@syncfusion/ej2-inputs 20.4.48 → 20.4.52

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.
@@ -424,8 +424,8 @@ var Input;
424
424
  * @param {any} element - Input element which is need to add.
425
425
  * @param {HTMLElement} container - The parent element which is need to get the label span to calculate width
426
426
  */
427
- function calculateWidth(element, container) {
428
- let elementWidth = element.clientWidth - parseInt(getComputedStyle(element, null).getPropertyValue('padding-left'));
427
+ function calculateWidth(element, container, moduleName) {
428
+ let elementWidth = moduleName === 'multiselect' ? element : element.clientWidth - parseInt(getComputedStyle(element, null).getPropertyValue('padding-left'));
429
429
  if (!isNullOrUndefined(container.getElementsByClassName('e-float-text-content')[0])) {
430
430
  if (container.getElementsByClassName('e-float-text-content')[0].classList.contains('e-float-text-overflow')) {
431
431
  container.getElementsByClassName('e-float-text-content')[0].classList.remove('e-float-text-overflow');
@@ -2910,7 +2910,7 @@ function removeMaskInputValues(event) {
2910
2910
  function maskInputKeyPressHandler(event) {
2911
2911
  if (this.mask && !this.readonly) {
2912
2912
  const oldValue = this.element.value;
2913
- if ((!event.ctrlKey) || (event.ctrlKey && event.code !== 'KeyA' && event.code !== 'KeyY'
2913
+ if (!(event.ctrlKey || event.metaKey) || ((event.ctrlKey || event.metaKey) && event.code !== 'KeyA' && event.code !== 'KeyY'
2914
2914
  && event.code !== 'KeyZ' && event.code !== 'KeyX' && event.code !== 'KeyC' && event.code !== 'KeyV')) {
2915
2915
  this.maskKeyPress = true;
2916
2916
  let key = event.key;
@@ -7903,7 +7903,12 @@ let Uploader = class Uploader extends Component {
7903
7903
  const inputElement = this.createElement('input', { attrs: { type: 'file' } });
7904
7904
  let index = 0;
7905
7905
  for (index; index < this.element.attributes.length; index++) {
7906
- inputElement.setAttribute(this.element.attributes[index].nodeName, this.element.attributes[index].nodeValue);
7906
+ if (this.element.attributes[index].nodeName !== 'id') {
7907
+ inputElement.setAttribute(this.element.attributes[index].nodeName, this.element.attributes[index].nodeValue);
7908
+ }
7909
+ else if (this.element.attributes[index].nodeName === 'id') {
7910
+ inputElement.setAttribute(this.element.attributes[index].nodeName, getUniqueID('uploader'));
7911
+ }
7907
7912
  inputElement.innerHTML = this.element.innerHTML;
7908
7913
  }
7909
7914
  if (!inputElement.hasAttribute('name')) {
@@ -9725,7 +9730,7 @@ let Uploader = class Uploader extends Component {
9725
9730
  for (let selectFileIndex = 0; selectFileIndex < selectedFiles.length; selectFileIndex++) {
9726
9731
  const selectedFileData = selectedFiles[selectFileIndex];
9727
9732
  for (let fileDataIndex = 0; fileDataIndex < this.filesData.length; fileDataIndex++) {
9728
- if (this.filesData[fileDataIndex].name === selectedFileData.name) {
9733
+ if (this.filesData[fileDataIndex].name === selectedFileData.name && this.filesData[fileDataIndex].status === selectedFileData.status) {
9729
9734
  matchFiles[matchFilesIndex] = this.filesData[fileDataIndex];
9730
9735
  ++matchFilesIndex;
9731
9736
  }
@@ -13627,7 +13632,8 @@ class SignatureBase extends Component {
13627
13632
  this.clearArray = [];
13628
13633
  this.isBlazor = false;
13629
13634
  this.isResponsive = false;
13630
- this.imageEditorPointsColl = [];
13635
+ this.signPointsColl = [];
13636
+ this.signRatioPointsColl = [];
13631
13637
  }
13632
13638
  /**
13633
13639
  * To Initialize the component rendering
@@ -13698,17 +13704,12 @@ class SignatureBase extends Component {
13698
13704
  }
13699
13705
  }
13700
13706
  // eslint-disable-next-line
13701
- mouseDownHandler(e, canvas, panStart, zoomState) {
13707
+ mouseDownHandler(e) {
13702
13708
  if (e.buttons === 1 || e.buttons === 2 || e.type === 'touchstart') {
13703
13709
  if (e.type === 'touchstart') {
13704
13710
  e.preventDefault();
13705
13711
  e.stopPropagation();
13706
13712
  }
13707
- if (canvas) {
13708
- this.canvasContext = canvas.getContext('2d');
13709
- this.scale = zoomState;
13710
- this.panStart = panStart;
13711
- }
13712
13713
  this.beginStroke(e);
13713
13714
  this.wireEvents();
13714
13715
  }
@@ -13743,6 +13744,11 @@ class SignatureBase extends Component {
13743
13744
  this.dotnetRef.invokeMethodAsync('TriggerEventAsync', 'mouseUp');
13744
13745
  }
13745
13746
  this.signatureValue = this.snapColl[this.incStep];
13747
+ for (let i = 0; i < this.signPointsColl.length; i++) {
13748
+ this.signRatioPointsColl.push({ x: (this.signPointsColl[i].x / this.canvasContext.canvas.width),
13749
+ y: (this.signPointsColl[i].y / this.canvasContext.canvas.height) });
13750
+ }
13751
+ this.signPointsColl = [];
13746
13752
  }
13747
13753
  keyboardHandler(e) {
13748
13754
  const args = { fileName: 'Signature', type: 'Png', cancel: false };
@@ -13779,13 +13785,23 @@ class SignatureBase extends Component {
13779
13785
  this.canvasContext.canvas.width = this.element.offsetWidth;
13780
13786
  this.canvasContext.canvas.height = this.element.offsetHeight;
13781
13787
  this.canvasContext.scale(1, 1);
13788
+ this.canvasContext.clearRect(0, 0, this.canvasContext.canvas.width, this.canvasContext.canvas.height);
13789
+ const pointSize = (this.minStrokeWidth + this.maxStrokeWidth) / 2;
13790
+ for (let i = 0; i < this.signRatioPointsColl.length; i++) {
13791
+ this.arcDraw((this.signRatioPointsColl[i].x * this.canvasContext.canvas.width), (this.signRatioPointsColl[i].y * this.canvasContext.canvas.height), pointSize);
13792
+ }
13793
+ this.signPointsColl = [];
13794
+ this.canvasContext.closePath();
13795
+ this.canvasContext.fill();
13796
+ }
13797
+ else {
13798
+ const restoreImg = new Image();
13799
+ restoreImg.src = this.snapColl[this.incStep];
13800
+ restoreImg.onload = () => {
13801
+ proxy.canvasContext.clearRect(0, 0, proxy.element.width, proxy.element.height);
13802
+ proxy.canvasContext.drawImage(restoreImg, 0, 0, proxy.element.width, proxy.element.height);
13803
+ };
13782
13804
  }
13783
- const restoreImg = new Image();
13784
- restoreImg.src = this.snapColl[this.incStep];
13785
- restoreImg.onload = () => {
13786
- proxy.canvasContext.clearRect(0, 0, proxy.element.width, proxy.element.height);
13787
- proxy.canvasContext.drawImage(restoreImg, 0, 0, proxy.element.width, proxy.element.height);
13788
- };
13789
13805
  }
13790
13806
  beginStroke(e) {
13791
13807
  this.refresh();
@@ -13825,34 +13841,10 @@ class SignatureBase extends Component {
13825
13841
  createPoint(e) {
13826
13842
  const rect = this.canvasContext.canvas.getBoundingClientRect();
13827
13843
  if (e.type === 'mousedown' || e.type === 'mousemove') {
13828
- // signature
13829
- if (this.canvasRatio === undefined) {
13830
- return this.point(e.clientX - rect.left, e.clientY - rect.top, new Date().getTime());
13831
- }
13832
- // image editor
13833
- else if (this.scale === 1) {
13834
- return this.point(((e.clientX - rect.left) * this.canvasRatio.width) / this.scale, ((e.clientY - rect.top) * this.canvasRatio.height) / this.scale, new Date().getTime());
13835
- }
13836
- else {
13837
- return this.point((((e.clientX - rect.left) + ((this.panStart.startX) / this.canvasRatio.width
13838
- * this.scale)) / this.scale) * this.canvasRatio.width, (((e.clientY - rect.top) + ((this.panStart.startY) / this.canvasRatio.height
13839
- * this.scale)) / this.scale) * this.canvasRatio.height, new Date().getTime());
13840
- }
13844
+ return this.point(e.clientX - rect.left, e.clientY - rect.top, new Date().getTime());
13841
13845
  }
13842
13846
  else {
13843
- // signature
13844
- if (this.canvasRatio === undefined) {
13845
- return this.point(e.touches[0].clientX - rect.left, e.touches[0].clientY - rect.top, new Date().getTime());
13846
- }
13847
- // image editor
13848
- else if (this.scale === 1) {
13849
- return this.point(((e.touches[0].clientX - rect.left) * this.canvasRatio.width) / this.scale, ((e.touches[0].clientY - rect.top) * this.canvasRatio.height) / this.scale, new Date().getTime());
13850
- }
13851
- else {
13852
- return this.point((e.touches[0].clientX - rect.left) + this.panStart.startX / (this.canvasRatio.width
13853
- * this.scale), (e.touches[0].clientY - rect.top) + this.panStart.startY / (this.canvasRatio.height
13854
- * this.scale), new Date().getTime());
13855
- }
13847
+ return this.point(e.touches[0].clientX - rect.left, e.touches[0].clientY - rect.top, new Date().getTime());
13856
13848
  }
13857
13849
  }
13858
13850
  /* Returns the current point corrdinates(x, y) and time.*/
@@ -13870,7 +13862,6 @@ class SignatureBase extends Component {
13870
13862
  const isLastPointTooClose = lastPoint ? this.distanceTo(lastPoint) <= this.minDistance : false;
13871
13863
  if (!lastPoint || !(lastPoint && isLastPointTooClose)) {
13872
13864
  points.push(point);
13873
- this.imageEditorPointsColl.push(point);
13874
13865
  if (points.length > 2) {
13875
13866
  if (points.length === 3) {
13876
13867
  points.unshift(points[0]);
@@ -13951,6 +13942,7 @@ class SignatureBase extends Component {
13951
13942
  this.isSignatureEmpty = false;
13952
13943
  }
13953
13944
  arcDraw(x, y, size) {
13945
+ this.signPointsColl.push({ x: x, y: y });
13954
13946
  const context = this.canvasContext;
13955
13947
  context.moveTo(x, y);
13956
13948
  context.arc(x, y, size, 0, 2 * Math.PI, false);
@@ -14151,6 +14143,7 @@ class SignatureBase extends Component {
14151
14143
  const args = { actionName: 'clear' };
14152
14144
  this.canvasContext.clearRect(0, 0, this.canvasContext.canvas.width, this.canvasContext.canvas.height);
14153
14145
  this.refresh();
14146
+ this.signRatioPointsColl = [];
14154
14147
  this.updateSnapCollection(true);
14155
14148
  this.isSignatureEmpty = true;
14156
14149
  if (!this.isBlazor) {