Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.145.84.128
(window.webpackJsonp=window.webpackJsonp||[]).push([[138],{1170:function(e,t,n){"use strict";n.r(t);var r=n(2),a=n(41),o=n.n(a),s=n(68),l=n(99),i=n(100),u=n(102),c=n(101),p=n(103),d=n(1),h=n.n(d),f=n(104),m=n(1139),g=n(1106),v=n(272),w=n(1098),b=n(1100),E=n(1101),k=n(858),C=n(266),S=n(269),O=n(271),x=(n(273),n(284),function(e){function t(){var e,n;Object(l.a)(this,t);for(var r=arguments.length,a=new Array(r),i=0;i<r;i++)a[i]=arguments[i];return(n=Object(u.a)(this,(e=Object(c.a)(t)).call.apply(e,[this].concat(a)))).state={deggrp:"",date:[],subject:[],degree:[],centre:[],session:[],reportorder:""},n.componentDidMount=Object(s.a)(o.a.mark(function e(){return o.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.props.loaddegreegroup();case 2:case"end":return e.stop()}},e)})),n.handleChangeDeggrp=function(){var e=Object(s.a)(o.a.mark(function e(t,r){return o.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.setState({deggrp:r.value});case 2:return e.next=4,n.props.loadall(n.state);case 4:n.setState({date:["All"],subject:["All"],degree:["All"],centre:["All"],session:["All"]});case 5:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}(),n.handleChangeDate=function(){var e=Object(s.a)(o.a.mark(function e(t,r){return o.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.setState({date:r.value});case 2:return e.next=4,n.props.loadall(n.state);case 4:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}(),n.handleChangeSubject=function(){var e=Object(s.a)(o.a.mark(function e(t,r){return o.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.setState({subject:r.value});case 2:return e.next=4,n.props.loadall(n.state);case 4:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}(),n.handleChangeDegree=function(){var e=Object(s.a)(o.a.mark(function e(t,r){return o.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.setState({degree:r.value});case 2:return e.next=4,n.props.loadall(n.state);case 4:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}(),n.handleChangeCentre=function(){var e=Object(s.a)(o.a.mark(function e(t,r){return o.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.setState({centre:r.value});case 2:return e.next=4,n.props.loadall(n.state);case 4:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}(),n.handleChangeSession=function(){var e=Object(s.a)(o.a.mark(function e(t,r){return o.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.setState({session:r.value});case 2:return e.next=4,n.props.loadall(n.state);case 4:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}(),n.handleChangeReportOrder=function(e,t){n.setState({reportorder:t.value})},n.handleSubmit=Object(s.a)(o.a.mark(function e(){var t,r,a,s,l,i,u;return o.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(""!==n.state.deggrp){e.next=4;break}return t={header:"Error",content:"Select Degree Group"},n.props.showError(t),e.abrupt("return");case 4:if(""!==n.state.date){e.next=8;break}return r={header:"Error",content:"Select Date"},n.props.showError(r),e.abrupt("return");case 8:if(""!==n.state.subject){e.next=12;break}return a={header:"Error",content:"Select Subject"},n.props.showError(a),e.abrupt("return");case 12:if(""!==n.state.degree){e.next=16;break}return s={header:"Error",content:"Select Degree"},n.props.showError(s),e.abrupt("return");case 16:if(""!==n.state.centre){e.next=20;break}return l={header:"Error",content:"Select Centre"},n.props.showError(l),e.abrupt("return");case 20:if(""!==n.state.session){e.next=24;break}return i={header:"Error",content:"Select Session"},n.props.showError(i),e.abrupt("return");case 24:if(""!==n.state.reportorder){e.next=28;break}return u={header:"Error",content:"Select Report Order"},n.props.showError(u),e.abrupt("return");case 28:return e.next=30,n.props.loadtableexamcentre(n.state);case 30:console.log(n.props.table);case 31:case"end":return e.stop()}},e)})),n.handleCancel=Object(s.a)(o.a.mark(function e(){return o.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n.setState({deggrp:"",date:[],subject:[],degree:[],centre:[],session:[],reporttype:"",reportorder:""});case 1:case"end":return e.stop()}},e)})),n.handleSubmitReport=Object(s.a)(o.a.mark(function e(){var t,r,a,s,l,i,u,c,p,d,h,f,m,g;return o.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.state,r=t.deggrp,a=t.date,s=t.subject,l=t.degree,i=t.centre,u=t.session,t.reportorder,""!==n.state.deggrp){e.next=5;break}return c={header:"Error",content:"Select Degree Group"},n.props.showError(c),e.abrupt("return");case 5:if(""!==n.state.date){e.next=9;break}return p={header:"Error",content:"Select Date"},n.props.showError(p),e.abrupt("return");case 9:if(""!==n.state.subject){e.next=13;break}return d={header:"Error",content:"Select Subject"},n.props.showError(d),e.abrupt("return");case 13:if(""!==n.state.degree){e.next=17;break}return h={header:"Error",content:"Select Degree"},n.props.showError(h),e.abrupt("return");case 17:if(""!==n.state.centre){e.next=21;break}return f={header:"Error",content:"Select Centre"},n.props.showError(f),e.abrupt("return");case 21:if(""!==n.state.session){e.next=25;break}return m={header:"Error",content:"Select Session"},n.props.showError(m),e.abrupt("return");case 25:if(""!==n.state.reportorder){e.next=29;break}return g={header:"Error",content:"Select Report Order"},n.props.showError(g),e.abrupt("return");case 29:if("qpwisedatewisecentrewise"!=n.state.reportorder){e.next=32;break}return e.next=32,window.open(O.c+"ViewExamCentreNewReport_excel°grp="+r+"&univcode="+n.props.univcode+"&date="+JSON.stringify(a)+"&subject="+JSON.stringify(s)+"°ree="+JSON.stringify(l)+"¢re="+JSON.stringify(i)+"&session="+JSON.stringify(u),"_blank");case 32:case"end":return e.stop()}},e)})),n}return Object(p.a)(t,e),Object(i.a)(t,[{key:"render",value:function(){var e=this.state,t=e.deggrp,n=e.date,a=e.subject,o=e.degree,s=e.centre,l=e.session,i=e.reportorder,u=[{key:1,value:"All",text:"All"}],c=this.props.degcentre.map(function(e){return{key:e.fdeggrp,value:e.fdeggrp,text:e.fdescpn}}),p=this.props.all.date.map(function(e){return{key:e.fdoe,value:e.fdoe,text:e.fdoe}}),d=[].concat(u,Object(r.a)(p)),f=this.props.all.sub.map(function(e,t){return{key:t+"_"+e.fsubname,value:e.fsubcode,text:e.fsubname}}),C=[].concat(u,Object(r.a)(f)),S=this.props.all.degree.map(function(e){return{key:e.fdegree,value:e.fdegree,text:e.fdescpn}}),O=[].concat(u,Object(r.a)(S)),x=this.props.all.centre.map(function(e){return{key:e.fcntrcode,value:e.fcntrcode,text:e.fcntrcode}}),y=[].concat(u,Object(r.a)(x)),D=this.props.all.session.map(function(e){return{key:e.fsession,value:e.fsession,text:e.fsession}}),j=[].concat(u,Object(r.a)(D));return h.a.createElement("div",{className:"animated fadeIn"},h.a.createElement(m.a,{fluid:!0},h.a.createElement(m.a.Content,null,h.a.createElement(m.a.Header,{style:{display:"flex"}},h.a.createElement("h4",null,"View Exam Centre New"),h.a.createElement("div",{className:"ml-auto"},h.a.createElement(g.a,{basic:!0,color:"blue",onClick:this.handleSubmitReport,content:"Report",icon:"file"}),h.a.createElement(g.a,{basic:!0,color:"black",icon:"ban",onClick:this.handleCancel,content:"Cancel"}),h.a.createElement(k.a,{to:"/dashboard"},h.a.createElement(g.a,{basic:!0,color:"red",content:"Exit",icon:"home"})))),h.a.createElement(v.a,null),h.a.createElement(m.a.Description,{style:{overflowY:"auto",height:"auto"}},h.a.createElement("div",{className:"col-md-8 col-lg-8 col-sm-12"},h.a.createElement(w.a,null,h.a.createElement(w.a.Group,null,h.a.createElement(w.a.Field,{width:8},h.a.createElement("label",null,"Degree Group"),h.a.createElement(b.a,{fluid:!0,search:!0,selection:!0,onChange:this.handleChangeDeggrp,value:t,name:"deggrp",placeholder:"Degree Group",options:c})),h.a.createElement(w.a.Field,{width:8},h.a.createElement("label",null,"Date"),h.a.createElement(b.a,{multiple:!0,fluid:!0,search:!0,selection:!0,onChange:this.handleChangeDate,value:n,name:"date",placeholder:"Date",options:d}))),h.a.createElement(w.a.Field,{width:16},h.a.createElement("label",null,"Subject"),h.a.createElement(b.a,{multiple:!0,fluid:!0,search:!0,selection:!0,onChange:this.handleChangeSubject,value:a,name:"subject",placeholder:"Subject",options:C})),h.a.createElement(w.a.Field,{width:16},h.a.createElement("label",null,"Degree"),h.a.createElement(b.a,{multiple:!0,fluid:!0,search:!0,selection:!0,onChange:this.handleChangeDegree,value:o,name:"degree",placeholder:"Degree",options:O})),h.a.createElement(w.a.Group,null,h.a.createElement(w.a.Field,{width:16},h.a.createElement("label",null,"Centre"),h.a.createElement(b.a,{multiple:!0,fluid:!0,search:!0,selection:!0,onChange:this.handleChangeCentre,value:s,name:"centre",placeholder:"Centre",options:y})),h.a.createElement(w.a.Field,{width:16},h.a.createElement("label",null,"Session"),h.a.createElement(b.a,{multiple:!0,fluid:!0,search:!0,selection:!0,onChange:this.handleChangeSession,value:l,name:"session",placeholder:"Session",options:j}))),h.a.createElement(w.a.Group,null,h.a.createElement(w.a.Field,{width:8},h.a.createElement("label",null,"Report Order"),h.a.createElement(b.a,{fluid:!0,search:!0,selection:!0,onChange:this.handleChangeReportOrder,value:i,name:"reportorder",placeholder:"Report Order",options:[{key:1,value:"qpwisedatewisecentrewise",text:"QP Wise,Centre Wise,Date Wise"}]}))),h.a.createElement(w.a.Field,null,h.a.createElement(g.a,{content:"Submit",color:"blue",onClick:this.handleSubmit}))),Object.keys(this.props.table).length>0?h.a.createElement(E.a,{celled:!0,padded:!0,style:{width:"1100px"}},h.a.createElement(E.a.Header,null,h.a.createElement(E.a.Row,null,h.a.createElement(E.a.HeaderCell,{singleLine:!0,style:{textAlign:"center"}},"Sl. No."),h.a.createElement(E.a.HeaderCell,{style:{textAlign:"center"}},"Centre Code"),h.a.createElement(E.a.HeaderCell,{style:{textAlign:"center"}},"College Name"),h.a.createElement(E.a.HeaderCell,{style:{textAlign:"center"}},"QP Code"),h.a.createElement(E.a.HeaderCell,{style:{textAlign:"center"}},"Subject Name"),h.a.createElement(E.a.HeaderCell,{style:{textAlign:"center"}},"Session"),h.a.createElement(E.a.HeaderCell,{style:{textAlign:"center"}},"Date of Exam"),h.a.createElement(E.a.HeaderCell,{style:{textAlign:"center"}},"Count"))),h.a.createElement(E.a.Body,null,this.props.table.map(function(e,t){return h.a.createElement(E.a.Row,null,h.a.createElement(E.a.Cell,{style:{textAlign:"center"}},t+1),h.a.createElement(E.a.Cell,{style:{textAlign:"center"}},e.fcntrcode),h.a.createElement(E.a.Cell,null,e.fcollname),h.a.createElement(E.a.Cell,{style:{textAlign:"center"}},e.fqpcode),h.a.createElement(E.a.Cell,null,e.fsubname),h.a.createElement(E.a.Cell,{style:{textAlign:"center"}},e.fsession),h.a.createElement(E.a.Cell,{style:{textAlign:"center"}},e.fdoe),h.a.createElement(E.a.Cell,{style:{textAlign:"center"}},e.cnt))}))):null)))))}}]),t}(d.Component));t.default=Object(f.b)(function(e){return{univcode:e.univ.funivcode,degcentre:e.deggrpexamcentre,all:e.allexamcentre,table:e.loadexamcentretable}},{showError:C.w,loaddegreegroup:function(){return function(){var e=Object(s.a)(o.a.mark(function e(t,n){var r,a,s,l;return o.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=n(),t({type:"SET_LOADER"}),e.next=4,S.a.get("/app.php",{params:{a:"loaddeggrpexamcentre",univcode:r.user.fcuruniv}});case 4:a=e.sent,t({type:"UNSET_LOADER"}),"object"!==typeof a.data?(s={header:"Error",content:"Something went wrong"},t(Object(C.w)(s))):-1===a.data.error_code?(l={header:"Error",content:a.data.data.msg},t(Object(C.w)(l))):t({type:"LOAD_DEGGRP_EXAMCENTRE",payload:a.data});case 7:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}()},loadall:function(e){return function(){var t=Object(s.a)(o.a.mark(function t(n,r){var a,s,l,i;return o.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a=r(),n({type:"SET_LOADER"}),t.next=4,S.a.post("/app.php?a=loadallexamcentre&univcode="+a.univ.funivcode+"°grp="+e.deggrp,{data:e});case 4:s=t.sent,n({type:"UNSET_LOADER"}),"object"!==typeof s.data?(l={header:"Error",content:"Something went wrong"},n(Object(C.w)(l))):-1===s.data.error_code?(i={header:"Error",content:s.data.data.msg},n(Object(C.w)(i))):n({type:"LOAD_ALL_EXAMCENTRE",payload:s.data});case 7:case"end":return t.stop()}},t)}));return function(e,n){return t.apply(this,arguments)}}()},loadtableexamcentre:function(e){return function(){var t=Object(s.a)(o.a.mark(function t(n,r){var a,s,l,i;return o.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a=r(),n({type:"SET_LOADER"}),t.next=4,S.a.post("/app.php?a=loadtableexamcentre&univcode="+a.univ.funivcode+"°grp="+e.deggrp,{data:e});case 4:s=t.sent,n({type:"UNSET_LOADER"}),"object"!==typeof s.data?(l={header:"Error",content:"Something went wrong"},n(Object(C.w)(l))):-1===s.data.error_code?(i={header:"Error",content:s.data.data.msg},n(Object(C.w)(i))):n({type:"LOAD_TABLE_EXAMCENTRE",payload:s.data});case 7:case"end":return t.stop()}},t)}));return function(e,n){return t.apply(this,arguments)}}()}})(x)},273:function(e,t,n){e.exports=n(274)},274:function(e,t,n){"use strict";var r,a=(r=n(1))&&"object"==typeof r&&"default"in r?r.default:r,o=n(105);function s(){return(s=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}).apply(this,arguments)}function l(e,t){e.prototype=Object.create(t.prototype),function(e,t){for(var n=Object.getOwnPropertyNames(t),r=0;r<n.length;r++){var a=n[r],o=Object.getOwnPropertyDescriptor(t,a);o&&o.configurable&&void 0===e[a]&&Object.defineProperty(e,a,o)}}(e.prototype.constructor=e,t)}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var u=function(e,t,n,r,a,o,s,l){if(!e){var i;if(void 0===t)i=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[n,r,a,o,s,l],c=0;(i=new Error(t.replace(/%s/g,function(){return u[c++]}))).name="Invariant Violation"}throw i.framesToPop=1,i}};function c(e,t,n){if("selectionStart"in e&&"selectionEnd"in e)e.selectionStart=t,e.selectionEnd=n;else{var r=e.createTextRange();r.collapse(!0),r.moveStart("character",t),r.moveEnd("character",n-t),r.select()}}var p={9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},d="_";function h(e,t,n){var r="",a="",o=null,s=[];if(void 0===t&&(t=d),null==n&&(n=p),!e||"string"!=typeof e)return{maskChar:t,formatChars:n,mask:null,prefix:null,lastEditablePosition:null,permanents:[]};var l=!1;return e.split("").forEach(function(e){l=!l&&"\\"===e||(l||!n[e]?(s.push(r.length),r.length===s.length-1&&(a+=e)):o=r.length+1,r+=e,!1)}),{maskChar:t,formatChars:n,prefix:a,mask:r,lastEditablePosition:o,permanents:s}}function f(e,t){return-1!==e.permanents.indexOf(t)}function m(e,t,n){var r=e.mask,a=e.formatChars;if(!n)return!1;if(f(e,t))return r[t]===n;var o=a[r[t]];return new RegExp(o).test(n)}function g(e,t){return t.split("").every(function(t,n){return f(e,n)||!m(e,n,t)})}function v(e,t){var n=e.maskChar,r=e.prefix;if(!n){for(;t.length>r.length&&f(e,t.length-1);)t=t.slice(0,t.length-1);return t.length}for(var a=r.length,o=t.length;o>=r.length;o--){var s=t[o];if(!f(e,o)&&m(e,o,s)){a=o+1;break}}return a}function w(e,t){return v(e,t)===e.mask.length}function b(e,t){var n=e.maskChar,r=e.mask,a=e.prefix;if(!n){for((t=E(e,"",t,0)).length<a.length&&(t=a);t.length<r.length&&f(e,t.length);)t+=r[t.length];return t}if(t)return E(e,b(e,""),t,0);for(var o=0;o<r.length;o++)f(e,o)?t+=r[o]:t+=n;return t}function E(e,t,n,r){var a=e.mask,o=e.maskChar,s=e.prefix,l=n.split(""),i=w(e,t);return!o&&r>t.length&&(t+=a.slice(t.length,r)),l.every(function(n){for(;c=n,f(e,u=r)&&c!==a[u];){if(r>=t.length&&(t+=a[r]),l=n,o&&f(e,r)&&l===o)return!0;if(++r>=a.length)return!1}var l,u,c;return!m(e,r,n)&&n!==o||(r<t.length?t=o||i||r<s.length?t.slice(0,r)+n+t.slice(r+1):(t=t.slice(0,r)+n+t.slice(r),b(e,t)):o||(t+=n),++r<a.length)}),t}function k(e,t){for(var n=e.mask,r=t;r<n.length;++r)if(!f(e,r))return r;return null}function C(e){return e||0===e?e+"":""}function S(e,t,n,r,a){var o=e.mask,s=e.prefix,l=e.lastEditablePosition,i=t,u="",c=0,p=0,d=Math.min(a.start,n.start);return n.end>a.start?p=(c=function(e,t,n,r){var a=e.mask,o=e.maskChar,s=n.split(""),l=r;return s.every(function(t){for(;s=t,f(e,n=r)&&s!==a[n];)if(++r>=a.length)return!1;var n,s;return(m(e,r,t)||t===o)&&r++,r<a.length}),r-l}(e,0,u=i.slice(a.start,n.end),d))?a.length:0:i.length<r.length&&(p=r.length-i.length),i=r,p&&(1!==p||a.length||(d=a.start===n.start?k(e,n.start):function(e,t){for(var n=t;0<=n;--n)if(!f(e,n))return n;return null}(e,n.start)),i=function(e,t,n,r){var a=n+r,o=e.maskChar,s=e.mask,l=e.prefix,i=t.split("");if(o)return i.map(function(t,r){return r<n||a<=r?t:f(e,r)?s[r]:o}).join("");for(var u=a;u<i.length;u++)f(e,u)&&(i[u]="");return n=Math.max(l.length,n),i.splice(n,a-n),t=i.join(""),b(e,t)}(e,i,d,p)),i=E(e,i,u,d),(d+=c)>=o.length?d=o.length:d<s.length&&!c?d=s.length:d>=s.length&&d<l&&c&&(d=k(e,d)),u||(u=null),{value:i=b(e,i),enteredString:u,selection:{start:d,end:d}}}function O(e){return"function"==typeof e}function x(){return window.cancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame}function y(e){return(x()?window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame:function(){return setTimeout(e,1e3/60)})(e)}function D(e){(x()||clearTimeout)(e)}var j=function(e){function t(t){var n=e.call(this,t)||this;n.focused=!1,n.mounted=!1,n.previousSelection=null,n.selectionDeferId=null,n.saveSelectionLoopDeferId=null,n.saveSelectionLoop=function(){n.previousSelection=n.getSelection(),n.saveSelectionLoopDeferId=y(n.saveSelectionLoop)},n.runSaveSelectionLoop=function(){null===n.saveSelectionLoopDeferId&&n.saveSelectionLoop()},n.stopSaveSelectionLoop=function(){null!==n.saveSelectionLoopDeferId&&(D(n.saveSelectionLoopDeferId),n.saveSelectionLoopDeferId=null,n.previousSelection=null)},n.getInputDOMNode=function(){if(!n.mounted)return null;var e=o.findDOMNode(i(i(n))),t="undefined"!=typeof window&&e instanceof window.Element;if(e&&!t)return null;if("INPUT"!==e.nodeName&&(e=e.querySelector("input")),!e)throw new Error("react-input-mask: inputComponent doesn't contain input node");return e},n.getInputValue=function(){var e=n.getInputDOMNode();return e?e.value:null},n.setInputValue=function(e){var t=n.getInputDOMNode();t&&(n.value=e,t.value=e)},n.setCursorToEnd=function(){var e=v(n.maskOptions,n.value),t=k(n.maskOptions,e);null!==t&&n.setCursorPosition(t)},n.setSelection=function(e,t,r){void 0===r&&(r={});var a=n.getInputDOMNode(),o=n.isFocused();a&&o&&(r.deferred||c(a,e,t),null!==n.selectionDeferId&&D(n.selectionDeferId),n.selectionDeferId=y(function(){n.selectionDeferId=null,c(a,e,t)}),n.previousSelection={start:e,end:t,length:Math.abs(t-e)})},n.getSelection=function(){return function(e){var t=0,n=0;if("selectionStart"in e&&"selectionEnd"in e)t=e.selectionStart,n=e.selectionEnd;else{var r=document.selection.createRange();r.parentElement()===e&&(t=-r.moveStart("character",-e.value.length),n=-r.moveEnd("character",-e.value.length))}return{start:t,end:n,length:n-t}}(n.getInputDOMNode())},n.getCursorPosition=function(){return n.getSelection().start},n.setCursorPosition=function(e){n.setSelection(e,e)},n.isFocused=function(){return n.focused},n.getBeforeMaskedValueChangeConfig=function(){var e=n.maskOptions,t=e.mask,r=e.maskChar,a=e.permanents,o=e.formatChars;return{mask:t,maskChar:r,permanents:a,alwaysShowMask:!!n.props.alwaysShowMask,formatChars:o}},n.isInputAutofilled=function(e,t,r,a){var o=n.getInputDOMNode();try{if(o.matches(":-webkit-autofill"))return!0}catch(u){}return!n.focused||a.end<r.length&&t.end===e.length},n.onChange=function(e){var t=i(i(n)).beforePasteState,r=i(i(n)).previousSelection,a=n.props.beforeMaskedValueChange,o=n.getInputValue(),s=n.value,l=n.getSelection();n.isInputAutofilled(o,l,s,r)&&(s=b(n.maskOptions,""),r={start:0,end:0,length:0}),t&&(r=t.selection,s=t.value,l={start:r.start+o.length,end:r.start+o.length,length:0},o=s.slice(0,r.start)+o+s.slice(r.end),n.beforePasteState=null);var u=S(n.maskOptions,o,l,s,r),c=u.enteredString,p=u.selection,d=u.value;if(O(a)){var h=a({value:d,selection:p},{value:s,selection:r},c,n.getBeforeMaskedValueChangeConfig());d=h.value,p=h.selection}n.setInputValue(d),O(n.props.onChange)&&n.props.onChange(e),n.isWindowsPhoneBrowser?n.setSelection(p.start,p.end,{deferred:!0}):n.setSelection(p.start,p.end)},n.onFocus=function(e){var t=n.props.beforeMaskedValueChange,r=n.maskOptions,a=r.mask,o=r.prefix;if(n.focused=!0,n.mounted=!0,a){if(n.value)v(n.maskOptions,n.value)<n.maskOptions.mask.length&&n.setCursorToEnd();else{var s=b(n.maskOptions,o),l=b(n.maskOptions,s),i=v(n.maskOptions,l),u=k(n.maskOptions,i),c={start:u,end:u};if(O(t)){var p=t({value:l,selection:c},{value:n.value,selection:null},null,n.getBeforeMaskedValueChangeConfig());l=p.value,c=p.selection}var d=l!==n.getInputValue();d&&n.setInputValue(l),d&&O(n.props.onChange)&&n.props.onChange(e),n.setSelection(c.start,c.end)}n.runSaveSelectionLoop()}O(n.props.onFocus)&&n.props.onFocus(e)},n.onBlur=function(e){var t=n.props.beforeMaskedValueChange,r=n.maskOptions.mask;if(n.stopSaveSelectionLoop(),n.focused=!1,r&&!n.props.alwaysShowMask&&g(n.maskOptions,n.value)){var a="";O(t)&&(a=t({value:a,selection:null},{value:n.value,selection:n.previousSelection},null,n.getBeforeMaskedValueChangeConfig()).value);var o=a!==n.getInputValue();o&&n.setInputValue(a),o&&O(n.props.onChange)&&n.props.onChange(e)}O(n.props.onBlur)&&n.props.onBlur(e)},n.onMouseDown=function(e){if(!n.focused&&document.addEventListener){n.mouseDownX=e.clientX,n.mouseDownY=e.clientY,n.mouseDownTime=(new Date).getTime();document.addEventListener("mouseup",function e(t){if(document.removeEventListener("mouseup",e),n.focused){var r=Math.abs(t.clientX-n.mouseDownX),a=Math.abs(t.clientY-n.mouseDownY),o=Math.max(r,a),s=(new Date).getTime()-n.mouseDownTime;(o<=10&&s<=200||o<=5&&s<=300)&&n.setCursorToEnd()}})}O(n.props.onMouseDown)&&n.props.onMouseDown(e)},n.onPaste=function(e){O(n.props.onPaste)&&n.props.onPaste(e),e.defaultPrevented||(n.beforePasteState={value:n.getInputValue(),selection:n.getSelection()},n.setInputValue(""))},n.handleRef=function(e){null==n.props.children&&O(n.props.inputRef)&&n.props.inputRef(e)};var r=t.mask,a=t.maskChar,s=t.formatChars,l=t.alwaysShowMask,u=t.beforeMaskedValueChange,p=t.defaultValue,d=t.value;n.maskOptions=h(r,a,s),null==p&&(p=""),null==d&&(d=p);var f=C(d);if(n.maskOptions.mask&&(l||f)&&(f=b(n.maskOptions,f),O(u))){var m=t.value;null==t.value&&(m=p),f=u({value:f,selection:null},{value:m=C(m),selection:null},null,n.getBeforeMaskedValueChangeConfig()).value}return n.value=f,n}l(t,e);var n=t.prototype;return n.componentDidMount=function(){this.mounted=!0,this.getInputDOMNode()&&(this.isWindowsPhoneBrowser=function(){var e=new RegExp("windows","i"),t=new RegExp("phone","i"),n=navigator.userAgent;return e.test(n)&&t.test(n)}(),this.maskOptions.mask&&this.getInputValue()!==this.value&&this.setInputValue(this.value))},n.componentDidUpdate=function(){var e=this.previousSelection,t=this.props,n=t.beforeMaskedValueChange,r=t.alwaysShowMask,a=t.mask,o=t.maskChar,s=t.formatChars,l=this.maskOptions,i=r||this.isFocused(),u=null!=this.props.value,c=u?C(this.props.value):this.value,p=e?e.start:null;if(this.maskOptions=h(a,o,s),this.maskOptions.mask){!l.mask&&this.isFocused()&&this.runSaveSelectionLoop();var d=this.maskOptions.mask&&this.maskOptions.mask!==l.mask;if(l.mask||u||(c=this.getInputValue()),(d||this.maskOptions.mask&&(c||i))&&(c=b(this.maskOptions,c)),d){var f=v(this.maskOptions,c);(null===p||f<p)&&(p=w(this.maskOptions,c)?f:k(this.maskOptions,f))}!this.maskOptions.mask||!g(this.maskOptions,c)||i||u&&this.props.value||(c="");var m={start:p,end:p};if(O(n)){var E=n({value:c,selection:m},{value:this.value,selection:this.previousSelection},null,this.getBeforeMaskedValueChangeConfig());c=E.value,m=E.selection}this.value=c;var S=this.getInputValue()!==this.value;S?(this.setInputValue(this.value),this.forceUpdate()):d&&this.forceUpdate();var x=!1;null!=m.start&&null!=m.end&&(x=!e||e.start!==m.start||e.end!==m.end),(x||S)&&this.setSelection(m.start,m.end)}else l.mask&&(this.stopSaveSelectionLoop(),this.forceUpdate())},n.componentWillUnmount=function(){this.mounted=!1,null!==this.selectionDeferId&&D(this.selectionDeferId),this.stopSaveSelectionLoop()},n.render=function(){var e,t=this.props,n=(t.mask,t.alwaysShowMask,t.maskChar,t.formatChars,t.inputRef,t.beforeMaskedValueChange,t.children),r=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],0<=t.indexOf(n)||(a[n]=e[n]);return a}(t,["mask","alwaysShowMask","maskChar","formatChars","inputRef","beforeMaskedValueChange","children"]);if(n){O(n)||u(!1);var o=["onChange","onPaste","onMouseDown","onFocus","onBlur","value","disabled","readOnly"],l=s({},r);o.forEach(function(e){return delete l[e]}),e=n(l),o.filter(function(t){return null!=e.props[t]&&e.props[t]!==r[t]}).length&&u(!1)}else e=a.createElement("input",s({ref:this.handleRef},r));var i={onFocus:this.onFocus,onBlur:this.onBlur};return this.maskOptions.mask&&(r.disabled||r.readOnly||(i.onChange=this.onChange,i.onPaste=this.onPaste,i.onMouseDown=this.onMouseDown),null!=r.value&&(i.value=this.value)),e=a.cloneElement(e,i)},t}(a.Component);e.exports=j}}]);
//# sourceMappingURL=138.e725b22c.chunk.js.map
|