intelicoreact 1.1.7 → 1.1.9

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.
@@ -17,6 +17,12 @@ var _utils = require("../../../Functions/utils");
17
17
 
18
18
  require("./FileLoaderLocal.scss");
19
19
 
20
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
21
+
22
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
23
+
24
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
25
+
20
26
  var FileLoaderLocal = function FileLoaderLocal(_ref) {
21
27
  var groupId = _ref.groupId,
22
28
  id = _ref.id,
@@ -50,6 +56,39 @@ var FileLoaderLocal = function FileLoaderLocal(_ref) {
50
56
  return file.size > maxItemSizeBytes;
51
57
  };
52
58
 
59
+ var removeDuplicateExtensions = function removeDuplicateExtensions(str) {
60
+ var parts = str.split(' '); // Разделить строку на части
61
+
62
+ var extensions = [];
63
+ var newParts = [];
64
+
65
+ var _iterator = _createForOfIteratorHelper(parts),
66
+ _step;
67
+
68
+ try {
69
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
70
+ var part = _step.value;
71
+
72
+ if (part.includes('.')) {
73
+ var extension = part.substring(part.lastIndexOf('.'));
74
+
75
+ if (!extensions.includes(extension)) {
76
+ extensions.push(extension);
77
+ newParts.push(part);
78
+ }
79
+ } else {
80
+ newParts.push(part);
81
+ }
82
+ }
83
+ } catch (err) {
84
+ _iterator.e(err);
85
+ } finally {
86
+ _iterator.f();
87
+ }
88
+
89
+ return "Only ".concat(newParts.join(' '), " are allowed"); // Объединить части и вернуть новую строку
90
+ };
91
+
53
92
  var checkExtension = function checkExtension(valueExtension) {
54
93
  return accept.includes(valueExtension);
55
94
  };
@@ -81,7 +120,7 @@ var FileLoaderLocal = function FileLoaderLocal(_ref) {
81
120
  valueExtension: valueExtension,
82
121
  e: e,
83
122
  file: file,
84
- error: "Only ".concat(allowedExtensions, " are allowed")
123
+ error: removeDuplicateExtensions(allowedExtensions)
85
124
  });
86
125
  } else onChange({
87
126
  id: id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelicoreact",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [