@colijnit/corecomponents_v12 256.1.19 → 256.1.20
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
|
@@ -8339,6 +8339,7 @@
|
|
|
8339
8339
|
function InputSearchComponent() {
|
|
8340
8340
|
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
8341
8341
|
_this.searchIcon = exports.CoreComponentsIcon.Magnifier;
|
|
8342
|
+
_this.handleKeydown = true;
|
|
8342
8343
|
_this.search = new i0.EventEmitter();
|
|
8343
8344
|
_this.isFocused = new i0.EventEmitter();
|
|
8344
8345
|
_this.leftIconClick = new i0.EventEmitter();
|
|
@@ -8352,6 +8353,9 @@
|
|
|
8352
8353
|
return true;
|
|
8353
8354
|
};
|
|
8354
8355
|
InputSearchComponent.prototype.handleKeyDown = function (event) {
|
|
8356
|
+
if (!this.handleKeydown) {
|
|
8357
|
+
return;
|
|
8358
|
+
}
|
|
8355
8359
|
var enterKeys = ['Enter', 'NumpadEnter', 'Go'];
|
|
8356
8360
|
if (enterKeys.includes(event.key)) {
|
|
8357
8361
|
event.preventDefault();
|
|
@@ -8383,6 +8387,7 @@
|
|
|
8383
8387
|
];
|
|
8384
8388
|
InputSearchComponent.propDecorators = {
|
|
8385
8389
|
placeholder: [{ type: i0.Input }],
|
|
8390
|
+
handleKeydown: [{ type: i0.Input }],
|
|
8386
8391
|
search: [{ type: i0.Output }],
|
|
8387
8392
|
isFocused: [{ type: i0.Output }],
|
|
8388
8393
|
leftIconClick: [{ type: i0.Output }],
|
|
@@ -13238,11 +13243,17 @@
|
|
|
13238
13243
|
var _this = this;
|
|
13239
13244
|
this._buffer = [];
|
|
13240
13245
|
this._keyPress = function (event) {
|
|
13246
|
+
_this._clearScanTimeout();
|
|
13241
13247
|
if (event.key === "Enter") {
|
|
13242
|
-
|
|
13243
|
-
|
|
13248
|
+
if (_this._buffer.length > 0) {
|
|
13249
|
+
document.dispatchEvent(_this._createScanEvent());
|
|
13250
|
+
_this._clearBuffer();
|
|
13251
|
+
}
|
|
13244
13252
|
}
|
|
13245
13253
|
else {
|
|
13254
|
+
_this._scanTimeout = setTimeout(function () {
|
|
13255
|
+
_this._clearBuffer();
|
|
13256
|
+
}, 200);
|
|
13246
13257
|
var str = event.key;
|
|
13247
13258
|
_this._buffer.push(str);
|
|
13248
13259
|
}
|
|
@@ -13252,6 +13263,13 @@
|
|
|
13252
13263
|
BarCodeScanner.prototype.close = function () {
|
|
13253
13264
|
document.removeEventListener('keypress', this._keyPress);
|
|
13254
13265
|
};
|
|
13266
|
+
BarCodeScanner.prototype._clearScanTimeout = function () {
|
|
13267
|
+
clearTimeout(this._scanTimeout);
|
|
13268
|
+
this._scanTimeout = undefined;
|
|
13269
|
+
};
|
|
13270
|
+
BarCodeScanner.prototype._clearBuffer = function () {
|
|
13271
|
+
this._buffer.length = 0;
|
|
13272
|
+
};
|
|
13255
13273
|
BarCodeScanner.prototype._createScanEvent = function () {
|
|
13256
13274
|
return new CustomEvent("barcodescanned", { detail: this._buffer.join("") });
|
|
13257
13275
|
};
|
|
@@ -13298,21 +13316,45 @@
|
|
|
13298
13316
|
this.search = new i0.EventEmitter();
|
|
13299
13317
|
this.isFocused = new i0.EventEmitter();
|
|
13300
13318
|
this.barCodeScanned = new i0.EventEmitter();
|
|
13319
|
+
this._blockEnterKeydown = false;
|
|
13301
13320
|
this._scannerService.registerInput(this);
|
|
13302
13321
|
}
|
|
13303
13322
|
InputScannerComponent.prototype.showClass = function () {
|
|
13304
13323
|
return true;
|
|
13305
13324
|
};
|
|
13325
|
+
InputScannerComponent.prototype.ngOnDestroy = function () {
|
|
13326
|
+
this._clearTimeout();
|
|
13327
|
+
};
|
|
13328
|
+
InputScannerComponent.prototype.handleKeyDown = function (event) {
|
|
13329
|
+
var _this = this;
|
|
13330
|
+
this._clearTimeout();
|
|
13331
|
+
this._keyDownTimeout = setTimeout(function () {
|
|
13332
|
+
if (_this._blockEnterKeydown) {
|
|
13333
|
+
return;
|
|
13334
|
+
}
|
|
13335
|
+
var enterKeys = ['Enter', 'NumpadEnter', 'Go'];
|
|
13336
|
+
if (enterKeys.includes(event.key)) {
|
|
13337
|
+
_this.search.next(_this.model);
|
|
13338
|
+
}
|
|
13339
|
+
}, 200);
|
|
13340
|
+
};
|
|
13306
13341
|
InputScannerComponent.prototype.triggerCodeScanned = function (code) {
|
|
13342
|
+
this._clearTimeout();
|
|
13343
|
+
this._blockEnterKeydown = true;
|
|
13307
13344
|
this.model = code;
|
|
13308
13345
|
this.barCodeScanned.next(this.model);
|
|
13346
|
+
this._blockEnterKeydown = false;
|
|
13347
|
+
};
|
|
13348
|
+
InputScannerComponent.prototype._clearTimeout = function () {
|
|
13349
|
+
clearTimeout(this._keyDownTimeout);
|
|
13350
|
+
this._keyDownTimeout = undefined;
|
|
13309
13351
|
};
|
|
13310
13352
|
return InputScannerComponent;
|
|
13311
13353
|
}());
|
|
13312
13354
|
InputScannerComponent.decorators = [
|
|
13313
13355
|
{ type: i0.Component, args: [{
|
|
13314
13356
|
selector: 'co-input-scanner',
|
|
13315
|
-
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 (
|
|
13357
|
+
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 ",
|
|
13316
13358
|
providers: [
|
|
13317
13359
|
ScannerService,
|
|
13318
13360
|
OverlayService
|
|
@@ -13338,7 +13380,8 @@
|
|
|
13338
13380
|
search: [{ type: i0.Output }],
|
|
13339
13381
|
isFocused: [{ type: i0.Output }],
|
|
13340
13382
|
barCodeScanned: [{ type: i0.Output }],
|
|
13341
|
-
showClass: [{ type: i0.HostBinding, args: ['class.co-input-scanner',] }]
|
|
13383
|
+
showClass: [{ type: i0.HostBinding, args: ['class.co-input-scanner',] }],
|
|
13384
|
+
handleKeyDown: [{ type: i0.HostListener, args: ['keydown', ['$event'],] }]
|
|
13342
13385
|
};
|
|
13343
13386
|
|
|
13344
13387
|
var InputScannerModule = /** @class */ (function () {
|