cleavejs-rails 1.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +16 -0
- data/lib/cleavejs-rails.rb +7 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ac.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ad.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ae.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.af.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ag.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ai.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.al.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.am.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ao.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ar.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.as.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.at.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.au-cn.js +85 -0
- data/vendor/assets/javascripts/addons/cleave-phone.au.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.aw.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ax.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.az.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ba.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.bb.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.bd.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.be.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.bf.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.bg.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.bh.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.bi.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.bj.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.bl.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.bm.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.bn.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.bo.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.bq.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.br.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.bs.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.bt.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.bw.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.by.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.bz.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ca.js +111 -0
- data/vendor/assets/javascripts/addons/cleave-phone.cc.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.cd.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.cf.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.cg.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ch.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ci.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ck.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.cl.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.cm.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.cn.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.co.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.cr.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.cu.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.cv.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.cw.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.cx.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.cy.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.cz.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.de.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.dj.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.dk.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.dm.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.do.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.dz.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ec.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ee.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.eg.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.eh.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.er.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.es.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.et.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.fi.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.fj.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.fk.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.fm.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.fo.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.fr.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ga.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.gb.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.gd.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ge.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.gf.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.gg.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.gh.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.gi.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.gl.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.gm.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.gn.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.gp.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.gq.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.gr.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.gt.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.gu.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.gw.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.gy.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.hk.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.hn.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.hr.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ht.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.hu.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.i18n.js +58 -0
- data/vendor/assets/javascripts/addons/cleave-phone.id.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ie.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.il.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.im.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.in.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.io.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.iq.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ir.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.is.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.it.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.je.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.jm.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.jo.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.jp.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ke.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.kg.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.kh.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ki.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.km.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.kn.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.kp.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.kr.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.kw.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ky.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.kz.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.la.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.lb.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.lc.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.li.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.lk.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.lr.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ls.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.lt.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.lu.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.lv.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ly.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ma.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.mc.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.md.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.me.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.mf.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.mg.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.mh.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.mk.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ml.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.mm.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.mn.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.mo.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.mp.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.mq.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.mr.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ms.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.mt.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.mu.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.mv.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.mw.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.mx.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.my.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.mz.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.na.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.nc.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ne.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.nf.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ng.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ni.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.nl.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.no.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.np.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.nr.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.nu.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.nz.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.om.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.pa.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.pe.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.pf.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.pg.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ph.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.pk.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.pl.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.pm.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.pr.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ps.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.pt.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.pw.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.py.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.qa.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.re.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ro.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.rs.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ru.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.rw.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.sa.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.sb.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.sc.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.sd.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.se.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.sg.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.sh.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.si.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.sj.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.sk.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.sl.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.sm.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.sn.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.so.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.sr.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ss.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.st.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.sv.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.sx.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.sy.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.sz.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ta.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.tc.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.td.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.tg.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.th.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.tj.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.tk.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.tl.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.tm.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.tn.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.to.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.tr.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.tt.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.tv.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.tw.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.tz.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ua.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ug.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.us.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.uy.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.uz.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.va.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.vc.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ve.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.vg.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.vi.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.vn.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.vu.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.wf.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ws.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.ye.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.yt.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.za.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.zm.js +51 -0
- data/vendor/assets/javascripts/addons/cleave-phone.zw.js +51 -0
- data/vendor/assets/javascripts/cleave-angular.js +1292 -0
- data/vendor/assets/javascripts/cleave-angular.min.js +8 -0
- data/vendor/assets/javascripts/cleave-react-node.js +2443 -0
- data/vendor/assets/javascripts/cleave-react-node.min.js +8 -0
- data/vendor/assets/javascripts/cleave-react.js +2638 -0
- data/vendor/assets/javascripts/cleave-react.min.js +8 -0
- data/vendor/assets/javascripts/cleave.js +1235 -0
- data/vendor/assets/javascripts/cleave.min.js +8 -0
- metadata +343 -0
@@ -0,0 +1,8 @@
|
|
1
|
+
/*!
|
2
|
+
* cleave.js - 1.3.7
|
3
|
+
* https://github.com/nosir/cleave.js
|
4
|
+
* Apache License Version 2.0
|
5
|
+
*
|
6
|
+
* Copyright (C) 2012-2018 Max Huang https://github.com/nosir/
|
7
|
+
*/
|
8
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.Cleave=t(require("react")):e.Cleave=t(e.React)}(this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=n(1),a=n(2),s=n(9),c=n(10),l=n(11),u=n(12),p=n(13),d=n(14),m=a({componentDidMount:function(){this.init()},componentDidUpdate:function(){var e=this,t=e.properties;p.setSelection(e.element,e.state.cursorPosition,t.document)},componentWillReceiveProps:function(e){var t=this,n=(e.options||{}).phoneRegionCode,r=e.value;void 0!==r&&(r=r.toString(),r!==t.properties.initValue&&r!==t.properties.result&&(t.properties.initValue=r,t.onInput(r,!0))),n&&n!==t.properties.phoneRegionCode&&(t.properties.phoneRegionCode=n,t.initPhoneFormatter(),t.onInput(t.properties.result))},getInitialState:function(){var e=this,t=e.props,n=t.value,r=t.options,o=t.onKeyDown,i=t.onChange,a=t.onFocus,s=t.onBlur,c=t.onInit;return e.registeredEvents={onInit:c||p.noop,onChange:i||p.noop,onFocus:a||p.noop,onBlur:s||p.noop,onKeyDown:o||p.noop},r||(r={}),r.initValue=n,e.properties=d.assign({},r),{value:e.properties.result,cursorPosition:0}},init:function(){var e=this,t=e.properties;return t.numeral||t.phone||t.creditCard||t.date||0!==t.blocksLength||t.prefix?(t.maxLength=p.getMaxLength(t.blocks),e.isAndroid=p.isAndroid(),e.initPhoneFormatter(),e.initDateFormatter(),e.initNumeralFormatter(),(t.initValue||t.prefix&&!t.noImmediatePrefix)&&e.onInput(t.initValue),void e.registeredEvents.onInit(e)):(e.onInput(t.initValue),void e.registeredEvents.onInit(e))},initNumeralFormatter:function(){var e=this,t=e.properties;t.numeral&&(t.numeralFormatter=new s(t.numeralDecimalMark,t.numeralIntegerScale,t.numeralDecimalScale,t.numeralThousandsGroupStyle,t.numeralPositiveOnly,t.stripLeadingZeroes,t.delimiter))},initDateFormatter:function(){var e=this,t=e.properties;t.date&&(t.dateFormatter=new c(t.datePattern),t.blocks=t.dateFormatter.getBlocks(),t.blocksLength=t.blocks.length,t.maxLength=p.getMaxLength(t.blocks))},initPhoneFormatter:function(){var e=this,t=e.properties;if(t.phone)try{t.phoneFormatter=new l(new t.root.Cleave.AsYouTypeFormatter(t.phoneRegionCode),t.delimiter)}catch(n){throw new Error("Please include phone-type-formatter.{country}.js lib")}},setRawValue:function(e){var t=this,n=t.properties;e=void 0!==e&&null!==e?e.toString():"",n.numeral&&(e=e.replace(".",n.numeralDecimalMark)),n.backspace=!1,t.onChange({target:{value:e},stopPropagation:p.noop,preventDefault:p.noop,persist:p.noop})},getRawValue:function(){var e=this,t=e.properties,n=t.result;return t.rawValueTrimPrefix&&(n=p.getPrefixStrippedValue(n,t.prefix,t.prefixLength,t.result)),n=t.numeral?t.numeralFormatter?t.numeralFormatter.getRawValue(n):"":p.stripDelimiters(n,t.delimiter,t.delimiters)},getISOFormatDate:function(){var e=this,t=e.properties;return t.date?t.dateFormatter.getISOFormatDate():""},onInit:function(e){return e},onKeyDown:function(e){var t=this,n=t.properties,r=e.which||e.keyCode;8===r&&p.isDelimiter(n.result.slice(-n.delimiterLength),n.delimiter,n.delimiters)?n.backspace=!0:n.backspace=!1,t.registeredEvents.onKeyDown(e)},onFocus:function(e){var t=this,n=t.properties;e.target.rawValue=t.getRawValue(),e.target.value=n.result,t.registeredEvents.onFocus(e),p.fixPrefixCursor(t.element,n.prefix,n.delimiter,n.delimiters)},onBlur:function(e){var t=this,n=t.properties;e.target.rawValue=t.getRawValue(),e.target.value=n.result,t.registeredEvents.onBlur(e)},onChange:function(e){var t=this,n=t.properties;t.onInput(e.target.value),e.target.rawValue=t.getRawValue(),e.target.value=n.result,t.registeredEvents.onChange(e)},onInput:function(e,t){var n=this,r=n.properties;return p.isAndroidBackspaceKeydown(n.lastInputValue,n.element.value)&&p.isDelimiter(r.result.slice(-r.delimiterLength),r.delimiter,r.delimiters)&&(r.backspace=!0),t||r.numeral||!r.backspace||p.isDelimiter(e.slice(-r.delimiterLength),r.delimiter,r.delimiters)||(e=p.headStr(e,e.length-r.delimiterLength)),r.phone?(r.result=r.phoneFormatter.format(e),void n.updateValueState()):r.numeral?(!r.prefix||r.noImmediatePrefix&&!e.length?r.result=r.numeralFormatter.format(e):r.result=r.prefix+r.numeralFormatter.format(e),void n.updateValueState()):(r.date&&(e=r.dateFormatter.getValidatedDate(e)),e=p.stripDelimiters(e,r.delimiter,r.delimiters),e=p.getPrefixStrippedValue(e,r.prefix,r.prefixLength,r.result),e=r.numericOnly?p.strip(e,/[^\d]/g):e,e=r.uppercase?e.toUpperCase():e,e=r.lowercase?e.toLowerCase():e,!r.prefix||r.noImmediatePrefix&&!e.length||(e=r.prefix+e,0!==r.blocksLength)?(r.creditCard&&n.updateCreditCardPropsByValue(e),e=r.maxLength>0?p.headStr(e,r.maxLength):e,r.result=p.getFormattedValue(e,r.blocks,r.blocksLength,r.delimiter,r.delimiters,r.delimiterLazyShow),void n.updateValueState()):(r.result=e,void n.updateValueState()))},updateCreditCardPropsByValue:function(e){var t,n=this,r=n.properties;p.headStr(r.result,4)!==p.headStr(e,4)&&(t=u.getInfo(e,r.creditCardStrictMode),r.blocks=t.blocks,r.blocksLength=r.blocks.length,r.maxLength=p.getMaxLength(r.blocks),r.creditCardType!==t.type&&(r.creditCardType=t.type,r.onCreditCardTypeChanged.call(n,r.creditCardType)))},updateValueState:function(){var e=this,t=e.properties;e.element||e.setState({value:t.result});var n=e.element.selectionEnd,r=e.element.value,o=t.result;return e.lastInputValue=o,n=p.getNextCursorPosition(n,r,o,t.delimiter,t.delimiters),e.isAndroid?void window.setTimeout(function(){e.setState({value:o,cursorPosition:n})},1):void e.setState({value:o,cursorPosition:n})},render:function(){var e=this,t=e.props,n=(t.value,t.options,t.onKeyDown,t.onFocus,t.onBlur,t.onChange,t.onInit,t.htmlRef),a=r(t,["value","options","onKeyDown","onFocus","onBlur","onChange","onInit","htmlRef"]);return i.createElement("input",o({type:"text",ref:function(t){e.element=t,n&&n.apply(this,arguments)},value:e.state.value,onKeyDown:e.onKeyDown,onChange:e.onChange,onFocus:e.onFocus,onBlur:e.onBlur},a))}});e.exports=m},function(t,n){t.exports=e},function(e,t,n){"use strict";var r=n(1),o=n(3);if("undefined"==typeof r)throw Error("create-react-class could not find the React object. If you are using script tags, make sure that React is being loaded before create-react-class.");var i=(new r.Component).updater;e.exports=o(r.Component,r.isValidElement,i)},function(e,t,n){"use strict";function r(e){return e}function o(e,t,n){function o(e,t,n){for(var r in t)t.hasOwnProperty(r)&&"production"!==process.env.NODE_ENV&&c("function"==typeof t[r],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",e.displayName||"ReactClass",l[n],r)}function p(e,t){var n=b.hasOwnProperty(t)?b[t]:null;C.hasOwnProperty(t)&&s("OVERRIDE_BASE"===n,"ReactClassInterface: You are attempting to override `%s` from your class specification. Ensure that your method names do not overlap with React methods.",t),e&&s("DEFINE_MANY"===n||"DEFINE_MANY_MERGED"===n,"ReactClassInterface: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.",t)}function d(e,n){if(n){s("function"!=typeof n,"ReactClass: You're attempting to use a component class or function as a mixin. Instead, just use a regular object."),s(!t(n),"ReactClass: You're attempting to use a component as a mixin. Instead, just use a regular object.");var r=e.prototype,o=r.__reactAutoBindPairs;n.hasOwnProperty(u)&&x.mixins(e,n.mixins);for(var i in n)if(n.hasOwnProperty(i)&&i!==u){var a=n[i],l=r.hasOwnProperty(i);if(p(l,i),x.hasOwnProperty(i))x[i](e,a);else{var d=b.hasOwnProperty(i),m="function"==typeof a,f=m&&!d&&!l&&n.autobind!==!1;if(f)o.push(i,a),r[i]=a;else if(l){var y=b[i];s(d&&("DEFINE_MANY_MERGED"===y||"DEFINE_MANY"===y),"ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.",y,i),"DEFINE_MANY_MERGED"===y?r[i]=h(r[i],a):"DEFINE_MANY"===y&&(r[i]=g(r[i],a))}else r[i]=a,"production"!==process.env.NODE_ENV&&"function"==typeof a&&n.displayName&&(r[i].displayName=n.displayName+"_"+i)}}}else if("production"!==process.env.NODE_ENV){var v=typeof n,E="object"===v&&null!==n;"production"!==process.env.NODE_ENV&&c(E,"%s: You're attempting to include a mixin that is either null or not an object. Check the mixins included by the component, as well as any mixins they include themselves. Expected object but got %s.",e.displayName||"ReactClass",null===n?null:v)}}function m(e,t){if(t)for(var n in t){var r=t[n];if(t.hasOwnProperty(n)){var o=n in x;s(!o,'ReactClass: You are attempting to define a reserved property, `%s`, that shouldn\'t be on the "statics" key. Define it as an instance property instead; it will still be accessible on the constructor.',n);var i=n in e;s(!i,"ReactClass: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.",n),e[n]=r}}}function f(e,t){s(e&&t&&"object"==typeof e&&"object"==typeof t,"mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.");for(var n in t)t.hasOwnProperty(n)&&(s(void 0===e[n],"mergeIntoWithNoDuplicateKeys(): Tried to merge two objects with the same key: `%s`. This conflict may be due to a mixin; in particular, this may be caused by two getInitialState() or getDefaultProps() methods returning objects with clashing keys.",n),e[n]=t[n]);return e}function h(e,t){return function(){var n=e.apply(this,arguments),r=t.apply(this,arguments);if(null==n)return r;if(null==r)return n;var o={};return f(o,n),f(o,r),o}}function g(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function y(e,t){var n=t.bind(e);if("production"!==process.env.NODE_ENV){n.__reactBoundContext=e,n.__reactBoundMethod=t,n.__reactBoundArguments=null;var r=e.constructor.displayName,o=n.bind;n.bind=function(i){for(var a=arguments.length,s=Array(a>1?a-1:0),l=1;l<a;l++)s[l-1]=arguments[l];if(i!==e&&null!==i)"production"!==process.env.NODE_ENV&&c(!1,"bind(): React component methods may only be bound to the component instance. See %s",r);else if(!s.length)return"production"!==process.env.NODE_ENV&&c(!1,"bind(): You are binding a component method to the component. React does this for you automatically in a high-performance way, so you can safely remove this call. See %s",r),n;var u=o.apply(n,arguments);return u.__reactBoundContext=e,u.__reactBoundMethod=t,u.__reactBoundArguments=s,u}}return n}function v(e){for(var t=e.__reactAutoBindPairs,n=0;n<t.length;n+=2){var r=t[n],o=t[n+1];e[r]=y(e,o)}}function E(e){var t=r(function(e,r,o){"production"!==process.env.NODE_ENV&&c(this instanceof t,"Something is calling a React component directly. Use a factory or JSX instead. See: https://fb.me/react-legacyfactory"),this.__reactAutoBindPairs.length&&v(this),this.props=e,this.context=r,this.refs=a,this.updater=o||n,this.state=null;var i=this.getInitialState?this.getInitialState():null;"production"!==process.env.NODE_ENV&&void 0===i&&this.getInitialState._isMockFunction&&(i=null),s("object"==typeof i&&!Array.isArray(i),"%s.getInitialState(): must return an object or null",t.displayName||"ReactCompositeComponent"),this.state=i});t.prototype=new S,t.prototype.constructor=t,t.prototype.__reactAutoBindPairs=[],D.forEach(d.bind(null,t)),d(t,N),d(t,e),d(t,w),t.getDefaultProps&&(t.defaultProps=t.getDefaultProps()),"production"!==process.env.NODE_ENV&&(t.getDefaultProps&&(t.getDefaultProps.isReactClassApproved={}),t.prototype.getInitialState&&(t.prototype.getInitialState.isReactClassApproved={})),s(t.prototype.render,"createClass(...): Class specification must implement a `render` method."),"production"!==process.env.NODE_ENV&&(c(!t.prototype.componentShouldUpdate,"%s has a method called componentShouldUpdate(). Did you mean shouldComponentUpdate()? The name is phrased as a question because the function is expected to return a value.",e.displayName||"A component"),c(!t.prototype.componentWillRecieveProps,"%s has a method called componentWillRecieveProps(). Did you mean componentWillReceiveProps()?",e.displayName||"A component"));for(var o in b)t.prototype[o]||(t.prototype[o]=null);return t}var D=[],b={mixins:"DEFINE_MANY",statics:"DEFINE_MANY",propTypes:"DEFINE_MANY",contextTypes:"DEFINE_MANY",childContextTypes:"DEFINE_MANY",getDefaultProps:"DEFINE_MANY_MERGED",getInitialState:"DEFINE_MANY_MERGED",getChildContext:"DEFINE_MANY_MERGED",render:"DEFINE_ONCE",componentWillMount:"DEFINE_MANY",componentDidMount:"DEFINE_MANY",componentWillReceiveProps:"DEFINE_MANY",shouldComponentUpdate:"DEFINE_ONCE",componentWillUpdate:"DEFINE_MANY",componentDidUpdate:"DEFINE_MANY",componentWillUnmount:"DEFINE_MANY",updateComponent:"OVERRIDE_BASE"},x={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var n=0;n<t.length;n++)d(e,t[n])},childContextTypes:function(e,t){"production"!==process.env.NODE_ENV&&o(e,t,"childContext"),e.childContextTypes=i({},e.childContextTypes,t)},contextTypes:function(e,t){"production"!==process.env.NODE_ENV&&o(e,t,"context"),e.contextTypes=i({},e.contextTypes,t)},getDefaultProps:function(e,t){e.getDefaultProps?e.getDefaultProps=h(e.getDefaultProps,t):e.getDefaultProps=t},propTypes:function(e,t){"production"!==process.env.NODE_ENV&&o(e,t,"prop"),e.propTypes=i({},e.propTypes,t)},statics:function(e,t){m(e,t)},autobind:function(){}},N={componentDidMount:function(){this.__isMounted=!0}},w={componentWillUnmount:function(){this.__isMounted=!1}},C={replaceState:function(e,t){this.updater.enqueueReplaceState(this,e,t)},isMounted:function(){return"production"!==process.env.NODE_ENV&&(c(this.__didWarnIsMounted,"%s: isMounted is deprecated. Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks.",this.constructor&&this.constructor.displayName||this.name||"Component"),this.__didWarnIsMounted=!0),!!this.__isMounted}},S=function(){};return i(S.prototype,e.prototype,C),E}var i=n(4),a=n(5),s=n(6);if("production"!==process.env.NODE_ENV)var c=n(7);var l,u="mixins";l="production"!==process.env.NODE_ENV?{prop:"prop",context:"context",childContext:"child context"}:{},e.exports=o},function(e,t){"use strict";function n(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function r(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;var r=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==r.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(i){return!1}}var o=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=r()?Object.assign:function(e,t){for(var r,s,c=n(e),l=1;l<arguments.length;l++){r=Object(arguments[l]);for(var u in r)i.call(r,u)&&(c[u]=r[u]);if(o){s=o(r);for(var p=0;p<s.length;p++)a.call(r,s[p])&&(c[s[p]]=r[s[p]])}}return c}},function(e,t){"use strict";var n={};"production"!==process.env.NODE_ENV&&Object.freeze(n),e.exports=n},function(e,t){"use strict";function n(e,t,n,o,i,a,s,c){if(r(t),!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[n,o,i,a,s,c],p=0;l=new Error(t.replace(/%s/g,function(){return u[p++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}}var r=function(e){};"production"!==process.env.NODE_ENV&&(r=function(e){if(void 0===e)throw new Error("invariant requires an error message argument")}),e.exports=n},function(e,t,n){"use strict";var r=n(8),o=r;if("production"!==process.env.NODE_ENV){var i=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=0,i="Warning: "+e.replace(/%s/g,function(){return n[o++]});"undefined"!=typeof console&&console.error(i);try{throw new Error(i)}catch(a){}};o=function(e,t){if(void 0===t)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==t.indexOf("Failed Composite propType: ")&&!e){for(var n=arguments.length,r=Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];i.apply(void 0,[t].concat(r))}}}e.exports=o},function(e,t){"use strict";function n(e){return function(){return e}}var r=function(){};r.thatReturns=n,r.thatReturnsFalse=n(!1),r.thatReturnsTrue=n(!0),r.thatReturnsNull=n(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},e.exports=r},function(e,t){"use strict";var n=function r(e,t,n,o,i,a,s){var c=this;c.numeralDecimalMark=e||".",c.numeralIntegerScale=t>0?t:0,c.numeralDecimalScale=n>=0?n:2,c.numeralThousandsGroupStyle=o||r.groupStyle.thousand,c.numeralPositiveOnly=!!i,c.stripLeadingZeroes=a!==!1,c.delimiter=s||""===s?s:",",c.delimiterRE=s?new RegExp("\\"+s,"g"):""};n.groupStyle={thousand:"thousand",lakh:"lakh",wan:"wan",none:"none"},n.prototype={getRawValue:function(e){return e.replace(this.delimiterRE,"").replace(this.numeralDecimalMark,".")},format:function(e){var t,r,o=this,i="";switch(e=e.replace(/[A-Za-z]/g,"").replace(o.numeralDecimalMark,"M").replace(/[^\dM-]/g,"").replace(/^\-/,"N").replace(/\-/g,"").replace("N",o.numeralPositiveOnly?"":"-").replace("M",o.numeralDecimalMark),o.stripLeadingZeroes&&(e=e.replace(/^(-)?0+(?=\d)/,"$1")),r=e,e.indexOf(o.numeralDecimalMark)>=0&&(t=e.split(o.numeralDecimalMark),r=t[0],i=o.numeralDecimalMark+t[1].slice(0,o.numeralDecimalScale)),o.numeralIntegerScale>0&&(r=r.slice(0,o.numeralIntegerScale+("-"===e.slice(0,1)?1:0))),o.numeralThousandsGroupStyle){case n.groupStyle.lakh:r=r.replace(/(\d)(?=(\d\d)+\d$)/g,"$1"+o.delimiter);break;case n.groupStyle.wan:r=r.replace(/(\d)(?=(\d{4})+$)/g,"$1"+o.delimiter);break;case n.groupStyle.thousand:r=r.replace(/(\d)(?=(\d{3})+$)/g,"$1"+o.delimiter)}return r.toString()+(o.numeralDecimalScale>0?i.toString():"")}},e.exports=n},function(e,t){"use strict";var n=function(e){var t=this;t.date=[],t.blocks=[],t.datePattern=e,t.initBlocks()};n.prototype={initBlocks:function(){var e=this;e.datePattern.forEach(function(t){"Y"===t?e.blocks.push(4):e.blocks.push(2)})},getISOFormatDate:function(){var e=this,t=e.date;return t[2]?t[2]+"-"+e.addLeadingZero(t[1])+"-"+e.addLeadingZero(t[0]):""},getBlocks:function(){return this.blocks},getValidatedDate:function(e){var t=this,n="";return e=e.replace(/[^\d]/g,""),t.blocks.forEach(function(r,o){if(e.length>0){var i=e.slice(0,r),a=i.slice(0,1),s=e.slice(r);switch(t.datePattern[o]){case"d":"00"===i?i="01":parseInt(a,10)>3?i="0"+a:parseInt(i,10)>31&&(i="31");break;case"m":"00"===i?i="01":parseInt(a,10)>1?i="0"+a:parseInt(i,10)>12&&(i="12")}n+=i,e=s}}),this.getFixedDateString(n)},getFixedDateString:function(e){var t,n,r,o=this,i=o.datePattern,a=[],s=0,c=0,l=0,u=0,p=0,d=0,m=!1;return 4===e.length&&"y"!==i[0].toLowerCase()&&"y"!==i[1].toLowerCase()&&(u="d"===i[0]?0:2,p=2-u,t=parseInt(e.slice(u,u+2),10),n=parseInt(e.slice(p,p+2),10),a=this.getFixedDate(t,n,0)),8===e.length&&(i.forEach(function(e,t){switch(e){case"d":s=t;break;case"m":c=t;break;default:l=t}}),d=2*l,u=s<=l?2*s:2*s+2,p=c<=l?2*c:2*c+2,t=parseInt(e.slice(u,u+2),10),n=parseInt(e.slice(p,p+2),10),r=parseInt(e.slice(d,d+4),10),m=4===e.slice(d,d+4).length,a=this.getFixedDate(t,n,r)),o.date=a,0===a.length?e:i.reduce(function(e,t){switch(t){case"d":return e+o.addLeadingZero(a[0]);case"m":return e+o.addLeadingZero(a[1]);default:return e+(m?o.addLeadingZeroForYear(a[2]):"")}},"")},getFixedDate:function(e,t,n){return e=Math.min(e,31),t=Math.min(t,12),n=parseInt(n||0,10),(t<7&&t%2===0||t>8&&t%2===1)&&(e=Math.min(e,2===t?this.isLeapYear(n)?29:28:30)),[e,t,n]},isLeapYear:function(e){return e%4===0&&e%100!==0||e%400===0},addLeadingZero:function(e){return(e<10?"0":"")+e},addLeadingZeroForYear:function(e){return(e<10?"000":e<100?"00":e<1e3?"0":"")+e}},e.exports=n},function(e,t){"use strict";var n=function(e,t){var n=this;n.delimiter=t||""===t?t:" ",n.delimiterRE=t?new RegExp("\\"+t,"g"):"",n.formatter=e};n.prototype={setFormatter:function(e){this.formatter=e},format:function(e){var t=this;t.formatter.clear(),e=e.replace(/[^\d+]/g,""),e=e.replace(t.delimiterRE,"");for(var n,r="",o=!1,i=0,a=e.length;i<a;i++)n=t.formatter.inputDigit(e.charAt(i)),/[\s()-]/g.test(n)?(r=n,o=!0):o||(r=n);return r=r.replace(/[()]/g,""),r=r.replace(/[\s-]/g,t.delimiter)}},e.exports=n},function(e,t){"use strict";var n={blocks:{uatp:[4,5,6],amex:[4,6,5],diners:[4,6,4],discover:[4,4,4,4],mastercard:[4,4,4,4],dankort:[4,4,4,4],instapayment:[4,4,4,4],jcb15:[4,6,5],jcb:[4,4,4,4],maestro:[4,4,4,4],visa:[4,4,4,4],mir:[4,4,4,4],unionPay:[4,4,4,4],general:[4,4,4,4],generalStrict:[4,4,4,7]},re:{uatp:/^(?!1800)1\d{0,14}/,amex:/^3[47]\d{0,13}/,discover:/^(?:6011|65\d{0,2}|64[4-9]\d?)\d{0,12}/,diners:/^3(?:0([0-5]|9)|[689]\d?)\d{0,11}/,mastercard:/^(5[1-5]\d{0,2}|22[2-9]\d{0,1}|2[3-7]\d{0,2})\d{0,12}/,dankort:/^(5019|4175|4571)\d{0,12}/,instapayment:/^63[7-9]\d{0,13}/,jcb15:/^(?:2131|1800)\d{0,11}/,jcb:/^(?:35\d{0,2})\d{0,12}/,maestro:/^(?:5[0678]\d{0,2}|6304|67\d{0,2})\d{0,12}/,mir:/^220[0-4]\d{0,12}/,visa:/^4\d{0,15}/,unionPay:/^62\d{0,14}/},getInfo:function(e,t){var r=n.blocks,o=n.re;t=!!t;for(var i in o)if(o[i].test(e)){var a;return a=t?r.generalStrict:r[i],{type:i,blocks:a}}return{type:"unknown",blocks:t?r.generalStrict:r.general}}};e.exports=n},function(e,t){"use strict";var n={noop:function(){},strip:function(e,t){return e.replace(t,"")},isDelimiter:function(e,t,n){return 0===n.length?e===t:n.some(function(t){if(e===t)return!0})},getDelimiterREByDelimiter:function(e){return new RegExp(e.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),"g")},getNextCursorPosition:function(e,t,n,r,o){return t.length===e?n.length:e+this.getPositionOffset(e,t,n,r,o)},getPositionOffset:function(e,t,n,r,o){var i,a,s;return i=this.stripDelimiters(t.slice(0,e),r,o),a=this.stripDelimiters(n.slice(0,e),r,o),s=i.length-a.length,0!==s?s/Math.abs(s):0},stripDelimiters:function(e,t,n){var r=this;if(0===n.length){var o=t?r.getDelimiterREByDelimiter(t):"";return e.replace(o,"")}return n.forEach(function(t){e=e.replace(r.getDelimiterREByDelimiter(t),"")}),e},headStr:function(e,t){return e.slice(0,t)},getMaxLength:function(e){return e.reduce(function(e,t){return e+t},0)},getPrefixStrippedValue:function(e,t,n,r){if(e.slice(0,n)!==t)if(e.length<r.length)e=e.length>n?r:t;else{var o=this.getFirstDiffIndex(t,e.slice(0,n));e=t+e.slice(o,o+1)+e.slice(n+1)}return e.slice(n)},getFirstDiffIndex:function(e,t){for(var n=0;e.charAt(n)===t.charAt(n);)if(""===e.charAt(n++))return-1;return n},getFormattedValue:function(e,t,n,r,o,i){var a,s="",c=o.length>0;return 0===n?e:(t.forEach(function(t,l){if(e.length>0){var u=e.slice(0,t),p=e.slice(t);a=c?o[i?l-1:l]||a:r,i?(l>0&&(s+=a),s+=u):(s+=u,u.length===t&&l<n-1&&(s+=a)),e=p}}),s)},fixPrefixCursor:function(e,t,n,r){if(e){var o=e.value,i=n||r[0]||" ";if(e.setSelectionRange&&t&&!(t.length+i.length<o.length)){var a=2*o.length;setTimeout(function(){e.setSelectionRange(a,a)},1)}}},setSelection:function(e,t,n){if(e===n.activeElement&&!(e&&e.value.length<=t))if(e.createTextRange){var r=e.createTextRange();r.move("character",t),r.select()}else try{e.setSelectionRange(t,t)}catch(o){console.warn("The input element type does not support selection")}},isAndroid:function(){return navigator&&/android/i.test(navigator.userAgent)},isAndroidBackspaceKeydown:function(e,t){return!!(this.isAndroid()&&e&&t)&&t===e.slice(0,-1)}};e.exports=n},function(e,t){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r={assign:function(e,t){return e=e||{},t=t||{},e.creditCard=!!t.creditCard,e.creditCardStrictMode=!!t.creditCardStrictMode,e.creditCardType="",e.onCreditCardTypeChanged=t.onCreditCardTypeChanged||function(){},e.phone=!!t.phone,e.phoneRegionCode=t.phoneRegionCode||"AU",e.phoneFormatter={},e.date=!!t.date,e.datePattern=t.datePattern||["d","m","Y"],e.dateFormatter={},e.numeral=!!t.numeral,e.numeralIntegerScale=t.numeralIntegerScale>0?t.numeralIntegerScale:0,e.numeralDecimalScale=t.numeralDecimalScale>=0?t.numeralDecimalScale:2,e.numeralDecimalMark=t.numeralDecimalMark||".",e.numeralThousandsGroupStyle=t.numeralThousandsGroupStyle||"thousand",e.numeralPositiveOnly=!!t.numeralPositiveOnly,e.stripLeadingZeroes=t.stripLeadingZeroes!==!1,e.numericOnly=e.creditCard||e.date||!!t.numericOnly,e.uppercase=!!t.uppercase,e.lowercase=!!t.lowercase,e.prefix=e.creditCard||e.date?"":t.prefix||"",e.noImmediatePrefix=!!t.noImmediatePrefix,e.prefixLength=e.prefix.length,e.rawValueTrimPrefix=!!t.rawValueTrimPrefix,e.copyDelimiter=!!t.copyDelimiter,e.initValue=void 0!==t.initValue&&null!==t.initValue?t.initValue.toString():"",e.delimiter=t.delimiter||""===t.delimiter?t.delimiter:t.date?"/":t.numeral?",":(t.phone," "),e.delimiterLength=e.delimiter.length,e.delimiterLazyShow=!!t.delimiterLazyShow,e.delimiters=t.delimiters||[],e.blocks=t.blocks||[],e.blocksLength=e.blocks.length,e.document=t.document||document,e.root="object"===("undefined"==typeof global?"undefined":n(global))&&global?global:window,e.maxLength=0,e.backspace=!1,e.result="",e.onValueChanged=t.onValueChanged||function(){},e}};e.exports=r}])});
|
@@ -0,0 +1,2638 @@
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
2
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
3
|
+
module.exports = factory(require("react"));
|
4
|
+
else if(typeof define === 'function' && define.amd)
|
5
|
+
define(["react"], factory);
|
6
|
+
else if(typeof exports === 'object')
|
7
|
+
exports["Cleave"] = factory(require("react"));
|
8
|
+
else
|
9
|
+
root["Cleave"] = factory(root["React"]);
|
10
|
+
})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) {
|
11
|
+
return /******/ (function(modules) { // webpackBootstrap
|
12
|
+
/******/ // The module cache
|
13
|
+
/******/ var installedModules = {};
|
14
|
+
|
15
|
+
/******/ // The require function
|
16
|
+
/******/ function __webpack_require__(moduleId) {
|
17
|
+
|
18
|
+
/******/ // Check if module is in cache
|
19
|
+
/******/ if(installedModules[moduleId])
|
20
|
+
/******/ return installedModules[moduleId].exports;
|
21
|
+
|
22
|
+
/******/ // Create a new module (and put it into the cache)
|
23
|
+
/******/ var module = installedModules[moduleId] = {
|
24
|
+
/******/ exports: {},
|
25
|
+
/******/ id: moduleId,
|
26
|
+
/******/ loaded: false
|
27
|
+
/******/ };
|
28
|
+
|
29
|
+
/******/ // Execute the module function
|
30
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
31
|
+
|
32
|
+
/******/ // Flag the module as loaded
|
33
|
+
/******/ module.loaded = true;
|
34
|
+
|
35
|
+
/******/ // Return the exports of the module
|
36
|
+
/******/ return module.exports;
|
37
|
+
/******/ }
|
38
|
+
|
39
|
+
|
40
|
+
/******/ // expose the modules object (__webpack_modules__)
|
41
|
+
/******/ __webpack_require__.m = modules;
|
42
|
+
|
43
|
+
/******/ // expose the module cache
|
44
|
+
/******/ __webpack_require__.c = installedModules;
|
45
|
+
|
46
|
+
/******/ // __webpack_public_path__
|
47
|
+
/******/ __webpack_require__.p = "";
|
48
|
+
|
49
|
+
/******/ // Load entry module and return exports
|
50
|
+
/******/ return __webpack_require__(0);
|
51
|
+
/******/ })
|
52
|
+
/************************************************************************/
|
53
|
+
/******/ ([
|
54
|
+
/* 0 */
|
55
|
+
/***/ (function(module, exports, __webpack_require__) {
|
56
|
+
|
57
|
+
'use strict';
|
58
|
+
|
59
|
+
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
60
|
+
|
61
|
+
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
62
|
+
|
63
|
+
var React = __webpack_require__(1); // eslint-disable-line no-unused-vars
|
64
|
+
var CreateReactClass = __webpack_require__(2);
|
65
|
+
|
66
|
+
var NumeralFormatter = __webpack_require__(10);
|
67
|
+
var DateFormatter = __webpack_require__(11);
|
68
|
+
var PhoneFormatter = __webpack_require__(12);
|
69
|
+
var CreditCardDetector = __webpack_require__(13);
|
70
|
+
var Util = __webpack_require__(14);
|
71
|
+
var DefaultProperties = __webpack_require__(15);
|
72
|
+
|
73
|
+
var cleaveReactClass = CreateReactClass({
|
74
|
+
componentDidMount: function componentDidMount() {
|
75
|
+
this.init();
|
76
|
+
},
|
77
|
+
|
78
|
+
componentDidUpdate: function componentDidUpdate() {
|
79
|
+
var owner = this,
|
80
|
+
pps = owner.properties;
|
81
|
+
|
82
|
+
Util.setSelection(owner.element, owner.state.cursorPosition, pps.document);
|
83
|
+
},
|
84
|
+
|
85
|
+
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
|
86
|
+
var owner = this,
|
87
|
+
phoneRegionCode = (nextProps.options || {}).phoneRegionCode,
|
88
|
+
newValue = nextProps.value;
|
89
|
+
|
90
|
+
if (newValue !== undefined) {
|
91
|
+
newValue = newValue.toString();
|
92
|
+
|
93
|
+
if (newValue !== owner.properties.initValue && newValue !== owner.properties.result) {
|
94
|
+
owner.properties.initValue = newValue;
|
95
|
+
owner.onInput(newValue, true);
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
// update phone region code
|
100
|
+
if (phoneRegionCode && phoneRegionCode !== owner.properties.phoneRegionCode) {
|
101
|
+
owner.properties.phoneRegionCode = phoneRegionCode;
|
102
|
+
owner.initPhoneFormatter();
|
103
|
+
owner.onInput(owner.properties.result);
|
104
|
+
}
|
105
|
+
},
|
106
|
+
|
107
|
+
getInitialState: function getInitialState() {
|
108
|
+
var owner = this,
|
109
|
+
_owner$props = owner.props,
|
110
|
+
value = _owner$props.value,
|
111
|
+
options = _owner$props.options,
|
112
|
+
onKeyDown = _owner$props.onKeyDown,
|
113
|
+
onChange = _owner$props.onChange,
|
114
|
+
onFocus = _owner$props.onFocus,
|
115
|
+
onBlur = _owner$props.onBlur,
|
116
|
+
onInit = _owner$props.onInit;
|
117
|
+
|
118
|
+
|
119
|
+
owner.registeredEvents = {
|
120
|
+
onInit: onInit || Util.noop,
|
121
|
+
onChange: onChange || Util.noop,
|
122
|
+
onFocus: onFocus || Util.noop,
|
123
|
+
onBlur: onBlur || Util.noop,
|
124
|
+
onKeyDown: onKeyDown || Util.noop
|
125
|
+
};
|
126
|
+
|
127
|
+
if (!options) {
|
128
|
+
options = {};
|
129
|
+
}
|
130
|
+
|
131
|
+
options.initValue = value;
|
132
|
+
|
133
|
+
owner.properties = DefaultProperties.assign({}, options);
|
134
|
+
|
135
|
+
return {
|
136
|
+
value: owner.properties.result,
|
137
|
+
cursorPosition: 0
|
138
|
+
};
|
139
|
+
},
|
140
|
+
|
141
|
+
init: function init() {
|
142
|
+
var owner = this,
|
143
|
+
pps = owner.properties;
|
144
|
+
|
145
|
+
// so no need for this lib at all
|
146
|
+
if (!pps.numeral && !pps.phone && !pps.creditCard && !pps.date && pps.blocksLength === 0 && !pps.prefix) {
|
147
|
+
owner.onInput(pps.initValue);
|
148
|
+
owner.registeredEvents.onInit(owner);
|
149
|
+
|
150
|
+
return;
|
151
|
+
}
|
152
|
+
|
153
|
+
pps.maxLength = Util.getMaxLength(pps.blocks);
|
154
|
+
|
155
|
+
owner.isAndroid = Util.isAndroid();
|
156
|
+
|
157
|
+
owner.initPhoneFormatter();
|
158
|
+
owner.initDateFormatter();
|
159
|
+
owner.initNumeralFormatter();
|
160
|
+
|
161
|
+
// avoid touch input field if value is null
|
162
|
+
// otherwise Firefox will add red box-shadow for <input required />
|
163
|
+
if (pps.initValue || pps.prefix && !pps.noImmediatePrefix) {
|
164
|
+
owner.onInput(pps.initValue);
|
165
|
+
}
|
166
|
+
|
167
|
+
owner.registeredEvents.onInit(owner);
|
168
|
+
},
|
169
|
+
|
170
|
+
initNumeralFormatter: function initNumeralFormatter() {
|
171
|
+
var owner = this,
|
172
|
+
pps = owner.properties;
|
173
|
+
|
174
|
+
if (!pps.numeral) {
|
175
|
+
return;
|
176
|
+
}
|
177
|
+
|
178
|
+
pps.numeralFormatter = new NumeralFormatter(pps.numeralDecimalMark, pps.numeralIntegerScale, pps.numeralDecimalScale, pps.numeralThousandsGroupStyle, pps.numeralPositiveOnly, pps.stripLeadingZeroes, pps.delimiter);
|
179
|
+
},
|
180
|
+
|
181
|
+
initDateFormatter: function initDateFormatter() {
|
182
|
+
var owner = this,
|
183
|
+
pps = owner.properties;
|
184
|
+
|
185
|
+
if (!pps.date) {
|
186
|
+
return;
|
187
|
+
}
|
188
|
+
|
189
|
+
pps.dateFormatter = new DateFormatter(pps.datePattern);
|
190
|
+
pps.blocks = pps.dateFormatter.getBlocks();
|
191
|
+
pps.blocksLength = pps.blocks.length;
|
192
|
+
pps.maxLength = Util.getMaxLength(pps.blocks);
|
193
|
+
},
|
194
|
+
|
195
|
+
initPhoneFormatter: function initPhoneFormatter() {
|
196
|
+
var owner = this,
|
197
|
+
pps = owner.properties;
|
198
|
+
|
199
|
+
if (!pps.phone) {
|
200
|
+
return;
|
201
|
+
}
|
202
|
+
|
203
|
+
// Cleave.AsYouTypeFormatter should be provided by
|
204
|
+
// external google closure lib
|
205
|
+
try {
|
206
|
+
pps.phoneFormatter = new PhoneFormatter(new pps.root.Cleave.AsYouTypeFormatter(pps.phoneRegionCode), pps.delimiter);
|
207
|
+
} catch (ex) {
|
208
|
+
throw new Error('Please include phone-type-formatter.{country}.js lib');
|
209
|
+
}
|
210
|
+
},
|
211
|
+
|
212
|
+
setRawValue: function setRawValue(value) {
|
213
|
+
var owner = this,
|
214
|
+
pps = owner.properties;
|
215
|
+
|
216
|
+
value = value !== undefined && value !== null ? value.toString() : '';
|
217
|
+
|
218
|
+
if (pps.numeral) {
|
219
|
+
value = value.replace('.', pps.numeralDecimalMark);
|
220
|
+
}
|
221
|
+
|
222
|
+
pps.backspace = false;
|
223
|
+
|
224
|
+
owner.onChange({
|
225
|
+
target: { value: value },
|
226
|
+
|
227
|
+
// Methods to better resemble a SyntheticEvent
|
228
|
+
stopPropagation: Util.noop,
|
229
|
+
preventDefault: Util.noop,
|
230
|
+
persist: Util.noop
|
231
|
+
});
|
232
|
+
},
|
233
|
+
|
234
|
+
getRawValue: function getRawValue() {
|
235
|
+
var owner = this,
|
236
|
+
pps = owner.properties,
|
237
|
+
rawValue = pps.result;
|
238
|
+
|
239
|
+
if (pps.rawValueTrimPrefix) {
|
240
|
+
rawValue = Util.getPrefixStrippedValue(rawValue, pps.prefix, pps.prefixLength, pps.result);
|
241
|
+
}
|
242
|
+
|
243
|
+
if (pps.numeral) {
|
244
|
+
rawValue = pps.numeralFormatter ? pps.numeralFormatter.getRawValue(rawValue) : '';
|
245
|
+
} else {
|
246
|
+
rawValue = Util.stripDelimiters(rawValue, pps.delimiter, pps.delimiters);
|
247
|
+
}
|
248
|
+
|
249
|
+
return rawValue;
|
250
|
+
},
|
251
|
+
|
252
|
+
getISOFormatDate: function getISOFormatDate() {
|
253
|
+
var owner = this,
|
254
|
+
pps = owner.properties;
|
255
|
+
|
256
|
+
return pps.date ? pps.dateFormatter.getISOFormatDate() : '';
|
257
|
+
},
|
258
|
+
|
259
|
+
onInit: function onInit(owner) {
|
260
|
+
return owner;
|
261
|
+
},
|
262
|
+
|
263
|
+
onKeyDown: function onKeyDown(event) {
|
264
|
+
var owner = this,
|
265
|
+
pps = owner.properties,
|
266
|
+
charCode = event.which || event.keyCode;
|
267
|
+
|
268
|
+
// hit backspace when last character is delimiter
|
269
|
+
if (charCode === 8 && Util.isDelimiter(pps.result.slice(-pps.delimiterLength), pps.delimiter, pps.delimiters)) {
|
270
|
+
pps.backspace = true;
|
271
|
+
} else {
|
272
|
+
pps.backspace = false;
|
273
|
+
}
|
274
|
+
|
275
|
+
owner.registeredEvents.onKeyDown(event);
|
276
|
+
},
|
277
|
+
|
278
|
+
onFocus: function onFocus(event) {
|
279
|
+
var owner = this,
|
280
|
+
pps = owner.properties;
|
281
|
+
|
282
|
+
event.target.rawValue = owner.getRawValue();
|
283
|
+
event.target.value = pps.result;
|
284
|
+
|
285
|
+
owner.registeredEvents.onFocus(event);
|
286
|
+
|
287
|
+
Util.fixPrefixCursor(owner.element, pps.prefix, pps.delimiter, pps.delimiters);
|
288
|
+
},
|
289
|
+
|
290
|
+
onBlur: function onBlur(event) {
|
291
|
+
var owner = this,
|
292
|
+
pps = owner.properties;
|
293
|
+
|
294
|
+
event.target.rawValue = owner.getRawValue();
|
295
|
+
event.target.value = pps.result;
|
296
|
+
|
297
|
+
owner.registeredEvents.onBlur(event);
|
298
|
+
},
|
299
|
+
|
300
|
+
onChange: function onChange(event) {
|
301
|
+
var owner = this,
|
302
|
+
pps = owner.properties;
|
303
|
+
|
304
|
+
owner.onInput(event.target.value);
|
305
|
+
|
306
|
+
event.target.rawValue = owner.getRawValue();
|
307
|
+
event.target.value = pps.result;
|
308
|
+
|
309
|
+
owner.registeredEvents.onChange(event);
|
310
|
+
},
|
311
|
+
|
312
|
+
onInput: function onInput(value, fromProps) {
|
313
|
+
var owner = this,
|
314
|
+
pps = owner.properties;
|
315
|
+
|
316
|
+
if (Util.isAndroidBackspaceKeydown(owner.lastInputValue, owner.element.value) && Util.isDelimiter(pps.result.slice(-pps.delimiterLength), pps.delimiter, pps.delimiters)) {
|
317
|
+
pps.backspace = true;
|
318
|
+
}
|
319
|
+
|
320
|
+
// case 1: delete one more character "4"
|
321
|
+
// 1234*| -> hit backspace -> 123|
|
322
|
+
// case 2: last character is not delimiter which is:
|
323
|
+
// 12|34* -> hit backspace -> 1|34*
|
324
|
+
|
325
|
+
if (!fromProps && !pps.numeral && pps.backspace && !Util.isDelimiter(value.slice(-pps.delimiterLength), pps.delimiter, pps.delimiters)) {
|
326
|
+
value = Util.headStr(value, value.length - pps.delimiterLength);
|
327
|
+
}
|
328
|
+
|
329
|
+
// phone formatter
|
330
|
+
if (pps.phone) {
|
331
|
+
pps.result = pps.phoneFormatter.format(value);
|
332
|
+
owner.updateValueState();
|
333
|
+
|
334
|
+
return;
|
335
|
+
}
|
336
|
+
|
337
|
+
// numeral formatter
|
338
|
+
if (pps.numeral) {
|
339
|
+
if (pps.prefix && (!pps.noImmediatePrefix || value.length)) {
|
340
|
+
pps.result = pps.prefix + pps.numeralFormatter.format(value);
|
341
|
+
} else {
|
342
|
+
pps.result = pps.numeralFormatter.format(value);
|
343
|
+
}
|
344
|
+
owner.updateValueState();
|
345
|
+
|
346
|
+
return;
|
347
|
+
}
|
348
|
+
|
349
|
+
// date
|
350
|
+
if (pps.date) {
|
351
|
+
value = pps.dateFormatter.getValidatedDate(value);
|
352
|
+
}
|
353
|
+
|
354
|
+
// strip delimiters
|
355
|
+
value = Util.stripDelimiters(value, pps.delimiter, pps.delimiters);
|
356
|
+
|
357
|
+
// strip prefix
|
358
|
+
value = Util.getPrefixStrippedValue(value, pps.prefix, pps.prefixLength, pps.result);
|
359
|
+
|
360
|
+
// strip non-numeric characters
|
361
|
+
value = pps.numericOnly ? Util.strip(value, /[^\d]/g) : value;
|
362
|
+
|
363
|
+
// convert case
|
364
|
+
value = pps.uppercase ? value.toUpperCase() : value;
|
365
|
+
value = pps.lowercase ? value.toLowerCase() : value;
|
366
|
+
|
367
|
+
// prefix
|
368
|
+
if (pps.prefix && (!pps.noImmediatePrefix || value.length)) {
|
369
|
+
value = pps.prefix + value;
|
370
|
+
|
371
|
+
// no blocks specified, no need to do formatting
|
372
|
+
if (pps.blocksLength === 0) {
|
373
|
+
pps.result = value;
|
374
|
+
owner.updateValueState();
|
375
|
+
|
376
|
+
return;
|
377
|
+
}
|
378
|
+
}
|
379
|
+
|
380
|
+
// update credit card props
|
381
|
+
if (pps.creditCard) {
|
382
|
+
owner.updateCreditCardPropsByValue(value);
|
383
|
+
}
|
384
|
+
|
385
|
+
// strip over length characters
|
386
|
+
value = pps.maxLength > 0 ? Util.headStr(value, pps.maxLength) : value;
|
387
|
+
|
388
|
+
// apply blocks
|
389
|
+
pps.result = Util.getFormattedValue(value, pps.blocks, pps.blocksLength, pps.delimiter, pps.delimiters, pps.delimiterLazyShow);
|
390
|
+
|
391
|
+
owner.updateValueState();
|
392
|
+
},
|
393
|
+
|
394
|
+
updateCreditCardPropsByValue: function updateCreditCardPropsByValue(value) {
|
395
|
+
var owner = this,
|
396
|
+
pps = owner.properties,
|
397
|
+
creditCardInfo;
|
398
|
+
|
399
|
+
// At least one of the first 4 characters has changed
|
400
|
+
if (Util.headStr(pps.result, 4) === Util.headStr(value, 4)) {
|
401
|
+
return;
|
402
|
+
}
|
403
|
+
|
404
|
+
creditCardInfo = CreditCardDetector.getInfo(value, pps.creditCardStrictMode);
|
405
|
+
|
406
|
+
pps.blocks = creditCardInfo.blocks;
|
407
|
+
pps.blocksLength = pps.blocks.length;
|
408
|
+
pps.maxLength = Util.getMaxLength(pps.blocks);
|
409
|
+
|
410
|
+
// credit card type changed
|
411
|
+
if (pps.creditCardType !== creditCardInfo.type) {
|
412
|
+
pps.creditCardType = creditCardInfo.type;
|
413
|
+
|
414
|
+
pps.onCreditCardTypeChanged.call(owner, pps.creditCardType);
|
415
|
+
}
|
416
|
+
},
|
417
|
+
|
418
|
+
updateValueState: function updateValueState() {
|
419
|
+
var owner = this,
|
420
|
+
pps = owner.properties;
|
421
|
+
|
422
|
+
if (!owner.element) {
|
423
|
+
owner.setState({ value: pps.result });
|
424
|
+
}
|
425
|
+
|
426
|
+
var endPos = owner.element.selectionEnd;
|
427
|
+
var oldValue = owner.element.value;
|
428
|
+
var newValue = pps.result;
|
429
|
+
|
430
|
+
owner.lastInputValue = newValue;
|
431
|
+
|
432
|
+
endPos = Util.getNextCursorPosition(endPos, oldValue, newValue, pps.delimiter, pps.delimiters);
|
433
|
+
|
434
|
+
if (owner.isAndroid) {
|
435
|
+
window.setTimeout(function () {
|
436
|
+
owner.setState({ value: newValue, cursorPosition: endPos });
|
437
|
+
}, 1);
|
438
|
+
|
439
|
+
return;
|
440
|
+
}
|
441
|
+
|
442
|
+
owner.setState({ value: newValue, cursorPosition: endPos });
|
443
|
+
},
|
444
|
+
|
445
|
+
render: function render() {
|
446
|
+
var owner = this;
|
447
|
+
// eslint-disable-next-line
|
448
|
+
|
449
|
+
var _owner$props2 = owner.props,
|
450
|
+
value = _owner$props2.value,
|
451
|
+
options = _owner$props2.options,
|
452
|
+
onKeyDown = _owner$props2.onKeyDown,
|
453
|
+
onFocus = _owner$props2.onFocus,
|
454
|
+
onBlur = _owner$props2.onBlur,
|
455
|
+
onChange = _owner$props2.onChange,
|
456
|
+
onInit = _owner$props2.onInit,
|
457
|
+
htmlRef = _owner$props2.htmlRef,
|
458
|
+
propsToTransfer = _objectWithoutProperties(_owner$props2, ['value', 'options', 'onKeyDown', 'onFocus', 'onBlur', 'onChange', 'onInit', 'htmlRef']);
|
459
|
+
|
460
|
+
return React.createElement('input', _extends({
|
461
|
+
type: 'text',
|
462
|
+
ref: function ref(_ref) {
|
463
|
+
owner.element = _ref;
|
464
|
+
|
465
|
+
if (!htmlRef) {
|
466
|
+
return;
|
467
|
+
}
|
468
|
+
|
469
|
+
htmlRef.apply(this, arguments);
|
470
|
+
},
|
471
|
+
value: owner.state.value,
|
472
|
+
onKeyDown: owner.onKeyDown,
|
473
|
+
onChange: owner.onChange,
|
474
|
+
onFocus: owner.onFocus,
|
475
|
+
onBlur: owner.onBlur
|
476
|
+
}, propsToTransfer));
|
477
|
+
}
|
478
|
+
});
|
479
|
+
|
480
|
+
module.exports = cleaveReactClass;
|
481
|
+
|
482
|
+
/***/ }),
|
483
|
+
/* 1 */
|
484
|
+
/***/ (function(module, exports) {
|
485
|
+
|
486
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_1__;
|
487
|
+
|
488
|
+
/***/ }),
|
489
|
+
/* 2 */
|
490
|
+
/***/ (function(module, exports, __webpack_require__) {
|
491
|
+
|
492
|
+
/**
|
493
|
+
* Copyright 2013-present, Facebook, Inc.
|
494
|
+
* All rights reserved.
|
495
|
+
*
|
496
|
+
* This source code is licensed under the BSD-style license found in the
|
497
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
498
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
499
|
+
*
|
500
|
+
*/
|
501
|
+
|
502
|
+
'use strict';
|
503
|
+
|
504
|
+
var React = __webpack_require__(1);
|
505
|
+
var factory = __webpack_require__(3);
|
506
|
+
|
507
|
+
if (typeof React === 'undefined') {
|
508
|
+
throw Error(
|
509
|
+
'create-react-class could not find the React object. If you are using script tags, ' +
|
510
|
+
'make sure that React is being loaded before create-react-class.'
|
511
|
+
);
|
512
|
+
}
|
513
|
+
|
514
|
+
// Hack to grab NoopUpdateQueue from isomorphic React
|
515
|
+
var ReactNoopUpdateQueue = new React.Component().updater;
|
516
|
+
|
517
|
+
module.exports = factory(
|
518
|
+
React.Component,
|
519
|
+
React.isValidElement,
|
520
|
+
ReactNoopUpdateQueue
|
521
|
+
);
|
522
|
+
|
523
|
+
|
524
|
+
/***/ }),
|
525
|
+
/* 3 */
|
526
|
+
/***/ (function(module, exports, __webpack_require__) {
|
527
|
+
|
528
|
+
/* WEBPACK VAR INJECTION */(function(process) {/**
|
529
|
+
* Copyright 2013-present, Facebook, Inc.
|
530
|
+
* All rights reserved.
|
531
|
+
*
|
532
|
+
* This source code is licensed under the BSD-style license found in the
|
533
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
534
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
535
|
+
*
|
536
|
+
*/
|
537
|
+
|
538
|
+
'use strict';
|
539
|
+
|
540
|
+
var _assign = __webpack_require__(5);
|
541
|
+
|
542
|
+
var emptyObject = __webpack_require__(6);
|
543
|
+
var _invariant = __webpack_require__(7);
|
544
|
+
|
545
|
+
if (process.env.NODE_ENV !== 'production') {
|
546
|
+
var warning = __webpack_require__(8);
|
547
|
+
}
|
548
|
+
|
549
|
+
var MIXINS_KEY = 'mixins';
|
550
|
+
|
551
|
+
// Helper function to allow the creation of anonymous functions which do not
|
552
|
+
// have .name set to the name of the variable being assigned to.
|
553
|
+
function identity(fn) {
|
554
|
+
return fn;
|
555
|
+
}
|
556
|
+
|
557
|
+
var ReactPropTypeLocationNames;
|
558
|
+
if (process.env.NODE_ENV !== 'production') {
|
559
|
+
ReactPropTypeLocationNames = {
|
560
|
+
prop: 'prop',
|
561
|
+
context: 'context',
|
562
|
+
childContext: 'child context'
|
563
|
+
};
|
564
|
+
} else {
|
565
|
+
ReactPropTypeLocationNames = {};
|
566
|
+
}
|
567
|
+
|
568
|
+
function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) {
|
569
|
+
/**
|
570
|
+
* Policies that describe methods in `ReactClassInterface`.
|
571
|
+
*/
|
572
|
+
|
573
|
+
var injectedMixins = [];
|
574
|
+
|
575
|
+
/**
|
576
|
+
* Composite components are higher-level components that compose other composite
|
577
|
+
* or host components.
|
578
|
+
*
|
579
|
+
* To create a new type of `ReactClass`, pass a specification of
|
580
|
+
* your new class to `React.createClass`. The only requirement of your class
|
581
|
+
* specification is that you implement a `render` method.
|
582
|
+
*
|
583
|
+
* var MyComponent = React.createClass({
|
584
|
+
* render: function() {
|
585
|
+
* return <div>Hello World</div>;
|
586
|
+
* }
|
587
|
+
* });
|
588
|
+
*
|
589
|
+
* The class specification supports a specific protocol of methods that have
|
590
|
+
* special meaning (e.g. `render`). See `ReactClassInterface` for
|
591
|
+
* more the comprehensive protocol. Any other properties and methods in the
|
592
|
+
* class specification will be available on the prototype.
|
593
|
+
*
|
594
|
+
* @interface ReactClassInterface
|
595
|
+
* @internal
|
596
|
+
*/
|
597
|
+
var ReactClassInterface = {
|
598
|
+
/**
|
599
|
+
* An array of Mixin objects to include when defining your component.
|
600
|
+
*
|
601
|
+
* @type {array}
|
602
|
+
* @optional
|
603
|
+
*/
|
604
|
+
mixins: 'DEFINE_MANY',
|
605
|
+
|
606
|
+
/**
|
607
|
+
* An object containing properties and methods that should be defined on
|
608
|
+
* the component's constructor instead of its prototype (static methods).
|
609
|
+
*
|
610
|
+
* @type {object}
|
611
|
+
* @optional
|
612
|
+
*/
|
613
|
+
statics: 'DEFINE_MANY',
|
614
|
+
|
615
|
+
/**
|
616
|
+
* Definition of prop types for this component.
|
617
|
+
*
|
618
|
+
* @type {object}
|
619
|
+
* @optional
|
620
|
+
*/
|
621
|
+
propTypes: 'DEFINE_MANY',
|
622
|
+
|
623
|
+
/**
|
624
|
+
* Definition of context types for this component.
|
625
|
+
*
|
626
|
+
* @type {object}
|
627
|
+
* @optional
|
628
|
+
*/
|
629
|
+
contextTypes: 'DEFINE_MANY',
|
630
|
+
|
631
|
+
/**
|
632
|
+
* Definition of context types this component sets for its children.
|
633
|
+
*
|
634
|
+
* @type {object}
|
635
|
+
* @optional
|
636
|
+
*/
|
637
|
+
childContextTypes: 'DEFINE_MANY',
|
638
|
+
|
639
|
+
// ==== Definition methods ====
|
640
|
+
|
641
|
+
/**
|
642
|
+
* Invoked when the component is mounted. Values in the mapping will be set on
|
643
|
+
* `this.props` if that prop is not specified (i.e. using an `in` check).
|
644
|
+
*
|
645
|
+
* This method is invoked before `getInitialState` and therefore cannot rely
|
646
|
+
* on `this.state` or use `this.setState`.
|
647
|
+
*
|
648
|
+
* @return {object}
|
649
|
+
* @optional
|
650
|
+
*/
|
651
|
+
getDefaultProps: 'DEFINE_MANY_MERGED',
|
652
|
+
|
653
|
+
/**
|
654
|
+
* Invoked once before the component is mounted. The return value will be used
|
655
|
+
* as the initial value of `this.state`.
|
656
|
+
*
|
657
|
+
* getInitialState: function() {
|
658
|
+
* return {
|
659
|
+
* isOn: false,
|
660
|
+
* fooBaz: new BazFoo()
|
661
|
+
* }
|
662
|
+
* }
|
663
|
+
*
|
664
|
+
* @return {object}
|
665
|
+
* @optional
|
666
|
+
*/
|
667
|
+
getInitialState: 'DEFINE_MANY_MERGED',
|
668
|
+
|
669
|
+
/**
|
670
|
+
* @return {object}
|
671
|
+
* @optional
|
672
|
+
*/
|
673
|
+
getChildContext: 'DEFINE_MANY_MERGED',
|
674
|
+
|
675
|
+
/**
|
676
|
+
* Uses props from `this.props` and state from `this.state` to render the
|
677
|
+
* structure of the component.
|
678
|
+
*
|
679
|
+
* No guarantees are made about when or how often this method is invoked, so
|
680
|
+
* it must not have side effects.
|
681
|
+
*
|
682
|
+
* render: function() {
|
683
|
+
* var name = this.props.name;
|
684
|
+
* return <div>Hello, {name}!</div>;
|
685
|
+
* }
|
686
|
+
*
|
687
|
+
* @return {ReactComponent}
|
688
|
+
* @required
|
689
|
+
*/
|
690
|
+
render: 'DEFINE_ONCE',
|
691
|
+
|
692
|
+
// ==== Delegate methods ====
|
693
|
+
|
694
|
+
/**
|
695
|
+
* Invoked when the component is initially created and about to be mounted.
|
696
|
+
* This may have side effects, but any external subscriptions or data created
|
697
|
+
* by this method must be cleaned up in `componentWillUnmount`.
|
698
|
+
*
|
699
|
+
* @optional
|
700
|
+
*/
|
701
|
+
componentWillMount: 'DEFINE_MANY',
|
702
|
+
|
703
|
+
/**
|
704
|
+
* Invoked when the component has been mounted and has a DOM representation.
|
705
|
+
* However, there is no guarantee that the DOM node is in the document.
|
706
|
+
*
|
707
|
+
* Use this as an opportunity to operate on the DOM when the component has
|
708
|
+
* been mounted (initialized and rendered) for the first time.
|
709
|
+
*
|
710
|
+
* @param {DOMElement} rootNode DOM element representing the component.
|
711
|
+
* @optional
|
712
|
+
*/
|
713
|
+
componentDidMount: 'DEFINE_MANY',
|
714
|
+
|
715
|
+
/**
|
716
|
+
* Invoked before the component receives new props.
|
717
|
+
*
|
718
|
+
* Use this as an opportunity to react to a prop transition by updating the
|
719
|
+
* state using `this.setState`. Current props are accessed via `this.props`.
|
720
|
+
*
|
721
|
+
* componentWillReceiveProps: function(nextProps, nextContext) {
|
722
|
+
* this.setState({
|
723
|
+
* likesIncreasing: nextProps.likeCount > this.props.likeCount
|
724
|
+
* });
|
725
|
+
* }
|
726
|
+
*
|
727
|
+
* NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
|
728
|
+
* transition may cause a state change, but the opposite is not true. If you
|
729
|
+
* need it, you are probably looking for `componentWillUpdate`.
|
730
|
+
*
|
731
|
+
* @param {object} nextProps
|
732
|
+
* @optional
|
733
|
+
*/
|
734
|
+
componentWillReceiveProps: 'DEFINE_MANY',
|
735
|
+
|
736
|
+
/**
|
737
|
+
* Invoked while deciding if the component should be updated as a result of
|
738
|
+
* receiving new props, state and/or context.
|
739
|
+
*
|
740
|
+
* Use this as an opportunity to `return false` when you're certain that the
|
741
|
+
* transition to the new props/state/context will not require a component
|
742
|
+
* update.
|
743
|
+
*
|
744
|
+
* shouldComponentUpdate: function(nextProps, nextState, nextContext) {
|
745
|
+
* return !equal(nextProps, this.props) ||
|
746
|
+
* !equal(nextState, this.state) ||
|
747
|
+
* !equal(nextContext, this.context);
|
748
|
+
* }
|
749
|
+
*
|
750
|
+
* @param {object} nextProps
|
751
|
+
* @param {?object} nextState
|
752
|
+
* @param {?object} nextContext
|
753
|
+
* @return {boolean} True if the component should update.
|
754
|
+
* @optional
|
755
|
+
*/
|
756
|
+
shouldComponentUpdate: 'DEFINE_ONCE',
|
757
|
+
|
758
|
+
/**
|
759
|
+
* Invoked when the component is about to update due to a transition from
|
760
|
+
* `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
|
761
|
+
* and `nextContext`.
|
762
|
+
*
|
763
|
+
* Use this as an opportunity to perform preparation before an update occurs.
|
764
|
+
*
|
765
|
+
* NOTE: You **cannot** use `this.setState()` in this method.
|
766
|
+
*
|
767
|
+
* @param {object} nextProps
|
768
|
+
* @param {?object} nextState
|
769
|
+
* @param {?object} nextContext
|
770
|
+
* @param {ReactReconcileTransaction} transaction
|
771
|
+
* @optional
|
772
|
+
*/
|
773
|
+
componentWillUpdate: 'DEFINE_MANY',
|
774
|
+
|
775
|
+
/**
|
776
|
+
* Invoked when the component's DOM representation has been updated.
|
777
|
+
*
|
778
|
+
* Use this as an opportunity to operate on the DOM when the component has
|
779
|
+
* been updated.
|
780
|
+
*
|
781
|
+
* @param {object} prevProps
|
782
|
+
* @param {?object} prevState
|
783
|
+
* @param {?object} prevContext
|
784
|
+
* @param {DOMElement} rootNode DOM element representing the component.
|
785
|
+
* @optional
|
786
|
+
*/
|
787
|
+
componentDidUpdate: 'DEFINE_MANY',
|
788
|
+
|
789
|
+
/**
|
790
|
+
* Invoked when the component is about to be removed from its parent and have
|
791
|
+
* its DOM representation destroyed.
|
792
|
+
*
|
793
|
+
* Use this as an opportunity to deallocate any external resources.
|
794
|
+
*
|
795
|
+
* NOTE: There is no `componentDidUnmount` since your component will have been
|
796
|
+
* destroyed by that point.
|
797
|
+
*
|
798
|
+
* @optional
|
799
|
+
*/
|
800
|
+
componentWillUnmount: 'DEFINE_MANY',
|
801
|
+
|
802
|
+
// ==== Advanced methods ====
|
803
|
+
|
804
|
+
/**
|
805
|
+
* Updates the component's currently mounted DOM representation.
|
806
|
+
*
|
807
|
+
* By default, this implements React's rendering and reconciliation algorithm.
|
808
|
+
* Sophisticated clients may wish to override this.
|
809
|
+
*
|
810
|
+
* @param {ReactReconcileTransaction} transaction
|
811
|
+
* @internal
|
812
|
+
* @overridable
|
813
|
+
*/
|
814
|
+
updateComponent: 'OVERRIDE_BASE'
|
815
|
+
};
|
816
|
+
|
817
|
+
/**
|
818
|
+
* Mapping from class specification keys to special processing functions.
|
819
|
+
*
|
820
|
+
* Although these are declared like instance properties in the specification
|
821
|
+
* when defining classes using `React.createClass`, they are actually static
|
822
|
+
* and are accessible on the constructor instead of the prototype. Despite
|
823
|
+
* being static, they must be defined outside of the "statics" key under
|
824
|
+
* which all other static methods are defined.
|
825
|
+
*/
|
826
|
+
var RESERVED_SPEC_KEYS = {
|
827
|
+
displayName: function(Constructor, displayName) {
|
828
|
+
Constructor.displayName = displayName;
|
829
|
+
},
|
830
|
+
mixins: function(Constructor, mixins) {
|
831
|
+
if (mixins) {
|
832
|
+
for (var i = 0; i < mixins.length; i++) {
|
833
|
+
mixSpecIntoComponent(Constructor, mixins[i]);
|
834
|
+
}
|
835
|
+
}
|
836
|
+
},
|
837
|
+
childContextTypes: function(Constructor, childContextTypes) {
|
838
|
+
if (process.env.NODE_ENV !== 'production') {
|
839
|
+
validateTypeDef(Constructor, childContextTypes, 'childContext');
|
840
|
+
}
|
841
|
+
Constructor.childContextTypes = _assign(
|
842
|
+
{},
|
843
|
+
Constructor.childContextTypes,
|
844
|
+
childContextTypes
|
845
|
+
);
|
846
|
+
},
|
847
|
+
contextTypes: function(Constructor, contextTypes) {
|
848
|
+
if (process.env.NODE_ENV !== 'production') {
|
849
|
+
validateTypeDef(Constructor, contextTypes, 'context');
|
850
|
+
}
|
851
|
+
Constructor.contextTypes = _assign(
|
852
|
+
{},
|
853
|
+
Constructor.contextTypes,
|
854
|
+
contextTypes
|
855
|
+
);
|
856
|
+
},
|
857
|
+
/**
|
858
|
+
* Special case getDefaultProps which should move into statics but requires
|
859
|
+
* automatic merging.
|
860
|
+
*/
|
861
|
+
getDefaultProps: function(Constructor, getDefaultProps) {
|
862
|
+
if (Constructor.getDefaultProps) {
|
863
|
+
Constructor.getDefaultProps = createMergedResultFunction(
|
864
|
+
Constructor.getDefaultProps,
|
865
|
+
getDefaultProps
|
866
|
+
);
|
867
|
+
} else {
|
868
|
+
Constructor.getDefaultProps = getDefaultProps;
|
869
|
+
}
|
870
|
+
},
|
871
|
+
propTypes: function(Constructor, propTypes) {
|
872
|
+
if (process.env.NODE_ENV !== 'production') {
|
873
|
+
validateTypeDef(Constructor, propTypes, 'prop');
|
874
|
+
}
|
875
|
+
Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes);
|
876
|
+
},
|
877
|
+
statics: function(Constructor, statics) {
|
878
|
+
mixStaticSpecIntoComponent(Constructor, statics);
|
879
|
+
},
|
880
|
+
autobind: function() {}
|
881
|
+
};
|
882
|
+
|
883
|
+
function validateTypeDef(Constructor, typeDef, location) {
|
884
|
+
for (var propName in typeDef) {
|
885
|
+
if (typeDef.hasOwnProperty(propName)) {
|
886
|
+
// use a warning instead of an _invariant so components
|
887
|
+
// don't show up in prod but only in __DEV__
|
888
|
+
if (process.env.NODE_ENV !== 'production') {
|
889
|
+
warning(
|
890
|
+
typeof typeDef[propName] === 'function',
|
891
|
+
'%s: %s type `%s` is invalid; it must be a function, usually from ' +
|
892
|
+
'React.PropTypes.',
|
893
|
+
Constructor.displayName || 'ReactClass',
|
894
|
+
ReactPropTypeLocationNames[location],
|
895
|
+
propName
|
896
|
+
);
|
897
|
+
}
|
898
|
+
}
|
899
|
+
}
|
900
|
+
}
|
901
|
+
|
902
|
+
function validateMethodOverride(isAlreadyDefined, name) {
|
903
|
+
var specPolicy = ReactClassInterface.hasOwnProperty(name)
|
904
|
+
? ReactClassInterface[name]
|
905
|
+
: null;
|
906
|
+
|
907
|
+
// Disallow overriding of base class methods unless explicitly allowed.
|
908
|
+
if (ReactClassMixin.hasOwnProperty(name)) {
|
909
|
+
_invariant(
|
910
|
+
specPolicy === 'OVERRIDE_BASE',
|
911
|
+
'ReactClassInterface: You are attempting to override ' +
|
912
|
+
'`%s` from your class specification. Ensure that your method names ' +
|
913
|
+
'do not overlap with React methods.',
|
914
|
+
name
|
915
|
+
);
|
916
|
+
}
|
917
|
+
|
918
|
+
// Disallow defining methods more than once unless explicitly allowed.
|
919
|
+
if (isAlreadyDefined) {
|
920
|
+
_invariant(
|
921
|
+
specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED',
|
922
|
+
'ReactClassInterface: You are attempting to define ' +
|
923
|
+
'`%s` on your component more than once. This conflict may be due ' +
|
924
|
+
'to a mixin.',
|
925
|
+
name
|
926
|
+
);
|
927
|
+
}
|
928
|
+
}
|
929
|
+
|
930
|
+
/**
|
931
|
+
* Mixin helper which handles policy validation and reserved
|
932
|
+
* specification keys when building React classes.
|
933
|
+
*/
|
934
|
+
function mixSpecIntoComponent(Constructor, spec) {
|
935
|
+
if (!spec) {
|
936
|
+
if (process.env.NODE_ENV !== 'production') {
|
937
|
+
var typeofSpec = typeof spec;
|
938
|
+
var isMixinValid = typeofSpec === 'object' && spec !== null;
|
939
|
+
|
940
|
+
if (process.env.NODE_ENV !== 'production') {
|
941
|
+
warning(
|
942
|
+
isMixinValid,
|
943
|
+
"%s: You're attempting to include a mixin that is either null " +
|
944
|
+
'or not an object. Check the mixins included by the component, ' +
|
945
|
+
'as well as any mixins they include themselves. ' +
|
946
|
+
'Expected object but got %s.',
|
947
|
+
Constructor.displayName || 'ReactClass',
|
948
|
+
spec === null ? null : typeofSpec
|
949
|
+
);
|
950
|
+
}
|
951
|
+
}
|
952
|
+
|
953
|
+
return;
|
954
|
+
}
|
955
|
+
|
956
|
+
_invariant(
|
957
|
+
typeof spec !== 'function',
|
958
|
+
"ReactClass: You're attempting to " +
|
959
|
+
'use a component class or function as a mixin. Instead, just use a ' +
|
960
|
+
'regular object.'
|
961
|
+
);
|
962
|
+
_invariant(
|
963
|
+
!isValidElement(spec),
|
964
|
+
"ReactClass: You're attempting to " +
|
965
|
+
'use a component as a mixin. Instead, just use a regular object.'
|
966
|
+
);
|
967
|
+
|
968
|
+
var proto = Constructor.prototype;
|
969
|
+
var autoBindPairs = proto.__reactAutoBindPairs;
|
970
|
+
|
971
|
+
// By handling mixins before any other properties, we ensure the same
|
972
|
+
// chaining order is applied to methods with DEFINE_MANY policy, whether
|
973
|
+
// mixins are listed before or after these methods in the spec.
|
974
|
+
if (spec.hasOwnProperty(MIXINS_KEY)) {
|
975
|
+
RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
|
976
|
+
}
|
977
|
+
|
978
|
+
for (var name in spec) {
|
979
|
+
if (!spec.hasOwnProperty(name)) {
|
980
|
+
continue;
|
981
|
+
}
|
982
|
+
|
983
|
+
if (name === MIXINS_KEY) {
|
984
|
+
// We have already handled mixins in a special case above.
|
985
|
+
continue;
|
986
|
+
}
|
987
|
+
|
988
|
+
var property = spec[name];
|
989
|
+
var isAlreadyDefined = proto.hasOwnProperty(name);
|
990
|
+
validateMethodOverride(isAlreadyDefined, name);
|
991
|
+
|
992
|
+
if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
|
993
|
+
RESERVED_SPEC_KEYS[name](Constructor, property);
|
994
|
+
} else {
|
995
|
+
// Setup methods on prototype:
|
996
|
+
// The following member methods should not be automatically bound:
|
997
|
+
// 1. Expected ReactClass methods (in the "interface").
|
998
|
+
// 2. Overridden methods (that were mixed in).
|
999
|
+
var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
|
1000
|
+
var isFunction = typeof property === 'function';
|
1001
|
+
var shouldAutoBind =
|
1002
|
+
isFunction &&
|
1003
|
+
!isReactClassMethod &&
|
1004
|
+
!isAlreadyDefined &&
|
1005
|
+
spec.autobind !== false;
|
1006
|
+
|
1007
|
+
if (shouldAutoBind) {
|
1008
|
+
autoBindPairs.push(name, property);
|
1009
|
+
proto[name] = property;
|
1010
|
+
} else {
|
1011
|
+
if (isAlreadyDefined) {
|
1012
|
+
var specPolicy = ReactClassInterface[name];
|
1013
|
+
|
1014
|
+
// These cases should already be caught by validateMethodOverride.
|
1015
|
+
_invariant(
|
1016
|
+
isReactClassMethod &&
|
1017
|
+
(specPolicy === 'DEFINE_MANY_MERGED' ||
|
1018
|
+
specPolicy === 'DEFINE_MANY'),
|
1019
|
+
'ReactClass: Unexpected spec policy %s for key %s ' +
|
1020
|
+
'when mixing in component specs.',
|
1021
|
+
specPolicy,
|
1022
|
+
name
|
1023
|
+
);
|
1024
|
+
|
1025
|
+
// For methods which are defined more than once, call the existing
|
1026
|
+
// methods before calling the new property, merging if appropriate.
|
1027
|
+
if (specPolicy === 'DEFINE_MANY_MERGED') {
|
1028
|
+
proto[name] = createMergedResultFunction(proto[name], property);
|
1029
|
+
} else if (specPolicy === 'DEFINE_MANY') {
|
1030
|
+
proto[name] = createChainedFunction(proto[name], property);
|
1031
|
+
}
|
1032
|
+
} else {
|
1033
|
+
proto[name] = property;
|
1034
|
+
if (process.env.NODE_ENV !== 'production') {
|
1035
|
+
// Add verbose displayName to the function, which helps when looking
|
1036
|
+
// at profiling tools.
|
1037
|
+
if (typeof property === 'function' && spec.displayName) {
|
1038
|
+
proto[name].displayName = spec.displayName + '_' + name;
|
1039
|
+
}
|
1040
|
+
}
|
1041
|
+
}
|
1042
|
+
}
|
1043
|
+
}
|
1044
|
+
}
|
1045
|
+
}
|
1046
|
+
|
1047
|
+
function mixStaticSpecIntoComponent(Constructor, statics) {
|
1048
|
+
if (!statics) {
|
1049
|
+
return;
|
1050
|
+
}
|
1051
|
+
for (var name in statics) {
|
1052
|
+
var property = statics[name];
|
1053
|
+
if (!statics.hasOwnProperty(name)) {
|
1054
|
+
continue;
|
1055
|
+
}
|
1056
|
+
|
1057
|
+
var isReserved = name in RESERVED_SPEC_KEYS;
|
1058
|
+
_invariant(
|
1059
|
+
!isReserved,
|
1060
|
+
'ReactClass: You are attempting to define a reserved ' +
|
1061
|
+
'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' +
|
1062
|
+
'as an instance property instead; it will still be accessible on the ' +
|
1063
|
+
'constructor.',
|
1064
|
+
name
|
1065
|
+
);
|
1066
|
+
|
1067
|
+
var isInherited = name in Constructor;
|
1068
|
+
_invariant(
|
1069
|
+
!isInherited,
|
1070
|
+
'ReactClass: You are attempting to define ' +
|
1071
|
+
'`%s` on your component more than once. This conflict may be ' +
|
1072
|
+
'due to a mixin.',
|
1073
|
+
name
|
1074
|
+
);
|
1075
|
+
Constructor[name] = property;
|
1076
|
+
}
|
1077
|
+
}
|
1078
|
+
|
1079
|
+
/**
|
1080
|
+
* Merge two objects, but throw if both contain the same key.
|
1081
|
+
*
|
1082
|
+
* @param {object} one The first object, which is mutated.
|
1083
|
+
* @param {object} two The second object
|
1084
|
+
* @return {object} one after it has been mutated to contain everything in two.
|
1085
|
+
*/
|
1086
|
+
function mergeIntoWithNoDuplicateKeys(one, two) {
|
1087
|
+
_invariant(
|
1088
|
+
one && two && typeof one === 'object' && typeof two === 'object',
|
1089
|
+
'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.'
|
1090
|
+
);
|
1091
|
+
|
1092
|
+
for (var key in two) {
|
1093
|
+
if (two.hasOwnProperty(key)) {
|
1094
|
+
_invariant(
|
1095
|
+
one[key] === undefined,
|
1096
|
+
'mergeIntoWithNoDuplicateKeys(): ' +
|
1097
|
+
'Tried to merge two objects with the same key: `%s`. This conflict ' +
|
1098
|
+
'may be due to a mixin; in particular, this may be caused by two ' +
|
1099
|
+
'getInitialState() or getDefaultProps() methods returning objects ' +
|
1100
|
+
'with clashing keys.',
|
1101
|
+
key
|
1102
|
+
);
|
1103
|
+
one[key] = two[key];
|
1104
|
+
}
|
1105
|
+
}
|
1106
|
+
return one;
|
1107
|
+
}
|
1108
|
+
|
1109
|
+
/**
|
1110
|
+
* Creates a function that invokes two functions and merges their return values.
|
1111
|
+
*
|
1112
|
+
* @param {function} one Function to invoke first.
|
1113
|
+
* @param {function} two Function to invoke second.
|
1114
|
+
* @return {function} Function that invokes the two argument functions.
|
1115
|
+
* @private
|
1116
|
+
*/
|
1117
|
+
function createMergedResultFunction(one, two) {
|
1118
|
+
return function mergedResult() {
|
1119
|
+
var a = one.apply(this, arguments);
|
1120
|
+
var b = two.apply(this, arguments);
|
1121
|
+
if (a == null) {
|
1122
|
+
return b;
|
1123
|
+
} else if (b == null) {
|
1124
|
+
return a;
|
1125
|
+
}
|
1126
|
+
var c = {};
|
1127
|
+
mergeIntoWithNoDuplicateKeys(c, a);
|
1128
|
+
mergeIntoWithNoDuplicateKeys(c, b);
|
1129
|
+
return c;
|
1130
|
+
};
|
1131
|
+
}
|
1132
|
+
|
1133
|
+
/**
|
1134
|
+
* Creates a function that invokes two functions and ignores their return vales.
|
1135
|
+
*
|
1136
|
+
* @param {function} one Function to invoke first.
|
1137
|
+
* @param {function} two Function to invoke second.
|
1138
|
+
* @return {function} Function that invokes the two argument functions.
|
1139
|
+
* @private
|
1140
|
+
*/
|
1141
|
+
function createChainedFunction(one, two) {
|
1142
|
+
return function chainedFunction() {
|
1143
|
+
one.apply(this, arguments);
|
1144
|
+
two.apply(this, arguments);
|
1145
|
+
};
|
1146
|
+
}
|
1147
|
+
|
1148
|
+
/**
|
1149
|
+
* Binds a method to the component.
|
1150
|
+
*
|
1151
|
+
* @param {object} component Component whose method is going to be bound.
|
1152
|
+
* @param {function} method Method to be bound.
|
1153
|
+
* @return {function} The bound method.
|
1154
|
+
*/
|
1155
|
+
function bindAutoBindMethod(component, method) {
|
1156
|
+
var boundMethod = method.bind(component);
|
1157
|
+
if (process.env.NODE_ENV !== 'production') {
|
1158
|
+
boundMethod.__reactBoundContext = component;
|
1159
|
+
boundMethod.__reactBoundMethod = method;
|
1160
|
+
boundMethod.__reactBoundArguments = null;
|
1161
|
+
var componentName = component.constructor.displayName;
|
1162
|
+
var _bind = boundMethod.bind;
|
1163
|
+
boundMethod.bind = function(newThis) {
|
1164
|
+
for (
|
1165
|
+
var _len = arguments.length,
|
1166
|
+
args = Array(_len > 1 ? _len - 1 : 0),
|
1167
|
+
_key = 1;
|
1168
|
+
_key < _len;
|
1169
|
+
_key++
|
1170
|
+
) {
|
1171
|
+
args[_key - 1] = arguments[_key];
|
1172
|
+
}
|
1173
|
+
|
1174
|
+
// User is trying to bind() an autobound method; we effectively will
|
1175
|
+
// ignore the value of "this" that the user is trying to use, so
|
1176
|
+
// let's warn.
|
1177
|
+
if (newThis !== component && newThis !== null) {
|
1178
|
+
if (process.env.NODE_ENV !== 'production') {
|
1179
|
+
warning(
|
1180
|
+
false,
|
1181
|
+
'bind(): React component methods may only be bound to the ' +
|
1182
|
+
'component instance. See %s',
|
1183
|
+
componentName
|
1184
|
+
);
|
1185
|
+
}
|
1186
|
+
} else if (!args.length) {
|
1187
|
+
if (process.env.NODE_ENV !== 'production') {
|
1188
|
+
warning(
|
1189
|
+
false,
|
1190
|
+
'bind(): You are binding a component method to the component. ' +
|
1191
|
+
'React does this for you automatically in a high-performance ' +
|
1192
|
+
'way, so you can safely remove this call. See %s',
|
1193
|
+
componentName
|
1194
|
+
);
|
1195
|
+
}
|
1196
|
+
return boundMethod;
|
1197
|
+
}
|
1198
|
+
var reboundMethod = _bind.apply(boundMethod, arguments);
|
1199
|
+
reboundMethod.__reactBoundContext = component;
|
1200
|
+
reboundMethod.__reactBoundMethod = method;
|
1201
|
+
reboundMethod.__reactBoundArguments = args;
|
1202
|
+
return reboundMethod;
|
1203
|
+
};
|
1204
|
+
}
|
1205
|
+
return boundMethod;
|
1206
|
+
}
|
1207
|
+
|
1208
|
+
/**
|
1209
|
+
* Binds all auto-bound methods in a component.
|
1210
|
+
*
|
1211
|
+
* @param {object} component Component whose method is going to be bound.
|
1212
|
+
*/
|
1213
|
+
function bindAutoBindMethods(component) {
|
1214
|
+
var pairs = component.__reactAutoBindPairs;
|
1215
|
+
for (var i = 0; i < pairs.length; i += 2) {
|
1216
|
+
var autoBindKey = pairs[i];
|
1217
|
+
var method = pairs[i + 1];
|
1218
|
+
component[autoBindKey] = bindAutoBindMethod(component, method);
|
1219
|
+
}
|
1220
|
+
}
|
1221
|
+
|
1222
|
+
var IsMountedPreMixin = {
|
1223
|
+
componentDidMount: function() {
|
1224
|
+
this.__isMounted = true;
|
1225
|
+
}
|
1226
|
+
};
|
1227
|
+
|
1228
|
+
var IsMountedPostMixin = {
|
1229
|
+
componentWillUnmount: function() {
|
1230
|
+
this.__isMounted = false;
|
1231
|
+
}
|
1232
|
+
};
|
1233
|
+
|
1234
|
+
/**
|
1235
|
+
* Add more to the ReactClass base class. These are all legacy features and
|
1236
|
+
* therefore not already part of the modern ReactComponent.
|
1237
|
+
*/
|
1238
|
+
var ReactClassMixin = {
|
1239
|
+
/**
|
1240
|
+
* TODO: This will be deprecated because state should always keep a consistent
|
1241
|
+
* type signature and the only use case for this, is to avoid that.
|
1242
|
+
*/
|
1243
|
+
replaceState: function(newState, callback) {
|
1244
|
+
this.updater.enqueueReplaceState(this, newState, callback);
|
1245
|
+
},
|
1246
|
+
|
1247
|
+
/**
|
1248
|
+
* Checks whether or not this composite component is mounted.
|
1249
|
+
* @return {boolean} True if mounted, false otherwise.
|
1250
|
+
* @protected
|
1251
|
+
* @final
|
1252
|
+
*/
|
1253
|
+
isMounted: function() {
|
1254
|
+
if (process.env.NODE_ENV !== 'production') {
|
1255
|
+
warning(
|
1256
|
+
this.__didWarnIsMounted,
|
1257
|
+
'%s: isMounted is deprecated. Instead, make sure to clean up ' +
|
1258
|
+
'subscriptions and pending requests in componentWillUnmount to ' +
|
1259
|
+
'prevent memory leaks.',
|
1260
|
+
(this.constructor && this.constructor.displayName) ||
|
1261
|
+
this.name ||
|
1262
|
+
'Component'
|
1263
|
+
);
|
1264
|
+
this.__didWarnIsMounted = true;
|
1265
|
+
}
|
1266
|
+
return !!this.__isMounted;
|
1267
|
+
}
|
1268
|
+
};
|
1269
|
+
|
1270
|
+
var ReactClassComponent = function() {};
|
1271
|
+
_assign(
|
1272
|
+
ReactClassComponent.prototype,
|
1273
|
+
ReactComponent.prototype,
|
1274
|
+
ReactClassMixin
|
1275
|
+
);
|
1276
|
+
|
1277
|
+
/**
|
1278
|
+
* Creates a composite component class given a class specification.
|
1279
|
+
* See https://facebook.github.io/react/docs/top-level-api.html#react.createclass
|
1280
|
+
*
|
1281
|
+
* @param {object} spec Class specification (which must define `render`).
|
1282
|
+
* @return {function} Component constructor function.
|
1283
|
+
* @public
|
1284
|
+
*/
|
1285
|
+
function createClass(spec) {
|
1286
|
+
// To keep our warnings more understandable, we'll use a little hack here to
|
1287
|
+
// ensure that Constructor.name !== 'Constructor'. This makes sure we don't
|
1288
|
+
// unnecessarily identify a class without displayName as 'Constructor'.
|
1289
|
+
var Constructor = identity(function(props, context, updater) {
|
1290
|
+
// This constructor gets overridden by mocks. The argument is used
|
1291
|
+
// by mocks to assert on what gets mounted.
|
1292
|
+
|
1293
|
+
if (process.env.NODE_ENV !== 'production') {
|
1294
|
+
warning(
|
1295
|
+
this instanceof Constructor,
|
1296
|
+
'Something is calling a React component directly. Use a factory or ' +
|
1297
|
+
'JSX instead. See: https://fb.me/react-legacyfactory'
|
1298
|
+
);
|
1299
|
+
}
|
1300
|
+
|
1301
|
+
// Wire up auto-binding
|
1302
|
+
if (this.__reactAutoBindPairs.length) {
|
1303
|
+
bindAutoBindMethods(this);
|
1304
|
+
}
|
1305
|
+
|
1306
|
+
this.props = props;
|
1307
|
+
this.context = context;
|
1308
|
+
this.refs = emptyObject;
|
1309
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
1310
|
+
|
1311
|
+
this.state = null;
|
1312
|
+
|
1313
|
+
// ReactClasses doesn't have constructors. Instead, they use the
|
1314
|
+
// getInitialState and componentWillMount methods for initialization.
|
1315
|
+
|
1316
|
+
var initialState = this.getInitialState ? this.getInitialState() : null;
|
1317
|
+
if (process.env.NODE_ENV !== 'production') {
|
1318
|
+
// We allow auto-mocks to proceed as if they're returning null.
|
1319
|
+
if (
|
1320
|
+
initialState === undefined &&
|
1321
|
+
this.getInitialState._isMockFunction
|
1322
|
+
) {
|
1323
|
+
// This is probably bad practice. Consider warning here and
|
1324
|
+
// deprecating this convenience.
|
1325
|
+
initialState = null;
|
1326
|
+
}
|
1327
|
+
}
|
1328
|
+
_invariant(
|
1329
|
+
typeof initialState === 'object' && !Array.isArray(initialState),
|
1330
|
+
'%s.getInitialState(): must return an object or null',
|
1331
|
+
Constructor.displayName || 'ReactCompositeComponent'
|
1332
|
+
);
|
1333
|
+
|
1334
|
+
this.state = initialState;
|
1335
|
+
});
|
1336
|
+
Constructor.prototype = new ReactClassComponent();
|
1337
|
+
Constructor.prototype.constructor = Constructor;
|
1338
|
+
Constructor.prototype.__reactAutoBindPairs = [];
|
1339
|
+
|
1340
|
+
injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
|
1341
|
+
|
1342
|
+
mixSpecIntoComponent(Constructor, IsMountedPreMixin);
|
1343
|
+
mixSpecIntoComponent(Constructor, spec);
|
1344
|
+
mixSpecIntoComponent(Constructor, IsMountedPostMixin);
|
1345
|
+
|
1346
|
+
// Initialize the defaultProps property after all mixins have been merged.
|
1347
|
+
if (Constructor.getDefaultProps) {
|
1348
|
+
Constructor.defaultProps = Constructor.getDefaultProps();
|
1349
|
+
}
|
1350
|
+
|
1351
|
+
if (process.env.NODE_ENV !== 'production') {
|
1352
|
+
// This is a tag to indicate that the use of these method names is ok,
|
1353
|
+
// since it's used with createClass. If it's not, then it's likely a
|
1354
|
+
// mistake so we'll warn you to use the static property, property
|
1355
|
+
// initializer or constructor respectively.
|
1356
|
+
if (Constructor.getDefaultProps) {
|
1357
|
+
Constructor.getDefaultProps.isReactClassApproved = {};
|
1358
|
+
}
|
1359
|
+
if (Constructor.prototype.getInitialState) {
|
1360
|
+
Constructor.prototype.getInitialState.isReactClassApproved = {};
|
1361
|
+
}
|
1362
|
+
}
|
1363
|
+
|
1364
|
+
_invariant(
|
1365
|
+
Constructor.prototype.render,
|
1366
|
+
'createClass(...): Class specification must implement a `render` method.'
|
1367
|
+
);
|
1368
|
+
|
1369
|
+
if (process.env.NODE_ENV !== 'production') {
|
1370
|
+
warning(
|
1371
|
+
!Constructor.prototype.componentShouldUpdate,
|
1372
|
+
'%s has a method called ' +
|
1373
|
+
'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
|
1374
|
+
'The name is phrased as a question because the function is ' +
|
1375
|
+
'expected to return a value.',
|
1376
|
+
spec.displayName || 'A component'
|
1377
|
+
);
|
1378
|
+
warning(
|
1379
|
+
!Constructor.prototype.componentWillRecieveProps,
|
1380
|
+
'%s has a method called ' +
|
1381
|
+
'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?',
|
1382
|
+
spec.displayName || 'A component'
|
1383
|
+
);
|
1384
|
+
}
|
1385
|
+
|
1386
|
+
// Reduce time spent doing lookups by setting these on the prototype.
|
1387
|
+
for (var methodName in ReactClassInterface) {
|
1388
|
+
if (!Constructor.prototype[methodName]) {
|
1389
|
+
Constructor.prototype[methodName] = null;
|
1390
|
+
}
|
1391
|
+
}
|
1392
|
+
|
1393
|
+
return Constructor;
|
1394
|
+
}
|
1395
|
+
|
1396
|
+
return createClass;
|
1397
|
+
}
|
1398
|
+
|
1399
|
+
module.exports = factory;
|
1400
|
+
|
1401
|
+
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4)))
|
1402
|
+
|
1403
|
+
/***/ }),
|
1404
|
+
/* 4 */
|
1405
|
+
/***/ (function(module, exports) {
|
1406
|
+
|
1407
|
+
// shim for using process in browser
|
1408
|
+
var process = module.exports = {};
|
1409
|
+
|
1410
|
+
// cached from whatever global is present so that test runners that stub it
|
1411
|
+
// don't break things. But we need to wrap it in a try catch in case it is
|
1412
|
+
// wrapped in strict mode code which doesn't define any globals. It's inside a
|
1413
|
+
// function because try/catches deoptimize in certain engines.
|
1414
|
+
|
1415
|
+
var cachedSetTimeout;
|
1416
|
+
var cachedClearTimeout;
|
1417
|
+
|
1418
|
+
function defaultSetTimout() {
|
1419
|
+
throw new Error('setTimeout has not been defined');
|
1420
|
+
}
|
1421
|
+
function defaultClearTimeout () {
|
1422
|
+
throw new Error('clearTimeout has not been defined');
|
1423
|
+
}
|
1424
|
+
(function () {
|
1425
|
+
try {
|
1426
|
+
if (typeof setTimeout === 'function') {
|
1427
|
+
cachedSetTimeout = setTimeout;
|
1428
|
+
} else {
|
1429
|
+
cachedSetTimeout = defaultSetTimout;
|
1430
|
+
}
|
1431
|
+
} catch (e) {
|
1432
|
+
cachedSetTimeout = defaultSetTimout;
|
1433
|
+
}
|
1434
|
+
try {
|
1435
|
+
if (typeof clearTimeout === 'function') {
|
1436
|
+
cachedClearTimeout = clearTimeout;
|
1437
|
+
} else {
|
1438
|
+
cachedClearTimeout = defaultClearTimeout;
|
1439
|
+
}
|
1440
|
+
} catch (e) {
|
1441
|
+
cachedClearTimeout = defaultClearTimeout;
|
1442
|
+
}
|
1443
|
+
} ())
|
1444
|
+
function runTimeout(fun) {
|
1445
|
+
if (cachedSetTimeout === setTimeout) {
|
1446
|
+
//normal enviroments in sane situations
|
1447
|
+
return setTimeout(fun, 0);
|
1448
|
+
}
|
1449
|
+
// if setTimeout wasn't available but was latter defined
|
1450
|
+
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
1451
|
+
cachedSetTimeout = setTimeout;
|
1452
|
+
return setTimeout(fun, 0);
|
1453
|
+
}
|
1454
|
+
try {
|
1455
|
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
1456
|
+
return cachedSetTimeout(fun, 0);
|
1457
|
+
} catch(e){
|
1458
|
+
try {
|
1459
|
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
1460
|
+
return cachedSetTimeout.call(null, fun, 0);
|
1461
|
+
} catch(e){
|
1462
|
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
1463
|
+
return cachedSetTimeout.call(this, fun, 0);
|
1464
|
+
}
|
1465
|
+
}
|
1466
|
+
|
1467
|
+
|
1468
|
+
}
|
1469
|
+
function runClearTimeout(marker) {
|
1470
|
+
if (cachedClearTimeout === clearTimeout) {
|
1471
|
+
//normal enviroments in sane situations
|
1472
|
+
return clearTimeout(marker);
|
1473
|
+
}
|
1474
|
+
// if clearTimeout wasn't available but was latter defined
|
1475
|
+
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
1476
|
+
cachedClearTimeout = clearTimeout;
|
1477
|
+
return clearTimeout(marker);
|
1478
|
+
}
|
1479
|
+
try {
|
1480
|
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
1481
|
+
return cachedClearTimeout(marker);
|
1482
|
+
} catch (e){
|
1483
|
+
try {
|
1484
|
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
1485
|
+
return cachedClearTimeout.call(null, marker);
|
1486
|
+
} catch (e){
|
1487
|
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
1488
|
+
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
1489
|
+
return cachedClearTimeout.call(this, marker);
|
1490
|
+
}
|
1491
|
+
}
|
1492
|
+
|
1493
|
+
|
1494
|
+
|
1495
|
+
}
|
1496
|
+
var queue = [];
|
1497
|
+
var draining = false;
|
1498
|
+
var currentQueue;
|
1499
|
+
var queueIndex = -1;
|
1500
|
+
|
1501
|
+
function cleanUpNextTick() {
|
1502
|
+
if (!draining || !currentQueue) {
|
1503
|
+
return;
|
1504
|
+
}
|
1505
|
+
draining = false;
|
1506
|
+
if (currentQueue.length) {
|
1507
|
+
queue = currentQueue.concat(queue);
|
1508
|
+
} else {
|
1509
|
+
queueIndex = -1;
|
1510
|
+
}
|
1511
|
+
if (queue.length) {
|
1512
|
+
drainQueue();
|
1513
|
+
}
|
1514
|
+
}
|
1515
|
+
|
1516
|
+
function drainQueue() {
|
1517
|
+
if (draining) {
|
1518
|
+
return;
|
1519
|
+
}
|
1520
|
+
var timeout = runTimeout(cleanUpNextTick);
|
1521
|
+
draining = true;
|
1522
|
+
|
1523
|
+
var len = queue.length;
|
1524
|
+
while(len) {
|
1525
|
+
currentQueue = queue;
|
1526
|
+
queue = [];
|
1527
|
+
while (++queueIndex < len) {
|
1528
|
+
if (currentQueue) {
|
1529
|
+
currentQueue[queueIndex].run();
|
1530
|
+
}
|
1531
|
+
}
|
1532
|
+
queueIndex = -1;
|
1533
|
+
len = queue.length;
|
1534
|
+
}
|
1535
|
+
currentQueue = null;
|
1536
|
+
draining = false;
|
1537
|
+
runClearTimeout(timeout);
|
1538
|
+
}
|
1539
|
+
|
1540
|
+
process.nextTick = function (fun) {
|
1541
|
+
var args = new Array(arguments.length - 1);
|
1542
|
+
if (arguments.length > 1) {
|
1543
|
+
for (var i = 1; i < arguments.length; i++) {
|
1544
|
+
args[i - 1] = arguments[i];
|
1545
|
+
}
|
1546
|
+
}
|
1547
|
+
queue.push(new Item(fun, args));
|
1548
|
+
if (queue.length === 1 && !draining) {
|
1549
|
+
runTimeout(drainQueue);
|
1550
|
+
}
|
1551
|
+
};
|
1552
|
+
|
1553
|
+
// v8 likes predictible objects
|
1554
|
+
function Item(fun, array) {
|
1555
|
+
this.fun = fun;
|
1556
|
+
this.array = array;
|
1557
|
+
}
|
1558
|
+
Item.prototype.run = function () {
|
1559
|
+
this.fun.apply(null, this.array);
|
1560
|
+
};
|
1561
|
+
process.title = 'browser';
|
1562
|
+
process.browser = true;
|
1563
|
+
process.env = {};
|
1564
|
+
process.argv = [];
|
1565
|
+
process.version = ''; // empty string to avoid regexp issues
|
1566
|
+
process.versions = {};
|
1567
|
+
|
1568
|
+
function noop() {}
|
1569
|
+
|
1570
|
+
process.on = noop;
|
1571
|
+
process.addListener = noop;
|
1572
|
+
process.once = noop;
|
1573
|
+
process.off = noop;
|
1574
|
+
process.removeListener = noop;
|
1575
|
+
process.removeAllListeners = noop;
|
1576
|
+
process.emit = noop;
|
1577
|
+
process.prependListener = noop;
|
1578
|
+
process.prependOnceListener = noop;
|
1579
|
+
|
1580
|
+
process.listeners = function (name) { return [] }
|
1581
|
+
|
1582
|
+
process.binding = function (name) {
|
1583
|
+
throw new Error('process.binding is not supported');
|
1584
|
+
};
|
1585
|
+
|
1586
|
+
process.cwd = function () { return '/' };
|
1587
|
+
process.chdir = function (dir) {
|
1588
|
+
throw new Error('process.chdir is not supported');
|
1589
|
+
};
|
1590
|
+
process.umask = function() { return 0; };
|
1591
|
+
|
1592
|
+
|
1593
|
+
/***/ }),
|
1594
|
+
/* 5 */
|
1595
|
+
/***/ (function(module, exports) {
|
1596
|
+
|
1597
|
+
/*
|
1598
|
+
object-assign
|
1599
|
+
(c) Sindre Sorhus
|
1600
|
+
@license MIT
|
1601
|
+
*/
|
1602
|
+
|
1603
|
+
'use strict';
|
1604
|
+
/* eslint-disable no-unused-vars */
|
1605
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
1606
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
1607
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
1608
|
+
|
1609
|
+
function toObject(val) {
|
1610
|
+
if (val === null || val === undefined) {
|
1611
|
+
throw new TypeError('Object.assign cannot be called with null or undefined');
|
1612
|
+
}
|
1613
|
+
|
1614
|
+
return Object(val);
|
1615
|
+
}
|
1616
|
+
|
1617
|
+
function shouldUseNative() {
|
1618
|
+
try {
|
1619
|
+
if (!Object.assign) {
|
1620
|
+
return false;
|
1621
|
+
}
|
1622
|
+
|
1623
|
+
// Detect buggy property enumeration order in older V8 versions.
|
1624
|
+
|
1625
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
1626
|
+
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
1627
|
+
test1[5] = 'de';
|
1628
|
+
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
1629
|
+
return false;
|
1630
|
+
}
|
1631
|
+
|
1632
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
1633
|
+
var test2 = {};
|
1634
|
+
for (var i = 0; i < 10; i++) {
|
1635
|
+
test2['_' + String.fromCharCode(i)] = i;
|
1636
|
+
}
|
1637
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
1638
|
+
return test2[n];
|
1639
|
+
});
|
1640
|
+
if (order2.join('') !== '0123456789') {
|
1641
|
+
return false;
|
1642
|
+
}
|
1643
|
+
|
1644
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
1645
|
+
var test3 = {};
|
1646
|
+
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
1647
|
+
test3[letter] = letter;
|
1648
|
+
});
|
1649
|
+
if (Object.keys(Object.assign({}, test3)).join('') !==
|
1650
|
+
'abcdefghijklmnopqrst') {
|
1651
|
+
return false;
|
1652
|
+
}
|
1653
|
+
|
1654
|
+
return true;
|
1655
|
+
} catch (err) {
|
1656
|
+
// We don't expect any of the above to throw, but better to be safe.
|
1657
|
+
return false;
|
1658
|
+
}
|
1659
|
+
}
|
1660
|
+
|
1661
|
+
module.exports = shouldUseNative() ? Object.assign : function (target, source) {
|
1662
|
+
var from;
|
1663
|
+
var to = toObject(target);
|
1664
|
+
var symbols;
|
1665
|
+
|
1666
|
+
for (var s = 1; s < arguments.length; s++) {
|
1667
|
+
from = Object(arguments[s]);
|
1668
|
+
|
1669
|
+
for (var key in from) {
|
1670
|
+
if (hasOwnProperty.call(from, key)) {
|
1671
|
+
to[key] = from[key];
|
1672
|
+
}
|
1673
|
+
}
|
1674
|
+
|
1675
|
+
if (getOwnPropertySymbols) {
|
1676
|
+
symbols = getOwnPropertySymbols(from);
|
1677
|
+
for (var i = 0; i < symbols.length; i++) {
|
1678
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
1679
|
+
to[symbols[i]] = from[symbols[i]];
|
1680
|
+
}
|
1681
|
+
}
|
1682
|
+
}
|
1683
|
+
}
|
1684
|
+
|
1685
|
+
return to;
|
1686
|
+
};
|
1687
|
+
|
1688
|
+
|
1689
|
+
/***/ }),
|
1690
|
+
/* 6 */
|
1691
|
+
/***/ (function(module, exports, __webpack_require__) {
|
1692
|
+
|
1693
|
+
/* WEBPACK VAR INJECTION */(function(process) {/**
|
1694
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
1695
|
+
* All rights reserved.
|
1696
|
+
*
|
1697
|
+
* This source code is licensed under the BSD-style license found in the
|
1698
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
1699
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
1700
|
+
*
|
1701
|
+
*/
|
1702
|
+
|
1703
|
+
'use strict';
|
1704
|
+
|
1705
|
+
var emptyObject = {};
|
1706
|
+
|
1707
|
+
if (process.env.NODE_ENV !== 'production') {
|
1708
|
+
Object.freeze(emptyObject);
|
1709
|
+
}
|
1710
|
+
|
1711
|
+
module.exports = emptyObject;
|
1712
|
+
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4)))
|
1713
|
+
|
1714
|
+
/***/ }),
|
1715
|
+
/* 7 */
|
1716
|
+
/***/ (function(module, exports, __webpack_require__) {
|
1717
|
+
|
1718
|
+
/* WEBPACK VAR INJECTION */(function(process) {/**
|
1719
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
1720
|
+
* All rights reserved.
|
1721
|
+
*
|
1722
|
+
* This source code is licensed under the BSD-style license found in the
|
1723
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
1724
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
1725
|
+
*
|
1726
|
+
*/
|
1727
|
+
|
1728
|
+
'use strict';
|
1729
|
+
|
1730
|
+
/**
|
1731
|
+
* Use invariant() to assert state which your program assumes to be true.
|
1732
|
+
*
|
1733
|
+
* Provide sprintf-style format (only %s is supported) and arguments
|
1734
|
+
* to provide information about what broke and what you were
|
1735
|
+
* expecting.
|
1736
|
+
*
|
1737
|
+
* The invariant message will be stripped in production, but the invariant
|
1738
|
+
* will remain to ensure logic does not differ in production.
|
1739
|
+
*/
|
1740
|
+
|
1741
|
+
var validateFormat = function validateFormat(format) {};
|
1742
|
+
|
1743
|
+
if (process.env.NODE_ENV !== 'production') {
|
1744
|
+
validateFormat = function validateFormat(format) {
|
1745
|
+
if (format === undefined) {
|
1746
|
+
throw new Error('invariant requires an error message argument');
|
1747
|
+
}
|
1748
|
+
};
|
1749
|
+
}
|
1750
|
+
|
1751
|
+
function invariant(condition, format, a, b, c, d, e, f) {
|
1752
|
+
validateFormat(format);
|
1753
|
+
|
1754
|
+
if (!condition) {
|
1755
|
+
var error;
|
1756
|
+
if (format === undefined) {
|
1757
|
+
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
1758
|
+
} else {
|
1759
|
+
var args = [a, b, c, d, e, f];
|
1760
|
+
var argIndex = 0;
|
1761
|
+
error = new Error(format.replace(/%s/g, function () {
|
1762
|
+
return args[argIndex++];
|
1763
|
+
}));
|
1764
|
+
error.name = 'Invariant Violation';
|
1765
|
+
}
|
1766
|
+
|
1767
|
+
error.framesToPop = 1; // we don't care about invariant's own frame
|
1768
|
+
throw error;
|
1769
|
+
}
|
1770
|
+
}
|
1771
|
+
|
1772
|
+
module.exports = invariant;
|
1773
|
+
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4)))
|
1774
|
+
|
1775
|
+
/***/ }),
|
1776
|
+
/* 8 */
|
1777
|
+
/***/ (function(module, exports, __webpack_require__) {
|
1778
|
+
|
1779
|
+
/* WEBPACK VAR INJECTION */(function(process) {/**
|
1780
|
+
* Copyright 2014-2015, Facebook, Inc.
|
1781
|
+
* All rights reserved.
|
1782
|
+
*
|
1783
|
+
* This source code is licensed under the BSD-style license found in the
|
1784
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
1785
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
1786
|
+
*
|
1787
|
+
*/
|
1788
|
+
|
1789
|
+
'use strict';
|
1790
|
+
|
1791
|
+
var emptyFunction = __webpack_require__(9);
|
1792
|
+
|
1793
|
+
/**
|
1794
|
+
* Similar to invariant but only logs a warning if the condition is not met.
|
1795
|
+
* This can be used to log issues in development environments in critical
|
1796
|
+
* paths. Removing the logging code for production environments will keep the
|
1797
|
+
* same logic and follow the same code paths.
|
1798
|
+
*/
|
1799
|
+
|
1800
|
+
var warning = emptyFunction;
|
1801
|
+
|
1802
|
+
if (process.env.NODE_ENV !== 'production') {
|
1803
|
+
var printWarning = function printWarning(format) {
|
1804
|
+
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
1805
|
+
args[_key - 1] = arguments[_key];
|
1806
|
+
}
|
1807
|
+
|
1808
|
+
var argIndex = 0;
|
1809
|
+
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
1810
|
+
return args[argIndex++];
|
1811
|
+
});
|
1812
|
+
if (typeof console !== 'undefined') {
|
1813
|
+
console.error(message);
|
1814
|
+
}
|
1815
|
+
try {
|
1816
|
+
// --- Welcome to debugging React ---
|
1817
|
+
// This error was thrown as a convenience so that you can use this stack
|
1818
|
+
// to find the callsite that caused this warning to fire.
|
1819
|
+
throw new Error(message);
|
1820
|
+
} catch (x) {}
|
1821
|
+
};
|
1822
|
+
|
1823
|
+
warning = function warning(condition, format) {
|
1824
|
+
if (format === undefined) {
|
1825
|
+
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
1826
|
+
}
|
1827
|
+
|
1828
|
+
if (format.indexOf('Failed Composite propType: ') === 0) {
|
1829
|
+
return; // Ignore CompositeComponent proptype check.
|
1830
|
+
}
|
1831
|
+
|
1832
|
+
if (!condition) {
|
1833
|
+
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
1834
|
+
args[_key2 - 2] = arguments[_key2];
|
1835
|
+
}
|
1836
|
+
|
1837
|
+
printWarning.apply(undefined, [format].concat(args));
|
1838
|
+
}
|
1839
|
+
};
|
1840
|
+
}
|
1841
|
+
|
1842
|
+
module.exports = warning;
|
1843
|
+
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4)))
|
1844
|
+
|
1845
|
+
/***/ }),
|
1846
|
+
/* 9 */
|
1847
|
+
/***/ (function(module, exports) {
|
1848
|
+
|
1849
|
+
"use strict";
|
1850
|
+
|
1851
|
+
/**
|
1852
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
1853
|
+
* All rights reserved.
|
1854
|
+
*
|
1855
|
+
* This source code is licensed under the BSD-style license found in the
|
1856
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
1857
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
1858
|
+
*
|
1859
|
+
*
|
1860
|
+
*/
|
1861
|
+
|
1862
|
+
function makeEmptyFunction(arg) {
|
1863
|
+
return function () {
|
1864
|
+
return arg;
|
1865
|
+
};
|
1866
|
+
}
|
1867
|
+
|
1868
|
+
/**
|
1869
|
+
* This function accepts and discards inputs; it has no side effects. This is
|
1870
|
+
* primarily useful idiomatically for overridable function endpoints which
|
1871
|
+
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
|
1872
|
+
*/
|
1873
|
+
var emptyFunction = function emptyFunction() {};
|
1874
|
+
|
1875
|
+
emptyFunction.thatReturns = makeEmptyFunction;
|
1876
|
+
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
|
1877
|
+
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
|
1878
|
+
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
|
1879
|
+
emptyFunction.thatReturnsThis = function () {
|
1880
|
+
return this;
|
1881
|
+
};
|
1882
|
+
emptyFunction.thatReturnsArgument = function (arg) {
|
1883
|
+
return arg;
|
1884
|
+
};
|
1885
|
+
|
1886
|
+
module.exports = emptyFunction;
|
1887
|
+
|
1888
|
+
/***/ }),
|
1889
|
+
/* 10 */
|
1890
|
+
/***/ (function(module, exports) {
|
1891
|
+
|
1892
|
+
'use strict';
|
1893
|
+
|
1894
|
+
var NumeralFormatter = function NumeralFormatter(numeralDecimalMark, numeralIntegerScale, numeralDecimalScale, numeralThousandsGroupStyle, numeralPositiveOnly, stripLeadingZeroes, delimiter) {
|
1895
|
+
var owner = this;
|
1896
|
+
|
1897
|
+
owner.numeralDecimalMark = numeralDecimalMark || '.';
|
1898
|
+
owner.numeralIntegerScale = numeralIntegerScale > 0 ? numeralIntegerScale : 0;
|
1899
|
+
owner.numeralDecimalScale = numeralDecimalScale >= 0 ? numeralDecimalScale : 2;
|
1900
|
+
owner.numeralThousandsGroupStyle = numeralThousandsGroupStyle || NumeralFormatter.groupStyle.thousand;
|
1901
|
+
owner.numeralPositiveOnly = !!numeralPositiveOnly;
|
1902
|
+
owner.stripLeadingZeroes = stripLeadingZeroes !== false;
|
1903
|
+
owner.delimiter = delimiter || delimiter === '' ? delimiter : ',';
|
1904
|
+
owner.delimiterRE = delimiter ? new RegExp('\\' + delimiter, 'g') : '';
|
1905
|
+
};
|
1906
|
+
|
1907
|
+
NumeralFormatter.groupStyle = {
|
1908
|
+
thousand: 'thousand',
|
1909
|
+
lakh: 'lakh',
|
1910
|
+
wan: 'wan',
|
1911
|
+
none: 'none'
|
1912
|
+
};
|
1913
|
+
|
1914
|
+
NumeralFormatter.prototype = {
|
1915
|
+
getRawValue: function getRawValue(value) {
|
1916
|
+
return value.replace(this.delimiterRE, '').replace(this.numeralDecimalMark, '.');
|
1917
|
+
},
|
1918
|
+
|
1919
|
+
format: function format(value) {
|
1920
|
+
var owner = this,
|
1921
|
+
parts,
|
1922
|
+
partInteger,
|
1923
|
+
partDecimal = '';
|
1924
|
+
|
1925
|
+
// strip alphabet letters
|
1926
|
+
value = value.replace(/[A-Za-z]/g, '')
|
1927
|
+
// replace the first decimal mark with reserved placeholder
|
1928
|
+
.replace(owner.numeralDecimalMark, 'M')
|
1929
|
+
|
1930
|
+
// strip non numeric letters except minus and "M"
|
1931
|
+
// this is to ensure prefix has been stripped
|
1932
|
+
.replace(/[^\dM-]/g, '')
|
1933
|
+
|
1934
|
+
// replace the leading minus with reserved placeholder
|
1935
|
+
.replace(/^\-/, 'N')
|
1936
|
+
|
1937
|
+
// strip the other minus sign (if present)
|
1938
|
+
.replace(/\-/g, '')
|
1939
|
+
|
1940
|
+
// replace the minus sign (if present)
|
1941
|
+
.replace('N', owner.numeralPositiveOnly ? '' : '-')
|
1942
|
+
|
1943
|
+
// replace decimal mark
|
1944
|
+
.replace('M', owner.numeralDecimalMark);
|
1945
|
+
|
1946
|
+
// strip any leading zeros
|
1947
|
+
if (owner.stripLeadingZeroes) {
|
1948
|
+
value = value.replace(/^(-)?0+(?=\d)/, '$1');
|
1949
|
+
}
|
1950
|
+
|
1951
|
+
partInteger = value;
|
1952
|
+
|
1953
|
+
if (value.indexOf(owner.numeralDecimalMark) >= 0) {
|
1954
|
+
parts = value.split(owner.numeralDecimalMark);
|
1955
|
+
partInteger = parts[0];
|
1956
|
+
partDecimal = owner.numeralDecimalMark + parts[1].slice(0, owner.numeralDecimalScale);
|
1957
|
+
}
|
1958
|
+
|
1959
|
+
if (owner.numeralIntegerScale > 0) {
|
1960
|
+
partInteger = partInteger.slice(0, owner.numeralIntegerScale + (value.slice(0, 1) === '-' ? 1 : 0));
|
1961
|
+
}
|
1962
|
+
|
1963
|
+
switch (owner.numeralThousandsGroupStyle) {
|
1964
|
+
case NumeralFormatter.groupStyle.lakh:
|
1965
|
+
partInteger = partInteger.replace(/(\d)(?=(\d\d)+\d$)/g, '$1' + owner.delimiter);
|
1966
|
+
|
1967
|
+
break;
|
1968
|
+
|
1969
|
+
case NumeralFormatter.groupStyle.wan:
|
1970
|
+
partInteger = partInteger.replace(/(\d)(?=(\d{4})+$)/g, '$1' + owner.delimiter);
|
1971
|
+
|
1972
|
+
break;
|
1973
|
+
|
1974
|
+
case NumeralFormatter.groupStyle.thousand:
|
1975
|
+
partInteger = partInteger.replace(/(\d)(?=(\d{3})+$)/g, '$1' + owner.delimiter);
|
1976
|
+
|
1977
|
+
break;
|
1978
|
+
}
|
1979
|
+
|
1980
|
+
return partInteger.toString() + (owner.numeralDecimalScale > 0 ? partDecimal.toString() : '');
|
1981
|
+
}
|
1982
|
+
};
|
1983
|
+
|
1984
|
+
module.exports = NumeralFormatter;
|
1985
|
+
|
1986
|
+
/***/ }),
|
1987
|
+
/* 11 */
|
1988
|
+
/***/ (function(module, exports) {
|
1989
|
+
|
1990
|
+
'use strict';
|
1991
|
+
|
1992
|
+
var DateFormatter = function DateFormatter(datePattern) {
|
1993
|
+
var owner = this;
|
1994
|
+
|
1995
|
+
owner.date = [];
|
1996
|
+
owner.blocks = [];
|
1997
|
+
owner.datePattern = datePattern;
|
1998
|
+
owner.initBlocks();
|
1999
|
+
};
|
2000
|
+
|
2001
|
+
DateFormatter.prototype = {
|
2002
|
+
initBlocks: function initBlocks() {
|
2003
|
+
var owner = this;
|
2004
|
+
owner.datePattern.forEach(function (value) {
|
2005
|
+
if (value === 'Y') {
|
2006
|
+
owner.blocks.push(4);
|
2007
|
+
} else {
|
2008
|
+
owner.blocks.push(2);
|
2009
|
+
}
|
2010
|
+
});
|
2011
|
+
},
|
2012
|
+
|
2013
|
+
getISOFormatDate: function getISOFormatDate() {
|
2014
|
+
var owner = this,
|
2015
|
+
date = owner.date;
|
2016
|
+
|
2017
|
+
return date[2] ? date[2] + '-' + owner.addLeadingZero(date[1]) + '-' + owner.addLeadingZero(date[0]) : '';
|
2018
|
+
},
|
2019
|
+
|
2020
|
+
getBlocks: function getBlocks() {
|
2021
|
+
return this.blocks;
|
2022
|
+
},
|
2023
|
+
|
2024
|
+
getValidatedDate: function getValidatedDate(value) {
|
2025
|
+
var owner = this,
|
2026
|
+
result = '';
|
2027
|
+
|
2028
|
+
value = value.replace(/[^\d]/g, '');
|
2029
|
+
|
2030
|
+
owner.blocks.forEach(function (length, index) {
|
2031
|
+
if (value.length > 0) {
|
2032
|
+
var sub = value.slice(0, length),
|
2033
|
+
sub0 = sub.slice(0, 1),
|
2034
|
+
rest = value.slice(length);
|
2035
|
+
|
2036
|
+
switch (owner.datePattern[index]) {
|
2037
|
+
case 'd':
|
2038
|
+
if (sub === '00') {
|
2039
|
+
sub = '01';
|
2040
|
+
} else if (parseInt(sub0, 10) > 3) {
|
2041
|
+
sub = '0' + sub0;
|
2042
|
+
} else if (parseInt(sub, 10) > 31) {
|
2043
|
+
sub = '31';
|
2044
|
+
}
|
2045
|
+
|
2046
|
+
break;
|
2047
|
+
|
2048
|
+
case 'm':
|
2049
|
+
if (sub === '00') {
|
2050
|
+
sub = '01';
|
2051
|
+
} else if (parseInt(sub0, 10) > 1) {
|
2052
|
+
sub = '0' + sub0;
|
2053
|
+
} else if (parseInt(sub, 10) > 12) {
|
2054
|
+
sub = '12';
|
2055
|
+
}
|
2056
|
+
|
2057
|
+
break;
|
2058
|
+
}
|
2059
|
+
|
2060
|
+
result += sub;
|
2061
|
+
|
2062
|
+
// update remaining string
|
2063
|
+
value = rest;
|
2064
|
+
}
|
2065
|
+
});
|
2066
|
+
|
2067
|
+
return this.getFixedDateString(result);
|
2068
|
+
},
|
2069
|
+
|
2070
|
+
getFixedDateString: function getFixedDateString(value) {
|
2071
|
+
var owner = this,
|
2072
|
+
datePattern = owner.datePattern,
|
2073
|
+
date = [],
|
2074
|
+
dayIndex = 0,
|
2075
|
+
monthIndex = 0,
|
2076
|
+
yearIndex = 0,
|
2077
|
+
dayStartIndex = 0,
|
2078
|
+
monthStartIndex = 0,
|
2079
|
+
yearStartIndex = 0,
|
2080
|
+
day,
|
2081
|
+
month,
|
2082
|
+
year,
|
2083
|
+
fullYearDone = false;
|
2084
|
+
|
2085
|
+
// mm-dd || dd-mm
|
2086
|
+
if (value.length === 4 && datePattern[0].toLowerCase() !== 'y' && datePattern[1].toLowerCase() !== 'y') {
|
2087
|
+
dayStartIndex = datePattern[0] === 'd' ? 0 : 2;
|
2088
|
+
monthStartIndex = 2 - dayStartIndex;
|
2089
|
+
day = parseInt(value.slice(dayStartIndex, dayStartIndex + 2), 10);
|
2090
|
+
month = parseInt(value.slice(monthStartIndex, monthStartIndex + 2), 10);
|
2091
|
+
|
2092
|
+
date = this.getFixedDate(day, month, 0);
|
2093
|
+
}
|
2094
|
+
|
2095
|
+
// yyyy-mm-dd || yyyy-dd-mm || mm-dd-yyyy || dd-mm-yyyy || dd-yyyy-mm || mm-yyyy-dd
|
2096
|
+
if (value.length === 8) {
|
2097
|
+
datePattern.forEach(function (type, index) {
|
2098
|
+
switch (type) {
|
2099
|
+
case 'd':
|
2100
|
+
dayIndex = index;
|
2101
|
+
break;
|
2102
|
+
case 'm':
|
2103
|
+
monthIndex = index;
|
2104
|
+
break;
|
2105
|
+
default:
|
2106
|
+
yearIndex = index;
|
2107
|
+
break;
|
2108
|
+
}
|
2109
|
+
});
|
2110
|
+
|
2111
|
+
yearStartIndex = yearIndex * 2;
|
2112
|
+
dayStartIndex = dayIndex <= yearIndex ? dayIndex * 2 : dayIndex * 2 + 2;
|
2113
|
+
monthStartIndex = monthIndex <= yearIndex ? monthIndex * 2 : monthIndex * 2 + 2;
|
2114
|
+
|
2115
|
+
day = parseInt(value.slice(dayStartIndex, dayStartIndex + 2), 10);
|
2116
|
+
month = parseInt(value.slice(monthStartIndex, monthStartIndex + 2), 10);
|
2117
|
+
year = parseInt(value.slice(yearStartIndex, yearStartIndex + 4), 10);
|
2118
|
+
|
2119
|
+
fullYearDone = value.slice(yearStartIndex, yearStartIndex + 4).length === 4;
|
2120
|
+
|
2121
|
+
date = this.getFixedDate(day, month, year);
|
2122
|
+
}
|
2123
|
+
|
2124
|
+
owner.date = date;
|
2125
|
+
|
2126
|
+
return date.length === 0 ? value : datePattern.reduce(function (previous, current) {
|
2127
|
+
switch (current) {
|
2128
|
+
case 'd':
|
2129
|
+
return previous + owner.addLeadingZero(date[0]);
|
2130
|
+
case 'm':
|
2131
|
+
return previous + owner.addLeadingZero(date[1]);
|
2132
|
+
default:
|
2133
|
+
return previous + (fullYearDone ? owner.addLeadingZeroForYear(date[2]) : '');
|
2134
|
+
}
|
2135
|
+
}, '');
|
2136
|
+
},
|
2137
|
+
|
2138
|
+
getFixedDate: function getFixedDate(day, month, year) {
|
2139
|
+
day = Math.min(day, 31);
|
2140
|
+
month = Math.min(month, 12);
|
2141
|
+
year = parseInt(year || 0, 10);
|
2142
|
+
|
2143
|
+
if (month < 7 && month % 2 === 0 || month > 8 && month % 2 === 1) {
|
2144
|
+
day = Math.min(day, month === 2 ? this.isLeapYear(year) ? 29 : 28 : 30);
|
2145
|
+
}
|
2146
|
+
|
2147
|
+
return [day, month, year];
|
2148
|
+
},
|
2149
|
+
|
2150
|
+
isLeapYear: function isLeapYear(year) {
|
2151
|
+
return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
|
2152
|
+
},
|
2153
|
+
|
2154
|
+
addLeadingZero: function addLeadingZero(number) {
|
2155
|
+
return (number < 10 ? '0' : '') + number;
|
2156
|
+
},
|
2157
|
+
|
2158
|
+
addLeadingZeroForYear: function addLeadingZeroForYear(number) {
|
2159
|
+
return (number < 10 ? '000' : number < 100 ? '00' : number < 1000 ? '0' : '') + number;
|
2160
|
+
}
|
2161
|
+
};
|
2162
|
+
|
2163
|
+
module.exports = DateFormatter;
|
2164
|
+
|
2165
|
+
/***/ }),
|
2166
|
+
/* 12 */
|
2167
|
+
/***/ (function(module, exports) {
|
2168
|
+
|
2169
|
+
'use strict';
|
2170
|
+
|
2171
|
+
var PhoneFormatter = function PhoneFormatter(formatter, delimiter) {
|
2172
|
+
var owner = this;
|
2173
|
+
|
2174
|
+
owner.delimiter = delimiter || delimiter === '' ? delimiter : ' ';
|
2175
|
+
owner.delimiterRE = delimiter ? new RegExp('\\' + delimiter, 'g') : '';
|
2176
|
+
|
2177
|
+
owner.formatter = formatter;
|
2178
|
+
};
|
2179
|
+
|
2180
|
+
PhoneFormatter.prototype = {
|
2181
|
+
setFormatter: function setFormatter(formatter) {
|
2182
|
+
this.formatter = formatter;
|
2183
|
+
},
|
2184
|
+
|
2185
|
+
format: function format(phoneNumber) {
|
2186
|
+
var owner = this;
|
2187
|
+
|
2188
|
+
owner.formatter.clear();
|
2189
|
+
|
2190
|
+
// only keep number and +
|
2191
|
+
phoneNumber = phoneNumber.replace(/[^\d+]/g, '');
|
2192
|
+
|
2193
|
+
// strip delimiter
|
2194
|
+
phoneNumber = phoneNumber.replace(owner.delimiterRE, '');
|
2195
|
+
|
2196
|
+
var result = '',
|
2197
|
+
current,
|
2198
|
+
validated = false;
|
2199
|
+
|
2200
|
+
for (var i = 0, iMax = phoneNumber.length; i < iMax; i++) {
|
2201
|
+
current = owner.formatter.inputDigit(phoneNumber.charAt(i));
|
2202
|
+
|
2203
|
+
// has ()- or space inside
|
2204
|
+
if (/[\s()-]/g.test(current)) {
|
2205
|
+
result = current;
|
2206
|
+
|
2207
|
+
validated = true;
|
2208
|
+
} else {
|
2209
|
+
if (!validated) {
|
2210
|
+
result = current;
|
2211
|
+
}
|
2212
|
+
// else: over length input
|
2213
|
+
// it turns to invalid number again
|
2214
|
+
}
|
2215
|
+
}
|
2216
|
+
|
2217
|
+
// strip ()
|
2218
|
+
// e.g. US: 7161234567 returns (716) 123-4567
|
2219
|
+
result = result.replace(/[()]/g, '');
|
2220
|
+
// replace library delimiter with user customized delimiter
|
2221
|
+
result = result.replace(/[\s-]/g, owner.delimiter);
|
2222
|
+
|
2223
|
+
return result;
|
2224
|
+
}
|
2225
|
+
};
|
2226
|
+
|
2227
|
+
module.exports = PhoneFormatter;
|
2228
|
+
|
2229
|
+
/***/ }),
|
2230
|
+
/* 13 */
|
2231
|
+
/***/ (function(module, exports) {
|
2232
|
+
|
2233
|
+
'use strict';
|
2234
|
+
|
2235
|
+
var CreditCardDetector = {
|
2236
|
+
blocks: {
|
2237
|
+
uatp: [4, 5, 6],
|
2238
|
+
amex: [4, 6, 5],
|
2239
|
+
diners: [4, 6, 4],
|
2240
|
+
discover: [4, 4, 4, 4],
|
2241
|
+
mastercard: [4, 4, 4, 4],
|
2242
|
+
dankort: [4, 4, 4, 4],
|
2243
|
+
instapayment: [4, 4, 4, 4],
|
2244
|
+
jcb15: [4, 6, 5],
|
2245
|
+
jcb: [4, 4, 4, 4],
|
2246
|
+
maestro: [4, 4, 4, 4],
|
2247
|
+
visa: [4, 4, 4, 4],
|
2248
|
+
mir: [4, 4, 4, 4],
|
2249
|
+
unionPay: [4, 4, 4, 4],
|
2250
|
+
general: [4, 4, 4, 4],
|
2251
|
+
generalStrict: [4, 4, 4, 7]
|
2252
|
+
},
|
2253
|
+
|
2254
|
+
re: {
|
2255
|
+
// starts with 1; 15 digits, not starts with 1800 (jcb card)
|
2256
|
+
uatp: /^(?!1800)1\d{0,14}/,
|
2257
|
+
|
2258
|
+
// starts with 34/37; 15 digits
|
2259
|
+
amex: /^3[47]\d{0,13}/,
|
2260
|
+
|
2261
|
+
// starts with 6011/65/644-649; 16 digits
|
2262
|
+
discover: /^(?:6011|65\d{0,2}|64[4-9]\d?)\d{0,12}/,
|
2263
|
+
|
2264
|
+
// starts with 300-305/309 or 36/38/39; 14 digits
|
2265
|
+
diners: /^3(?:0([0-5]|9)|[689]\d?)\d{0,11}/,
|
2266
|
+
|
2267
|
+
// starts with 51-55/2221–2720; 16 digits
|
2268
|
+
mastercard: /^(5[1-5]\d{0,2}|22[2-9]\d{0,1}|2[3-7]\d{0,2})\d{0,12}/,
|
2269
|
+
|
2270
|
+
// starts with 5019/4175/4571; 16 digits
|
2271
|
+
dankort: /^(5019|4175|4571)\d{0,12}/,
|
2272
|
+
|
2273
|
+
// starts with 637-639; 16 digits
|
2274
|
+
instapayment: /^63[7-9]\d{0,13}/,
|
2275
|
+
|
2276
|
+
// starts with 2131/1800; 15 digits
|
2277
|
+
jcb15: /^(?:2131|1800)\d{0,11}/,
|
2278
|
+
|
2279
|
+
// starts with 2131/1800/35; 16 digits
|
2280
|
+
jcb: /^(?:35\d{0,2})\d{0,12}/,
|
2281
|
+
|
2282
|
+
// starts with 50/56-58/6304/67; 16 digits
|
2283
|
+
maestro: /^(?:5[0678]\d{0,2}|6304|67\d{0,2})\d{0,12}/,
|
2284
|
+
|
2285
|
+
// starts with 22; 16 digits
|
2286
|
+
mir: /^220[0-4]\d{0,12}/,
|
2287
|
+
|
2288
|
+
// starts with 4; 16 digits
|
2289
|
+
visa: /^4\d{0,15}/,
|
2290
|
+
|
2291
|
+
// starts with 62; 16 digits
|
2292
|
+
unionPay: /^62\d{0,14}/
|
2293
|
+
},
|
2294
|
+
|
2295
|
+
getInfo: function getInfo(value, strictMode) {
|
2296
|
+
var blocks = CreditCardDetector.blocks,
|
2297
|
+
re = CreditCardDetector.re;
|
2298
|
+
|
2299
|
+
// Some credit card can have up to 19 digits number.
|
2300
|
+
// Set strictMode to true will remove the 16 max-length restrain,
|
2301
|
+
// however, I never found any website validate card number like
|
2302
|
+
// this, hence probably you don't want to enable this option.
|
2303
|
+
strictMode = !!strictMode;
|
2304
|
+
|
2305
|
+
for (var key in re) {
|
2306
|
+
if (re[key].test(value)) {
|
2307
|
+
var block;
|
2308
|
+
|
2309
|
+
if (strictMode) {
|
2310
|
+
block = blocks.generalStrict;
|
2311
|
+
} else {
|
2312
|
+
block = blocks[key];
|
2313
|
+
}
|
2314
|
+
|
2315
|
+
return {
|
2316
|
+
type: key,
|
2317
|
+
blocks: block
|
2318
|
+
};
|
2319
|
+
}
|
2320
|
+
}
|
2321
|
+
|
2322
|
+
return {
|
2323
|
+
type: 'unknown',
|
2324
|
+
blocks: strictMode ? blocks.generalStrict : blocks.general
|
2325
|
+
};
|
2326
|
+
}
|
2327
|
+
};
|
2328
|
+
|
2329
|
+
module.exports = CreditCardDetector;
|
2330
|
+
|
2331
|
+
/***/ }),
|
2332
|
+
/* 14 */
|
2333
|
+
/***/ (function(module, exports) {
|
2334
|
+
|
2335
|
+
'use strict';
|
2336
|
+
|
2337
|
+
var Util = {
|
2338
|
+
noop: function noop() {},
|
2339
|
+
|
2340
|
+
strip: function strip(value, re) {
|
2341
|
+
return value.replace(re, '');
|
2342
|
+
},
|
2343
|
+
|
2344
|
+
isDelimiter: function isDelimiter(letter, delimiter, delimiters) {
|
2345
|
+
// single delimiter
|
2346
|
+
if (delimiters.length === 0) {
|
2347
|
+
return letter === delimiter;
|
2348
|
+
}
|
2349
|
+
|
2350
|
+
// multiple delimiters
|
2351
|
+
return delimiters.some(function (current) {
|
2352
|
+
if (letter === current) {
|
2353
|
+
return true;
|
2354
|
+
}
|
2355
|
+
});
|
2356
|
+
},
|
2357
|
+
|
2358
|
+
getDelimiterREByDelimiter: function getDelimiterREByDelimiter(delimiter) {
|
2359
|
+
return new RegExp(delimiter.replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1'), 'g');
|
2360
|
+
},
|
2361
|
+
|
2362
|
+
getNextCursorPosition: function getNextCursorPosition(prevPos, oldValue, newValue, delimiter, delimiters) {
|
2363
|
+
// If cursor was at the end of value, just place it back.
|
2364
|
+
// Because new value could contain additional chars.
|
2365
|
+
if (oldValue.length === prevPos) {
|
2366
|
+
return newValue.length;
|
2367
|
+
}
|
2368
|
+
|
2369
|
+
return prevPos + this.getPositionOffset(prevPos, oldValue, newValue, delimiter, delimiters);
|
2370
|
+
},
|
2371
|
+
|
2372
|
+
getPositionOffset: function getPositionOffset(prevPos, oldValue, newValue, delimiter, delimiters) {
|
2373
|
+
var oldRawValue, newRawValue, lengthOffset;
|
2374
|
+
|
2375
|
+
oldRawValue = this.stripDelimiters(oldValue.slice(0, prevPos), delimiter, delimiters);
|
2376
|
+
newRawValue = this.stripDelimiters(newValue.slice(0, prevPos), delimiter, delimiters);
|
2377
|
+
lengthOffset = oldRawValue.length - newRawValue.length;
|
2378
|
+
|
2379
|
+
return lengthOffset !== 0 ? lengthOffset / Math.abs(lengthOffset) : 0;
|
2380
|
+
},
|
2381
|
+
|
2382
|
+
stripDelimiters: function stripDelimiters(value, delimiter, delimiters) {
|
2383
|
+
var owner = this;
|
2384
|
+
|
2385
|
+
// single delimiter
|
2386
|
+
if (delimiters.length === 0) {
|
2387
|
+
var delimiterRE = delimiter ? owner.getDelimiterREByDelimiter(delimiter) : '';
|
2388
|
+
|
2389
|
+
return value.replace(delimiterRE, '');
|
2390
|
+
}
|
2391
|
+
|
2392
|
+
// multiple delimiters
|
2393
|
+
delimiters.forEach(function (current) {
|
2394
|
+
value = value.replace(owner.getDelimiterREByDelimiter(current), '');
|
2395
|
+
});
|
2396
|
+
|
2397
|
+
return value;
|
2398
|
+
},
|
2399
|
+
|
2400
|
+
headStr: function headStr(str, length) {
|
2401
|
+
return str.slice(0, length);
|
2402
|
+
},
|
2403
|
+
|
2404
|
+
getMaxLength: function getMaxLength(blocks) {
|
2405
|
+
return blocks.reduce(function (previous, current) {
|
2406
|
+
return previous + current;
|
2407
|
+
}, 0);
|
2408
|
+
},
|
2409
|
+
|
2410
|
+
// strip value by prefix length
|
2411
|
+
// for prefix: PRE
|
2412
|
+
// (PRE123, 3) -> 123
|
2413
|
+
// (PR123, 3) -> 23 this happens when user hits backspace in front of "PRE"
|
2414
|
+
getPrefixStrippedValue: function getPrefixStrippedValue(value, prefix, prefixLength, prevValue) {
|
2415
|
+
if (value.slice(0, prefixLength) !== prefix) {
|
2416
|
+
|
2417
|
+
// Check whether if it is a deletion
|
2418
|
+
if (value.length < prevValue.length) {
|
2419
|
+
value = value.length > prefixLength ? prevValue : prefix;
|
2420
|
+
} else {
|
2421
|
+
var diffIndex = this.getFirstDiffIndex(prefix, value.slice(0, prefixLength));
|
2422
|
+
value = prefix + value.slice(diffIndex, diffIndex + 1) + value.slice(prefixLength + 1);
|
2423
|
+
}
|
2424
|
+
}
|
2425
|
+
|
2426
|
+
return value.slice(prefixLength);
|
2427
|
+
},
|
2428
|
+
|
2429
|
+
getFirstDiffIndex: function getFirstDiffIndex(prev, current) {
|
2430
|
+
var index = 0;
|
2431
|
+
|
2432
|
+
while (prev.charAt(index) === current.charAt(index)) {
|
2433
|
+
if (prev.charAt(index++) === '') {
|
2434
|
+
return -1;
|
2435
|
+
}
|
2436
|
+
}
|
2437
|
+
|
2438
|
+
return index;
|
2439
|
+
},
|
2440
|
+
|
2441
|
+
getFormattedValue: function getFormattedValue(value, blocks, blocksLength, delimiter, delimiters, delimiterLazyShow) {
|
2442
|
+
var result = '',
|
2443
|
+
multipleDelimiters = delimiters.length > 0,
|
2444
|
+
currentDelimiter;
|
2445
|
+
|
2446
|
+
// no options, normal input
|
2447
|
+
if (blocksLength === 0) {
|
2448
|
+
return value;
|
2449
|
+
}
|
2450
|
+
|
2451
|
+
blocks.forEach(function (length, index) {
|
2452
|
+
if (value.length > 0) {
|
2453
|
+
var sub = value.slice(0, length),
|
2454
|
+
rest = value.slice(length);
|
2455
|
+
|
2456
|
+
if (multipleDelimiters) {
|
2457
|
+
currentDelimiter = delimiters[delimiterLazyShow ? index - 1 : index] || currentDelimiter;
|
2458
|
+
} else {
|
2459
|
+
currentDelimiter = delimiter;
|
2460
|
+
}
|
2461
|
+
|
2462
|
+
if (delimiterLazyShow) {
|
2463
|
+
if (index > 0) {
|
2464
|
+
result += currentDelimiter;
|
2465
|
+
}
|
2466
|
+
|
2467
|
+
result += sub;
|
2468
|
+
} else {
|
2469
|
+
result += sub;
|
2470
|
+
|
2471
|
+
if (sub.length === length && index < blocksLength - 1) {
|
2472
|
+
result += currentDelimiter;
|
2473
|
+
}
|
2474
|
+
}
|
2475
|
+
|
2476
|
+
// update remaining string
|
2477
|
+
value = rest;
|
2478
|
+
}
|
2479
|
+
});
|
2480
|
+
|
2481
|
+
return result;
|
2482
|
+
},
|
2483
|
+
|
2484
|
+
// move cursor to the end
|
2485
|
+
// the first time user focuses on an input with prefix
|
2486
|
+
fixPrefixCursor: function fixPrefixCursor(el, prefix, delimiter, delimiters) {
|
2487
|
+
if (!el) {
|
2488
|
+
return;
|
2489
|
+
}
|
2490
|
+
|
2491
|
+
var val = el.value,
|
2492
|
+
appendix = delimiter || delimiters[0] || ' ';
|
2493
|
+
|
2494
|
+
if (!el.setSelectionRange || !prefix || prefix.length + appendix.length < val.length) {
|
2495
|
+
return;
|
2496
|
+
}
|
2497
|
+
|
2498
|
+
var len = val.length * 2;
|
2499
|
+
|
2500
|
+
// set timeout to avoid blink
|
2501
|
+
setTimeout(function () {
|
2502
|
+
el.setSelectionRange(len, len);
|
2503
|
+
}, 1);
|
2504
|
+
},
|
2505
|
+
|
2506
|
+
setSelection: function setSelection(element, position, doc) {
|
2507
|
+
if (element !== doc.activeElement) {
|
2508
|
+
return;
|
2509
|
+
}
|
2510
|
+
|
2511
|
+
// cursor is already in the end
|
2512
|
+
if (element && element.value.length <= position) {
|
2513
|
+
return;
|
2514
|
+
}
|
2515
|
+
|
2516
|
+
if (element.createTextRange) {
|
2517
|
+
var range = element.createTextRange();
|
2518
|
+
|
2519
|
+
range.move('character', position);
|
2520
|
+
range.select();
|
2521
|
+
} else {
|
2522
|
+
try {
|
2523
|
+
element.setSelectionRange(position, position);
|
2524
|
+
} catch (e) {
|
2525
|
+
// eslint-disable-next-line
|
2526
|
+
console.warn('The input element type does not support selection');
|
2527
|
+
}
|
2528
|
+
}
|
2529
|
+
},
|
2530
|
+
|
2531
|
+
isAndroid: function isAndroid() {
|
2532
|
+
return navigator && /android/i.test(navigator.userAgent);
|
2533
|
+
},
|
2534
|
+
|
2535
|
+
// On Android chrome, the keyup and keydown events
|
2536
|
+
// always return key code 229 as a composition that
|
2537
|
+
// buffers the user’s keystrokes
|
2538
|
+
// see https://github.com/nosir/cleave.js/issues/147
|
2539
|
+
isAndroidBackspaceKeydown: function isAndroidBackspaceKeydown(lastInputValue, currentInputValue) {
|
2540
|
+
if (!this.isAndroid() || !lastInputValue || !currentInputValue) {
|
2541
|
+
return false;
|
2542
|
+
}
|
2543
|
+
|
2544
|
+
return currentInputValue === lastInputValue.slice(0, -1);
|
2545
|
+
}
|
2546
|
+
};
|
2547
|
+
|
2548
|
+
module.exports = Util;
|
2549
|
+
|
2550
|
+
/***/ }),
|
2551
|
+
/* 15 */
|
2552
|
+
/***/ (function(module, exports) {
|
2553
|
+
|
2554
|
+
/* WEBPACK VAR INJECTION */(function(global) {'use strict';
|
2555
|
+
|
2556
|
+
/**
|
2557
|
+
* Props Assignment
|
2558
|
+
*
|
2559
|
+
* Separate this, so react module can share the usage
|
2560
|
+
*/
|
2561
|
+
|
2562
|
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
2563
|
+
|
2564
|
+
var DefaultProperties = {
|
2565
|
+
// Maybe change to object-assign
|
2566
|
+
// for now just keep it as simple
|
2567
|
+
assign: function assign(target, opts) {
|
2568
|
+
target = target || {};
|
2569
|
+
opts = opts || {};
|
2570
|
+
|
2571
|
+
// credit card
|
2572
|
+
target.creditCard = !!opts.creditCard;
|
2573
|
+
target.creditCardStrictMode = !!opts.creditCardStrictMode;
|
2574
|
+
target.creditCardType = '';
|
2575
|
+
target.onCreditCardTypeChanged = opts.onCreditCardTypeChanged || function () {};
|
2576
|
+
|
2577
|
+
// phone
|
2578
|
+
target.phone = !!opts.phone;
|
2579
|
+
target.phoneRegionCode = opts.phoneRegionCode || 'AU';
|
2580
|
+
target.phoneFormatter = {};
|
2581
|
+
|
2582
|
+
// date
|
2583
|
+
target.date = !!opts.date;
|
2584
|
+
target.datePattern = opts.datePattern || ['d', 'm', 'Y'];
|
2585
|
+
target.dateFormatter = {};
|
2586
|
+
|
2587
|
+
// numeral
|
2588
|
+
target.numeral = !!opts.numeral;
|
2589
|
+
target.numeralIntegerScale = opts.numeralIntegerScale > 0 ? opts.numeralIntegerScale : 0;
|
2590
|
+
target.numeralDecimalScale = opts.numeralDecimalScale >= 0 ? opts.numeralDecimalScale : 2;
|
2591
|
+
target.numeralDecimalMark = opts.numeralDecimalMark || '.';
|
2592
|
+
target.numeralThousandsGroupStyle = opts.numeralThousandsGroupStyle || 'thousand';
|
2593
|
+
target.numeralPositiveOnly = !!opts.numeralPositiveOnly;
|
2594
|
+
target.stripLeadingZeroes = opts.stripLeadingZeroes !== false;
|
2595
|
+
|
2596
|
+
// others
|
2597
|
+
target.numericOnly = target.creditCard || target.date || !!opts.numericOnly;
|
2598
|
+
|
2599
|
+
target.uppercase = !!opts.uppercase;
|
2600
|
+
target.lowercase = !!opts.lowercase;
|
2601
|
+
|
2602
|
+
target.prefix = target.creditCard || target.date ? '' : opts.prefix || '';
|
2603
|
+
target.noImmediatePrefix = !!opts.noImmediatePrefix;
|
2604
|
+
target.prefixLength = target.prefix.length;
|
2605
|
+
target.rawValueTrimPrefix = !!opts.rawValueTrimPrefix;
|
2606
|
+
target.copyDelimiter = !!opts.copyDelimiter;
|
2607
|
+
|
2608
|
+
target.initValue = opts.initValue !== undefined && opts.initValue !== null ? opts.initValue.toString() : '';
|
2609
|
+
|
2610
|
+
target.delimiter = opts.delimiter || opts.delimiter === '' ? opts.delimiter : opts.date ? '/' : opts.numeral ? ',' : opts.phone ? ' ' : ' ';
|
2611
|
+
target.delimiterLength = target.delimiter.length;
|
2612
|
+
target.delimiterLazyShow = !!opts.delimiterLazyShow;
|
2613
|
+
target.delimiters = opts.delimiters || [];
|
2614
|
+
|
2615
|
+
target.blocks = opts.blocks || [];
|
2616
|
+
target.blocksLength = target.blocks.length;
|
2617
|
+
|
2618
|
+
target.document = opts.document || document;
|
2619
|
+
target.root = (typeof global === 'undefined' ? 'undefined' : _typeof(global)) === 'object' && global ? global : window;
|
2620
|
+
|
2621
|
+
target.maxLength = 0;
|
2622
|
+
|
2623
|
+
target.backspace = false;
|
2624
|
+
target.result = '';
|
2625
|
+
|
2626
|
+
target.onValueChanged = opts.onValueChanged || function () {};
|
2627
|
+
|
2628
|
+
return target;
|
2629
|
+
}
|
2630
|
+
};
|
2631
|
+
|
2632
|
+
module.exports = DefaultProperties;
|
2633
|
+
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
|
2634
|
+
|
2635
|
+
/***/ })
|
2636
|
+
/******/ ])
|
2637
|
+
});
|
2638
|
+
;
|