componenteshospitais 3.0.9 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +1367 -142
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +1357 -132
- package/dist/esm/index.js.map +1 -1
- package/dist/types/components/InputField.d.ts +0 -1
- package/package.json +3 -1
- package/src/components/InputField.tsx +72 -86
package/dist/cjs/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var React = require('react');
|
|
3
|
+
var React$2 = require('react');
|
|
4
|
+
var reactDom = require('react-dom');
|
|
4
5
|
|
|
5
6
|
function styleInject(css, ref) {
|
|
6
7
|
if ( ref === void 0 ) ref = {};
|
|
@@ -39,10 +40,10 @@ styleInject(css_248z$8);
|
|
|
39
40
|
var TituloPagina = function (_a) {
|
|
40
41
|
var titulo = _a.titulo, onClick = _a.onClick, empresa = _a.empresa;
|
|
41
42
|
var empresaClass = styles$8["empresa".concat(empresa)];
|
|
42
|
-
return (React.createElement("div", { className: "".concat(empresaClass) },
|
|
43
|
-
React.createElement("div", { className: styles$8.header },
|
|
44
|
-
React.createElement("p", { className: styles$8.title }, titulo),
|
|
45
|
-
React.createElement("button", { onClick: onClick, className: styles$8.backButton }, "Voltar"))));
|
|
43
|
+
return (React$2.createElement("div", { className: "".concat(empresaClass) },
|
|
44
|
+
React$2.createElement("div", { className: styles$8.header },
|
|
45
|
+
React$2.createElement("p", { className: styles$8.title }, titulo),
|
|
46
|
+
React$2.createElement("button", { onClick: onClick, className: styles$8.backButton }, "Voltar"))));
|
|
46
47
|
};
|
|
47
48
|
|
|
48
49
|
var css_248z$7 = ".card-module_icone__8F-jV{height:55px;margin-right:10px;width:55px}.card-module_item__YYEzi{align-items:center;border-radius:10px;color:#fff;display:flex;font-size:18px;margin-bottom:1rem;padding:15px}.card-module_imgLateral__zCZz5{height:55px;margin-left:auto;margin-right:10px;width:55px}.card-module_empresa1__Jl5OB .card-module_item__YYEzi{background-color:var(--blue)}.card-module_empresa1__Jl5OB .card-module_item__YYEzi:hover{background-color:var(--red)}.card-module_empresa3__TCJpW .card-module_item__YYEzi{background-color:var(--green)}.card-module_empresa3__TCJpW .card-module_item__YYEzi:hover{background-color:var(--lightblue)}.card-module_empresa4__zoSLq .card-module_item__YYEzi{background-color:var(--red)}.card-module_empresa4__zoSLq .card-module_item__YYEzi:hover{background-color:var(--blue)}.card-module_empresa5__tlURf .card-module_item__YYEzi{background-color:var(--cartaoBlue)}.card-module_empresa5__tlURf .card-module_item__YYEzi:hover{background-color:var(--cartaoGreen)}";
|
|
@@ -67,11 +68,11 @@ var Card = function (_a) {
|
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
70
|
};
|
|
70
|
-
return (React.createElement("div", { className: "".concat(empresaClass), onClick: link ? handleClick : handleActionClick, style: { cursor: link || (funcao && parametro) ? 'pointer' : 'default' } },
|
|
71
|
-
React.createElement("div", { className: "".concat(styles$7.item, " empresa").concat(empresa), style: { width: largura ? "".concat(largura) : '' } },
|
|
72
|
-
img && (React.createElement("img", { src: img, alt: text, className: styles$7.icone })),
|
|
73
|
-
React.createElement("span", { className: styles$7.texto, dangerouslySetInnerHTML: { __html: text } }),
|
|
74
|
-
imgLateral && (React.createElement("img", { src: imgLateral, alt: "Right", className: styles$7.imgLateral })))));
|
|
71
|
+
return (React$2.createElement("div", { className: "".concat(empresaClass), onClick: link ? handleClick : handleActionClick, style: { cursor: link || (funcao && parametro) ? 'pointer' : 'default' } },
|
|
72
|
+
React$2.createElement("div", { className: "".concat(styles$7.item, " empresa").concat(empresa), style: { width: largura ? "".concat(largura) : '' } },
|
|
73
|
+
img && (React$2.createElement("img", { src: img, alt: text, className: styles$7.icone })),
|
|
74
|
+
React$2.createElement("span", { className: styles$7.texto, dangerouslySetInnerHTML: { __html: text } }),
|
|
75
|
+
imgLateral && (React$2.createElement("img", { src: imgLateral, alt: "Right", className: styles$7.imgLateral })))));
|
|
75
76
|
};
|
|
76
77
|
|
|
77
78
|
var css_248z$6 = ".cardImage-module_botaoCert__Rs0fg{align-items:center;border-color:transparent;border-radius:1rem;box-sizing:border-box;color:#fff;display:flex;flex-direction:column;justify-content:center;padding:.8rem;text-decoration:none}.cardImage-module_iconeOna__WQil5{height:150px;margin-bottom:10px}.cardImage-module_cardText__NfgFE{bottom:.5rem;font-size:18px;overflow:hidden;position:relative;text-align:center}.cardImage-module_empresa1__SnbEU{background-color:var(--blue)}.cardImage-module_empresa1__SnbEU:hover{background-color:var(--red)}.cardImage-module_empresa3__ItFp0{background-color:var(--green)}.cardImage-module_empresa3__ItFp0:hover{background-color:var(--lightblue)}.cardImage-module_empresa4__L6K5N{background-color:var(--red)}.cardImage-module_empresa4__L6K5N:hover{background-color:var(--blue)}.cardImage-module_empresa5__-b4e1{background-color:var(--cartaoGreen)}.cardImage-module_empresa5__-b4e1:hover{background-color:var(--cartaoBlue)}";
|
|
@@ -80,7 +81,7 @@ styleInject(css_248z$6);
|
|
|
80
81
|
|
|
81
82
|
var CardImage = function (_a) {
|
|
82
83
|
var img = _a.img, href = _a.href, texto = _a.texto, empresa = _a.empresa, largura = _a.largura, altura = _a.altura, externo = _a.externo, funcao = _a.funcao, parametro = _a.parametro, fileInput = _a.fileInput, alturaImage = _a.alturaImage, larguraImage = _a.larguraImage, onFileSelect = _a.onFileSelect, accept = _a.accept;
|
|
83
|
-
var _b = React.useState(null), fileName = _b[0], setFileName = _b[1];
|
|
84
|
+
var _b = React$2.useState(null), fileName = _b[0], setFileName = _b[1];
|
|
84
85
|
var empresaClass = styles$6["empresa".concat(empresa)];
|
|
85
86
|
var handleActionClick = function () {
|
|
86
87
|
if (funcao && parametro) {
|
|
@@ -99,11 +100,11 @@ var CardImage = function (_a) {
|
|
|
99
100
|
setFileName(null);
|
|
100
101
|
}
|
|
101
102
|
};
|
|
102
|
-
var content = (React.createElement(React.Fragment, null,
|
|
103
|
-
React.createElement("img", { src: img, alt: img, className: styles$6.iconeOna, style: { width: larguraImage ? larguraImage : undefined, height: alturaImage ? alturaImage : undefined } }),
|
|
104
|
-
texto && (React.createElement("span", { className: styles$6.cardText, dangerouslySetInnerHTML: { __html: texto } }))));
|
|
105
|
-
return (React.createElement("div", { className: "".concat(empresaClass), style: { width: largura ? "".concat(largura) : '250px', height: altura ? "".concat(altura) : '300px', borderRadius: '1rem' } }, fileInput ? (React.createElement("label", { className: "".concat(styles$6.botaoCert), style: { position: 'relative', cursor: 'pointer', display: 'flex', flexDirection: 'column', justifyContent: 'center', alignItems: 'center', width: '100%', height: '100%' } },
|
|
106
|
-
React.createElement("input", { type: "file", onChange: handleFileChange, style: {
|
|
103
|
+
var content = (React$2.createElement(React$2.Fragment, null,
|
|
104
|
+
React$2.createElement("img", { src: img, alt: img, className: styles$6.iconeOna, style: { width: larguraImage ? larguraImage : undefined, height: alturaImage ? alturaImage : undefined } }),
|
|
105
|
+
texto && (React$2.createElement("span", { className: styles$6.cardText, dangerouslySetInnerHTML: { __html: texto } }))));
|
|
106
|
+
return (React$2.createElement("div", { className: "".concat(empresaClass), style: { width: largura ? "".concat(largura) : '250px', height: altura ? "".concat(altura) : '300px', borderRadius: '1rem' } }, fileInput ? (React$2.createElement("label", { className: "".concat(styles$6.botaoCert), style: { position: 'relative', cursor: 'pointer', display: 'flex', flexDirection: 'column', justifyContent: 'center', alignItems: 'center', width: '100%', height: '100%' } },
|
|
107
|
+
React$2.createElement("input", { type: "file", onChange: handleFileChange, style: {
|
|
107
108
|
position: 'absolute',
|
|
108
109
|
top: 0,
|
|
109
110
|
left: 0,
|
|
@@ -113,7 +114,7 @@ var CardImage = function (_a) {
|
|
|
113
114
|
cursor: 'pointer'
|
|
114
115
|
}, accept: accept }),
|
|
115
116
|
content,
|
|
116
|
-
React.createElement("span", { className: styles$6.cardText }, fileName ? fileName : 'Selecione um arquivo'))) : (href ? (React.createElement("a", { href: href, target: externo ? "_blank" : "_self", rel: externo ? "noopener noreferrer" : undefined, className: "".concat(styles$6.botaoCert), title: href, style: { width: '100%', height: '100%' } }, content)) : (React.createElement("div", { className: "".concat(styles$6.botaoCert), onClick: handleActionClick, style: { width: '100%', height: '100%' } }, content)))));
|
|
117
|
+
React$2.createElement("span", { className: styles$6.cardText }, fileName ? fileName : 'Selecione um arquivo'))) : (href ? (React$2.createElement("a", { href: href, target: externo ? "_blank" : "_self", rel: externo ? "noopener noreferrer" : undefined, className: "".concat(styles$6.botaoCert), title: href, style: { width: '100%', height: '100%' } }, content)) : (React$2.createElement("div", { className: "".concat(styles$6.botaoCert), onClick: handleActionClick, style: { width: '100%', height: '100%' } }, content)))));
|
|
117
118
|
};
|
|
118
119
|
|
|
119
120
|
var css_248z$5 = ".input-module_inputSubmit__21-Pj{align-self:center;border:none;border-radius:20px;color:#fff;cursor:pointer;font-size:15px;padding:10px;width:10rem}.input-module_inputWrapper__oqH8F{position:relative;width:100%}.input-module_inputPadrao__jypjY{border:1px solid #ccc;border-radius:.5rem;box-sizing:border-box;font-style:italic;padding:.8rem 1rem;width:100%}.input-module_inputPadrao__jypjY:focus{outline:none}.input-module_searchIcon__miuBI{color:#888;font-size:1.2rem;left:8px;position:absolute}.input-module_passwordToggleIcon__D8cEc{cursor:pointer;font-size:1.2rem;position:absolute;right:10px;top:25px;transform:translateY(-50%)}.input-module_empresa1__bxBov .input-module_inputSubmit__21-Pj{background-color:var(--blue)}.input-module_empresa1__bxBov .input-module_inputSubmit__21-Pj:hover{background-color:var(--red)}.input-module_empresa3__RU89A .input-module_inputSubmit__21-Pj{background-color:var(--green)}.input-module_empresa3__RU89A .input-module_inputSubmit__21-Pj:hover{background-color:var(--lightblue)}.input-module_empresa4__rWmWH .input-module_inputSubmit__21-Pj{background-color:var(--red)}.input-module_empresa4__rWmWH .input-module_inputSubmit__21-Pj:hover{background-color:var(--blue)}.input-module_empresa5__rJ8DJ .input-module_inputSubmit__21-Pj{background-color:var(--cartaoGreen)}.input-module_empresa5__rJ8DJ .input-module_inputSubmit__21-Pj:hover{background-color:var(--cartaoBlue)}";
|
|
@@ -123,7 +124,7 @@ styleInject(css_248z$5);
|
|
|
123
124
|
var Button = function (_a) {
|
|
124
125
|
var empresa = _a.empresa, _b = _a.type, type = _b === void 0 ? 'submit' : _b, onClick = _a.onClick, texto = _a.texto, largura = _a.largura, borderRadius = _a.borderRadius, disabled = _a.disabled;
|
|
125
126
|
var empresaClass = styles$5["empresa".concat(empresa)];
|
|
126
|
-
return (React.createElement("div", { className: "".concat(empresaClass) }, type === 'submit' ? (React.createElement("input", { type: "submit", className: styles$5.inputSubmit, style: { width: largura ? "".concat(largura) : '', borderRadius: borderRadius ? "".concat(borderRadius, "px") : '' }, value: texto, disabled: disabled })) : (React.createElement("button", { type: "button", className: styles$5.inputSubmit, onClick: onClick, style: { width: largura ? "".concat(largura) : '', borderRadius: borderRadius ? "".concat(borderRadius, "px") : '' }, dangerouslySetInnerHTML: { __html: texto }, disabled: disabled }))));
|
|
127
|
+
return (React$2.createElement("div", { className: "".concat(empresaClass) }, type === 'submit' ? (React$2.createElement("input", { type: "submit", className: styles$5.inputSubmit, style: { width: largura ? "".concat(largura) : '', borderRadius: borderRadius ? "".concat(borderRadius, "px") : '' }, value: texto, disabled: disabled })) : (React$2.createElement("button", { type: "button", className: styles$5.inputSubmit, onClick: onClick, style: { width: largura ? "".concat(largura) : '', borderRadius: borderRadius ? "".concat(borderRadius, "px") : '' }, dangerouslySetInnerHTML: { __html: texto }, disabled: disabled }))));
|
|
127
128
|
};
|
|
128
129
|
|
|
129
130
|
/******************************************************************************
|
|
@@ -169,6 +170,1258 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
169
170
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
170
171
|
};
|
|
171
172
|
|
|
173
|
+
function createCommonjsModule(fn, module) {
|
|
174
|
+
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function _interopDefault$2(e){return e&&"object"==typeof e&&"default"in e?e["default"]:e}var React$1=_interopDefault$2(React$2);function _defaults2$1(e,t){for(var n=Object.getOwnPropertyNames(t),a=0;a<n.length;a++){var i=n[a],r=Object.getOwnPropertyDescriptor(t,i);r&&r.configurable&&e[i]===undefined&&Object.defineProperty(e,i,r);}return e}function _extends$2(){return (_extends$2=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);}return e}).apply(this,arguments)}function _inheritsLoose$1(e,t){e.prototype=Object.create(t.prototype),_defaults2$1(e.prototype.constructor=e,t);}function _objectWithoutPropertiesLoose$2(e,t){if(null==e)return {};var n,a,i={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],0<=t.indexOf(n)||(i[n]=e[n]);return i}function _assertThisInitialized$1(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var invariant$2=function(e,t,n,a,i,r,o,s){if(!e){var l;if(t===undefined)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,a,i,r,o,s],c=0;(l=new Error(t.replace(/%s/g,function(){return u[c++]}))).name="Invariant Violation";}throw l.framesToPop=1,l}},invariant_1$1=invariant$2;function setInputSelection$1(e,t,n){if("selectionStart"in e&&"selectionEnd"in e)e.selectionStart=t,e.selectionEnd=n;else {var a=e.createTextRange();a.collapse(!0),a.moveStart("character",t),a.moveEnd("character",n-t),a.select();}}function getInputSelection$1(e){var t=0,n=0;if("selectionStart"in e&&"selectionEnd"in e)t=e.selectionStart,n=e.selectionEnd;else {var a=document.selection.createRange();a.parentElement()===e&&(t=-a.moveStart("character",-e.value.length),n=-a.moveEnd("character",-e.value.length));}return {start:t,end:n,length:n-t}}var defaultFormatChars$1={9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},defaultMaskChar$1="_";function parseMask$1(e,t,n){var a="",i="",r=null,o=[];if(t===undefined&&(t=defaultMaskChar$1),null==n&&(n=defaultFormatChars$1),!e||"string"!=typeof e)return {maskChar:t,formatChars:n,mask:null,prefix:null,lastEditablePosition:null,permanents:[]};var s=!1;return e.split("").forEach(function(e){s=!s&&"\\"===e||(s||!n[e]?(o.push(a.length),a.length===o.length-1&&(i+=e)):r=a.length+1,a+=e,!1);}),{maskChar:t,formatChars:n,prefix:i,mask:a,lastEditablePosition:r,permanents:o}}function isPermanentCharacter$1(e,t){return -1!==e.permanents.indexOf(t)}function isAllowedCharacter$1(e,t,n){var a=e.mask,i=e.formatChars;if(!n)return !1;if(isPermanentCharacter$1(e,t))return a[t]===n;var r=i[a[t]];return new RegExp(r).test(n)}function isEmpty$1(n,e){return e.split("").every(function(e,t){return isPermanentCharacter$1(n,t)||!isAllowedCharacter$1(n,t,e)})}function getFilledLength$1(e,t){var n=e.maskChar,a=e.prefix;if(!n){for(;t.length>a.length&&isPermanentCharacter$1(e,t.length-1);)t=t.slice(0,t.length-1);return t.length}for(var i=a.length,r=t.length;r>=a.length;r--){var o=t[r];if(!isPermanentCharacter$1(e,r)&&isAllowedCharacter$1(e,r,o)){i=r+1;break}}return i}function isFilled$1(e,t){return getFilledLength$1(e,t)===e.mask.length}function formatValue$1(e,t){var n=e.maskChar,a=e.mask,i=e.prefix;if(!n){for((t=insertString$1(e,"",t,0)).length<i.length&&(t=i);t.length<a.length&&isPermanentCharacter$1(e,t.length);)t+=a[t.length];return t}if(t)return insertString$1(e,formatValue$1(e,""),t,0);for(var r=0;r<a.length;r++)isPermanentCharacter$1(e,r)?t+=a[r]:t+=n;return t}function clearRange$1(n,e,a,t){var i=a+t,r=n.maskChar,o=n.mask,s=n.prefix,l=e.split("");if(r)return l.map(function(e,t){return t<a||i<=t?e:isPermanentCharacter$1(n,t)?o[t]:r}).join("");for(var u=i;u<l.length;u++)isPermanentCharacter$1(n,u)&&(l[u]="");return a=Math.max(s.length,a),l.splice(a,i-a),e=l.join(""),formatValue$1(n,e)}function insertString$1(r,o,e,s){var l=r.mask,u=r.maskChar,c=r.prefix,t=e.split(""),h=isFilled$1(r,o);return !u&&s>o.length&&(o+=l.slice(o.length,s)),t.every(function(e){for(;i=e,isPermanentCharacter$1(r,a=s)&&i!==l[a];){if(s>=o.length&&(o+=l[s]),t=e,n=s,u&&isPermanentCharacter$1(r,n)&&t===u)return !0;if(++s>=l.length)return !1}var t,n,a,i;return !isAllowedCharacter$1(r,s,e)&&e!==u||(s<o.length?o=u||h||s<c.length?o.slice(0,s)+e+o.slice(s+1):(o=o.slice(0,s)+e+o.slice(s),formatValue$1(r,o)):u||(o+=e),++s<l.length)}),o}function getInsertStringLength$1(a,e,t,i){var r=a.mask,o=a.maskChar,n=t.split(""),s=i;return n.every(function(e){for(;n=e,isPermanentCharacter$1(a,t=i)&&n!==r[t];)if(++i>=r.length)return !1;var t,n;return (isAllowedCharacter$1(a,i,e)||e===o)&&i++,i<r.length}),i-s}function getLeftEditablePosition$1(e,t){for(var n=t;0<=n;--n)if(!isPermanentCharacter$1(e,n))return n;return null}function getRightEditablePosition$1(e,t){for(var n=e.mask,a=t;a<n.length;++a)if(!isPermanentCharacter$1(e,a))return a;return null}function getStringValue$1(e){return e||0===e?e+"":""}function processChange$1(e,t,n,a,i){var r=e.mask,o=e.prefix,s=e.lastEditablePosition,l=t,u="",c=0,h=0,f=Math.min(i.start,n.start);if(n.end>i.start?h=(c=getInsertStringLength$1(e,a,u=l.slice(i.start,n.end),f))?i.length:0:l.length<a.length&&(h=a.length-l.length),l=a,h){if(1===h&&!i.length)f=i.start===n.start?getRightEditablePosition$1(e,n.start):getLeftEditablePosition$1(e,n.start);l=clearRange$1(e,l,f,h);}return l=insertString$1(e,l,u,f),(f+=c)>=r.length?f=r.length:f<o.length&&!c?f=o.length:f>=o.length&&f<s&&c&&(f=getRightEditablePosition$1(e,f)),u||(u=null),{value:l=formatValue$1(e,l),enteredString:u,selection:{start:f,end:f}}}function isWindowsPhoneBrowser$1(){var e=new RegExp("windows","i"),t=new RegExp("phone","i"),n=navigator.userAgent;return e.test(n)&&t.test(n)}function isFunction$1(e){return "function"==typeof e}function getRequestAnimationFrame$1(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame}function getCancelAnimationFrame$1(){return window.cancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame}function defer$1(e){return (!!getCancelAnimationFrame$1()?getRequestAnimationFrame$1():function(){return setTimeout(e,1e3/60)})(e)}function cancelDefer$1(e){(getCancelAnimationFrame$1()||clearTimeout)(e);}var InputElement$1=function(c){function e(e){var f=c.call(this,e)||this;f.focused=!1,f.mounted=!1,f.previousSelection=null,f.selectionDeferId=null,f.saveSelectionLoopDeferId=null,f.saveSelectionLoop=function(){f.previousSelection=f.getSelection(),f.saveSelectionLoopDeferId=defer$1(f.saveSelectionLoop);},f.runSaveSelectionLoop=function(){null===f.saveSelectionLoopDeferId&&f.saveSelectionLoop();},f.stopSaveSelectionLoop=function(){null!==f.saveSelectionLoopDeferId&&(cancelDefer$1(f.saveSelectionLoopDeferId),f.saveSelectionLoopDeferId=null,f.previousSelection=null);},f.getInputDOMNode=function(){if(!f.mounted)return null;var e=reactDom.findDOMNode(_assertThisInitialized$1(_assertThisInitialized$1(f))),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},f.getInputValue=function(){var e=f.getInputDOMNode();return e?e.value:null},f.setInputValue=function(e){var t=f.getInputDOMNode();t&&(f.value=e,t.value=e);},f.setCursorToEnd=function(){var e=getFilledLength$1(f.maskOptions,f.value),t=getRightEditablePosition$1(f.maskOptions,e);null!==t&&f.setCursorPosition(t);},f.setSelection=function(e,t,n){void 0===n&&(n={});var a=f.getInputDOMNode(),i=f.isFocused();a&&i&&(n.deferred||setInputSelection$1(a,e,t),null!==f.selectionDeferId&&cancelDefer$1(f.selectionDeferId),f.selectionDeferId=defer$1(function(){f.selectionDeferId=null,setInputSelection$1(a,e,t);}),f.previousSelection={start:e,end:t,length:Math.abs(t-e)});},f.getSelection=function(){return getInputSelection$1(f.getInputDOMNode())},f.getCursorPosition=function(){return f.getSelection().start},f.setCursorPosition=function(e){f.setSelection(e,e);},f.isFocused=function(){return f.focused},f.getBeforeMaskedValueChangeConfig=function(){var e=f.maskOptions,t=e.mask,n=e.maskChar,a=e.permanents,i=e.formatChars;return {mask:t,maskChar:n,permanents:a,alwaysShowMask:!!f.props.alwaysShowMask,formatChars:i}},f.isInputAutofilled=function(e,t,n,a){var i=f.getInputDOMNode();try{if(i.matches(":-webkit-autofill"))return !0}catch(r){}return !f.focused||a.end<n.length&&t.end===e.length},f.onChange=function(e){var t=_assertThisInitialized$1(_assertThisInitialized$1(f)).beforePasteState,n=_assertThisInitialized$1(_assertThisInitialized$1(f)).previousSelection,a=f.props.beforeMaskedValueChange,i=f.getInputValue(),r=f.value,o=f.getSelection();f.isInputAutofilled(i,o,r,n)&&(r=formatValue$1(f.maskOptions,""),n={start:0,end:0,length:0}),t&&(n=t.selection,r=t.value,o={start:n.start+i.length,end:n.start+i.length,length:0},i=r.slice(0,n.start)+i+r.slice(n.end),f.beforePasteState=null);var s=processChange$1(f.maskOptions,i,o,r,n),l=s.enteredString,u=s.selection,c=s.value;if(isFunction$1(a)){var h=a({value:c,selection:u},{value:r,selection:n},l,f.getBeforeMaskedValueChangeConfig());c=h.value,u=h.selection;}f.setInputValue(c),isFunction$1(f.props.onChange)&&f.props.onChange(e),f.isWindowsPhoneBrowser?f.setSelection(u.start,u.end,{deferred:!0}):f.setSelection(u.start,u.end);},f.onFocus=function(e){var t=f.props.beforeMaskedValueChange,n=f.maskOptions,a=n.mask,i=n.prefix;if(f.focused=!0,f.mounted=!0,a){if(f.value)getFilledLength$1(f.maskOptions,f.value)<f.maskOptions.mask.length&&f.setCursorToEnd();else {var r=formatValue$1(f.maskOptions,i),o=formatValue$1(f.maskOptions,r),s=getFilledLength$1(f.maskOptions,o),l=getRightEditablePosition$1(f.maskOptions,s),u={start:l,end:l};if(isFunction$1(t)){var c=t({value:o,selection:u},{value:f.value,selection:null},null,f.getBeforeMaskedValueChangeConfig());o=c.value,u=c.selection;}var h=o!==f.getInputValue();h&&f.setInputValue(o),h&&isFunction$1(f.props.onChange)&&f.props.onChange(e),f.setSelection(u.start,u.end);}f.runSaveSelectionLoop();}isFunction$1(f.props.onFocus)&&f.props.onFocus(e);},f.onBlur=function(e){var t=f.props.beforeMaskedValueChange,n=f.maskOptions.mask;if(f.stopSaveSelectionLoop(),f.focused=!1,n&&!f.props.alwaysShowMask&&isEmpty$1(f.maskOptions,f.value)){var a="";if(isFunction$1(t))a=t({value:a,selection:null},{value:f.value,selection:f.previousSelection},null,f.getBeforeMaskedValueChangeConfig()).value;var i=a!==f.getInputValue();i&&f.setInputValue(a),i&&isFunction$1(f.props.onChange)&&f.props.onChange(e);}isFunction$1(f.props.onBlur)&&f.props.onBlur(e);},f.onMouseDown=function(e){if(!f.focused&&document.addEventListener){f.mouseDownX=e.clientX,f.mouseDownY=e.clientY,f.mouseDownTime=(new Date).getTime();var r=function r(e){if(document.removeEventListener("mouseup",r),f.focused){var t=Math.abs(e.clientX-f.mouseDownX),n=Math.abs(e.clientY-f.mouseDownY),a=Math.max(t,n),i=(new Date).getTime()-f.mouseDownTime;(a<=10&&i<=200||a<=5&&i<=300)&&f.setCursorToEnd();}};document.addEventListener("mouseup",r);}isFunction$1(f.props.onMouseDown)&&f.props.onMouseDown(e);},f.onPaste=function(e){isFunction$1(f.props.onPaste)&&f.props.onPaste(e),e.defaultPrevented||(f.beforePasteState={value:f.getInputValue(),selection:f.getSelection()},f.setInputValue(""));},f.handleRef=function(e){null==f.props.children&&isFunction$1(f.props.inputRef)&&f.props.inputRef(e);};var t=e.mask,n=e.maskChar,a=e.formatChars,i=e.alwaysShowMask,r=e.beforeMaskedValueChange,o=e.defaultValue,s=e.value;f.maskOptions=parseMask$1(t,n,a),null==o&&(o=""),null==s&&(s=o);var l=getStringValue$1(s);if(f.maskOptions.mask&&(i||l)&&(l=formatValue$1(f.maskOptions,l),isFunction$1(r))){var u=e.value;null==e.value&&(u=o),l=r({value:l,selection:null},{value:u=getStringValue$1(u),selection:null},null,f.getBeforeMaskedValueChangeConfig()).value;}return f.value=l,f}_inheritsLoose$1(e,c);var t=e.prototype;return t.componentDidMount=function(){this.mounted=!0,this.getInputDOMNode()&&(this.isWindowsPhoneBrowser=isWindowsPhoneBrowser$1(),this.maskOptions.mask&&this.getInputValue()!==this.value&&this.setInputValue(this.value));},t.componentDidUpdate=function(){var e=this.previousSelection,t=this.props,n=t.beforeMaskedValueChange,a=t.alwaysShowMask,i=t.mask,r=t.maskChar,o=t.formatChars,s=this.maskOptions,l=a||this.isFocused(),u=null!=this.props.value,c=u?getStringValue$1(this.props.value):this.value,h=e?e.start:null;if(this.maskOptions=parseMask$1(i,r,o),this.maskOptions.mask){!s.mask&&this.isFocused()&&this.runSaveSelectionLoop();var f=this.maskOptions.mask&&this.maskOptions.mask!==s.mask;if(s.mask||u||(c=this.getInputValue()),(f||this.maskOptions.mask&&(c||l))&&(c=formatValue$1(this.maskOptions,c)),f){var p=getFilledLength$1(this.maskOptions,c);(null===h||p<h)&&(h=isFilled$1(this.maskOptions,c)?p:getRightEditablePosition$1(this.maskOptions,p));}!this.maskOptions.mask||!isEmpty$1(this.maskOptions,c)||l||u&&this.props.value||(c="");var d={start:h,end:h};if(isFunction$1(n)){var m=n({value:c,selection:d},{value:this.value,selection:this.previousSelection},null,this.getBeforeMaskedValueChangeConfig());c=m.value,d=m.selection;}this.value=c;var g=this.getInputValue()!==this.value;g?(this.setInputValue(this.value),this.forceUpdate()):f&&this.forceUpdate();var v=!1;null!=d.start&&null!=d.end&&(v=!e||e.start!==d.start||e.end!==d.end),(v||g)&&this.setSelection(d.start,d.end);}else s.mask&&(this.stopSaveSelectionLoop(),this.forceUpdate());},t.componentWillUnmount=function(){this.mounted=!1,null!==this.selectionDeferId&&cancelDefer$1(this.selectionDeferId),this.stopSaveSelectionLoop();},t.render=function(){var t,e=this.props,n=(e.mask,e.alwaysShowMask,e.maskChar,e.formatChars,e.inputRef,e.beforeMaskedValueChange,e.children),a=_objectWithoutPropertiesLoose$2(e,["mask","alwaysShowMask","maskChar","formatChars","inputRef","beforeMaskedValueChange","children"]);if(n){isFunction$1(n)||invariant_1$1(!1);var i=["onChange","onPaste","onMouseDown","onFocus","onBlur","value","disabled","readOnly"],r=_extends$2({},a);i.forEach(function(e){return delete r[e]}),t=n(r),i.filter(function(e){return null!=t.props[e]&&t.props[e]!==a[e]}).length&&invariant_1$1(!1);}else t=React$1.createElement("input",_extends$2({ref:this.handleRef},a));var o={onFocus:this.onFocus,onBlur:this.onBlur};return this.maskOptions.mask&&(a.disabled||a.readOnly||(o.onChange=this.onChange,o.onPaste=this.onPaste,o.onMouseDown=this.onMouseDown),null!=a.value&&(o.value=this.value)),t=React$1.cloneElement(t,o)},e}(React$1.Component);var reactInputMask_production_min=InputElement$1;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
181
|
+
*
|
|
182
|
+
* This source code is licensed under the MIT license found in the
|
|
183
|
+
* LICENSE file in the root directory of this source tree.
|
|
184
|
+
*/
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Use invariant() to assert state which your program assumes to be true.
|
|
189
|
+
*
|
|
190
|
+
* Provide sprintf-style format (only %s is supported) and arguments
|
|
191
|
+
* to provide information about what broke and what you were
|
|
192
|
+
* expecting.
|
|
193
|
+
*
|
|
194
|
+
* The invariant message will be stripped in production, but the invariant
|
|
195
|
+
* will remain to ensure logic does not differ in production.
|
|
196
|
+
*/
|
|
197
|
+
|
|
198
|
+
var NODE_ENV = process.env.NODE_ENV;
|
|
199
|
+
|
|
200
|
+
var invariant$1 = function(condition, format, a, b, c, d, e, f) {
|
|
201
|
+
if (NODE_ENV !== 'production') {
|
|
202
|
+
if (format === undefined) {
|
|
203
|
+
throw new Error('invariant requires an error message argument');
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (!condition) {
|
|
208
|
+
var error;
|
|
209
|
+
if (format === undefined) {
|
|
210
|
+
error = new Error(
|
|
211
|
+
'Minified exception occurred; use the non-minified dev environment ' +
|
|
212
|
+
'for the full error message and additional helpful warnings.'
|
|
213
|
+
);
|
|
214
|
+
} else {
|
|
215
|
+
var args = [a, b, c, d, e, f];
|
|
216
|
+
var argIndex = 0;
|
|
217
|
+
error = new Error(
|
|
218
|
+
format.replace(/%s/g, function() { return args[argIndex++]; })
|
|
219
|
+
);
|
|
220
|
+
error.name = 'Invariant Violation';
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
error.framesToPop = 1; // we don't care about invariant's own frame
|
|
224
|
+
throw error;
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
var invariant_1 = invariant$1;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Copyright (c) 2014-present, Facebook, Inc.
|
|
232
|
+
*
|
|
233
|
+
* This source code is licensed under the MIT license found in the
|
|
234
|
+
* LICENSE file in the root directory of this source tree.
|
|
235
|
+
*/
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Similar to invariant but only logs a warning if the condition is not met.
|
|
240
|
+
* This can be used to log issues in development environments in critical
|
|
241
|
+
* paths. Removing the logging code for production environments will keep the
|
|
242
|
+
* same logic and follow the same code paths.
|
|
243
|
+
*/
|
|
244
|
+
|
|
245
|
+
var __DEV__ = process.env.NODE_ENV !== 'production';
|
|
246
|
+
|
|
247
|
+
var warning$1 = function() {};
|
|
248
|
+
|
|
249
|
+
if (__DEV__) {
|
|
250
|
+
var printWarning = function printWarning(format, args) {
|
|
251
|
+
var len = arguments.length;
|
|
252
|
+
args = new Array(len > 1 ? len - 1 : 0);
|
|
253
|
+
for (var key = 1; key < len; key++) {
|
|
254
|
+
args[key - 1] = arguments[key];
|
|
255
|
+
}
|
|
256
|
+
var argIndex = 0;
|
|
257
|
+
var message = 'Warning: ' +
|
|
258
|
+
format.replace(/%s/g, function() {
|
|
259
|
+
return args[argIndex++];
|
|
260
|
+
});
|
|
261
|
+
if (typeof console !== 'undefined') {
|
|
262
|
+
console.error(message);
|
|
263
|
+
}
|
|
264
|
+
try {
|
|
265
|
+
// --- Welcome to debugging React ---
|
|
266
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
267
|
+
// to find the callsite that caused this warning to fire.
|
|
268
|
+
throw new Error(message);
|
|
269
|
+
} catch (x) {}
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
warning$1 = function(condition, format, args) {
|
|
273
|
+
var len = arguments.length;
|
|
274
|
+
args = new Array(len > 2 ? len - 2 : 0);
|
|
275
|
+
for (var key = 2; key < len; key++) {
|
|
276
|
+
args[key - 2] = arguments[key];
|
|
277
|
+
}
|
|
278
|
+
if (format === undefined) {
|
|
279
|
+
throw new Error(
|
|
280
|
+
'`warning(condition, format, ...args)` requires a warning ' +
|
|
281
|
+
'message argument'
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
if (!condition) {
|
|
285
|
+
printWarning.apply(null, [format].concat(args));
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
var warning_1 = warning$1;
|
|
291
|
+
|
|
292
|
+
function _interopDefault$1 (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
293
|
+
|
|
294
|
+
var React = _interopDefault$1(React$2);
|
|
295
|
+
|
|
296
|
+
var invariant = _interopDefault$1(invariant_1);
|
|
297
|
+
var warning = _interopDefault$1(warning_1);
|
|
298
|
+
|
|
299
|
+
function _defaults2(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
|
300
|
+
|
|
301
|
+
function _extends$1() {
|
|
302
|
+
_extends$1 = Object.assign || function (target) {
|
|
303
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
304
|
+
var source = arguments[i];
|
|
305
|
+
|
|
306
|
+
for (var key in source) {
|
|
307
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
308
|
+
target[key] = source[key];
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
return target;
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
return _extends$1.apply(this, arguments);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
function _inheritsLoose(subClass, superClass) {
|
|
320
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
321
|
+
subClass.prototype.constructor = subClass;
|
|
322
|
+
|
|
323
|
+
_defaults2(subClass, superClass);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function _objectWithoutPropertiesLoose$1(source, excluded) {
|
|
327
|
+
if (source == null) return {};
|
|
328
|
+
var target = {};
|
|
329
|
+
var sourceKeys = Object.keys(source);
|
|
330
|
+
var key, i;
|
|
331
|
+
|
|
332
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
333
|
+
key = sourceKeys[i];
|
|
334
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
335
|
+
target[key] = source[key];
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
return target;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
function _assertThisInitialized(self) {
|
|
342
|
+
if (self === void 0) {
|
|
343
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
return self;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
function setInputSelection(input, start, end) {
|
|
350
|
+
if ('selectionStart' in input && 'selectionEnd' in input) {
|
|
351
|
+
input.selectionStart = start;
|
|
352
|
+
input.selectionEnd = end;
|
|
353
|
+
} else {
|
|
354
|
+
var range = input.createTextRange();
|
|
355
|
+
range.collapse(true);
|
|
356
|
+
range.moveStart('character', start);
|
|
357
|
+
range.moveEnd('character', end - start);
|
|
358
|
+
range.select();
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
function getInputSelection(input) {
|
|
362
|
+
var start = 0;
|
|
363
|
+
var end = 0;
|
|
364
|
+
|
|
365
|
+
if ('selectionStart' in input && 'selectionEnd' in input) {
|
|
366
|
+
start = input.selectionStart;
|
|
367
|
+
end = input.selectionEnd;
|
|
368
|
+
} else {
|
|
369
|
+
var range = document.selection.createRange();
|
|
370
|
+
|
|
371
|
+
if (range.parentElement() === input) {
|
|
372
|
+
start = -range.moveStart('character', -input.value.length);
|
|
373
|
+
end = -range.moveEnd('character', -input.value.length);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
return {
|
|
378
|
+
start: start,
|
|
379
|
+
end: end,
|
|
380
|
+
length: end - start
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
var defaultFormatChars = {
|
|
385
|
+
'9': '[0-9]',
|
|
386
|
+
'a': '[A-Za-z]',
|
|
387
|
+
'*': '[A-Za-z0-9]'
|
|
388
|
+
};
|
|
389
|
+
var defaultMaskChar = '_';
|
|
390
|
+
|
|
391
|
+
function parseMask (mask, maskChar, formatChars) {
|
|
392
|
+
var parsedMaskString = '';
|
|
393
|
+
var prefix = '';
|
|
394
|
+
var lastEditablePosition = null;
|
|
395
|
+
var permanents = [];
|
|
396
|
+
|
|
397
|
+
if (maskChar === undefined) {
|
|
398
|
+
maskChar = defaultMaskChar;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
if (formatChars == null) {
|
|
402
|
+
formatChars = defaultFormatChars;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
if (!mask || typeof mask !== 'string') {
|
|
406
|
+
return {
|
|
407
|
+
maskChar: maskChar,
|
|
408
|
+
formatChars: formatChars,
|
|
409
|
+
mask: null,
|
|
410
|
+
prefix: null,
|
|
411
|
+
lastEditablePosition: null,
|
|
412
|
+
permanents: []
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
var isPermanent = false;
|
|
417
|
+
mask.split('').forEach(function (character) {
|
|
418
|
+
if (!isPermanent && character === '\\') {
|
|
419
|
+
isPermanent = true;
|
|
420
|
+
} else {
|
|
421
|
+
if (isPermanent || !formatChars[character]) {
|
|
422
|
+
permanents.push(parsedMaskString.length);
|
|
423
|
+
|
|
424
|
+
if (parsedMaskString.length === permanents.length - 1) {
|
|
425
|
+
prefix += character;
|
|
426
|
+
}
|
|
427
|
+
} else {
|
|
428
|
+
lastEditablePosition = parsedMaskString.length + 1;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
parsedMaskString += character;
|
|
432
|
+
isPermanent = false;
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
return {
|
|
436
|
+
maskChar: maskChar,
|
|
437
|
+
formatChars: formatChars,
|
|
438
|
+
prefix: prefix,
|
|
439
|
+
mask: parsedMaskString,
|
|
440
|
+
lastEditablePosition: lastEditablePosition,
|
|
441
|
+
permanents: permanents
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/* eslint no-use-before-define: ["error", { functions: false }] */
|
|
446
|
+
function isPermanentCharacter(maskOptions, pos) {
|
|
447
|
+
return maskOptions.permanents.indexOf(pos) !== -1;
|
|
448
|
+
}
|
|
449
|
+
function isAllowedCharacter(maskOptions, pos, character) {
|
|
450
|
+
var mask = maskOptions.mask,
|
|
451
|
+
formatChars = maskOptions.formatChars;
|
|
452
|
+
|
|
453
|
+
if (!character) {
|
|
454
|
+
return false;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
if (isPermanentCharacter(maskOptions, pos)) {
|
|
458
|
+
return mask[pos] === character;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
var ruleChar = mask[pos];
|
|
462
|
+
var charRule = formatChars[ruleChar];
|
|
463
|
+
return new RegExp(charRule).test(character);
|
|
464
|
+
}
|
|
465
|
+
function isEmpty(maskOptions, value) {
|
|
466
|
+
return value.split('').every(function (character, i) {
|
|
467
|
+
return isPermanentCharacter(maskOptions, i) || !isAllowedCharacter(maskOptions, i, character);
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
function getFilledLength(maskOptions, value) {
|
|
471
|
+
var maskChar = maskOptions.maskChar,
|
|
472
|
+
prefix = maskOptions.prefix;
|
|
473
|
+
|
|
474
|
+
if (!maskChar) {
|
|
475
|
+
while (value.length > prefix.length && isPermanentCharacter(maskOptions, value.length - 1)) {
|
|
476
|
+
value = value.slice(0, value.length - 1);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
return value.length;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
var filledLength = prefix.length;
|
|
483
|
+
|
|
484
|
+
for (var i = value.length; i >= prefix.length; i--) {
|
|
485
|
+
var character = value[i];
|
|
486
|
+
var isEnteredCharacter = !isPermanentCharacter(maskOptions, i) && isAllowedCharacter(maskOptions, i, character);
|
|
487
|
+
|
|
488
|
+
if (isEnteredCharacter) {
|
|
489
|
+
filledLength = i + 1;
|
|
490
|
+
break;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
return filledLength;
|
|
495
|
+
}
|
|
496
|
+
function isFilled(maskOptions, value) {
|
|
497
|
+
return getFilledLength(maskOptions, value) === maskOptions.mask.length;
|
|
498
|
+
}
|
|
499
|
+
function formatValue(maskOptions, value) {
|
|
500
|
+
var maskChar = maskOptions.maskChar,
|
|
501
|
+
mask = maskOptions.mask,
|
|
502
|
+
prefix = maskOptions.prefix;
|
|
503
|
+
|
|
504
|
+
if (!maskChar) {
|
|
505
|
+
value = insertString(maskOptions, '', value, 0);
|
|
506
|
+
|
|
507
|
+
if (value.length < prefix.length) {
|
|
508
|
+
value = prefix;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
while (value.length < mask.length && isPermanentCharacter(maskOptions, value.length)) {
|
|
512
|
+
value += mask[value.length];
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
return value;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
if (value) {
|
|
519
|
+
var emptyValue = formatValue(maskOptions, '');
|
|
520
|
+
return insertString(maskOptions, emptyValue, value, 0);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
for (var i = 0; i < mask.length; i++) {
|
|
524
|
+
if (isPermanentCharacter(maskOptions, i)) {
|
|
525
|
+
value += mask[i];
|
|
526
|
+
} else {
|
|
527
|
+
value += maskChar;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
return value;
|
|
532
|
+
}
|
|
533
|
+
function clearRange(maskOptions, value, start, len) {
|
|
534
|
+
var end = start + len;
|
|
535
|
+
var maskChar = maskOptions.maskChar,
|
|
536
|
+
mask = maskOptions.mask,
|
|
537
|
+
prefix = maskOptions.prefix;
|
|
538
|
+
var arrayValue = value.split('');
|
|
539
|
+
|
|
540
|
+
if (!maskChar) {
|
|
541
|
+
// remove any permanent chars after clear range, they will be added back by formatValue
|
|
542
|
+
for (var i = end; i < arrayValue.length; i++) {
|
|
543
|
+
if (isPermanentCharacter(maskOptions, i)) {
|
|
544
|
+
arrayValue[i] = '';
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
start = Math.max(prefix.length, start);
|
|
549
|
+
arrayValue.splice(start, end - start);
|
|
550
|
+
value = arrayValue.join('');
|
|
551
|
+
return formatValue(maskOptions, value);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
return arrayValue.map(function (character, i) {
|
|
555
|
+
if (i < start || i >= end) {
|
|
556
|
+
return character;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
if (isPermanentCharacter(maskOptions, i)) {
|
|
560
|
+
return mask[i];
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
return maskChar;
|
|
564
|
+
}).join('');
|
|
565
|
+
}
|
|
566
|
+
function insertString(maskOptions, value, insertStr, insertPosition) {
|
|
567
|
+
var mask = maskOptions.mask,
|
|
568
|
+
maskChar = maskOptions.maskChar,
|
|
569
|
+
prefix = maskOptions.prefix;
|
|
570
|
+
var arrayInsertStr = insertStr.split('');
|
|
571
|
+
var isInputFilled = isFilled(maskOptions, value);
|
|
572
|
+
|
|
573
|
+
var isUsablePosition = function isUsablePosition(pos, character) {
|
|
574
|
+
return !isPermanentCharacter(maskOptions, pos) || character === mask[pos];
|
|
575
|
+
};
|
|
576
|
+
|
|
577
|
+
var isUsableCharacter = function isUsableCharacter(character, pos) {
|
|
578
|
+
return !maskChar || !isPermanentCharacter(maskOptions, pos) || character !== maskChar;
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
if (!maskChar && insertPosition > value.length) {
|
|
582
|
+
value += mask.slice(value.length, insertPosition);
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
arrayInsertStr.every(function (insertCharacter) {
|
|
586
|
+
while (!isUsablePosition(insertPosition, insertCharacter)) {
|
|
587
|
+
if (insertPosition >= value.length) {
|
|
588
|
+
value += mask[insertPosition];
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
if (!isUsableCharacter(insertCharacter, insertPosition)) {
|
|
592
|
+
return true;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
insertPosition++; // stop iteration if maximum value length reached
|
|
596
|
+
|
|
597
|
+
if (insertPosition >= mask.length) {
|
|
598
|
+
return false;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
var isAllowed = isAllowedCharacter(maskOptions, insertPosition, insertCharacter) || insertCharacter === maskChar;
|
|
603
|
+
|
|
604
|
+
if (!isAllowed) {
|
|
605
|
+
return true;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
if (insertPosition < value.length) {
|
|
609
|
+
if (maskChar || isInputFilled || insertPosition < prefix.length) {
|
|
610
|
+
value = value.slice(0, insertPosition) + insertCharacter + value.slice(insertPosition + 1);
|
|
611
|
+
} else {
|
|
612
|
+
value = value.slice(0, insertPosition) + insertCharacter + value.slice(insertPosition);
|
|
613
|
+
value = formatValue(maskOptions, value);
|
|
614
|
+
}
|
|
615
|
+
} else if (!maskChar) {
|
|
616
|
+
value += insertCharacter;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
insertPosition++; // stop iteration if maximum value length reached
|
|
620
|
+
|
|
621
|
+
return insertPosition < mask.length;
|
|
622
|
+
});
|
|
623
|
+
return value;
|
|
624
|
+
}
|
|
625
|
+
function getInsertStringLength(maskOptions, value, insertStr, insertPosition) {
|
|
626
|
+
var mask = maskOptions.mask,
|
|
627
|
+
maskChar = maskOptions.maskChar;
|
|
628
|
+
var arrayInsertStr = insertStr.split('');
|
|
629
|
+
var initialInsertPosition = insertPosition;
|
|
630
|
+
|
|
631
|
+
var isUsablePosition = function isUsablePosition(pos, character) {
|
|
632
|
+
return !isPermanentCharacter(maskOptions, pos) || character === mask[pos];
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
arrayInsertStr.every(function (insertCharacter) {
|
|
636
|
+
while (!isUsablePosition(insertPosition, insertCharacter)) {
|
|
637
|
+
insertPosition++; // stop iteration if maximum value length reached
|
|
638
|
+
|
|
639
|
+
if (insertPosition >= mask.length) {
|
|
640
|
+
return false;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
var isAllowed = isAllowedCharacter(maskOptions, insertPosition, insertCharacter) || insertCharacter === maskChar;
|
|
645
|
+
|
|
646
|
+
if (isAllowed) {
|
|
647
|
+
insertPosition++;
|
|
648
|
+
} // stop iteration if maximum value length reached
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
return insertPosition < mask.length;
|
|
652
|
+
});
|
|
653
|
+
return insertPosition - initialInsertPosition;
|
|
654
|
+
}
|
|
655
|
+
function getLeftEditablePosition(maskOptions, pos) {
|
|
656
|
+
for (var i = pos; i >= 0; --i) {
|
|
657
|
+
if (!isPermanentCharacter(maskOptions, i)) {
|
|
658
|
+
return i;
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
return null;
|
|
663
|
+
}
|
|
664
|
+
function getRightEditablePosition(maskOptions, pos) {
|
|
665
|
+
var mask = maskOptions.mask;
|
|
666
|
+
|
|
667
|
+
for (var i = pos; i < mask.length; ++i) {
|
|
668
|
+
if (!isPermanentCharacter(maskOptions, i)) {
|
|
669
|
+
return i;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
return null;
|
|
674
|
+
}
|
|
675
|
+
function getStringValue(value) {
|
|
676
|
+
return !value && value !== 0 ? '' : value + '';
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
function processChange(maskOptions, value, selection, previousValue, previousSelection) {
|
|
680
|
+
var mask = maskOptions.mask,
|
|
681
|
+
prefix = maskOptions.prefix,
|
|
682
|
+
lastEditablePosition = maskOptions.lastEditablePosition;
|
|
683
|
+
var newValue = value;
|
|
684
|
+
var enteredString = '';
|
|
685
|
+
var formattedEnteredStringLength = 0;
|
|
686
|
+
var removedLength = 0;
|
|
687
|
+
var cursorPosition = Math.min(previousSelection.start, selection.start);
|
|
688
|
+
|
|
689
|
+
if (selection.end > previousSelection.start) {
|
|
690
|
+
enteredString = newValue.slice(previousSelection.start, selection.end);
|
|
691
|
+
formattedEnteredStringLength = getInsertStringLength(maskOptions, previousValue, enteredString, cursorPosition);
|
|
692
|
+
|
|
693
|
+
if (!formattedEnteredStringLength) {
|
|
694
|
+
removedLength = 0;
|
|
695
|
+
} else {
|
|
696
|
+
removedLength = previousSelection.length;
|
|
697
|
+
}
|
|
698
|
+
} else if (newValue.length < previousValue.length) {
|
|
699
|
+
removedLength = previousValue.length - newValue.length;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
newValue = previousValue;
|
|
703
|
+
|
|
704
|
+
if (removedLength) {
|
|
705
|
+
if (removedLength === 1 && !previousSelection.length) {
|
|
706
|
+
var deleteFromRight = previousSelection.start === selection.start;
|
|
707
|
+
cursorPosition = deleteFromRight ? getRightEditablePosition(maskOptions, selection.start) : getLeftEditablePosition(maskOptions, selection.start);
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
newValue = clearRange(maskOptions, newValue, cursorPosition, removedLength);
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
newValue = insertString(maskOptions, newValue, enteredString, cursorPosition);
|
|
714
|
+
cursorPosition = cursorPosition + formattedEnteredStringLength;
|
|
715
|
+
|
|
716
|
+
if (cursorPosition >= mask.length) {
|
|
717
|
+
cursorPosition = mask.length;
|
|
718
|
+
} else if (cursorPosition < prefix.length && !formattedEnteredStringLength) {
|
|
719
|
+
cursorPosition = prefix.length;
|
|
720
|
+
} else if (cursorPosition >= prefix.length && cursorPosition < lastEditablePosition && formattedEnteredStringLength) {
|
|
721
|
+
cursorPosition = getRightEditablePosition(maskOptions, cursorPosition);
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
newValue = formatValue(maskOptions, newValue);
|
|
725
|
+
|
|
726
|
+
if (!enteredString) {
|
|
727
|
+
enteredString = null;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
return {
|
|
731
|
+
value: newValue,
|
|
732
|
+
enteredString: enteredString,
|
|
733
|
+
selection: {
|
|
734
|
+
start: cursorPosition,
|
|
735
|
+
end: cursorPosition
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
function isWindowsPhoneBrowser() {
|
|
741
|
+
var windows = new RegExp('windows', 'i');
|
|
742
|
+
var phone = new RegExp('phone', 'i');
|
|
743
|
+
var ua = navigator.userAgent;
|
|
744
|
+
return windows.test(ua) && phone.test(ua);
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
function isFunction(value) {
|
|
748
|
+
return typeof value === 'function';
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
function getRequestAnimationFrame() {
|
|
752
|
+
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
function getCancelAnimationFrame() {
|
|
756
|
+
return window.cancelAnimationFrame || window.webkitCancelRequestAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
function defer(fn) {
|
|
760
|
+
var hasCancelAnimationFrame = !!getCancelAnimationFrame();
|
|
761
|
+
var deferFn;
|
|
762
|
+
|
|
763
|
+
if (hasCancelAnimationFrame) {
|
|
764
|
+
deferFn = getRequestAnimationFrame();
|
|
765
|
+
} else {
|
|
766
|
+
deferFn = function deferFn() {
|
|
767
|
+
return setTimeout(fn, 1000 / 60);
|
|
768
|
+
};
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
return deferFn(fn);
|
|
772
|
+
}
|
|
773
|
+
function cancelDefer(deferId) {
|
|
774
|
+
var cancelFn = getCancelAnimationFrame() || clearTimeout;
|
|
775
|
+
cancelFn(deferId);
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
var InputElement =
|
|
779
|
+
/*#__PURE__*/
|
|
780
|
+
function (_React$Component) {
|
|
781
|
+
_inheritsLoose(InputElement, _React$Component);
|
|
782
|
+
|
|
783
|
+
function InputElement(props) {
|
|
784
|
+
var _this;
|
|
785
|
+
|
|
786
|
+
_this = _React$Component.call(this, props) || this;
|
|
787
|
+
_this.focused = false;
|
|
788
|
+
_this.mounted = false;
|
|
789
|
+
_this.previousSelection = null;
|
|
790
|
+
_this.selectionDeferId = null;
|
|
791
|
+
_this.saveSelectionLoopDeferId = null;
|
|
792
|
+
|
|
793
|
+
_this.saveSelectionLoop = function () {
|
|
794
|
+
_this.previousSelection = _this.getSelection();
|
|
795
|
+
_this.saveSelectionLoopDeferId = defer(_this.saveSelectionLoop);
|
|
796
|
+
};
|
|
797
|
+
|
|
798
|
+
_this.runSaveSelectionLoop = function () {
|
|
799
|
+
if (_this.saveSelectionLoopDeferId === null) {
|
|
800
|
+
_this.saveSelectionLoop();
|
|
801
|
+
}
|
|
802
|
+
};
|
|
803
|
+
|
|
804
|
+
_this.stopSaveSelectionLoop = function () {
|
|
805
|
+
if (_this.saveSelectionLoopDeferId !== null) {
|
|
806
|
+
cancelDefer(_this.saveSelectionLoopDeferId);
|
|
807
|
+
_this.saveSelectionLoopDeferId = null;
|
|
808
|
+
_this.previousSelection = null;
|
|
809
|
+
}
|
|
810
|
+
};
|
|
811
|
+
|
|
812
|
+
_this.getInputDOMNode = function () {
|
|
813
|
+
if (!_this.mounted) {
|
|
814
|
+
return null;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
var input = reactDom.findDOMNode(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
818
|
+
var isDOMNode = typeof window !== 'undefined' && input instanceof window.Element; // workaround for react-test-renderer
|
|
819
|
+
// https://github.com/sanniassin/react-input-mask/issues/147
|
|
820
|
+
|
|
821
|
+
if (input && !isDOMNode) {
|
|
822
|
+
return null;
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
if (input.nodeName !== 'INPUT') {
|
|
826
|
+
input = input.querySelector('input');
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
if (!input) {
|
|
830
|
+
throw new Error('react-input-mask: inputComponent doesn\'t contain input node');
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
return input;
|
|
834
|
+
};
|
|
835
|
+
|
|
836
|
+
_this.getInputValue = function () {
|
|
837
|
+
var input = _this.getInputDOMNode();
|
|
838
|
+
|
|
839
|
+
if (!input) {
|
|
840
|
+
return null;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
return input.value;
|
|
844
|
+
};
|
|
845
|
+
|
|
846
|
+
_this.setInputValue = function (value) {
|
|
847
|
+
var input = _this.getInputDOMNode();
|
|
848
|
+
|
|
849
|
+
if (!input) {
|
|
850
|
+
return;
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
_this.value = value;
|
|
854
|
+
input.value = value;
|
|
855
|
+
};
|
|
856
|
+
|
|
857
|
+
_this.setCursorToEnd = function () {
|
|
858
|
+
var filledLength = getFilledLength(_this.maskOptions, _this.value);
|
|
859
|
+
var pos = getRightEditablePosition(_this.maskOptions, filledLength);
|
|
860
|
+
|
|
861
|
+
if (pos !== null) {
|
|
862
|
+
_this.setCursorPosition(pos);
|
|
863
|
+
}
|
|
864
|
+
};
|
|
865
|
+
|
|
866
|
+
_this.setSelection = function (start, end, options) {
|
|
867
|
+
if (options === void 0) {
|
|
868
|
+
options = {};
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
var input = _this.getInputDOMNode();
|
|
872
|
+
|
|
873
|
+
var isFocused = _this.isFocused(); // don't change selection on unfocused input
|
|
874
|
+
// because Safari sets focus on selection change (#154)
|
|
875
|
+
|
|
876
|
+
|
|
877
|
+
if (!input || !isFocused) {
|
|
878
|
+
return;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
var _options = options,
|
|
882
|
+
deferred = _options.deferred;
|
|
883
|
+
|
|
884
|
+
if (!deferred) {
|
|
885
|
+
setInputSelection(input, start, end);
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
if (_this.selectionDeferId !== null) {
|
|
889
|
+
cancelDefer(_this.selectionDeferId);
|
|
890
|
+
} // deferred selection update is required for pre-Lollipop Android browser,
|
|
891
|
+
// but for consistent behavior we do it for all browsers
|
|
892
|
+
|
|
893
|
+
|
|
894
|
+
_this.selectionDeferId = defer(function () {
|
|
895
|
+
_this.selectionDeferId = null;
|
|
896
|
+
setInputSelection(input, start, end);
|
|
897
|
+
});
|
|
898
|
+
_this.previousSelection = {
|
|
899
|
+
start: start,
|
|
900
|
+
end: end,
|
|
901
|
+
length: Math.abs(end - start)
|
|
902
|
+
};
|
|
903
|
+
};
|
|
904
|
+
|
|
905
|
+
_this.getSelection = function () {
|
|
906
|
+
var input = _this.getInputDOMNode();
|
|
907
|
+
|
|
908
|
+
return getInputSelection(input);
|
|
909
|
+
};
|
|
910
|
+
|
|
911
|
+
_this.getCursorPosition = function () {
|
|
912
|
+
return _this.getSelection().start;
|
|
913
|
+
};
|
|
914
|
+
|
|
915
|
+
_this.setCursorPosition = function (pos) {
|
|
916
|
+
_this.setSelection(pos, pos);
|
|
917
|
+
};
|
|
918
|
+
|
|
919
|
+
_this.isFocused = function () {
|
|
920
|
+
return _this.focused;
|
|
921
|
+
};
|
|
922
|
+
|
|
923
|
+
_this.getBeforeMaskedValueChangeConfig = function () {
|
|
924
|
+
var _this$maskOptions = _this.maskOptions,
|
|
925
|
+
mask = _this$maskOptions.mask,
|
|
926
|
+
maskChar = _this$maskOptions.maskChar,
|
|
927
|
+
permanents = _this$maskOptions.permanents,
|
|
928
|
+
formatChars = _this$maskOptions.formatChars;
|
|
929
|
+
var alwaysShowMask = _this.props.alwaysShowMask;
|
|
930
|
+
return {
|
|
931
|
+
mask: mask,
|
|
932
|
+
maskChar: maskChar,
|
|
933
|
+
permanents: permanents,
|
|
934
|
+
alwaysShowMask: !!alwaysShowMask,
|
|
935
|
+
formatChars: formatChars
|
|
936
|
+
};
|
|
937
|
+
};
|
|
938
|
+
|
|
939
|
+
_this.isInputAutofilled = function (value, selection, previousValue, previousSelection) {
|
|
940
|
+
var input = _this.getInputDOMNode(); // only check for positive match because it will be false negative
|
|
941
|
+
// in case of autofill simulation in tests
|
|
942
|
+
//
|
|
943
|
+
// input.matches throws an exception if selector isn't supported
|
|
944
|
+
|
|
945
|
+
|
|
946
|
+
try {
|
|
947
|
+
if (input.matches(':-webkit-autofill')) {
|
|
948
|
+
return true;
|
|
949
|
+
}
|
|
950
|
+
} catch (e) {} // if input isn't focused then change event must have been triggered
|
|
951
|
+
// either by autofill or event simulation in tests
|
|
952
|
+
|
|
953
|
+
|
|
954
|
+
if (!_this.focused) {
|
|
955
|
+
return true;
|
|
956
|
+
} // if cursor has moved to the end while previousSelection forbids it
|
|
957
|
+
// then it must be autofill
|
|
958
|
+
|
|
959
|
+
|
|
960
|
+
return previousSelection.end < previousValue.length && selection.end === value.length;
|
|
961
|
+
};
|
|
962
|
+
|
|
963
|
+
_this.onChange = function (event) {
|
|
964
|
+
var _assertThisInitialize = _assertThisInitialized(_assertThisInitialized(_this)),
|
|
965
|
+
beforePasteState = _assertThisInitialize.beforePasteState;
|
|
966
|
+
|
|
967
|
+
var _assertThisInitialize2 = _assertThisInitialized(_assertThisInitialized(_this)),
|
|
968
|
+
previousSelection = _assertThisInitialize2.previousSelection;
|
|
969
|
+
|
|
970
|
+
var beforeMaskedValueChange = _this.props.beforeMaskedValueChange;
|
|
971
|
+
|
|
972
|
+
var value = _this.getInputValue();
|
|
973
|
+
|
|
974
|
+
var previousValue = _this.value;
|
|
975
|
+
|
|
976
|
+
var selection = _this.getSelection(); // autofill replaces entire value, ignore old one
|
|
977
|
+
// https://github.com/sanniassin/react-input-mask/issues/113
|
|
978
|
+
|
|
979
|
+
|
|
980
|
+
if (_this.isInputAutofilled(value, selection, previousValue, previousSelection)) {
|
|
981
|
+
previousValue = formatValue(_this.maskOptions, '');
|
|
982
|
+
previousSelection = {
|
|
983
|
+
start: 0,
|
|
984
|
+
end: 0,
|
|
985
|
+
length: 0
|
|
986
|
+
};
|
|
987
|
+
} // set value and selection as if we haven't
|
|
988
|
+
// cleared input in onPaste handler
|
|
989
|
+
|
|
990
|
+
|
|
991
|
+
if (beforePasteState) {
|
|
992
|
+
previousSelection = beforePasteState.selection;
|
|
993
|
+
previousValue = beforePasteState.value;
|
|
994
|
+
selection = {
|
|
995
|
+
start: previousSelection.start + value.length,
|
|
996
|
+
end: previousSelection.start + value.length,
|
|
997
|
+
length: 0
|
|
998
|
+
};
|
|
999
|
+
value = previousValue.slice(0, previousSelection.start) + value + previousValue.slice(previousSelection.end);
|
|
1000
|
+
_this.beforePasteState = null;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
var changedState = processChange(_this.maskOptions, value, selection, previousValue, previousSelection);
|
|
1004
|
+
var enteredString = changedState.enteredString;
|
|
1005
|
+
var newSelection = changedState.selection;
|
|
1006
|
+
var newValue = changedState.value;
|
|
1007
|
+
|
|
1008
|
+
if (isFunction(beforeMaskedValueChange)) {
|
|
1009
|
+
var modifiedValue = beforeMaskedValueChange({
|
|
1010
|
+
value: newValue,
|
|
1011
|
+
selection: newSelection
|
|
1012
|
+
}, {
|
|
1013
|
+
value: previousValue,
|
|
1014
|
+
selection: previousSelection
|
|
1015
|
+
}, enteredString, _this.getBeforeMaskedValueChangeConfig());
|
|
1016
|
+
newValue = modifiedValue.value;
|
|
1017
|
+
newSelection = modifiedValue.selection;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
_this.setInputValue(newValue);
|
|
1021
|
+
|
|
1022
|
+
if (isFunction(_this.props.onChange)) {
|
|
1023
|
+
_this.props.onChange(event);
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
if (_this.isWindowsPhoneBrowser) {
|
|
1027
|
+
_this.setSelection(newSelection.start, newSelection.end, {
|
|
1028
|
+
deferred: true
|
|
1029
|
+
});
|
|
1030
|
+
} else {
|
|
1031
|
+
_this.setSelection(newSelection.start, newSelection.end);
|
|
1032
|
+
}
|
|
1033
|
+
};
|
|
1034
|
+
|
|
1035
|
+
_this.onFocus = function (event) {
|
|
1036
|
+
var beforeMaskedValueChange = _this.props.beforeMaskedValueChange;
|
|
1037
|
+
var _this$maskOptions2 = _this.maskOptions,
|
|
1038
|
+
mask = _this$maskOptions2.mask,
|
|
1039
|
+
prefix = _this$maskOptions2.prefix;
|
|
1040
|
+
_this.focused = true; // if autoFocus is set, onFocus triggers before componentDidMount
|
|
1041
|
+
|
|
1042
|
+
_this.mounted = true;
|
|
1043
|
+
|
|
1044
|
+
if (mask) {
|
|
1045
|
+
if (!_this.value) {
|
|
1046
|
+
var emptyValue = formatValue(_this.maskOptions, prefix);
|
|
1047
|
+
var newValue = formatValue(_this.maskOptions, emptyValue);
|
|
1048
|
+
var filledLength = getFilledLength(_this.maskOptions, newValue);
|
|
1049
|
+
var cursorPosition = getRightEditablePosition(_this.maskOptions, filledLength);
|
|
1050
|
+
var newSelection = {
|
|
1051
|
+
start: cursorPosition,
|
|
1052
|
+
end: cursorPosition
|
|
1053
|
+
};
|
|
1054
|
+
|
|
1055
|
+
if (isFunction(beforeMaskedValueChange)) {
|
|
1056
|
+
var modifiedValue = beforeMaskedValueChange({
|
|
1057
|
+
value: newValue,
|
|
1058
|
+
selection: newSelection
|
|
1059
|
+
}, {
|
|
1060
|
+
value: _this.value,
|
|
1061
|
+
selection: null
|
|
1062
|
+
}, null, _this.getBeforeMaskedValueChangeConfig());
|
|
1063
|
+
newValue = modifiedValue.value;
|
|
1064
|
+
newSelection = modifiedValue.selection;
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
var isInputValueChanged = newValue !== _this.getInputValue();
|
|
1068
|
+
|
|
1069
|
+
if (isInputValueChanged) {
|
|
1070
|
+
_this.setInputValue(newValue);
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
if (isInputValueChanged && isFunction(_this.props.onChange)) {
|
|
1074
|
+
_this.props.onChange(event);
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
_this.setSelection(newSelection.start, newSelection.end);
|
|
1078
|
+
} else if (getFilledLength(_this.maskOptions, _this.value) < _this.maskOptions.mask.length) {
|
|
1079
|
+
_this.setCursorToEnd();
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
_this.runSaveSelectionLoop();
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
if (isFunction(_this.props.onFocus)) {
|
|
1086
|
+
_this.props.onFocus(event);
|
|
1087
|
+
}
|
|
1088
|
+
};
|
|
1089
|
+
|
|
1090
|
+
_this.onBlur = function (event) {
|
|
1091
|
+
var beforeMaskedValueChange = _this.props.beforeMaskedValueChange;
|
|
1092
|
+
var mask = _this.maskOptions.mask;
|
|
1093
|
+
|
|
1094
|
+
_this.stopSaveSelectionLoop();
|
|
1095
|
+
|
|
1096
|
+
_this.focused = false;
|
|
1097
|
+
|
|
1098
|
+
if (mask && !_this.props.alwaysShowMask && isEmpty(_this.maskOptions, _this.value)) {
|
|
1099
|
+
var newValue = '';
|
|
1100
|
+
|
|
1101
|
+
if (isFunction(beforeMaskedValueChange)) {
|
|
1102
|
+
var modifiedValue = beforeMaskedValueChange({
|
|
1103
|
+
value: newValue,
|
|
1104
|
+
selection: null
|
|
1105
|
+
}, {
|
|
1106
|
+
value: _this.value,
|
|
1107
|
+
selection: _this.previousSelection
|
|
1108
|
+
}, null, _this.getBeforeMaskedValueChangeConfig());
|
|
1109
|
+
newValue = modifiedValue.value;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
var isInputValueChanged = newValue !== _this.getInputValue();
|
|
1113
|
+
|
|
1114
|
+
if (isInputValueChanged) {
|
|
1115
|
+
_this.setInputValue(newValue);
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
if (isInputValueChanged && isFunction(_this.props.onChange)) {
|
|
1119
|
+
_this.props.onChange(event);
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
if (isFunction(_this.props.onBlur)) {
|
|
1124
|
+
_this.props.onBlur(event);
|
|
1125
|
+
}
|
|
1126
|
+
};
|
|
1127
|
+
|
|
1128
|
+
_this.onMouseDown = function (event) {
|
|
1129
|
+
// tiny unintentional mouse movements can break cursor
|
|
1130
|
+
// position on focus, so we have to restore it in that case
|
|
1131
|
+
//
|
|
1132
|
+
// https://github.com/sanniassin/react-input-mask/issues/108
|
|
1133
|
+
if (!_this.focused && document.addEventListener) {
|
|
1134
|
+
_this.mouseDownX = event.clientX;
|
|
1135
|
+
_this.mouseDownY = event.clientY;
|
|
1136
|
+
_this.mouseDownTime = new Date().getTime();
|
|
1137
|
+
|
|
1138
|
+
var mouseUpHandler = function mouseUpHandler(mouseUpEvent) {
|
|
1139
|
+
document.removeEventListener('mouseup', mouseUpHandler);
|
|
1140
|
+
|
|
1141
|
+
if (!_this.focused) {
|
|
1142
|
+
return;
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
var deltaX = Math.abs(mouseUpEvent.clientX - _this.mouseDownX);
|
|
1146
|
+
var deltaY = Math.abs(mouseUpEvent.clientY - _this.mouseDownY);
|
|
1147
|
+
var axisDelta = Math.max(deltaX, deltaY);
|
|
1148
|
+
|
|
1149
|
+
var timeDelta = new Date().getTime() - _this.mouseDownTime;
|
|
1150
|
+
|
|
1151
|
+
if (axisDelta <= 10 && timeDelta <= 200 || axisDelta <= 5 && timeDelta <= 300) {
|
|
1152
|
+
_this.setCursorToEnd();
|
|
1153
|
+
}
|
|
1154
|
+
};
|
|
1155
|
+
|
|
1156
|
+
document.addEventListener('mouseup', mouseUpHandler);
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
if (isFunction(_this.props.onMouseDown)) {
|
|
1160
|
+
_this.props.onMouseDown(event);
|
|
1161
|
+
}
|
|
1162
|
+
};
|
|
1163
|
+
|
|
1164
|
+
_this.onPaste = function (event) {
|
|
1165
|
+
if (isFunction(_this.props.onPaste)) {
|
|
1166
|
+
_this.props.onPaste(event);
|
|
1167
|
+
} // event.clipboardData might not work in Android browser
|
|
1168
|
+
// cleaning input to get raw text inside onChange handler
|
|
1169
|
+
|
|
1170
|
+
|
|
1171
|
+
if (!event.defaultPrevented) {
|
|
1172
|
+
_this.beforePasteState = {
|
|
1173
|
+
value: _this.getInputValue(),
|
|
1174
|
+
selection: _this.getSelection()
|
|
1175
|
+
};
|
|
1176
|
+
|
|
1177
|
+
_this.setInputValue('');
|
|
1178
|
+
}
|
|
1179
|
+
};
|
|
1180
|
+
|
|
1181
|
+
_this.handleRef = function (ref) {
|
|
1182
|
+
if (_this.props.children == null && isFunction(_this.props.inputRef)) {
|
|
1183
|
+
_this.props.inputRef(ref);
|
|
1184
|
+
}
|
|
1185
|
+
};
|
|
1186
|
+
|
|
1187
|
+
var _mask = props.mask,
|
|
1188
|
+
_maskChar = props.maskChar,
|
|
1189
|
+
_formatChars = props.formatChars,
|
|
1190
|
+
_alwaysShowMask = props.alwaysShowMask,
|
|
1191
|
+
_beforeMaskedValueChange = props.beforeMaskedValueChange;
|
|
1192
|
+
var defaultValue = props.defaultValue,
|
|
1193
|
+
_value = props.value;
|
|
1194
|
+
_this.maskOptions = parseMask(_mask, _maskChar, _formatChars);
|
|
1195
|
+
|
|
1196
|
+
if (defaultValue == null) {
|
|
1197
|
+
defaultValue = '';
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
if (_value == null) {
|
|
1201
|
+
_value = defaultValue;
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
var _newValue = getStringValue(_value);
|
|
1205
|
+
|
|
1206
|
+
if (_this.maskOptions.mask && (_alwaysShowMask || _newValue)) {
|
|
1207
|
+
_newValue = formatValue(_this.maskOptions, _newValue);
|
|
1208
|
+
|
|
1209
|
+
if (isFunction(_beforeMaskedValueChange)) {
|
|
1210
|
+
var oldValue = props.value;
|
|
1211
|
+
|
|
1212
|
+
if (props.value == null) {
|
|
1213
|
+
oldValue = defaultValue;
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
oldValue = getStringValue(oldValue);
|
|
1217
|
+
|
|
1218
|
+
var modifiedValue = _beforeMaskedValueChange({
|
|
1219
|
+
value: _newValue,
|
|
1220
|
+
selection: null
|
|
1221
|
+
}, {
|
|
1222
|
+
value: oldValue,
|
|
1223
|
+
selection: null
|
|
1224
|
+
}, null, _this.getBeforeMaskedValueChangeConfig());
|
|
1225
|
+
|
|
1226
|
+
_newValue = modifiedValue.value;
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
_this.value = _newValue;
|
|
1231
|
+
return _this;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
var _proto = InputElement.prototype;
|
|
1235
|
+
|
|
1236
|
+
_proto.componentDidMount = function componentDidMount() {
|
|
1237
|
+
this.mounted = true; // workaround for react-test-renderer
|
|
1238
|
+
// https://github.com/sanniassin/react-input-mask/issues/147
|
|
1239
|
+
|
|
1240
|
+
if (!this.getInputDOMNode()) {
|
|
1241
|
+
return;
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
this.isWindowsPhoneBrowser = isWindowsPhoneBrowser();
|
|
1245
|
+
|
|
1246
|
+
if (this.maskOptions.mask && this.getInputValue() !== this.value) {
|
|
1247
|
+
this.setInputValue(this.value);
|
|
1248
|
+
}
|
|
1249
|
+
};
|
|
1250
|
+
|
|
1251
|
+
_proto.componentDidUpdate = function componentDidUpdate() {
|
|
1252
|
+
var previousSelection = this.previousSelection;
|
|
1253
|
+
var _this$props = this.props,
|
|
1254
|
+
beforeMaskedValueChange = _this$props.beforeMaskedValueChange,
|
|
1255
|
+
alwaysShowMask = _this$props.alwaysShowMask,
|
|
1256
|
+
mask = _this$props.mask,
|
|
1257
|
+
maskChar = _this$props.maskChar,
|
|
1258
|
+
formatChars = _this$props.formatChars;
|
|
1259
|
+
var previousMaskOptions = this.maskOptions;
|
|
1260
|
+
var showEmpty = alwaysShowMask || this.isFocused();
|
|
1261
|
+
var hasValue = this.props.value != null;
|
|
1262
|
+
var newValue = hasValue ? getStringValue(this.props.value) : this.value;
|
|
1263
|
+
var cursorPosition = previousSelection ? previousSelection.start : null;
|
|
1264
|
+
this.maskOptions = parseMask(mask, maskChar, formatChars);
|
|
1265
|
+
|
|
1266
|
+
if (!this.maskOptions.mask) {
|
|
1267
|
+
if (previousMaskOptions.mask) {
|
|
1268
|
+
this.stopSaveSelectionLoop(); // render depends on this.maskOptions and this.value,
|
|
1269
|
+
// call forceUpdate to keep it in sync
|
|
1270
|
+
|
|
1271
|
+
this.forceUpdate();
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
return;
|
|
1275
|
+
} else if (!previousMaskOptions.mask && this.isFocused()) {
|
|
1276
|
+
this.runSaveSelectionLoop();
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
var isMaskChanged = this.maskOptions.mask && this.maskOptions.mask !== previousMaskOptions.mask;
|
|
1280
|
+
|
|
1281
|
+
if (!previousMaskOptions.mask && !hasValue) {
|
|
1282
|
+
newValue = this.getInputValue();
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
if (isMaskChanged || this.maskOptions.mask && (newValue || showEmpty)) {
|
|
1286
|
+
newValue = formatValue(this.maskOptions, newValue);
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
if (isMaskChanged) {
|
|
1290
|
+
var filledLength = getFilledLength(this.maskOptions, newValue);
|
|
1291
|
+
|
|
1292
|
+
if (cursorPosition === null || filledLength < cursorPosition) {
|
|
1293
|
+
if (isFilled(this.maskOptions, newValue)) {
|
|
1294
|
+
cursorPosition = filledLength;
|
|
1295
|
+
} else {
|
|
1296
|
+
cursorPosition = getRightEditablePosition(this.maskOptions, filledLength);
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
if (this.maskOptions.mask && isEmpty(this.maskOptions, newValue) && !showEmpty && (!hasValue || !this.props.value)) {
|
|
1302
|
+
newValue = '';
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
var newSelection = {
|
|
1306
|
+
start: cursorPosition,
|
|
1307
|
+
end: cursorPosition
|
|
1308
|
+
};
|
|
1309
|
+
|
|
1310
|
+
if (isFunction(beforeMaskedValueChange)) {
|
|
1311
|
+
var modifiedValue = beforeMaskedValueChange({
|
|
1312
|
+
value: newValue,
|
|
1313
|
+
selection: newSelection
|
|
1314
|
+
}, {
|
|
1315
|
+
value: this.value,
|
|
1316
|
+
selection: this.previousSelection
|
|
1317
|
+
}, null, this.getBeforeMaskedValueChangeConfig());
|
|
1318
|
+
newValue = modifiedValue.value;
|
|
1319
|
+
newSelection = modifiedValue.selection;
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
this.value = newValue;
|
|
1323
|
+
var isValueChanged = this.getInputValue() !== this.value; // render depends on this.maskOptions and this.value,
|
|
1324
|
+
// call forceUpdate to keep it in sync
|
|
1325
|
+
|
|
1326
|
+
if (isValueChanged) {
|
|
1327
|
+
this.setInputValue(this.value);
|
|
1328
|
+
this.forceUpdate();
|
|
1329
|
+
} else if (isMaskChanged) {
|
|
1330
|
+
this.forceUpdate();
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
var isSelectionChanged = false;
|
|
1334
|
+
|
|
1335
|
+
if (newSelection.start != null && newSelection.end != null) {
|
|
1336
|
+
isSelectionChanged = !previousSelection || previousSelection.start !== newSelection.start || previousSelection.end !== newSelection.end;
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
if (isSelectionChanged || isValueChanged) {
|
|
1340
|
+
this.setSelection(newSelection.start, newSelection.end);
|
|
1341
|
+
}
|
|
1342
|
+
};
|
|
1343
|
+
|
|
1344
|
+
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
1345
|
+
this.mounted = false;
|
|
1346
|
+
|
|
1347
|
+
if (this.selectionDeferId !== null) {
|
|
1348
|
+
cancelDefer(this.selectionDeferId);
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
this.stopSaveSelectionLoop();
|
|
1352
|
+
};
|
|
1353
|
+
|
|
1354
|
+
_proto.render = function render() {
|
|
1355
|
+
var _this$props2 = this.props,
|
|
1356
|
+
mask = _this$props2.mask;
|
|
1357
|
+
_this$props2.alwaysShowMask;
|
|
1358
|
+
var maskChar = _this$props2.maskChar,
|
|
1359
|
+
formatChars = _this$props2.formatChars,
|
|
1360
|
+
inputRef = _this$props2.inputRef;
|
|
1361
|
+
_this$props2.beforeMaskedValueChange;
|
|
1362
|
+
var children = _this$props2.children,
|
|
1363
|
+
restProps = _objectWithoutPropertiesLoose$1(_this$props2, ["mask", "alwaysShowMask", "maskChar", "formatChars", "inputRef", "beforeMaskedValueChange", "children"]);
|
|
1364
|
+
|
|
1365
|
+
var inputElement;
|
|
1366
|
+
process.env.NODE_ENV !== "production" ? warning( // parse mask to test against actual mask prop as this.maskOptions
|
|
1367
|
+
// will be updated later in componentDidUpdate
|
|
1368
|
+
!restProps.maxLength || !parseMask(mask, maskChar, formatChars).mask, 'react-input-mask: maxLength property shouldn\'t be passed to the masked input. It breaks masking and unnecessary because length is limited by the mask length.') : void 0;
|
|
1369
|
+
|
|
1370
|
+
if (children) {
|
|
1371
|
+
!isFunction(children) ? process.env.NODE_ENV !== "production" ? invariant(false, 'react-input-mask: children must be a function') : invariant(false) : void 0;
|
|
1372
|
+
var controlledProps = ['onChange', 'onPaste', 'onMouseDown', 'onFocus', 'onBlur', 'value', 'disabled', 'readOnly'];
|
|
1373
|
+
|
|
1374
|
+
var childrenProps = _extends$1({}, restProps);
|
|
1375
|
+
|
|
1376
|
+
controlledProps.forEach(function (propId) {
|
|
1377
|
+
return delete childrenProps[propId];
|
|
1378
|
+
});
|
|
1379
|
+
inputElement = children(childrenProps);
|
|
1380
|
+
var conflictProps = controlledProps.filter(function (propId) {
|
|
1381
|
+
return inputElement.props[propId] != null && inputElement.props[propId] !== restProps[propId];
|
|
1382
|
+
});
|
|
1383
|
+
!!conflictProps.length ? process.env.NODE_ENV !== "production" ? invariant(false, "react-input-mask: the following props should be passed to the react-input-mask's component and should not be altered in children's function: " + conflictProps.join(', ')) : invariant(false) : void 0;
|
|
1384
|
+
process.env.NODE_ENV !== "production" ? warning(!inputRef, 'react-input-mask: inputRef is ignored when children is passed, attach ref to the children instead') : void 0;
|
|
1385
|
+
} else {
|
|
1386
|
+
inputElement = React.createElement("input", _extends$1({
|
|
1387
|
+
ref: this.handleRef
|
|
1388
|
+
}, restProps));
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
var changedProps = {
|
|
1392
|
+
onFocus: this.onFocus,
|
|
1393
|
+
onBlur: this.onBlur
|
|
1394
|
+
};
|
|
1395
|
+
|
|
1396
|
+
if (this.maskOptions.mask) {
|
|
1397
|
+
if (!restProps.disabled && !restProps.readOnly) {
|
|
1398
|
+
changedProps.onChange = this.onChange;
|
|
1399
|
+
changedProps.onPaste = this.onPaste;
|
|
1400
|
+
changedProps.onMouseDown = this.onMouseDown;
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
if (restProps.value != null) {
|
|
1404
|
+
changedProps.value = this.value;
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
inputElement = React.cloneElement(inputElement, changedProps);
|
|
1409
|
+
return inputElement;
|
|
1410
|
+
};
|
|
1411
|
+
|
|
1412
|
+
return InputElement;
|
|
1413
|
+
}(React.Component);
|
|
1414
|
+
|
|
1415
|
+
var reactInputMask_development = InputElement;
|
|
1416
|
+
|
|
1417
|
+
var reactInputMask = createCommonjsModule(function (module) {
|
|
1418
|
+
if (process.env.NODE_ENV === 'production') {
|
|
1419
|
+
module.exports = reactInputMask_production_min;
|
|
1420
|
+
} else {
|
|
1421
|
+
module.exports = reactInputMask_development;
|
|
1422
|
+
}
|
|
1423
|
+
});
|
|
1424
|
+
|
|
172
1425
|
var DefaultContext = {
|
|
173
1426
|
color: undefined,
|
|
174
1427
|
size: undefined,
|
|
@@ -176,7 +1429,7 @@ var DefaultContext = {
|
|
|
176
1429
|
style: undefined,
|
|
177
1430
|
attr: undefined
|
|
178
1431
|
};
|
|
179
|
-
var IconContext = React.createContext && /*#__PURE__*/React.createContext(DefaultContext);
|
|
1432
|
+
var IconContext = React$2.createContext && /*#__PURE__*/React$2.createContext(DefaultContext);
|
|
180
1433
|
|
|
181
1434
|
var _excluded = ["attr", "size", "title"];
|
|
182
1435
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
@@ -188,12 +1441,12 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
188
1441
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
189
1442
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
190
1443
|
function Tree2Element(tree) {
|
|
191
|
-
return tree && tree.map((node, i) => /*#__PURE__*/React.createElement(node.tag, _objectSpread({
|
|
1444
|
+
return tree && tree.map((node, i) => /*#__PURE__*/React$2.createElement(node.tag, _objectSpread({
|
|
192
1445
|
key: i
|
|
193
1446
|
}, node.attr), Tree2Element(node.child)));
|
|
194
1447
|
}
|
|
195
1448
|
function GenIcon(data) {
|
|
196
|
-
return props => /*#__PURE__*/React.createElement(IconBase, _extends({
|
|
1449
|
+
return props => /*#__PURE__*/React$2.createElement(IconBase, _extends({
|
|
197
1450
|
attr: _objectSpread({}, data.attr)
|
|
198
1451
|
}, props), Tree2Element(data.child));
|
|
199
1452
|
}
|
|
@@ -209,7 +1462,7 @@ function IconBase(props) {
|
|
|
209
1462
|
var className;
|
|
210
1463
|
if (conf.className) className = conf.className;
|
|
211
1464
|
if (props.className) className = (className ? className + " " : "") + props.className;
|
|
212
|
-
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
1465
|
+
return /*#__PURE__*/React$2.createElement("svg", _extends({
|
|
213
1466
|
stroke: "currentColor",
|
|
214
1467
|
fill: "currentColor",
|
|
215
1468
|
strokeWidth: "0"
|
|
@@ -221,9 +1474,9 @@ function IconBase(props) {
|
|
|
221
1474
|
height: computedSize,
|
|
222
1475
|
width: computedSize,
|
|
223
1476
|
xmlns: "http://www.w3.org/2000/svg"
|
|
224
|
-
}), title && /*#__PURE__*/React.createElement("title", null, title), props.children);
|
|
1477
|
+
}), title && /*#__PURE__*/React$2.createElement("title", null, title), props.children);
|
|
225
1478
|
};
|
|
226
|
-
return IconContext !== undefined ? /*#__PURE__*/React.createElement(IconContext.Consumer, null, conf => elem(conf)) : elem(DefaultContext);
|
|
1479
|
+
return IconContext !== undefined ? /*#__PURE__*/React$2.createElement(IconContext.Consumer, null, conf => elem(conf)) : elem(DefaultContext);
|
|
227
1480
|
}
|
|
228
1481
|
|
|
229
1482
|
// THIS FILE IS AUTO GENERATED
|
|
@@ -240,70 +1493,42 @@ function FaDownload (props) {
|
|
|
240
1493
|
}
|
|
241
1494
|
|
|
242
1495
|
var InputField = function (_a) {
|
|
243
|
-
var type = _a.type, id = _a.id,
|
|
244
|
-
|
|
1496
|
+
var type = _a.type, id = _a.id, placeholder = _a.placeholder, onChange = _a.onChange, value = _a.value, label = _a.label, largura = _a.largura, readonly = _a.readonly, disabled = _a.disabled, required = _a.required, checked = _a.checked, maxLength = _a.maxLength, maskType = _a.maskType, onKeyPress = _a.onKeyPress, onBlur = _a.onBlur, // Usando onBlur nas props
|
|
1497
|
+
corFundo = _a.corFundo, corLabel = _a.corLabel, borderRadius = _a.borderRadius, colorIcon = _a.colorIcon, border = _a.border;
|
|
1498
|
+
var _b = React$2.useState(false), isPasswordVisible = _b[0], setIsPasswordVisible = _b[1];
|
|
245
1499
|
var togglePasswordVisibility = function () {
|
|
246
1500
|
setIsPasswordVisible(!isPasswordVisible);
|
|
247
1501
|
};
|
|
248
1502
|
var appliedMaxLength = maxLength !== undefined ? maxLength : 524288;
|
|
249
|
-
// Helper function to apply masks
|
|
250
|
-
var applyMask = function (maskType, value) {
|
|
251
|
-
switch (maskType) {
|
|
252
|
-
case 'cpf':
|
|
253
|
-
return value
|
|
254
|
-
.replace(/\D/g, '') // Remove all non-digits
|
|
255
|
-
.replace(/(\d{3})(\d)/, '$1.$2') // Add dots and hyphen
|
|
256
|
-
.replace(/(\d{3})(\d)/, '$1.$2')
|
|
257
|
-
.replace(/(\d{3})(\d{1,2})$/, '$1-$2')
|
|
258
|
-
.slice(0, 14); // Limit length
|
|
259
|
-
case 'phone':
|
|
260
|
-
return value
|
|
261
|
-
.replace(/\D/g, '')
|
|
262
|
-
.replace(/(\d{2})(\d)/, '($1) $2') // Add parentheses and space
|
|
263
|
-
.replace(/(\d{5})(\d)/, '$1-$2') // Add hyphen
|
|
264
|
-
.slice(0, 15); // Limit length
|
|
265
|
-
case 'telefone':
|
|
266
|
-
return value
|
|
267
|
-
.replace(/\D/g, '')
|
|
268
|
-
.replace(/(\d{2})(\d)/, '($1) $2') // Add parentheses and space
|
|
269
|
-
.replace(/(\d{4})(\d)/, '$1-$2') // Add hyphen
|
|
270
|
-
.slice(0, 14); // Limit length
|
|
271
|
-
case 'cep':
|
|
272
|
-
return value
|
|
273
|
-
.replace(/\D/g, '')
|
|
274
|
-
.replace(/(\d{5})(\d)/, '$1-$2') // Add hyphen
|
|
275
|
-
.slice(0, 9); // Limit length
|
|
276
|
-
case 'date':
|
|
277
|
-
return value
|
|
278
|
-
.replace(/\D/g, '')
|
|
279
|
-
.replace(/(\d{2})(\d)/, '$1/$2')
|
|
280
|
-
.replace(/(\d{2})(\d)/, '$1/$2')
|
|
281
|
-
.slice(0, 10); // Limit length
|
|
282
|
-
case 'time':
|
|
283
|
-
return value
|
|
284
|
-
.replace(/\D/g, '')
|
|
285
|
-
.replace(/(\d{2})(\d)/, '$1:$2')
|
|
286
|
-
.slice(0, 5); // Limit length
|
|
287
|
-
default:
|
|
288
|
-
return value; // No mask applied
|
|
289
|
-
}
|
|
290
|
-
};
|
|
291
1503
|
var handleChange = function (e) {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
1504
|
+
if (type === 'number' && e.target.value.length > appliedMaxLength) {
|
|
1505
|
+
e.target.value = e.target.value.slice(0, appliedMaxLength);
|
|
1506
|
+
}
|
|
1507
|
+
if (onChange) { // Verificando se onChange foi passado antes de chamá-lo
|
|
1508
|
+
onChange(e);
|
|
295
1509
|
}
|
|
296
1510
|
};
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
1511
|
+
var mask = maskType === 'cpf' ? '999.999.999-99' :
|
|
1512
|
+
maskType === 'phone' ? '(99) 99999-9999' :
|
|
1513
|
+
maskType === 'time' ? '99:99' :
|
|
1514
|
+
maskType === 'date' ? '99/99/9999' :
|
|
1515
|
+
maskType === 'cep' ? '99999-999' :
|
|
1516
|
+
maskType === 'telefone' ? '(99) 9999-9999' : '';
|
|
1517
|
+
return (React$2.createElement(React$2.Fragment, null,
|
|
1518
|
+
label && React$2.createElement("label", { htmlFor: id, style: { color: corLabel ? corLabel : '' } }, label),
|
|
1519
|
+
React$2.createElement("div", { className: styles$5.inputWrapper },
|
|
1520
|
+
maskType ? (React$2.createElement(reactInputMask, { mask: mask, value: value, onChange: handleChange, disabled: disabled }, function (inputProps) { return (React$2.createElement("input", __assign({}, inputProps, { type: type === 'password' && isPasswordVisible ? 'text' : type, id: id, name: id, placeholder: placeholder, className: styles$5.inputPadrao, style: {
|
|
301
1521
|
width: largura ? "".concat(largura) : '',
|
|
302
|
-
backgroundColor: disabled ? '#e5e5e5' : (corFundo ? corFundo : ''),
|
|
303
|
-
borderRadius: borderRadius ? "".concat(borderRadius, "px") : '',
|
|
304
|
-
border: border ? border : ''
|
|
305
|
-
}, readOnly: readonly,
|
|
306
|
-
|
|
1522
|
+
backgroundColor: (disabled ? '#e5e5e5' : (corFundo ? corFundo : '')),
|
|
1523
|
+
borderRadius: (borderRadius ? "".concat(borderRadius, "px") : ''),
|
|
1524
|
+
border: (border ? border : '')
|
|
1525
|
+
}, readOnly: readonly, required: required, checked: checked, onKeyPress: onKeyPress, onBlur: onBlur }))); })) : (React$2.createElement("input", { type: type === 'password' && isPasswordVisible ? 'text' : type, id: id, name: id, value: value, placeholder: placeholder, onChange: handleChange, className: styles$5.inputPadrao, style: {
|
|
1526
|
+
width: largura ? "".concat(largura) : '',
|
|
1527
|
+
backgroundColor: (disabled ? '#e5e5e5' : (corFundo ? corFundo : '')),
|
|
1528
|
+
borderRadius: (borderRadius ? "".concat(borderRadius, "px") : ''),
|
|
1529
|
+
border: (border ? border : '')
|
|
1530
|
+
}, readOnly: readonly, disabled: disabled, required: required, checked: checked, maxLength: type === 'text' ? appliedMaxLength : undefined, onKeyPress: onKeyPress, onBlur: onBlur })),
|
|
1531
|
+
type === 'password' && (React$2.createElement("div", { className: styles$5.passwordToggleIcon, onClick: togglePasswordVisibility }, isPasswordVisible ? React$2.createElement(FaEyeSlash, { style: { color: colorIcon ? colorIcon : '' } }) : React$2.createElement(FaEye, { style: { color: colorIcon ? colorIcon : '' } }))))));
|
|
307
1532
|
};
|
|
308
1533
|
|
|
309
1534
|
var css_248z$4 = ".textPage-module_container__GBEF6{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:20px}.textPage-module_content__CpD68{display:flex;text-align:justify}.textPage-module_imageCabecalho__J6YFH{border-radius:8px}.textPage-module_imageCabecalho__J6YFH img{border-radius:8px;height:100%;object-fit:cover;width:100%}.textPage-module_contentWithLateralImage__-f5pQ{flex-direction:row}.textPage-module_imageLateral__Dy9Kx{align-self:flex-start;height:230px;margin-right:20px;margin-top:15px;width:300px}.textPage-module_imageLateral__Dy9Kx img{border-radius:8px;height:100%;object-fit:cover;width:100%}.textPage-module_text__3pwuU{color:#5d5d5d;flex:2;line-height:1.8;text-align:justify}.textPage-module_text__3pwuU p{line-height:1.6;margin:10px 0}.textPage-module_text__3pwuU .textPage-module_coordenacao__UypV-,.textPage-module_text__3pwuU .textPage-module_direcao__x5psb{font-weight:700;margin-top:20px}";
|
|
@@ -312,14 +1537,14 @@ styleInject(css_248z$4);
|
|
|
312
1537
|
|
|
313
1538
|
var TextPage = function (_a) {
|
|
314
1539
|
var imgLateral = _a.imgLateral, imgCabecalho = _a.imgCabecalho, texto = _a.texto;
|
|
315
|
-
return (React.createElement(React.Fragment, null,
|
|
316
|
-
React.createElement("div", { className: styles$4.container },
|
|
317
|
-
imgCabecalho && (React.createElement("div", { className: styles$4.imageCabecalho },
|
|
318
|
-
React.createElement("img", { src: imgCabecalho, alt: imgCabecalho }))),
|
|
319
|
-
React.createElement("div", { className: "".concat(styles$4.content, " ").concat(imgLateral ? styles$4.contentWithLateralImage : '') },
|
|
320
|
-
imgLateral && (React.createElement("div", { className: styles$4.imageLateral },
|
|
321
|
-
React.createElement("img", { src: imgLateral, alt: imgLateral }))),
|
|
322
|
-
React.createElement("div", { className: styles$4.text, dangerouslySetInnerHTML: { __html: texto } })))));
|
|
1540
|
+
return (React$2.createElement(React$2.Fragment, null,
|
|
1541
|
+
React$2.createElement("div", { className: styles$4.container },
|
|
1542
|
+
imgCabecalho && (React$2.createElement("div", { className: styles$4.imageCabecalho },
|
|
1543
|
+
React$2.createElement("img", { src: imgCabecalho, alt: imgCabecalho }))),
|
|
1544
|
+
React$2.createElement("div", { className: "".concat(styles$4.content, " ").concat(imgLateral ? styles$4.contentWithLateralImage : '') },
|
|
1545
|
+
imgLateral && (React$2.createElement("div", { className: styles$4.imageLateral },
|
|
1546
|
+
React$2.createElement("img", { src: imgLateral, alt: imgLateral }))),
|
|
1547
|
+
React$2.createElement("div", { className: styles$4.text, dangerouslySetInnerHTML: { __html: texto } })))));
|
|
323
1548
|
};
|
|
324
1549
|
|
|
325
1550
|
var css_248z$3 = ".menuPage-module_container__grjEI{color:#000;display:flex;height:100%}.menuPage-module_sidebar__7Kg1S{background-color:#fff;border-right:1px solid var(--greyHover);height:500px;max-height:500px;overflow-y:auto;padding-bottom:15px;width:250px}.menuPage-module_sidebar__7Kg1S ul{list-style:none;margin:0;padding:0}.menuPage-module_sidebar__7Kg1S ul li{margin:10px 0}.menuPage-module_sidebar__7Kg1S ul li button{background:none;border:none;cursor:pointer;font-weight:700;padding:10px;text-align:left;text-decoration:none;width:100%}.menuPage-module_content__g2T-d{background-color:#fff;flex:1;max-height:475px;overflow-y:auto;padding:20px}@media (max-width:800px){.menuPage-module_sidebar__7Kg1S{width:160px}}.menuPage-module_empresa1__tLASf .menuPage-module_sidebar__7Kg1S ul li button{color:var(--blue)}.menuPage-module_empresa1__tLASf .menuPage-module_sidebar__7Kg1S ul li button.menuPage-module_active__Mfy4T{background-color:var(--lightGray);border-left:4px solid var(--blue)}.menuPage-module_empresa3__xkxls .menuPage-module_sidebar__7Kg1S ul li button{color:var(--green)}.menuPage-module_empresa3__xkxls .menuPage-module_sidebar__7Kg1S ul li button.menuPage-module_active__Mfy4T{background-color:var(--lightGray);border-left:4px solid var(--green)}.menuPage-module_empresa4__h8gOQ .menuPage-module_sidebar__7Kg1S ul li button{background-color:var(--red)}.menuPage-module_empresa4__h8gOQ .menuPage-module_sidebar__7Kg1S ul li button.menuPage-module_active__Mfy4T{background-color:var(--lightGray);border-left:4px solid var(--blue)}.menuPage-module_empresa5__iiGgr .menuPage-module_sidebar__7Kg1S ul li button{background-color:var(--cartaoGreen)}.menuPage-module_empresa5__iiGgr .menuPage-module_sidebar__7Kg1S ul li button.menuPage-module_active__Mfy4T{background-color:var(--lightGray);border-left:4px solid var(--cartaoBlue)}";
|
|
@@ -329,13 +1554,13 @@ styleInject(css_248z$3);
|
|
|
329
1554
|
var MenuPage = function (_a) {
|
|
330
1555
|
var menus = _a.menus, contents = _a.contents, empresa = _a.empresa;
|
|
331
1556
|
var empresaClass = styles$3["empresa".concat(empresa)];
|
|
332
|
-
var _b = React.useState(menus[0].key), selectedSection = _b[0], setSelectedSection = _b[1];
|
|
333
|
-
return (React.createElement("div", { className: "".concat(empresaClass) },
|
|
334
|
-
React.createElement("div", { className: styles$3.container },
|
|
335
|
-
React.createElement("nav", { className: styles$3.sidebar },
|
|
336
|
-
React.createElement("ul", null, menus.map(function (menu) { return (React.createElement("li", { key: menu.key },
|
|
337
|
-
React.createElement("button", { className: selectedSection === menu.key ? styles$3.active : '', onClick: function () { return setSelectedSection(menu.key); } }, menu.label))); }))),
|
|
338
|
-
React.createElement("main", { className: styles$3.content }, contents[selectedSection]))));
|
|
1557
|
+
var _b = React$2.useState(menus[0].key), selectedSection = _b[0], setSelectedSection = _b[1];
|
|
1558
|
+
return (React$2.createElement("div", { className: "".concat(empresaClass) },
|
|
1559
|
+
React$2.createElement("div", { className: styles$3.container },
|
|
1560
|
+
React$2.createElement("nav", { className: styles$3.sidebar },
|
|
1561
|
+
React$2.createElement("ul", null, menus.map(function (menu) { return (React$2.createElement("li", { key: menu.key },
|
|
1562
|
+
React$2.createElement("button", { className: selectedSection === menu.key ? styles$3.active : '', onClick: function () { return setSelectedSection(menu.key); } }, menu.label))); }))),
|
|
1563
|
+
React$2.createElement("main", { className: styles$3.content }, contents[selectedSection]))));
|
|
339
1564
|
};
|
|
340
1565
|
|
|
341
1566
|
var css_248z$2 = ".select-module_selectPadrao__poGiL{appearance:none;-webkit-appearance:none;-moz-appearance:none;background-color:#fff;background-position:right .75rem center;background-repeat:no-repeat;background-size:1rem;border:1px solid #ccc;border-radius:.5rem;font-style:italic;padding:.8rem 2.5rem .8rem 1rem;width:100%}.select-module_selectPadrao__poGiL:focus{outline:none}.select-module_empresa1__ol7rX .select-module_selectPadrao__poGiL option:hover{background-color:var(--blueHover)}.select-module_empresa3__8ChI2 .select-module_selectPadrao__poGiL option:hover,.select-module_empresa4__XByGS .select-module_selectPadrao__poGiL option:hover{background-color:var(--redHover)}.select-module_empresa5__Th-sO .select-module_selectPadrao__poGiL option:hover{background-color:var(--lightblueHover)}";
|
|
@@ -366,9 +1591,9 @@ var SelectField = function (_a) {
|
|
|
366
1591
|
};
|
|
367
1592
|
var arrowColor = getArrowColorByEmpresa(empresa);
|
|
368
1593
|
var arrowSvg = encodeURIComponent("\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"".concat(arrowColor, "\">\n <path fill-rule=\"evenodd\" d=\"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z\" clip-rule=\"evenodd\"/>\n </svg>\n "));
|
|
369
|
-
return (React.createElement("div", { className: styles$2["empresa".concat(empresa)] },
|
|
370
|
-
label && React.createElement("label", { htmlFor: id, style: { color: corLabel ? corLabel : '' } }, label),
|
|
371
|
-
React.createElement("select", { id: id, name: name, className: styles$2.selectPadrao, value: value, onChange: handleSelectChange, style: {
|
|
1594
|
+
return (React$2.createElement("div", { className: styles$2["empresa".concat(empresa)] },
|
|
1595
|
+
label && React$2.createElement("label", { htmlFor: id, style: { color: corLabel ? corLabel : '' } }, label),
|
|
1596
|
+
React$2.createElement("select", { id: id, name: name, className: styles$2.selectPadrao, value: value, onChange: handleSelectChange, style: {
|
|
372
1597
|
width: largura ? "".concat(largura) : '',
|
|
373
1598
|
backgroundColor: corFundo ? corFundo : '',
|
|
374
1599
|
backgroundImage: "url(\"data:image/svg+xml,".concat(arrowSvg, "\")"),
|
|
@@ -378,16 +1603,16 @@ var SelectField = function (_a) {
|
|
|
378
1603
|
borderRadius: (borderRadius ? "".concat(borderRadius, "px") : ''),
|
|
379
1604
|
border: (border ? border : '')
|
|
380
1605
|
}, disabled: disabled, multiple: multiple, required: required },
|
|
381
|
-
optionDefault && !multiple && (React.createElement("option", { value: "" }, "Selecione...")),
|
|
382
|
-
options.map(function (option) { return (React.createElement("option", { key: option.value, value: option.value }, option.description)); }))));
|
|
1606
|
+
optionDefault && !multiple && (React$2.createElement("option", { value: "" }, "Selecione...")),
|
|
1607
|
+
options.map(function (option) { return (React$2.createElement("option", { key: option.value, value: option.value }, option.description)); }))));
|
|
383
1608
|
};
|
|
384
1609
|
|
|
385
1610
|
var Busca = function (_a) {
|
|
386
1611
|
var options = _a.options; _a.value; var onChange = _a.onChange, label = _a.label, _b = _a.showIcon, showIcon = _b === void 0 ? false : _b, corLabel = _a.corLabel, corFundo = _a.corFundo, borderRadius = _a.borderRadius, border = _a.border;
|
|
387
|
-
var _c = React.useState(options), filteredOptions = _c[0], setFilteredOptions = _c[1];
|
|
388
|
-
var _d = React.useState(false), showOptions = _d[0], setShowOptions = _d[1];
|
|
389
|
-
var _e = React.useState(''), inputValue = _e[0], setInputValue = _e[1];
|
|
390
|
-
var inputRef = React.useRef(null);
|
|
1612
|
+
var _c = React$2.useState(options), filteredOptions = _c[0], setFilteredOptions = _c[1];
|
|
1613
|
+
var _d = React$2.useState(false), showOptions = _d[0], setShowOptions = _d[1];
|
|
1614
|
+
var _e = React$2.useState(''), inputValue = _e[0], setInputValue = _e[1];
|
|
1615
|
+
var inputRef = React$2.useRef(null);
|
|
391
1616
|
var handleInputChange = function (e) {
|
|
392
1617
|
var inputValue = e.target.value;
|
|
393
1618
|
setInputValue(inputValue);
|
|
@@ -417,24 +1642,24 @@ var Busca = function (_a) {
|
|
|
417
1642
|
setShowOptions(false);
|
|
418
1643
|
}
|
|
419
1644
|
};
|
|
420
|
-
React.useEffect(function () {
|
|
1645
|
+
React$2.useEffect(function () {
|
|
421
1646
|
document.addEventListener('mousedown', handleClickOutside);
|
|
422
1647
|
return function () {
|
|
423
1648
|
document.removeEventListener('mousedown', handleClickOutside);
|
|
424
1649
|
};
|
|
425
1650
|
}, []);
|
|
426
|
-
return (React.createElement("div", { style: { position: 'relative', width: '100%' }, ref: inputRef },
|
|
427
|
-
label && React.createElement("label", { htmlFor: "busca", style: { color: corLabel ? corLabel : '' } }, label),
|
|
428
|
-
React.createElement("div", { style: { position: 'relative', display: 'flex', alignItems: 'center', gap: '10px', width: '100%' } },
|
|
429
|
-
showIcon && React.createElement(FaSearch, { className: styles$5.searchIcon }),
|
|
430
|
-
React.createElement("input", { type: "text", id: "busca", value: inputValue, onChange: handleInputChange, onFocus: handleFocus, placeholder: "Digite para buscar...", autoComplete: "off", className: styles$5.inputPadrao, style: {
|
|
1651
|
+
return (React$2.createElement("div", { style: { position: 'relative', width: '100%' }, ref: inputRef },
|
|
1652
|
+
label && React$2.createElement("label", { htmlFor: "busca", style: { color: corLabel ? corLabel : '' } }, label),
|
|
1653
|
+
React$2.createElement("div", { style: { position: 'relative', display: 'flex', alignItems: 'center', gap: '10px', width: '100%' } },
|
|
1654
|
+
showIcon && React$2.createElement(FaSearch, { className: styles$5.searchIcon }),
|
|
1655
|
+
React$2.createElement("input", { type: "text", id: "busca", value: inputValue, onChange: handleInputChange, onFocus: handleFocus, placeholder: "Digite para buscar...", autoComplete: "off", className: styles$5.inputPadrao, style: {
|
|
431
1656
|
width: '100%',
|
|
432
1657
|
paddingLeft: showIcon ? '30px' : '0',
|
|
433
1658
|
backgroundColor: (corFundo ? corFundo : ''),
|
|
434
1659
|
borderRadius: (borderRadius ? "".concat(borderRadius, "px") : ''),
|
|
435
1660
|
border: (border ? border : '')
|
|
436
1661
|
} })),
|
|
437
|
-
showOptions && filteredOptions.length > 0 && (React.createElement("ul", { style: {
|
|
1662
|
+
showOptions && filteredOptions.length > 0 && (React$2.createElement("ul", { style: {
|
|
438
1663
|
position: 'absolute',
|
|
439
1664
|
width: '100%',
|
|
440
1665
|
maxHeight: '150px',
|
|
@@ -445,7 +1670,7 @@ var Busca = function (_a) {
|
|
|
445
1670
|
margin: 0,
|
|
446
1671
|
padding: '5px',
|
|
447
1672
|
listStyle: 'none'
|
|
448
|
-
} }, filteredOptions.map(function (option, index) { return (React.createElement("li", { key: index, onClick: function () { return handleOptionClick(option); }, style: { padding: '5px', cursor: 'pointer' } }, option.description)); })))));
|
|
1673
|
+
} }, filteredOptions.map(function (option, index) { return (React$2.createElement("li", { key: index, onClick: function () { return handleOptionClick(option); }, style: { padding: '5px', cursor: 'pointer' } }, option.description)); })))));
|
|
449
1674
|
};
|
|
450
1675
|
|
|
451
1676
|
var css_248z$1 = ".checkboxGroup-module_checkboxGroup__JFRoY{border:1px solid #ccc;border-radius:.5rem;box-sizing:border-box;display:grid;font-style:italic;gap:.5rem;grid-auto-rows:auto;grid-template-columns:repeat(auto-fill,minmax(275px,1fr));padding:.8rem 0 .8rem 1rem;width:100%}.checkboxGroup-module_title__238QG{margin-bottom:10px}.checkboxGroup-module_checkboxLabel__tIciT{align-items:center;cursor:pointer;display:flex;font-style:italic}.checkboxGroup-module_checkboxLabel__tIciT input[type=checkbox]{cursor:pointer;margin-right:.5rem}.checkboxGroup-module_checkboxLabel__tIciT input[type=checkbox]:focus{outline:none}";
|
|
@@ -464,10 +1689,10 @@ var CheckboxGroup = function (_a) {
|
|
|
464
1689
|
}
|
|
465
1690
|
onChange(updatedValues);
|
|
466
1691
|
};
|
|
467
|
-
return (React.createElement("div", { className: styles$1.checkboxGroup },
|
|
468
|
-
label && React.createElement("label", { className: styles$1.title }, label),
|
|
469
|
-
options.map(function (option) { return (React.createElement("label", { key: option.value, className: styles$1.checkboxLabel },
|
|
470
|
-
React.createElement("input", { type: "checkbox", name: name, value: option.value, checked: selectedValues.includes(option.value), onChange: function () { return handleCheckboxChange(option.value); }, required: required && selectedValues.length === 0 }),
|
|
1692
|
+
return (React$2.createElement("div", { className: styles$1.checkboxGroup },
|
|
1693
|
+
label && React$2.createElement("label", { className: styles$1.title }, label),
|
|
1694
|
+
options.map(function (option) { return (React$2.createElement("label", { key: option.value, className: styles$1.checkboxLabel },
|
|
1695
|
+
React$2.createElement("input", { type: "checkbox", name: name, value: option.value, checked: selectedValues.includes(option.value), onChange: function () { return handleCheckboxChange(option.value); }, required: required && selectedValues.length === 0 }),
|
|
471
1696
|
option.description)); })));
|
|
472
1697
|
};
|
|
473
1698
|
|
|
@@ -16352,8 +17577,8 @@ styleInject(css_248z);
|
|
|
16352
17577
|
|
|
16353
17578
|
var TableStandard = function (_a) {
|
|
16354
17579
|
var dados = _a.dados, onRowClick = _a.onRowClick, _b = _a.idColumn, idColumn = _b === void 0 ? 'id' : _b, onActionClick = _a.onActionClick, onDownloadClick = _a.onDownloadClick, onViewClick = _a.onViewClick, _c = _a.showActionColumn, showActionColumn = _c === void 0 ? false : _c, _d = _a.showDownloadButton, showDownloadButton = _d === void 0 ? false : _d, _e = _a.showExcelDownloadButton, showExcelDownloadButton = _e === void 0 ? false : _e, _f = _a.showViewButton, showViewButton = _f === void 0 ? false : _f, _g = _a.cor, cor = _g === void 0 ? false : _g, _h = _a.numeroPaginas, numeroPaginas = _h === void 0 ? 10 : _h, empresa = _a.empresa;
|
|
16355
|
-
var _j = React.useState(null), selectedRow = _j[0], setSelectedRow = _j[1];
|
|
16356
|
-
var _k = React.useState(1), currentPage = _k[0], setCurrentPage = _k[1];
|
|
17580
|
+
var _j = React$2.useState(null), selectedRow = _j[0], setSelectedRow = _j[1];
|
|
17581
|
+
var _k = React$2.useState(1), currentPage = _k[0], setCurrentPage = _k[1];
|
|
16357
17582
|
var ultimoItem = currentPage * numeroPaginas;
|
|
16358
17583
|
var primeiroItem = ultimoItem - numeroPaginas;
|
|
16359
17584
|
var currentItems = dados.slice(primeiroItem, ultimoItem);
|
|
@@ -16381,48 +17606,48 @@ var TableStandard = function (_a) {
|
|
|
16381
17606
|
for (var i = 1; i <= Math.ceil(dados.length / numeroPaginas); i++) {
|
|
16382
17607
|
pageNumbers.push(i);
|
|
16383
17608
|
}
|
|
16384
|
-
return (React.createElement("div", { className: styles.tableResponsive },
|
|
16385
|
-
showExcelDownloadButton && (React.createElement("div", { className: styles.excelWrapper },
|
|
16386
|
-
React.createElement("button", { onClick: handleDownloadClick, className: styles.downloadButton },
|
|
16387
|
-
React.createElement(FaDownload, null),
|
|
17609
|
+
return (React$2.createElement("div", { className: styles.tableResponsive },
|
|
17610
|
+
showExcelDownloadButton && (React$2.createElement("div", { className: styles.excelWrapper },
|
|
17611
|
+
React$2.createElement("button", { onClick: handleDownloadClick, className: styles.downloadButton },
|
|
17612
|
+
React$2.createElement(FaDownload, null),
|
|
16388
17613
|
" Excel"))),
|
|
16389
|
-
React.createElement("table", { className: styles.tableContainer },
|
|
16390
|
-
React.createElement("thead", null,
|
|
16391
|
-
React.createElement("tr", { className: "".concat(empresaClass, " ").concat(styles.row) },
|
|
16392
|
-
Object.keys(dados[0] || {}).map(function (key) { return (React.createElement("th", { key: key, className: styles.header }, key.charAt(0).toUpperCase() + key.slice(1))); }),
|
|
16393
|
-
(showActionColumn || showDownloadButton || showViewButton) && React.createElement("th", { className: styles.header }, "A\u00E7\u00F5es"))),
|
|
16394
|
-
React.createElement("tbody", null, currentItems.map(function (row, index) { return (React.createElement("tr", { key: index, className: "".concat(styles.row, " ").concat(selectedRow === row[idColumn] ? styles.activeRow : ''), onClick: function () { return handleRowClick(row); }, style: { background: cor ? 'white' : '' } },
|
|
16395
|
-
Object.keys(row).map(function (key, i) { return (React.createElement("td", { key: i, className: styles.cell }, row[key])); }),
|
|
16396
|
-
(showActionColumn || showDownloadButton || showViewButton) && (React.createElement("td", { className: styles.cell },
|
|
16397
|
-
React.createElement("div", { style: { display: 'flex', gap: '0.5rem', justifyContent: 'center' }, className: "".concat(empresaClass) },
|
|
16398
|
-
showActionColumn && (React.createElement("button", { onClick: function (e) {
|
|
17614
|
+
React$2.createElement("table", { className: styles.tableContainer },
|
|
17615
|
+
React$2.createElement("thead", null,
|
|
17616
|
+
React$2.createElement("tr", { className: "".concat(empresaClass, " ").concat(styles.row) },
|
|
17617
|
+
Object.keys(dados[0] || {}).map(function (key) { return (React$2.createElement("th", { key: key, className: styles.header }, key.charAt(0).toUpperCase() + key.slice(1))); }),
|
|
17618
|
+
(showActionColumn || showDownloadButton || showViewButton) && React$2.createElement("th", { className: styles.header }, "A\u00E7\u00F5es"))),
|
|
17619
|
+
React$2.createElement("tbody", null, currentItems.map(function (row, index) { return (React$2.createElement("tr", { key: index, className: "".concat(styles.row, " ").concat(selectedRow === row[idColumn] ? styles.activeRow : ''), onClick: function () { return handleRowClick(row); }, style: { background: cor ? 'white' : '' } },
|
|
17620
|
+
Object.keys(row).map(function (key, i) { return (React$2.createElement("td", { key: i, className: styles.cell }, row[key])); }),
|
|
17621
|
+
(showActionColumn || showDownloadButton || showViewButton) && (React$2.createElement("td", { className: styles.cell },
|
|
17622
|
+
React$2.createElement("div", { style: { display: 'flex', gap: '0.5rem', justifyContent: 'center' }, className: "".concat(empresaClass) },
|
|
17623
|
+
showActionColumn && (React$2.createElement("button", { onClick: function (e) {
|
|
16399
17624
|
e.stopPropagation();
|
|
16400
17625
|
if (onActionClick)
|
|
16401
17626
|
onActionClick(row[idColumn]);
|
|
16402
17627
|
}, className: styles.actionButton, title: 'Editar' },
|
|
16403
|
-
React.createElement(FaPen, null))),
|
|
16404
|
-
showDownloadButton && shouldShowDownloadButton(row[idColumn]) && (React.createElement("button", { onClick: function (e) {
|
|
17628
|
+
React$2.createElement(FaPen, null))),
|
|
17629
|
+
showDownloadButton && shouldShowDownloadButton(row[idColumn]) && (React$2.createElement("button", { onClick: function (e) {
|
|
16405
17630
|
e.stopPropagation();
|
|
16406
17631
|
if (onDownloadClick)
|
|
16407
17632
|
onDownloadClick(row[idColumn]);
|
|
16408
17633
|
}, className: styles.downloadButton, title: 'Download do Arquivo' },
|
|
16409
|
-
React.createElement(FaDownload, null))),
|
|
16410
|
-
showViewButton && (React.createElement("button", { onClick: function (e) {
|
|
17634
|
+
React$2.createElement(FaDownload, null))),
|
|
17635
|
+
showViewButton && (React$2.createElement("button", { onClick: function (e) {
|
|
16411
17636
|
e.stopPropagation();
|
|
16412
17637
|
if (onViewClick)
|
|
16413
17638
|
onViewClick(row[idColumn]);
|
|
16414
17639
|
}, className: styles.actionButton, title: 'Visualizar' },
|
|
16415
|
-
React.createElement(FaEye, null)))))))); }))),
|
|
16416
|
-
React.createElement("div", { className: "".concat(empresaClass, " ").concat(styles.pagination) }, pageNumbers.map(function (number) { return (React.createElement("button", { key: number, onClick: function () { return setCurrentPage(number); }, className: "".concat(styles.pageButton, " ").concat(currentPage === number ? styles.activePage : '') }, number)); }))));
|
|
17640
|
+
React$2.createElement(FaEye, null)))))))); }))),
|
|
17641
|
+
React$2.createElement("div", { className: "".concat(empresaClass, " ").concat(styles.pagination) }, pageNumbers.map(function (number) { return (React$2.createElement("button", { key: number, onClick: function () { return setCurrentPage(number); }, className: "".concat(styles.pageButton, " ").concat(currentPage === number ? styles.activePage : '') }, number)); }))));
|
|
16417
17642
|
};
|
|
16418
17643
|
|
|
16419
17644
|
var TextAreaField = function (_a) {
|
|
16420
17645
|
var id = _a.id, placeholder = _a.placeholder, onChange = _a.onChange, value = _a.value, label = _a.label, largura = _a.largura, readonly = _a.readonly, disabled = _a.disabled, required = _a.required, maxLength = _a.maxLength, onKeyPress = _a.onKeyPress, onBlur = _a.onBlur, corFundo = _a.corFundo, corLabel = _a.corLabel, borderRadius = _a.borderRadius, border = _a.border;
|
|
16421
17646
|
var appliedMaxLength = maxLength !== undefined ? maxLength : 524288;
|
|
16422
|
-
return (React.createElement(React.Fragment, null,
|
|
16423
|
-
label && React.createElement("label", { htmlFor: id, style: { color: corLabel ? corLabel : '' } }, label),
|
|
16424
|
-
React.createElement("div", { className: styles$5.inputWrapper },
|
|
16425
|
-
React.createElement("textarea", { id: id, name: id, value: value, placeholder: placeholder, onChange: onChange, className: styles$5.inputPadrao, style: {
|
|
17647
|
+
return (React$2.createElement(React$2.Fragment, null,
|
|
17648
|
+
label && React$2.createElement("label", { htmlFor: id, style: { color: corLabel ? corLabel : '' } }, label),
|
|
17649
|
+
React$2.createElement("div", { className: styles$5.inputWrapper },
|
|
17650
|
+
React$2.createElement("textarea", { id: id, name: id, value: value, placeholder: placeholder, onChange: onChange, className: styles$5.inputPadrao, style: {
|
|
16426
17651
|
width: largura ? "".concat(largura) : '',
|
|
16427
17652
|
backgroundColor: disabled ? '#e5e5e5' : (corFundo ? corFundo : ''),
|
|
16428
17653
|
resize: 'none',
|