@limetech/lime-crm-building-blocks 1.50.2 → 1.50.3

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.50.3](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.50.2...v1.50.3) (2024-11-20)
2
+
3
+ ### Bug Fixes
4
+
5
+
6
+ * **text-editor:** be able to use text editor before releasing notifications ([02cbf0a](https://github.com/Lundalogik/lime-crm-building-blocks/commit/02cbf0a927663f80105be66988d407c7551ef06c))
7
+
1
8
  ## [1.50.2](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.50.1...v1.50.2) (2024-11-18)
2
9
 
3
10
  ### Bug Fixes
@@ -170,9 +170,11 @@ const LimeBBTextEditor = class {
170
170
  }
171
171
  setCustomElementsAndTriggers() {
172
172
  const customElements = Object.values(this.triggerMap).map((item) => item.customElement);
173
- const triggers = Object.keys(this.triggerMap);
174
173
  this.customElements = customElements;
175
- this.registeredTriggers = triggers;
174
+ if (!this.platform.isFeatureEnabled('useNotifications')) {
175
+ return;
176
+ }
177
+ this.registeredTriggers = Object.keys(this.triggerMap);
176
178
  }
177
179
  setPickerMessage() {
178
180
  if (this.isPickerOpen === true && this.editorPickerQuery.length > 0) {
@@ -22,15 +22,15 @@ const hasLabel = (label) => (object) => {
22
22
  const SEARCH_LIMIT = 20;
23
23
  /**
24
24
  * This component is a wrapper on the `limel-text-editor`. It adds support for platform
25
- * specific things that can't reside in lime-elements. So this is basically a
25
+ * specific things that can't reside in lime-elements. So this is basically an
26
26
  * invocation of the text editor with support for mentions.
27
27
  *
28
- * A mention is practically a inserted <limebb-mention /> tag that will visually show
28
+ * A mention is practically an inserted <limebb-mention /> tag that will visually show
29
29
  * the mention in the text editor but will also trigger the creation of a mention on
30
30
  * the server side if saved together with a text field in a limeobject.
31
31
  *
32
32
  * The mention will always point towards a limeobject with the combination of a limetype
33
- * that has the label USER and a object id.
33
+ * that has the label USER and an object id.
34
34
  *
35
35
  * @todo replace the elastic search with lime-query
36
36
  * @todo move findLimetypeByLabel from crm-components to some suitable place
@@ -163,9 +163,11 @@ export class LimeBBTextEditor {
163
163
  }
164
164
  setCustomElementsAndTriggers() {
165
165
  const customElements = Object.values(this.triggerMap).map((item) => item.customElement);
166
- const triggers = Object.keys(this.triggerMap);
167
166
  this.customElements = customElements;
168
- this.registeredTriggers = triggers;
167
+ if (!this.platform.isFeatureEnabled('useNotifications')) {
168
+ return;
169
+ }
170
+ this.registeredTriggers = Object.keys(this.triggerMap);
169
171
  }
170
172
  setPickerMessage() {
171
173
  if (this.isPickerOpen === true && this.editorPickerQuery.length > 0) {
@@ -0,0 +1 @@
1
+ export {};
@@ -168,9 +168,11 @@ const LimeBBTextEditor = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
168
168
  }
169
169
  setCustomElementsAndTriggers() {
170
170
  const customElements = Object.values(this.triggerMap).map((item) => item.customElement);
171
- const triggers = Object.keys(this.triggerMap);
172
171
  this.customElements = customElements;
173
- this.registeredTriggers = triggers;
172
+ if (!this.platform.isFeatureEnabled('useNotifications')) {
173
+ return;
174
+ }
175
+ this.registeredTriggers = Object.keys(this.triggerMap);
174
176
  }
175
177
  setPickerMessage() {
176
178
  if (this.isPickerOpen === true && this.editorPickerQuery.length > 0) {
@@ -166,9 +166,11 @@ const LimeBBTextEditor = class {
166
166
  }
167
167
  setCustomElementsAndTriggers() {
168
168
  const customElements = Object.values(this.triggerMap).map((item) => item.customElement);
169
- const triggers = Object.keys(this.triggerMap);
170
169
  this.customElements = customElements;
171
- this.registeredTriggers = triggers;
170
+ if (!this.platform.isFeatureEnabled('useNotifications')) {
171
+ return;
172
+ }
173
+ this.registeredTriggers = Object.keys(this.triggerMap);
172
174
  }
173
175
  setPickerMessage() {
174
176
  if (this.isPickerOpen === true && this.editorPickerQuery.length > 0) {
@@ -1 +1 @@
1
- import{p as e,b as t}from"./p-8e85017b.js";(()=>{const t=import.meta.url,i={};return""!==t&&(i.resourcesUrl=new URL(".",t).href),e(i)})().then((e=>t([["p-117f668f",[[1,"limebb-feed",{platform:[16],context:[16],items:[16],emptyStateMessage:[1,"empty-state-message"],heading:[1],loading:[4],minutesOfProximity:[2,"minutes-of-proximity"],totalCount:[2,"total-count"],lastVisitedTimestamp:[1,"last-visited-timestamp"]}]]],["p-32ab34e5",[[1,"limebb-kanban",{platform:[16],context:[16],items:[16],paginationSize:[2,"pagination-size"],groupBy:[513,"group-by"],groups:[16]}]]],["p-2e549d89",[[1,"limebb-date-range",{platform:[16],context:[16],startTime:[16],endTime:[16],startTimeLabel:[1,"start-time-label"],endTimeLabel:[1,"end-time-label"],language:[1],timeFormat:[1,"time-format"],type:[1]}]]],["p-beb4e864",[[1,"limebb-info-tile-currency-format",{platform:[16],context:[16],value:[16]}]]],["p-c8370ef6",[[1,"limebb-notification-list",{platform:[16],context:[16],items:[16],loading:[4],lastVisitedTimestamp:[1,"last-visited-timestamp"]}]]],["p-5f075485",[[1,"limebb-text-editor",{platform:[16],context:[16],selectedContext:[16],uiType:[8,"ui-type"],allowResize:[4,"allow-resize"],value:[1],items:[32],customElements:[32],registeredTriggers:[32],editorPickerQuery:[32],coworkerLimetype:[32],isPickerOpen:[32]}]]],["p-4b60c5a3",[[17,"limebb-browser",{platform:[16],context:[16],items:[16],layout:[1],filter:[32]}]]],["p-7ddcb65a",[[1,"limebb-component-config",{platform:[16],context:[16],value:[16],required:[4],readonly:[4],disabled:[4],label:[1],helperText:[1,"helper-text"],formInfo:[16],type:[1],nameField:[1,"name-field"],configComponent:[32],configViewType:[32]}]]],["p-98ce1c1d",[[1,"limebb-component-picker",{platform:[16],context:[16],type:[1],tags:[16],value:[1],copyLabel:[1,"copy-label"],hideCopyButton:[4,"hide-copy-button"],required:[4],readonly:[4],disabled:[4],label:[1],helperText:[1,"helper-text"]}]]],["p-74dfea73",[[1,"limebb-dashboard-widget",{heading:[513],subheading:[513],supportingText:[513,"supporting-text"],icon:[513]}]]],["p-8aafd8fb",[[1,"limebb-icon-picker",{value:[1],required:[4],readonly:[4],invalid:[4],disabled:[4],label:[1],helperText:[1,"helper-text"]}]]],["p-f7a3fe1d",[[1,"limebb-info-tile",{platform:[16],context:[16],filterId:[513,"filter-id"],disabled:[4],icon:[513],label:[1],prefix:[1],suffix:[1],propertyName:[1,"property-name"],aggregateOperator:[1,"aggregate-operator"],format:[16],config:[32],filters:[32],value:[32],loading:[32],error:[32]}]]],["p-3602eb38",[[1,"limebb-info-tile-date-format",{value:[16]}]]],["p-87d08f0d",[[1,"limebb-info-tile-decimal-format",{value:[16]}]]],["p-2867f980",[[1,"limebb-info-tile-format",{platform:[16],context:[16],type:[1],value:[16]}]]],["p-c163374e",[[1,"limebb-info-tile-relative-date-format",{value:[16]}]]],["p-d0a17301",[[1,"limebb-info-tile-unit-format",{value:[16]}]]],["p-8dfb79e0",[[1,"limebb-limeobject-file-viewer",{platform:[16],context:[16],property:[1],fileTypes:[16],limeobject:[32],limetype:[32]}]]],["p-8ba97e32",[[1,"limebb-locale-picker",{platform:[16],context:[16],value:[1],required:[4],disabled:[4],label:[1],helperText:[1,"helper-text"],readonly:[4],multipleChoice:[4,"multiple-choice"],allLanguages:[32]}]]],["p-3d8fe6cc",[[1,"limebb-mention",{limetype:[1],objectid:[2],limeobject:[32]}]]],["p-25011706",[[17,"limebb-navigation-button",{href:[513],tooltipLabel:[513,"tooltip-label"],tooltipHelperLabel:[513,"tooltip-helper-label"],type:[513]}]]],["p-b26fc50f",[[1,"limebb-kanban-column",{platform:[16],context:[16],columnHeading:[1,"column-heading"],items:[16],loading:[4],paginationSize:[2,"pagination-size"],displayedItemCount:[32]}]]],["p-e3fc55d6",[[1,"limebb-currency-picker",{platform:[16],context:[16],label:[513],currencies:[16],helperText:[513,"helper-text"],required:[516],readonly:[516],invalid:[516],disabled:[516],value:[1]}]]],["p-08d58041",[[1,"limebb-date-picker",{platform:[16],context:[16],disabled:[516],readonly:[516],invalid:[516],label:[513],placeholder:[513],helperText:[513,"helper-text"],required:[516],value:[1],type:[513]}]]],["p-54c38e90",[[1,"limebb-notification-item",{platform:[16],context:[16],item:[16]}]]],["p-3b38867a",[[1,"limebb-text-editor-picker",{items:[16],open:[516],emptyMessage:[1,"empty-message"]}]]],["p-63929d5d",[[1,"limebb-empty-state",{heading:[513],value:[513],icon:[16]}],[1,"limebb-feed-timeline-item",{platform:[16],context:[16],item:[16],ui:[513],isBundled:[516,"is-bundled"],headingCanExpand:[32],isHeadingExpanded:[32],showMore:[32],isTall:[32]}]]],["p-8295211a",[[1,"limebb-kanban-item",{platform:[16],context:[16],item:[16]}]]]],e)));
1
+ import{p as e,b as t}from"./p-8e85017b.js";(()=>{const t=import.meta.url,i={};return""!==t&&(i.resourcesUrl=new URL(".",t).href),e(i)})().then((e=>t([["p-117f668f",[[1,"limebb-feed",{platform:[16],context:[16],items:[16],emptyStateMessage:[1,"empty-state-message"],heading:[1],loading:[4],minutesOfProximity:[2,"minutes-of-proximity"],totalCount:[2,"total-count"],lastVisitedTimestamp:[1,"last-visited-timestamp"]}]]],["p-32ab34e5",[[1,"limebb-kanban",{platform:[16],context:[16],items:[16],paginationSize:[2,"pagination-size"],groupBy:[513,"group-by"],groups:[16]}]]],["p-2e549d89",[[1,"limebb-date-range",{platform:[16],context:[16],startTime:[16],endTime:[16],startTimeLabel:[1,"start-time-label"],endTimeLabel:[1,"end-time-label"],language:[1],timeFormat:[1,"time-format"],type:[1]}]]],["p-beb4e864",[[1,"limebb-info-tile-currency-format",{platform:[16],context:[16],value:[16]}]]],["p-c8370ef6",[[1,"limebb-notification-list",{platform:[16],context:[16],items:[16],loading:[4],lastVisitedTimestamp:[1,"last-visited-timestamp"]}]]],["p-3d68fa86",[[1,"limebb-text-editor",{platform:[16],context:[16],selectedContext:[16],uiType:[8,"ui-type"],allowResize:[4,"allow-resize"],value:[1],items:[32],customElements:[32],registeredTriggers:[32],editorPickerQuery:[32],coworkerLimetype:[32],isPickerOpen:[32]}]]],["p-4b60c5a3",[[17,"limebb-browser",{platform:[16],context:[16],items:[16],layout:[1],filter:[32]}]]],["p-7ddcb65a",[[1,"limebb-component-config",{platform:[16],context:[16],value:[16],required:[4],readonly:[4],disabled:[4],label:[1],helperText:[1,"helper-text"],formInfo:[16],type:[1],nameField:[1,"name-field"],configComponent:[32],configViewType:[32]}]]],["p-98ce1c1d",[[1,"limebb-component-picker",{platform:[16],context:[16],type:[1],tags:[16],value:[1],copyLabel:[1,"copy-label"],hideCopyButton:[4,"hide-copy-button"],required:[4],readonly:[4],disabled:[4],label:[1],helperText:[1,"helper-text"]}]]],["p-74dfea73",[[1,"limebb-dashboard-widget",{heading:[513],subheading:[513],supportingText:[513,"supporting-text"],icon:[513]}]]],["p-8aafd8fb",[[1,"limebb-icon-picker",{value:[1],required:[4],readonly:[4],invalid:[4],disabled:[4],label:[1],helperText:[1,"helper-text"]}]]],["p-f7a3fe1d",[[1,"limebb-info-tile",{platform:[16],context:[16],filterId:[513,"filter-id"],disabled:[4],icon:[513],label:[1],prefix:[1],suffix:[1],propertyName:[1,"property-name"],aggregateOperator:[1,"aggregate-operator"],format:[16],config:[32],filters:[32],value:[32],loading:[32],error:[32]}]]],["p-3602eb38",[[1,"limebb-info-tile-date-format",{value:[16]}]]],["p-87d08f0d",[[1,"limebb-info-tile-decimal-format",{value:[16]}]]],["p-2867f980",[[1,"limebb-info-tile-format",{platform:[16],context:[16],type:[1],value:[16]}]]],["p-c163374e",[[1,"limebb-info-tile-relative-date-format",{value:[16]}]]],["p-d0a17301",[[1,"limebb-info-tile-unit-format",{value:[16]}]]],["p-8dfb79e0",[[1,"limebb-limeobject-file-viewer",{platform:[16],context:[16],property:[1],fileTypes:[16],limeobject:[32],limetype:[32]}]]],["p-8ba97e32",[[1,"limebb-locale-picker",{platform:[16],context:[16],value:[1],required:[4],disabled:[4],label:[1],helperText:[1,"helper-text"],readonly:[4],multipleChoice:[4,"multiple-choice"],allLanguages:[32]}]]],["p-3d8fe6cc",[[1,"limebb-mention",{limetype:[1],objectid:[2],limeobject:[32]}]]],["p-25011706",[[17,"limebb-navigation-button",{href:[513],tooltipLabel:[513,"tooltip-label"],tooltipHelperLabel:[513,"tooltip-helper-label"],type:[513]}]]],["p-b26fc50f",[[1,"limebb-kanban-column",{platform:[16],context:[16],columnHeading:[1,"column-heading"],items:[16],loading:[4],paginationSize:[2,"pagination-size"],displayedItemCount:[32]}]]],["p-e3fc55d6",[[1,"limebb-currency-picker",{platform:[16],context:[16],label:[513],currencies:[16],helperText:[513,"helper-text"],required:[516],readonly:[516],invalid:[516],disabled:[516],value:[1]}]]],["p-08d58041",[[1,"limebb-date-picker",{platform:[16],context:[16],disabled:[516],readonly:[516],invalid:[516],label:[513],placeholder:[513],helperText:[513,"helper-text"],required:[516],value:[1],type:[513]}]]],["p-54c38e90",[[1,"limebb-notification-item",{platform:[16],context:[16],item:[16]}]]],["p-3b38867a",[[1,"limebb-text-editor-picker",{items:[16],open:[516],emptyMessage:[1,"empty-message"]}]]],["p-63929d5d",[[1,"limebb-empty-state",{heading:[513],value:[513],icon:[16]}],[1,"limebb-feed-timeline-item",{platform:[16],context:[16],item:[16],ui:[513],isBundled:[516,"is-bundled"],headingCanExpand:[32],isHeadingExpanded:[32],showMore:[32],isTall:[32]}]]],["p-8295211a",[[1,"limebb-kanban-item",{platform:[16],context:[16],item:[16]}]]]],e)));
@@ -1 +1 @@
1
- import{r as t,h as i,g as e}from"./p-8e85017b.js";import{P as s,O as h}from"./p-3f4595a3.js";import{a as r}from"./p-0f7e92c9.js";import{a as o,B as n,E as c,T as a}from"./p-214188d4.js";import{i as l}from"./p-86b9d9e8.js";import"./p-8b377b1f.js";const d=class{constructor(i){var e;t(this,i),this.allowResize=!0,this.value="",this.items=[],this.customElements=[],this.registeredTriggers=[],this.isPickerOpen=!1,this.activeTrigger=void 0,this.triggerMap={"@":{customElement:{tagName:"limebb-mention",attributes:["limetype","objectid","href"]},mapAttributes:t=>({limetype:t.secondaryText,objectid:t.value,href:`object/${this.context.limetype}/${this.context.id}`})}},this.handleGlobalKeyPress=t=>{const i=void 0!==this.activeTrigger;t.key===o||t.key===n&&1===this.value.length?this.isPickerOpen=!1:(i&&t.key===c||i&&t.key===a)&&t.preventDefault()},this.globalClickListener=t=>{const i=this.textEditorElement.contains(t.target),e=void 0!==this.activeTrigger;this.isPickerOpen&&!i&&(this.isPickerOpen=!1),i&&e&&(t.stopPropagation(),t.preventDefault(),this.isPickerOpen=!0)},this.handleTriggerStart=t=>{t.stopPropagation(),this.isPickerOpen=!0,this.activeTrigger=t.detail.trigger,this.triggerFunction=t.detail.textEditor},this.handleTriggerStop=t=>{t.stopPropagation(),this.isPickerOpen=!1,this.activeTrigger=void 0},this.handleTriggerChange=t=>{t.stopImmediatePropagation(),this.editorPickerQuery=t.detail.value,this.search()},this.loadObjects=(t,i)=>i.map((i=>{const e=this.limeObjectService.getObject(t.name,i._id);if(e)return{text:e.descriptive,secondaryText:t.name,value:i._id}})).filter(l),this.handleItemSelected=t=>{this.insertEditorNode(t.detail),this.activeTrigger=void 0},this.insertEditorNode=t=>{var i;if(void 0===this.activeTrigger)return void console.warn("No triggerMap found");const e=this.triggerMap[this.activeTrigger];try{null===(i=this.triggerFunction)||void 0===i||i.insert({node:{tagName:e.customElement.tagName,attributes:e.mapAttributes(t)},children:[this.activeTrigger+t.text]})}catch(t){console.error("Can't insert node to the text editor",t)}},this.portalId="crypto"in window&&"function"==typeof(null===(e=window.crypto)||void 0===e?void 0:e.randomUUID)?"a_"+crypto.randomUUID():String.fromCharCode(97+Math.floor(26*Math.random()))+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2)}watchOpen(){this.setupGlobalHandlers()}watchQuery(){this.setPickerMessage()}componentWillLoad(){this.setCustomElementsAndTriggers()}setCustomElementsAndTriggers(){const t=Object.values(this.triggerMap).map((t=>t.customElement)),i=Object.keys(this.triggerMap);this.customElements=t,this.registeredTriggers=i}setPickerMessage(){this.pickerMessage=!0===this.isPickerOpen&&this.editorPickerQuery.length>0?"No results for your search...":"Start typing a name..."}setupGlobalHandlers(){this.isPickerOpen?(document.addEventListener("click",this.globalClickListener,{capture:!0}),document.addEventListener("keyup",this.handleGlobalKeyPress)):(document.removeEventListener("click",this.globalClickListener),document.removeEventListener("keyup",this.handleGlobalKeyPress))}render(){return[i("limel-text-editor",{value:this.value,customElements:this.customElements,triggers:this.registeredTriggers,onTriggerStart:this.handleTriggerStart,onTriggerStop:this.handleTriggerStop,onTriggerChange:this.handleTriggerChange,ui:this.uiType,allowResize:this.allowResize}),this.renderPicker()]}renderPicker(){if(this.isPickerOpen)return i("limel-portal",{containerId:this.portalId,visible:this.isPickerOpen,openDirection:"top",inheritParentWidth:!0,anchor:this.textEditorElement},i("limebb-text-editor-picker",{items:this.items,onItemSelected:this.handleItemSelected,emptyMessage:this.pickerMessage}))}async search(){if(!this.limeObjectService)return;const t=this.editorPickerQuery,i=this.coworkerLimetype;try{const e=await this.limeObjectService.search(t,i,20);if(t!==this.editorPickerQuery)return;const s=e.objects.map((t=>t._id)),r={filter:{key:"_id",op:h.IN,exp:s}},o=(await this.limeObjectService.loadObjects(i.name,r)).objects;this.items=this.loadObjects(i,o)}catch(t){console.error("Failed search for user",t)}}get limeObjectService(){return this.platform.get(s.LimeObjectRepository)}get textEditorElement(){return e(this)}static get watchers(){return{isPickerOpen:["watchOpen"],editorPickerQuery:["watchQuery"]}}};!function(t,i,e,s){var h,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var n=t.length-1;n>=0;n--)(h=t[n])&&(o=(r<3?h(o):r>3?h(i,e,o):h(i,e))||o);r>3&&o&&Object.defineProperty(i,e,o)}([r({map:[("user",t=>Object.values(t).find((t=>i=>(null==i?void 0:i.label)===t)("user")))]})],d.prototype,"coworkerLimetype",void 0);export{d as limebb_text_editor}
1
+ import{r as t,h as i,g as e}from"./p-8e85017b.js";import{P as s,O as h}from"./p-3f4595a3.js";import{a as r}from"./p-0f7e92c9.js";import{a as o,B as n,E as c,T as a}from"./p-214188d4.js";import{i as l}from"./p-86b9d9e8.js";import"./p-8b377b1f.js";const u=class{constructor(i){var e;t(this,i),this.allowResize=!0,this.value="",this.items=[],this.customElements=[],this.registeredTriggers=[],this.isPickerOpen=!1,this.activeTrigger=void 0,this.triggerMap={"@":{customElement:{tagName:"limebb-mention",attributes:["limetype","objectid","href"]},mapAttributes:t=>({limetype:t.secondaryText,objectid:t.value,href:`object/${this.context.limetype}/${this.context.id}`})}},this.handleGlobalKeyPress=t=>{const i=void 0!==this.activeTrigger;t.key===o||t.key===n&&1===this.value.length?this.isPickerOpen=!1:(i&&t.key===c||i&&t.key===a)&&t.preventDefault()},this.globalClickListener=t=>{const i=this.textEditorElement.contains(t.target),e=void 0!==this.activeTrigger;this.isPickerOpen&&!i&&(this.isPickerOpen=!1),i&&e&&(t.stopPropagation(),t.preventDefault(),this.isPickerOpen=!0)},this.handleTriggerStart=t=>{t.stopPropagation(),this.isPickerOpen=!0,this.activeTrigger=t.detail.trigger,this.triggerFunction=t.detail.textEditor},this.handleTriggerStop=t=>{t.stopPropagation(),this.isPickerOpen=!1,this.activeTrigger=void 0},this.handleTriggerChange=t=>{t.stopImmediatePropagation(),this.editorPickerQuery=t.detail.value,this.search()},this.loadObjects=(t,i)=>i.map((i=>{const e=this.limeObjectService.getObject(t.name,i._id);if(e)return{text:e.descriptive,secondaryText:t.name,value:i._id}})).filter(l),this.handleItemSelected=t=>{this.insertEditorNode(t.detail),this.activeTrigger=void 0},this.insertEditorNode=t=>{var i;if(void 0===this.activeTrigger)return void console.warn("No triggerMap found");const e=this.triggerMap[this.activeTrigger];try{null===(i=this.triggerFunction)||void 0===i||i.insert({node:{tagName:e.customElement.tagName,attributes:e.mapAttributes(t)},children:[this.activeTrigger+t.text]})}catch(t){console.error("Can't insert node to the text editor",t)}},this.portalId="crypto"in window&&"function"==typeof(null===(e=window.crypto)||void 0===e?void 0:e.randomUUID)?"a_"+crypto.randomUUID():String.fromCharCode(97+Math.floor(26*Math.random()))+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2)}watchOpen(){this.setupGlobalHandlers()}watchQuery(){this.setPickerMessage()}componentWillLoad(){this.setCustomElementsAndTriggers()}setCustomElementsAndTriggers(){const t=Object.values(this.triggerMap).map((t=>t.customElement));this.customElements=t,this.platform.isFeatureEnabled("useNotifications")&&(this.registeredTriggers=Object.keys(this.triggerMap))}setPickerMessage(){this.pickerMessage=!0===this.isPickerOpen&&this.editorPickerQuery.length>0?"No results for your search...":"Start typing a name..."}setupGlobalHandlers(){this.isPickerOpen?(document.addEventListener("click",this.globalClickListener,{capture:!0}),document.addEventListener("keyup",this.handleGlobalKeyPress)):(document.removeEventListener("click",this.globalClickListener),document.removeEventListener("keyup",this.handleGlobalKeyPress))}render(){return[i("limel-text-editor",{value:this.value,customElements:this.customElements,triggers:this.registeredTriggers,onTriggerStart:this.handleTriggerStart,onTriggerStop:this.handleTriggerStop,onTriggerChange:this.handleTriggerChange,ui:this.uiType,allowResize:this.allowResize}),this.renderPicker()]}renderPicker(){if(this.isPickerOpen)return i("limel-portal",{containerId:this.portalId,visible:this.isPickerOpen,openDirection:"top",inheritParentWidth:!0,anchor:this.textEditorElement},i("limebb-text-editor-picker",{items:this.items,onItemSelected:this.handleItemSelected,emptyMessage:this.pickerMessage}))}async search(){if(!this.limeObjectService)return;const t=this.editorPickerQuery,i=this.coworkerLimetype;try{const e=await this.limeObjectService.search(t,i,20);if(t!==this.editorPickerQuery)return;const s=e.objects.map((t=>t._id)),r={filter:{key:"_id",op:h.IN,exp:s}},o=(await this.limeObjectService.loadObjects(i.name,r)).objects;this.items=this.loadObjects(i,o)}catch(t){console.error("Failed search for user",t)}}get limeObjectService(){return this.platform.get(s.LimeObjectRepository)}get textEditorElement(){return e(this)}static get watchers(){return{isPickerOpen:["watchOpen"],editorPickerQuery:["watchQuery"]}}};!function(t,i,e,s){var h,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var n=t.length-1;n>=0;n--)(h=t[n])&&(o=(r<3?h(o):r>3?h(i,e,o):h(i,e))||o);r>3&&o&&Object.defineProperty(i,e,o)}([r({map:[("user",t=>Object.values(t).find((t=>i=>(null==i?void 0:i.label)===t)("user")))]})],u.prototype,"coworkerLimetype",void 0);export{u as limebb_text_editor}
@@ -1,15 +1,15 @@
1
1
  import { LimeWebComponent, LimeWebComponentContext, LimeWebComponentPlatform } from '@limetech/lime-web-components';
2
2
  /**
3
3
  * This component is a wrapper on the `limel-text-editor`. It adds support for platform
4
- * specific things that can't reside in lime-elements. So this is basically a
4
+ * specific things that can't reside in lime-elements. So this is basically an
5
5
  * invocation of the text editor with support for mentions.
6
6
  *
7
- * A mention is practically a inserted <limebb-mention /> tag that will visually show
7
+ * A mention is practically an inserted <limebb-mention /> tag that will visually show
8
8
  * the mention in the text editor but will also trigger the creation of a mention on
9
9
  * the server side if saved together with a text field in a limeobject.
10
10
  *
11
11
  * The mention will always point towards a limeobject with the combination of a limetype
12
- * that has the label USER and a object id.
12
+ * that has the label USER and an object id.
13
13
  *
14
14
  * @todo replace the elastic search with lime-query
15
15
  * @todo move findLimetypeByLabel from crm-components to some suitable place
@@ -0,0 +1,6 @@
1
+ declare module '@limetech/lime-web-components' {
2
+ interface FeatureSwitches {
3
+ useNotifications: boolean;
4
+ }
5
+ }
6
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limetech/lime-crm-building-blocks",
3
- "version": "1.50.2",
3
+ "version": "1.50.3",
4
4
  "description": "A home for shared components meant for use with Lime CRM",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",