@progress/kendo-angular-inputs 9.0.0-next.202203230846 → 9.0.0-next.202204011342

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.
@@ -4,11 +4,11 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { Component, EventEmitter, HostBinding, HostListener, Inject, Input, Optional, Output, ViewChild, forwardRef, isDevMode } from '@angular/core';
6
6
  import { NG_VALIDATORS, NG_VALUE_ACCESSOR, NgControl } from '@angular/forms';
7
+ import { guid, hasObservers, isChanged, KendoInput } from '@progress/kendo-angular-common';
7
8
  import { RTL } from '@progress/kendo-angular-l10n';
8
9
  import { validatePackage } from '@progress/kendo-licensing';
9
10
  import { packageMetadata } from '../package-metadata';
10
11
  import { MaskingService } from './masking.service';
11
- import { isChanged, anyChanged, guid, hasObservers, KendoInput } from '@progress/kendo-angular-common';
12
12
  import { invokeElementMethod } from '../common/dom-utils';
13
13
  import { requiresZoneOnBlur, isPresent, getStylingClasses } from '../common/utils';
14
14
  import * as i0 from "@angular/core";
@@ -58,7 +58,6 @@ export class MaskedTextBoxComponent {
58
58
  * Determines whether the MaskedTextBox is in its read-only state ([see example]({% slug readonly_maskedtextbox %})).
59
59
  */
60
60
  this.readonly = false;
61
- this.hostClasses = true;
62
61
  /**
63
62
  * Represents a prompt character for the masked value.
64
63
  * @default `_`
@@ -134,6 +133,7 @@ export class MaskedTextBoxComponent {
134
133
  * Fires each time the value changes.
135
134
  */
136
135
  this.valueChange = new EventEmitter();
136
+ this.hostClasses = true;
137
137
  this.focusClick = false;
138
138
  this.defaultRules = {
139
139
  "#": /[\d\s\+\-]/,
@@ -251,18 +251,15 @@ export class MaskedTextBoxComponent {
251
251
  get fillMode() {
252
252
  return this._fillMode;
253
253
  }
254
- get hostDisabledClass() {
255
- return this.disabled;
256
- }
257
254
  /**
258
255
  * Exposes the RegExp-based mask validation array ([see example]({% slug masks_maskedtextbox %})).
259
256
  */
260
- get rules() {
261
- return this._rules || this.defaultRules;
262
- }
263
257
  set rules(value) {
264
258
  this._rules = Object.assign({}, this.defaultRules, value);
265
259
  }
260
+ get rules() {
261
+ return this._rules || this.defaultRules;
262
+ }
266
263
  /**
267
264
  * @hidden
268
265
  */
@@ -272,6 +269,9 @@ export class MaskedTextBoxComponent {
272
269
  get tabIndex() {
273
270
  return this.tabindex;
274
271
  }
272
+ get hostDisabledClass() {
273
+ return this.disabled;
274
+ }
275
275
  ngOnInit() {
276
276
  if (this.hostElement) {
277
277
  this.renderer.removeAttribute(this.hostElement.nativeElement, "tabindex");
@@ -348,7 +348,7 @@ export class MaskedTextBoxComponent {
348
348
  const value = e.target.value;
349
349
  const [start, end] = this.selection;
350
350
  if (!this.mask) {
351
- this.updateValue(value);
351
+ this.updateValueWithEvents(value);
352
352
  this.isPasted = false;
353
353
  return;
354
354
  }
@@ -360,10 +360,10 @@ export class MaskedTextBoxComponent {
360
360
  result = this.service.maskInRange(value.slice(start, to), this.maskedValue, start, end);
361
361
  }
362
362
  else {
363
- result = this.service.maskInput(value, this.maskedValue, e.target.selectionStart);
363
+ result = this.service.maskInput(value, this.maskedValue || '', e.target.selectionStart);
364
364
  }
365
365
  this.updateInput(result.value, result.selection);
366
- this.updateValue(result.value);
366
+ this.updateValueWithEvents(result.value);
367
367
  }
368
368
  /**
369
369
  * @hidden
@@ -378,20 +378,13 @@ export class MaskedTextBoxComponent {
378
378
  }
379
379
  const next = this.extractChanges(changes);
380
380
  this.updateService(next);
381
- if (isChanged('value', changes)) {
382
- const maskedValue = this.service.maskRaw(this.value);
383
- if (maskedValue !== this.maskedValue) {
384
- this.updateInput(maskedValue);
385
- }
386
- }
387
- else if (anyChanged(['promptPlaceholder', 'includeLiterals'], changes)) {
381
+ const maskedValue = this.service.maskRaw(this.value);
382
+ this.updateInput(maskedValue, null, true);
383
+ if (changes.includeLiterals || isChanged('promptPlaceholder', changes)) {
388
384
  resolvedPromise.then(() => {
389
- this.updateValue(this.maskedValue);
385
+ this.updateValueWithEvents(this.maskedValue);
390
386
  });
391
387
  }
392
- else {
393
- this.updateInput(this.service.maskRaw(this.value));
394
- }
395
388
  }
396
389
  /**
397
390
  * @hidden
@@ -400,6 +393,9 @@ export class MaskedTextBoxComponent {
400
393
  writeValue(value) {
401
394
  this.value = this.normalizeValue(value);
402
395
  this.updateInput(this.service.maskRaw(this.value));
396
+ if (this.includeLiterals) {
397
+ this.updateValue(this.maskedValue);
398
+ }
403
399
  }
404
400
  /**
405
401
  * @hidden
@@ -450,17 +446,25 @@ export class MaskedTextBoxComponent {
450
446
  /**
451
447
  * @hidden
452
448
  */
453
- updateValue(maskedValue) {
454
- if (this.mask && !this.service.validationValue(maskedValue)) {
449
+ updateValueWithEvents(maskedValue) {
450
+ this.updateValue(maskedValue);
451
+ if (hasObservers(this.valueChange)) {
452
+ this.valueChange.emit(this.value);
453
+ }
454
+ }
455
+ updateValue(value) {
456
+ if (this.mask && !this.service.validationValue(value) && !this.includeLiterals) {
455
457
  this.value = '';
456
458
  }
457
459
  else {
458
- this.value = this.service.rawValue(maskedValue);
460
+ this.value = this.service.rawValue(value);
459
461
  }
460
462
  this.onChange(this.value);
461
- this.valueChange.emit(this.value);
462
463
  }
463
- updateInput(maskedValue = '', selection) {
464
+ updateInput(maskedValue = '', selection, isFromOnChanges) {
465
+ if (isFromOnChanges && maskedValue === this.maskedValue) {
466
+ return;
467
+ }
464
468
  this.maskedValue = maskedValue;
465
469
  const value = this.maskOnFocus && !this.focused && this.emptyMask ? '' : maskedValue;
466
470
  this.renderer.setProperty(this.input.nativeElement, "value", value);
@@ -639,18 +643,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
639
643
  type: Input
640
644
  }], fillMode: [{
641
645
  type: Input
642
- }], direction: [{
643
- type: HostBinding,
644
- args: ['attr.dir']
645
- }], hostClasses: [{
646
- type: HostBinding,
647
- args: ['class.k-input']
648
- }, {
649
- type: HostBinding,
650
- args: ['class.k-maskedtextbox']
651
- }], hostDisabledClass: [{
652
- type: HostBinding,
653
- args: ['class.k-disabled']
654
646
  }], mask: [{
655
647
  type: Input
656
648
  }], value: [{
@@ -679,6 +671,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
679
671
  args: ['blur']
680
672
  }], valueChange: [{
681
673
  type: Output
674
+ }], direction: [{
675
+ type: HostBinding,
676
+ args: ['attr.dir']
677
+ }], hostClasses: [{
678
+ type: HostBinding,
679
+ args: ['class.k-input']
680
+ }, {
681
+ type: HostBinding,
682
+ args: ['class.k-maskedtextbox']
683
+ }], hostDisabledClass: [{
684
+ type: HostBinding,
685
+ args: ['class.k-disabled']
682
686
  }], input: [{
683
687
  type: ViewChild,
684
688
  args: ['input', { static: true }]
@@ -9,7 +9,7 @@ export const packageMetadata = {
9
9
  name: '@progress/kendo-angular-inputs',
10
10
  productName: 'Kendo UI for Angular',
11
11
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
12
- publishDate: 1648025032,
12
+ publishDate: 1648820374,
13
13
  version: '',
14
14
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
15
15
  };
@@ -221,9 +221,13 @@ export class RangeSliderComponent extends SliderBase {
221
221
  const lastCoords = this.draggedHandle.getBoundingClientRect();
222
222
  this.lastHandlePosition = { x: lastCoords.left, y: lastCoords.top };
223
223
  this.dragging = { value: true, target };
224
- const left = args.pageX < this.lastHandlePosition.x;
225
- const right = args.pageX > this.lastHandlePosition.x;
226
- const up = args.pageY > this.lastHandlePosition.y;
224
+ const mousePos = {
225
+ x: (args.pageX - 0.5) - (lastCoords.width / 2),
226
+ y: (args.pageY - (lastCoords.width / 2))
227
+ };
228
+ const left = mousePos.x < this.lastHandlePosition.x;
229
+ const right = mousePos.x > this.lastHandlePosition.x;
230
+ const up = mousePos.y > this.lastHandlePosition.y;
227
231
  const moveStartHandle = () => this.changeValue([eventValue(args, this.track.nativeElement, this.getProps()), this.value[1]]);
228
232
  const moveEndHandle = () => this.changeValue([this.value[0], eventValue(args, this.track.nativeElement, this.getProps())]);
229
233
  const moveBothHandles = () => this.changeValue([eventValue(args, this.track.nativeElement, this.getProps()), eventValue(args, this.track.nativeElement, this.getProps())]);
@@ -231,8 +235,8 @@ export class RangeSliderComponent extends SliderBase {
231
235
  const vertical = this.vertical;
232
236
  const horizontal = !vertical;
233
237
  const forward = (vertical && up) || (this.reverse ? horizontal && right : horizontal && left);
234
- // const forward = (this.reverse ? (!this.vertical && !left) : (!this.vertical && left)) || (this.vertical && up);
235
- if (this.value[0] === this.value[1]) {
238
+ const incorrectValueState = this.value[0] > this.value[1];
239
+ if (this.value[0] === this.value[1] || incorrectValueState) {
236
240
  if (forward) {
237
241
  // eslint-disable-next-line no-unused-expressions
238
242
  activeStartHandle ? moveStartHandle() : moveBothHandles();
@@ -519,7 +519,7 @@ const packageMetadata = {
519
519
  name: '@progress/kendo-angular-inputs',
520
520
  productName: 'Kendo UI for Angular',
521
521
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
522
- publishDate: 1648025032,
522
+ publishDate: 1648820374,
523
523
  version: '',
524
524
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
525
525
  };
@@ -1830,9 +1830,13 @@ class RangeSliderComponent extends SliderBase {
1830
1830
  const lastCoords = this.draggedHandle.getBoundingClientRect();
1831
1831
  this.lastHandlePosition = { x: lastCoords.left, y: lastCoords.top };
1832
1832
  this.dragging = { value: true, target };
1833
- const left = args.pageX < this.lastHandlePosition.x;
1834
- const right = args.pageX > this.lastHandlePosition.x;
1835
- const up = args.pageY > this.lastHandlePosition.y;
1833
+ const mousePos = {
1834
+ x: (args.pageX - 0.5) - (lastCoords.width / 2),
1835
+ y: (args.pageY - (lastCoords.width / 2))
1836
+ };
1837
+ const left = mousePos.x < this.lastHandlePosition.x;
1838
+ const right = mousePos.x > this.lastHandlePosition.x;
1839
+ const up = mousePos.y > this.lastHandlePosition.y;
1836
1840
  const moveStartHandle = () => this.changeValue([eventValue(args, this.track.nativeElement, this.getProps()), this.value[1]]);
1837
1841
  const moveEndHandle = () => this.changeValue([this.value[0], eventValue(args, this.track.nativeElement, this.getProps())]);
1838
1842
  const moveBothHandles = () => this.changeValue([eventValue(args, this.track.nativeElement, this.getProps()), eventValue(args, this.track.nativeElement, this.getProps())]);
@@ -1840,8 +1844,8 @@ class RangeSliderComponent extends SliderBase {
1840
1844
  const vertical = this.vertical;
1841
1845
  const horizontal = !vertical;
1842
1846
  const forward = (vertical && up) || (this.reverse ? horizontal && right : horizontal && left);
1843
- // const forward = (this.reverse ? (!this.vertical && !left) : (!this.vertical && left)) || (this.vertical && up);
1844
- if (this.value[0] === this.value[1]) {
1847
+ const incorrectValueState = this.value[0] > this.value[1];
1848
+ if (this.value[0] === this.value[1] || incorrectValueState) {
1845
1849
  if (forward) {
1846
1850
  // eslint-disable-next-line no-unused-expressions
1847
1851
  activeStartHandle ? moveStartHandle() : moveBothHandles();
@@ -4882,7 +4886,6 @@ class MaskedTextBoxComponent {
4882
4886
  * Determines whether the MaskedTextBox is in its read-only state ([see example]({% slug readonly_maskedtextbox %})).
4883
4887
  */
4884
4888
  this.readonly = false;
4885
- this.hostClasses = true;
4886
4889
  /**
4887
4890
  * Represents a prompt character for the masked value.
4888
4891
  * @default `_`
@@ -4958,6 +4961,7 @@ class MaskedTextBoxComponent {
4958
4961
  * Fires each time the value changes.
4959
4962
  */
4960
4963
  this.valueChange = new EventEmitter();
4964
+ this.hostClasses = true;
4961
4965
  this.focusClick = false;
4962
4966
  this.defaultRules = {
4963
4967
  "#": /[\d\s\+\-]/,
@@ -5075,18 +5079,15 @@ class MaskedTextBoxComponent {
5075
5079
  get fillMode() {
5076
5080
  return this._fillMode;
5077
5081
  }
5078
- get hostDisabledClass() {
5079
- return this.disabled;
5080
- }
5081
5082
  /**
5082
5083
  * Exposes the RegExp-based mask validation array ([see example]({% slug masks_maskedtextbox %})).
5083
5084
  */
5084
- get rules() {
5085
- return this._rules || this.defaultRules;
5086
- }
5087
5085
  set rules(value) {
5088
5086
  this._rules = Object.assign({}, this.defaultRules, value);
5089
5087
  }
5088
+ get rules() {
5089
+ return this._rules || this.defaultRules;
5090
+ }
5090
5091
  /**
5091
5092
  * @hidden
5092
5093
  */
@@ -5096,6 +5097,9 @@ class MaskedTextBoxComponent {
5096
5097
  get tabIndex() {
5097
5098
  return this.tabindex;
5098
5099
  }
5100
+ get hostDisabledClass() {
5101
+ return this.disabled;
5102
+ }
5099
5103
  ngOnInit() {
5100
5104
  if (this.hostElement) {
5101
5105
  this.renderer.removeAttribute(this.hostElement.nativeElement, "tabindex");
@@ -5172,7 +5176,7 @@ class MaskedTextBoxComponent {
5172
5176
  const value = e.target.value;
5173
5177
  const [start, end] = this.selection;
5174
5178
  if (!this.mask) {
5175
- this.updateValue(value);
5179
+ this.updateValueWithEvents(value);
5176
5180
  this.isPasted = false;
5177
5181
  return;
5178
5182
  }
@@ -5184,10 +5188,10 @@ class MaskedTextBoxComponent {
5184
5188
  result = this.service.maskInRange(value.slice(start, to), this.maskedValue, start, end);
5185
5189
  }
5186
5190
  else {
5187
- result = this.service.maskInput(value, this.maskedValue, e.target.selectionStart);
5191
+ result = this.service.maskInput(value, this.maskedValue || '', e.target.selectionStart);
5188
5192
  }
5189
5193
  this.updateInput(result.value, result.selection);
5190
- this.updateValue(result.value);
5194
+ this.updateValueWithEvents(result.value);
5191
5195
  }
5192
5196
  /**
5193
5197
  * @hidden
@@ -5202,20 +5206,13 @@ class MaskedTextBoxComponent {
5202
5206
  }
5203
5207
  const next = this.extractChanges(changes);
5204
5208
  this.updateService(next);
5205
- if (isChanged('value', changes)) {
5206
- const maskedValue = this.service.maskRaw(this.value);
5207
- if (maskedValue !== this.maskedValue) {
5208
- this.updateInput(maskedValue);
5209
- }
5210
- }
5211
- else if (anyChanged(['promptPlaceholder', 'includeLiterals'], changes)) {
5209
+ const maskedValue = this.service.maskRaw(this.value);
5210
+ this.updateInput(maskedValue, null, true);
5211
+ if (changes.includeLiterals || isChanged('promptPlaceholder', changes)) {
5212
5212
  resolvedPromise.then(() => {
5213
- this.updateValue(this.maskedValue);
5213
+ this.updateValueWithEvents(this.maskedValue);
5214
5214
  });
5215
5215
  }
5216
- else {
5217
- this.updateInput(this.service.maskRaw(this.value));
5218
- }
5219
5216
  }
5220
5217
  /**
5221
5218
  * @hidden
@@ -5224,6 +5221,9 @@ class MaskedTextBoxComponent {
5224
5221
  writeValue(value) {
5225
5222
  this.value = this.normalizeValue(value);
5226
5223
  this.updateInput(this.service.maskRaw(this.value));
5224
+ if (this.includeLiterals) {
5225
+ this.updateValue(this.maskedValue);
5226
+ }
5227
5227
  }
5228
5228
  /**
5229
5229
  * @hidden
@@ -5274,17 +5274,25 @@ class MaskedTextBoxComponent {
5274
5274
  /**
5275
5275
  * @hidden
5276
5276
  */
5277
- updateValue(maskedValue) {
5278
- if (this.mask && !this.service.validationValue(maskedValue)) {
5277
+ updateValueWithEvents(maskedValue) {
5278
+ this.updateValue(maskedValue);
5279
+ if (hasObservers(this.valueChange)) {
5280
+ this.valueChange.emit(this.value);
5281
+ }
5282
+ }
5283
+ updateValue(value) {
5284
+ if (this.mask && !this.service.validationValue(value) && !this.includeLiterals) {
5279
5285
  this.value = '';
5280
5286
  }
5281
5287
  else {
5282
- this.value = this.service.rawValue(maskedValue);
5288
+ this.value = this.service.rawValue(value);
5283
5289
  }
5284
5290
  this.onChange(this.value);
5285
- this.valueChange.emit(this.value);
5286
5291
  }
5287
- updateInput(maskedValue = '', selection) {
5292
+ updateInput(maskedValue = '', selection, isFromOnChanges) {
5293
+ if (isFromOnChanges && maskedValue === this.maskedValue) {
5294
+ return;
5295
+ }
5288
5296
  this.maskedValue = maskedValue;
5289
5297
  const value = this.maskOnFocus && !this.focused && this.emptyMask ? '' : maskedValue;
5290
5298
  this.renderer.setProperty(this.input.nativeElement, "value", value);
@@ -5463,18 +5471,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
5463
5471
  type: Input
5464
5472
  }], fillMode: [{
5465
5473
  type: Input
5466
- }], direction: [{
5467
- type: HostBinding,
5468
- args: ['attr.dir']
5469
- }], hostClasses: [{
5470
- type: HostBinding,
5471
- args: ['class.k-input']
5472
- }, {
5473
- type: HostBinding,
5474
- args: ['class.k-maskedtextbox']
5475
- }], hostDisabledClass: [{
5476
- type: HostBinding,
5477
- args: ['class.k-disabled']
5478
5474
  }], mask: [{
5479
5475
  type: Input
5480
5476
  }], value: [{
@@ -5503,6 +5499,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
5503
5499
  args: ['blur']
5504
5500
  }], valueChange: [{
5505
5501
  type: Output
5502
+ }], direction: [{
5503
+ type: HostBinding,
5504
+ args: ['attr.dir']
5505
+ }], hostClasses: [{
5506
+ type: HostBinding,
5507
+ args: ['class.k-input']
5508
+ }, {
5509
+ type: HostBinding,
5510
+ args: ['class.k-maskedtextbox']
5511
+ }], hostDisabledClass: [{
5512
+ type: HostBinding,
5513
+ args: ['class.k-disabled']
5506
5514
  }], input: [{
5507
5515
  type: ViewChild,
5508
5516
  args: ['input', { static: true }]
@@ -87,9 +87,6 @@ export declare class MaskedTextBoxComponent implements ControlValueAccessor, OnC
87
87
  */
88
88
  set fillMode(fillMode: InputFillMode);
89
89
  get fillMode(): InputFillMode;
90
- direction: string;
91
- hostClasses: boolean;
92
- get hostDisabledClass(): boolean;
93
90
  /**
94
91
  * Represents the current mask ([see example]({% slug value_maskedtextbox %})).
95
92
  * If no mask is set, the component behaves as a standard `type="text"` input.
@@ -105,12 +102,12 @@ export declare class MaskedTextBoxComponent implements ControlValueAccessor, OnC
105
102
  /**
106
103
  * Exposes the RegExp-based mask validation array ([see example]({% slug masks_maskedtextbox %})).
107
104
  */
108
- get rules(): {
109
- [key: string]: RegExp;
110
- };
111
105
  set rules(value: {
112
106
  [key: string]: RegExp;
113
107
  });
108
+ get rules(): {
109
+ [key: string]: RegExp;
110
+ };
114
111
  /**
115
112
  * Represents a prompt character for the masked value.
116
113
  * @default `_`
@@ -191,6 +188,9 @@ export declare class MaskedTextBoxComponent implements ControlValueAccessor, OnC
191
188
  * Fires each time the value changes.
192
189
  */
193
190
  valueChange: EventEmitter<string>;
191
+ direction: string;
192
+ hostClasses: boolean;
193
+ get hostDisabledClass(): boolean;
194
194
  /**
195
195
  * Represents the `ElementRef` of the visible `input` element.
196
196
  */
@@ -292,9 +292,10 @@ export declare class MaskedTextBoxComponent implements ControlValueAccessor, OnC
292
292
  /**
293
293
  * @hidden
294
294
  */
295
- updateValue(maskedValue: string): void;
295
+ updateValueWithEvents(maskedValue: string): void;
296
296
  protected onChange: (_: any) => void;
297
297
  protected onTouched: () => void;
298
+ private updateValue;
298
299
  private updateInput;
299
300
  private extractChanges;
300
301
  private updateService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-angular-inputs",
3
- "version": "9.0.0-next.202203230846",
3
+ "version": "9.0.0-next.202204011342",
4
4
  "description": "Inputs Package for Angular",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "Progress",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@progress/kendo-common": "^0.2.1",
35
- "@progress/kendo-schematics": "^2.0.0",
35
+ "@progress/kendo-schematics": "next",
36
36
  "@telerik/kendo-draggable": "^2.0.0",
37
37
  "tslib": "^2.3.1"
38
38
  },