componenteshospitais 3.1.0 → 3.1.2
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 +181 -1394
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +171 -1384
- package/dist/esm/index.js.map +1 -1
- package/dist/types/components/SelectField.d.ts +1 -0
- package/dist/types/components/TableStandard.d.ts +1 -1
- package/package.json +3 -3
- package/src/components/InputField.tsx +67 -38
- package/src/components/SelectField.tsx +4 -1
- package/src/components/TableStandard.tsx +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var React
|
|
4
|
-
var reactDom = require('react-dom');
|
|
3
|
+
var React = require('react');
|
|
5
4
|
|
|
6
5
|
function styleInject(css, ref) {
|
|
7
6
|
if ( ref === void 0 ) ref = {};
|
|
@@ -40,10 +39,10 @@ styleInject(css_248z$8);
|
|
|
40
39
|
var TituloPagina = function (_a) {
|
|
41
40
|
var titulo = _a.titulo, onClick = _a.onClick, empresa = _a.empresa;
|
|
42
41
|
var empresaClass = styles$8["empresa".concat(empresa)];
|
|
43
|
-
return (React
|
|
44
|
-
React
|
|
45
|
-
React
|
|
46
|
-
React
|
|
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"))));
|
|
47
46
|
};
|
|
48
47
|
|
|
49
48
|
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)}";
|
|
@@ -68,11 +67,11 @@ var Card = function (_a) {
|
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
69
|
};
|
|
71
|
-
return (React
|
|
72
|
-
React
|
|
73
|
-
img && (React
|
|
74
|
-
React
|
|
75
|
-
imgLateral && (React
|
|
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 })))));
|
|
76
75
|
};
|
|
77
76
|
|
|
78
77
|
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)}";
|
|
@@ -81,7 +80,7 @@ styleInject(css_248z$6);
|
|
|
81
80
|
|
|
82
81
|
var CardImage = function (_a) {
|
|
83
82
|
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;
|
|
84
|
-
var _b = React
|
|
83
|
+
var _b = React.useState(null), fileName = _b[0], setFileName = _b[1];
|
|
85
84
|
var empresaClass = styles$6["empresa".concat(empresa)];
|
|
86
85
|
var handleActionClick = function () {
|
|
87
86
|
if (funcao && parametro) {
|
|
@@ -100,11 +99,11 @@ var CardImage = function (_a) {
|
|
|
100
99
|
setFileName(null);
|
|
101
100
|
}
|
|
102
101
|
};
|
|
103
|
-
var content = (React
|
|
104
|
-
React
|
|
105
|
-
texto && (React
|
|
106
|
-
return (React
|
|
107
|
-
React
|
|
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: {
|
|
108
107
|
position: 'absolute',
|
|
109
108
|
top: 0,
|
|
110
109
|
left: 0,
|
|
@@ -114,7 +113,7 @@ var CardImage = function (_a) {
|
|
|
114
113
|
cursor: 'pointer'
|
|
115
114
|
}, accept: accept }),
|
|
116
115
|
content,
|
|
117
|
-
React
|
|
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)))));
|
|
118
117
|
};
|
|
119
118
|
|
|
120
119
|
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)}";
|
|
@@ -124,1304 +123,26 @@ styleInject(css_248z$5);
|
|
|
124
123
|
var Button = function (_a) {
|
|
125
124
|
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;
|
|
126
125
|
var empresaClass = styles$5["empresa".concat(empresa)];
|
|
127
|
-
return (React
|
|
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 }))));
|
|
128
127
|
};
|
|
129
128
|
|
|
130
|
-
|
|
131
|
-
Copyright (c) Microsoft Corporation.
|
|
132
|
-
|
|
133
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
134
|
-
purpose with or without fee is hereby granted.
|
|
135
|
-
|
|
136
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
137
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
138
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
139
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
140
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
141
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
142
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
143
|
-
***************************************************************************** */
|
|
144
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
var __assign = function() {
|
|
148
|
-
__assign = Object.assign || function __assign(t) {
|
|
149
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
150
|
-
s = arguments[i];
|
|
151
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
152
|
-
}
|
|
153
|
-
return t;
|
|
154
|
-
};
|
|
155
|
-
return __assign.apply(this, arguments);
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
function __spreadArray(to, from, pack) {
|
|
159
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
160
|
-
if (ar || !(i in from)) {
|
|
161
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
162
|
-
ar[i] = from[i];
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
169
|
-
var e = new Error(message);
|
|
170
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
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
|
-
}
|
|
129
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
777
130
|
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
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;
|
|
131
|
+
function unwrapExports (x) {
|
|
132
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
133
|
+
}
|
|
1416
134
|
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
module.exports = reactInputMask_production_min;
|
|
1420
|
-
} else {
|
|
1421
|
-
module.exports = reactInputMask_development;
|
|
135
|
+
function createCommonjsModule(fn, module) {
|
|
136
|
+
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
1422
137
|
}
|
|
138
|
+
|
|
139
|
+
var reactTextMask = createCommonjsModule(function (module, exports) {
|
|
140
|
+
!function(e,t){module.exports=t(React);}(commonjsGlobal,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return !t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t);}Object.defineProperty(t,"__esModule",{value:!0}),t.conformToMask=void 0;var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);}return e},l=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n);}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),f=r(3);Object.defineProperty(t,"conformToMask",{enumerable:!0,get:function(){return n(f).default}});var c=r(11),p=n(c),d=r(9),h=n(d),v=r(5),y=n(v),m=r(2),b=function(e){function t(){var e;i(this,t);for(var r=arguments.length,n=Array(r),o=0;o<r;o++)n[o]=arguments[o];var u=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(n)));return u.setRef=u.setRef.bind(u),u.onBlur=u.onBlur.bind(u),u.onChange=u.onChange.bind(u),u}return u(t,e),l(t,[{key:"setRef",value:function(e){this.inputElement=e;}},{key:"initTextMask",value:function(){var e=this.props,t=this.props.value;this.textMaskInputElement=(0, y.default)(s({inputElement:this.inputElement},e)),this.textMaskInputElement.update(t);}},{key:"componentDidMount",value:function(){this.initTextMask();}},{key:"componentDidUpdate",value:function(e){var t=this.props,r=t.value,n=t.pipe,o=t.mask,i=t.guide,a=t.placeholderChar,u=t.showMask,s={guide:i,placeholderChar:a,showMask:u},l="function"==typeof n&&"function"==typeof e.pipe?n.toString()!==e.pipe.toString():(0, m.isNil)(n)&&!(0, m.isNil)(e.pipe)||!(0, m.isNil)(n)&&(0, m.isNil)(e.pipe),f=o.toString()!==e.mask.toString(),c=Object.keys(s).some(function(t){return s[t]!==e[t]})||f||l,p=r!==this.inputElement.value;(p||c)&&this.initTextMask();}},{key:"render",value:function e(){var t=this.props,e=t.render,r=o(t,["render"]);return delete r.mask,delete r.guide,delete r.pipe,delete r.placeholderChar,delete r.keepCharPositions,delete r.value,delete r.onBlur,delete r.onChange,delete r.showMask,e(this.setRef,s({onBlur:this.onBlur,onChange:this.onChange,defaultValue:this.props.value},r))}},{key:"onChange",value:function(e){this.textMaskInputElement.update(),"function"==typeof this.props.onChange&&this.props.onChange(e);}},{key:"onBlur",value:function(e){"function"==typeof this.props.onBlur&&this.props.onBlur(e);}}]),t}(p.default.PureComponent);t.default=b,b.propTypes={mask:h.default.oneOfType([h.default.array,h.default.func,h.default.bool,h.default.shape({mask:h.default.oneOfType([h.default.array,h.default.func]),pipe:h.default.func})]).isRequired,guide:h.default.bool,value:h.default.oneOfType([h.default.string,h.default.number]),pipe:h.default.func,placeholderChar:h.default.string,keepCharPositions:h.default.bool,showMask:h.default.bool},b.defaultProps={render:function(e,t){return p.default.createElement("input",s({ref:e},t))}};},function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.placeholderChar="_",t.strFunction="function";},function(e,t,r){function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.placeholderChar;if(!o(e))throw new Error("Text-mask:convertMaskToPlaceholder; The mask property must be an array.");if(e.indexOf(t)!==-1)throw new Error("Placeholder character must not be used as part of the mask. Please specify a character that is not present in your mask as your placeholder character.\n\n"+("The placeholder character that was received is: "+JSON.stringify(t)+"\n\n")+("The mask that was received is: "+JSON.stringify(e)));return e.map(function(e){return e instanceof RegExp?t:e}).join("")}function o(e){return Array.isArray&&Array.isArray(e)||e instanceof Array}function i(e){return "string"==typeof e||e instanceof String}function a(e){return "number"==typeof e&&void 0===e.length&&!isNaN(e)}function u(e){return "undefined"==typeof e||null===e}function s(e){for(var t=[],r=void 0;r=e.indexOf(c),r!==-1;)t.push(r),e.splice(r,1);return {maskWithoutCaretTraps:e,indexes:t}}Object.defineProperty(t,"__esModule",{value:!0}),t.convertMaskToPlaceholder=n,t.isArray=o,t.isString=i,t.isNumber=a,t.isNil=u,t.processCaretTraps=s;var l=r(1),f=[],c="[]";},function(e,t,r){function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!(0, i.isArray)(t)){if(("undefined"==typeof t?"undefined":o(t))!==a.strFunction)throw new Error("Text-mask:conformToMask; The mask property must be an array.");t=t(e,r),t=(0, i.processCaretTraps)(t).maskWithoutCaretTraps;}var n=r.guide,l=void 0===n||n,f=r.previousConformedValue,c=void 0===f?s:f,p=r.placeholderChar,d=void 0===p?a.placeholderChar:p,h=r.placeholder,v=void 0===h?(0, i.convertMaskToPlaceholder)(t,d):h,y=r.currentCaretPosition,m=r.keepCharPositions,b=l===!1&&void 0!==c,g=e.length,k=c.length,C=v.length,O=t.length,T=g-k,P=T>0,x=y+(P?-T:0),w=x+Math.abs(T);if(m===!0&&!P){for(var S=s,_=x;_<w;_++)v[_]===d&&(S+=d);e=e.slice(0,x)+S+e.slice(x,g);}for(var M=e.split(s).map(function(e,t){return {char:e,isNew:t>=x&&t<w}}),j=g-1;j>=0;j--){var E=M[j].char;if(E!==d){var R=j>=x&&k===O;E===v[R?j-T:j]&&M.splice(j,1);}}var V=s,N=!1;e:for(var A=0;A<C;A++){var B=v[A];if(B===d){if(M.length>0)for(;M.length>0;){var I=M.shift(),F=I.char,q=I.isNew;if(F===d&&b!==!0){V+=d;continue e}if(t[A].test(F)){if(m===!0&&q!==!1&&c!==s&&l!==!1&&P){for(var D=M.length,L=null,W=0;W<D;W++){var J=M[W];if(J.char!==d&&J.isNew===!1)break;if(J.char===d){L=W;break}}null!==L?(V+=F,M.splice(L,1)):A--;}else V+=F;continue e}N=!0;}b===!1&&(V+=v.substr(A,C));break}V+=B;}if(b&&P===!1){for(var U=null,H=0;H<V.length;H++)v[H]===d&&(U=H);V=null!==U?V.substr(0,U+1):s;}return {conformedValue:V,meta:{someCharsRejected:N}}}Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=n;var i=r(2),a=r(1),u=[],s="";},function(e,t){function r(e){var t=e.previousConformedValue,r=void 0===t?o:t,i=e.previousPlaceholder,a=void 0===i?o:i,u=e.currentCaretPosition,s=void 0===u?0:u,l=e.conformedValue,f=e.rawValue,c=e.placeholderChar,p=e.placeholder,d=e.indexesOfPipedChars,h=void 0===d?n:d,v=e.caretTrapIndexes,y=void 0===v?n:v;if(0===s||!f.length)return 0;var m=f.length,b=r.length,g=p.length,k=l.length,C=m-b,O=C>0,T=0===b,P=C>1&&!O&&!T;if(P)return s;var x=O&&(r===l||l===p),w=0,S=void 0,_=void 0;if(x)w=s-C;else {var M=l.toLowerCase(),j=f.toLowerCase(),E=j.substr(0,s).split(o),R=E.filter(function(e){return M.indexOf(e)!==-1});_=R[R.length-1];var V=a.substr(0,R.length).split(o).filter(function(e){return e!==c}).length,N=p.substr(0,R.length).split(o).filter(function(e){return e!==c}).length,A=N!==V,B=void 0!==a[R.length-1]&&void 0!==p[R.length-2]&&a[R.length-1]!==c&&a[R.length-1]!==p[R.length-1]&&a[R.length-1]===p[R.length-2];!O&&(A||B)&&V>0&&p.indexOf(_)>-1&&void 0!==f[s]&&(S=!0,_=f[s]);for(var I=h.map(function(e){return M[e]}),F=I.filter(function(e){return e===_}).length,q=R.filter(function(e){return e===_}).length,D=p.substr(0,p.indexOf(c)).split(o).filter(function(e,t){return e===_&&f[t]!==e}).length,L=D+q+F+(S?1:0),W=0,J=0;J<k;J++){var U=M[J];if(w=J+1,U===_&&W++,W>=L)break}}if(O){for(var H=w,Y=w;Y<=g;Y++)if(p[Y]===c&&(H=Y),p[Y]===c||y.indexOf(Y)!==-1||Y===g)return H}else if(S){for(var z=w-1;z>=0;z--)if(l[z]===_||y.indexOf(z)!==-1||0===z)return z}else for(var G=w;G>=0;G--)if(p[G-1]===c||y.indexOf(G)!==-1||0===G)return G}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var n=[],o="";},function(e,t,r){function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t={previousConformedValue:void 0,previousPlaceholder:void 0};return {state:t,update:function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,o=n.inputElement,l=n.mask,c=n.guide,y=n.pipe,b=n.placeholderChar,g=void 0===b?h.placeholderChar:b,k=n.keepCharPositions,C=void 0!==k&&k,O=n.showMask,T=void 0!==O&&O;if("undefined"==typeof r&&(r=o.value),r!==t.previousConformedValue){("undefined"==typeof l?"undefined":s(l))===m&&void 0!==l.pipe&&void 0!==l.mask&&(y=l.pipe,l=l.mask);var P=void 0,x=void 0;if(l instanceof Array&&(P=(0, d.convertMaskToPlaceholder)(l,g)),l!==!1){var w=a(r),S=o.selectionEnd,_=t.previousConformedValue,M=t.previousPlaceholder,j=void 0;if(("undefined"==typeof l?"undefined":s(l))===h.strFunction){if(x=l(w,{currentCaretPosition:S,previousConformedValue:_,placeholderChar:g}),x===!1)return;var E=(0, d.processCaretTraps)(x),R=E.maskWithoutCaretTraps,V=E.indexes;x=R,j=V,P=(0, d.convertMaskToPlaceholder)(x,g);}else x=l;var N={previousConformedValue:_,guide:c,placeholderChar:g,pipe:y,placeholder:P,currentCaretPosition:S,keepCharPositions:C},A=(0, p.default)(w,x,N),B=A.conformedValue,I=("undefined"==typeof y?"undefined":s(y))===h.strFunction,F={};I&&(F=y(B,u({rawValue:w},N)),F===!1?F={value:_,rejected:!0}:(0, d.isString)(F)&&(F={value:F}));var q=I?F.value:B,D=(0, f.default)({previousConformedValue:_,previousPlaceholder:M,conformedValue:q,placeholder:P,rawValue:w,currentCaretPosition:S,placeholderChar:g,indexesOfPipedChars:F.indexesOfPipedChars,caretTrapIndexes:j}),L=q===P&&0===D,W=T?P:v,J=L?W:q;t.previousConformedValue=J,t.previousPlaceholder=P,o.value!==J&&(o.value=J,i(o,D));}}}}}function i(e,t){document.activeElement===e&&(b?g(function(){return e.setSelectionRange(t,t,y)},0):e.setSelectionRange(t,t,y));}function a(e){if((0, d.isString)(e))return e;if((0, d.isNumber)(e))return String(e);if(void 0===e||null===e)return v;throw new Error("The 'value' provided to Text Mask needs to be a string or a number. The value received was:\n\n "+JSON.stringify(e))}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);}return e},s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=o;var l=r(4),f=n(l),c=r(3),p=n(c),d=r(2),h=r(1),v="",y="none",m="object",b="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),g="undefined"!=typeof requestAnimationFrame?requestAnimationFrame:setTimeout;},function(e,t){function r(e){return function(){return e}}var n=function(){};n.thatReturns=r,n.thatReturnsFalse=r(!1),n.thatReturnsTrue=r(!0),n.thatReturnsNull=r(null),n.thatReturnsThis=function(){return this},n.thatReturnsArgument=function(e){return e},e.exports=n;},function(e,t,r){function n(e,t,r,n,i,a,u,s){if(!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else {var f=[r,n,i,a,u,s],c=0;l=new Error(t.replace(/%s/g,function(){return f[c++]})),l.name="Invariant Violation";}throw l.framesToPop=1,l}}e.exports=n;},function(e,t,r){var n=r(6),o=r(7),i=r(10);e.exports=function(){function e(e,t,r,n,a,u){u!==i&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return r.checkPropTypes=n,r.PropTypes=r,r};},function(e,t,r){e.exports=r(8)();},function(e,t){var r="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";e.exports=r;},function(t,r){t.exports=e;}])});
|
|
1423
141
|
});
|
|
1424
142
|
|
|
143
|
+
var MaskedInput = unwrapExports(reactTextMask);
|
|
144
|
+
reactTextMask.reactTextMask;
|
|
145
|
+
|
|
1425
146
|
var DefaultContext = {
|
|
1426
147
|
color: undefined,
|
|
1427
148
|
size: undefined,
|
|
@@ -1429,7 +150,7 @@ var DefaultContext = {
|
|
|
1429
150
|
style: undefined,
|
|
1430
151
|
attr: undefined
|
|
1431
152
|
};
|
|
1432
|
-
var IconContext = React
|
|
153
|
+
var IconContext = React.createContext && /*#__PURE__*/React.createContext(DefaultContext);
|
|
1433
154
|
|
|
1434
155
|
var _excluded = ["attr", "size", "title"];
|
|
1435
156
|
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; }
|
|
@@ -1441,12 +162,12 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
1441
162
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
1442
163
|
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); }
|
|
1443
164
|
function Tree2Element(tree) {
|
|
1444
|
-
return tree && tree.map((node, i) => /*#__PURE__*/React
|
|
165
|
+
return tree && tree.map((node, i) => /*#__PURE__*/React.createElement(node.tag, _objectSpread({
|
|
1445
166
|
key: i
|
|
1446
167
|
}, node.attr), Tree2Element(node.child)));
|
|
1447
168
|
}
|
|
1448
169
|
function GenIcon(data) {
|
|
1449
|
-
return props => /*#__PURE__*/React
|
|
170
|
+
return props => /*#__PURE__*/React.createElement(IconBase, _extends({
|
|
1450
171
|
attr: _objectSpread({}, data.attr)
|
|
1451
172
|
}, props), Tree2Element(data.child));
|
|
1452
173
|
}
|
|
@@ -1462,7 +183,7 @@ function IconBase(props) {
|
|
|
1462
183
|
var className;
|
|
1463
184
|
if (conf.className) className = conf.className;
|
|
1464
185
|
if (props.className) className = (className ? className + " " : "") + props.className;
|
|
1465
|
-
return /*#__PURE__*/React
|
|
186
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
1466
187
|
stroke: "currentColor",
|
|
1467
188
|
fill: "currentColor",
|
|
1468
189
|
strokeWidth: "0"
|
|
@@ -1474,9 +195,9 @@ function IconBase(props) {
|
|
|
1474
195
|
height: computedSize,
|
|
1475
196
|
width: computedSize,
|
|
1476
197
|
xmlns: "http://www.w3.org/2000/svg"
|
|
1477
|
-
}), title && /*#__PURE__*/React
|
|
198
|
+
}), title && /*#__PURE__*/React.createElement("title", null, title), props.children);
|
|
1478
199
|
};
|
|
1479
|
-
return IconContext !== undefined ? /*#__PURE__*/React
|
|
200
|
+
return IconContext !== undefined ? /*#__PURE__*/React.createElement(IconContext.Consumer, null, conf => elem(conf)) : elem(DefaultContext);
|
|
1480
201
|
}
|
|
1481
202
|
|
|
1482
203
|
// THIS FILE IS AUTO GENERATED
|
|
@@ -1493,9 +214,8 @@ function FaDownload (props) {
|
|
|
1493
214
|
}
|
|
1494
215
|
|
|
1495
216
|
var InputField = function (_a) {
|
|
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,
|
|
1497
|
-
|
|
1498
|
-
var _b = React$2.useState(false), isPasswordVisible = _b[0], setIsPasswordVisible = _b[1];
|
|
217
|
+
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, corFundo = _a.corFundo, corLabel = _a.corLabel, borderRadius = _a.borderRadius, colorIcon = _a.colorIcon, border = _a.border;
|
|
218
|
+
var _b = React.useState(false), isPasswordVisible = _b[0], setIsPasswordVisible = _b[1];
|
|
1499
219
|
var togglePasswordVisibility = function () {
|
|
1500
220
|
setIsPasswordVisible(!isPasswordVisible);
|
|
1501
221
|
};
|
|
@@ -1504,31 +224,66 @@ var InputField = function (_a) {
|
|
|
1504
224
|
if (type === 'number' && e.target.value.length > appliedMaxLength) {
|
|
1505
225
|
e.target.value = e.target.value.slice(0, appliedMaxLength);
|
|
1506
226
|
}
|
|
1507
|
-
if (onChange) {
|
|
227
|
+
if (onChange) {
|
|
1508
228
|
onChange(e);
|
|
1509
229
|
}
|
|
1510
230
|
};
|
|
1511
|
-
var mask = maskType === 'cpf'
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
231
|
+
var mask = maskType === 'cpf'
|
|
232
|
+
? [/\d/, /\d/, /\d/, '.', /\d/, /\d/, /\d/, '.', /\d/, /\d/, /\d/, '-', /\d/, /\d/]
|
|
233
|
+
: maskType === 'phone'
|
|
234
|
+
? ['(', /[1-9]/, /\d/, ')', ' ', /\d/, /\d/, /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/]
|
|
235
|
+
: maskType === 'time'
|
|
236
|
+
? [/\d/, /\d/, ':', /\d/, /\d/]
|
|
237
|
+
: maskType === 'date'
|
|
238
|
+
? [/\d/, /\d/, '/', /\d/, /\d/, '/', /\d/, /\d/, /\d/, /\d/]
|
|
239
|
+
: maskType === 'cep'
|
|
240
|
+
? [/\d/, /\d/, /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/]
|
|
241
|
+
: maskType === 'telefone'
|
|
242
|
+
? ['(', /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/]
|
|
243
|
+
: [];
|
|
244
|
+
return (React.createElement(React.Fragment, null,
|
|
245
|
+
label && React.createElement("label", { htmlFor: id, style: { color: corLabel ? corLabel : '' } }, label),
|
|
246
|
+
React.createElement("div", { className: styles$5.inputWrapper },
|
|
247
|
+
maskType ? (React.createElement(MaskedInput, { mask: mask, value: value, onChange: handleChange, disabled: disabled, id: id, name: id, placeholder: placeholder, className: styles$5.inputPadrao, style: {
|
|
1521
248
|
width: largura ? "".concat(largura) : '',
|
|
1522
249
|
backgroundColor: (disabled ? '#e5e5e5' : (corFundo ? corFundo : '')),
|
|
1523
250
|
borderRadius: (borderRadius ? "".concat(borderRadius, "px") : ''),
|
|
1524
251
|
border: (border ? border : '')
|
|
1525
|
-
}, readOnly: readonly, required: required, checked: checked, onKeyPress: onKeyPress
|
|
252
|
+
}, readOnly: readonly, required: required, checked: checked, onKeyPress: onKeyPress })
|
|
253
|
+
// <InputMask
|
|
254
|
+
// mask={mask}
|
|
255
|
+
// value={value}
|
|
256
|
+
// onChange={handleChange}
|
|
257
|
+
// disabled={disabled}
|
|
258
|
+
// >
|
|
259
|
+
// {(inputProps: any) => (
|
|
260
|
+
// <input
|
|
261
|
+
// {...inputProps}
|
|
262
|
+
// type={type === 'password' && isPasswordVisible ? 'text' : type}
|
|
263
|
+
// id={id}
|
|
264
|
+
// name={id}
|
|
265
|
+
// placeholder={placeholder}
|
|
266
|
+
// className={styles.inputPadrao}
|
|
267
|
+
// style={{
|
|
268
|
+
// width: largura ? `${largura}` : '',
|
|
269
|
+
// backgroundColor: (disabled ? '#e5e5e5' : (corFundo ? corFundo : '')),
|
|
270
|
+
// borderRadius: (borderRadius ? `${borderRadius}px` : ''),
|
|
271
|
+
// border: (border ? border : '')
|
|
272
|
+
// }}
|
|
273
|
+
// readOnly={readonly}
|
|
274
|
+
// required={required}
|
|
275
|
+
// checked={checked}
|
|
276
|
+
// onKeyPress={onKeyPress}
|
|
277
|
+
// />
|
|
278
|
+
// )}
|
|
279
|
+
// </InputMask>
|
|
280
|
+
) : (React.createElement("input", { type: type === 'password' && isPasswordVisible ? 'text' : type, id: id, name: id, value: value, placeholder: placeholder, onChange: handleChange, className: styles$5.inputPadrao, style: {
|
|
1526
281
|
width: largura ? "".concat(largura) : '',
|
|
1527
282
|
backgroundColor: (disabled ? '#e5e5e5' : (corFundo ? corFundo : '')),
|
|
1528
283
|
borderRadius: (borderRadius ? "".concat(borderRadius, "px") : ''),
|
|
1529
284
|
border: (border ? border : '')
|
|
1530
285
|
}, readOnly: readonly, disabled: disabled, required: required, checked: checked, maxLength: type === 'text' ? appliedMaxLength : undefined, onKeyPress: onKeyPress, onBlur: onBlur })),
|
|
1531
|
-
type === 'password' && (React
|
|
286
|
+
type === 'password' && (React.createElement("div", { className: styles$5.passwordToggleIcon, onClick: togglePasswordVisibility }, isPasswordVisible ? React.createElement(FaEyeSlash, { style: { color: colorIcon ? colorIcon : '' } }) : React.createElement(FaEye, { style: { color: colorIcon ? colorIcon : '' } }))))));
|
|
1532
287
|
};
|
|
1533
288
|
|
|
1534
289
|
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}";
|
|
@@ -1537,14 +292,14 @@ styleInject(css_248z$4);
|
|
|
1537
292
|
|
|
1538
293
|
var TextPage = function (_a) {
|
|
1539
294
|
var imgLateral = _a.imgLateral, imgCabecalho = _a.imgCabecalho, texto = _a.texto;
|
|
1540
|
-
return (React
|
|
1541
|
-
React
|
|
1542
|
-
imgCabecalho && (React
|
|
1543
|
-
React
|
|
1544
|
-
React
|
|
1545
|
-
imgLateral && (React
|
|
1546
|
-
React
|
|
1547
|
-
React
|
|
295
|
+
return (React.createElement(React.Fragment, null,
|
|
296
|
+
React.createElement("div", { className: styles$4.container },
|
|
297
|
+
imgCabecalho && (React.createElement("div", { className: styles$4.imageCabecalho },
|
|
298
|
+
React.createElement("img", { src: imgCabecalho, alt: imgCabecalho }))),
|
|
299
|
+
React.createElement("div", { className: "".concat(styles$4.content, " ").concat(imgLateral ? styles$4.contentWithLateralImage : '') },
|
|
300
|
+
imgLateral && (React.createElement("div", { className: styles$4.imageLateral },
|
|
301
|
+
React.createElement("img", { src: imgLateral, alt: imgLateral }))),
|
|
302
|
+
React.createElement("div", { className: styles$4.text, dangerouslySetInnerHTML: { __html: texto } })))));
|
|
1548
303
|
};
|
|
1549
304
|
|
|
1550
305
|
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)}";
|
|
@@ -1554,13 +309,13 @@ styleInject(css_248z$3);
|
|
|
1554
309
|
var MenuPage = function (_a) {
|
|
1555
310
|
var menus = _a.menus, contents = _a.contents, empresa = _a.empresa;
|
|
1556
311
|
var empresaClass = styles$3["empresa".concat(empresa)];
|
|
1557
|
-
var _b = React
|
|
1558
|
-
return (React
|
|
1559
|
-
React
|
|
1560
|
-
React
|
|
1561
|
-
React
|
|
1562
|
-
React
|
|
1563
|
-
React
|
|
312
|
+
var _b = React.useState(menus[0].key), selectedSection = _b[0], setSelectedSection = _b[1];
|
|
313
|
+
return (React.createElement("div", { className: "".concat(empresaClass) },
|
|
314
|
+
React.createElement("div", { className: styles$3.container },
|
|
315
|
+
React.createElement("nav", { className: styles$3.sidebar },
|
|
316
|
+
React.createElement("ul", null, menus.map(function (menu) { return (React.createElement("li", { key: menu.key },
|
|
317
|
+
React.createElement("button", { className: selectedSection === menu.key ? styles$3.active : '', onClick: function () { return setSelectedSection(menu.key); } }, menu.label))); }))),
|
|
318
|
+
React.createElement("main", { className: styles$3.content }, contents[selectedSection]))));
|
|
1564
319
|
};
|
|
1565
320
|
|
|
1566
321
|
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)}";
|
|
@@ -1579,7 +334,7 @@ var getArrowColorByEmpresa = function (empresa) {
|
|
|
1579
334
|
}
|
|
1580
335
|
};
|
|
1581
336
|
var SelectField = function (_a) {
|
|
1582
|
-
var id = _a.id, name = _a.name, options = _a.options, value = _a.value, onChange = _a.onChange, label = _a.label, optionDefault = _a.optionDefault, largura = _a.largura, disabled = _a.disabled, multiple = _a.multiple, required = _a.required, corFundo = _a.corFundo, corLabel = _a.corLabel, empresa = _a.empresa, borderRadius = _a.borderRadius, border = _a.border;
|
|
337
|
+
var id = _a.id, name = _a.name, options = _a.options, value = _a.value, onChange = _a.onChange, label = _a.label, optionDefault = _a.optionDefault, largura = _a.largura, disabled = _a.disabled, multiple = _a.multiple, required = _a.required, corFundo = _a.corFundo, corLabel = _a.corLabel, empresa = _a.empresa, borderRadius = _a.borderRadius, border = _a.border, size = _a.size;
|
|
1583
338
|
var handleSelectChange = function (e) {
|
|
1584
339
|
if (multiple) {
|
|
1585
340
|
var selectedOptions = Array.from(e.target.selectedOptions, function (option) { return option.value; });
|
|
@@ -1591,9 +346,9 @@ var SelectField = function (_a) {
|
|
|
1591
346
|
};
|
|
1592
347
|
var arrowColor = getArrowColorByEmpresa(empresa);
|
|
1593
348
|
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 "));
|
|
1594
|
-
return (React
|
|
1595
|
-
label && React
|
|
1596
|
-
React
|
|
349
|
+
return (React.createElement("div", { className: styles$2["empresa".concat(empresa)] },
|
|
350
|
+
label && React.createElement("label", { htmlFor: id, style: { color: corLabel ? corLabel : '' } }, label),
|
|
351
|
+
React.createElement("select", { id: id, name: name, className: styles$2.selectPadrao, value: value, size: size, onChange: handleSelectChange, style: {
|
|
1597
352
|
width: largura ? "".concat(largura) : '',
|
|
1598
353
|
backgroundColor: corFundo ? corFundo : '',
|
|
1599
354
|
backgroundImage: "url(\"data:image/svg+xml,".concat(arrowSvg, "\")"),
|
|
@@ -1603,16 +358,16 @@ var SelectField = function (_a) {
|
|
|
1603
358
|
borderRadius: (borderRadius ? "".concat(borderRadius, "px") : ''),
|
|
1604
359
|
border: (border ? border : '')
|
|
1605
360
|
}, disabled: disabled, multiple: multiple, required: required },
|
|
1606
|
-
optionDefault && !multiple && (React
|
|
1607
|
-
options.map(function (option) { return (React
|
|
361
|
+
optionDefault && !multiple && (React.createElement("option", { value: "" }, "Selecione...")),
|
|
362
|
+
options.map(function (option) { return (React.createElement("option", { key: option.value, value: option.value }, option.description)); }))));
|
|
1608
363
|
};
|
|
1609
364
|
|
|
1610
365
|
var Busca = function (_a) {
|
|
1611
366
|
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;
|
|
1612
|
-
var _c = React
|
|
1613
|
-
var _d = React
|
|
1614
|
-
var _e = React
|
|
1615
|
-
var inputRef = React
|
|
367
|
+
var _c = React.useState(options), filteredOptions = _c[0], setFilteredOptions = _c[1];
|
|
368
|
+
var _d = React.useState(false), showOptions = _d[0], setShowOptions = _d[1];
|
|
369
|
+
var _e = React.useState(''), inputValue = _e[0], setInputValue = _e[1];
|
|
370
|
+
var inputRef = React.useRef(null);
|
|
1616
371
|
var handleInputChange = function (e) {
|
|
1617
372
|
var inputValue = e.target.value;
|
|
1618
373
|
setInputValue(inputValue);
|
|
@@ -1642,24 +397,24 @@ var Busca = function (_a) {
|
|
|
1642
397
|
setShowOptions(false);
|
|
1643
398
|
}
|
|
1644
399
|
};
|
|
1645
|
-
React
|
|
400
|
+
React.useEffect(function () {
|
|
1646
401
|
document.addEventListener('mousedown', handleClickOutside);
|
|
1647
402
|
return function () {
|
|
1648
403
|
document.removeEventListener('mousedown', handleClickOutside);
|
|
1649
404
|
};
|
|
1650
405
|
}, []);
|
|
1651
|
-
return (React
|
|
1652
|
-
label && React
|
|
1653
|
-
React
|
|
1654
|
-
showIcon && React
|
|
1655
|
-
React
|
|
406
|
+
return (React.createElement("div", { style: { position: 'relative', width: '100%' }, ref: inputRef },
|
|
407
|
+
label && React.createElement("label", { htmlFor: "busca", style: { color: corLabel ? corLabel : '' } }, label),
|
|
408
|
+
React.createElement("div", { style: { position: 'relative', display: 'flex', alignItems: 'center', gap: '10px', width: '100%' } },
|
|
409
|
+
showIcon && React.createElement(FaSearch, { className: styles$5.searchIcon }),
|
|
410
|
+
React.createElement("input", { type: "text", id: "busca", value: inputValue, onChange: handleInputChange, onFocus: handleFocus, placeholder: "Digite para buscar...", autoComplete: "off", className: styles$5.inputPadrao, style: {
|
|
1656
411
|
width: '100%',
|
|
1657
412
|
paddingLeft: showIcon ? '30px' : '0',
|
|
1658
413
|
backgroundColor: (corFundo ? corFundo : ''),
|
|
1659
414
|
borderRadius: (borderRadius ? "".concat(borderRadius, "px") : ''),
|
|
1660
415
|
border: (border ? border : '')
|
|
1661
416
|
} })),
|
|
1662
|
-
showOptions && filteredOptions.length > 0 && (React
|
|
417
|
+
showOptions && filteredOptions.length > 0 && (React.createElement("ul", { style: {
|
|
1663
418
|
position: 'absolute',
|
|
1664
419
|
width: '100%',
|
|
1665
420
|
maxHeight: '150px',
|
|
@@ -1670,7 +425,39 @@ var Busca = function (_a) {
|
|
|
1670
425
|
margin: 0,
|
|
1671
426
|
padding: '5px',
|
|
1672
427
|
listStyle: 'none'
|
|
1673
|
-
} }, filteredOptions.map(function (option, index) { return (React
|
|
428
|
+
} }, filteredOptions.map(function (option, index) { return (React.createElement("li", { key: index, onClick: function () { return handleOptionClick(option); }, style: { padding: '5px', cursor: 'pointer' } }, option.description)); })))));
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
/******************************************************************************
|
|
432
|
+
Copyright (c) Microsoft Corporation.
|
|
433
|
+
|
|
434
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
435
|
+
purpose with or without fee is hereby granted.
|
|
436
|
+
|
|
437
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
438
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
439
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
440
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
441
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
442
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
443
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
444
|
+
***************************************************************************** */
|
|
445
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
function __spreadArray(to, from, pack) {
|
|
449
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
450
|
+
if (ar || !(i in from)) {
|
|
451
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
452
|
+
ar[i] = from[i];
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
459
|
+
var e = new Error(message);
|
|
460
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
1674
461
|
};
|
|
1675
462
|
|
|
1676
463
|
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}";
|
|
@@ -1689,10 +476,10 @@ var CheckboxGroup = function (_a) {
|
|
|
1689
476
|
}
|
|
1690
477
|
onChange(updatedValues);
|
|
1691
478
|
};
|
|
1692
|
-
return (React
|
|
1693
|
-
label && React
|
|
1694
|
-
options.map(function (option) { return (React
|
|
1695
|
-
React
|
|
479
|
+
return (React.createElement("div", { className: styles$1.checkboxGroup },
|
|
480
|
+
label && React.createElement("label", { className: styles$1.title }, label),
|
|
481
|
+
options.map(function (option) { return (React.createElement("label", { key: option.value, className: styles$1.checkboxLabel },
|
|
482
|
+
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 }),
|
|
1696
483
|
option.description)); })));
|
|
1697
484
|
};
|
|
1698
485
|
|
|
@@ -17577,8 +16364,8 @@ styleInject(css_248z);
|
|
|
17577
16364
|
|
|
17578
16365
|
var TableStandard = function (_a) {
|
|
17579
16366
|
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;
|
|
17580
|
-
var _j = React
|
|
17581
|
-
var _k = React
|
|
16367
|
+
var _j = React.useState(null), selectedRow = _j[0], setSelectedRow = _j[1];
|
|
16368
|
+
var _k = React.useState(1), currentPage = _k[0], setCurrentPage = _k[1];
|
|
17582
16369
|
var ultimoItem = currentPage * numeroPaginas;
|
|
17583
16370
|
var primeiroItem = ultimoItem - numeroPaginas;
|
|
17584
16371
|
var currentItems = dados.slice(primeiroItem, ultimoItem);
|
|
@@ -17606,48 +16393,48 @@ var TableStandard = function (_a) {
|
|
|
17606
16393
|
for (var i = 1; i <= Math.ceil(dados.length / numeroPaginas); i++) {
|
|
17607
16394
|
pageNumbers.push(i);
|
|
17608
16395
|
}
|
|
17609
|
-
return (React
|
|
17610
|
-
showExcelDownloadButton && (React
|
|
17611
|
-
React
|
|
17612
|
-
React
|
|
16396
|
+
return (React.createElement("div", { className: styles.tableResponsive },
|
|
16397
|
+
showExcelDownloadButton && (React.createElement("div", { className: styles.excelWrapper },
|
|
16398
|
+
React.createElement("button", { onClick: handleDownloadClick, className: styles.downloadButton },
|
|
16399
|
+
React.createElement(FaDownload, null),
|
|
17613
16400
|
" Excel"))),
|
|
17614
|
-
React
|
|
17615
|
-
React
|
|
17616
|
-
React
|
|
17617
|
-
Object.keys(dados[0] || {}).map(function (key) { return (React
|
|
17618
|
-
(showActionColumn || showDownloadButton || showViewButton) && React
|
|
17619
|
-
React
|
|
17620
|
-
Object.keys(row).map(function (key, i) { return (React
|
|
17621
|
-
(showActionColumn || showDownloadButton || showViewButton) && (React
|
|
17622
|
-
React
|
|
17623
|
-
showActionColumn && (React
|
|
16401
|
+
React.createElement("table", { className: styles.tableContainer },
|
|
16402
|
+
React.createElement("thead", null,
|
|
16403
|
+
React.createElement("tr", { className: "".concat(empresaClass, " ").concat(styles.row) },
|
|
16404
|
+
Object.keys(dados[0] || {}).map(function (key) { return (React.createElement("th", { key: key, className: styles.header }, key.charAt(0).toUpperCase() + key.slice(1))); }),
|
|
16405
|
+
(showActionColumn || showDownloadButton || showViewButton) && React.createElement("th", { className: styles.header }, "A\u00E7\u00F5es"))),
|
|
16406
|
+
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' : '' } },
|
|
16407
|
+
Object.keys(row).map(function (key, i) { return (React.createElement("td", { key: i, className: styles.cell }, row[key])); }),
|
|
16408
|
+
(showActionColumn || showDownloadButton || showViewButton) && (React.createElement("td", { className: styles.cell },
|
|
16409
|
+
React.createElement("div", { style: { display: 'flex', gap: '0.5rem', justifyContent: 'center' }, className: "".concat(empresaClass) },
|
|
16410
|
+
showActionColumn && (React.createElement("button", { onClick: function (e) {
|
|
17624
16411
|
e.stopPropagation();
|
|
17625
16412
|
if (onActionClick)
|
|
17626
16413
|
onActionClick(row[idColumn]);
|
|
17627
16414
|
}, className: styles.actionButton, title: 'Editar' },
|
|
17628
|
-
React
|
|
17629
|
-
showDownloadButton && shouldShowDownloadButton(row[idColumn]) && (React
|
|
16415
|
+
React.createElement(FaPen, null))),
|
|
16416
|
+
showDownloadButton && shouldShowDownloadButton(row[idColumn]) && (React.createElement("button", { onClick: function (e) {
|
|
17630
16417
|
e.stopPropagation();
|
|
17631
16418
|
if (onDownloadClick)
|
|
17632
16419
|
onDownloadClick(row[idColumn]);
|
|
17633
16420
|
}, className: styles.downloadButton, title: 'Download do Arquivo' },
|
|
17634
|
-
React
|
|
17635
|
-
showViewButton && (React
|
|
16421
|
+
React.createElement(FaDownload, null))),
|
|
16422
|
+
showViewButton && (React.createElement("button", { onClick: function (e) {
|
|
17636
16423
|
e.stopPropagation();
|
|
17637
16424
|
if (onViewClick)
|
|
17638
16425
|
onViewClick(row[idColumn]);
|
|
17639
16426
|
}, className: styles.actionButton, title: 'Visualizar' },
|
|
17640
|
-
React
|
|
17641
|
-
React
|
|
16427
|
+
React.createElement(FaEye, null)))))))); }))),
|
|
16428
|
+
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)); }))));
|
|
17642
16429
|
};
|
|
17643
16430
|
|
|
17644
16431
|
var TextAreaField = function (_a) {
|
|
17645
16432
|
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;
|
|
17646
16433
|
var appliedMaxLength = maxLength !== undefined ? maxLength : 524288;
|
|
17647
|
-
return (React
|
|
17648
|
-
label && React
|
|
17649
|
-
React
|
|
17650
|
-
React
|
|
16434
|
+
return (React.createElement(React.Fragment, null,
|
|
16435
|
+
label && React.createElement("label", { htmlFor: id, style: { color: corLabel ? corLabel : '' } }, label),
|
|
16436
|
+
React.createElement("div", { className: styles$5.inputWrapper },
|
|
16437
|
+
React.createElement("textarea", { id: id, name: id, value: value, placeholder: placeholder, onChange: onChange, className: styles$5.inputPadrao, style: {
|
|
17651
16438
|
width: largura ? "".concat(largura) : '',
|
|
17652
16439
|
backgroundColor: disabled ? '#e5e5e5' : (corFundo ? corFundo : ''),
|
|
17653
16440
|
resize: 'none',
|