@colijnit/corecomponents_v12 257.1.20 → 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.
- package/bundles/colijnit-corecomponents_v12.umd.js +47 -4
- package/bundles/colijnit-corecomponents_v12.umd.js.map +1 -1
- package/colijnit-corecomponents_v12.metadata.json +1 -1
- package/esm2015/lib/components/input-scanner/bar-code-scanner.js +16 -3
- package/esm2015/lib/components/input-scanner/input-scanner.component.js +28 -4
- package/esm2015/lib/components/input-search/input-search.component.js +6 -1
- package/fesm2015/colijnit-corecomponents_v12.js +46 -4
- package/fesm2015/colijnit-corecomponents_v12.js.map +1 -1
- package/lib/components/input-scanner/bar-code-scanner.d.ts +3 -0
- package/lib/components/input-scanner/input-scanner.component.d.ts +7 -2
- package/lib/components/input-search/input-search.component.d.ts +1 -0
- package/package.json +1 -1
|
@@ -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 }],
|
|
@@ -13260,11 +13265,17 @@
|
|
|
13260
13265
|
var _this = this;
|
|
13261
13266
|
this._buffer = [];
|
|
13262
13267
|
this._keyPress = function (event) {
|
|
13268
|
+
_this._clearScanTimeout();
|
|
13263
13269
|
if (event.key === "Enter") {
|
|
13264
|
-
|
|
13265
|
-
|
|
13270
|
+
if (_this._buffer.length > 0) {
|
|
13271
|
+
document.dispatchEvent(_this._createScanEvent());
|
|
13272
|
+
_this._clearBuffer();
|
|
13273
|
+
}
|
|
13266
13274
|
}
|
|
13267
13275
|
else {
|
|
13276
|
+
_this._scanTimeout = setTimeout(function () {
|
|
13277
|
+
_this._clearBuffer();
|
|
13278
|
+
}, 200);
|
|
13268
13279
|
var str = event.key;
|
|
13269
13280
|
_this._buffer.push(str);
|
|
13270
13281
|
}
|
|
@@ -13274,6 +13285,13 @@
|
|
|
13274
13285
|
BarCodeScanner.prototype.close = function () {
|
|
13275
13286
|
document.removeEventListener('keypress', this._keyPress);
|
|
13276
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
|
+
};
|
|
13277
13295
|
BarCodeScanner.prototype._createScanEvent = function () {
|
|
13278
13296
|
return new CustomEvent("barcodescanned", { detail: this._buffer.join("") });
|
|
13279
13297
|
};
|
|
@@ -13320,21 +13338,45 @@
|
|
|
13320
13338
|
this.search = new i0.EventEmitter();
|
|
13321
13339
|
this.isFocused = new i0.EventEmitter();
|
|
13322
13340
|
this.barCodeScanned = new i0.EventEmitter();
|
|
13341
|
+
this._blockEnterKeydown = false;
|
|
13323
13342
|
this._scannerService.registerInput(this);
|
|
13324
13343
|
}
|
|
13325
13344
|
InputScannerComponent.prototype.showClass = function () {
|
|
13326
13345
|
return true;
|
|
13327
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
|
+
};
|
|
13328
13363
|
InputScannerComponent.prototype.triggerCodeScanned = function (code) {
|
|
13364
|
+
this._clearTimeout();
|
|
13365
|
+
this._blockEnterKeydown = true;
|
|
13329
13366
|
this.model = code;
|
|
13330
13367
|
this.barCodeScanned.next(this.model);
|
|
13368
|
+
this._blockEnterKeydown = false;
|
|
13369
|
+
};
|
|
13370
|
+
InputScannerComponent.prototype._clearTimeout = function () {
|
|
13371
|
+
clearTimeout(this._keyDownTimeout);
|
|
13372
|
+
this._keyDownTimeout = undefined;
|
|
13331
13373
|
};
|
|
13332
13374
|
return InputScannerComponent;
|
|
13333
13375
|
}());
|
|
13334
13376
|
InputScannerComponent.decorators = [
|
|
13335
13377
|
{ type: i0.Component, args: [{
|
|
13336
13378
|
selector: 'co-input-scanner',
|
|
13337
|
-
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 (
|
|
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 ",
|
|
13338
13380
|
providers: [
|
|
13339
13381
|
ScannerService,
|
|
13340
13382
|
OverlayService
|
|
@@ -13360,7 +13402,8 @@
|
|
|
13360
13402
|
search: [{ type: i0.Output }],
|
|
13361
13403
|
isFocused: [{ type: i0.Output }],
|
|
13362
13404
|
barCodeScanned: [{ type: i0.Output }],
|
|
13363
|
-
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'],] }]
|
|
13364
13407
|
};
|
|
13365
13408
|
|
|
13366
13409
|
var InputScannerModule = /** @class */ (function () {
|