@aurigma/design-atoms-model 7.0.33 → 7.0.36
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/Collection.js +271 -514
- package/Collection.js.map +1 -1
- package/Colors/CmykColor.js +35 -69
- package/Colors/CmykColor.js.map +1 -1
- package/Colors/Color.js +11 -19
- package/Colors/Color.js.map +1 -1
- package/Colors/GrayscaleColor.js +23 -45
- package/Colors/GrayscaleColor.js.map +1 -1
- package/Colors/HsbColor.js +67 -85
- package/Colors/HsbColor.js.map +1 -1
- package/Colors/Ink.js +20 -35
- package/Colors/Ink.js.map +1 -1
- package/Colors/LabColor.js +29 -59
- package/Colors/LabColor.js.map +1 -1
- package/Colors/Palette.js +2 -21
- package/Colors/Palette.js.map +1 -1
- package/Colors/ProcessColor.js +24 -54
- package/Colors/ProcessColor.js.map +1 -1
- package/Colors/RgbColor.js +31 -61
- package/Colors/RgbColor.js.map +1 -1
- package/Colors/RgbColors.js +22 -54
- package/Colors/RgbColors.js.map +1 -1
- package/Colors/SpotColor.js +34 -68
- package/Colors/SpotColor.js.map +1 -1
- package/Colors/Swatch.js +16 -40
- package/Colors/Swatch.js.map +1 -1
- package/Colors/ValidationUtils.js +3 -5
- package/Colors/ValidationUtils.js.map +1 -1
- package/ColorsOld/CmykColor.js +54 -80
- package/ColorsOld/CmykColor.js.map +1 -1
- package/ColorsOld/Color.d.ts +1 -1
- package/ColorsOld/Color.js +25 -34
- package/ColorsOld/Color.js.map +1 -1
- package/ColorsOld/ColorFactory.js +30 -40
- package/ColorsOld/ColorFactory.js.map +1 -1
- package/ColorsOld/GrayscaleColor.js +29 -54
- package/ColorsOld/GrayscaleColor.js.map +1 -1
- package/ColorsOld/HsbColor.js +29 -35
- package/ColorsOld/HsbColor.js.map +1 -1
- package/ColorsOld/LabColor.js +35 -56
- package/ColorsOld/LabColor.js.map +1 -1
- package/ColorsOld/RgbColor.js +73 -114
- package/ColorsOld/RgbColor.js.map +1 -1
- package/ColorsOld/SpotColor.js +32 -53
- package/ColorsOld/SpotColor.js.map +1 -1
- package/ColorsOld/Utils.js +9 -13
- package/ColorsOld/Utils.js.map +1 -1
- package/Configuration/IRenderingConfig.js +1 -0
- package/Configuration/WatermarkConfig.js +17 -33
- package/Configuration/WatermarkConfig.js.map +1 -1
- package/Configuration/index.js +1 -0
- package/Configuration/index.js.map +1 -1
- package/Configuration.js +7 -11
- package/Configuration.js.map +1 -1
- package/EquatableKeyDictionary.js +43 -127
- package/EquatableKeyDictionary.js.map +1 -1
- package/EventObject.js +59 -136
- package/EventObject.js.map +1 -1
- package/Exception.d.ts +1 -1
- package/Exception.js +47 -88
- package/Exception.js.map +1 -1
- package/INotifyPropertyChanged.d.ts +1 -1
- package/INotifyPropertyChanged.js +1 -0
- package/Math/Array.js +3 -3
- package/Math/Array.js.map +1 -1
- package/Math/Common.js +13 -15
- package/Math/Common.js.map +1 -1
- package/Math/ILtrb.js +1 -0
- package/Math/IPoint.js +1 -0
- package/Math/ISize.js +1 -0
- package/Math/Margin.js +62 -99
- package/Math/Margin.js.map +1 -1
- package/Math/Matrix.js +63 -94
- package/Math/Matrix.js.map +1 -1
- package/Math/Path.d.ts +2 -0
- package/Math/Path.js +231 -142
- package/Math/Path.js.map +1 -1
- package/Math/PointF.js +31 -34
- package/Math/PointF.js.map +1 -1
- package/Math/RectangleF.js +119 -159
- package/Math/RectangleF.js.map +1 -1
- package/Math/RotatedRectangleF.js +132 -147
- package/Math/RotatedRectangleF.js.map +1 -1
- package/Math/SizeF.js +10 -12
- package/Math/SizeF.js.map +1 -1
- package/Math/Transform.js +50 -80
- package/Math/Transform.js.map +1 -1
- package/Math/index.js +3 -0
- package/Math/index.js.map +1 -1
- package/Product/Constraints/ContainerConstraints.d.ts +13 -0
- package/Product/Constraints/ContainerConstraints.js +22 -0
- package/Product/Constraints/ContainerConstraints.js.map +1 -0
- package/Product/Constraints/MaxArtworkSizeConstraints.d.ts +13 -0
- package/Product/Constraints/MaxArtworkSizeConstraints.js +25 -0
- package/Product/Constraints/MaxArtworkSizeConstraints.js.map +1 -0
- package/Product/Constraints/PrintingTechniqueConstraints.js +10 -13
- package/Product/Constraints/PrintingTechniqueConstraints.js.map +1 -1
- package/Product/Container.d.ts +48 -10
- package/Product/Container.js +257 -373
- package/Product/Container.js.map +1 -1
- package/Product/ContainerVisualization.js +31 -56
- package/Product/ContainerVisualization.js.map +1 -1
- package/Product/Convert/CornerRadiusConverter.js +32 -34
- package/Product/Convert/CornerRadiusConverter.js.map +1 -1
- package/Product/CropMark.js +28 -40
- package/Product/CropMark.js.map +1 -1
- package/Product/Decorators/Factory/AbstractFactory.js +13 -23
- package/Product/Decorators/Factory/AbstractFactory.js.map +1 -1
- package/Product/Decorators/Factory/CollectionFactory.js +10 -45
- package/Product/Decorators/Factory/CollectionFactory.js.map +1 -1
- package/Product/Decorators/Factory/ColorFactory.js +13 -35
- package/Product/Decorators/Factory/ColorFactory.js.map +1 -1
- package/Product/Decorators/Factory/ObjectFactory.js +10 -45
- package/Product/Decorators/Factory/ObjectFactory.js.map +1 -1
- package/Product/Decorators/Factory/SimpleFactory.js +11 -21
- package/Product/Decorators/Factory/SimpleFactory.js.map +1 -1
- package/Product/Decorators/Interfaces/IInputPropertyMetadata.d.ts +1 -1
- package/Product/Decorators/Interfaces/IInputPropertyMetadata.js +1 -0
- package/Product/Decorators/Interfaces/IObjectMetadata.js +1 -0
- package/Product/Decorators/Interfaces/IPropertyMetadata.js +1 -0
- package/Product/Decorators/ItemsMetadata.js +11 -13
- package/Product/Decorators/ItemsMetadata.js.map +1 -1
- package/Product/Decorators/Property.js +4 -4
- package/Product/Decorators/Property.js.map +1 -1
- package/Product/Decorators/PropertyChanged.js +1 -1
- package/Product/Decorators/PropertyChanged.js.map +1 -1
- package/Product/Decorators/index.js +1 -0
- package/Product/Decorators/index.js.map +1 -1
- package/Product/Effects/ColorDictionaryEntry.js +3 -5
- package/Product/Effects/ColorDictionaryEntry.js.map +1 -1
- package/Product/Effects/NDEffectParameters.js +2 -6
- package/Product/Effects/NDEffectParameters.js.map +1 -1
- package/Product/Effects/NDEffects.js +20 -27
- package/Product/Effects/NDEffects.js.map +1 -1
- package/Product/Effects/RecolorEffectParameters.js +44 -89
- package/Product/Effects/RecolorEffectParameters.js.map +1 -1
- package/Product/IGetAllItemsOptions.js +1 -0
- package/Product/InteractiveZone.js +34 -66
- package/Product/InteractiveZone.js.map +1 -1
- package/Product/Interfaces/IColorWithTitle.js +1 -0
- package/Product/Interfaces/IDataSet.js +1 -0
- package/Product/Interfaces/IFontSettings.js +1 -0
- package/Product/Interfaces/IItemData.js +1 -0
- package/Product/Interfaces/IPdfMetadata.js +1 -0
- package/Product/Interfaces/IProductThemeConfig.js +1 -0
- package/Product/Interfaces/IShadowSettings.js +1 -0
- package/Product/Interfaces/IStrokeSettings.js +1 -0
- package/Product/Interfaces/index.js +3 -0
- package/Product/Interfaces/index.js.map +1 -1
- package/Product/ItemMask.js +20 -26
- package/Product/ItemMask.js.map +1 -1
- package/Product/Items/ArchedTextItem.js +65 -100
- package/Product/Items/ArchedTextItem.js.map +1 -1
- package/Product/Items/AutoScaledTextItem.js +35 -62
- package/Product/Items/AutoScaledTextItem.js.map +1 -1
- package/Product/Items/BarcodeData.d.ts +2 -1
- package/Product/Items/BarcodeData.js +77 -90
- package/Product/Items/BarcodeData.js.map +1 -1
- package/Product/Items/BarcodeItem.js +249 -298
- package/Product/Items/BarcodeItem.js.map +1 -1
- package/Product/Items/BarcodePermissions.js +38 -52
- package/Product/Items/BarcodePermissions.js.map +1 -1
- package/Product/Items/BaseItem.js +30 -53
- package/Product/Items/BaseItem.js.map +1 -1
- package/Product/Items/BaseTextItem.d.ts +2 -2
- package/Product/Items/BaseTextItem.js +447 -621
- package/Product/Items/BaseTextItem.js.map +1 -1
- package/Product/Items/BoundedTextItem.js +184 -255
- package/Product/Items/BoundedTextItem.js.map +1 -1
- package/Product/Items/ClipartItem.js +82 -175
- package/Product/Items/ClipartItem.js.map +1 -1
- package/Product/Items/ContentItem.js +52 -80
- package/Product/Items/ContentItem.js.map +1 -1
- package/Product/Items/ContentPermissions.js +36 -47
- package/Product/Items/ContentPermissions.js.map +1 -1
- package/Product/Items/CurvedTextItem.js +106 -158
- package/Product/Items/CurvedTextItem.js.map +1 -1
- package/Product/Items/DashedLineItem.js +45 -76
- package/Product/Items/DashedLineItem.js.map +1 -1
- package/Product/Items/EllipseItem.js +11 -31
- package/Product/Items/EllipseItem.js.map +1 -1
- package/Product/Items/FrontEndPermissions.js +20 -26
- package/Product/Items/FrontEndPermissions.js.map +1 -1
- package/Product/Items/GridItem.js +107 -162
- package/Product/Items/GridItem.js.map +1 -1
- package/Product/Items/GroupItem.js +93 -171
- package/Product/Items/GroupItem.js.map +1 -1
- package/Product/Items/GroupItemPermissions.js +42 -56
- package/Product/Items/GroupItemPermissions.js.map +1 -1
- package/Product/Items/ImageItem.js +304 -428
- package/Product/Items/ImageItem.js.map +1 -1
- package/Product/Items/ImageMetaData.js +14 -15
- package/Product/Items/ImageMetaData.js.map +1 -1
- package/Product/Items/ImagePermissions.js +42 -56
- package/Product/Items/ImagePermissions.js.map +1 -1
- package/Product/Items/ImageViolationSettings.js +18 -35
- package/Product/Items/ImageViolationSettings.js.map +1 -1
- package/Product/Items/InStringPlaceholder.js +50 -100
- package/Product/Items/InStringPlaceholder.js.map +1 -1
- package/Product/Items/Item.d.ts +1 -1
- package/Product/Items/Item.js +278 -370
- package/Product/Items/Item.js.map +1 -1
- package/Product/Items/ItemPermissions.js +54 -73
- package/Product/Items/ItemPermissions.js.map +1 -1
- package/Product/Items/ItemToolbarPermissions.js +61 -80
- package/Product/Items/ItemToolbarPermissions.js.map +1 -1
- package/Product/Items/LayoutItem.js +241 -326
- package/Product/Items/LayoutItem.js.map +1 -1
- package/Product/Items/LineItem.js +109 -156
- package/Product/Items/LineItem.js.map +1 -1
- package/Product/Items/LinePermissions.js +29 -39
- package/Product/Items/LinePermissions.js.map +1 -1
- package/Product/Items/ManipulationPermissions.d.ts +1 -1
- package/Product/Items/ManipulationPermissions.js +94 -135
- package/Product/Items/ManipulationPermissions.js.map +1 -1
- package/Product/Items/OpenTypeFeature.d.ts +1 -1
- package/Product/Items/OpenTypeFeature.js +3 -5
- package/Product/Items/OpenTypeFeature.js.map +1 -1
- package/Product/Items/OverlayEffect.js +56 -70
- package/Product/Items/OverlayEffect.js.map +1 -1
- package/Product/Items/ParagraphSettings.js +9 -11
- package/Product/Items/ParagraphSettings.js.map +1 -1
- package/Product/Items/PathBoundedTextItem.js +113 -164
- package/Product/Items/PathBoundedTextItem.js.map +1 -1
- package/Product/Items/PathBoundedTextPermissions.js +20 -26
- package/Product/Items/PathBoundedTextPermissions.js.map +1 -1
- package/Product/Items/PlaceholderItem.d.ts +1 -1
- package/Product/Items/PlaceholderItem.js +307 -417
- package/Product/Items/PlaceholderItem.js.map +1 -1
- package/Product/Items/PlaceholderPermissions.js +38 -47
- package/Product/Items/PlaceholderPermissions.js.map +1 -1
- package/Product/Items/PlainTextItem.js +45 -74
- package/Product/Items/PlainTextItem.js.map +1 -1
- package/Product/Items/PolylineItem.js +47 -78
- package/Product/Items/PolylineItem.js.map +1 -1
- package/Product/Items/RectangleItem.js +10 -30
- package/Product/Items/RectangleItem.js.map +1 -1
- package/Product/Items/ResizeGripsPermissions.d.ts +3 -3
- package/Product/Items/ResizeGripsPermissions.js +74 -94
- package/Product/Items/ResizeGripsPermissions.js.map +1 -1
- package/Product/Items/ShadowSettings.js +51 -69
- package/Product/Items/ShadowSettings.js.map +1 -1
- package/Product/Items/ShapeItem.js +182 -251
- package/Product/Items/ShapeItem.js.map +1 -1
- package/Product/Items/ShapePermissions.js +38 -52
- package/Product/Items/ShapePermissions.js.map +1 -1
- package/Product/Items/ShapeViolationSettings.js +18 -36
- package/Product/Items/ShapeViolationSettings.js.map +1 -1
- package/Product/Items/Size.js +7 -11
- package/Product/Items/Size.js.map +1 -1
- package/Product/Items/SmartItem.js +21 -41
- package/Product/Items/SmartItem.js.map +1 -1
- package/Product/Items/StrokeSettings.js +48 -62
- package/Product/Items/StrokeSettings.js.map +1 -1
- package/Product/Items/TextEnums.d.ts +2 -1
- package/Product/Items/TextEnums.js +1 -0
- package/Product/Items/TextEnums.js.map +1 -1
- package/Product/Items/TextPermissions.js +56 -58
- package/Product/Items/TextPermissions.js.map +1 -1
- package/Product/Items/TextViolationSettings.js +23 -40
- package/Product/Items/TextViolationSettings.js.map +1 -1
- package/Product/Items/ThemeBinding.js +10 -12
- package/Product/Items/ThemeBinding.js.map +1 -1
- package/Product/Items/ViolationSettings.js +26 -44
- package/Product/Items/ViolationSettings.js.map +1 -1
- package/Product/Items/VisualizationPermissions.js +29 -39
- package/Product/Items/VisualizationPermissions.js.map +1 -1
- package/Product/ItemsData/ItemData.js +8 -24
- package/Product/ItemsData/ItemData.js.map +1 -1
- package/Product/ModelComponent.js +41 -63
- package/Product/ModelComponent.js.map +1 -1
- package/Product/PrintArea.d.ts +11 -5
- package/Product/PrintArea.js +164 -155
- package/Product/PrintArea.js.map +1 -1
- package/Product/Product.js +67 -105
- package/Product/Product.js.map +1 -1
- package/Product/SafetyLine.d.ts +1 -1
- package/Product/SafetyLine.js +90 -124
- package/Product/SafetyLine.js.map +1 -1
- package/Product/Surface.d.ts +2 -1
- package/Product/Surface.js +193 -287
- package/Product/Surface.js.map +1 -1
- package/Product/SurfaceMockup.js +40 -73
- package/Product/SurfaceMockup.js.map +1 -1
- package/Product/Uuid.js +19 -25
- package/Product/Uuid.js.map +1 -1
- package/Product/Watermark.js +5 -9
- package/Product/Watermark.js.map +1 -1
- package/Product/index.d.ts +2 -0
- package/Product/index.js +3 -0
- package/Product/index.js.map +1 -1
- package/Serialization/IProductSerializer.js +1 -0
- package/Utils/Environment.d.ts +1 -1
- package/Utils/Environment.js +2 -2
- package/Utils/Environment.js.map +1 -1
- package/Utils/Exceptions.js +5 -5
- package/Utils/Exceptions.js.map +1 -1
- package/Utils/Items.js +19 -19
- package/Utils/Items.js.map +1 -1
- package/Utils/Types/Action.d.ts +5 -1
- package/Utils/Types/Action.js +1 -0
- package/Utils/Types/AnyFunction.d.ts +1 -1
- package/Utils/Types/AnyFunction.js +1 -0
- package/Utils/Types/Func.d.ts +1 -1
- package/Utils/Types/Func.js +1 -0
- package/Utils/Types/index.js +3 -0
- package/Utils/Types/index.js.map +1 -1
- package/Utils/Utils.d.ts +9 -4
- package/Utils/Utils.js +179 -296
- package/Utils/Utils.js.map +1 -1
- package/Utils/debounce.d.ts +29 -0
- package/Utils/debounce.js +106 -0
- package/Utils/debounce.js.map +1 -0
- package/Utils/index.d.ts +2 -0
- package/Utils/index.js +3 -0
- package/Utils/index.js.map +1 -1
- package/Utils/throttle.d.ts +16 -0
- package/Utils/throttle.js +25 -0
- package/Utils/throttle.js.map +1 -0
- package/Validators/CmykComponentValidator.js +13 -15
- package/Validators/CmykComponentValidator.js.map +1 -1
- package/Version.d.ts +1 -1
- package/Version.js +1 -1
- package/Version.js.map +1 -1
- package/package.json +3 -8
- package/typings/structured-clone.d.ts +5 -0
package/Utils/Utils.js
CHANGED
|
@@ -1,80 +1,13 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (_) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
var __values = (this && this.__values) || function(o) {
|
|
38
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
39
|
-
if (m) return m.call(o);
|
|
40
|
-
if (o && typeof o.length === "number") return {
|
|
41
|
-
next: function () {
|
|
42
|
-
if (o && i >= o.length) o = void 0;
|
|
43
|
-
return { value: o && o[i++], done: !o };
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
47
|
-
};
|
|
48
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
49
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
50
|
-
if (!m) return o;
|
|
51
|
-
var i = m.call(o), r, ar = [], e;
|
|
52
|
-
try {
|
|
53
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
54
|
-
}
|
|
55
|
-
catch (error) { e = { error: error }; }
|
|
56
|
-
finally {
|
|
57
|
-
try {
|
|
58
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
59
|
-
}
|
|
60
|
-
finally { if (e) throw e.error; }
|
|
61
|
-
}
|
|
62
|
-
return ar;
|
|
63
|
-
};
|
|
64
|
-
var __spread = (this && this.__spread) || function () {
|
|
65
|
-
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
|
66
|
-
return ar;
|
|
67
|
-
};
|
|
68
1
|
import { ArgumentException } from "../Exception";
|
|
69
2
|
import { Uuid } from "../Product/Uuid";
|
|
70
|
-
import
|
|
3
|
+
import { uniq, defaults } from "@aurigma/utils-js";
|
|
71
4
|
import Environment from "../Utils/Environment";
|
|
72
|
-
import {
|
|
73
|
-
|
|
5
|
+
import { EqualsOfFloatNumbers } from "../Math/Common";
|
|
6
|
+
export { intersection } from "@aurigma/utils-js";
|
|
74
7
|
export function mmToPoint(millimeters) { return millimeters * 2.83464567; }
|
|
75
8
|
;
|
|
76
9
|
export function stringEquals(str1, str2, options) {
|
|
77
|
-
|
|
10
|
+
let ignoreCase = false;
|
|
78
11
|
if (options != null)
|
|
79
12
|
ignoreCase = typeof options === "boolean" ?
|
|
80
13
|
options
|
|
@@ -83,23 +16,19 @@ export function stringEquals(str1, str2, options) {
|
|
|
83
16
|
str2 = ignoreCase ? str2.toLowerCase() : str2;
|
|
84
17
|
return str1 === str2;
|
|
85
18
|
}
|
|
86
|
-
export function urlCombine(startUrl) {
|
|
87
|
-
|
|
88
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
89
|
-
urlParts[_i - 1] = arguments[_i];
|
|
90
|
-
}
|
|
91
|
-
var endUrl = urlParts.pop();
|
|
19
|
+
export function urlCombine(startUrl, ...urlParts) {
|
|
20
|
+
let endUrl = urlParts.pop();
|
|
92
21
|
if (urlParts.length === 0 && endUrl === "")
|
|
93
22
|
return startUrl;
|
|
94
|
-
|
|
23
|
+
const separatorChar = "/";
|
|
95
24
|
endUrl = endUrl.replace(/^(\/|\s)+/g, "");
|
|
96
25
|
startUrl = startUrl.replace(/(\/|\s)+$/g, "");
|
|
97
26
|
if (urlParts.length === 0) {
|
|
98
27
|
return startUrl + separatorChar + endUrl;
|
|
99
28
|
}
|
|
100
29
|
else {
|
|
101
|
-
|
|
102
|
-
return
|
|
30
|
+
const trimedArgs = urlParts.map(arg => arg.replace(/^(\/|\s)+/g, "").replace(/(\/|\s)+$/g, ""));
|
|
31
|
+
return [startUrl, trimedArgs, endUrl].flat().join(separatorChar);
|
|
103
32
|
}
|
|
104
33
|
}
|
|
105
34
|
export function contains(str1, str2) {
|
|
@@ -111,8 +40,8 @@ export function equals(obj1, obj2) {
|
|
|
111
40
|
return true;
|
|
112
41
|
if ((obj1 == null && obj2 != null) || (obj1 != null && obj2 == null))
|
|
113
42
|
return false;
|
|
114
|
-
|
|
115
|
-
|
|
43
|
+
const typeof1 = typeof obj1;
|
|
44
|
+
const typeof2 = typeof obj2;
|
|
116
45
|
if (typeof1 !== typeof2)
|
|
117
46
|
return false;
|
|
118
47
|
if (typeof1 === "string" || typeof1 === "boolean")
|
|
@@ -124,14 +53,14 @@ export function equals(obj1, obj2) {
|
|
|
124
53
|
return false;
|
|
125
54
|
return arrayEquals(obj1, obj2);
|
|
126
55
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
56
|
+
let equalFunc;
|
|
57
|
+
const obj1equalsReady = obj1;
|
|
58
|
+
const obj2equalsReady = obj2;
|
|
130
59
|
if (typeof obj1equalsReady.equals === "function" && typeof obj2equalsReady.equals === "function") {
|
|
131
|
-
equalFunc =
|
|
60
|
+
equalFunc = (obj1, obj2) => obj1.equals(obj2);
|
|
132
61
|
}
|
|
133
62
|
else {
|
|
134
|
-
equalFunc =
|
|
63
|
+
equalFunc = (obj1, obj2) => obj1 == obj2;
|
|
135
64
|
}
|
|
136
65
|
return equalFunc(obj1, obj2);
|
|
137
66
|
}
|
|
@@ -142,14 +71,14 @@ export function arrayEquals(obj1, obj2) {
|
|
|
142
71
|
return false;
|
|
143
72
|
if (obj1.length !== obj2.length)
|
|
144
73
|
return false;
|
|
145
|
-
return obj1.reduce(
|
|
74
|
+
return obj1.reduce((result, value, index) => {
|
|
146
75
|
return result && equals(value, obj2[index]);
|
|
147
76
|
}, true);
|
|
148
77
|
}
|
|
149
78
|
export function arrayReferenceEquals(obj1, obj2) {
|
|
150
79
|
if ((obj1 === null || obj1 === void 0 ? void 0 : obj1.length) !== (obj2 === null || obj2 === void 0 ? void 0 : obj2.length))
|
|
151
80
|
return false;
|
|
152
|
-
return obj1.reduce(
|
|
81
|
+
return obj1.reduce((result, value, index) => {
|
|
153
82
|
return result && value == obj2[index];
|
|
154
83
|
}, true);
|
|
155
84
|
}
|
|
@@ -163,28 +92,27 @@ export function capitalize(word) {
|
|
|
163
92
|
return word;
|
|
164
93
|
return word[0].toUpperCase() + word.substr(1);
|
|
165
94
|
}
|
|
166
|
-
export function isValidXml(str, fixAmpsEnabled) {
|
|
167
|
-
if (fixAmpsEnabled === void 0) { fixAmpsEnabled = true; }
|
|
95
|
+
export function isValidXml(str, fixAmpsEnabled = true) {
|
|
168
96
|
if (isNullOrEmptyOrWhiteSpace(str) || !str.startsWith("<"))
|
|
169
97
|
return false;
|
|
170
98
|
if (fixAmpsEnabled)
|
|
171
99
|
str = fixAmps(str);
|
|
172
|
-
|
|
100
|
+
const xmlDoc = new DOMParser().parseFromString(`<root>${str}</root>`, "application/xml");
|
|
173
101
|
return xmlDoc.querySelector("parsererror") == null;
|
|
174
102
|
}
|
|
175
103
|
function fixAmps(str) {
|
|
176
104
|
if (isNullOrEmptyOrWhiteSpace(str) || !str.startsWith("<"))
|
|
177
105
|
return str;
|
|
178
|
-
|
|
106
|
+
const strParts = [str];
|
|
179
107
|
while (true) {
|
|
180
|
-
|
|
181
|
-
|
|
108
|
+
let lastPart = strParts.pop();
|
|
109
|
+
let ampIndex = lastPart.indexOf(`&`);
|
|
182
110
|
if (ampIndex === -1) {
|
|
183
111
|
strParts.push(lastPart);
|
|
184
112
|
break;
|
|
185
113
|
}
|
|
186
114
|
strParts.push(lastPart.substring(0, ampIndex));
|
|
187
|
-
|
|
115
|
+
let ampEntity = getAmpEntity(lastPart, ampIndex);
|
|
188
116
|
if (ampEntity != null) {
|
|
189
117
|
strParts.push(ampEntity.entity);
|
|
190
118
|
strParts.push(lastPart.substring(ampIndex + ampEntity.length));
|
|
@@ -197,80 +125,57 @@ function fixAmps(str) {
|
|
|
197
125
|
return strParts.join('');
|
|
198
126
|
}
|
|
199
127
|
function getAmpEntity(str, index) {
|
|
200
|
-
|
|
128
|
+
let substring4 = str.substring(index, index + 4).toLowerCase();
|
|
201
129
|
if (substring4 == "<")
|
|
202
130
|
return { entity: "<", length: 4 };
|
|
203
131
|
else if (substring4 == ">")
|
|
204
132
|
return { entity: ">", length: 4 };
|
|
205
|
-
|
|
133
|
+
let substring5 = str.substring(index, index + 5).toLowerCase();
|
|
206
134
|
if (substring5 == "&")
|
|
207
135
|
return { entity: "&", length: 5 };
|
|
208
|
-
|
|
136
|
+
let substring6 = str.substring(index, index + 6).toLowerCase();
|
|
209
137
|
if (substring6 == "'")
|
|
210
138
|
return { entity: "'", length: 6 };
|
|
211
139
|
if (substring6 == """)
|
|
212
140
|
return { entity: """, length: 6 };
|
|
213
|
-
|
|
141
|
+
let substring7 = str.substring(index, index + 7).toLowerCase();
|
|
214
142
|
if (substring7.match(/^&#[\\d]{4};$$/)) { // 
|
|
215
143
|
return { entity: substring7, length: 7 };
|
|
216
144
|
}
|
|
217
|
-
|
|
145
|
+
let substring8 = str.substring(index, index + 8);
|
|
218
146
|
if (substring8.toLowerCase().match(/^&#x[\\dabcdef]{4};$/)) // «
|
|
219
147
|
return { entity: substring8, length: 8 };
|
|
220
148
|
return null;
|
|
221
149
|
}
|
|
222
|
-
export function getTextFromXml(xmlFormattedText, replaceParagraphString) {
|
|
223
|
-
|
|
224
|
-
if (replaceParagraphString === void 0) { replaceParagraphString = " "; }
|
|
225
|
-
var domParser = new DOMParser();
|
|
150
|
+
export function getTextFromXml(xmlFormattedText, replaceParagraphString = " ") {
|
|
151
|
+
const domParser = new DOMParser();
|
|
226
152
|
xmlFormattedText = fixAmps(xmlFormattedText);
|
|
227
|
-
|
|
228
|
-
|
|
153
|
+
const xmlObject = domParser.parseFromString(`<root>${xmlFormattedText}</root>`, "application/xml");
|
|
154
|
+
let parseError = xmlObject.querySelector("parsererror");
|
|
229
155
|
if (parseError == null) {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
br.textContent = replaceParagraphString;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
237
|
-
finally {
|
|
238
|
-
try {
|
|
239
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
240
|
-
}
|
|
241
|
-
finally { if (e_1) throw e_1.error; }
|
|
242
|
-
}
|
|
243
|
-
var paragraphArray = Array.from(xmlObject.querySelectorAll("p, li"));
|
|
156
|
+
for (let br of Array.from(xmlObject.querySelectorAll("br")))
|
|
157
|
+
br.textContent = replaceParagraphString;
|
|
158
|
+
const paragraphArray = Array.from(xmlObject.querySelectorAll("p, li"));
|
|
244
159
|
if (paragraphArray.length > 1) {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
spaceSpan.textContent = replaceParagraphString;
|
|
251
|
-
el.appendChild(spaceSpan);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
255
|
-
finally {
|
|
256
|
-
try {
|
|
257
|
-
if (paragraphArrayWithoutLastElement_1_1 && !paragraphArrayWithoutLastElement_1_1.done && (_b = paragraphArrayWithoutLastElement_1.return)) _b.call(paragraphArrayWithoutLastElement_1);
|
|
258
|
-
}
|
|
259
|
-
finally { if (e_2) throw e_2.error; }
|
|
160
|
+
const paragraphArrayWithoutLastElement = paragraphArray.filter(p => p != paragraphArray[paragraphArray.length - 1]);
|
|
161
|
+
for (let el of paragraphArrayWithoutLastElement) {
|
|
162
|
+
const spaceSpan = document.createElementNS("application/xml", "span");
|
|
163
|
+
spaceSpan.textContent = replaceParagraphString;
|
|
164
|
+
el.appendChild(spaceSpan);
|
|
260
165
|
}
|
|
261
166
|
}
|
|
262
167
|
return xmlObject.querySelector("root").textContent;
|
|
263
168
|
}
|
|
264
169
|
else {
|
|
265
|
-
console.warn(
|
|
170
|
+
console.warn(`Bad value xmlObject`, xmlObject, parseError.innerHTML);
|
|
266
171
|
return escapeXml(xmlFormattedText);
|
|
267
172
|
}
|
|
268
173
|
}
|
|
269
174
|
export function unescapeXml(str) {
|
|
270
|
-
|
|
175
|
+
const stringForParse = `<span>${str}</span>`;
|
|
271
176
|
if (isValidXml(stringForParse, false)) {
|
|
272
|
-
|
|
273
|
-
|
|
177
|
+
const xmlDoc = new DOMParser().parseFromString(stringForParse, "application/xml");
|
|
178
|
+
const span = xmlDoc.querySelector("span");
|
|
274
179
|
return span.textContent;
|
|
275
180
|
}
|
|
276
181
|
else {
|
|
@@ -278,23 +183,23 @@ export function unescapeXml(str) {
|
|
|
278
183
|
}
|
|
279
184
|
}
|
|
280
185
|
export function escapeXml(str) {
|
|
281
|
-
|
|
282
|
-
|
|
186
|
+
const xmlDoc = new DOMParser().parseFromString("<span></span>", "application/xml");
|
|
187
|
+
const span = xmlDoc.querySelector("span");
|
|
283
188
|
span.textContent = str;
|
|
284
|
-
|
|
189
|
+
let escapedString = (new XMLSerializer()).serializeToString(xmlDoc);
|
|
285
190
|
escapedString = escapedString.replace("<span>", "").replace("</span>", "").replace("<span/>", "").replace("<span />", "");
|
|
286
191
|
return escapedString;
|
|
287
192
|
}
|
|
288
193
|
export function stringFormat(str) {
|
|
289
194
|
var args = Array.prototype.slice.call(arguments);
|
|
290
195
|
args.splice(0, 1);
|
|
291
|
-
return str.replace(/\{(\d+)\}/g,
|
|
196
|
+
return str.replace(/\{(\d+)\}/g, (m, n) => args[n]);
|
|
292
197
|
}
|
|
293
198
|
export function getCurrentLineInTextArea(element) {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
for (
|
|
199
|
+
const textLines = element.value.split("\n");
|
|
200
|
+
const selectionStart = element.selectionStart;
|
|
201
|
+
let lineInitialPosition = 0;
|
|
202
|
+
for (let i = 0; i < textLines.length; i++) {
|
|
298
203
|
if (lineInitialPosition + textLines[i].length >= selectionStart) {
|
|
299
204
|
return textLines[i];
|
|
300
205
|
}
|
|
@@ -302,26 +207,14 @@ export function getCurrentLineInTextArea(element) {
|
|
|
302
207
|
}
|
|
303
208
|
}
|
|
304
209
|
export function flatten(nestedCollec) {
|
|
305
|
-
|
|
306
|
-
var flattentArray = [];
|
|
210
|
+
const flattentArray = [];
|
|
307
211
|
if (nestedCollec instanceof Array)
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
var innerArray = nestedCollec_1_1.value;
|
|
311
|
-
flattentArray.push.apply(flattentArray, __spread(innerArray));
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
315
|
-
finally {
|
|
316
|
-
try {
|
|
317
|
-
if (nestedCollec_1_1 && !nestedCollec_1_1.done && (_a = nestedCollec_1.return)) _a.call(nestedCollec_1);
|
|
318
|
-
}
|
|
319
|
-
finally { if (e_3) throw e_3.error; }
|
|
320
|
-
}
|
|
212
|
+
for (let innerArray of nestedCollec)
|
|
213
|
+
flattentArray.push(...innerArray);
|
|
321
214
|
return flattentArray;
|
|
322
215
|
}
|
|
323
216
|
export function createCssDataUri(css) {
|
|
324
|
-
return
|
|
217
|
+
return `data:text/css,${encodeURI(css)}`;
|
|
325
218
|
}
|
|
326
219
|
//function and css class are from bootstrap library
|
|
327
220
|
export function measureScrollbar() {
|
|
@@ -333,10 +226,10 @@ export function measureScrollbar() {
|
|
|
333
226
|
return scrollbarWidth;
|
|
334
227
|
}
|
|
335
228
|
export function getHiddenElemenHeight(el) {
|
|
336
|
-
|
|
229
|
+
const hiddenElement = el.cloneNode();
|
|
337
230
|
document.body.appendChild(hiddenElement);
|
|
338
|
-
|
|
339
|
-
|
|
231
|
+
const style = getComputedStyle(hiddenElement);
|
|
232
|
+
const height = hiddenElement.offsetHeight + parseFloat(style.marginTop) + parseFloat(style.marginBottom);
|
|
340
233
|
hiddenElement.remove();
|
|
341
234
|
return height;
|
|
342
235
|
}
|
|
@@ -346,8 +239,8 @@ export function getHiddenElemenHeight(el) {
|
|
|
346
239
|
* @param getFocusElement Function returns element to be focused after dropdown expand
|
|
347
240
|
*/
|
|
348
241
|
export function enableMoveDropDownFocus(element, getFocusElement) {
|
|
349
|
-
element.querySelectorAll('[data-toggle="dropdown"]').forEach(
|
|
350
|
-
element.parentElement.addEventListener("shown.bs.dropdown",
|
|
242
|
+
element.querySelectorAll('[data-toggle="dropdown"]').forEach((element) => {
|
|
243
|
+
element.parentElement.addEventListener("shown.bs.dropdown", () => {
|
|
351
244
|
getFocusElement().focus();
|
|
352
245
|
});
|
|
353
246
|
});
|
|
@@ -355,10 +248,10 @@ export function enableMoveDropDownFocus(element, getFocusElement) {
|
|
|
355
248
|
export function timeout(delay) {
|
|
356
249
|
if (delay == null)
|
|
357
250
|
delay = 0;
|
|
358
|
-
return new Promise(
|
|
251
|
+
return new Promise(resolve => setTimeout(resolve, delay));
|
|
359
252
|
}
|
|
360
|
-
export
|
|
361
|
-
|
|
253
|
+
export const delay = timeout;
|
|
254
|
+
const objectUniqueIdsMap = new Map();
|
|
362
255
|
export function getUniqueId(object) {
|
|
363
256
|
if (object == null)
|
|
364
257
|
return null;
|
|
@@ -367,7 +260,7 @@ export function getUniqueId(object) {
|
|
|
367
260
|
return objectUniqueIdsMap.get(object);
|
|
368
261
|
}
|
|
369
262
|
export function getFontNames(text) {
|
|
370
|
-
|
|
263
|
+
const fontNames = [];
|
|
371
264
|
text = fixAmps(text);
|
|
372
265
|
if (isValidXml(text, false)) {
|
|
373
266
|
try {
|
|
@@ -379,57 +272,48 @@ export function getFontNames(text) {
|
|
|
379
272
|
console.error(ex);
|
|
380
273
|
}
|
|
381
274
|
}
|
|
382
|
-
return
|
|
275
|
+
return uniq(fontNames);
|
|
383
276
|
//#region local funcs
|
|
384
277
|
function parseSizeableNode(element) {
|
|
385
|
-
|
|
278
|
+
const style = parseXmlStyle(element);
|
|
386
279
|
if (style != null && style.has("font-name"))
|
|
387
280
|
fontNames.push(style.get("font-name"));
|
|
388
281
|
}
|
|
389
282
|
function parseXmlStyle(element) {
|
|
390
|
-
|
|
391
|
-
var styleAttr = element.attributes.getNamedItem("style");
|
|
283
|
+
const styleAttr = element.attributes.getNamedItem("style");
|
|
392
284
|
if (styleAttr == null || styleAttr.value == null)
|
|
393
285
|
return null;
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
var value = content[1].trim();
|
|
405
|
-
styleMap.set(key, value);
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
409
|
-
finally {
|
|
410
|
-
try {
|
|
411
|
-
if (nodeStyleParts_1_1 && !nodeStyleParts_1_1.done && (_a = nodeStyleParts_1.return)) _a.call(nodeStyleParts_1);
|
|
412
|
-
}
|
|
413
|
-
finally { if (e_4) throw e_4.error; }
|
|
286
|
+
const nodeStyleParts = styleAttr.value.split(";");
|
|
287
|
+
const styleMap = new Map();
|
|
288
|
+
for (let stylePart of nodeStyleParts) {
|
|
289
|
+
stylePart = stylePart.trim();
|
|
290
|
+
if (stylePart == null || stylePart === "")
|
|
291
|
+
continue;
|
|
292
|
+
const content = stylePart.split(":");
|
|
293
|
+
const key = content[0].trim();
|
|
294
|
+
const value = content[1].trim();
|
|
295
|
+
styleMap.set(key, value);
|
|
414
296
|
}
|
|
415
297
|
return styleMap;
|
|
416
298
|
}
|
|
417
299
|
function walkNodes(gmXml, nodeNames, parseNode) {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
acceptNode:
|
|
421
|
-
|
|
300
|
+
const xmlDoc = new DOMParser().parseFromString(`<body>${gmXml}</body>`, "application/xml");
|
|
301
|
+
let filter = {
|
|
302
|
+
acceptNode: (node) => {
|
|
303
|
+
const nodeName = node.nodeName.toLowerCase();
|
|
422
304
|
return nodeNames.includes(nodeName) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
423
305
|
}
|
|
424
306
|
};
|
|
425
307
|
if (Environment.IsIE())
|
|
426
308
|
filter = makeIeCompatible(filter);
|
|
427
|
-
|
|
309
|
+
// @ts-ignore
|
|
310
|
+
const walker = document.createTreeWalker(xmlDoc.childNodes[0], NodeFilter.SHOW_ELEMENT, filter, false);
|
|
428
311
|
while (walker.nextNode()) {
|
|
429
|
-
|
|
312
|
+
const node = walker.currentNode;
|
|
430
313
|
parseNode(node);
|
|
431
314
|
}
|
|
432
315
|
function makeIeCompatible(filter) {
|
|
316
|
+
// @ts-ignore
|
|
433
317
|
return filter.acceptNode;
|
|
434
318
|
}
|
|
435
319
|
}
|
|
@@ -438,22 +322,19 @@ export function getFontNames(text) {
|
|
|
438
322
|
export function assign(target, sources, options) {
|
|
439
323
|
options = normalize(options);
|
|
440
324
|
if (options.ignoreNull) {
|
|
441
|
-
for (
|
|
442
|
-
|
|
325
|
+
for (let i = 0; i < sources.length; i++) {
|
|
326
|
+
const source = structuredClone(sources[i]);
|
|
443
327
|
//$.extend ignores undefined in the source, but not null
|
|
444
328
|
removeNulls(source);
|
|
445
329
|
sources[i] = source;
|
|
446
330
|
}
|
|
447
331
|
}
|
|
448
332
|
return options.deep
|
|
449
|
-
? deepExtend
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
}
|
|
455
|
-
var extendedObj = target;
|
|
456
|
-
var sourceObj = __spread(sources);
|
|
333
|
+
? deepExtend(target, ...sources)
|
|
334
|
+
: Object.assign(target, ...sources);
|
|
335
|
+
function deepExtend(target, ...sources) {
|
|
336
|
+
let extendedObj = target;
|
|
337
|
+
const sourceObj = [...sources];
|
|
457
338
|
var merge = function (obj) {
|
|
458
339
|
for (var prop in obj) {
|
|
459
340
|
if (obj.hasOwnProperty(prop)) {
|
|
@@ -469,8 +350,8 @@ export function assign(target, sources, options) {
|
|
|
469
350
|
}
|
|
470
351
|
}
|
|
471
352
|
};
|
|
472
|
-
for (
|
|
473
|
-
|
|
353
|
+
for (let i = 0; i < sourceObj.length; i++) {
|
|
354
|
+
const obj = sourceObj[i];
|
|
474
355
|
merge(obj);
|
|
475
356
|
}
|
|
476
357
|
return extendedObj;
|
|
@@ -479,61 +360,50 @@ export function assign(target, sources, options) {
|
|
|
479
360
|
function normalize(op) {
|
|
480
361
|
if (op == null)
|
|
481
362
|
op = {};
|
|
482
|
-
|
|
363
|
+
defaults(op, { deep: false, ignoreNull: true });
|
|
483
364
|
return op;
|
|
484
365
|
}
|
|
485
366
|
function removeNulls(source) {
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
delete source[propName];
|
|
494
|
-
else
|
|
495
|
-
source[propName] = undefined;
|
|
496
|
-
}
|
|
497
|
-
else if (typeof property === "object") {
|
|
498
|
-
removeNulls(property);
|
|
499
|
-
}
|
|
367
|
+
for (let propName of Object.keys(source)) {
|
|
368
|
+
const property = source[propName];
|
|
369
|
+
if (property === null) {
|
|
370
|
+
if (source.hasOwnProperty(propName))
|
|
371
|
+
delete source[propName];
|
|
372
|
+
else
|
|
373
|
+
source[propName] = undefined;
|
|
500
374
|
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
finally {
|
|
504
|
-
try {
|
|
505
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
375
|
+
else if (typeof property === "object") {
|
|
376
|
+
removeNulls(property);
|
|
506
377
|
}
|
|
507
|
-
finally { if (e_5) throw e_5.error; }
|
|
508
378
|
}
|
|
509
379
|
}
|
|
510
380
|
}
|
|
511
381
|
export function assignProperties(target, propObject) {
|
|
512
382
|
return assign(target, [propObject], { deep: true });
|
|
513
383
|
}
|
|
514
|
-
export function normalize(paramObject,
|
|
384
|
+
export function normalize(paramObject, def) {
|
|
515
385
|
if (paramObject == null)
|
|
516
386
|
paramObject = {};
|
|
517
|
-
|
|
387
|
+
defaults(paramObject, def);
|
|
518
388
|
return paramObject;
|
|
519
389
|
}
|
|
520
390
|
export function toDashedStyle(camleCase) {
|
|
521
|
-
return camleCase.replace(/([A-Z])/g,
|
|
391
|
+
return camleCase.replace(/([A-Z])/g, (segment) => `-${segment.toLowerCase()}`);
|
|
522
392
|
}
|
|
523
393
|
export function getStringEnumValue(enumObject, enumValue) {
|
|
524
|
-
|
|
394
|
+
let propertyNames = Object.getOwnPropertyNames(enumObject);
|
|
525
395
|
return propertyNames[propertyNames
|
|
526
|
-
.map(
|
|
396
|
+
.map(i => enumObject[i].toString().toLowerCase())
|
|
527
397
|
.indexOf(enumValue.toLowerCase())];
|
|
528
398
|
}
|
|
529
399
|
export function strToInt(str) {
|
|
530
|
-
|
|
531
|
-
if (
|
|
400
|
+
const value = parseInt(str);
|
|
401
|
+
if (str == null || str === "" || isNaN(value) || !isFinite(value))
|
|
532
402
|
return null;
|
|
533
403
|
return value;
|
|
534
404
|
}
|
|
535
405
|
export function localStorageEnabled() {
|
|
536
|
-
|
|
406
|
+
const test = "test";
|
|
537
407
|
try {
|
|
538
408
|
localStorage.setItem(test, test);
|
|
539
409
|
localStorage.removeItem(test);
|
|
@@ -546,72 +416,54 @@ export function localStorageEnabled() {
|
|
|
546
416
|
/**
|
|
547
417
|
* @deprecated The method should not be used. User ImageUtils.getImageSizeByUrl from design-atoms module.
|
|
548
418
|
*/
|
|
549
|
-
export function getImageSize(imageUrl) {
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
}
|
|
561
|
-
var imgElement;
|
|
562
|
-
return __generator(this, function (_a) {
|
|
563
|
-
switch (_a.label) {
|
|
564
|
-
case 0: return [4 /*yield*/, toImageElement(imageUrl)];
|
|
565
|
-
case 1:
|
|
566
|
-
imgElement = _a.sent();
|
|
567
|
-
return [2 /*return*/, { width: imgElement.width, height: imgElement.height }];
|
|
568
|
-
}
|
|
419
|
+
export async function getImageSize(imageUrl) {
|
|
420
|
+
const imgElement = await toImageElement(imageUrl);
|
|
421
|
+
return { width: imgElement.width, height: imgElement.height };
|
|
422
|
+
function toImageElement(url) {
|
|
423
|
+
return new Promise((resolve) => {
|
|
424
|
+
const img = new Image();
|
|
425
|
+
img.crossOrigin = "anonymous";
|
|
426
|
+
img.src = url;
|
|
427
|
+
img.onload = () => resolve(img);
|
|
428
|
+
img.onerror = e => resolve(null);
|
|
429
|
+
return img;
|
|
569
430
|
});
|
|
570
|
-
}
|
|
431
|
+
}
|
|
571
432
|
}
|
|
572
433
|
export function stripForJson(obj, omitProperties) {
|
|
573
434
|
if (omitProperties == null)
|
|
574
435
|
omitProperties = [];
|
|
575
436
|
else if (typeof omitProperties === "string")
|
|
576
437
|
omitProperties = [omitProperties];
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
objectKeys.
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
591
|
-
finally {
|
|
592
|
-
try {
|
|
593
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
594
|
-
}
|
|
595
|
-
finally { if (e_6) throw e_6.error; }
|
|
596
|
-
}
|
|
597
|
-
if (omitProperties.some(function (p) { return p === key; }))
|
|
438
|
+
const objectKeys = new Set();
|
|
439
|
+
let currentObj = obj;
|
|
440
|
+
while (currentObj && currentObj !== Object.prototype) {
|
|
441
|
+
Object.getOwnPropertyNames(currentObj).forEach(k => objectKeys.add(k));
|
|
442
|
+
currentObj = Object.getPrototypeOf(currentObj);
|
|
443
|
+
}
|
|
444
|
+
const allowedKeys = Array.from(objectKeys).filter(key => {
|
|
445
|
+
if (key === 'constructor')
|
|
446
|
+
return false;
|
|
447
|
+
for (let forbiddenPrefix of ["_", "$$"])
|
|
448
|
+
if (key.startsWith(forbiddenPrefix))
|
|
449
|
+
return false;
|
|
450
|
+
if (omitProperties.some(p => p === key))
|
|
598
451
|
return false;
|
|
599
452
|
if (typeof obj[key] === "function")
|
|
600
453
|
return false;
|
|
601
454
|
return true;
|
|
602
455
|
});
|
|
603
|
-
return allowedKeys.reduce(
|
|
456
|
+
return allowedKeys.reduce((strippedObject, currentKey) => {
|
|
604
457
|
strippedObject[currentKey] = obj[currentKey];
|
|
605
458
|
return strippedObject;
|
|
606
459
|
}, {});
|
|
607
460
|
}
|
|
608
|
-
export function isFocused(element,
|
|
609
|
-
|
|
610
|
-
var focused = document.activeElement === element;
|
|
461
|
+
export function isFocused(element, { checkDocumentFocus = false } = {}) {
|
|
462
|
+
const focused = document.activeElement === element;
|
|
611
463
|
return focused && (checkDocumentFocus ? document.hasFocus() : true);
|
|
612
464
|
}
|
|
613
465
|
export function getExtension(fileName) {
|
|
614
|
-
|
|
466
|
+
const nameParts = fileName.split(".");
|
|
615
467
|
return nameParts.length > 1 ? nameParts[nameParts.length - 1] : "";
|
|
616
468
|
}
|
|
617
469
|
export function getNameWithoutExtension(fileName) {
|
|
@@ -632,20 +484,51 @@ export function getLastPathSegment(path) {
|
|
|
632
484
|
return path;
|
|
633
485
|
if (!path.includes("/"))
|
|
634
486
|
return path;
|
|
635
|
-
|
|
636
|
-
return
|
|
487
|
+
const segments = path.split("/");
|
|
488
|
+
return segments[segments.length - 1];
|
|
637
489
|
}
|
|
638
490
|
export function parsePercentOrPointValue(point, printAreaSize) {
|
|
639
|
-
|
|
491
|
+
let result = null;
|
|
640
492
|
if (typeof point === "string" && /%$/.test(point)) {
|
|
641
|
-
|
|
493
|
+
const percent = Number(point.split(/%/)[0]);
|
|
642
494
|
result = printAreaSize * percent / 100;
|
|
643
495
|
}
|
|
644
496
|
else {
|
|
645
497
|
result = Number(point);
|
|
646
498
|
}
|
|
647
499
|
if (typeof result !== "number" || isNaN(result))
|
|
648
|
-
throw new ArgumentException(
|
|
500
|
+
throw new ArgumentException(`'${point}' is not a number or percent string`);
|
|
649
501
|
return result;
|
|
650
502
|
}
|
|
503
|
+
export function isString(value) {
|
|
504
|
+
return Boolean(typeof value === "string" || value instanceof String);
|
|
505
|
+
}
|
|
506
|
+
export function isNumber(value) {
|
|
507
|
+
return typeof value === "number";
|
|
508
|
+
}
|
|
509
|
+
export function isEmpty(value) {
|
|
510
|
+
if (value == null) {
|
|
511
|
+
return true;
|
|
512
|
+
}
|
|
513
|
+
if (typeof value === 'object') {
|
|
514
|
+
return Object.keys(value).length === 0;
|
|
515
|
+
}
|
|
516
|
+
if (typeof value === 'string' || Array.isArray(value)) {
|
|
517
|
+
return value.length === 0;
|
|
518
|
+
}
|
|
519
|
+
return false;
|
|
520
|
+
}
|
|
521
|
+
export function isEqual(a, b) {
|
|
522
|
+
if (a === b)
|
|
523
|
+
return true;
|
|
524
|
+
if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null) {
|
|
525
|
+
return false;
|
|
526
|
+
}
|
|
527
|
+
const aKeys = Object.keys(a);
|
|
528
|
+
const bKeys = Object.keys(b);
|
|
529
|
+
if (aKeys.length !== bKeys.length)
|
|
530
|
+
return false;
|
|
531
|
+
return aKeys.every(key => isEqual(a[key], b[key]));
|
|
532
|
+
}
|
|
533
|
+
export const isObject = (value) => value !== null && typeof value === 'object';
|
|
651
534
|
//# sourceMappingURL=Utils.js.map
|