@fundamental-ngx/cdk 0.43.5 → 0.43.7

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.
@@ -313,6 +313,7 @@ class DeprecatedSelector {
313
313
  }
314
314
  }
315
315
 
316
+ /* eslint-disable @typescript-eslint/member-ordering */
316
317
  class DeprecatedAutoCompleteDirective extends DeprecatedSelector {
317
318
  }
318
319
  DeprecatedAutoCompleteDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DeprecatedAutoCompleteDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
@@ -342,6 +343,8 @@ class AutoCompleteDirective {
342
343
  this._elementRef = _elementRef;
343
344
  /** Whether the auto complete directive should be enabled */
344
345
  this.enable = true;
346
+ /** Matcher function for testing the str for a search term */
347
+ this.matcher = (str, searchTerm) => str.startsWith(searchTerm);
345
348
  /** Display function. Accepts an object of the same type as the
346
349
  * items passed to dropdownValues as argument, and outputs a string.
347
350
  * An arrow function can be used to access the *this* keyword in the calling component.
@@ -375,7 +378,7 @@ class AutoCompleteDirective {
375
378
  return;
376
379
  }
377
380
  this.oldValue = this.inputText;
378
- const item = this.options.find((option) => this.displayFn(option).toLocaleLowerCase().startsWith(this.inputText.toLocaleLowerCase()));
381
+ const item = this.options.find((option) => this.matcher(this.displayFn(option).toLocaleLowerCase(), this.inputText.toLocaleLowerCase()));
379
382
  if (item) {
380
383
  this._typeahead(this.displayFn(item));
381
384
  }
@@ -422,7 +425,7 @@ class AutoCompleteDirective {
422
425
  }
423
426
  }
424
427
  AutoCompleteDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AutoCompleteDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
425
- AutoCompleteDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: AutoCompleteDirective, isStandalone: true, selector: "[fdkAutoComplete], [fdAutoComplete], [fd-auto-complete]", inputs: { options: "options", inputText: "inputText", enable: "enable", displayFn: "displayFn" }, outputs: { onComplete: "onComplete" }, host: { listeners: { "keyup": "handleKeyboardEvent($event)" } }, ngImport: i0 });
428
+ AutoCompleteDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: AutoCompleteDirective, isStandalone: true, selector: "[fdkAutoComplete], [fdAutoComplete], [fd-auto-complete]", inputs: { options: "options", inputText: "inputText", enable: "enable", matcher: "matcher", displayFn: "displayFn" }, outputs: { onComplete: "onComplete" }, host: { listeners: { "keyup": "handleKeyboardEvent($event)" } }, ngImport: i0 });
426
429
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AutoCompleteDirective, decorators: [{
427
430
  type: Directive,
428
431
  args: [{
@@ -435,6 +438,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
435
438
  type: Input
436
439
  }], enable: [{
437
440
  type: Input
441
+ }], matcher: [{
442
+ type: Input
438
443
  }], displayFn: [{
439
444
  type: Input
440
445
  }], onComplete: [{
@@ -5246,6 +5251,7 @@ function selectStrategy(obj) {
5246
5251
  const DND_ITEM = new InjectionToken('Drag and drop Item');
5247
5252
  const DND_LIST = new InjectionToken('Drag and drop List');
5248
5253
 
5254
+ /* eslint-disable @typescript-eslint/member-ordering */
5249
5255
  class DndListDirective {
5250
5256
  constructor() {
5251
5257
  /**
@@ -5284,6 +5290,8 @@ class DndListDirective {
5284
5290
  /** Event that is thrown when predicate function returned false. */
5285
5291
  this.dropCancelled = new EventEmitter();
5286
5292
  /** @hidden */
5293
+ this._initialClass = 'fd-dnd-list';
5294
+ /** @hidden */
5287
5295
  this._closestItemIndex = null;
5288
5296
  /** @hidden */
5289
5297
  this._closestItemPosition = null;
@@ -5294,8 +5302,6 @@ class DndListDirective {
5294
5302
  /** @hidden */
5295
5303
  this._draggable = true;
5296
5304
  /** @hidden */
5297
- this._initialClass = 'fd-dnd-list';
5298
- /** @hidden */
5299
5305
  this._linesRemoved = true;
5300
5306
  /** @hidden */
5301
5307
  this._indicatorsRemoved = true;
@@ -5325,13 +5331,29 @@ class DndListDirective {
5325
5331
  /** @hidden */
5326
5332
  ngAfterContentInit() {
5327
5333
  this._changeDraggableState(this._draggable);
5328
- this.dndItems.changes.pipe(takeUntil(this._onDestroy$), startWith(0)).subscribe(() => this._refreshQueryList());
5334
+ this.dndItems.changes
5335
+ .pipe(startWith(null), takeUntil(this._onDestroy$))
5336
+ .subscribe(() => this.refreshQueryList());
5329
5337
  }
5330
5338
  /** @hidden */
5331
5339
  ngOnDestroy() {
5332
5340
  this._onDestroy$.next();
5333
5341
  this._onDestroy$.complete();
5334
5342
  }
5343
+ /**
5344
+ * Refreshes the indexes of the items.
5345
+ */
5346
+ refreshQueryList() {
5347
+ const refresh$ = merge(this._refresh$, this._onDestroy$);
5348
+ this._refresh$.next();
5349
+ this._dndItemReference = this.dndItems.toArray();
5350
+ this._changeDraggableState(this._draggable);
5351
+ this.dndItems.forEach((item, index) => {
5352
+ item.moved.pipe(takeUntil(refresh$)).subscribe((position) => this.onMove(position, index));
5353
+ item.started.pipe(takeUntil(refresh$)).subscribe(() => this.dragStart(index));
5354
+ item.released.pipe(takeUntil(refresh$)).subscribe(async () => await this.dragEnd(index));
5355
+ });
5356
+ }
5335
5357
  /** Method called when the item is being moved by 1 px */
5336
5358
  onMove(mousePosition, draggedItemIndex) {
5337
5359
  /** Temporary object, to store lowest distance values */
@@ -5512,18 +5534,6 @@ class DndListDirective {
5512
5534
  this._indicatorsRemoved = false;
5513
5535
  this._dndItemReference[closestItemIndex].createReplaceIndicator();
5514
5536
  }
5515
- /** @hidden */
5516
- _refreshQueryList() {
5517
- const refresh$ = merge(this._refresh$, this._onDestroy$);
5518
- this._refresh$.next();
5519
- this._dndItemReference = this.dndItems.toArray();
5520
- this._changeDraggableState(this._draggable);
5521
- this.dndItems.forEach((item, index) => {
5522
- item.moved.pipe(takeUntil(refresh$)).subscribe((position) => this.onMove(position, index));
5523
- item.started.pipe(takeUntil(refresh$)).subscribe(() => this.dragStart(index));
5524
- item.released.pipe(takeUntil(refresh$)).subscribe(async () => await this.dragEnd(index));
5525
- });
5526
- }
5527
5537
  /**
5528
5538
  * @hidden
5529
5539
  * Return information if an element is placed before the dragged element