@aurigma/design-atoms-model 7.0.34 → 7.0.37
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 +1 -1
- package/Math/Path.js +149 -234
- 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.js +11 -13
- package/Product/Constraints/ContainerConstraints.js.map +1 -1
- package/Product/Constraints/MaxArtworkSizeConstraints.d.ts +1 -1
- package/Product/Constraints/MaxArtworkSizeConstraints.js +10 -12
- package/Product/Constraints/MaxArtworkSizeConstraints.js.map +1 -1
- package/Product/Constraints/PrintingTechniqueConstraints.js +10 -13
- package/Product/Constraints/PrintingTechniqueConstraints.js.map +1 -1
- package/Product/Container.d.ts +10 -10
- package/Product/Container.js +253 -375
- package/Product/Container.js.map +1 -1
- package/Product/ContainerVisualization.d.ts +1 -0
- 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.d.ts +1 -0
- package/Product/Effects/NDEffects.js +20 -27
- package/Product/Effects/NDEffects.js.map +1 -1
- package/Product/Effects/RecolorEffectParameters.d.ts +1 -0
- 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 +1 -1
- package/Product/Items/BarcodeData.js +62 -91
- 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 +451 -625
- 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 +95 -172
- 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.d.ts +9 -4
- package/Product/Items/ImageItem.js +319 -430
- 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.d.ts +2 -1
- package/Product/Items/InStringPlaceholder.js +52 -101
- 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 +116 -166
- 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 +310 -419
- 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 +51 -81
- 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 +5 -4
- package/Product/Items/ResizeGripsPermissions.js +75 -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 -250
- 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.d.ts +2 -1
- package/Product/Items/ThemeBinding.js +13 -15
- 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 +1 -0
- package/Product/PrintArea.js +132 -178
- 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.js +1 -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 +24 -44
- 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 +14 -5
- package/Utils/Utils.js +185 -298
- 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,15 @@
|
|
|
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 {
|
|
7
|
+
/** @deprecated use from @aurigma/utils-js */
|
|
8
|
+
intersection } from "@aurigma/utils-js";
|
|
74
9
|
export function mmToPoint(millimeters) { return millimeters * 2.83464567; }
|
|
75
10
|
;
|
|
76
11
|
export function stringEquals(str1, str2, options) {
|
|
77
|
-
|
|
12
|
+
let ignoreCase = false;
|
|
78
13
|
if (options != null)
|
|
79
14
|
ignoreCase = typeof options === "boolean" ?
|
|
80
15
|
options
|
|
@@ -83,36 +18,32 @@ export function stringEquals(str1, str2, options) {
|
|
|
83
18
|
str2 = ignoreCase ? str2.toLowerCase() : str2;
|
|
84
19
|
return str1 === str2;
|
|
85
20
|
}
|
|
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();
|
|
21
|
+
export function urlCombine(startUrl, ...urlParts) {
|
|
22
|
+
let endUrl = urlParts.pop();
|
|
92
23
|
if (urlParts.length === 0 && endUrl === "")
|
|
93
24
|
return startUrl;
|
|
94
|
-
|
|
25
|
+
const separatorChar = "/";
|
|
95
26
|
endUrl = endUrl.replace(/^(\/|\s)+/g, "");
|
|
96
27
|
startUrl = startUrl.replace(/(\/|\s)+$/g, "");
|
|
97
28
|
if (urlParts.length === 0) {
|
|
98
29
|
return startUrl + separatorChar + endUrl;
|
|
99
30
|
}
|
|
100
31
|
else {
|
|
101
|
-
|
|
102
|
-
return
|
|
32
|
+
const trimedArgs = urlParts.map(arg => arg.replace(/^(\/|\s)+/g, "").replace(/(\/|\s)+$/g, ""));
|
|
33
|
+
return [startUrl, trimedArgs, endUrl].flat().join(separatorChar);
|
|
103
34
|
}
|
|
104
35
|
}
|
|
105
36
|
export function contains(str1, str2) {
|
|
106
37
|
return str1 != null && str2 != null && str1.toLowerCase().indexOf(str2.toLowerCase()) !== -1;
|
|
107
38
|
}
|
|
108
39
|
;
|
|
109
|
-
export
|
|
40
|
+
export const equals = (obj1, obj2) => {
|
|
110
41
|
if (obj1 == null && obj2 == null)
|
|
111
42
|
return true;
|
|
112
43
|
if ((obj1 == null && obj2 != null) || (obj1 != null && obj2 == null))
|
|
113
44
|
return false;
|
|
114
|
-
|
|
115
|
-
|
|
45
|
+
const typeof1 = typeof obj1;
|
|
46
|
+
const typeof2 = typeof obj2;
|
|
116
47
|
if (typeof1 !== typeof2)
|
|
117
48
|
return false;
|
|
118
49
|
if (typeof1 === "string" || typeof1 === "boolean")
|
|
@@ -124,17 +55,18 @@ export function equals(obj1, obj2) {
|
|
|
124
55
|
return false;
|
|
125
56
|
return arrayEquals(obj1, obj2);
|
|
126
57
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
58
|
+
let equalFunc;
|
|
59
|
+
const obj1equalsReady = obj1;
|
|
60
|
+
const obj2equalsReady = obj2;
|
|
130
61
|
if (typeof obj1equalsReady.equals === "function" && typeof obj2equalsReady.equals === "function") {
|
|
131
|
-
equalFunc =
|
|
62
|
+
equalFunc = (obj1, obj2) => obj1.equals(obj2);
|
|
132
63
|
}
|
|
133
64
|
else {
|
|
134
|
-
equalFunc =
|
|
65
|
+
equalFunc = (obj1, obj2) => obj1 == obj2;
|
|
135
66
|
}
|
|
136
67
|
return equalFunc(obj1, obj2);
|
|
137
|
-
}
|
|
68
|
+
};
|
|
69
|
+
/** @deprecated use arrayIsEquals from `@aurigma/utils-js/algorithms/array` */
|
|
138
70
|
export function arrayEquals(obj1, obj2) {
|
|
139
71
|
if (obj1 == null && obj2 == null)
|
|
140
72
|
return true;
|
|
@@ -142,14 +74,14 @@ export function arrayEquals(obj1, obj2) {
|
|
|
142
74
|
return false;
|
|
143
75
|
if (obj1.length !== obj2.length)
|
|
144
76
|
return false;
|
|
145
|
-
return obj1.reduce(
|
|
77
|
+
return obj1.reduce((result, value, index) => {
|
|
146
78
|
return result && equals(value, obj2[index]);
|
|
147
79
|
}, true);
|
|
148
80
|
}
|
|
149
81
|
export function arrayReferenceEquals(obj1, obj2) {
|
|
150
82
|
if ((obj1 === null || obj1 === void 0 ? void 0 : obj1.length) !== (obj2 === null || obj2 === void 0 ? void 0 : obj2.length))
|
|
151
83
|
return false;
|
|
152
|
-
return obj1.reduce(
|
|
84
|
+
return obj1.reduce((result, value, index) => {
|
|
153
85
|
return result && value == obj2[index];
|
|
154
86
|
}, true);
|
|
155
87
|
}
|
|
@@ -163,28 +95,27 @@ export function capitalize(word) {
|
|
|
163
95
|
return word;
|
|
164
96
|
return word[0].toUpperCase() + word.substr(1);
|
|
165
97
|
}
|
|
166
|
-
export function isValidXml(str, fixAmpsEnabled) {
|
|
167
|
-
if (fixAmpsEnabled === void 0) { fixAmpsEnabled = true; }
|
|
98
|
+
export function isValidXml(str, fixAmpsEnabled = true) {
|
|
168
99
|
if (isNullOrEmptyOrWhiteSpace(str) || !str.startsWith("<"))
|
|
169
100
|
return false;
|
|
170
101
|
if (fixAmpsEnabled)
|
|
171
102
|
str = fixAmps(str);
|
|
172
|
-
|
|
103
|
+
const xmlDoc = new DOMParser().parseFromString(`<root>${str}</root>`, "application/xml");
|
|
173
104
|
return xmlDoc.querySelector("parsererror") == null;
|
|
174
105
|
}
|
|
175
106
|
function fixAmps(str) {
|
|
176
107
|
if (isNullOrEmptyOrWhiteSpace(str) || !str.startsWith("<"))
|
|
177
108
|
return str;
|
|
178
|
-
|
|
109
|
+
const strParts = [str];
|
|
179
110
|
while (true) {
|
|
180
|
-
|
|
181
|
-
|
|
111
|
+
let lastPart = strParts.pop();
|
|
112
|
+
let ampIndex = lastPart.indexOf(`&`);
|
|
182
113
|
if (ampIndex === -1) {
|
|
183
114
|
strParts.push(lastPart);
|
|
184
115
|
break;
|
|
185
116
|
}
|
|
186
117
|
strParts.push(lastPart.substring(0, ampIndex));
|
|
187
|
-
|
|
118
|
+
let ampEntity = getAmpEntity(lastPart, ampIndex);
|
|
188
119
|
if (ampEntity != null) {
|
|
189
120
|
strParts.push(ampEntity.entity);
|
|
190
121
|
strParts.push(lastPart.substring(ampIndex + ampEntity.length));
|
|
@@ -197,80 +128,57 @@ function fixAmps(str) {
|
|
|
197
128
|
return strParts.join('');
|
|
198
129
|
}
|
|
199
130
|
function getAmpEntity(str, index) {
|
|
200
|
-
|
|
131
|
+
let substring4 = str.substring(index, index + 4).toLowerCase();
|
|
201
132
|
if (substring4 == "<")
|
|
202
133
|
return { entity: "<", length: 4 };
|
|
203
134
|
else if (substring4 == ">")
|
|
204
135
|
return { entity: ">", length: 4 };
|
|
205
|
-
|
|
136
|
+
let substring5 = str.substring(index, index + 5).toLowerCase();
|
|
206
137
|
if (substring5 == "&")
|
|
207
138
|
return { entity: "&", length: 5 };
|
|
208
|
-
|
|
139
|
+
let substring6 = str.substring(index, index + 6).toLowerCase();
|
|
209
140
|
if (substring6 == "'")
|
|
210
141
|
return { entity: "'", length: 6 };
|
|
211
142
|
if (substring6 == """)
|
|
212
143
|
return { entity: """, length: 6 };
|
|
213
|
-
|
|
144
|
+
let substring7 = str.substring(index, index + 7).toLowerCase();
|
|
214
145
|
if (substring7.match(/^&#[\\d]{4};$$/)) { // 
|
|
215
146
|
return { entity: substring7, length: 7 };
|
|
216
147
|
}
|
|
217
|
-
|
|
148
|
+
let substring8 = str.substring(index, index + 8);
|
|
218
149
|
if (substring8.toLowerCase().match(/^&#x[\\dabcdef]{4};$/)) // «
|
|
219
150
|
return { entity: substring8, length: 8 };
|
|
220
151
|
return null;
|
|
221
152
|
}
|
|
222
|
-
export function getTextFromXml(xmlFormattedText, replaceParagraphString) {
|
|
223
|
-
|
|
224
|
-
if (replaceParagraphString === void 0) { replaceParagraphString = " "; }
|
|
225
|
-
var domParser = new DOMParser();
|
|
153
|
+
export function getTextFromXml(xmlFormattedText, replaceParagraphString = " ") {
|
|
154
|
+
const domParser = new DOMParser();
|
|
226
155
|
xmlFormattedText = fixAmps(xmlFormattedText);
|
|
227
|
-
|
|
228
|
-
|
|
156
|
+
const xmlObject = domParser.parseFromString(`<root>${xmlFormattedText}</root>`, "application/xml");
|
|
157
|
+
let parseError = xmlObject.querySelector("parsererror");
|
|
229
158
|
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"));
|
|
159
|
+
for (let br of Array.from(xmlObject.querySelectorAll("br")))
|
|
160
|
+
br.textContent = replaceParagraphString;
|
|
161
|
+
const paragraphArray = Array.from(xmlObject.querySelectorAll("p, li"));
|
|
244
162
|
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; }
|
|
163
|
+
const paragraphArrayWithoutLastElement = paragraphArray.filter(p => p != paragraphArray[paragraphArray.length - 1]);
|
|
164
|
+
for (let el of paragraphArrayWithoutLastElement) {
|
|
165
|
+
const spaceSpan = document.createElementNS("application/xml", "span");
|
|
166
|
+
spaceSpan.textContent = replaceParagraphString;
|
|
167
|
+
el.appendChild(spaceSpan);
|
|
260
168
|
}
|
|
261
169
|
}
|
|
262
170
|
return xmlObject.querySelector("root").textContent;
|
|
263
171
|
}
|
|
264
172
|
else {
|
|
265
|
-
console.warn(
|
|
173
|
+
console.warn(`Bad value xmlObject`, xmlObject, parseError.innerHTML);
|
|
266
174
|
return escapeXml(xmlFormattedText);
|
|
267
175
|
}
|
|
268
176
|
}
|
|
269
177
|
export function unescapeXml(str) {
|
|
270
|
-
|
|
178
|
+
const stringForParse = `<span>${str}</span>`;
|
|
271
179
|
if (isValidXml(stringForParse, false)) {
|
|
272
|
-
|
|
273
|
-
|
|
180
|
+
const xmlDoc = new DOMParser().parseFromString(stringForParse, "application/xml");
|
|
181
|
+
const span = xmlDoc.querySelector("span");
|
|
274
182
|
return span.textContent;
|
|
275
183
|
}
|
|
276
184
|
else {
|
|
@@ -278,50 +186,39 @@ export function unescapeXml(str) {
|
|
|
278
186
|
}
|
|
279
187
|
}
|
|
280
188
|
export function escapeXml(str) {
|
|
281
|
-
|
|
282
|
-
|
|
189
|
+
const xmlDoc = new DOMParser().parseFromString("<span></span>", "application/xml");
|
|
190
|
+
const span = xmlDoc.querySelector("span");
|
|
283
191
|
span.textContent = str;
|
|
284
|
-
|
|
192
|
+
let escapedString = (new XMLSerializer()).serializeToString(xmlDoc);
|
|
285
193
|
escapedString = escapedString.replace("<span>", "").replace("</span>", "").replace("<span/>", "").replace("<span />", "");
|
|
286
194
|
return escapedString;
|
|
287
195
|
}
|
|
288
196
|
export function stringFormat(str) {
|
|
289
197
|
var args = Array.prototype.slice.call(arguments);
|
|
290
198
|
args.splice(0, 1);
|
|
291
|
-
return str.replace(/\{(\d+)\}/g,
|
|
199
|
+
return str.replace(/\{(\d+)\}/g, (m, n) => args[n]);
|
|
292
200
|
}
|
|
293
201
|
export function getCurrentLineInTextArea(element) {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
for (
|
|
202
|
+
const textLines = element.value.split("\n");
|
|
203
|
+
const selectionStart = element.selectionStart;
|
|
204
|
+
let lineInitialPosition = 0;
|
|
205
|
+
for (let i = 0; i < textLines.length; i++) {
|
|
298
206
|
if (lineInitialPosition + textLines[i].length >= selectionStart) {
|
|
299
207
|
return textLines[i];
|
|
300
208
|
}
|
|
301
209
|
lineInitialPosition += textLines[i].length + 1;
|
|
302
210
|
}
|
|
303
211
|
}
|
|
212
|
+
/** @deprecated use native JS array flatten */
|
|
304
213
|
export function flatten(nestedCollec) {
|
|
305
|
-
|
|
306
|
-
var flattentArray = [];
|
|
214
|
+
const flattentArray = [];
|
|
307
215
|
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
|
-
}
|
|
216
|
+
for (let innerArray of nestedCollec)
|
|
217
|
+
flattentArray.push(...innerArray);
|
|
321
218
|
return flattentArray;
|
|
322
219
|
}
|
|
323
220
|
export function createCssDataUri(css) {
|
|
324
|
-
return
|
|
221
|
+
return `data:text/css,${encodeURI(css)}`;
|
|
325
222
|
}
|
|
326
223
|
//function and css class are from bootstrap library
|
|
327
224
|
export function measureScrollbar() {
|
|
@@ -333,10 +230,10 @@ export function measureScrollbar() {
|
|
|
333
230
|
return scrollbarWidth;
|
|
334
231
|
}
|
|
335
232
|
export function getHiddenElemenHeight(el) {
|
|
336
|
-
|
|
233
|
+
const hiddenElement = el.cloneNode();
|
|
337
234
|
document.body.appendChild(hiddenElement);
|
|
338
|
-
|
|
339
|
-
|
|
235
|
+
const style = getComputedStyle(hiddenElement);
|
|
236
|
+
const height = hiddenElement.offsetHeight + parseFloat(style.marginTop) + parseFloat(style.marginBottom);
|
|
340
237
|
hiddenElement.remove();
|
|
341
238
|
return height;
|
|
342
239
|
}
|
|
@@ -346,8 +243,8 @@ export function getHiddenElemenHeight(el) {
|
|
|
346
243
|
* @param getFocusElement Function returns element to be focused after dropdown expand
|
|
347
244
|
*/
|
|
348
245
|
export function enableMoveDropDownFocus(element, getFocusElement) {
|
|
349
|
-
element.querySelectorAll('[data-toggle="dropdown"]').forEach(
|
|
350
|
-
element.parentElement.addEventListener("shown.bs.dropdown",
|
|
246
|
+
element.querySelectorAll('[data-toggle="dropdown"]').forEach((element) => {
|
|
247
|
+
element.parentElement.addEventListener("shown.bs.dropdown", () => {
|
|
351
248
|
getFocusElement().focus();
|
|
352
249
|
});
|
|
353
250
|
});
|
|
@@ -355,10 +252,10 @@ export function enableMoveDropDownFocus(element, getFocusElement) {
|
|
|
355
252
|
export function timeout(delay) {
|
|
356
253
|
if (delay == null)
|
|
357
254
|
delay = 0;
|
|
358
|
-
return new Promise(
|
|
255
|
+
return new Promise(resolve => setTimeout(resolve, delay));
|
|
359
256
|
}
|
|
360
|
-
export
|
|
361
|
-
|
|
257
|
+
export const delay = timeout;
|
|
258
|
+
const objectUniqueIdsMap = new Map();
|
|
362
259
|
export function getUniqueId(object) {
|
|
363
260
|
if (object == null)
|
|
364
261
|
return null;
|
|
@@ -367,7 +264,7 @@ export function getUniqueId(object) {
|
|
|
367
264
|
return objectUniqueIdsMap.get(object);
|
|
368
265
|
}
|
|
369
266
|
export function getFontNames(text) {
|
|
370
|
-
|
|
267
|
+
const fontNames = [];
|
|
371
268
|
text = fixAmps(text);
|
|
372
269
|
if (isValidXml(text, false)) {
|
|
373
270
|
try {
|
|
@@ -379,57 +276,48 @@ export function getFontNames(text) {
|
|
|
379
276
|
console.error(ex);
|
|
380
277
|
}
|
|
381
278
|
}
|
|
382
|
-
return
|
|
279
|
+
return uniq(fontNames);
|
|
383
280
|
//#region local funcs
|
|
384
281
|
function parseSizeableNode(element) {
|
|
385
|
-
|
|
282
|
+
const style = parseXmlStyle(element);
|
|
386
283
|
if (style != null && style.has("font-name"))
|
|
387
284
|
fontNames.push(style.get("font-name"));
|
|
388
285
|
}
|
|
389
286
|
function parseXmlStyle(element) {
|
|
390
|
-
|
|
391
|
-
var styleAttr = element.attributes.getNamedItem("style");
|
|
287
|
+
const styleAttr = element.attributes.getNamedItem("style");
|
|
392
288
|
if (styleAttr == null || styleAttr.value == null)
|
|
393
289
|
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; }
|
|
290
|
+
const nodeStyleParts = styleAttr.value.split(";");
|
|
291
|
+
const styleMap = new Map();
|
|
292
|
+
for (let stylePart of nodeStyleParts) {
|
|
293
|
+
stylePart = stylePart.trim();
|
|
294
|
+
if (stylePart == null || stylePart === "")
|
|
295
|
+
continue;
|
|
296
|
+
const content = stylePart.split(":");
|
|
297
|
+
const key = content[0].trim();
|
|
298
|
+
const value = content[1].trim();
|
|
299
|
+
styleMap.set(key, value);
|
|
414
300
|
}
|
|
415
301
|
return styleMap;
|
|
416
302
|
}
|
|
417
303
|
function walkNodes(gmXml, nodeNames, parseNode) {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
acceptNode:
|
|
421
|
-
|
|
304
|
+
const xmlDoc = new DOMParser().parseFromString(`<body>${gmXml}</body>`, "application/xml");
|
|
305
|
+
let filter = {
|
|
306
|
+
acceptNode: (node) => {
|
|
307
|
+
const nodeName = node.nodeName.toLowerCase();
|
|
422
308
|
return nodeNames.includes(nodeName) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
423
309
|
}
|
|
424
310
|
};
|
|
425
311
|
if (Environment.IsIE())
|
|
426
312
|
filter = makeIeCompatible(filter);
|
|
427
|
-
|
|
313
|
+
// @ts-ignore
|
|
314
|
+
const walker = document.createTreeWalker(xmlDoc.childNodes[0], NodeFilter.SHOW_ELEMENT, filter, false);
|
|
428
315
|
while (walker.nextNode()) {
|
|
429
|
-
|
|
316
|
+
const node = walker.currentNode;
|
|
430
317
|
parseNode(node);
|
|
431
318
|
}
|
|
432
319
|
function makeIeCompatible(filter) {
|
|
320
|
+
// @ts-ignore
|
|
433
321
|
return filter.acceptNode;
|
|
434
322
|
}
|
|
435
323
|
}
|
|
@@ -438,22 +326,19 @@ export function getFontNames(text) {
|
|
|
438
326
|
export function assign(target, sources, options) {
|
|
439
327
|
options = normalize(options);
|
|
440
328
|
if (options.ignoreNull) {
|
|
441
|
-
for (
|
|
442
|
-
|
|
329
|
+
for (let i = 0; i < sources.length; i++) {
|
|
330
|
+
const source = structuredClone(sources[i]);
|
|
443
331
|
//$.extend ignores undefined in the source, but not null
|
|
444
332
|
removeNulls(source);
|
|
445
333
|
sources[i] = source;
|
|
446
334
|
}
|
|
447
335
|
}
|
|
448
336
|
return options.deep
|
|
449
|
-
? deepExtend
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
}
|
|
455
|
-
var extendedObj = target;
|
|
456
|
-
var sourceObj = __spread(sources);
|
|
337
|
+
? deepExtend(target, ...sources)
|
|
338
|
+
: Object.assign(target, ...sources);
|
|
339
|
+
function deepExtend(target, ...sources) {
|
|
340
|
+
let extendedObj = target;
|
|
341
|
+
const sourceObj = [...sources];
|
|
457
342
|
var merge = function (obj) {
|
|
458
343
|
for (var prop in obj) {
|
|
459
344
|
if (obj.hasOwnProperty(prop)) {
|
|
@@ -469,8 +354,8 @@ export function assign(target, sources, options) {
|
|
|
469
354
|
}
|
|
470
355
|
}
|
|
471
356
|
};
|
|
472
|
-
for (
|
|
473
|
-
|
|
357
|
+
for (let i = 0; i < sourceObj.length; i++) {
|
|
358
|
+
const obj = sourceObj[i];
|
|
474
359
|
merge(obj);
|
|
475
360
|
}
|
|
476
361
|
return extendedObj;
|
|
@@ -479,61 +364,50 @@ export function assign(target, sources, options) {
|
|
|
479
364
|
function normalize(op) {
|
|
480
365
|
if (op == null)
|
|
481
366
|
op = {};
|
|
482
|
-
|
|
367
|
+
defaults(op, { deep: false, ignoreNull: true });
|
|
483
368
|
return op;
|
|
484
369
|
}
|
|
485
370
|
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
|
-
}
|
|
371
|
+
for (let propName of Object.keys(source)) {
|
|
372
|
+
const property = source[propName];
|
|
373
|
+
if (property === null) {
|
|
374
|
+
if (source.hasOwnProperty(propName))
|
|
375
|
+
delete source[propName];
|
|
376
|
+
else
|
|
377
|
+
source[propName] = undefined;
|
|
500
378
|
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
finally {
|
|
504
|
-
try {
|
|
505
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
379
|
+
else if (typeof property === "object") {
|
|
380
|
+
removeNulls(property);
|
|
506
381
|
}
|
|
507
|
-
finally { if (e_5) throw e_5.error; }
|
|
508
382
|
}
|
|
509
383
|
}
|
|
510
384
|
}
|
|
511
385
|
export function assignProperties(target, propObject) {
|
|
512
386
|
return assign(target, [propObject], { deep: true });
|
|
513
387
|
}
|
|
514
|
-
export function normalize(paramObject,
|
|
388
|
+
export function normalize(paramObject, def) {
|
|
515
389
|
if (paramObject == null)
|
|
516
390
|
paramObject = {};
|
|
517
|
-
|
|
391
|
+
defaults(paramObject, def);
|
|
518
392
|
return paramObject;
|
|
519
393
|
}
|
|
520
394
|
export function toDashedStyle(camleCase) {
|
|
521
|
-
return camleCase.replace(/([A-Z])/g,
|
|
395
|
+
return camleCase.replace(/([A-Z])/g, (segment) => `-${segment.toLowerCase()}`);
|
|
522
396
|
}
|
|
523
397
|
export function getStringEnumValue(enumObject, enumValue) {
|
|
524
|
-
|
|
398
|
+
let propertyNames = Object.getOwnPropertyNames(enumObject);
|
|
525
399
|
return propertyNames[propertyNames
|
|
526
|
-
.map(
|
|
400
|
+
.map(i => enumObject[i].toString().toLowerCase())
|
|
527
401
|
.indexOf(enumValue.toLowerCase())];
|
|
528
402
|
}
|
|
529
403
|
export function strToInt(str) {
|
|
530
|
-
|
|
531
|
-
if (
|
|
404
|
+
const value = parseInt(str);
|
|
405
|
+
if (str == null || str === "" || isNaN(value) || !isFinite(value))
|
|
532
406
|
return null;
|
|
533
407
|
return value;
|
|
534
408
|
}
|
|
535
409
|
export function localStorageEnabled() {
|
|
536
|
-
|
|
410
|
+
const test = "test";
|
|
537
411
|
try {
|
|
538
412
|
localStorage.setItem(test, test);
|
|
539
413
|
localStorage.removeItem(test);
|
|
@@ -546,72 +420,54 @@ export function localStorageEnabled() {
|
|
|
546
420
|
/**
|
|
547
421
|
* @deprecated The method should not be used. User ImageUtils.getImageSizeByUrl from design-atoms module.
|
|
548
422
|
*/
|
|
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
|
-
}
|
|
423
|
+
export async function getImageSize(imageUrl) {
|
|
424
|
+
const imgElement = await toImageElement(imageUrl);
|
|
425
|
+
return { width: imgElement.width, height: imgElement.height };
|
|
426
|
+
function toImageElement(url) {
|
|
427
|
+
return new Promise((resolve) => {
|
|
428
|
+
const img = new Image();
|
|
429
|
+
img.crossOrigin = "anonymous";
|
|
430
|
+
img.src = url;
|
|
431
|
+
img.onload = () => resolve(img);
|
|
432
|
+
img.onerror = e => resolve(null);
|
|
433
|
+
return img;
|
|
569
434
|
});
|
|
570
|
-
}
|
|
435
|
+
}
|
|
571
436
|
}
|
|
572
437
|
export function stripForJson(obj, omitProperties) {
|
|
573
438
|
if (omitProperties == null)
|
|
574
439
|
omitProperties = [];
|
|
575
440
|
else if (typeof omitProperties === "string")
|
|
576
441
|
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; }))
|
|
442
|
+
const objectKeys = new Set();
|
|
443
|
+
let currentObj = obj;
|
|
444
|
+
while (currentObj && currentObj !== Object.prototype) {
|
|
445
|
+
Object.getOwnPropertyNames(currentObj).forEach(k => objectKeys.add(k));
|
|
446
|
+
currentObj = Object.getPrototypeOf(currentObj);
|
|
447
|
+
}
|
|
448
|
+
const allowedKeys = Array.from(objectKeys).filter(key => {
|
|
449
|
+
if (key === 'constructor')
|
|
450
|
+
return false;
|
|
451
|
+
for (let forbiddenPrefix of ["_", "$$"])
|
|
452
|
+
if (key.startsWith(forbiddenPrefix))
|
|
453
|
+
return false;
|
|
454
|
+
if (omitProperties.some(p => p === key))
|
|
598
455
|
return false;
|
|
599
456
|
if (typeof obj[key] === "function")
|
|
600
457
|
return false;
|
|
601
458
|
return true;
|
|
602
459
|
});
|
|
603
|
-
return allowedKeys.reduce(
|
|
460
|
+
return allowedKeys.reduce((strippedObject, currentKey) => {
|
|
604
461
|
strippedObject[currentKey] = obj[currentKey];
|
|
605
462
|
return strippedObject;
|
|
606
463
|
}, {});
|
|
607
464
|
}
|
|
608
|
-
export function isFocused(element,
|
|
609
|
-
|
|
610
|
-
var focused = document.activeElement === element;
|
|
465
|
+
export function isFocused(element, { checkDocumentFocus = false } = {}) {
|
|
466
|
+
const focused = document.activeElement === element;
|
|
611
467
|
return focused && (checkDocumentFocus ? document.hasFocus() : true);
|
|
612
468
|
}
|
|
613
469
|
export function getExtension(fileName) {
|
|
614
|
-
|
|
470
|
+
const nameParts = fileName.split(".");
|
|
615
471
|
return nameParts.length > 1 ? nameParts[nameParts.length - 1] : "";
|
|
616
472
|
}
|
|
617
473
|
export function getNameWithoutExtension(fileName) {
|
|
@@ -632,20 +488,51 @@ export function getLastPathSegment(path) {
|
|
|
632
488
|
return path;
|
|
633
489
|
if (!path.includes("/"))
|
|
634
490
|
return path;
|
|
635
|
-
|
|
636
|
-
return
|
|
491
|
+
const segments = path.split("/");
|
|
492
|
+
return segments[segments.length - 1];
|
|
637
493
|
}
|
|
638
494
|
export function parsePercentOrPointValue(point, printAreaSize) {
|
|
639
|
-
|
|
495
|
+
let result = null;
|
|
640
496
|
if (typeof point === "string" && /%$/.test(point)) {
|
|
641
|
-
|
|
497
|
+
const percent = Number(point.split(/%/)[0]);
|
|
642
498
|
result = printAreaSize * percent / 100;
|
|
643
499
|
}
|
|
644
500
|
else {
|
|
645
501
|
result = Number(point);
|
|
646
502
|
}
|
|
647
503
|
if (typeof result !== "number" || isNaN(result))
|
|
648
|
-
throw new ArgumentException(
|
|
504
|
+
throw new ArgumentException(`'${point}' is not a number or percent string`);
|
|
649
505
|
return result;
|
|
650
506
|
}
|
|
507
|
+
export function isString(value) {
|
|
508
|
+
return Boolean(typeof value === "string" || value instanceof String);
|
|
509
|
+
}
|
|
510
|
+
export function isNumber(value) {
|
|
511
|
+
return typeof value === "number";
|
|
512
|
+
}
|
|
513
|
+
export function isEmpty(value) {
|
|
514
|
+
if (value == null) {
|
|
515
|
+
return true;
|
|
516
|
+
}
|
|
517
|
+
if (typeof value === 'object') {
|
|
518
|
+
return Object.keys(value).length === 0;
|
|
519
|
+
}
|
|
520
|
+
if (typeof value === 'string' || Array.isArray(value)) {
|
|
521
|
+
return value.length === 0;
|
|
522
|
+
}
|
|
523
|
+
return false;
|
|
524
|
+
}
|
|
525
|
+
export function isEqual(a, b) {
|
|
526
|
+
if (a === b)
|
|
527
|
+
return true;
|
|
528
|
+
if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null) {
|
|
529
|
+
return false;
|
|
530
|
+
}
|
|
531
|
+
const aKeys = Object.keys(a);
|
|
532
|
+
const bKeys = Object.keys(b);
|
|
533
|
+
if (aKeys.length !== bKeys.length)
|
|
534
|
+
return false;
|
|
535
|
+
return aKeys.every(key => isEqual(a[key], b[key]));
|
|
536
|
+
}
|
|
537
|
+
export const isObject = (value) => value !== null && typeof value === 'object';
|
|
651
538
|
//# sourceMappingURL=Utils.js.map
|