@syncfusion/ej2-image-editor 20.4.38 → 20.4.40

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 20.4.38
3
+ * version : 20.4.40
4
4
  * Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "_from": "@syncfusion/ej2-image-editor@*",
3
- "_id": "@syncfusion/ej2-image-editor@20.5.2",
3
+ "_id": "@syncfusion/ej2-image-editor@20.4.38",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-5ifN1vR2eDXYloC2I91m7z6BGK/5hOKQxX9FjA2AGnu/EMCEuRd46k/G6v97y9G2tFfK06NzJxTBftRzJoVjbQ==",
5
+ "_integrity": "sha512-qmD+rNyurwGSaTsEg87SGQDiy4gvGYVwnXVxEyuY5sjSSHXmRV21J33nFIOfrzx6an+GxUJfUwQ/0NPIFCnKwA==",
6
6
  "_location": "/@syncfusion/ej2-image-editor",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -23,8 +23,8 @@
23
23
  "/@syncfusion/ej2-react-image-editor",
24
24
  "/@syncfusion/ej2-vue-image-editor"
25
25
  ],
26
- "_resolved": "https://nexus.syncfusion.com/repository/ej2-release/@syncfusion/ej2-image-editor/-/ej2-image-editor-20.5.2.tgz",
27
- "_shasum": "52c3e2411c696fa6b06398a8651f55b6eb18ef8c",
26
+ "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-image-editor/-/ej2-image-editor-20.4.38.tgz",
27
+ "_shasum": "0e045a664e6e4c477c8dd1b736c36df40153ebcd",
28
28
  "_spec": "@syncfusion/ej2-image-editor@*",
29
29
  "_where": "/jenkins/workspace/ease-automation_release_19.1.0.1/packages/included",
30
30
  "author": {
@@ -32,12 +32,12 @@
32
32
  },
33
33
  "bundleDependencies": false,
34
34
  "dependencies": {
35
- "@syncfusion/ej2-base": "~20.4.38",
36
- "@syncfusion/ej2-buttons": "~20.4.38",
37
- "@syncfusion/ej2-inputs": "~20.4.38",
38
- "@syncfusion/ej2-navigations": "~20.4.38",
39
- "@syncfusion/ej2-popups": "~20.4.38",
40
- "@syncfusion/ej2-splitbuttons": "~20.4.38"
35
+ "@syncfusion/ej2-base": "~20.4.40",
36
+ "@syncfusion/ej2-buttons": "~20.4.40",
37
+ "@syncfusion/ej2-inputs": "~20.4.40",
38
+ "@syncfusion/ej2-navigations": "~20.4.40",
39
+ "@syncfusion/ej2-popups": "~20.4.40",
40
+ "@syncfusion/ej2-splitbuttons": "~20.4.40"
41
41
  },
42
42
  "deprecated": false,
43
43
  "description": "Essential JS 2 ImageEditor",
@@ -67,6 +67,7 @@
67
67
  "url": "https://github.com/syncfusion/ej2-javascript-ui-controls/tree/master/controls/imageeditor"
68
68
  },
69
69
  "typings": "index.d.ts",
70
- "version": "20.4.38",
71
- "sideEffects": false
70
+ "version": "20.4.40",
71
+ "sideEffects": false,
72
+ "homepage": "https://www.syncfusion.com/javascript-ui-controls"
72
73
  }
@@ -1,5 +1,5 @@
1
- import { NotifyPropertyChanges, INotifyPropertyChanged, Property, addClass, removeClass, extend } from '@syncfusion/ej2-base';
2
- import {ImageFinetuneValue,Theme,ImageEditorCommands,SaveEventArgs,BeforeSaveEventArgs,ZoomEventArgs,PanEventArgs,CropEventArgs,RotateEventArgs,FlipEventArgs,ShapeChangeEventArgs,ToolbarEventArgs,ImageFilterEventArgs,FinetuneEventArgs} from "./image-editor";
1
+ import { NotifyPropertyChanges, INotifyPropertyChanged, Property, addClass, removeClass, extend } from '@syncfusion/ej2-base';
2
+ import {ImageFinetuneValue,Theme,ImageEditorCommands,SaveEventArgs,BeforeSaveEventArgs,ZoomEventArgs,PanEventArgs,CropEventArgs,RotateEventArgs,FlipEventArgs,ShapeChangeEventArgs,FileOpenEventArgs,ToolbarEventArgs,ImageFilterEventArgs,FinetuneEventArgs} from "./image-editor";
3
3
 
4
4
  /**
5
5
  * Interface for a class FinetuneSettings
@@ -8,42 +8,49 @@ export interface FinetuneSettingsModel {
8
8
 
9
9
  /**
10
10
  * Specifies the brightness level of image.
11
+ *
11
12
  * @default null
12
13
  */
13
14
  brightness?: ImageFinetuneValue;
14
15
 
15
16
  /**
16
17
  * Specifies the contrast level image.
18
+ *
17
19
  * @default null
18
20
  */
19
21
  contrast?: ImageFinetuneValue;
20
22
 
21
23
  /**
22
24
  * Specifies the hue level image.
25
+ *
23
26
  * @default null
24
27
  */
25
28
  hue?: ImageFinetuneValue;
26
29
 
27
30
  /**
28
31
  * Specifies the saturation level image.
32
+ *
29
33
  * @default null
30
34
  */
31
35
  saturation?: ImageFinetuneValue;
32
36
 
33
37
  /**
34
38
  * Specifies the exposure level image.
39
+ *
35
40
  * @default null
36
41
  */
37
42
  exposure?: ImageFinetuneValue;
38
43
 
39
44
  /**
40
45
  * Specifies the opacity level image.
46
+ *
41
47
  * @default null
42
48
  */
43
49
  opacity?: ImageFinetuneValue;
44
50
 
45
51
  /**
46
52
  * Specifies the blur level image.
53
+ *
47
54
  * @default null
48
55
  */
49
56
  blur?: ImageFinetuneValue;
@@ -57,6 +64,7 @@ export interface ImageEditorModel {
57
64
 
58
65
  /**
59
66
  * Defines class/multiple classes separated by a space for customizing Image Editor UI.
67
+ *
60
68
  * @default ''
61
69
  ```html
62
70
  * <div id='imageeditor'></div>
@@ -72,12 +80,14 @@ export interface ImageEditorModel {
72
80
 
73
81
  /**
74
82
  * Specifies whether the Image Editor is disabled.
83
+ *
75
84
  * @default false
76
85
  */
77
86
  disabled?: boolean;
78
87
 
79
88
  /**
80
89
  * Specifies the height of the Image Editor.
90
+ *
81
91
  * @default '100%'
82
92
  */
83
93
  height?: string;
@@ -150,6 +160,7 @@ export interface ImageEditorModel {
150
160
 
151
161
  /**
152
162
  * Specifies the width of the Image Editor.
163
+ *
153
164
  * @default '100%'
154
165
  */
155
166
  width?: string;
@@ -335,7 +346,7 @@ export interface ImageEditorModel {
335
346
  *
336
347
  * @event fileOpened
337
348
  */
338
- fileOpened?: EmitType<OpenEventArgs>
349
+ fileOpened?: EmitType<FileOpenEventArgs>
339
350
 
340
351
  /**
341
352
  * Triggers once an image is saved.
@@ -2,7 +2,6 @@ import { INotifyPropertyChanged } from '@syncfusion/ej2-base';
2
2
  import { EmitType } from '@syncfusion/ej2-base';
3
3
  import { SignatureBase } from '@syncfusion/ej2-inputs';
4
4
  import { ItemModel, ClickEventArgs } from '@syncfusion/ej2-navigations';
5
- import { OpenEventArgs } from '@syncfusion/ej2-popups';
6
5
  import { ChildProperty } from '@syncfusion/ej2-base';
7
6
  import { ImageEditorModel, FinetuneSettingsModel } from './image-editor-model';
8
7
  /**
@@ -10,17 +9,20 @@ import { ImageEditorModel, FinetuneSettingsModel } from './image-editor-model';
10
9
  */
11
10
  export interface ImageFinetuneValue {
12
11
  /**
13
- * Specifies the minimum value of finetune option.
14
- * @default null
15
- */
12
+ * Specifies the minimum value of finetune option.
13
+ *
14
+ * @default null
15
+ */
16
16
  min: number;
17
17
  /**
18
18
  * Specifies the maximum value of finetune option.
19
+ *
19
20
  * @default null
20
21
  */
21
22
  max: number;
22
23
  /**
23
24
  * Specifies the default value of finetune option.
25
+ *
24
26
  * @default null
25
27
  */
26
28
  defaultValue: number;
@@ -31,36 +33,43 @@ export interface ImageFinetuneValue {
31
33
  export declare class FinetuneSettings extends ChildProperty<FinetuneSettings> {
32
34
  /**
33
35
  * Specifies the brightness level of image.
36
+ *
34
37
  * @default null
35
38
  */
36
39
  brightness: ImageFinetuneValue;
37
40
  /**
38
41
  * Specifies the contrast level image.
42
+ *
39
43
  * @default null
40
44
  */
41
45
  contrast: ImageFinetuneValue;
42
46
  /**
43
47
  * Specifies the hue level image.
48
+ *
44
49
  * @default null
45
50
  */
46
51
  hue: ImageFinetuneValue;
47
52
  /**
48
53
  * Specifies the saturation level image.
54
+ *
49
55
  * @default null
50
56
  */
51
57
  saturation: ImageFinetuneValue;
52
58
  /**
53
- * Specifies the exposure level image.
54
- * @default null
55
- */
59
+ * Specifies the exposure level image.
60
+ *
61
+ * @default null
62
+ */
56
63
  exposure: ImageFinetuneValue;
57
64
  /**
58
65
  * Specifies the opacity level image.
66
+ *
59
67
  * @default null
60
68
  */
61
69
  opacity: ImageFinetuneValue;
62
70
  /**
63
71
  * Specifies the blur level image.
72
+ *
64
73
  * @default null
65
74
  */
66
75
  blur: ImageFinetuneValue;
@@ -163,8 +172,11 @@ export declare class ImageEditor extends SignatureBase implements INotifyPropert
163
172
  private tempBWFilter;
164
173
  private isBrightnessAdjusted;
165
174
  private isInitialLoading;
175
+ private imageFileName;
176
+ private imageFileType;
166
177
  /**
167
178
  * Defines class/multiple classes separated by a space for customizing Image Editor UI.
179
+ *
168
180
  * @default ''
169
181
  ```html
170
182
  * <div id='imageeditor'></div>
@@ -179,11 +191,13 @@ export declare class ImageEditor extends SignatureBase implements INotifyPropert
179
191
  cssClass: string;
180
192
  /**
181
193
  * Specifies whether the Image Editor is disabled.
194
+ *
182
195
  * @default false
183
196
  */
184
197
  disabled: boolean;
185
198
  /**
186
199
  * Specifies the height of the Image Editor.
200
+ *
187
201
  * @default '100%'
188
202
  */
189
203
  height: string;
@@ -251,6 +265,7 @@ export declare class ImageEditor extends SignatureBase implements INotifyPropert
251
265
  toolbarTemplate: string;
252
266
  /**
253
267
  * Specifies the width of the Image Editor.
268
+ *
254
269
  * @default '100%'
255
270
  */
256
271
  width: string;
@@ -414,7 +429,7 @@ export declare class ImageEditor extends SignatureBase implements INotifyPropert
414
429
  *
415
430
  * @event fileOpened
416
431
  */
417
- fileOpened: EmitType<OpenEventArgs>;
432
+ fileOpened: EmitType<FileOpenEventArgs>;
418
433
  /**
419
434
  * Triggers once an image is saved.
420
435
  *
@@ -1212,6 +1227,19 @@ export interface ToolbarEventArgs {
1212
1227
  */
1213
1228
  toolbarItems?: (string | ItemModel)[];
1214
1229
  }
1230
+ /**
1231
+ * Interface for saving the canvas as image.
1232
+ */
1233
+ export interface FileOpenEventArgs {
1234
+ /**
1235
+ * Specifies the file name for an image.
1236
+ */
1237
+ fileName: string;
1238
+ /**
1239
+ * Returns the file type for an image.
1240
+ */
1241
+ fileType: FileType;
1242
+ }
1215
1243
  /**
1216
1244
  * Interface for saving the canvas as image.
1217
1245
  */
@@ -148,6 +148,7 @@ var ImageEditor = /** @class */ (function (_super) {
148
148
  _this.tempBWFilter = false;
149
149
  _this.isBrightnessAdjusted = false;
150
150
  _this.isInitialLoading = false;
151
+ _this.imageFileName = '';
151
152
  return _this;
152
153
  }
153
154
  ImageEditor_1 = ImageEditor;
@@ -3347,6 +3348,7 @@ var ImageEditor = /** @class */ (function (_super) {
3347
3348
  ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
3348
3349
  };
3349
3350
  ImageEditor.prototype.updateCanvas = function () {
3351
+ var fileOpened = { fileName: this.imageFileName, fileType: this.imageFileType };
3350
3352
  this.lastX = this.baseImg.width / 2;
3351
3353
  this.lastY = this.baseImg.height / 2;
3352
3354
  var wrapperWidth;
@@ -3411,7 +3413,7 @@ var ImageEditor = /** @class */ (function (_super) {
3411
3413
  if (this.disabled) {
3412
3414
  this.element.setAttribute('class', 'e-disabled');
3413
3415
  }
3414
- this.trigger('fileOpened');
3416
+ this.trigger('fileOpened', fileOpened);
3415
3417
  };
3416
3418
  ImageEditor.prototype.imageOnLoad = function (src) {
3417
3419
  var _this = this;
@@ -3615,6 +3617,18 @@ var ImageEditor = /** @class */ (function (_super) {
3615
3617
  }
3616
3618
  };
3617
3619
  ImageEditor.prototype.fileSelect = function (inputElement, args) {
3620
+ this.imageFileName = inputElement.value.split('\\')[inputElement.value.split('\\').length - 1];
3621
+ this.imageFileName = this.imageFileName.split('.')[0];
3622
+ var fileType = inputElement.value.split('.');
3623
+ if (fileType[fileType.length - 1].toLowerCase() === 'jpg' || fileType[fileType.length - 1].toLowerCase() === 'jpeg') {
3624
+ this.imageFileType = 'Jpeg';
3625
+ }
3626
+ else if (fileType[fileType.length - 1].toLowerCase() === 'png') {
3627
+ this.imageFileType = 'Png';
3628
+ }
3629
+ else if (fileType[fileType.length - 1].toLowerCase() === 'svg') {
3630
+ this.imageFileType = 'Svg';
3631
+ }
3618
3632
  showSpinner(this.element);
3619
3633
  this.element.style.opacity = '0.5';
3620
3634
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
@@ -8379,7 +8393,6 @@ var ImageEditor = /** @class */ (function (_super) {
8379
8393
  var heightRatio = void 0;
8380
8394
  var imgData = void 0;
8381
8395
  var zoomedRotate = false;
8382
- var factor = this.factor;
8383
8396
  if (this.factor === 1) {
8384
8397
  imgData = this.lowerContext.getImageData(0, 0, this.lowerCanvas.width, this.lowerCanvas.height);
8385
8398
  widthRatio = this.lowerCanvas.width / parseInt(this.lowerCanvas.style.maxWidth, 10);
@@ -8681,9 +8694,23 @@ var ImageEditor = /** @class */ (function (_super) {
8681
8694
  this.imgDataColl = [];
8682
8695
  var type = typeof (data);
8683
8696
  if (type === 'string') {
8697
+ var fileName = data.split('.');
8698
+ if (fileName[fileName.length - 1].toLowerCase() === 'jpg' || fileName[fileName.length - 1].toLowerCase() === 'jpeg') {
8699
+ this.imageFileType = 'Jpeg';
8700
+ }
8701
+ else if (fileName[fileName.length - 1].toLowerCase() === 'png') {
8702
+ this.imageFileType = 'Png';
8703
+ }
8704
+ else if (fileName[fileName.length - 1].toLowerCase() === 'svg') {
8705
+ this.imageFileType = 'Svg';
8706
+ }
8707
+ fileName = fileName[fileName.length - 2].split('/');
8708
+ this.imageFileName = fileName[fileName.length - 1];
8684
8709
  this.imageOnLoad(data);
8685
8710
  }
8686
8711
  else {
8712
+ this.imageFileName = 'ImageEditor';
8713
+ this.imageFileType = 'Jpeg';
8687
8714
  var tempFilter = this.lowerContext.filter;
8688
8715
  this.lowerCanvas = document.querySelector('#' + this.element.id + '_lowerCanvas');
8689
8716
  this.upperCanvas = document.querySelector('#' + this.element.id + '_upperCanvas');
@@ -8787,6 +8814,8 @@ var ImageEditor = /** @class */ (function (_super) {
8787
8814
  this.tempObjColl = undefined;
8788
8815
  this.adjustmentLevel = { brightness: 0, contrast: 0, hue: 0, opacity: 100, saturation: 0, blur: 0, exposure: 0, sharpen: false, bw: false };
8789
8816
  this.tempAdjustmentLevel = { brightness: 0, contrast: 0, hue: 0, opacity: 100, saturation: 0, blur: 0, exposure: 0, sharpen: false, bw: false };
8817
+ this.imageFileName = '';
8818
+ this.imageFileType = undefined;
8790
8819
  this.canvasFilter = this.currentFilter = this.tempAdjustmentValue = '';
8791
8820
  this.lowerContext.filter = this.initialAdjustmentValue = this.adjustmentValue = 'brightness(' + 1 + ') ' + 'contrast(' + 100
8792
8821
  + '%) ' + 'hue-rotate(' + 0 + 'deg) ' +
@@ -8908,22 +8937,23 @@ var ImageEditor = /** @class */ (function (_super) {
8908
8937
  }
8909
8938
  type = type ? type : 'Png';
8910
8939
  this.redrawActObj();
8911
- var beforeSave = { cancel: false, fileName: fileName ? fileName : 'ImageEditor', fileType: type };
8912
- var saved_1 = { fileName: fileName ? fileName : 'ImageEditor', fileType: type };
8940
+ fileName = fileName ? fileName : this.imageFileName;
8941
+ var beforeSave = { cancel: false, fileName: fileName, fileType: type };
8942
+ var saved_1 = { fileName: fileName ? fileName : this.imageFileName, fileType: type };
8913
8943
  this.trigger('beforeSave', beforeSave, function (observableSaveArgs) {
8914
8944
  if (!observableSaveArgs.cancel) {
8915
8945
  _this.currObjType.isSave = true;
8916
8946
  fileName = observableSaveArgs.fileName ? observableSaveArgs.fileName : fileName;
8917
8947
  if (type.toLowerCase() === 'svg') {
8918
- fileName = fileName || 'ImageEditor';
8948
+ fileName = fileName || _this.imageFileName;
8919
8949
  _this.toSVGImg(fileName);
8920
8950
  }
8921
8951
  else if (type.toLowerCase() === 'jpeg') {
8922
- fileName = fileName || 'ImageEditor';
8952
+ fileName = fileName || _this.imageFileName;
8923
8953
  _this.toBlobFn(fileName, type.toLowerCase());
8924
8954
  }
8925
8955
  else {
8926
- fileName = fileName || 'ImageEditor';
8956
+ fileName = fileName || _this.imageFileName;
8927
8957
  _this.toBlobFn(fileName, type.toLowerCase());
8928
8958
  }
8929
8959
  _this.trigger('saved', saved_1);
@@ -9459,7 +9489,8 @@ var ImageEditor = /** @class */ (function (_super) {
9459
9489
  this.initialAdjustmentValue = 'brightness(1) contrast(100%) hue-rotate(0deg) saturate(100%) opacity(1) blur(0px) sepia(0%) grayscale(0%) invert(0%)';
9460
9490
  }
9461
9491
  this.lowerContext.filter = this.initialAdjustmentValue;
9462
- this.setFilter(filterOption.toString());
9492
+ var filterValue = filterOption.split(' ');
9493
+ this.setFilter(filterValue.join('').toLowerCase());
9463
9494
  };
9464
9495
  /**
9465
9496
  * To apply the filters to an image