@colijnit/corecomponents_v12 257.1.19 → 257.1.21

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.
@@ -8352,6 +8352,7 @@
8352
8352
  function InputSearchComponent() {
8353
8353
  var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
8354
8354
  _this.searchIcon = exports.CoreComponentsIcon.Magnifier;
8355
+ _this.handleKeydown = true;
8355
8356
  _this.search = new i0.EventEmitter();
8356
8357
  _this.isFocused = new i0.EventEmitter();
8357
8358
  _this.leftIconClick = new i0.EventEmitter();
@@ -8365,6 +8366,9 @@
8365
8366
  return true;
8366
8367
  };
8367
8368
  InputSearchComponent.prototype.handleKeyDown = function (event) {
8369
+ if (!this.handleKeydown) {
8370
+ return;
8371
+ }
8368
8372
  var enterKeys = ['Enter', 'NumpadEnter', 'Go'];
8369
8373
  if (enterKeys.includes(event.key)) {
8370
8374
  event.preventDefault();
@@ -8396,6 +8400,7 @@
8396
8400
  ];
8397
8401
  InputSearchComponent.propDecorators = {
8398
8402
  placeholder: [{ type: i0.Input }],
8403
+ handleKeydown: [{ type: i0.Input }],
8399
8404
  search: [{ type: i0.Output }],
8400
8405
  isFocused: [{ type: i0.Output }],
8401
8406
  leftIconClick: [{ type: i0.Output }],
@@ -11999,7 +12004,6 @@
11999
12004
  OverlayModule,
12000
12005
  ClickoutsideModule,
12001
12006
  IconModule,
12002
- InputTextModule,
12003
12007
  InputSearchModule
12004
12008
  ],
12005
12009
  declarations: [
@@ -13261,11 +13265,17 @@
13261
13265
  var _this = this;
13262
13266
  this._buffer = [];
13263
13267
  this._keyPress = function (event) {
13268
+ _this._clearScanTimeout();
13264
13269
  if (event.key === "Enter") {
13265
- document.dispatchEvent(_this._createScanEvent());
13266
- _this._buffer.length = 0;
13270
+ if (_this._buffer.length > 0) {
13271
+ document.dispatchEvent(_this._createScanEvent());
13272
+ _this._clearBuffer();
13273
+ }
13267
13274
  }
13268
13275
  else {
13276
+ _this._scanTimeout = setTimeout(function () {
13277
+ _this._clearBuffer();
13278
+ }, 200);
13269
13279
  var str = event.key;
13270
13280
  _this._buffer.push(str);
13271
13281
  }
@@ -13275,6 +13285,13 @@
13275
13285
  BarCodeScanner.prototype.close = function () {
13276
13286
  document.removeEventListener('keypress', this._keyPress);
13277
13287
  };
13288
+ BarCodeScanner.prototype._clearScanTimeout = function () {
13289
+ clearTimeout(this._scanTimeout);
13290
+ this._scanTimeout = undefined;
13291
+ };
13292
+ BarCodeScanner.prototype._clearBuffer = function () {
13293
+ this._buffer.length = 0;
13294
+ };
13278
13295
  BarCodeScanner.prototype._createScanEvent = function () {
13279
13296
  return new CustomEvent("barcodescanned", { detail: this._buffer.join("") });
13280
13297
  };
@@ -13321,21 +13338,45 @@
13321
13338
  this.search = new i0.EventEmitter();
13322
13339
  this.isFocused = new i0.EventEmitter();
13323
13340
  this.barCodeScanned = new i0.EventEmitter();
13341
+ this._blockEnterKeydown = false;
13324
13342
  this._scannerService.registerInput(this);
13325
13343
  }
13326
13344
  InputScannerComponent.prototype.showClass = function () {
13327
13345
  return true;
13328
13346
  };
13347
+ InputScannerComponent.prototype.ngOnDestroy = function () {
13348
+ this._clearTimeout();
13349
+ };
13350
+ InputScannerComponent.prototype.handleKeyDown = function (event) {
13351
+ var _this = this;
13352
+ this._clearTimeout();
13353
+ this._keyDownTimeout = setTimeout(function () {
13354
+ if (_this._blockEnterKeydown) {
13355
+ return;
13356
+ }
13357
+ var enterKeys = ['Enter', 'NumpadEnter', 'Go'];
13358
+ if (enterKeys.includes(event.key)) {
13359
+ _this.search.next(_this.model);
13360
+ }
13361
+ }, 200);
13362
+ };
13329
13363
  InputScannerComponent.prototype.triggerCodeScanned = function (code) {
13364
+ this._clearTimeout();
13365
+ this._blockEnterKeydown = true;
13330
13366
  this.model = code;
13331
13367
  this.barCodeScanned.next(this.model);
13368
+ this._blockEnterKeydown = false;
13369
+ };
13370
+ InputScannerComponent.prototype._clearTimeout = function () {
13371
+ clearTimeout(this._keyDownTimeout);
13372
+ this._keyDownTimeout = undefined;
13332
13373
  };
13333
13374
  return InputScannerComponent;
13334
13375
  }());
13335
13376
  InputScannerComponent.decorators = [
13336
13377
  { type: i0.Component, args: [{
13337
13378
  selector: 'co-input-scanner',
13338
- template: "\n <co-input-search\n [(model)]=\"model\"\n [customCssClass]=\"customCssClass\"\n [placeholder]=\"placeholder\"\n [centerLabel]=\"centerLabel\"\n [useLeftIcon]=\"useLeftIcon\"\n [leftIconData]=\"leftIconData\"\n [useRightIcon]=\"useRightIcon\"\n [rightIconData]=\"rightIconData\"\n (leftIconClick)=\"leftIconClick.emit($event)\"\n (rightIconClick)=\"rightIconClick.emit($event)\"\n (search)=\"search.emit($event)\"\n (isFocused)=\"isFocused.emit($event)\"\n ></co-input-search>\n ",
13379
+ template: "\n <co-input-search\n [(model)]=\"model\"\n [handleKeydown]=\"false\"\n [customCssClass]=\"customCssClass\"\n [placeholder]=\"placeholder\"\n [centerLabel]=\"centerLabel\"\n [useLeftIcon]=\"useLeftIcon\"\n [leftIconData]=\"leftIconData\"\n [useRightIcon]=\"useRightIcon\"\n [rightIconData]=\"rightIconData\"\n (leftIconClick)=\"leftIconClick.emit($event)\"\n (rightIconClick)=\"rightIconClick.emit($event)\"\n (isFocused)=\"isFocused.emit($event)\"\n ></co-input-search>\n ",
13339
13380
  providers: [
13340
13381
  ScannerService,
13341
13382
  OverlayService
@@ -13361,7 +13402,8 @@
13361
13402
  search: [{ type: i0.Output }],
13362
13403
  isFocused: [{ type: i0.Output }],
13363
13404
  barCodeScanned: [{ type: i0.Output }],
13364
- showClass: [{ type: i0.HostBinding, args: ['class.co-input-scanner',] }]
13405
+ showClass: [{ type: i0.HostBinding, args: ['class.co-input-scanner',] }],
13406
+ handleKeyDown: [{ type: i0.HostListener, args: ['keydown', ['$event'],] }]
13365
13407
  };
13366
13408
 
13367
13409
  var InputScannerModule = /** @class */ (function () {