argous 1.2.200 → 1.2.202

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.
@@ -120,16 +120,11 @@ var DropArea = function (_a, ref) {
120
120
  });
121
121
  }); };
122
122
  return (react_1.default.createElement("div", __assign({ onDragEnter: function () { return setAbrir(true); }, style: __assign({ position: 'relative' }, style) }, props),
123
- abrir && (!(ref === null || ref === void 0 ? void 0 : ref.current) || (ref.current && !ref.current.loading)) && (react_1.default.createElement("div", { onDragLeave: function () { return setAbrir(false); }, onDrop: dropArquivo, onDragOver: function (e) { return e.preventDefault(); }, style: {
124
- position: 'absolute',
125
- border: '1px dashed',
126
- background: 'rgba(0,0,0,0.5)',
127
- zIndex: 5, width: '100%', height: '100%'
128
- } }, loading ?
123
+ abrir && (!(ref === null || ref === void 0 ? void 0 : ref.current) || (ref.current && !ref.current.loading)) && (react_1.default.createElement("div", { onDrop: dropArquivo, onDragOver: function (e) { return e.preventDefault(); }, onDragLeave: function () { return setAbrir(false); }, style: { position: 'absolute', border: '2px dashed', background: 'rgba(0, 0, 0, 0.5)', zIndex: 5, width: '100%', height: '100%', display: 'grid', placeItems: 'center' } }, (loading) ?
129
124
  react_1.default.createElement(core_1.Box, { display: 'flex', justifyContent: 'center', alignItems: 'center', height: '100%' },
130
125
  react_1.default.createElement(core_1.CircularProgress, { disableShrink: true }))
131
126
  :
132
- react_1.default.createElement(md_1.MdFileUpload, { style: { width: '100%', height: '100%' } }))),
127
+ react_1.default.createElement(md_1.MdFileUpload, { style: { width: '100%', height: '99%' } }))),
133
128
  deepMap(children, function (filho) { return filho.type === __1.FilePreparer ? react_1.cloneElement(filho, __assign(__assign({}, filho.props), { ref: ref })) : filho; })));
134
129
  };
135
130
  exports.default = react_1.forwardRef(DropArea);
@@ -72,5 +72,6 @@ export declare const storageMeasures: {
72
72
  exabyte: string;
73
73
  };
74
74
  export declare const bytesTranslator: (bytes?: number, decimals?: number, binary?: boolean) => object;
75
- export declare const formatCpfCnpj: (value: string | number) => string;
75
+ export declare const formatCpfCnpj: (value: (string | number)) => string;
76
76
  export declare function dataUrlToBlob(dataUrl: string): Blob | undefined;
77
+ export declare function cpfTest(cpf: (string | number)): boolean;
@@ -82,7 +82,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
82
82
  return to;
83
83
  };
84
84
  Object.defineProperty(exports, "__esModule", { value: true });
85
- exports.dataUrlToBlob = exports.formatCpfCnpj = exports.bytesTranslator = exports.storageMeasures = exports.confirm = exports.copyToClipboard = exports.toFloat = exports.currencyMask = exports.numbersOnly = exports.formataCpf = exports.useWebSocket = exports.formataTelefone = exports.reduxDispatch = exports.useStore = exports.useModal = exports.useGraph = exports.randomColor = exports.humanFileSize = exports.sanitizaHTML = exports.formataDinheiro = exports.useUpdateEffect = exports.usePrevious = exports.getNumeroFromInitials = exports.getInitials = exports.getRandomColor = exports.printPdf = exports.downloadFromUrl = exports.downloadBase64 = exports.formataNome = exports.addExtraZero = exports.getCookie = exports.widthToCenterVertically = void 0;
85
+ exports.cpfTest = exports.dataUrlToBlob = exports.formatCpfCnpj = exports.bytesTranslator = exports.storageMeasures = exports.confirm = exports.copyToClipboard = exports.toFloat = exports.currencyMask = exports.numbersOnly = exports.formataCpf = exports.useWebSocket = exports.formataTelefone = exports.reduxDispatch = exports.useStore = exports.useModal = exports.useGraph = exports.randomColor = exports.humanFileSize = exports.sanitizaHTML = exports.formataDinheiro = exports.useUpdateEffect = exports.usePrevious = exports.getNumeroFromInitials = exports.getInitials = exports.getRandomColor = exports.printPdf = exports.downloadFromUrl = exports.downloadBase64 = exports.formataNome = exports.addExtraZero = exports.getCookie = exports.widthToCenterVertically = void 0;
86
86
  var store_1 = require("./store");
87
87
  var api_1 = require("../api");
88
88
  var ModalProvider_1 = require("../components/ConfirmModal/ModalProvider");
@@ -451,3 +451,28 @@ function dataUrlToBlob(dataUrl) {
451
451
  return blob;
452
452
  }
453
453
  exports.dataUrlToBlob = dataUrlToBlob;
454
+ function cpfTest(cpf) {
455
+ if (cpf === '00000000000' || !cpf)
456
+ return false;
457
+ if (typeof cpf === 'number')
458
+ cpf = cpf.toString();
459
+ var sum = 0;
460
+ var rest;
461
+ for (var index = 1; index <= 9; index++)
462
+ sum += (parseInt(cpf.substring(index - 1, index)) * (11 - index));
463
+ rest = ((sum * 10) % 11);
464
+ if ((rest === 10) || (rest === 11))
465
+ rest = 0;
466
+ if (rest !== parseInt(cpf.substring(9, 10)))
467
+ return false;
468
+ sum = 0;
469
+ for (var index = 1; index <= 10; index++)
470
+ sum += (parseInt(cpf.substring(index - 1, index)) * (12 - index));
471
+ rest = ((sum * 10) % 11);
472
+ if ((rest === 10) || (rest === 11))
473
+ rest = 0;
474
+ if (rest !== parseInt(cpf.substring(10, 11)))
475
+ return false;
476
+ return true;
477
+ }
478
+ exports.cpfTest = cpfTest;
@@ -43,19 +43,18 @@ const DropArea = ({ children, onChange, style, ...props }, ref) => {
43
43
  return (
44
44
  <div onDragEnter={() => setAbrir(true)} style={{ position: 'relative', ...style }} {...props}>
45
45
  {abrir && (!ref?.current || (ref.current && !ref.current.loading)) && (
46
- <div onDragLeave={() => setAbrir(false)} onDrop={dropArquivo} onDragOver={e => e.preventDefault() }
47
- style={{
48
- position: 'absolute',
49
- border: '1px dashed',
50
- background: 'rgba(0,0,0,0.5)',
51
- zIndex: 5, width: '100%', height: '100%'
52
- }}>
53
- {loading ?
46
+ <div
47
+ onDrop={dropArquivo}
48
+ onDragOver={e => e.preventDefault()}
49
+ onDragLeave={() => setAbrir(false)}
50
+ style={{ position: 'absolute', border: '2px dashed', background: 'rgba(0, 0, 0, 0.5)', zIndex: 5, width: '100%', height: '100%', display: 'grid', placeItems: 'center' }}
51
+ >
52
+ {(loading) ?
54
53
  <Box display='flex' justifyContent='center' alignItems='center' height='100%'>
55
- <CircularProgress disableShrink/>
54
+ <CircularProgress disableShrink />
56
55
  </Box>
57
56
  :
58
- <MdFileUpload style={{ width: '100%', height: '100%' }}/>
57
+ <MdFileUpload style={{ width: '100%', height: '99%' }} />
59
58
  }
60
59
  </div>
61
60
  )}
@@ -338,7 +338,7 @@ export const bytesTranslator = (bytes: number = 0, decimals: number = 2, binary:
338
338
  return { type, size };
339
339
  };
340
340
 
341
- export const formatCpfCnpj = (value: string | number) => {
341
+ export const formatCpfCnpj = (value: (string|number)) => {
342
342
  if (!value) return '';
343
343
  if (isNumber(value)) value = value.toString();
344
344
  value = value.replace(/[^\d]/g, '');
@@ -362,4 +362,28 @@ export function dataUrlToBlob(dataUrl: string) {
362
362
  }
363
363
  let blob = new Blob([arrayBuffer], { type: mimeString });
364
364
  return blob;
365
+ }
366
+
367
+ export function cpfTest(cpf: (string|number)) {
368
+
369
+ if (cpf === '00000000000' || !cpf) return false;
370
+ if (typeof cpf === 'number') cpf = cpf.toString();
371
+
372
+ let sum = 0;
373
+ let rest: number;
374
+
375
+ for (let index = 1; index <= 9; index++) sum += (parseInt(cpf.substring(index - 1, index)) * (11 - index));
376
+ rest = ((sum * 10) % 11);
377
+
378
+ if ((rest === 10) || (rest === 11)) rest = 0;
379
+ if (rest !== parseInt(cpf.substring(9, 10))) return false;
380
+
381
+ sum = 0;
382
+ for (let index = 1; index <= 10; index++) sum += (parseInt(cpf.substring(index - 1, index)) * (12 - index));
383
+ rest = ((sum * 10) % 11);
384
+
385
+ if ((rest === 10) || (rest === 11)) rest = 0;
386
+ if (rest !== parseInt(cpf.substring(10, 11))) return false;
387
+
388
+ return true;
365
389
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "argous",
3
- "version": "1.2.200",
3
+ "version": "1.2.202",
4
4
  "description": "Argous.",
5
5
  "main": "lib/index.js",
6
6
  "author": "Carlos Schneider",