@libs-ui/components-inputs-mention 0.2.305 → 0.2.306-10

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.
@@ -17,6 +17,7 @@ const KEY_UP = 38;
17
17
  const KEY_DOWN = 40;
18
18
  const KEY_BUFFERED = 229;
19
19
 
20
+ /* eslint-disable @typescript-eslint/no-explicit-any */
20
21
  const PATTERN_INSERT = '\ufeff';
21
22
  const buildTemplate = (value, id, feId) => {
22
23
  return `<span class="libs-ui-components-mention-item" style="font-weight: 600;-moz-osx-font-smoothing: grayscale;-webkit-font-smoothing: antialiased; color: #7239EA" contenteditable="false" id="${id}" feId="${feId}" value="${value}">${value}</span>&nbsp;`;
@@ -33,12 +34,12 @@ const DEFAULT_CONFIG = {
33
34
  mentionSelect: (item) => `@${get(item, 'email')}`,
34
35
  mentionFilter: (search, items) => {
35
36
  const searchString = deleteUnicode(search.toLowerCase());
36
- return items?.filter(item => {
37
+ return items?.filter((item) => {
37
38
  const name = deleteUnicode(get(item, 'name').toLowerCase());
38
39
  const userName = deleteUnicode(get(item, 'username').toLowerCase());
39
40
  return name.includes(searchString) || userName.includes(searchString);
40
41
  });
41
- }
42
+ },
42
43
  };
43
44
 
44
45
  const setValue = (el, value) => {
@@ -81,7 +82,7 @@ const insertValueToContentEditable = (start, end, text) => {
81
82
  // Range.createContextualFragment() would be useful here but is
82
83
  // only relatively recently standardized and is not supported in
83
84
  // some browsers (IE9, for one)
84
- const el = document.createElement("SPAN");
85
+ const el = document.createElement('SPAN');
85
86
  el.innerHTML = text;
86
87
  const frag = document.createDocumentFragment();
87
88
  let node, lastNode, nodeHandlerEvent;
@@ -113,7 +114,7 @@ const getTextBeforeCursor = () => {
113
114
  rangeNew.selectNodeContents(anchorNode);
114
115
  rangeNew.setEnd(range.startContainer, range.startOffset);
115
116
  const fragNew = rangeNew.cloneContents();
116
- const elmPrev = document.createElement("SPAN");
117
+ const elmPrev = document.createElement('SPAN');
117
118
  elmPrev.appendChild(fragNew);
118
119
  return elmPrev.innerText;
119
120
  };
@@ -140,7 +141,6 @@ const setCaretPosition = (el, pos, iframe) => {
140
141
  if (range) {
141
142
  sel.addRange(range);
142
143
  }
143
- ;
144
144
  };
145
145
  const getCaretPosition = (el, iframe) => {
146
146
  if (isInputOrTextAreaElement(el)) {
@@ -181,7 +181,7 @@ const getContentEditableCaretCoords = (ctx) => {
181
181
  return {
182
182
  left: 0,
183
183
  top: 0,
184
- bottom: 0
184
+ bottom: 0,
185
185
  };
186
186
  }
187
187
  const prevRange = sel.getRangeAt(0);
@@ -202,7 +202,7 @@ const getContentEditableCaretCoords = (ctx) => {
202
202
  const coordinates = {
203
203
  left: 0,
204
204
  top: markerEl.offsetHeight,
205
- bottom: -1
205
+ bottom: -1,
206
206
  };
207
207
  localToRelativeCoordinates(ctx, markerEl, coordinates);
208
208
  markerEl.parentNode?.removeChild(markerEl);
@@ -272,7 +272,7 @@ const insertTextAtCaret = (element, text) => {
272
272
  const sel = window.getSelection();
273
273
  if (sel?.getRangeAt && sel.rangeCount) {
274
274
  let range = sel.getRangeAt(0);
275
- const el = document.createElement("SPAN");
275
+ const el = document.createElement('SPAN');
276
276
  range.deleteContents();
277
277
  el.innerHTML = text;
278
278
  const frag = document.createDocumentFragment();
@@ -356,10 +356,10 @@ const properties = [
356
356
  'letterSpacing',
357
357
  'wordSpacing',
358
358
  'tabSize',
359
- 'MozTabSize'
359
+ 'MozTabSize',
360
360
  ];
361
- const isBrowser = (typeof window !== 'undefined');
362
- const isFirefox = (isBrowser && get(window, 'mozInnerScreenX') !== null);
361
+ const isBrowser = typeof window !== 'undefined';
362
+ const isFirefox = isBrowser && get(window, 'mozInnerScreenX') !== null;
363
363
  const getCaretCoordinates = (element, position) => {
364
364
  if (!isBrowser) {
365
365
  throw new Error('textarea-caret-position#getCaretCoordinates should only be called in a browser');
@@ -379,10 +379,10 @@ const getCaretCoordinates = (element, position) => {
379
379
  // Position off-screen
380
380
  style.position = 'absolute'; // required to return coordinates properly
381
381
  // Transfer the element's properties to the div
382
- properties.forEach(prop => {
382
+ properties.forEach((prop) => {
383
383
  if (isInput && prop === 'lineHeight') {
384
384
  // Special case for <input>s because text is rendered centered and line height may be != height
385
- if (computed.boxSizing !== "border-box") {
385
+ if (computed.boxSizing !== 'border-box') {
386
386
  style.lineHeight = computed.height;
387
387
  return;
388
388
  }
@@ -390,7 +390,7 @@ const getCaretCoordinates = (element, position) => {
390
390
  const outerHeight = parseInt(computed.paddingTop) + parseInt(computed.paddingBottom) + parseInt(computed.borderTopWidth) + parseInt(computed.borderBottomWidth);
391
391
  const targetHeight = outerHeight + parseInt(computed.lineHeight);
392
392
  if (height > targetHeight) {
393
- style.lineHeight = height - outerHeight + "px";
393
+ style.lineHeight = height - outerHeight + 'px';
394
394
  return;
395
395
  }
396
396
  if (height === targetHeight) {
@@ -427,7 +427,7 @@ const getCaretCoordinates = (element, position) => {
427
427
  const coordinates = {
428
428
  top: span.offsetTop + parseInt(computed['borderTopWidth']),
429
429
  left: span.offsetLeft + parseInt(computed['borderLeftWidth']),
430
- height: parseInt(computed['lineHeight'])
430
+ height: parseInt(computed['lineHeight']),
431
431
  };
432
432
  document.body.removeChild(div);
433
433
  return coordinates;
@@ -464,7 +464,9 @@ class LibsUiComponentsInputsMentionListComponent {
464
464
  }
465
465
  /* FUNCTIONS */
466
466
  initEvent(element, eventName) {
467
- fromEvent(element, eventName).pipe(takeUntil(this.onDestroy)).subscribe((event) => {
467
+ fromEvent(element, eventName)
468
+ .pipe(takeUntil(this.onDestroy))
469
+ .subscribe((event) => {
468
470
  if (eventName === 'resize' || !this.elementEl()?.nativeElement.contains(event.target)) {
469
471
  this.handlerListenClose(event);
470
472
  }
@@ -481,10 +483,10 @@ class LibsUiComponentsInputsMentionListComponent {
481
483
  if (isInputOrTextAreaElement(nativeParentElement)) {
482
484
  // parent elements need to have postition:relative for this to work correctly?
483
485
  this.coords.set(getCaretCoordinates(nativeParentElement, nativeParentElement.selectionStart));
484
- this.coords.update(item => ({
486
+ this.coords.update((item) => ({
485
487
  ...item,
486
488
  top: nativeParentElement.offsetTop + item.top - nativeParentElement.scrollTop,
487
- left: nativeParentElement.offsetLeft + item.left - nativeParentElement.scrollLeft + nativeParentElement.getBoundingClientRect().left
489
+ left: nativeParentElement.offsetLeft + item.left - nativeParentElement.scrollLeft + nativeParentElement.getBoundingClientRect().left,
488
490
  }));
489
491
  // getCretCoordinates() for text/input elements needs an additional offset to position the list correctly
490
492
  this.offset.set(this.getBlockCursorDimensions(nativeParentElement).height);
@@ -497,15 +499,15 @@ class LibsUiComponentsInputsMentionListComponent {
497
499
  const caretRelativeToView = getContentEditableCaretCoords(context);
498
500
  const doc = document.documentElement;
499
501
  const scrollLeft = (window.scrollX || doc.scrollLeft) - (doc.clientLeft || 0);
500
- this.coords.update(item => ({
502
+ this.coords.update((item) => ({
501
503
  ...item,
502
504
  left: caretRelativeToView.left - scrollLeft - (leftDiv || 0),
503
- bottom: window.parent.innerHeight - caretRelativeToView.top + 18
505
+ bottom: window.parent.innerHeight - caretRelativeToView.top + 18,
504
506
  }));
505
507
  if (caretRelativeToView.bottom && caretRelativeToView.bottom !== -1) {
506
- this.coords.update(item => ({
508
+ this.coords.update((item) => ({
507
509
  ...item,
508
- bottom: caretRelativeToView.bottom
510
+ bottom: caretRelativeToView.bottom,
509
511
  }));
510
512
  }
511
513
  this.positionElement();
@@ -516,11 +518,11 @@ class LibsUiComponentsInputsMentionListComponent {
516
518
  const scrollTop = (window.scrollX || doc.scrollTop) - (doc.clientTop || 0);
517
519
  // bounding rectangles are relative to view, offsets are relative to container?
518
520
  const caretRelativeToView = getContentEditableCaretCoords({ iframe, parent: null });
519
- this.coords.update(item => ({
521
+ this.coords.update((item) => ({
520
522
  ...item,
521
523
  top: caretRelativeToView.top - scrollTop + 10,
522
524
  left: caretRelativeToView.left - scrollLeft - (leftDiv || 0),
523
- bottom: caretRelativeToView.bottom
525
+ bottom: caretRelativeToView.bottom,
524
526
  }));
525
527
  this.positionElement();
526
528
  }
@@ -544,7 +546,7 @@ class LibsUiComponentsInputsMentionListComponent {
544
546
  positionElement(left = this.coords().left, top = this.coords().top, dropUp = this.dropUp(), bottom = this.coords().bottom || 0) {
545
547
  const el = this.elementEl()?.nativeElement;
546
548
  top += dropUp ? 0 : this.offset(); // top of list is next line
547
- el.style.position = "absolute";
549
+ el.style.position = 'absolute';
548
550
  el.style.left = left + 'px';
549
551
  el.style.top = bottom !== -1 ? 'auto' : top + 'px';
550
552
  el.style.bottom = bottom === -1 ? 'auto' : bottom + 'px';
@@ -554,7 +556,7 @@ class LibsUiComponentsInputsMentionListComponent {
554
556
  const parentStyles = window.getComputedStyle(nativeParentElement);
555
557
  return {
556
558
  height: parseFloat(parentStyles.lineHeight),
557
- width: parseFloat(parentStyles.fontSize)
559
+ width: parseFloat(parentStyles.fontSize),
558
560
  };
559
561
  }
560
562
  handleActiveItem(event, index) {
@@ -562,7 +564,7 @@ class LibsUiComponentsInputsMentionListComponent {
562
564
  this.activeIndex.set(index);
563
565
  }
564
566
  scrollToActive() {
565
- if (!this.itemsEl() || (this.itemsEl().length <= this.activeIndex())) {
567
+ if (!this.itemsEl() || this.itemsEl().length <= this.activeIndex()) {
566
568
  return;
567
569
  }
568
570
  this.itemsEl()[this.activeIndex()].nativeElement.scrollIntoView();
@@ -580,14 +582,11 @@ class LibsUiComponentsInputsMentionListComponent {
580
582
  this.onDestroy.complete();
581
583
  }
582
584
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsInputsMentionListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
583
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: LibsUiComponentsInputsMentionListComponent, isStandalone: true, selector: "libs_ui-components-inputs-mention-list", inputs: { labelKey: { classPropertyName: "labelKey", publicName: "labelKey", isSignal: true, isRequired: false, transformFunction: null }, zIndex: { classPropertyName: "zIndex", publicName: "zIndex", isSignal: true, isRequired: false, transformFunction: null }, isIframe: { classPropertyName: "isIframe", publicName: "isIframe", isSignal: true, isRequired: true, transformFunction: null }, defaultAvatar: { classPropertyName: "defaultAvatar", publicName: "defaultAvatar", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { labelKey: "labelKeyChange", zIndex: "zIndexChange", isIframe: "isIframeChange", defaultAvatar: "defaultAvatarChange" }, viewQueries: [{ propertyName: "elementEl", first: true, predicate: ["element"], descendants: true, isSignal: true }, { propertyName: "itemsEl", predicate: ["item"], descendants: true, isSignal: true }], ngImport: i0, template: "<div #element\n class=\"libs-ui-mention-list\"\n [style.zIndex]=\"zIndex()\"\n [class.hidden]=\"hidden()\">\n @for (item of items(); track item) {\n <div #item\n class=\"libs-ui-mention-list-item\"\n [class.libs-ui-mention-list-item-active]=\"$index === activeIndex()\"\n (mousedown)=\"handlerClick($event, $index)\"\n (mouseenter)=\"handleActiveItem($event, $index)\">\n <div class=\"px-[12px] py-[6px] flex items-center\">\n <libs_ui-components-avatar [size]=\"24\"\n [linkAvatar]=\"item.avatar\"\n [linkAvatarError]=\"defaultAvatar()\"\n [getLastTextAfterSpace]=\"true\"\n [textAvatar]=\"item.name\"\n [idGenColor]=\"item.id\" />\n <libs_ui-components-popover [classInclude]=\"'libs-ui-font-h5r'\"\n [type]=\"'text'\"\n [ignoreShowPopover]=\"true\"\n [config]=\"{width: 250}\">\n <!-- // ta.m \u1EA9n show tooltip v\u00EC ch\u01B0a x\u1EED l\u00FD \u0111c v\u1ECB tr\u00ED -->\n {{ item.name + ' (' + item.username + ')' }}\n </libs_ui-components-popover>\n </div>\n </div>\n }\n</div>\n", styles: [".libs-ui-mention-list{position:absolute;top:-999px;left:-9999px;z-index:1202;float:left;width:315px;padding:4px 0;background-color:#fff;border:solid 1px #e6e8ed;border-radius:5px;max-height:190px;overflow:auto;box-shadow:0 2px 10px 1px #3333331a}.libs-ui-mention-list .libs-ui-mention-list-item{background:#fff;cursor:pointer}.libs-ui-mention-list .libs-ui-mention-list-item:hover,.libs-ui-mention-list .libs-ui-mention-list-item-active{background-color:var(--libs-ui-color-light-3, #f4f8ff)}\n"], dependencies: [{ kind: "component", type: LibsUiComponentsAvatarComponent, selector: "libs_ui-components-avatar", inputs: ["typeShape", "classInclude", "size", "linkAvatar", "linkAvatarError", "classImageInclude", "zIndexPreviewImage", "clickPreviewImage", "idGenColor", "getLastTextAfterSpace", "textAvatar", "textAvatarClassInclude", "containertextAvatarClassInclude"], outputs: ["outAvatarError", "outEventPreviewImage"] }, { kind: "component", type: LibsUiComponentsPopoverComponent, selector: "libs_ui-components-popover,[LibsUiComponentsPopoverDirective]", inputs: ["debugId", "flagMouse", "type", "mode", "config", "ignoreShowPopover", "elementRefCustom", "initEventInElementRefCustom", "classInclude", "ignoreHiddenPopoverContentWhenMouseLeave", "ignoreStopPropagationEvent", "ignoreCursorPointerModeLikeClick", "isAddContentToParentDocument", "ignoreClickOutside"], outputs: ["outEvent", "outChangStageFlagMouse", "outEventPopoverContent", "outFunctionsControl"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
585
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: LibsUiComponentsInputsMentionListComponent, isStandalone: true, selector: "libs_ui-components-inputs-mention-list", inputs: { labelKey: { classPropertyName: "labelKey", publicName: "labelKey", isSignal: true, isRequired: false, transformFunction: null }, zIndex: { classPropertyName: "zIndex", publicName: "zIndex", isSignal: true, isRequired: false, transformFunction: null }, isIframe: { classPropertyName: "isIframe", publicName: "isIframe", isSignal: true, isRequired: true, transformFunction: null }, defaultAvatar: { classPropertyName: "defaultAvatar", publicName: "defaultAvatar", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { labelKey: "labelKeyChange", zIndex: "zIndexChange", isIframe: "isIframeChange", defaultAvatar: "defaultAvatarChange" }, viewQueries: [{ propertyName: "elementEl", first: true, predicate: ["element"], descendants: true, isSignal: true }, { propertyName: "itemsEl", predicate: ["item"], descendants: true, isSignal: true }], ngImport: i0, template: "<div\n #element\n class=\"libs-ui-mention-list\"\n [style.zIndex]=\"zIndex()\"\n [class.hidden]=\"hidden()\">\n @for (item of items(); track item) {\n <div\n #item\n class=\"libs-ui-mention-list-item\"\n [class.libs-ui-mention-list-item-active]=\"$index === activeIndex()\"\n (mousedown)=\"handlerClick($event, $index)\"\n (mouseenter)=\"handleActiveItem($event, $index)\">\n <div class=\"px-[12px] py-[6px] flex items-center\">\n <libs_ui-components-avatar\n [size]=\"24\"\n [linkAvatar]=\"item.avatar\"\n [linkAvatarError]=\"defaultAvatar()\"\n [getLastTextAfterSpace]=\"true\"\n [textAvatar]=\"item.name\"\n [idGenColor]=\"item.id\" />\n <libs_ui-components-popover\n [classInclude]=\"'libs-ui-font-h5r'\"\n [type]=\"'text'\"\n [ignoreShowPopover]=\"true\"\n [config]=\"{ width: 250 }\">\n <!-- // ta.m \u1EA9n show tooltip v\u00EC ch\u01B0a x\u1EED l\u00FD \u0111c v\u1ECB tr\u00ED -->\n {{ item.name + ' (' + item.username + ')' }}\n </libs_ui-components-popover>\n </div>\n </div>\n }\n</div>\n", styles: [".libs-ui-mention-list{position:absolute;top:-999px;left:-9999px;z-index:1202;float:left;width:315px;padding:4px 0;background-color:#fff;border:solid 1px #e6e8ed;border-radius:5px;max-height:190px;overflow:auto;box-shadow:0 2px 10px 1px #3333331a}.libs-ui-mention-list .libs-ui-mention-list-item{background:#fff;cursor:pointer}.libs-ui-mention-list .libs-ui-mention-list-item:hover,.libs-ui-mention-list .libs-ui-mention-list-item-active{background-color:var(--libs-ui-color-light-3, #f4f8ff)}\n"], dependencies: [{ kind: "component", type: LibsUiComponentsAvatarComponent, selector: "libs_ui-components-avatar", inputs: ["typeShape", "classInclude", "size", "linkAvatar", "linkAvatarError", "classImageInclude", "zIndexPreviewImage", "clickPreviewImage", "idGenColor", "getLastTextAfterSpace", "textAvatar", "textAvatarClassInclude", "containertextAvatarClassInclude"], outputs: ["outAvatarError", "outEventPreviewImage"] }, { kind: "component", type: LibsUiComponentsPopoverComponent, selector: "libs_ui-components-popover,[LibsUiComponentsPopoverDirective]", inputs: ["debugId", "flagMouse", "type", "mode", "config", "ignoreShowPopover", "elementRefCustom", "initEventInElementRefCustom", "classInclude", "ignoreHiddenPopoverContentWhenMouseLeave", "ignoreStopPropagationEvent", "ignoreCursorPointerModeLikeClick", "isAddContentToParentDocument", "ignoreClickOutside"], outputs: ["outEvent", "outChangStageFlagMouse", "outEventPopoverContent", "outFunctionsControl"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
584
586
  }
585
587
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsInputsMentionListComponent, decorators: [{
586
588
  type: Component,
587
- args: [{ selector: 'libs_ui-components-inputs-mention-list', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
588
- LibsUiComponentsAvatarComponent,
589
- LibsUiComponentsPopoverComponent
590
- ], template: "<div #element\n class=\"libs-ui-mention-list\"\n [style.zIndex]=\"zIndex()\"\n [class.hidden]=\"hidden()\">\n @for (item of items(); track item) {\n <div #item\n class=\"libs-ui-mention-list-item\"\n [class.libs-ui-mention-list-item-active]=\"$index === activeIndex()\"\n (mousedown)=\"handlerClick($event, $index)\"\n (mouseenter)=\"handleActiveItem($event, $index)\">\n <div class=\"px-[12px] py-[6px] flex items-center\">\n <libs_ui-components-avatar [size]=\"24\"\n [linkAvatar]=\"item.avatar\"\n [linkAvatarError]=\"defaultAvatar()\"\n [getLastTextAfterSpace]=\"true\"\n [textAvatar]=\"item.name\"\n [idGenColor]=\"item.id\" />\n <libs_ui-components-popover [classInclude]=\"'libs-ui-font-h5r'\"\n [type]=\"'text'\"\n [ignoreShowPopover]=\"true\"\n [config]=\"{width: 250}\">\n <!-- // ta.m \u1EA9n show tooltip v\u00EC ch\u01B0a x\u1EED l\u00FD \u0111c v\u1ECB tr\u00ED -->\n {{ item.name + ' (' + item.username + ')' }}\n </libs_ui-components-popover>\n </div>\n </div>\n }\n</div>\n", styles: [".libs-ui-mention-list{position:absolute;top:-999px;left:-9999px;z-index:1202;float:left;width:315px;padding:4px 0;background-color:#fff;border:solid 1px #e6e8ed;border-radius:5px;max-height:190px;overflow:auto;box-shadow:0 2px 10px 1px #3333331a}.libs-ui-mention-list .libs-ui-mention-list-item{background:#fff;cursor:pointer}.libs-ui-mention-list .libs-ui-mention-list-item:hover,.libs-ui-mention-list .libs-ui-mention-list-item-active{background-color:var(--libs-ui-color-light-3, #f4f8ff)}\n"] }]
589
+ args: [{ selector: 'libs_ui-components-inputs-mention-list', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [LibsUiComponentsAvatarComponent, LibsUiComponentsPopoverComponent], template: "<div\n #element\n class=\"libs-ui-mention-list\"\n [style.zIndex]=\"zIndex()\"\n [class.hidden]=\"hidden()\">\n @for (item of items(); track item) {\n <div\n #item\n class=\"libs-ui-mention-list-item\"\n [class.libs-ui-mention-list-item-active]=\"$index === activeIndex()\"\n (mousedown)=\"handlerClick($event, $index)\"\n (mouseenter)=\"handleActiveItem($event, $index)\">\n <div class=\"px-[12px] py-[6px] flex items-center\">\n <libs_ui-components-avatar\n [size]=\"24\"\n [linkAvatar]=\"item.avatar\"\n [linkAvatarError]=\"defaultAvatar()\"\n [getLastTextAfterSpace]=\"true\"\n [textAvatar]=\"item.name\"\n [idGenColor]=\"item.id\" />\n <libs_ui-components-popover\n [classInclude]=\"'libs-ui-font-h5r'\"\n [type]=\"'text'\"\n [ignoreShowPopover]=\"true\"\n [config]=\"{ width: 250 }\">\n <!-- // ta.m \u1EA9n show tooltip v\u00EC ch\u01B0a x\u1EED l\u00FD \u0111c v\u1ECB tr\u00ED -->\n {{ item.name + ' (' + item.username + ')' }}\n </libs_ui-components-popover>\n </div>\n </div>\n }\n</div>\n", styles: [".libs-ui-mention-list{position:absolute;top:-999px;left:-9999px;z-index:1202;float:left;width:315px;padding:4px 0;background-color:#fff;border:solid 1px #e6e8ed;border-radius:5px;max-height:190px;overflow:auto;box-shadow:0 2px 10px 1px #3333331a}.libs-ui-mention-list .libs-ui-mention-list-item{background:#fff;cursor:pointer}.libs-ui-mention-list .libs-ui-mention-list-item:hover,.libs-ui-mention-list .libs-ui-mention-list-item-active{background-color:var(--libs-ui-color-light-3, #f4f8ff)}\n"] }]
591
590
  }] });
592
591
 
593
592
  /* eslint-disable @typescript-eslint/no-explicit-any */
@@ -610,7 +609,7 @@ class LibsUiComponentsInputsMentionDirective {
610
609
  dynamicComponentService = inject(LibsUiDynamicComponentService);
611
610
  onDestroy = new Subject();
612
611
  // #region INPUT
613
- timeDelayInit = input(0, { transform: val => val ?? 0 });
612
+ timeDelayInit = input(0, { transform: (val) => val ?? 0 });
614
613
  mentionConfig = input();
615
614
  mentionListTemplate = input();
616
615
  // #region OUTPUT
@@ -653,7 +652,7 @@ class LibsUiComponentsInputsMentionDirective {
653
652
  setTimeout(() => {
654
653
  this.handlerKeydown({ key: this.mentionConfig()?.triggerChar, keyCode: KEY_BACKSPACE, shiftKey: true, inputEvent: true }, element);
655
654
  }, 500);
656
- }
655
+ },
657
656
  });
658
657
  }, this.timeDelayInit());
659
658
  }
@@ -666,7 +665,7 @@ class LibsUiComponentsInputsMentionDirective {
666
665
  this.triggerChars.set({});
667
666
  this.addConfig(mentionConfig);
668
667
  if (mentionConfig.mention) {
669
- mentionConfig.mention.forEach(config => this.addConfig(config));
668
+ mentionConfig.mention.forEach((config) => this.addConfig(config));
670
669
  }
671
670
  }
672
671
  addConfig(config) {
@@ -683,15 +682,15 @@ class LibsUiComponentsInputsMentionDirective {
683
682
  }
684
683
  if (labelKey) {
685
684
  // remove items without an labelKey (as it's required to filter the list)
686
- config.items = config.items.filter(e => e[labelKey]);
685
+ config.items = config.items.filter((e) => e[labelKey]);
687
686
  if (!config.disableSort) {
688
- config.items.sort((a, b) => (a[labelKey] || '').localeCompare((b[labelKey] || '')));
687
+ config.items.sort((a, b) => (a[labelKey] || '').localeCompare(b[labelKey] || ''));
689
688
  }
690
689
  }
691
690
  }
692
- this.triggerChars.update(item => ({
691
+ this.triggerChars.update((item) => ({
693
692
  ...item,
694
- [config.triggerChar || '@']: config
693
+ [config.triggerChar || '@']: config,
695
694
  }));
696
695
  if (this.activeConfig() && this.activeConfig()?.triggerChar === config.triggerChar) {
697
696
  this.activeConfig.set(config);
@@ -739,7 +738,7 @@ class LibsUiComponentsInputsMentionDirective {
739
738
  if (!charPressed) {
740
739
  const charCode = event.which || event.keyCode;
741
740
  charPressed = String.fromCharCode(event.which || event.keyCode);
742
- if (!event.shiftKey && (charCode >= 65 && charCode <= 90)) {
741
+ if (!event.shiftKey && charCode >= 65 && charCode <= 90) {
743
742
  charPressed = String.fromCharCode(charCode + 32);
744
743
  }
745
744
  }
@@ -806,13 +805,13 @@ class LibsUiComponentsInputsMentionDirective {
806
805
  // optional function to format the selected item before inserting the text
807
806
  this.insertMention(nativeElement, pos);
808
807
  // fire input event so angular bindings are updated
809
- if ("Event" in window) {
808
+ if ('Event' in window) {
810
809
  // this seems backwards, but fire the event from this elements nativeElement (not the
811
810
  // one provided that may be in an iframe, as it won't be propogate)
812
811
  // Create the event using the modern Event constructor
813
- const evt = new Event(this.iframe() ? "change" : "input", {
812
+ const evt = new Event(this.iframe() ? 'change' : 'input', {
814
813
  bubbles: true,
815
- cancelable: false
814
+ cancelable: false,
816
815
  });
817
816
  // Dispatch the event on the native element
818
817
  nativeElement.dispatchEvent(evt);
@@ -851,11 +850,11 @@ class LibsUiComponentsInputsMentionDirective {
851
850
  const searchString = mention.replace(String.fromCharCode(160), ' ').replace(String.fromCharCode(0), '');
852
851
  this.searchString.set(searchString.trim());
853
852
  const limitSpaceSearchQuery = this.activeConfig()?.limitSpaceSearchQuery;
854
- if (limitSpaceSearchQuery && (searchString.split(' ').length - 1) > limitSpaceSearchQuery) {
853
+ if (limitSpaceSearchQuery && searchString.split(' ').length - 1 > limitSpaceSearchQuery) {
855
854
  this.searchString.set('');
856
855
  }
857
856
  if (this.activeConfig()?.returnTrigger) {
858
- const triggerChar = (this.searchString() || event.keyCode === KEY_BACKSPACE) ? val.substring(this.startPos(), (this.startPos() || 0) + 1) : '';
857
+ const triggerChar = this.searchString() || event.keyCode === KEY_BACKSPACE ? val.substring(this.startPos(), (this.startPos() || 0) + 1) : '';
859
858
  this.outSearchTerm.emit(triggerChar + this.searchString());
860
859
  this.updateSearchList();
861
860
  return;
@@ -876,10 +875,10 @@ class LibsUiComponentsInputsMentionDirective {
876
875
  return {
877
876
  key: key,
878
877
  config: this.triggerChars()[key],
879
- index: textBeforeCursor.lastIndexOf(key)
878
+ index: textBeforeCursor.lastIndexOf(key),
880
879
  };
881
880
  });
882
- const matchingCharacters = triggerChars.reduce((pre, current) => pre && current && current.index > pre.index ? current : pre);
881
+ const matchingCharacters = triggerChars.reduce((pre, current) => (pre && current && current.index > pre.index ? current : pre));
883
882
  if (matchingCharacters.index < 0) {
884
883
  this.stopSearch();
885
884
  return;
@@ -895,7 +894,7 @@ class LibsUiComponentsInputsMentionDirective {
895
894
  this.searchString.set(search.replace(matchingCharacters.key, ''));
896
895
  this.searching.set(true);
897
896
  this.handlerKeydown({ keyCode: ''.charCodeAt(0), inputEvent: false }, nativeElement);
898
- const divElement = document.createElement("div");
897
+ const divElement = document.createElement('div');
899
898
  divElement.style.width = 'max-content';
900
899
  divElement.style.position = 'absolute';
901
900
  divElement.innerText = search;
@@ -1052,11 +1051,13 @@ class LibsUiComponentsInputsMentionDirective {
1052
1051
  subscription: undefined,
1053
1052
  item: itemActive,
1054
1053
  triggerChar: triggerChar,
1055
- manualAdd: true
1054
+ manualAdd: true,
1056
1055
  };
1057
1056
  this.nodesInsert().add(data);
1058
1057
  if (mentionEventName) {
1059
- data.subscription = fromEvent(span, mentionEventName).pipe(tap(e => e.stopPropagation()), takeUntil$1(this.onDestroy)).subscribe(() => {
1058
+ data.subscription = fromEvent(span, mentionEventName)
1059
+ .pipe(tap((e) => e.stopPropagation()), takeUntil$1(this.onDestroy))
1060
+ .subscribe(() => {
1060
1061
  if (mentionActionByEvent) {
1061
1062
  mentionActionByEvent(itemActive, triggerChar);
1062
1063
  }
@@ -1081,7 +1082,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
1081
1082
  args: [{
1082
1083
  // eslint-disable-next-line @angular-eslint/directive-selector
1083
1084
  selector: '[LibsUiComponentsInputsMentionDirective]',
1084
- standalone: true
1085
+ standalone: true,
1085
1086
  }]
1086
1087
  }], ctorParameters: () => [] });
1087
1088