@kne/react-pdf-sign 1.1.5 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/img~cOOFcooA.png +0 -0
- package/dist/index.js +123 -52
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +123 -53
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -13,6 +13,7 @@ var useControlValue = require('@kne/use-control-value');
|
|
|
13
13
|
var useRefCallback = require('@kne/use-ref-callback');
|
|
14
14
|
var useImage = require('use-image');
|
|
15
15
|
var reactIntl = require('@kne/react-intl');
|
|
16
|
+
var img = require('./img~cOOFcooA.png');
|
|
16
17
|
var pdfLib = require('pdf-lib');
|
|
17
18
|
var SignatureCanvas = require('react-signature-canvas');
|
|
18
19
|
var snapdom = require('@zumer/snapdom');
|
|
@@ -24,6 +25,7 @@ var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
|
24
25
|
var useControlValue__default = /*#__PURE__*/_interopDefaultLegacy(useControlValue);
|
|
25
26
|
var useRefCallback__default = /*#__PURE__*/_interopDefaultLegacy(useRefCallback);
|
|
26
27
|
var useImage__default = /*#__PURE__*/_interopDefaultLegacy(useImage);
|
|
28
|
+
var img__default = /*#__PURE__*/_interopDefaultLegacy(img);
|
|
27
29
|
var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
|
|
28
30
|
|
|
29
31
|
function _extends() {
|
|
@@ -247,12 +249,15 @@ const LocationLayerInner = withLocale(p => {
|
|
|
247
249
|
onClick
|
|
248
250
|
} = p,
|
|
249
251
|
props = _objectWithoutPropertiesLoose(p, _excluded$3);
|
|
252
|
+
const [textWidth, setTextWidth] = react.useState(0);
|
|
250
253
|
const [value, setValue] = useControlValue__default["default"](props);
|
|
251
254
|
const [isInit, setIsInit] = react.useState(false);
|
|
252
255
|
const [signatureImage] = useImage__default["default"](signature);
|
|
256
|
+
const [iconImage] = useImage__default["default"](img__default["default"]);
|
|
253
257
|
const groupRef = react.useRef();
|
|
254
258
|
const signRef = react.useRef();
|
|
255
259
|
const transformerRef = react.useRef();
|
|
260
|
+
const textRef = react.useRef();
|
|
256
261
|
const computedSignLocation = () => {
|
|
257
262
|
const absolutePosition = signRef.current.absolutePosition();
|
|
258
263
|
const size = signRef.current.getClientRect();
|
|
@@ -296,11 +301,29 @@ const LocationLayerInner = withLocale(p => {
|
|
|
296
301
|
transformerRef.current.nodes([groupRef.current]);
|
|
297
302
|
}
|
|
298
303
|
}, [isInit]);
|
|
304
|
+
react.useEffect(() => {
|
|
305
|
+
if (isInit && textRef.current) {
|
|
306
|
+
setTextWidth(textRef.current.width());
|
|
307
|
+
}
|
|
308
|
+
}, [isInit, placeholder]);
|
|
299
309
|
if (!(isInit && value)) {
|
|
300
310
|
return null;
|
|
301
311
|
}
|
|
312
|
+
const textX = value.x + width * value.scaleX / 2 - textWidth / 2;
|
|
313
|
+
const textY = value.y + height * value.scaleY / 2 - 8;
|
|
302
314
|
return /*#__PURE__*/jsxRuntime.jsxs(reactKonva.Layer, {
|
|
303
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(reactKonva.
|
|
315
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(reactKonva.Rect, {
|
|
316
|
+
x: value.x,
|
|
317
|
+
y: value.y,
|
|
318
|
+
width: width * value.scaleX,
|
|
319
|
+
height: height * value.scaleY,
|
|
320
|
+
stroke: themeColor,
|
|
321
|
+
strokeWidth: 1,
|
|
322
|
+
dashEnabled: true,
|
|
323
|
+
cornerRadius: 8,
|
|
324
|
+
ref: signRef,
|
|
325
|
+
dash: [5, 5]
|
|
326
|
+
}), /*#__PURE__*/jsxRuntime.jsx(reactKonva.Group, {
|
|
304
327
|
x: value.x,
|
|
305
328
|
y: value.y,
|
|
306
329
|
draggable: active !== false,
|
|
@@ -322,22 +345,25 @@ const LocationLayerInner = withLocale(p => {
|
|
|
322
345
|
}) : /*#__PURE__*/jsxRuntime.jsx(reactKonva.Rect, {
|
|
323
346
|
width: width,
|
|
324
347
|
height: height,
|
|
325
|
-
fill: "#f0f0f0",
|
|
326
|
-
cornerRadius: 8,
|
|
327
348
|
ref: signRef
|
|
328
349
|
})
|
|
329
|
-
}), /*#__PURE__*/jsxRuntime.jsx(reactKonva.
|
|
350
|
+
}), !signatureImage ? /*#__PURE__*/jsxRuntime.jsx(reactKonva.Image, {
|
|
351
|
+
x: textX - 24,
|
|
352
|
+
y: textY,
|
|
353
|
+
width: 16,
|
|
354
|
+
height: 16,
|
|
355
|
+
image: iconImage
|
|
356
|
+
}) : null, /*#__PURE__*/jsxRuntime.jsx(reactKonva.Text, {
|
|
357
|
+
ref: textRef,
|
|
330
358
|
listening: false,
|
|
331
|
-
x:
|
|
332
|
-
y:
|
|
359
|
+
x: textX,
|
|
360
|
+
y: textY,
|
|
333
361
|
text: signatureImage ? '' : placeholder,
|
|
334
362
|
fontSize: 16,
|
|
335
|
-
fill:
|
|
363
|
+
fill: themeColor,
|
|
336
364
|
fontFamily: "Arial",
|
|
337
365
|
align: "center",
|
|
338
|
-
verticalAlign: "middle"
|
|
339
|
-
width: width * value.scaleX,
|
|
340
|
-
height: height * value.scaleY
|
|
366
|
+
verticalAlign: "middle"
|
|
341
367
|
}), /*#__PURE__*/jsxRuntime.jsx(reactKonva.Transformer, {
|
|
342
368
|
ref: transformerRef,
|
|
343
369
|
visible: active !== false,
|
|
@@ -1122,17 +1148,17 @@ var Symbol$1 = _root.Symbol;
|
|
|
1122
1148
|
var _Symbol = Symbol$1;
|
|
1123
1149
|
|
|
1124
1150
|
/** Used for built-in method references. */
|
|
1125
|
-
var objectProto$
|
|
1151
|
+
var objectProto$e = Object.prototype;
|
|
1126
1152
|
|
|
1127
1153
|
/** Used to check objects for own properties. */
|
|
1128
|
-
var hasOwnProperty$
|
|
1154
|
+
var hasOwnProperty$b = objectProto$e.hasOwnProperty;
|
|
1129
1155
|
|
|
1130
1156
|
/**
|
|
1131
1157
|
* Used to resolve the
|
|
1132
1158
|
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
1133
1159
|
* of values.
|
|
1134
1160
|
*/
|
|
1135
|
-
var nativeObjectToString$1 = objectProto$
|
|
1161
|
+
var nativeObjectToString$1 = objectProto$e.toString;
|
|
1136
1162
|
|
|
1137
1163
|
/** Built-in value references. */
|
|
1138
1164
|
var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
|
|
@@ -1145,7 +1171,7 @@ var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
|
|
|
1145
1171
|
* @returns {string} Returns the raw `toStringTag`.
|
|
1146
1172
|
*/
|
|
1147
1173
|
function getRawTag(value) {
|
|
1148
|
-
var isOwn = hasOwnProperty$
|
|
1174
|
+
var isOwn = hasOwnProperty$b.call(value, symToStringTag$1),
|
|
1149
1175
|
tag = value[symToStringTag$1];
|
|
1150
1176
|
|
|
1151
1177
|
try {
|
|
@@ -1167,14 +1193,14 @@ function getRawTag(value) {
|
|
|
1167
1193
|
var _getRawTag = getRawTag;
|
|
1168
1194
|
|
|
1169
1195
|
/** Used for built-in method references. */
|
|
1170
|
-
var objectProto$
|
|
1196
|
+
var objectProto$d = Object.prototype;
|
|
1171
1197
|
|
|
1172
1198
|
/**
|
|
1173
1199
|
* Used to resolve the
|
|
1174
1200
|
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
1175
1201
|
* of values.
|
|
1176
1202
|
*/
|
|
1177
|
-
var nativeObjectToString = objectProto$
|
|
1203
|
+
var nativeObjectToString = objectProto$d.toString;
|
|
1178
1204
|
|
|
1179
1205
|
/**
|
|
1180
1206
|
* Converts `value` to a string using `Object.prototype.toString`.
|
|
@@ -1343,17 +1369,17 @@ var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
|
1343
1369
|
|
|
1344
1370
|
/** Used for built-in method references. */
|
|
1345
1371
|
var funcProto$1 = Function.prototype,
|
|
1346
|
-
objectProto$
|
|
1372
|
+
objectProto$c = Object.prototype;
|
|
1347
1373
|
|
|
1348
1374
|
/** Used to resolve the decompiled source of functions. */
|
|
1349
1375
|
var funcToString$1 = funcProto$1.toString;
|
|
1350
1376
|
|
|
1351
1377
|
/** Used to check objects for own properties. */
|
|
1352
|
-
var hasOwnProperty$
|
|
1378
|
+
var hasOwnProperty$a = objectProto$c.hasOwnProperty;
|
|
1353
1379
|
|
|
1354
1380
|
/** Used to detect if a method is native. */
|
|
1355
1381
|
var reIsNative = RegExp('^' +
|
|
1356
|
-
funcToString$1.call(hasOwnProperty$
|
|
1382
|
+
funcToString$1.call(hasOwnProperty$a).replace(reRegExpChar, '\\$&')
|
|
1357
1383
|
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
|
1358
1384
|
);
|
|
1359
1385
|
|
|
@@ -1450,10 +1476,10 @@ var _hashDelete = hashDelete;
|
|
|
1450
1476
|
var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
|
|
1451
1477
|
|
|
1452
1478
|
/** Used for built-in method references. */
|
|
1453
|
-
var objectProto$
|
|
1479
|
+
var objectProto$b = Object.prototype;
|
|
1454
1480
|
|
|
1455
1481
|
/** Used to check objects for own properties. */
|
|
1456
|
-
var hasOwnProperty$
|
|
1482
|
+
var hasOwnProperty$9 = objectProto$b.hasOwnProperty;
|
|
1457
1483
|
|
|
1458
1484
|
/**
|
|
1459
1485
|
* Gets the hash value for `key`.
|
|
@@ -1470,16 +1496,16 @@ function hashGet(key) {
|
|
|
1470
1496
|
var result = data[key];
|
|
1471
1497
|
return result === HASH_UNDEFINED$1 ? undefined : result;
|
|
1472
1498
|
}
|
|
1473
|
-
return hasOwnProperty$
|
|
1499
|
+
return hasOwnProperty$9.call(data, key) ? data[key] : undefined;
|
|
1474
1500
|
}
|
|
1475
1501
|
|
|
1476
1502
|
var _hashGet = hashGet;
|
|
1477
1503
|
|
|
1478
1504
|
/** Used for built-in method references. */
|
|
1479
|
-
var objectProto$
|
|
1505
|
+
var objectProto$a = Object.prototype;
|
|
1480
1506
|
|
|
1481
1507
|
/** Used to check objects for own properties. */
|
|
1482
|
-
var hasOwnProperty$
|
|
1508
|
+
var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
|
|
1483
1509
|
|
|
1484
1510
|
/**
|
|
1485
1511
|
* Checks if a hash value for `key` exists.
|
|
@@ -1492,7 +1518,7 @@ var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
|
|
|
1492
1518
|
*/
|
|
1493
1519
|
function hashHas(key) {
|
|
1494
1520
|
var data = this.__data__;
|
|
1495
|
-
return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$
|
|
1521
|
+
return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$8.call(data, key);
|
|
1496
1522
|
}
|
|
1497
1523
|
|
|
1498
1524
|
var _hashHas = hashHas;
|
|
@@ -1802,10 +1828,10 @@ function baseAssignValue(object, key, value) {
|
|
|
1802
1828
|
var _baseAssignValue = baseAssignValue;
|
|
1803
1829
|
|
|
1804
1830
|
/** Used for built-in method references. */
|
|
1805
|
-
var objectProto$
|
|
1831
|
+
var objectProto$9 = Object.prototype;
|
|
1806
1832
|
|
|
1807
1833
|
/** Used to check objects for own properties. */
|
|
1808
|
-
var hasOwnProperty$
|
|
1834
|
+
var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
|
|
1809
1835
|
|
|
1810
1836
|
/**
|
|
1811
1837
|
* Assigns `value` to `key` of `object` if the existing value is not equivalent
|
|
@@ -1819,7 +1845,7 @@ var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
|
|
|
1819
1845
|
*/
|
|
1820
1846
|
function assignValue(object, key, value) {
|
|
1821
1847
|
var objValue = object[key];
|
|
1822
|
-
if (!(hasOwnProperty$
|
|
1848
|
+
if (!(hasOwnProperty$7.call(object, key) && eq_1(objValue, value)) ||
|
|
1823
1849
|
(value === undefined && !(key in object))) {
|
|
1824
1850
|
_baseAssignValue(object, key, value);
|
|
1825
1851
|
}
|
|
@@ -1933,13 +1959,13 @@ function baseIsArguments(value) {
|
|
|
1933
1959
|
var _baseIsArguments = baseIsArguments;
|
|
1934
1960
|
|
|
1935
1961
|
/** Used for built-in method references. */
|
|
1936
|
-
var objectProto$
|
|
1962
|
+
var objectProto$8 = Object.prototype;
|
|
1937
1963
|
|
|
1938
1964
|
/** Used to check objects for own properties. */
|
|
1939
|
-
var hasOwnProperty$
|
|
1965
|
+
var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
|
|
1940
1966
|
|
|
1941
1967
|
/** Built-in value references. */
|
|
1942
|
-
var propertyIsEnumerable$1 = objectProto$
|
|
1968
|
+
var propertyIsEnumerable$1 = objectProto$8.propertyIsEnumerable;
|
|
1943
1969
|
|
|
1944
1970
|
/**
|
|
1945
1971
|
* Checks if `value` is likely an `arguments` object.
|
|
@@ -1960,7 +1986,7 @@ var propertyIsEnumerable$1 = objectProto$7.propertyIsEnumerable;
|
|
|
1960
1986
|
* // => false
|
|
1961
1987
|
*/
|
|
1962
1988
|
var isArguments = _baseIsArguments(function() { return arguments; }()) ? _baseIsArguments : function(value) {
|
|
1963
|
-
return isObjectLike_1(value) && hasOwnProperty$
|
|
1989
|
+
return isObjectLike_1(value) && hasOwnProperty$6.call(value, 'callee') &&
|
|
1964
1990
|
!propertyIsEnumerable$1.call(value, 'callee');
|
|
1965
1991
|
};
|
|
1966
1992
|
|
|
@@ -2240,10 +2266,10 @@ var isTypedArray = nodeIsTypedArray ? _baseUnary(nodeIsTypedArray) : _baseIsType
|
|
|
2240
2266
|
var isTypedArray_1 = isTypedArray;
|
|
2241
2267
|
|
|
2242
2268
|
/** Used for built-in method references. */
|
|
2243
|
-
var objectProto$
|
|
2269
|
+
var objectProto$7 = Object.prototype;
|
|
2244
2270
|
|
|
2245
2271
|
/** Used to check objects for own properties. */
|
|
2246
|
-
var hasOwnProperty$
|
|
2272
|
+
var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
|
|
2247
2273
|
|
|
2248
2274
|
/**
|
|
2249
2275
|
* Creates an array of the enumerable property names of the array-like `value`.
|
|
@@ -2263,7 +2289,7 @@ function arrayLikeKeys(value, inherited) {
|
|
|
2263
2289
|
length = result.length;
|
|
2264
2290
|
|
|
2265
2291
|
for (var key in value) {
|
|
2266
|
-
if ((inherited || hasOwnProperty$
|
|
2292
|
+
if ((inherited || hasOwnProperty$5.call(value, key)) &&
|
|
2267
2293
|
!(skipIndexes && (
|
|
2268
2294
|
// Safari 9 has enumerable `arguments.length` in strict mode.
|
|
2269
2295
|
key == 'length' ||
|
|
@@ -2283,7 +2309,7 @@ function arrayLikeKeys(value, inherited) {
|
|
|
2283
2309
|
var _arrayLikeKeys = arrayLikeKeys;
|
|
2284
2310
|
|
|
2285
2311
|
/** Used for built-in method references. */
|
|
2286
|
-
var objectProto$
|
|
2312
|
+
var objectProto$6 = Object.prototype;
|
|
2287
2313
|
|
|
2288
2314
|
/**
|
|
2289
2315
|
* Checks if `value` is likely a prototype object.
|
|
@@ -2294,7 +2320,7 @@ var objectProto$5 = Object.prototype;
|
|
|
2294
2320
|
*/
|
|
2295
2321
|
function isPrototype(value) {
|
|
2296
2322
|
var Ctor = value && value.constructor,
|
|
2297
|
-
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$
|
|
2323
|
+
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$6;
|
|
2298
2324
|
|
|
2299
2325
|
return value === proto;
|
|
2300
2326
|
}
|
|
@@ -2323,10 +2349,10 @@ var nativeKeys = _overArg(Object.keys, Object);
|
|
|
2323
2349
|
var _nativeKeys = nativeKeys;
|
|
2324
2350
|
|
|
2325
2351
|
/** Used for built-in method references. */
|
|
2326
|
-
var objectProto$
|
|
2352
|
+
var objectProto$5 = Object.prototype;
|
|
2327
2353
|
|
|
2328
2354
|
/** Used to check objects for own properties. */
|
|
2329
|
-
var hasOwnProperty$
|
|
2355
|
+
var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
|
|
2330
2356
|
|
|
2331
2357
|
/**
|
|
2332
2358
|
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
|
|
@@ -2341,7 +2367,7 @@ function baseKeys(object) {
|
|
|
2341
2367
|
}
|
|
2342
2368
|
var result = [];
|
|
2343
2369
|
for (var key in Object(object)) {
|
|
2344
|
-
if (hasOwnProperty$
|
|
2370
|
+
if (hasOwnProperty$4.call(object, key) && key != 'constructor') {
|
|
2345
2371
|
result.push(key);
|
|
2346
2372
|
}
|
|
2347
2373
|
}
|
|
@@ -2452,10 +2478,10 @@ function nativeKeysIn(object) {
|
|
|
2452
2478
|
var _nativeKeysIn = nativeKeysIn;
|
|
2453
2479
|
|
|
2454
2480
|
/** Used for built-in method references. */
|
|
2455
|
-
var objectProto$
|
|
2481
|
+
var objectProto$4 = Object.prototype;
|
|
2456
2482
|
|
|
2457
2483
|
/** Used to check objects for own properties. */
|
|
2458
|
-
var hasOwnProperty$
|
|
2484
|
+
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
|
|
2459
2485
|
|
|
2460
2486
|
/**
|
|
2461
2487
|
* The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
|
|
@@ -2472,7 +2498,7 @@ function baseKeysIn(object) {
|
|
|
2472
2498
|
result = [];
|
|
2473
2499
|
|
|
2474
2500
|
for (var key in object) {
|
|
2475
|
-
if (!(key == 'constructor' && (isProto || !hasOwnProperty$
|
|
2501
|
+
if (!(key == 'constructor' && (isProto || !hasOwnProperty$3.call(object, key)))) {
|
|
2476
2502
|
result.push(key);
|
|
2477
2503
|
}
|
|
2478
2504
|
}
|
|
@@ -2633,10 +2659,10 @@ function stubArray() {
|
|
|
2633
2659
|
var stubArray_1 = stubArray;
|
|
2634
2660
|
|
|
2635
2661
|
/** Used for built-in method references. */
|
|
2636
|
-
var objectProto$
|
|
2662
|
+
var objectProto$3 = Object.prototype;
|
|
2637
2663
|
|
|
2638
2664
|
/** Built-in value references. */
|
|
2639
|
-
var propertyIsEnumerable = objectProto$
|
|
2665
|
+
var propertyIsEnumerable = objectProto$3.propertyIsEnumerable;
|
|
2640
2666
|
|
|
2641
2667
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
2642
2668
|
var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
|
|
@@ -2852,10 +2878,10 @@ if ((_DataView && getTag(new _DataView(new ArrayBuffer(1))) != dataViewTag$2) ||
|
|
|
2852
2878
|
var _getTag = getTag;
|
|
2853
2879
|
|
|
2854
2880
|
/** Used for built-in method references. */
|
|
2855
|
-
var objectProto$
|
|
2881
|
+
var objectProto$2 = Object.prototype;
|
|
2856
2882
|
|
|
2857
2883
|
/** Used to check objects for own properties. */
|
|
2858
|
-
var hasOwnProperty$
|
|
2884
|
+
var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
|
|
2859
2885
|
|
|
2860
2886
|
/**
|
|
2861
2887
|
* Initializes an array clone.
|
|
@@ -2869,7 +2895,7 @@ function initCloneArray(array) {
|
|
|
2869
2895
|
result = new array.constructor(length);
|
|
2870
2896
|
|
|
2871
2897
|
// Add properties assigned by `RegExp#exec`.
|
|
2872
|
-
if (length && typeof array[0] == 'string' && hasOwnProperty$
|
|
2898
|
+
if (length && typeof array[0] == 'string' && hasOwnProperty$2.call(array, 'index')) {
|
|
2873
2899
|
result.index = array.index;
|
|
2874
2900
|
result.input = array.input;
|
|
2875
2901
|
}
|
|
@@ -3666,6 +3692,12 @@ function parent(object, path) {
|
|
|
3666
3692
|
|
|
3667
3693
|
var _parent = parent;
|
|
3668
3694
|
|
|
3695
|
+
/** Used for built-in method references. */
|
|
3696
|
+
var objectProto$1 = Object.prototype;
|
|
3697
|
+
|
|
3698
|
+
/** Used to check objects for own properties. */
|
|
3699
|
+
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
|
3700
|
+
|
|
3669
3701
|
/**
|
|
3670
3702
|
* The base implementation of `_.unset`.
|
|
3671
3703
|
*
|
|
@@ -3676,8 +3708,47 @@ var _parent = parent;
|
|
|
3676
3708
|
*/
|
|
3677
3709
|
function baseUnset(object, path) {
|
|
3678
3710
|
path = _castPath(path, object);
|
|
3679
|
-
|
|
3680
|
-
|
|
3711
|
+
|
|
3712
|
+
// Prevent prototype pollution, see: https://github.com/lodash/lodash/security/advisories/GHSA-xxjr-mmjv-4gpg
|
|
3713
|
+
var index = -1,
|
|
3714
|
+
length = path.length;
|
|
3715
|
+
|
|
3716
|
+
if (!length) {
|
|
3717
|
+
return true;
|
|
3718
|
+
}
|
|
3719
|
+
|
|
3720
|
+
var isRootPrimitive = object == null || (typeof object !== 'object' && typeof object !== 'function');
|
|
3721
|
+
|
|
3722
|
+
while (++index < length) {
|
|
3723
|
+
var key = path[index];
|
|
3724
|
+
|
|
3725
|
+
// skip non-string keys (e.g., Symbols, numbers)
|
|
3726
|
+
if (typeof key !== 'string') {
|
|
3727
|
+
continue;
|
|
3728
|
+
}
|
|
3729
|
+
|
|
3730
|
+
// Always block "__proto__" anywhere in the path if it's not expected
|
|
3731
|
+
if (key === '__proto__' && !hasOwnProperty$1.call(object, '__proto__')) {
|
|
3732
|
+
return false;
|
|
3733
|
+
}
|
|
3734
|
+
|
|
3735
|
+
// Block "constructor.prototype" chains
|
|
3736
|
+
if (key === 'constructor' &&
|
|
3737
|
+
(index + 1) < length &&
|
|
3738
|
+
typeof path[index + 1] === 'string' &&
|
|
3739
|
+
path[index + 1] === 'prototype') {
|
|
3740
|
+
|
|
3741
|
+
// Allow ONLY when the path starts at a primitive root, e.g., _.unset(0, 'constructor.prototype.a')
|
|
3742
|
+
if (isRootPrimitive && index === 0) {
|
|
3743
|
+
continue;
|
|
3744
|
+
}
|
|
3745
|
+
|
|
3746
|
+
return false;
|
|
3747
|
+
}
|
|
3748
|
+
}
|
|
3749
|
+
|
|
3750
|
+
var obj = _parent(object, path);
|
|
3751
|
+
return obj == null || delete obj[_toKey(last_1(path))];
|
|
3681
3752
|
}
|
|
3682
3753
|
|
|
3683
3754
|
var _baseUnset = baseUnset;
|
|
@@ -4326,8 +4397,8 @@ const Signature = withLocale(_ref => {
|
|
|
4326
4397
|
scale: 2
|
|
4327
4398
|
})).then(function (maskPng) {
|
|
4328
4399
|
const canvas = document.createElement('canvas');
|
|
4329
|
-
canvas.width = width * 2;
|
|
4330
|
-
canvas.height = height *
|
|
4400
|
+
canvas.width = Math.min(width * 2, 300);
|
|
4401
|
+
canvas.height = Math.round(height * 368 / canvas.width);
|
|
4331
4402
|
const ctx = canvas.getContext('2d');
|
|
4332
4403
|
ctx.drawImage(maskPng, 0, 0, canvas.width, canvas.height);
|
|
4333
4404
|
const resultImage = new Image();
|