@limetech/lime-crm-building-blocks 1.100.1 → 1.102.0
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 +14 -0
- package/dist/cjs/lime-crm-building-blocks.cjs.js +1 -1
- package/dist/cjs/lime-query-validation-6be10fa7.js +558 -0
- package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +22 -426
- package/dist/cjs/limebb-lime-query-filter-builder_3.cjs.entry.js +86 -243
- package/dist/cjs/limebb-lime-query-filter-comparison_2.cjs.entry.js +1 -1
- package/dist/cjs/limebb-lime-query-filter-group_3.cjs.entry.js +2 -2
- package/dist/cjs/limebb-lime-query-order-by-item.cjs.entry.js +51 -0
- package/dist/cjs/limebb-lime-query-response-format-builder.cjs.entry.js +242 -0
- package/dist/cjs/limebb-lime-query-response-format-editor_2.cjs.entry.js +322 -0
- package/dist/cjs/limebb-live-docs-info.cjs.entry.js +2 -2
- package/dist/cjs/limebb-locale-picker.cjs.entry.js +1 -1
- package/dist/cjs/limebb-mention-group-counter.cjs.entry.js +2 -2
- package/dist/cjs/limebb-navigation-button_2.cjs.entry.js +3 -3
- package/dist/cjs/limebb-notification-item.cjs.entry.js +1 -1
- package/dist/cjs/limebb-percentage-visualizer.cjs.entry.js +2 -2
- package/dist/cjs/limebb-text-editor.cjs.entry.js +1 -1
- package/dist/cjs/limebb-trend-indicator.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +5 -2
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison.js +1 -1
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-group.js +1 -1
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-not.js +1 -1
- package/dist/collection/components/lime-query-builder/lime-query-builder.css +2 -5
- package/dist/collection/components/lime-query-builder/lime-query-builder.js +20 -20
- package/dist/collection/components/lime-query-builder/lime-query-response-format-builder.css +91 -0
- package/dist/collection/components/lime-query-builder/lime-query-response-format-builder.js +355 -0
- package/dist/collection/components/lime-query-builder/lime-query-validation.js +154 -7
- package/dist/collection/components/lime-query-builder/limetype-field/limetype-field.js +1 -1
- package/dist/collection/components/lime-query-builder/order-by/order-by-editor.css +72 -0
- package/dist/collection/components/lime-query-builder/order-by/order-by-editor.js +252 -0
- package/dist/collection/components/lime-query-builder/order-by/order-by-item.css +45 -0
- package/dist/collection/components/lime-query-builder/order-by/order-by-item.js +173 -0
- package/dist/collection/components/lime-query-builder/{response-format-editor.css → response-format/response-format-editor.css} +1 -1
- package/dist/collection/components/lime-query-builder/{response-format-editor.js → response-format/response-format-editor.js} +5 -5
- package/dist/collection/components/lime-query-builder/response-format/response-format-helpers.js +92 -0
- package/dist/collection/components/lime-query-builder/{response-format-item.css → response-format/response-format-item.css} +1 -1
- package/dist/collection/components/lime-query-builder/{response-format-item.js → response-format/response-format-item.js} +6 -6
- package/dist/collection/components/limeobject/file-viewer/live-docs-info.js +2 -2
- package/dist/collection/components/locale-picker/locale-picker.js +1 -1
- package/dist/collection/components/notification-list/notification-item/notification-item.js +1 -1
- package/dist/collection/components/percentage-visualizer/percentage-visualizer.js +2 -2
- package/dist/collection/components/summary-popover/summary-popover.js +3 -3
- package/dist/collection/components/text-editor/mention-group-counter.js +2 -2
- package/dist/collection/components/text-editor/text-editor.js +1 -1
- package/dist/collection/components/trend-indicator/trend-indicator.js +1 -1
- package/dist/components/lime-query-filter-comparison.js +1 -1
- package/dist/components/lime-query-filter-expression.js +2 -2
- package/dist/components/lime-query-validation.js +555 -0
- package/dist/components/lime-query-value-input.js +1 -1
- package/dist/components/limebb-lime-query-builder.js +53 -444
- package/dist/components/limebb-lime-query-order-by-editor.d.ts +11 -0
- package/dist/components/limebb-lime-query-order-by-editor.js +6 -0
- package/dist/components/limebb-lime-query-order-by-item.d.ts +11 -0
- package/dist/components/limebb-lime-query-order-by-item.js +6 -0
- package/dist/components/limebb-lime-query-response-format-builder.d.ts +11 -0
- package/dist/components/limebb-lime-query-response-format-builder.js +283 -0
- package/dist/components/limebb-lime-query-response-format-editor.d.ts +11 -0
- package/dist/components/{limebb-response-format-editor.js → limebb-lime-query-response-format-editor.js} +2 -2
- package/dist/components/limebb-lime-query-response-format-item.d.ts +11 -0
- package/dist/components/{limebb-response-format-item.js → limebb-lime-query-response-format-item.js} +2 -2
- package/dist/components/limebb-locale-picker.js +1 -1
- package/dist/components/limebb-mention-group-counter.js +2 -2
- package/dist/components/limebb-percentage-visualizer.js +2 -2
- package/dist/components/limebb-text-editor.js +1 -1
- package/dist/components/limebb-trend-indicator.js +1 -1
- package/dist/components/limetype-field.js +1 -1
- package/dist/components/live-docs-info.js +2 -2
- package/dist/components/notification-item.js +1 -1
- package/dist/components/order-by-editor.js +123 -0
- package/dist/components/order-by-item.js +73 -0
- package/dist/components/property-selector.js +1 -1
- package/dist/components/response-format-editor.js +11 -11
- package/dist/components/response-format-item.js +9 -9
- package/dist/components/summary-popover.js +3 -3
- package/dist/esm/lime-crm-building-blocks.js +1 -1
- package/dist/esm/lime-query-validation-573223a5.js +555 -0
- package/dist/esm/limebb-lime-query-builder.entry.js +22 -426
- package/dist/esm/limebb-lime-query-filter-builder_3.entry.js +86 -243
- package/dist/esm/limebb-lime-query-filter-comparison_2.entry.js +1 -1
- package/dist/esm/limebb-lime-query-filter-group_3.entry.js +3 -3
- package/dist/esm/limebb-lime-query-order-by-item.entry.js +47 -0
- package/dist/esm/limebb-lime-query-response-format-builder.entry.js +238 -0
- package/dist/esm/limebb-lime-query-response-format-editor_2.entry.js +317 -0
- package/dist/esm/limebb-live-docs-info.entry.js +2 -2
- package/dist/esm/limebb-locale-picker.entry.js +1 -1
- package/dist/esm/limebb-mention-group-counter.entry.js +2 -2
- package/dist/esm/limebb-navigation-button_2.entry.js +3 -3
- package/dist/esm/limebb-notification-item.entry.js +1 -1
- package/dist/esm/limebb-percentage-visualizer.entry.js +2 -2
- package/dist/esm/limebb-property-selector.entry.js +1 -1
- package/dist/esm/limebb-text-editor.entry.js +1 -1
- package/dist/esm/limebb-trend-indicator.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{property-resolution-fde2375e.js → property-resolution-c21a1369.js} +1 -1
- package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
- package/dist/lime-crm-building-blocks/{p-79b8b09b.entry.js → p-0de79b7f.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-1034b4a5.entry.js → p-0f7135ff.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-6aa216ec.entry.js → p-186e9f1a.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-289ce8b9.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-3351395b.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-33e6d0ec.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-8581245a.entry.js → p-3d1be1c9.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-b57dafef.entry.js → p-577d8909.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-89a6c396.entry.js → p-6579412e.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-8fb2e192.entry.js → p-6f6fed59.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-58782467.entry.js → p-7e5528f6.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-2048ac67.entry.js → p-a9ac501f.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-f79e354b.entry.js → p-abfc7815.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-e0ab1554.js → p-b748c770.js} +1 -1
- package/dist/lime-crm-building-blocks/p-be845252.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-cb338753.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-76d81eee.entry.js → p-d0721b22.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-fa2da6bc.js +1 -0
- package/dist/types/components/lime-query-builder/lime-query-builder.d.ts +9 -6
- package/dist/types/components/lime-query-builder/lime-query-response-format-builder.d.ts +102 -0
- package/dist/types/components/lime-query-builder/lime-query-validation.d.ts +13 -0
- package/dist/types/components/lime-query-builder/order-by/order-by-editor.d.ts +58 -0
- package/dist/types/components/lime-query-builder/order-by/order-by-item.d.ts +37 -0
- package/dist/types/components/lime-query-builder/{response-format-editor.d.ts → response-format/response-format-editor.d.ts} +2 -2
- package/dist/types/components/lime-query-builder/response-format/response-format-helpers.d.ts +42 -0
- package/dist/types/components/lime-query-builder/{response-format-item.d.ts → response-format/response-format-item.d.ts} +2 -2
- package/dist/types/components.d.ts +667 -279
- package/package.json +1 -1
- package/dist/cjs/limebb-response-format-item.cjs.entry.js +0 -80
- package/dist/components/limebb-response-format-editor.d.ts +0 -11
- package/dist/components/limebb-response-format-item.d.ts +0 -11
- package/dist/esm/limebb-response-format-item.entry.js +0 -76
- package/dist/lime-crm-building-blocks/p-244ee55b.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-323c49bc.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-f22b66f6.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as i,h as e,g as r}from"./p-1556b545.js";import{c as s,W as n,H as o,T as a}from"./p-4838284a.js";import{A as h,a as c,b as u,E as f,T as l}from"./p-463d3174.js";import{b as d,k as v,c as b,s as p,a as m,d as g,U as j,S as y,g as w}from"./p-35897ec3.js";import{d as O}from"./p-123190c3.js";import{e as S}from"./p-fe2b91d9.js";import{d as k,r as x,S as I,a as T,i as A}from"./p-b31772c8.js";import{d as C,i as E,o as F,g as M,h as P,n as $,a as N}from"./p-5322fd19.js";import{c as _}from"./p-fbda77a7.js";import{h as D,a as L,g as R}from"./p-20bfca36.js";import{i as U}from"./p-1484e300.js";import{i as z}from"./p-7e6fb4af.js";var G=/\s/,W=/^\s+/;var H=NaN,Q=/^[-+]0x[0-9a-f]+$/i,q=/^0b[01]+$/i,B=/^0o[0-7]+$/i,K=parseInt;function V(t){if("number"==typeof t)return t;if(z(t))return H;if(k(t)){var i="function"==typeof t.valueOf?t.valueOf():t;t=k(i)?i+"":i}if("string"!=typeof t)return 0===t?t:+t;var e;t=(e=t)?e.slice(0,function(t){for(var i=t.length;i--&&G.test(t.charAt(i)););return i}(e)+1).replace(W,""):e;var r=q.test(t);return r||B.test(t)?K(t.slice(2),r?2:8):Q.test(t)?H:+t}var J=Object.create;const X=function(){function t(){}return function(i){if(!k(i))return{};if(J)return J(i);t.prototype=i;var e=new t;return t.prototype=void 0,e}}();function Y(t,i,e){"__proto__"==i&&O?O(t,i,{configurable:!0,enumerable:!0,value:e,writable:!0}):t[i]=e}var Z=Object.prototype.hasOwnProperty;function tt(t,i,e){var r=t[i];Z.call(t,i)&&S(r,e)&&(void 0!==e||i in t)||Y(t,i,e)}function it(t,i,e,r){var s=!e;e||(e={});for(var n=-1,o=i.length;++n<o;){var a=i[n],h=r?r(e[a],t[a],a,e,t):void 0;void 0===h&&(h=t[a]),s?Y(e,a,h):tt(e,a,h)}return e}var et=Object.prototype.hasOwnProperty;function rt(t){return E(t)?d(t,!0):function(t){if(!k(t))return function(t){var i=[];if(null!=t)for(var e in Object(t))i.push(e);return i}(t);var i=C(t),e=[];for(var r in t)("constructor"!=r||!i&&et.call(t,r))&&e.push(r);return e}(t)}const st=F(Object.getPrototypeOf,Object);var nt="object"==typeof exports&&exports&&!exports.nodeType&&exports,ot=nt&&"object"==typeof module&&module&&!module.nodeType&&module,at=ot&&ot.exports===nt?x.Buffer:void 0,ht=at?at.allocUnsafe:void 0;const ct=Object.getOwnPropertySymbols?function(t){for(var i=[];t;)m(i,b(t)),t=st(t);return i}:p;function ut(t){return g(t,rt,ct)}var ft=Object.prototype.hasOwnProperty;function lt(t){var i=new t.constructor(t.byteLength);return new j(i).set(new j(t)),i}var dt=/\w*$/,vt=I?I.prototype:void 0,bt=vt?vt.valueOf:void 0,pt="[object Boolean]",mt="[object Date]",gt="[object Map]",jt="[object Number]",yt="[object RegExp]",wt="[object Set]",Ot="[object String]",St="[object Symbol]",kt="[object ArrayBuffer]",xt="[object DataView]",It="[object Float32Array]",Tt="[object Float64Array]",At="[object Int8Array]",Ct="[object Int16Array]",Et="[object Int32Array]",Ft="[object Uint8Array]",Mt="[object Uint8ClampedArray]",Pt="[object Uint16Array]",$t="[object Uint32Array]";var Nt=$&&$.isMap;const _t=Nt?P(Nt):function(t){return T(t)&&"[object Map]"==M(t)};var Dt=$&&$.isSet;const Lt=Dt?P(Dt):function(t){return T(t)&&"[object Set]"==M(t)};var Rt=1,Ut=2,zt=4,Gt="[object Arguments]",Wt="[object Function]",Ht="[object GeneratorFunction]",Qt="[object Object]",qt={};function Bt(t,i,e,r,s,n){var o,a=i&Rt,h=i&Ut,c=i&zt;if(e&&(o=s?e(t,r,s,n):e(t)),void 0!==o)return o;if(!k(t))return t;var u=A(t);if(u){if(o=function(t){var i=t.length,e=new t.constructor(i);return i&&"string"==typeof t[0]&&ft.call(t,"index")&&(e.index=t.index,e.input=t.input),e}(t),!a)return function(t,i){var e=-1,r=t.length;for(i||(i=Array(r));++e<r;)i[e]=t[e];return i}(t,o)}else{var f=M(t),l=f==Wt||f==Ht;if(N(t))return function(t,i){if(i)return t.slice();var e=t.length,r=ht?ht(e):new t.constructor(e);return t.copy(r),r}(t,a);if(f==Qt||f==Gt||l&&!s){if(o=h||l?{}:function(t){return"function"!=typeof t.constructor||C(t)?{}:X(st(t))}(t),!a)return h?function(t,i){return it(t,ct(t),i)}(t,function(t,i){return t&&it(i,rt(i),t)}(o,t)):function(t,i){return it(t,b(t),i)}(t,function(t,i){return t&&it(i,v(i),t)}(o,t))}else{if(!qt[f])return s?t:{};o=function(t,i,e){var r,s,n=t.constructor;switch(i){case kt:return lt(t);case pt:case mt:return new n(+t);case xt:return function(t,i){var e=i?lt(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.byteLength)}(t,e);case It:case Tt:case At:case Ct:case Et:case Ft:case Mt:case Pt:case $t:return function(t,i){var e=i?lt(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.length)}(t,e);case gt:return new n;case jt:case Ot:return new n(t);case yt:return(s=new(r=t).constructor(r.source,dt.exec(r))).lastIndex=r.lastIndex,s;case wt:return new n;case St:return bt?Object(bt.call(t)):{}}}(t,f,a)}}n||(n=new y);var d=n.get(t);if(d)return d;n.set(t,o),Lt(t)?t.forEach((function(r){o.add(Bt(r,i,e,r,t,n))})):_t(t)&&t.forEach((function(r,s){o.set(s,Bt(r,i,e,s,t,n))}));var p=u?void 0:(c?h?ut:w:h?rt:v)(t);return function(t,i){for(var e=-1,r=null==t?0:t.length;++e<r&&!1!==i(t[e],e););}(p||t,(function(r,s){p&&(r=t[s=r]),tt(o,s,Bt(r,i,e,s,t,n))})),o}qt[Gt]=qt["[object Array]"]=qt["[object ArrayBuffer]"]=qt["[object DataView]"]=qt["[object Boolean]"]=qt["[object Date]"]=qt["[object Float32Array]"]=qt["[object Float64Array]"]=qt["[object Int8Array]"]=qt["[object Int16Array]"]=qt["[object Int32Array]"]=qt["[object Map]"]=qt["[object Number]"]=qt[Qt]=qt["[object RegExp]"]=qt["[object Set]"]=qt["[object String]"]=qt["[object Symbol]"]=qt["[object Uint8Array]"]=qt["[object Uint8ClampedArray]"]=qt["[object Uint16Array]"]=qt["[object Uint32Array]"]=!0,qt["[object Error]"]=qt[Wt]=qt["[object WeakMap]"]=!1;const Kt=function(){return x.Date.now()};var Vt=Math.max,Jt=Math.min;class Xt{get limeObjectService(){return this.platform.get(s.LimeObjectRepository)}get queryService(){return this.platform.get(s.Query)}get viewFactoryRegistry(){return this.platform.get(s.ViewFactoryRegistry)}get translator(){var t;return null===(t=this.platform)||void 0===t?void 0:t.get(s.Translate)}get triggerCharacter(){return this._triggerCharacter}get triggerHandler(){return this._triggerHandler}constructor(t,i,e){this.platform=t,this.context=i,this.searchableLimetypes=e,this.groupCounts={},this._triggerCharacter="@",this._triggerHandler={searcher:t=>this.searcher(t),inserter:(t,i)=>this.inserter(t,i),emptySearchMessage:"Start typing a name...",noItemsFoundMessage:"No results for your search...",nodeDefinition:{customElement:{tagName:"limebb-mention",attributes:["limetype","objectid","href"]},mapAttributes:t=>({limetype:t.value.getLimetype().name,objectid:t.value.id,href:`object/${this.context.limetype}/${this.context.id}`})}},this.searcher=async t=>{if(!t)return[];const{objects:i}=await this.limeObjectService.search(t,this.searchableLimetypes,10);return this.createSearchListItems(i)},this.inserter=async(t,i)=>{var e;const r=this.triggerHandler.nodeDefinition;r&&t.insert({node:{tagName:r.customElement.tagName,attributes:r.mapAttributes(i)},children:[null===(e=i.value)||void 0===e?void 0:e.descriptive]})}}async initialize(){await this.loadGroupCounts()}async loadGroupCounts(){const t=this.searchableLimetypes.filter((t=>!D(t,"user")&&L(t,"user"))).map((t=>this.getGroupCounts(t)));for(const i of await Promise.all(t))Object.assign(this.groupCounts,i)}async getGroupCounts(t){var i;const e=R(t,"user"),r=t.name;try{const t=await this.queryService.execute({limetype:r,responseFormat:{object:{_id:null,[e.name]:{count:{aggregate:{op:n.Count}}}}}});if(!(null===(i=t.objects)||void 0===i?void 0:i.length))return{[r]:{}};const s=this.createGroupCount(t.objects,e.name);return{[r]:s}}catch(i){return console.error(`Error fetching group count for limetype: ${t.name}`,i),{[r]:{}}}}createGroupCount(t,i){const e={};for(const r of t){const{_id:t,[i]:s}=r;e[t]=s.count}return e}createSearchListItems(t=[]){return t.map((t=>this.createSearchListItem(t))).filter(U)}createSearchListItem(t){const i=this.viewFactoryRegistry.getFactory("search"),e=this.limeObjectService.getObject(t._limetype,t._id);if(!e)return null;const r=i(e,this.context),s=this.getGroupCountComponent(e);return Object.assign(Object.assign({},r),s?{primaryComponent:s}:{})}getGroupCountComponent(t){var i;const e=t.getLimetype(),r=null===(i=this.groupCounts[e.name])||void 0===i?void 0:i[t.id],s=R(e,"user");if(void 0!==r&&s)return{name:"limebb-mention-group-counter",props:{count:r,limetype:s.relation.getLimetype(),helperLabel:this.translator.get("webclient.notification-center.members-will-be-notified")}}}}class Yt{constructor(t,i){this.file=t,this.http=i,this.uploadCancelled=!1,this.getUrl=t=>`api/v1/file/${null!=t?t:""}`}async initialize(){this.uploadService=await this.http.createFileUpload(o.Post,this.getUrl(),this.file),this.progressCallback&&(this.uploadService.onProgress=this.progressCallback)}async upload(){return this.uploadService.upload()}getFileName(){return this.file.name}cancel(){this.uploadService.cancel(),this.uploadCancelled=!0}set onProgress(t){this.progressCallback=t,this.uploadService&&(this.uploadService.onProgress=t)}}class Zt{constructor(t){this.platform=t}async handleImagePasted(t){const i=null==t?void 0:t.fileInfo;if(!i)return;if(!this.validateImageSize(i))return;t.insertThumbnail();const e=await this.createFileUpload(i),r=null==e?void 0:e.href;return r&&void 0!==(null==e?void 0:e.fileId)?t.insertImage(r):t.insertFailedThumbnail(),e}parseFileIdFromSrc(t){if(t){const i=/\/(\d+)\/contents\/?$/.exec(t);if(i&&i[1])return Number(i[1])}}validateImageSize(t){return!!t.fileContent&&t.fileContent.size<=52428800}async createFileUpload(t){var i;if(!t.fileContent)return;const e=new Yt(t.fileContent,this.http);await e.initialize();const r=Object.assign(Object.assign({},t),{progress:0,file:e,state:"added",fileId:void 0,href:void 0,id:t.id});e.onProgress=t=>{0===r.progress&&(r.state="uploading"),r.progress=t,100===t&&(r.state="finalizing")};const s=await e.upload();return r.fileId=s.id,r.filename=s.filename,r.extension=s.extension,r.contentType=s.contentType,r.size=s.size,r.state="done",r.href=null===(i=s._links)||void 0===i?void 0:i.contents.href,r}get http(){return this.platform.get(s.Http)}}const ti=class{watchOpen(){this.setupHandlers(),this.setPickerMessage()}watchQuery(){this.setPickerMessage()}constructor(e){t(this,e),this.change=i(this,"change",7),this.metadataChange=i(this,"metadataChange",7),this.allowMentioning=!1,this.contentType="markdown",this.language="en",this.disabled=!1,this.readonly=!1,this.invalid=!1,this.required=!1,this.ui="standard",this.allowResize=!0,this.value="",this.triggerMap={},this.customElements=[],this.allowInlineImages=!1,this.items=[],this.highlightedItemIndex=0,this.isPickerOpen=!1,this.isSearching=!1,this.registeredTriggers=[],this.registeredTriggerMap=this.triggerMap,this.registeredCustomElements=this.customElements,this.activeTrigger=void 0,this.handleMouseClick=t=>{this.textEditorPickerElement&&(t.target===this.textEditorPickerElement||this.resetTriggerAndPicker())},this.handleKeyPress=t=>{if(!this.isPickerOpen||!this.activeTrigger)return;if(![c,u,h,f,l].includes(t.key))return;if(t.stopPropagation(),t.preventDefault(),"keyup"===t.type)return;const i={[c]:this.handleEscapeKey,[f]:this.handleEnterOrTabKey,[l]:this.handleEnterOrTabKey,[h]:this.handleArrowKeyPress,[u]:this.handleArrowKeyPress}[t.key];i&&i(t)},this.handleArrowKeyPress=t=>{this.highlightedItemIndex=this.findNonSeparatorIndex(t.key,this.highlightedItemIndex)},this.findNonSeparatorIndex=(t,i,e=0)=>{if(0===this.items.length||e>this.items.length)return i;const r=((t,i,e)=>(i+(t===h?1:-1)+e)%e)(t,i,this.items.length);return this.isListSeparator(this.items[r])?this.findNonSeparatorIndex(t,r,e+1):r},this.handleEscapeKey=()=>{var t;null===(t=this.triggerFunction)||void 0===t||t.stopTrigger(),this.resetTriggerAndPicker()},this.handleEnterOrTabKey=t=>{this.handleItemSelection(t)},this.handleMetadataChange=t=>{t.stopPropagation();const i=t.detail,e=this.getEnhancedImages(i.images||[]),r=Object.assign(Object.assign({},i),{images:e});this.metadataChange.emit(r)},this.handleImagePasted=t=>{t.stopPropagation(),this.allowInlineImages&&this.uploadHandler.handleImagePasted(t.detail)},this.handleTriggerStart=t=>{t.stopPropagation(),this.activeTrigger=t.detail.trigger,this.triggerFunction=t.detail.textEditor,this.isPickerOpen=!0},this.handleTriggerStop=t=>{t.stopPropagation(),this.resetTriggerAndPicker()},this.handleTriggerChange=t=>{var i;t.stopImmediatePropagation(),this.editorPickerQuery=t.detail.value;const e=null===(i=this.registeredTriggerMap[t.detail.trigger])||void 0===i?void 0:i.searcher;e&&(this.isSearching=!0,this.debouncedSearchFn(e,this.editorPickerQuery))},this.resetTriggerAndPicker=()=>{this.isPickerOpen=!1,this.activeTrigger=void 0,this.triggerFunction=void 0,this.isSearching=!1,this.highlightedItemIndex=0,this.items=[]},this.handleItemSelection=t=>{var i;let e;if(t instanceof CustomEvent)e=t.detail;else{if(!(t instanceof KeyboardEvent))return;{const t=this.items[this.highlightedItemIndex];if(this.isListSeparator(t))return;e=t}}if(!this.activeTrigger)return;const r=this.registeredTriggerMap[this.activeTrigger];try{r.inserter(this.triggerFunction,e)}catch(t){console.error("Error inserting",t)}this.resetTriggerAndPicker(),null===(i=this.textEditor)||void 0===i||i.focus()},this.handleVisibilityChange=()=>{"hidden"===document.visibilityState&&this.saveDraft()},this.handleBeforeUnload=()=>{this.saveDraft()},this.portalId=_(),this.debouncedSearchFn=function(t,i,e){var r,s,n,o,a,h,c=0,u=!1,f=!1,l=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function d(i){var e=r,n=s;return r=s=void 0,c=i,o=t.apply(n,e)}function v(t){var e=t-h;return void 0===h||e>=i||e<0||f&&t-c>=n}function b(){var t=Kt();if(v(t))return p(t);a=setTimeout(b,function(t){var e=i-(t-h);return f?Jt(e,n-(t-c)):e}(t))}function p(t){return a=void 0,l&&r?d(t):(r=s=void 0,o)}function m(){var t=Kt(),e=v(t);if(r=arguments,s=this,h=t,e){if(void 0===a)return function(t){return c=t,a=setTimeout(b,i),u?d(t):o}(h);if(f)return clearTimeout(a),a=setTimeout(b,i),d(h)}return void 0===a&&(a=setTimeout(b,i)),o}return i=V(i)||0,k(e)&&(u=!!e.leading,n=(f="maxWait"in e)?Vt(V(e.maxWait)||0,i):n,l="trailing"in e?!!e.trailing:l),m.cancel=function(){void 0!==a&&clearTimeout(a),c=0,r=h=s=a=void 0},m.flush=function(){return void 0===a?o:p(Kt())},m}((async(t,i)=>{try{const e=await t(i);if(i!==this.editorPickerQuery||!this.activeTrigger)return;this.items=e}catch(t){console.error("Error searching",t)}finally{this.isSearching=!1}}),300)}connectedCallback(){var t,i,e,r;if(this.draftIdentifier){const s=null!==(i=null===(t=this.context)||void 0===t?void 0:t.id)&&void 0!==i?i:"no-limeobject",n=null!==(r=null===(e=this.context)||void 0===e?void 0:e.limetype)&&void 0!==r?r:"no-limetype";this.textEditorInnerId=["text-editor-draft",n,s,this.draftIdentifier].join("-")}this.textEditorInnerId&&(document.addEventListener("visibilitychange",this.handleVisibilityChange),window.addEventListener("beforeunload",this.handleBeforeUnload)),this.uploadHandler=new Zt(this.platform)}componentWillLoad(){this.allowMentioning&&this.registerMentions(),this.registerTriggers(),this.loadDraft()}disconnectedCallback(){document.removeEventListener("visibilitychange",this.handleVisibilityChange),window.removeEventListener("beforeunload",this.handleBeforeUnload),document.removeEventListener("mousedown",this.handleMouseClick),this.saveDraft(),this.host&&(this.host.removeEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.removeEventListener("keydown",this.handleKeyPress,{capture:!0})),this.debouncedSearchFn&&this.debouncedSearchFn.cancel&&this.debouncedSearchFn.cancel()}registerMentions(){const t=new Xt(this.platform,this.context,this.searchableLimetypes),i=t.triggerHandler.nodeDefinition;i&&(this.registeredCustomElements.push(i.customElement),this.registeredTriggerMap[t.triggerCharacter]=t.triggerHandler,t.initialize())}registerTriggers(){this.registeredTriggers=Object.keys(this.registeredTriggerMap)}setPickerMessage(){var t;if(!this.activeTrigger)return;const i=this.registeredTriggerMap[this.activeTrigger];this.pickerMessage=(null===(t=this.editorPickerQuery)||void 0===t?void 0:t.length)>0?i.noItemsFoundMessage:i.emptySearchMessage}setupHandlers(){this.isPickerOpen?(this.host.addEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.addEventListener("keydown",this.handleKeyPress,{capture:!0}),document.addEventListener("mousedown",this.handleMouseClick)):(this.host.removeEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.removeEventListener("keydown",this.handleKeyPress,{capture:!0}),document.removeEventListener("mousedown",this.handleMouseClick))}isListSeparator(t){return"separator"in t&&!0===t.separator}render(){return[e("limel-text-editor",{key:"42b8630e5e15e4e7ca20277687695a245f2ea267",ref:t=>this.textEditor=t,tabindex:this.disabled?-1:0,value:this.value,contentType:this.contentType,customElements:this.registeredCustomElements,"aria-disabled":this.disabled,language:this.language,triggers:this.registeredTriggers,onTriggerStart:this.handleTriggerStart,onTriggerStop:this.handleTriggerStop,onTriggerChange:this.handleTriggerChange,onImagePasted:this.handleImagePasted,onMetadataChange:this.handleMetadataChange,ui:this.ui,allowResize:this.allowResize,required:this.required,disabled:this.disabled,readonly:this.readonly,helperText:this.helperText,placeholder:this.placeholder,label:this.label,invalid:this.invalid}),this.renderPicker()]}renderPicker(){if(this.isPickerOpen)return e("limel-portal",{containerId:this.portalId,visible:this.isPickerOpen,openDirection:"top",inheritParentWidth:!0,anchor:this.textEditor},e("limebb-text-editor-picker",{ref:t=>this.textEditorPickerElement=t,items:(t=this.items,i=this.highlightedItemIndex,t.map(((t,e)=>{const r=Bt(t,5);return Object.assign(Object.assign({},r),{selected:e===i})}))),onItemSelected:this.handleItemSelection,emptyMessage:this.pickerMessage,isSearching:this.isSearching}));var t,i}getEnhancedImages(t){return t.map((t=>{let i;return"success"===t.state&&(i=this.uploadHandler.parseFileIdFromSrc(t.src)),i?Object.assign(Object.assign({},t),{fileId:i}):t}))}loadDraft(){if(!this.userDataService||!this.textEditorInnerId)return;if(this.value)return;const t=this.userDataService.get(this.textEditorInnerId);t&&this.change.emit(t)}saveDraft(){var t,i,e,r;if(!this.textEditorInnerId)return;const s=null===(t=this.value)||void 0===t?void 0:t.trim(),n=null===(i=this.userDataService)||void 0===i?void 0:i.get(this.textEditorInnerId);s&&s!==n?null===(e=this.userDataService)||void 0===e||e.set(this.textEditorInnerId,s):!s&&n&&(null===(r=this.userDataService)||void 0===r||r.set(this.textEditorInnerId,void 0))}get userDataService(){return this.platform.get(s.UserDataRepository)}get host(){return r(this)}static get watchers(){return{isPickerOpen:["watchOpen"],editorPickerQuery:["watchQuery"]}}};!function(t,i,e,r){var s,n=arguments.length,o=n<3?i:null===r?r=Object.getOwnPropertyDescriptor(i,e):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,r);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(n<3?s(o):n>3?s(i,e,o):s(i,e))||o);n>3&&o&&Object.defineProperty(i,e,o)}([a({map:[function(t){return Object.values(t).filter((t=>D(t,"user")||L(t,"user")))}]})],ti.prototype,"searchableLimetypes",void 0);export{ti as limebb_text_editor}
|
|
1
|
+
import{r as t,c as i,h as e,g as r}from"./p-1556b545.js";import{c as s,W as n,H as o,T as a}from"./p-4838284a.js";import{A as h,a as c,b as u,E as f,T as l}from"./p-463d3174.js";import{b as d,k as v,c as b,s as p,a as m,d as g,U as j,S as y,g as w}from"./p-35897ec3.js";import{d as O}from"./p-123190c3.js";import{e as S}from"./p-fe2b91d9.js";import{d as k,r as x,S as I,a as T,i as A}from"./p-b31772c8.js";import{d as C,i as E,o as F,g as M,h as P,n as $,a as N}from"./p-5322fd19.js";import{c as _}from"./p-fbda77a7.js";import{h as D,a as L,g as R}from"./p-20bfca36.js";import{i as U}from"./p-1484e300.js";import{i as z}from"./p-7e6fb4af.js";var G=/\s/,W=/^\s+/;var H=NaN,Q=/^[-+]0x[0-9a-f]+$/i,q=/^0b[01]+$/i,B=/^0o[0-7]+$/i,K=parseInt;function V(t){if("number"==typeof t)return t;if(z(t))return H;if(k(t)){var i="function"==typeof t.valueOf?t.valueOf():t;t=k(i)?i+"":i}if("string"!=typeof t)return 0===t?t:+t;var e;t=(e=t)?e.slice(0,function(t){for(var i=t.length;i--&&G.test(t.charAt(i)););return i}(e)+1).replace(W,""):e;var r=q.test(t);return r||B.test(t)?K(t.slice(2),r?2:8):Q.test(t)?H:+t}var J=Object.create;const X=function(){function t(){}return function(i){if(!k(i))return{};if(J)return J(i);t.prototype=i;var e=new t;return t.prototype=void 0,e}}();function Y(t,i,e){"__proto__"==i&&O?O(t,i,{configurable:!0,enumerable:!0,value:e,writable:!0}):t[i]=e}var Z=Object.prototype.hasOwnProperty;function tt(t,i,e){var r=t[i];Z.call(t,i)&&S(r,e)&&(void 0!==e||i in t)||Y(t,i,e)}function it(t,i,e,r){var s=!e;e||(e={});for(var n=-1,o=i.length;++n<o;){var a=i[n],h=r?r(e[a],t[a],a,e,t):void 0;void 0===h&&(h=t[a]),s?Y(e,a,h):tt(e,a,h)}return e}var et=Object.prototype.hasOwnProperty;function rt(t){return E(t)?d(t,!0):function(t){if(!k(t))return function(t){var i=[];if(null!=t)for(var e in Object(t))i.push(e);return i}(t);var i=C(t),e=[];for(var r in t)("constructor"!=r||!i&&et.call(t,r))&&e.push(r);return e}(t)}const st=F(Object.getPrototypeOf,Object);var nt="object"==typeof exports&&exports&&!exports.nodeType&&exports,ot=nt&&"object"==typeof module&&module&&!module.nodeType&&module,at=ot&&ot.exports===nt?x.Buffer:void 0,ht=at?at.allocUnsafe:void 0;const ct=Object.getOwnPropertySymbols?function(t){for(var i=[];t;)m(i,b(t)),t=st(t);return i}:p;function ut(t){return g(t,rt,ct)}var ft=Object.prototype.hasOwnProperty;function lt(t){var i=new t.constructor(t.byteLength);return new j(i).set(new j(t)),i}var dt=/\w*$/,vt=I?I.prototype:void 0,bt=vt?vt.valueOf:void 0,pt="[object Boolean]",mt="[object Date]",gt="[object Map]",jt="[object Number]",yt="[object RegExp]",wt="[object Set]",Ot="[object String]",St="[object Symbol]",kt="[object ArrayBuffer]",xt="[object DataView]",It="[object Float32Array]",Tt="[object Float64Array]",At="[object Int8Array]",Ct="[object Int16Array]",Et="[object Int32Array]",Ft="[object Uint8Array]",Mt="[object Uint8ClampedArray]",Pt="[object Uint16Array]",$t="[object Uint32Array]";var Nt=$&&$.isMap;const _t=Nt?P(Nt):function(t){return T(t)&&"[object Map]"==M(t)};var Dt=$&&$.isSet;const Lt=Dt?P(Dt):function(t){return T(t)&&"[object Set]"==M(t)};var Rt=1,Ut=2,zt=4,Gt="[object Arguments]",Wt="[object Function]",Ht="[object GeneratorFunction]",Qt="[object Object]",qt={};function Bt(t,i,e,r,s,n){var o,a=i&Rt,h=i&Ut,c=i&zt;if(e&&(o=s?e(t,r,s,n):e(t)),void 0!==o)return o;if(!k(t))return t;var u=A(t);if(u){if(o=function(t){var i=t.length,e=new t.constructor(i);return i&&"string"==typeof t[0]&&ft.call(t,"index")&&(e.index=t.index,e.input=t.input),e}(t),!a)return function(t,i){var e=-1,r=t.length;for(i||(i=Array(r));++e<r;)i[e]=t[e];return i}(t,o)}else{var f=M(t),l=f==Wt||f==Ht;if(N(t))return function(t,i){if(i)return t.slice();var e=t.length,r=ht?ht(e):new t.constructor(e);return t.copy(r),r}(t,a);if(f==Qt||f==Gt||l&&!s){if(o=h||l?{}:function(t){return"function"!=typeof t.constructor||C(t)?{}:X(st(t))}(t),!a)return h?function(t,i){return it(t,ct(t),i)}(t,function(t,i){return t&&it(i,rt(i),t)}(o,t)):function(t,i){return it(t,b(t),i)}(t,function(t,i){return t&&it(i,v(i),t)}(o,t))}else{if(!qt[f])return s?t:{};o=function(t,i,e){var r,s,n=t.constructor;switch(i){case kt:return lt(t);case pt:case mt:return new n(+t);case xt:return function(t,i){var e=i?lt(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.byteLength)}(t,e);case It:case Tt:case At:case Ct:case Et:case Ft:case Mt:case Pt:case $t:return function(t,i){var e=i?lt(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.length)}(t,e);case gt:return new n;case jt:case Ot:return new n(t);case yt:return(s=new(r=t).constructor(r.source,dt.exec(r))).lastIndex=r.lastIndex,s;case wt:return new n;case St:return bt?Object(bt.call(t)):{}}}(t,f,a)}}n||(n=new y);var d=n.get(t);if(d)return d;n.set(t,o),Lt(t)?t.forEach((function(r){o.add(Bt(r,i,e,r,t,n))})):_t(t)&&t.forEach((function(r,s){o.set(s,Bt(r,i,e,s,t,n))}));var p=u?void 0:(c?h?ut:w:h?rt:v)(t);return function(t,i){for(var e=-1,r=null==t?0:t.length;++e<r&&!1!==i(t[e],e););}(p||t,(function(r,s){p&&(r=t[s=r]),tt(o,s,Bt(r,i,e,s,t,n))})),o}qt[Gt]=qt["[object Array]"]=qt["[object ArrayBuffer]"]=qt["[object DataView]"]=qt["[object Boolean]"]=qt["[object Date]"]=qt["[object Float32Array]"]=qt["[object Float64Array]"]=qt["[object Int8Array]"]=qt["[object Int16Array]"]=qt["[object Int32Array]"]=qt["[object Map]"]=qt["[object Number]"]=qt[Qt]=qt["[object RegExp]"]=qt["[object Set]"]=qt["[object String]"]=qt["[object Symbol]"]=qt["[object Uint8Array]"]=qt["[object Uint8ClampedArray]"]=qt["[object Uint16Array]"]=qt["[object Uint32Array]"]=!0,qt["[object Error]"]=qt[Wt]=qt["[object WeakMap]"]=!1;const Kt=function(){return x.Date.now()};var Vt=Math.max,Jt=Math.min;class Xt{get limeObjectService(){return this.platform.get(s.LimeObjectRepository)}get queryService(){return this.platform.get(s.Query)}get viewFactoryRegistry(){return this.platform.get(s.ViewFactoryRegistry)}get translator(){var t;return null===(t=this.platform)||void 0===t?void 0:t.get(s.Translate)}get triggerCharacter(){return this._triggerCharacter}get triggerHandler(){return this._triggerHandler}constructor(t,i,e){this.platform=t,this.context=i,this.searchableLimetypes=e,this.groupCounts={},this._triggerCharacter="@",this._triggerHandler={searcher:t=>this.searcher(t),inserter:(t,i)=>this.inserter(t,i),emptySearchMessage:"Start typing a name...",noItemsFoundMessage:"No results for your search...",nodeDefinition:{customElement:{tagName:"limebb-mention",attributes:["limetype","objectid","href"]},mapAttributes:t=>({limetype:t.value.getLimetype().name,objectid:t.value.id,href:`object/${this.context.limetype}/${this.context.id}`})}},this.searcher=async t=>{if(!t)return[];const{objects:i}=await this.limeObjectService.search(t,this.searchableLimetypes,10);return this.createSearchListItems(i)},this.inserter=async(t,i)=>{var e;const r=this.triggerHandler.nodeDefinition;r&&t.insert({node:{tagName:r.customElement.tagName,attributes:r.mapAttributes(i)},children:[null===(e=i.value)||void 0===e?void 0:e.descriptive]})}}async initialize(){await this.loadGroupCounts()}async loadGroupCounts(){const t=this.searchableLimetypes.filter((t=>!D(t,"user")&&L(t,"user"))).map((t=>this.getGroupCounts(t)));for(const i of await Promise.all(t))Object.assign(this.groupCounts,i)}async getGroupCounts(t){var i;const e=R(t,"user"),r=t.name;try{const t=await this.queryService.execute({limetype:r,responseFormat:{object:{_id:null,[e.name]:{count:{aggregate:{op:n.Count}}}}}});if(!(null===(i=t.objects)||void 0===i?void 0:i.length))return{[r]:{}};const s=this.createGroupCount(t.objects,e.name);return{[r]:s}}catch(i){return console.error(`Error fetching group count for limetype: ${t.name}`,i),{[r]:{}}}}createGroupCount(t,i){const e={};for(const r of t){const{_id:t,[i]:s}=r;e[t]=s.count}return e}createSearchListItems(t=[]){return t.map((t=>this.createSearchListItem(t))).filter(U)}createSearchListItem(t){const i=this.viewFactoryRegistry.getFactory("search"),e=this.limeObjectService.getObject(t._limetype,t._id);if(!e)return null;const r=i(e,this.context),s=this.getGroupCountComponent(e);return Object.assign(Object.assign({},r),s?{primaryComponent:s}:{})}getGroupCountComponent(t){var i;const e=t.getLimetype(),r=null===(i=this.groupCounts[e.name])||void 0===i?void 0:i[t.id],s=R(e,"user");if(void 0!==r&&s)return{name:"limebb-mention-group-counter",props:{count:r,limetype:s.relation.getLimetype(),helperLabel:this.translator.get("webclient.notification-center.members-will-be-notified")}}}}class Yt{constructor(t,i){this.file=t,this.http=i,this.uploadCancelled=!1,this.getUrl=t=>`api/v1/file/${null!=t?t:""}`}async initialize(){this.uploadService=await this.http.createFileUpload(o.Post,this.getUrl(),this.file),this.progressCallback&&(this.uploadService.onProgress=this.progressCallback)}async upload(){return this.uploadService.upload()}getFileName(){return this.file.name}cancel(){this.uploadService.cancel(),this.uploadCancelled=!0}set onProgress(t){this.progressCallback=t,this.uploadService&&(this.uploadService.onProgress=t)}}class Zt{constructor(t){this.platform=t}async handleImagePasted(t){const i=null==t?void 0:t.fileInfo;if(!i)return;if(!this.validateImageSize(i))return;t.insertThumbnail();const e=await this.createFileUpload(i),r=null==e?void 0:e.href;return r&&void 0!==(null==e?void 0:e.fileId)?t.insertImage(r):t.insertFailedThumbnail(),e}parseFileIdFromSrc(t){if(t){const i=/\/(\d+)\/contents\/?$/.exec(t);if(i&&i[1])return Number(i[1])}}validateImageSize(t){return!!t.fileContent&&t.fileContent.size<=52428800}async createFileUpload(t){var i;if(!t.fileContent)return;const e=new Yt(t.fileContent,this.http);await e.initialize();const r=Object.assign(Object.assign({},t),{progress:0,file:e,state:"added",fileId:void 0,href:void 0,id:t.id});e.onProgress=t=>{0===r.progress&&(r.state="uploading"),r.progress=t,100===t&&(r.state="finalizing")};const s=await e.upload();return r.fileId=s.id,r.filename=s.filename,r.extension=s.extension,r.contentType=s.contentType,r.size=s.size,r.state="done",r.href=null===(i=s._links)||void 0===i?void 0:i.contents.href,r}get http(){return this.platform.get(s.Http)}}const ti=class{watchOpen(){this.setupHandlers(),this.setPickerMessage()}watchQuery(){this.setPickerMessage()}constructor(e){t(this,e),this.change=i(this,"change",7),this.metadataChange=i(this,"metadataChange",7),this.allowMentioning=!1,this.contentType="markdown",this.language="en",this.disabled=!1,this.readonly=!1,this.invalid=!1,this.required=!1,this.ui="standard",this.allowResize=!0,this.value="",this.triggerMap={},this.customElements=[],this.allowInlineImages=!1,this.items=[],this.highlightedItemIndex=0,this.isPickerOpen=!1,this.isSearching=!1,this.registeredTriggers=[],this.registeredTriggerMap=this.triggerMap,this.registeredCustomElements=this.customElements,this.activeTrigger=void 0,this.handleMouseClick=t=>{this.textEditorPickerElement&&(t.target===this.textEditorPickerElement||this.resetTriggerAndPicker())},this.handleKeyPress=t=>{if(!this.isPickerOpen||!this.activeTrigger)return;if(![c,u,h,f,l].includes(t.key))return;if(t.stopPropagation(),t.preventDefault(),"keyup"===t.type)return;const i={[c]:this.handleEscapeKey,[f]:this.handleEnterOrTabKey,[l]:this.handleEnterOrTabKey,[h]:this.handleArrowKeyPress,[u]:this.handleArrowKeyPress}[t.key];i&&i(t)},this.handleArrowKeyPress=t=>{this.highlightedItemIndex=this.findNonSeparatorIndex(t.key,this.highlightedItemIndex)},this.findNonSeparatorIndex=(t,i,e=0)=>{if(0===this.items.length||e>this.items.length)return i;const r=((t,i,e)=>(i+(t===h?1:-1)+e)%e)(t,i,this.items.length);return this.isListSeparator(this.items[r])?this.findNonSeparatorIndex(t,r,e+1):r},this.handleEscapeKey=()=>{var t;null===(t=this.triggerFunction)||void 0===t||t.stopTrigger(),this.resetTriggerAndPicker()},this.handleEnterOrTabKey=t=>{this.handleItemSelection(t)},this.handleMetadataChange=t=>{t.stopPropagation();const i=t.detail,e=this.getEnhancedImages(i.images||[]),r=Object.assign(Object.assign({},i),{images:e});this.metadataChange.emit(r)},this.handleImagePasted=t=>{t.stopPropagation(),this.allowInlineImages&&this.uploadHandler.handleImagePasted(t.detail)},this.handleTriggerStart=t=>{t.stopPropagation(),this.activeTrigger=t.detail.trigger,this.triggerFunction=t.detail.textEditor,this.isPickerOpen=!0},this.handleTriggerStop=t=>{t.stopPropagation(),this.resetTriggerAndPicker()},this.handleTriggerChange=t=>{var i;t.stopImmediatePropagation(),this.editorPickerQuery=t.detail.value;const e=null===(i=this.registeredTriggerMap[t.detail.trigger])||void 0===i?void 0:i.searcher;e&&(this.isSearching=!0,this.debouncedSearchFn(e,this.editorPickerQuery))},this.resetTriggerAndPicker=()=>{this.isPickerOpen=!1,this.activeTrigger=void 0,this.triggerFunction=void 0,this.isSearching=!1,this.highlightedItemIndex=0,this.items=[]},this.handleItemSelection=t=>{var i;let e;if(t instanceof CustomEvent)e=t.detail;else{if(!(t instanceof KeyboardEvent))return;{const t=this.items[this.highlightedItemIndex];if(this.isListSeparator(t))return;e=t}}if(!this.activeTrigger)return;const r=this.registeredTriggerMap[this.activeTrigger];try{r.inserter(this.triggerFunction,e)}catch(t){console.error("Error inserting",t)}this.resetTriggerAndPicker(),null===(i=this.textEditor)||void 0===i||i.focus()},this.handleVisibilityChange=()=>{"hidden"===document.visibilityState&&this.saveDraft()},this.handleBeforeUnload=()=>{this.saveDraft()},this.portalId=_(),this.debouncedSearchFn=function(t,i,e){var r,s,n,o,a,h,c=0,u=!1,f=!1,l=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function d(i){var e=r,n=s;return r=s=void 0,c=i,o=t.apply(n,e)}function v(t){var e=t-h;return void 0===h||e>=i||e<0||f&&t-c>=n}function b(){var t=Kt();if(v(t))return p(t);a=setTimeout(b,function(t){var e=i-(t-h);return f?Jt(e,n-(t-c)):e}(t))}function p(t){return a=void 0,l&&r?d(t):(r=s=void 0,o)}function m(){var t=Kt(),e=v(t);if(r=arguments,s=this,h=t,e){if(void 0===a)return function(t){return c=t,a=setTimeout(b,i),u?d(t):o}(h);if(f)return clearTimeout(a),a=setTimeout(b,i),d(h)}return void 0===a&&(a=setTimeout(b,i)),o}return i=V(i)||0,k(e)&&(u=!!e.leading,n=(f="maxWait"in e)?Vt(V(e.maxWait)||0,i):n,l="trailing"in e?!!e.trailing:l),m.cancel=function(){void 0!==a&&clearTimeout(a),c=0,r=h=s=a=void 0},m.flush=function(){return void 0===a?o:p(Kt())},m}((async(t,i)=>{try{const e=await t(i);if(i!==this.editorPickerQuery||!this.activeTrigger)return;this.items=e}catch(t){console.error("Error searching",t)}finally{this.isSearching=!1}}),300)}connectedCallback(){var t,i,e,r;if(this.draftIdentifier){const s=null!==(i=null===(t=this.context)||void 0===t?void 0:t.id)&&void 0!==i?i:"no-limeobject",n=null!==(r=null===(e=this.context)||void 0===e?void 0:e.limetype)&&void 0!==r?r:"no-limetype";this.textEditorInnerId=["text-editor-draft",n,s,this.draftIdentifier].join("-")}this.textEditorInnerId&&(document.addEventListener("visibilitychange",this.handleVisibilityChange),window.addEventListener("beforeunload",this.handleBeforeUnload)),this.uploadHandler=new Zt(this.platform)}componentWillLoad(){this.allowMentioning&&this.registerMentions(),this.registerTriggers(),this.loadDraft()}disconnectedCallback(){document.removeEventListener("visibilitychange",this.handleVisibilityChange),window.removeEventListener("beforeunload",this.handleBeforeUnload),document.removeEventListener("mousedown",this.handleMouseClick),this.saveDraft(),this.host&&(this.host.removeEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.removeEventListener("keydown",this.handleKeyPress,{capture:!0})),this.debouncedSearchFn&&this.debouncedSearchFn.cancel&&this.debouncedSearchFn.cancel()}registerMentions(){const t=new Xt(this.platform,this.context,this.searchableLimetypes),i=t.triggerHandler.nodeDefinition;i&&(this.registeredCustomElements.push(i.customElement),this.registeredTriggerMap[t.triggerCharacter]=t.triggerHandler,t.initialize())}registerTriggers(){this.registeredTriggers=Object.keys(this.registeredTriggerMap)}setPickerMessage(){var t;if(!this.activeTrigger)return;const i=this.registeredTriggerMap[this.activeTrigger];this.pickerMessage=(null===(t=this.editorPickerQuery)||void 0===t?void 0:t.length)>0?i.noItemsFoundMessage:i.emptySearchMessage}setupHandlers(){this.isPickerOpen?(this.host.addEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.addEventListener("keydown",this.handleKeyPress,{capture:!0}),document.addEventListener("mousedown",this.handleMouseClick)):(this.host.removeEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.removeEventListener("keydown",this.handleKeyPress,{capture:!0}),document.removeEventListener("mousedown",this.handleMouseClick))}isListSeparator(t){return"separator"in t&&!0===t.separator}render(){return[e("limel-text-editor",{key:"b866f4d7a1feabc9a7f04aa9333ec93a0dbb1c60",ref:t=>this.textEditor=t,tabindex:this.disabled?-1:0,value:this.value,contentType:this.contentType,customElements:this.registeredCustomElements,"aria-disabled":this.disabled,language:this.language,triggers:this.registeredTriggers,onTriggerStart:this.handleTriggerStart,onTriggerStop:this.handleTriggerStop,onTriggerChange:this.handleTriggerChange,onImagePasted:this.handleImagePasted,onMetadataChange:this.handleMetadataChange,ui:this.ui,allowResize:this.allowResize,required:this.required,disabled:this.disabled,readonly:this.readonly,helperText:this.helperText,placeholder:this.placeholder,label:this.label,invalid:this.invalid}),this.renderPicker()]}renderPicker(){if(this.isPickerOpen)return e("limel-portal",{containerId:this.portalId,visible:this.isPickerOpen,openDirection:"top",inheritParentWidth:!0,anchor:this.textEditor},e("limebb-text-editor-picker",{ref:t=>this.textEditorPickerElement=t,items:(t=this.items,i=this.highlightedItemIndex,t.map(((t,e)=>{const r=Bt(t,5);return Object.assign(Object.assign({},r),{selected:e===i})}))),onItemSelected:this.handleItemSelection,emptyMessage:this.pickerMessage,isSearching:this.isSearching}));var t,i}getEnhancedImages(t){return t.map((t=>{let i;return"success"===t.state&&(i=this.uploadHandler.parseFileIdFromSrc(t.src)),i?Object.assign(Object.assign({},t),{fileId:i}):t}))}loadDraft(){if(!this.userDataService||!this.textEditorInnerId)return;if(this.value)return;const t=this.userDataService.get(this.textEditorInnerId);t&&this.change.emit(t)}saveDraft(){var t,i,e,r;if(!this.textEditorInnerId)return;const s=null===(t=this.value)||void 0===t?void 0:t.trim(),n=null===(i=this.userDataService)||void 0===i?void 0:i.get(this.textEditorInnerId);s&&s!==n?null===(e=this.userDataService)||void 0===e||e.set(this.textEditorInnerId,s):!s&&n&&(null===(r=this.userDataService)||void 0===r||r.set(this.textEditorInnerId,void 0))}get userDataService(){return this.platform.get(s.UserDataRepository)}get host(){return r(this)}static get watchers(){return{isPickerOpen:["watchOpen"],editorPickerQuery:["watchQuery"]}}};!function(t,i,e,r){var s,n=arguments.length,o=n<3?i:null===r?r=Object.getOwnPropertyDescriptor(i,e):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,r);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(n<3?s(o):n>3?s(i,e,o):s(i,e))||o);n>3&&o&&Object.defineProperty(i,e,o)}([a({map:[function(t){return Object.values(t).filter((t=>D(t,"user")||L(t,"user")))}]})],ti.prototype,"searchableLimetypes",void 0);export{ti as limebb_text_editor}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,h as o,c as t}from"./p-1556b545.js";const r={expand:"expand",minimize:"minus_math",maximize:"minus_math",newTab:"up_right_arrow",back:"left_arrow",close:"multiply",shrink:"compress",float:"rectangle"},i=class{constructor(t){e(this,t),this.renderAsLink=()=>o("a",{class:this.getContainerClassList(),id:"tooltipId","aria-label":this.tooltipLabel&&this.tooltipHelperLabel,href:this.href,target:"newTab"===this.type?"_blank":void 0},this.renderType(),this.renderTooltip()),this.renderAsButton=()=>o("button",{class:this.getContainerClassList(),id:"tooltipId","aria-label":this.tooltipLabel&&this.tooltipHelperLabel},this.renderType(),this.renderTooltip()),this.getContainerClassList=()=>({"navigation-button":!0,[this.type]:!0})}render(){return this.href?this.renderAsLink():this.renderAsButton()}renderType(){return this.renderIcon(r[this.type])}renderTooltip(){if(this.tooltipLabel)return o("limel-tooltip",{label:this.tooltipLabel,helperLabel:this.tooltipHelperLabel,elementId:"tooltipId"})}renderIcon(e){return o("limel-icon",{name:e})}static get delegatesFocus(){return!0}};i.style='@charset "UTF-8";.navigation-button{all:unset;isolation:isolate;position:relative;display:flex;justify-content:center;align-items:center;height:1.875rem;width:1.875rem;border-radius:50%;transition:color var(--limel-clickable-transition-speed, 0.4s) ease, background-color var(--limel-clickable-transition-speed, 0.4s) ease, box-shadow var(--limel-clickable-transform-speed, 0.4s) ease, transform var(--limel-clickable-transform-speed, 0.4s) var(--limel-clickable-transform-timing-function, ease);cursor:pointer;color:var(--limel-theme-on-surface-color);background-color:var(--navigation-button-background-color, var(--lime-elevated-surface-background-color))}.navigation-button:hover,.navigation-button:focus,.navigation-button:focus-visible{will-change:color, background-color, box-shadow, transform}.navigation-button:hover,.navigation-button:focus-visible{transform:translate3d(0, 0.01rem, 0);color:var(--limel-theme-on-surface-color);background-color:var(--lime-elevated-surface-background-color)}.navigation-button:hover{box-shadow:var(--button-shadow-hovered)}.navigation-button:active{--limel-clickable-transform-timing-function:cubic-bezier(\n 0.83,\n -0.15,\n 0.49,\n 1.16\n );transform:translate3d(0, 0.05rem, 0);box-shadow:var(--button-shadow-pressed)}.navigation-button:hover,.navigation-button:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}.navigation-button:focus{outline:none}.navigation-button:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}.navigation-button limel-icon{transition:color 0.2s ease, transform 0.2s cubic-bezier(0.84, 0.15, 0.52, 1.42);color:var(--header-menu-icon-color);width:1.25rem}.newTab limel-icon{transition:transform 0.2s ease;transform:scale(0.8);z-index:3}.newTab:before{z-index:2}.newTab::after{z-index:1}.newTab:before,.newTab:after{content:"";transition:transform 0.2s ease, border-color 0.2s ease;position:absolute;width:0.875rem;height:0.875rem;outline:1.5px solid rgb(var(--contrast-900));border-radius:1px;background-color:var(--navigation-button-background-color, rgb(var(--contrast-100)))}.newTab:hover limel-icon{color:var(--mdc-theme-primary);transform:translate3d(-0.1rem, 0.1rem, 0) scale(1)}.newTab:hover:before{transform:translate3d(0.125rem, -0.125rem, 0);border-color:rgb(var(--contrast-1000));box-shadow:var(--shadow-depth-8)}.newTab:hover:after{transform:translate3d(-0.15rem, 0.15rem, 0) scale(0.9);border-color:rgb(var(--contrast-700))}.expand:after{transition:transform 0.2s ease;content:"";position:absolute;z-index:1;background-color:var(--navigation-button-background-color, rgb(var(--contrast-100)));width:0.75rem;height:0.75rem}.expand:hover limel-icon{color:var(--mdc-theme-primary)}.expand:hover:after{transform:scale(0.5)}.expand:hover limel-icon{transform:scale(1.18)}.minimize:before,.minimize:after,.maximize:before,.maximize:after{content:"";transition:transform 0.3s ease-out 0.15s, background-color 0.1s ease}.minimize limel-icon,.maximize limel-icon{transition:transform 0.2s ease 0.1s}.minimize:before,.maximize:after,.maximize:hover:before{transform:scaleY(1) scaleX(1);z-index:-1;box-sizing:border-box;position:absolute;width:70%;height:60%;border-radius:0.25rem;transform-origin:bottom}.minimize:hover:before,.maximize:before{transition:transform 0.3s ease-out 0.15s, background-color 0.1s ease;transform:scaleY(0.3) scaleX(0.7);background-color:rgb(var(--contrast-500))}.minimize:hover limel-icon,.maximize limel-icon{transform:scaleX(0.8) translate3d(0, 0.4rem, 0)}.maximize limel-icon{color:rgb(var(--contrast-900))}.maximize:hover limel-icon{color:currentColor;transform:scaleX(1.1) translate3d(0, -0.1rem, 0)}.maximize:after{z-index:-2;border:1px dashed rgb(var(--contrast-800))}.close limel-icon{transition:transform 0.2s ease, color 0.2s ease}.close:before,.close:after{transition-delay:0.1s;content:"";position:absolute;inset:0;border-radius:50%;opacity:0}.close:before{transition:transform 0.3s ease, opacity 0.3s ease;background-color:rgb(var(--color-orange-dark))}.close:after{transition:transform 0.6s ease, opacity 0.6s ease;background-color:rgb(var(--color-orange-light))}.close:hover limel-icon{color:rgb(var(--color-white));transform:scale(0.7) rotate(90deg)}.close:hover:before{opacity:1;transform:scale(0.4)}.close:hover:after{opacity:0.4;transform:scale(0.6)}.float:after{transition:width 0.2s ease-out, opacity 0.2s ease;content:"";position:absolute;inset:0 0.5rem 0 auto;border-radius:1px;opacity:0.8;transform:translate3d(0, 0, 0);background-color:rgb(var(--contrast-800));width:0.125rem;height:0.6rem;margin:auto}.float:hover:after{width:0.4rem;opacity:1;transform:translate3d(0, 0, 0)}';const a=class{constructor(o){e(this,o),this.actionSelected=t(this,"actionSelected",7),this.triggerDelay=600,this.openDirection="top",this.popoverMaxWidth="20rem",this.popoverMaxHeight="min(35rem, calc(100vh - 2rem))",this.actions=[],this.isPopoverOpen=!1,this.openPopoverWithDelay=e=>{e.stopPropagation(),clearTimeout(this.hoverTimeout),this.hoverTimeout=window.setTimeout((()=>{a.currentOpenPopover&&a.currentOpenPopover!==this&&(a.currentOpenPopover.isPopoverOpen=!1),a.currentOpenPopover=this,this.isPopoverOpen=!0}),this.triggerDelay)},this.resetTimeout=()=>{this.isPopoverOpen||clearTimeout(this.hoverTimeout)},this.onPopoverClose=e=>{e.stopPropagation(),this.isPopoverOpen=!1,a.currentOpenPopover===this&&(a.currentOpenPopover=null)},this.handleCloseClick=e=>{e.stopPropagation(),this.isPopoverOpen=!1},this.handleSelected=e=>{this.actionSelected.emit(e.detail)}}render(){return o("limel-popover",{key:"
|
|
1
|
+
import{r as e,h as o,c as t}from"./p-1556b545.js";const r={expand:"expand",minimize:"minus_math",maximize:"minus_math",newTab:"up_right_arrow",back:"left_arrow",close:"multiply",shrink:"compress",float:"rectangle"},i=class{constructor(t){e(this,t),this.renderAsLink=()=>o("a",{class:this.getContainerClassList(),id:"tooltipId","aria-label":this.tooltipLabel&&this.tooltipHelperLabel,href:this.href,target:"newTab"===this.type?"_blank":void 0},this.renderType(),this.renderTooltip()),this.renderAsButton=()=>o("button",{class:this.getContainerClassList(),id:"tooltipId","aria-label":this.tooltipLabel&&this.tooltipHelperLabel},this.renderType(),this.renderTooltip()),this.getContainerClassList=()=>({"navigation-button":!0,[this.type]:!0})}render(){return this.href?this.renderAsLink():this.renderAsButton()}renderType(){return this.renderIcon(r[this.type])}renderTooltip(){if(this.tooltipLabel)return o("limel-tooltip",{label:this.tooltipLabel,helperLabel:this.tooltipHelperLabel,elementId:"tooltipId"})}renderIcon(e){return o("limel-icon",{name:e})}static get delegatesFocus(){return!0}};i.style='@charset "UTF-8";.navigation-button{all:unset;isolation:isolate;position:relative;display:flex;justify-content:center;align-items:center;height:1.875rem;width:1.875rem;border-radius:50%;transition:color var(--limel-clickable-transition-speed, 0.4s) ease, background-color var(--limel-clickable-transition-speed, 0.4s) ease, box-shadow var(--limel-clickable-transform-speed, 0.4s) ease, transform var(--limel-clickable-transform-speed, 0.4s) var(--limel-clickable-transform-timing-function, ease);cursor:pointer;color:var(--limel-theme-on-surface-color);background-color:var(--navigation-button-background-color, var(--lime-elevated-surface-background-color))}.navigation-button:hover,.navigation-button:focus,.navigation-button:focus-visible{will-change:color, background-color, box-shadow, transform}.navigation-button:hover,.navigation-button:focus-visible{transform:translate3d(0, 0.01rem, 0);color:var(--limel-theme-on-surface-color);background-color:var(--lime-elevated-surface-background-color)}.navigation-button:hover{box-shadow:var(--button-shadow-hovered)}.navigation-button:active{--limel-clickable-transform-timing-function:cubic-bezier(\n 0.83,\n -0.15,\n 0.49,\n 1.16\n );transform:translate3d(0, 0.05rem, 0);box-shadow:var(--button-shadow-pressed)}.navigation-button:hover,.navigation-button:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}.navigation-button:focus{outline:none}.navigation-button:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}.navigation-button limel-icon{transition:color 0.2s ease, transform 0.2s cubic-bezier(0.84, 0.15, 0.52, 1.42);color:var(--header-menu-icon-color);width:1.25rem}.newTab limel-icon{transition:transform 0.2s ease;transform:scale(0.8);z-index:3}.newTab:before{z-index:2}.newTab::after{z-index:1}.newTab:before,.newTab:after{content:"";transition:transform 0.2s ease, border-color 0.2s ease;position:absolute;width:0.875rem;height:0.875rem;outline:1.5px solid rgb(var(--contrast-900));border-radius:1px;background-color:var(--navigation-button-background-color, rgb(var(--contrast-100)))}.newTab:hover limel-icon{color:var(--mdc-theme-primary);transform:translate3d(-0.1rem, 0.1rem, 0) scale(1)}.newTab:hover:before{transform:translate3d(0.125rem, -0.125rem, 0);border-color:rgb(var(--contrast-1000));box-shadow:var(--shadow-depth-8)}.newTab:hover:after{transform:translate3d(-0.15rem, 0.15rem, 0) scale(0.9);border-color:rgb(var(--contrast-700))}.expand:after{transition:transform 0.2s ease;content:"";position:absolute;z-index:1;background-color:var(--navigation-button-background-color, rgb(var(--contrast-100)));width:0.75rem;height:0.75rem}.expand:hover limel-icon{color:var(--mdc-theme-primary)}.expand:hover:after{transform:scale(0.5)}.expand:hover limel-icon{transform:scale(1.18)}.minimize:before,.minimize:after,.maximize:before,.maximize:after{content:"";transition:transform 0.3s ease-out 0.15s, background-color 0.1s ease}.minimize limel-icon,.maximize limel-icon{transition:transform 0.2s ease 0.1s}.minimize:before,.maximize:after,.maximize:hover:before{transform:scaleY(1) scaleX(1);z-index:-1;box-sizing:border-box;position:absolute;width:70%;height:60%;border-radius:0.25rem;transform-origin:bottom}.minimize:hover:before,.maximize:before{transition:transform 0.3s ease-out 0.15s, background-color 0.1s ease;transform:scaleY(0.3) scaleX(0.7);background-color:rgb(var(--contrast-500))}.minimize:hover limel-icon,.maximize limel-icon{transform:scaleX(0.8) translate3d(0, 0.4rem, 0)}.maximize limel-icon{color:rgb(var(--contrast-900))}.maximize:hover limel-icon{color:currentColor;transform:scaleX(1.1) translate3d(0, -0.1rem, 0)}.maximize:after{z-index:-2;border:1px dashed rgb(var(--contrast-800))}.close limel-icon{transition:transform 0.2s ease, color 0.2s ease}.close:before,.close:after{transition-delay:0.1s;content:"";position:absolute;inset:0;border-radius:50%;opacity:0}.close:before{transition:transform 0.3s ease, opacity 0.3s ease;background-color:rgb(var(--color-orange-dark))}.close:after{transition:transform 0.6s ease, opacity 0.6s ease;background-color:rgb(var(--color-orange-light))}.close:hover limel-icon{color:rgb(var(--color-white));transform:scale(0.7) rotate(90deg)}.close:hover:before{opacity:1;transform:scale(0.4)}.close:hover:after{opacity:0.4;transform:scale(0.6)}.float:after{transition:width 0.2s ease-out, opacity 0.2s ease;content:"";position:absolute;inset:0 0.5rem 0 auto;border-radius:1px;opacity:0.8;transform:translate3d(0, 0, 0);background-color:rgb(var(--contrast-800));width:0.125rem;height:0.6rem;margin:auto}.float:hover:after{width:0.4rem;opacity:1;transform:translate3d(0, 0, 0)}';const a=class{constructor(o){e(this,o),this.actionSelected=t(this,"actionSelected",7),this.triggerDelay=600,this.openDirection="top",this.popoverMaxWidth="20rem",this.popoverMaxHeight="min(35rem, calc(100vh - 2rem))",this.actions=[],this.isPopoverOpen=!1,this.openPopoverWithDelay=e=>{e.stopPropagation(),clearTimeout(this.hoverTimeout),this.hoverTimeout=window.setTimeout((()=>{a.currentOpenPopover&&a.currentOpenPopover!==this&&(a.currentOpenPopover.isPopoverOpen=!1),a.currentOpenPopover=this,this.isPopoverOpen=!0}),this.triggerDelay)},this.resetTimeout=()=>{this.isPopoverOpen||clearTimeout(this.hoverTimeout)},this.onPopoverClose=e=>{e.stopPropagation(),this.isPopoverOpen=!1,a.currentOpenPopover===this&&(a.currentOpenPopover=null)},this.handleCloseClick=e=>{e.stopPropagation(),this.isPopoverOpen=!1},this.handleSelected=e=>{this.actionSelected.emit(e.detail)}}render(){return o("limel-popover",{key:"0d6f2ed3dddd353ee8228b84337e2924fc652088",style:{"--limebb-summary-popover-timeout":`${this.triggerDelay}ms`},open:this.isPopoverOpen,onClose:this.onPopoverClose,openDirection:this.openDirection},o("div",{key:"f644db3e5d485ace1a2748b4000aca49f3948a35",slot:"trigger",tabIndex:0,onMouseEnter:this.openPopoverWithDelay,onMouseLeave:this.resetTimeout,onFocus:this.openPopoverWithDelay},o("slot",{key:"0b5836a870f32b220496c0ddc0abc35a01dc86d8",name:"trigger"}),o("div",{key:"2ffe89c63ef52df0047e6329a21c460faa628c34",class:"opening-countdown-indicator"})),o("limel-card",{key:"786fc57e1de0a6a7e62f6dd844386e9c92045539",style:{"max-width":this.popoverMaxWidth,"max-height":this.popoverMaxHeight,"min-width":"7rem","min-height":"3rem"},orientation:"landscape",heading:this.heading,subheading:this.subheading,icon:this.icon,value:this.value,image:this.image,actions:this.actions,onActionSelected:this.handleSelected},o("limebb-navigation-button",{key:"3aae488dfb00e682400e2f169f98125db9eccd01",slot:"component",type:"close",style:{"--navigation-button-background-color":"rgb(var(--contrast-100), 0.8)",position:"absolute",top:"0.125rem",right:"0.125rem"},tooltipLabel:"Close",tooltipHelperLabel:"Esc",onClick:this.handleCloseClick})))}};a.currentOpenPopover=null,a.style="limel-popover{--popover-border-radius:0.95rem;--popover-body-background-color:transparent;--popover-box-shadow:var(--shadow-depth-8)}div[slot=trigger]{position:relative;display:flex;align-items:center;justify-content:center}div[slot=trigger] *{min-width:0;min-height:0}.opening-countdown-indicator{position:absolute;inset:auto 0 -0.25rem 0;margin:0 auto;height:0.125rem;border-radius:1rem;transition:width ease-out, opacity ease;transition-duration:120ms;opacity:0;width:0%;background-color:var(--mdc-theme-primary)}div[slot=trigger]:not([aria-expanded=true]):hover .opening-countdown-indicator{transition-duration:var(--limebb-summary-popover-timeout);opacity:1;width:100%}";export{i as limebb_navigation_button,a as limebb_summary_popover}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,h as r}from"./p-1556b545.js";const o=class{constructor(r){e(this,r)}render(){return[r("div",{key:"
|
|
1
|
+
import{r as e,h as r}from"./p-1556b545.js";const o=class{constructor(r){e(this,r)}render(){return[r("div",{key:"719c7b607dc66882cb8cee2275dc670c9ad53b73",class:"header"},r("limel-icon",{key:"a50b72a8266bf58feba9e92a8da2061ecc4fe855",name:"not_showing_video_frames"}),r("h2",{key:"fad26ca7f04886af8e63c4bfbcf736459ce49906"},"Viewing this file type requires ",r("em",{key:"f99708d544005e572f7efebe5b352017f69abdf9"},"Live Docs"))),r("p",{key:"d8433cc57b251319bc2d34e115df2a1d7d617ae3"},r("em",{key:"559862e1cb8631a3209eedd2e2354ab53ec74a96"},"Live Docs")," not only enables you to view many file formats such as Microsoft Office documents, but it also empowers you to edit them right in the CRM. No need to download anything on your device!",r("a",{key:"367bccba15d2b591c267870bd7610cc86fe7fb5b",target:"_blank",href:"https://www.lime-technologies.com/en/lime-crm/live-docs/"},"Learn more"))]}};o.style=":host(limebb-live-docs-info){padding:1rem 2rem;display:flex;flex-direction:column;gap:0.5rem;border-style:dashed;border-color:rgb(var(--contrast-700));border-radius:0 0 0.5rem 0.5rem;border-width:0 1px 1px 1px}.header{display:flex;align-items:center;gap:0.5rem}h2,p{margin:0;color:rgb(var(--contrast-1100))}h2{font-size:large;font-weight:300}limel-icon{color:rgb(var(--color-orange-default));width:2rem}a{all:unset;cursor:pointer;transition:color 0.2s ease;color:rgb(var(--color-sky-default));margin-left:0.5rem}a:hover{color:rgb(var(--color-sky-dark));text-decoration:underline}";export{o as limebb_live_docs_info}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as i,h as s}from"./p-1556b545.js";import{T as e}from"./p-4838284a.js";import{
|
|
1
|
+
import{r as t,c as i,h as s}from"./p-1556b545.js";import{T as e}from"./p-4838284a.js";import{g as o,a as r}from"./p-b748c770.js";const n=class{constructor(s){t(this,s),this.change=i(this,"change",7),this.label="Property",this.required=!1,this.isOpen=!1,this.navigationPath="",this.menuItems=[],this.handleChipSetWrapperClick=t=>{t.stopPropagation()},this.handleChipSetFocus=()=>{this.isOpen||(this.navigationPath=this.value||"",this.loadMenuItems(),this.isOpen=!0)},this.handleSelect=t=>{t.stopPropagation();const i=t.detail.value;if(!i)return;const s=o(this.limetypes,this.limetype,i);(null==s?void 0:s.relation)?this.navigationPath=i:(this.change.emit(i),this.isOpen=!1,this.navigationPath="")},this.handleNavigateMenu=t=>{var i;t.stopPropagation(),(null===(i=t.detail)||void 0===i?void 0:i.value)&&(this.navigationPath=t.detail.value)},this.handleCancel=()=>{this.isOpen=!1,this.navigationPath=""},this.handleChipSetChange=t=>{t.stopPropagation();const i=t.detail;if(!i)return this.change.emit(""),void(this.navigationPath="");const s=Array.isArray(i)?i:[i];if(0===s.length)this.change.emit(""),this.navigationPath="";else{const t=s.at(-1);t&&this.change.emit(t.value),this.navigationPath=""}}}render(){if(!this.limetype||!this.limetypes)return null;const t=this.getChipsForPath(this.navigationPath||this.value||"");return s("limel-menu",{items:this.menuItems,open:this.isOpen,emptyResultMessage:"No available properties",surfaceWidth:"inherit-from-trigger",openDirection:"bottom-end",onSelect:this.handleSelect,onNavigateMenu:this.handleNavigateMenu,onCancel:this.handleCancel},s("div",{slot:"trigger"},s("div",{onClick:this.handleChipSetWrapperClick},s("limel-chip-set",{type:"input",label:this.label,value:t,required:this.required,helperText:this.helperText,delimiter:"›",maxItems:1,onChange:this.handleChipSetChange,onFocus:this.handleChipSetFocus}))))}loadMenuItems(){const t=this.getCurrentLimetype();this.menuItems=t?this.createMenuItems(t,""):[]}getCurrentLimetype(){if(!this.navigationPath)return this.limetypes[this.limetype];const t=o(this.limetypes,this.limetype,this.navigationPath);return(null==t?void 0:t.relation)?t.relation.getLimetype():this.limetypes[this.limetype]}createMenuItems(t,i){const s=[];if(!t)return s;const e=r(t);for(const[t,o]of Object.entries(e)){if("hasmany"===o.type||"hasandbelongstomany"===o.type)continue;const e=i?`${i}.${t}`:t;let r;if(o.relation&&o.relation){const t=o.relation.getLimetype();t&&(r=async()=>this.createMenuItems(t,e))}s.push({text:o.localname||t,secondaryText:this.getSecondaryText(o),icon:this.getIconForProperty(o),value:e,items:r})}return 0===s.length?[{text:"No available properties",value:"",disabled:!0}]:s}getSecondaryText(t){var i;if(t.relation){const s=t.relation.getLimetype();return(null===(i=null==s?void 0:s.localname)||void 0===i?void 0:i.singular)||"Object"}return t.type.charAt(0).toUpperCase()+t.type.slice(1)}getIconForProperty(t){return t.relation?{name:"link",color:"rgb(var(--color-sky-default))"}:{name:"decision",color:"rgb(var(--color-gray-default))"}}getChipsForPath(t){if(!t)return[];const i=t.split("."),s=[];let e=this.limetypes[this.limetype],o="";for(const t of i){o=o?`${o}.${t}`:t;const i=r(e)[t];i&&(s.push({id:o,text:i.localname||t,icon:this.getIconForProperty(i),value:o}),i.relation&&(e=i.relation.getLimetype()))}return s}};(function(t,i,s,e){var o,r=arguments.length,n=r<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,s):e;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,i,s,e);else for(var h=t.length-1;h>=0;h--)(o=t[h])&&(n=(r<3?o(n):r>3?o(i,s,n):o(i,s))||n);r>3&&n&&Object.defineProperty(i,s,n)})([e()],n.prototype,"limetypes",void 0),n.style=":host(limebb-property-selector){display:block}limel-menu{display:block;width:100%}";export{n as limebb_property_selector}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){if(!(null==e?void 0:e.properties))return{};const t=Object.assign({},e.properties),r={id:"_id",timestamp:"_timestamp",descriptive:"_descriptive",createduser:"_createduser",createdtime:"_createdtime",updateduser:"_updateduser"};for(const[e,i]of Object.entries(r)){const r=t[e];r&&(t[i]=r,delete t[e])}return t}function t(t,r,i){if(!i||!r||!t)return;const n=i.split(".");let c,s=t[r];for(const t of n){if(!s)return;if(c=e(s)[t],!c)return;c.relation&&(s=c.relation.getLimetype())}return c}export{
|
|
1
|
+
function e(e){if(!(null==e?void 0:e.properties))return{};const t=Object.assign({},e.properties),r={id:"_id",timestamp:"_timestamp",descriptive:"_descriptive",createduser:"_createduser",createdtime:"_createdtime",updateduser:"_updateduser"};for(const[e,i]of Object.entries(r)){const r=t[e];r&&(t[i]=r,delete t[e])}return t}function t(t,r,i){if(!i||!r||!t)return;const n=i.split(".");let c,s=t[r];for(const t of n){if(!s)return;if(c=e(s)[t],!c)return;c.relation&&(s=c.relation.getLimetype())}return c}export{e as a,t as g}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as i,c as e,h as t}from"./p-1556b545.js";import{T as r}from"./p-4838284a.js";import{i as o}from"./p-fa2da6bc.js";import"./p-b748c770.js";const s=class{constructor(t){i(this,t),this.change=e(this,"change",7),this.mode="gui",this.codeValue="",this.limetype="",this.handleLimetypeChange=i=>{i.stopPropagation(),this.limetype=i.detail,this.filter=void 0,this.internalResponseFormat={object:{_id:null}},this.emitChange()},this.handleFilterChange=i=>{var e;i.stopPropagation(),this.filter=null!==(e=i.detail)&&void 0!==e?e:void 0,this.emitChange()},this.handleResponseFormatChange=i=>{i.stopPropagation(),this.internalResponseFormat=i.detail,this.emitChange()},this.handleLimitChange=i=>{i.stopPropagation();const e=i.detail;this.limit=e?Number.parseInt(e,10):void 0,this.emitChange()},this.handleOrderByChange=i=>{i.stopPropagation(),this.orderBy=i.detail,this.emitChange()},this.switchToGui=()=>{try{const i=JSON.parse(this.codeValue);if(!this.checkGuiSupport().guiSupported)return;this.limetype=i.limetype||"",this.filter=i.filter,this.internalResponseFormat=i.responseFormat,this.limit=i.limit,this.orderBy=i.orderBy,this.mode="gui",this.change.emit(i)}catch(i){}},this.switchToCode=()=>{this.updateCodeValue(),this.mode="code"},this.handleCodeChange=i=>{i.stopPropagation(),this.codeValue=i.detail;try{const i=JSON.parse(this.codeValue);this.change.emit(i)}catch(i){}}}get guiModeEnabled(){var i,e,t;return null!==(t=null===(e=null===(i=this.platform)||void 0===i?void 0:i.isFeatureEnabled)||void 0===e?void 0:e.call(i,"useLimeQueryBuilderGuiMode"))&&void 0!==t&&t}componentWillLoad(){if(!this.guiModeEnabled)return this.mode="code",void this.updateCodeValue();this.value&&(this.limetype=this.value.limetype||"",this.filter=this.value.filter,this.internalResponseFormat=this.value.responseFormat,this.limit=this.value.limit,this.orderBy=this.value.orderBy),this.updateCodeValue(),this.checkGuiSupport().guiSupported||(this.mode="code")}render(){const i=this.checkGuiSupport(),e=!this.guiModeEnabled||"code"===this.mode;return t("div",{key:"f51ae0459c1c7f482f3a790abb4cc3bd60b83e70",class:"lime-query-builder"},this.renderLabel(),this.renderModeControls(i),e?this.renderCodeMode(i):this.renderGuiMode())}emitChange(){"code"!==this.mode&&this.limetype&&this.change.emit(this.buildLimeQuery())}updateCodeValue(){this.codeValue=this.limetype?JSON.stringify(this.buildLimeQuery(),null,2):JSON.stringify(this.value||{},null,2)}buildLimeQuery(){const i={limetype:this.limetype,responseFormat:this.internalResponseFormat||{object:{_id:null}},filter:this.filter};return void 0!==this.limit&&this.limit>0&&(i.limit=this.limit),this.orderBy&&this.orderBy.length>0&&(i.orderBy=this.orderBy),i}checkGuiSupport(){if(!this.limetypes)return{valid:!0,guiSupported:!0,validationErrors:[],guiLimitations:[]};let i;if("code"===this.mode&&this.codeValue)try{i=JSON.parse(this.codeValue)}catch(i){return{valid:!1,guiSupported:!1,validationErrors:["Invalid JSON"],guiLimitations:[]}}else{if(!this.limetype)return{valid:!0,guiSupported:!0,validationErrors:[],guiLimitations:[]};i={limetype:this.limetype,responseFormat:this.internalResponseFormat||{object:{_id:null}},filter:this.filter},void 0!==this.limit&&this.limit>0&&(i.limit=this.limit)}return o(i,this.limetypes,this.activeLimetype,this.guiModeEnabled)}renderModeSwitch(i){return t("div",{class:"mode-switch"},t("limel-button",{label:"GUI",primary:"gui"===this.mode,disabled:!i.guiSupported,onClick:this.switchToGui}),t("limel-button",{label:"Code",primary:"code"===this.mode,onClick:this.switchToCode}))}renderCodeEditor(i){return t("div",{class:"code-editor-container"},t("limel-code-editor",{value:this.codeValue,language:"json",lineNumbers:!0,fold:!0,lint:!0,onChange:this.handleCodeChange}),!i.valid&&i.validationErrors.length>0&&t("div",{class:"validation-errors"},t("strong",null,"Invalid Lime Query:"),t("ul",null,i.validationErrors.map((i=>t("li",null,i))))),this.guiModeEnabled&&i.valid&&!i.guiSupported&&i.guiLimitations.length>0&&t("div",{class:"gui-limitations"},t("strong",null,"Cannot switch to GUI mode:"),t("ul",null,i.guiLimitations.map((i=>t("li",null,i))))))}renderLimetypeSection(){return t("div",{class:"limetype-section"},t("limebb-limetype-field",{platform:this.platform,context:this.context,label:"Object Type",value:this.limetype,required:!0,fieldName:"limetype",helperText:"Select the type of object you want to query",onChange:this.handleLimetypeChange}))}renderResponseFormatSection(){if(this.limetype)return t("div",{class:"response-format-section"},t("limebb-lime-query-response-format-editor",{platform:this.platform,context:this.context,limetype:this.limetype,value:this.internalResponseFormat,onChange:this.handleResponseFormatChange}))}renderFilterSection(){if(this.limetype)return t("div",{class:"filter-section"},t("h4",{class:"section-label"},"Filter Conditions"),t("limebb-lime-query-filter-builder",{platform:this.platform,context:this.context,limetype:this.limetype,activeLimetype:this.activeLimetype,expression:this.filter,onExpressionChange:this.handleFilterChange}))}renderQueryOptionsSection(){var i;if(this.limetype)return t("div",{class:"query-options-section"},t("h4",{class:"section-label"},"Query Options"),t("div",{class:"query-options-controls"},t("limel-input-field",{label:"Limit",type:"number",value:(null===(i=this.limit)||void 0===i?void 0:i.toString())||"",placeholder:"No limit",helperText:"Maximum number of results",onChange:this.handleLimitChange}),t("limebb-lime-query-order-by-editor",{platform:this.platform,context:this.context,limetype:this.limetype,value:this.orderBy,onChange:this.handleOrderByChange})))}renderGuiMode(){return t("div",{class:"gui-mode"},this.renderLimetypeSection(),this.renderResponseFormatSection(),this.renderFilterSection(),this.renderQueryOptionsSection())}renderLabel(){if(this.label)return t("h3",{class:"lime-query-builder-label"},this.label)}renderModeControls(i){if(this.guiModeEnabled)return t("div",{class:"mode-controls"},this.renderModeSwitch(i))}renderCodeMode(i){return t("div",{class:"code-mode"},this.renderCodeEditor(i))}};(function(i,e,t,r){var o,s=arguments.length,l=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,t):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(i,e,t,r);else for(var n=i.length-1;n>=0;n--)(o=i[n])&&(l=(s<3?o(l):s>3?o(e,t,l):o(e,t))||l);s>3&&l&&Object.defineProperty(e,t,l)})([r()],s.prototype,"limetypes",void 0),s.style=":host(limebb-lime-lime-query-builder){display:block;width:100%}.lime-query-builder{display:flex;flex-direction:column;gap:2rem}.mode-controls{display:flex;align-items:center;gap:0.5rem;padding:0.5rem}.mode-switch{display:flex;align-items:center;gap:0.5rem}.mode-switch limel-button{min-width:5rem}.mode-switch limel-helper-text{margin-left:1rem;color:rgb(var(--color-red-default))}.gui-mode,.code-mode{display:block}.code-editor-container{--code-editor-max-height:70vh;display:flex;flex-direction:column;gap:1rem}.code-editor-container .validation-errors{padding:0.75rem 1rem;color:rgb(var(--color-red-default));background-color:rgb(var(--color-red-lighter));border-left:0.25rem solid rgb(var(--color-red-default));border-radius:0.25rem;font-size:0.875rem}.code-editor-container .validation-errors strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-editor-container .validation-errors ul{margin:0;padding-left:1.5rem}.code-editor-container .validation-errors li{margin:0.25rem 0}.code-editor-container .gui-limitations{padding:0.75rem 1rem;color:rgb(var(--color-blue-dark));background-color:rgb(var(--color-blue-lighter));border-left:0.25rem solid rgb(var(--color-blue-default));border-radius:0.25rem;font-size:0.875rem}.code-editor-container .gui-limitations strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-editor-container .gui-limitations ul{margin:0;padding-left:1.5rem}.code-editor-container .gui-limitations li{margin:0.25rem 0}.lime-query-builder-label{margin:0;font-size:1.5rem;font-weight:600;color:rgb(var(--contrast-1100))}.limetype-section{display:flex;flex-direction:column}.filter-section,.query-options-section{display:flex;flex-direction:column;gap:1rem}.section-label{margin:0;font-size:1.125rem;font-weight:600;color:rgb(var(--contrast-1000))}.query-options-controls{display:flex;flex-direction:column;gap:1rem}@media (max-width: 768px){.lime-query-builder{gap:1.5rem}}";export{s as limebb_lime_query_builder}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as e,h as i}from"./p-1556b545.js";import{Z as s,c as r}from"./p-4838284a.js";import{b as o}from"./p-20bfca36.js";import{i as n}from"./p-1484e300.js";import{b as l}from"./p-a659d55a.js";import{i as a,a as h,b as d}from"./p-b31772c8.js";import"./p-35897ec3.js";import"./p-fe2b91d9.js";import"./p-5322fd19.js";function c(t){return"string"==typeof t||!a(t)&&h(t)&&"[object String]"==d(t)}const m=class{constructor(i){t(this,i),this.expressionChange=e(this,"expressionChange",7),this.handleAddFirstCondition=()=>{this.expressionChange.emit({key:"",op:s.EQUALS,exp:""})},this.handlePromoteAndAdd=()=>{this.expression&&this.expressionChange.emit({op:s.AND,exp:[this.expression,{key:"",op:s.EQUALS,exp:""}]})},this.handleExpressionChange=t=>{var e;t.stopPropagation(),this.expressionChange.emit(null!==(e=t.detail)&&void 0!==e?e:void 0)}}render(){return this.expression?this.needsPromotion()?this.renderWithPromotionButton():i("limebb-lime-query-filter-expression",{platform:this.platform,context:this.context,limetype:this.limetype,activeLimetype:this.activeLimetype,expression:this.expression,onExpressionChange:this.handleExpressionChange}):this.renderEmptyState()}needsPromotion(){return!!this.expression&&("key"in this.expression||this.expression.op===s.NOT)}renderEmptyState(){return i("limel-button",{label:"Add a condition",icon:"plus_math",onClick:this.handleAddFirstCondition})}renderWithPromotionButton(){return i("div",{class:"expression-with-promotion"},i("limebb-lime-query-filter-expression",{platform:this.platform,context:this.context,limetype:this.limetype,activeLimetype:this.activeLimetype,expression:this.expression,onExpressionChange:this.handleExpressionChange}),i("limel-button",{label:"Add another condition",icon:"plus_math",onClick:this.handlePromoteAndAdd}))}};m.style=".expression-with-promotion{display:flex;flex-direction:column;gap:1rem}";const p=class{constructor(i){t(this,i),this.change=e(this,"change",7),this.label="Sort Order",this.items=[],this.handleItemChange=t=>e=>{e.stopPropagation();const i=[...this.items];null===e.detail?i.splice(t,1):i[t]=e.detail,this.items=i,this.emitChange()},this.handleAddSortField=()=>{this.items=[...this.items,{"":"ASC"}],this.emitChange()}}componentWillLoad(){this.value&&this.value.length>0&&(this.items=[...this.value])}handleValueChange(t){t&&(t.length!==this.items.length||!t.every(((t,e)=>{const i=this.items[e];if(!i)return!1;const s=Object.keys(t)[0],r=Object.keys(i)[0];return s===r&&t[s]===i[r]})))&&(this.items=t.length>0?[...t]:[])}render(){return this.limetype?i("div",{class:"order-by-editor"},i("div",{class:"header"},i("h4",null,this.label)),this.renderOrderByList(),this.renderActions()):i("div",{class:"empty-state"},i("p",null,"Select a limetype to configure sorting"))}renderOrderByList(){return 0===this.items.length?null:i("div",{class:"order-by-list"},this.items.map(((t,e)=>this.renderItem(t,e))))}renderActions(){return i("div",{class:"actions"},i("limel-button",{label:"Add Sort Field",icon:"plus_math",onClick:this.handleAddSortField}))}renderItem(t,e){const s=Object.keys(t)[0]||"";return i("limebb-lime-query-order-by-item",{key:`${s}-${e}`,class:"order-by-item",platform:this.platform,context:this.context,limetype:this.limetype,item:t,onItemChange:this.handleItemChange(e)})}emitChange(){this.change.emit(this.items)}static get watchers(){return{value:["handleValueChange"]}}};p.style=":host(limebb-lime-query-order-by-editor){display:block;width:100%}.order-by-editor{display:flex;flex-direction:column;gap:1rem;padding:1rem}.header{display:flex;justify-content:space-between;align-items:center;gap:1rem}.header h4{margin:0;font-size:1rem;font-weight:600;color:rgb(var(--contrast-1000))}.order-by-list{display:flex;flex-direction:column;gap:1rem;padding:0.5rem;border:1px solid rgb(var(--contrast-300));border-radius:0.25rem;background-color:rgb(var(--contrast-50));min-height:4rem}.order-by-item{padding:0.5rem;border-radius:0.25rem;transition:background-color 0.2s}.order-by-item:hover{background-color:rgb(var(--contrast-100))}.actions{display:flex;justify-content:flex-start}.summary{display:flex;justify-content:space-between;align-items:center;padding-top:0.5rem;border-top:1px solid rgb(var(--contrast-300))}.summary .count{font-size:0.875rem;font-weight:500;color:rgb(var(--contrast-900))}.empty-state{padding:2rem;text-align:center;color:rgb(var(--contrast-700));font-style:italic}.empty-state p{margin:0}";const u=["string","text","phone","integer","decimal","percent","time","date","year","quarter","month","yesno","link","user","xml","option","set","file","system"],b=u.filter((t=>"system"!==t));b.push("belongsto","hasone","hasmany","hasandbelongstomany");const y=class{constructor(i){t(this,i),this.change=e(this,"change",7),this.propertyFields=[],this.fieldName="limetype",this.handleChange=t=>{t.stopPropagation();let e="";t.detail&&"value"in t.detail&&(e=t.detail.value),this.change.emit(e||void 0)}}componentWillLoad(){const t=this.platform.get(r.Application).getLanguage();this.collator=new Intl.Collator(t,{numeric:!0,sensitivity:"base"})}componentShouldUpdate(t,e,i){var s,r,o,n;return"formInfo"!==i||(o=null===(s=null==t?void 0:t.schema)||void 0===s?void 0:s.oneOf,n=null===(r=null==e?void 0:e.schema)||void 0===r?void 0:r.oneOf,!l(o,n))}render(){var t;const e=this.getLimeTypes().map(g);e.sort(((t,e)=>this.collator.compare(t.text,e.text)));let s=e.find((t=>t.value===this.value)),r=this.invalid;return this.value&&!s&&(r=!0,e.unshift({text:(null===(t=this.limeTypeRepository.getLimeType(this.value))||void 0===t?void 0:t.localname.singular)||this.value,value:this.value}),s=e[0]),e.unshift({text:"",value:""}),i("limel-select",{key:"ee9fdc46424c9e6dc5897260cb16bcbedd43413a",label:this.label,options:e,value:s,required:this.required,helperText:this.helperText,invalid:r,disabled:this.disabled||this.readonly,onChange:this.handleChange})}componentWillRender(){this.updatePropertyFields(this.value||"")}getLimeTypes(){var t,e;let i=this.limetypes;return(null===(e=null===(t=this.formInfo)||void 0===t?void 0:t.schema)||void 0===e?void 0:e.oneOf)&&(i=this.formInfo.schema.oneOf.map((t=>t.const)).filter(c)),i?i.map((t=>this.limeTypeRepository.getLimeType(t))).filter(n):this.limeTypeRepository.getLimeTypes()}updatePropertyFields(t){for(const e of this.propertyFields)e.limetype=t,e.allowedPropertyTypes===u&&(e.allowedPropertyTypes=b)}get limeTypeRepository(){return this.platform.get(r.LimeTypeRepository)}},g=t=>({text:t.localname.singular,value:t.name,icon:o(t)});export{m as limebb_lime_query_filter_builder,p as limebb_lime_query_order_by_editor,y as limebb_limetype_field}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,h as e}from"./p-1556b545.js";const o=class{constructor(e){r(this,e),this.tooltipId="a"+crypto.randomUUID()}render(){const r=this.getLabel();return[e("span",{key:"
|
|
1
|
+
import{r,h as e}from"./p-1556b545.js";const o=class{constructor(e){r(this,e),this.tooltipId="a"+crypto.randomUUID()}render(){const r=this.getLabel();return[e("span",{key:"2ed8fb232e05342565947976d2af9f212cc82331",id:this.tooltipId},r),e("limel-tooltip",{key:"404fcd53eec16a0b0b32a4358125354dd148e339",elementId:this.tooltipId,label:r,helperLabel:this.helperLabel})]}getLabel(){const r=this.limetype.localname;return`${this.count} ${1===this.count?r.singular:r.plural}`}};o.style=":host(limebb-mention-group-counter){order:2;margin-right:-0.5rem;box-sizing:border-box;transition:background-color 0.2s ease;min-width:fit-content;font-size:smaller;border-radius:9rem;cursor:help;padding:0.25rem 0.5rem;line-height:1;border:1px solid rgb(var(--contrast-500))}:host(limebb-mention-group-counter:hover){border-color:rgb(var(--contrast-100));background-color:rgb(var(--contrast-600))}";export{o as limebb_mention_group_counter}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Z as t}from"./p-4838284a.js";import{g as r,a as o}from"./p-b748c770.js";const n=new Set(["$yesterday","$now","$today","$tomorrow","$this_week","$this_month","$this_quarter","$this_year"]),e=/^\$(previous|next)_(day|week|month|quarter|year)\(\d+\)$/,i=/^\$me(\.\w+)*$/;function s(t,r,o=!0){const n=Object.keys(t),e=[];if(o){const t=n.filter((t=>t.startsWith("#")&&"#description"!==t));t.length>0&&e.push(`Property '${r}' contains # properties not supported in GUI: ${t.join(", ")}`)}return{keys:n.filter((t=>"_alias"!==t&&!t.startsWith("#"))),guiLimitations:e}}function u(t,r,o,n,e,i=!0){if(""===t){if(i&&null!==r)throw new Error("Empty property name must have null value");return[]}const u=o[t];if(!u)throw new Error(`Property '${t}' does not exist on limetype '${e}'`);return u.relation?function(t,r,o,n,e=!0){if(null===r)return[];if("object"!=typeof r)throw new TypeError(`Relation property '${t}' must be null or an object`);const i=r,{keys:u,guiLimitations:c}=s(i,t,e);if(0===u.length)return c;const f=n.relation.getLimetype();if(!f)throw new Error(`Could not determine related limetype for property '${t}'`);const p={};for(const t of u)p[t]=i[t];const l=a(p,o,f.name,e);return[...c,...l]}(t,r,n,u,i):function(t,r,o=!0){if(null===r)return[];if("object"==typeof r){const{keys:n,guiLimitations:e}=s(r,t,o);if(0===n.length)return e;throw new Error(`Non-relation property '${t}' cannot have nested properties other than _alias or # properties (got: ${n.join(", ")})`)}throw new Error(`Non-relation property '${t}' must be null or an object (got ${typeof r})`)}(t,r,i)}function a(t,r,n,e=!0){const i=r[n];if(!i)throw new Error(`Unknown limetype: ${n}`);const s=o(i),a=[];for(const[o,i]of Object.entries(t)){if(o.startsWith("#"))continue;const t=u(o,i,s,r,n,e);a.push(...t)}return a}function c(o,s,u,a=!0){o&&("key"in o?function(o,s,u){if(!Object.values(t).includes(o.op))throw new Error(`Unsupported filter operator: ${o.op}`);const a=function(t,o,s){if(function(t){return"string"==typeof t&&(n.has(t)||e.test(t)||i.test(t))}(t))return{valid:!0};if("string"!=typeof t||!t.startsWith("%activeObject%"))return{valid:!0};if(!o)return{valid:!0};const u=t.replace(/^%activeObject%\.?/,"");if(!u)return{valid:!0};try{return r(s,o,u)?{valid:!0}:{valid:!1,error:`Property path '${u}' does not exist on limetype '${o}'`}}catch(t){return{valid:!1,error:`Invalid placeholder path: ${t.message}`}}}(o.exp,s,u);if(!a.valid)throw new Error(`Invalid placeholder in filter '${o.key}': ${a.error}`)}(o,s,u):"exp"in o&&function(r,o,n,e){if(r.op!==t.AND&&r.op!==t.OR&&r.op!==t.NOT)throw new Error(`Unsupported group operator: ${r.op}`);if(r.op===t.NOT)c(r.exp,o,n,e);else if(r.op===t.AND||r.op===t.OR){const t=r.exp;for(const r of t)c(r,o,n,e)}}(o,s,u,a))}function f(t,o,n,e){const i=[],s=function(t,r){return"object"!=typeof t||null===t?`orderBy[${r}] must be an object`:null}(t,o);if(s)return[s];const u=Object.keys(t),a=function(t,r){return 0===t.length?`orderBy[${r}] must have a property path`:t.length>1?`orderBy[${r}] must have exactly one property, got ${t.length}`:null}(u,o);if(a)return[a];const c=u[0],f=function(t,r){return"ASC"!==t&&"DESC"!==t?`orderBy[${r}]: direction must be 'ASC' or 'DESC', got '${t}'`:null}(t[c],o);f&&i.push(f);const p=function(t,o,n,e){if(!t||""===t)return null;return r(o,n,t)?null:`orderBy[${e}]: property path '${t}' does not exist on limetype '${n}'`}(c,n,e,o);return p&&i.push(p),i}function p(t,r,o,n){const e=[],i=[];try{const e=function(t,r,o,n=!0){const e=[];if(n&&t.aggregates&&e.push("responseFormat.aggregates is not yet supported in GUI mode"),t.object){const i=a(t.object,r,o,n);e.push(...i)}return e}(t,r,o,n);i.push(...e)}catch(t){e.push(`Invalid responseFormat: ${t.message}`)}return{errors:e,limitations:i}}function l(t,r,o,n=!0){if(!t)return{valid:!0,guiSupported:!0,validationErrors:[],guiLimitations:[]};const e=[],i=[];if(t.limetype&&!r[t.limetype]&&e.push(`Unknown limetype: ${t.limetype}`),void 0===t.offset||t.orderBy||e.push("offset requires orderBy to be specified"),t.orderBy){const o=function(t,r,o){const n=[];if(!Array.isArray(t))return n.push("orderBy must be an array"),n;if(!o||!r[o])return n;for(const[e,i]of t.entries()){const t=f(i,e,r,o);n.push(...t)}return n}(t.orderBy,r,t.limetype);e.push(...o)}if(n&&void 0!==t.offset&&i.push("offset is not yet supported in GUI mode"),t.filter){const i=function(t,r,o,n){const e=[];try{c(t,r,o,n)}catch(t){e.push(`Invalid filter: ${t.message}`)}return e}(t.filter,o,r,n);e.push(...i)}if(t.responseFormat){const{errors:o,limitations:s}=p(t.responseFormat,r,t.limetype,n);e.push(...o),i.push(...s)}return{valid:0===e.length,guiSupported:0===i.length,validationErrors:e,guiLimitations:i}}function d(t,r,o,n=!0){const e=[],i=[];if(!r[o])return e.push(`Unknown limetype: ${o}`),{valid:!1,guiSupported:!1,validationErrors:e,guiLimitations:i};const{errors:s,limitations:u}=p(t,r,o,n);return e.push(...s),i.push(...u),{valid:0===e.length,guiSupported:0===i.length,validationErrors:e,guiLimitations:i}}export{l as i,d as v}
|
|
@@ -47,6 +47,12 @@ export declare class LimeQueryBuilder implements LimeWebComponent {
|
|
|
47
47
|
* Optional label for the Lime Query builder
|
|
48
48
|
*/
|
|
49
49
|
label: string;
|
|
50
|
+
/**
|
|
51
|
+
* The limetype of the active object (for %activeObject% placeholder validation).
|
|
52
|
+
* When provided, enables placeholder validation and the placeholder input mode.
|
|
53
|
+
* When omitted, placeholders are accepted without validation.
|
|
54
|
+
*/
|
|
55
|
+
activeLimetype?: string;
|
|
50
56
|
/**
|
|
51
57
|
* Emitted when the Lime Query changes
|
|
52
58
|
*/
|
|
@@ -58,12 +64,7 @@ export declare class LimeQueryBuilder implements LimeWebComponent {
|
|
|
58
64
|
private filter;
|
|
59
65
|
private internalResponseFormat?;
|
|
60
66
|
private limit?;
|
|
61
|
-
|
|
62
|
-
* The limetype of the active object (for %activeObject% placeholder validation).
|
|
63
|
-
* When provided, enables placeholder validation and the placeholder input mode.
|
|
64
|
-
* When omitted, placeholders are accepted without validation.
|
|
65
|
-
*/
|
|
66
|
-
activeLimetype?: string;
|
|
67
|
+
private orderBy?;
|
|
67
68
|
private get guiModeEnabled();
|
|
68
69
|
componentWillLoad(): void;
|
|
69
70
|
render(): any;
|
|
@@ -71,8 +72,10 @@ export declare class LimeQueryBuilder implements LimeWebComponent {
|
|
|
71
72
|
private handleFilterChange;
|
|
72
73
|
private handleResponseFormatChange;
|
|
73
74
|
private handleLimitChange;
|
|
75
|
+
private handleOrderByChange;
|
|
74
76
|
private emitChange;
|
|
75
77
|
private updateCodeValue;
|
|
78
|
+
private buildLimeQuery;
|
|
76
79
|
private checkGuiSupport;
|
|
77
80
|
private renderModeSwitch;
|
|
78
81
|
private renderCodeEditor;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
+
import { LimeWebComponent, LimeWebComponentContext, LimeWebComponentPlatform } from '@limetech/lime-web-components';
|
|
3
|
+
import { ResponseFormat } from './lime-query.types';
|
|
4
|
+
/**
|
|
5
|
+
* Response Format Builder
|
|
6
|
+
*
|
|
7
|
+
* A focused component for editing Lime Query ResponseFormat in isolation.
|
|
8
|
+
* Supports both GUI and code modes for maximum flexibility.
|
|
9
|
+
*
|
|
10
|
+
* Use this component when you need to configure which properties to return
|
|
11
|
+
* from a query, but don't need filter, limit, or other query parameters.
|
|
12
|
+
*
|
|
13
|
+
* **Features**:
|
|
14
|
+
* - **GUI Mode**: Visual property selector with relation navigation
|
|
15
|
+
* - **Code Mode**: JSON editor for ResponseFormat structure
|
|
16
|
+
* - **Validation**: Ensures JSON is valid ResponseFormat (rejects other fields)
|
|
17
|
+
* - **Mode Toggle**: Switch between GUI and code modes seamlessly
|
|
18
|
+
* - **Feature Flag**: Respects `useLimeQueryBuilderGuiMode` setting
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* <limebb-lime-query-response-format-builder
|
|
23
|
+
* platform={this.platform}
|
|
24
|
+
* context={this.context}
|
|
25
|
+
* limetype="deal"
|
|
26
|
+
* value={this.responseFormat}
|
|
27
|
+
* label="Select Properties to Return"
|
|
28
|
+
* onChange={this.handleChange}
|
|
29
|
+
* />
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @exampleComponent limebb-example-response-format-builder-basic
|
|
33
|
+
* @private
|
|
34
|
+
*/
|
|
35
|
+
export declare class LimeQueryResponseFormatBuilder implements LimeWebComponent {
|
|
36
|
+
/**
|
|
37
|
+
* Platform service provider
|
|
38
|
+
*/
|
|
39
|
+
platform: LimeWebComponentPlatform;
|
|
40
|
+
/**
|
|
41
|
+
* Component context
|
|
42
|
+
*/
|
|
43
|
+
context: LimeWebComponentContext;
|
|
44
|
+
/**
|
|
45
|
+
* The limetype to configure response format for
|
|
46
|
+
* This is fixed and not editable by the user
|
|
47
|
+
*/
|
|
48
|
+
limetype: string;
|
|
49
|
+
/**
|
|
50
|
+
* Current response format value
|
|
51
|
+
*/
|
|
52
|
+
value?: ResponseFormat;
|
|
53
|
+
/**
|
|
54
|
+
* Optional label for the builder
|
|
55
|
+
*/
|
|
56
|
+
label: string;
|
|
57
|
+
/**
|
|
58
|
+
* Emitted when the response format changes
|
|
59
|
+
*/
|
|
60
|
+
change: EventEmitter<ResponseFormat>;
|
|
61
|
+
private limetypes;
|
|
62
|
+
private mode;
|
|
63
|
+
private codeValue;
|
|
64
|
+
private internalValue;
|
|
65
|
+
/**
|
|
66
|
+
* Check if GUI mode is enabled via feature flag
|
|
67
|
+
*/
|
|
68
|
+
private get guiModeEnabled();
|
|
69
|
+
componentWillLoad(): void;
|
|
70
|
+
componentWillUpdate(): void;
|
|
71
|
+
render(): any;
|
|
72
|
+
private renderModeSwitch;
|
|
73
|
+
private renderCodeEditor;
|
|
74
|
+
private renderGuiMode;
|
|
75
|
+
/**
|
|
76
|
+
* Check if current value can be rendered in GUI mode
|
|
77
|
+
*/
|
|
78
|
+
private checkGuiSupport;
|
|
79
|
+
/**
|
|
80
|
+
* Update code value from internal state
|
|
81
|
+
*/
|
|
82
|
+
private updateCodeValue;
|
|
83
|
+
/**
|
|
84
|
+
* Switch from code mode to GUI mode
|
|
85
|
+
*/
|
|
86
|
+
private switchToGui;
|
|
87
|
+
/**
|
|
88
|
+
* Switch from GUI mode to code mode
|
|
89
|
+
*/
|
|
90
|
+
private switchToCode;
|
|
91
|
+
/**
|
|
92
|
+
* Handle code editor changes
|
|
93
|
+
* @param event
|
|
94
|
+
*/
|
|
95
|
+
private handleCodeChange;
|
|
96
|
+
/**
|
|
97
|
+
* Handle GUI mode changes
|
|
98
|
+
* @param event
|
|
99
|
+
*/
|
|
100
|
+
private handleGuiChange;
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=lime-query-response-format-builder.d.ts.map
|
|
@@ -55,4 +55,17 @@ export declare function validatePropertySelection(selection: PropertySelection,
|
|
|
55
55
|
* @returns LimeQueryValidationResult with validity status and any errors/limitations
|
|
56
56
|
*/
|
|
57
57
|
export declare function isLimeQuerySupported(limeQuery: LimeQuery, limetypes: Record<string, LimeType>, activeLimetype?: string, guiModeEnabled?: boolean): LimeQueryValidationResult;
|
|
58
|
+
/**
|
|
59
|
+
* Validate a ResponseFormat in isolation (for response-format-builder)
|
|
60
|
+
*
|
|
61
|
+
* This validator is designed for the response-format-builder component,
|
|
62
|
+
* which only handles ResponseFormat editing without the full LimeQuery context.
|
|
63
|
+
*
|
|
64
|
+
* @param responseFormat - The response format to validate
|
|
65
|
+
* @param limetypes - Record of all available limetypes
|
|
66
|
+
* @param limetype - The limetype context for validation
|
|
67
|
+
* @param guiModeEnabled - Whether GUI mode is enabled (affects validation)
|
|
68
|
+
* @returns Validation result with errors and GUI limitations
|
|
69
|
+
*/
|
|
70
|
+
export declare function validateResponseFormatOnly(responseFormat: ResponseFormat, limetypes: Record<string, LimeType>, limetype: string, guiModeEnabled?: boolean): LimeQueryValidationResult;
|
|
58
71
|
//# sourceMappingURL=lime-query-validation.d.ts.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { EventEmitter } from '../../../stencil-public-runtime';
|
|
2
|
+
import { LimeWebComponent, LimeWebComponentContext, LimeWebComponentPlatform } from '@limetech/lime-web-components';
|
|
3
|
+
import { OrderByItem } from '../lime-query.types';
|
|
4
|
+
/**
|
|
5
|
+
* Order By Editor Component
|
|
6
|
+
*
|
|
7
|
+
* Allows users to specify the order in which query results should be sorted.
|
|
8
|
+
* Supports sorting by multiple properties with ascending or descending order.
|
|
9
|
+
*
|
|
10
|
+
* Features:
|
|
11
|
+
* - **Property selection**: Choose properties using dropdown navigation
|
|
12
|
+
* - **Sort direction**: Toggle between ascending (ASC) and descending (DESC)
|
|
13
|
+
* - **Multiple sort fields**: Add multiple properties to create complex sorting
|
|
14
|
+
* - **Order matters**: Properties are sorted in the order they appear in the list
|
|
15
|
+
* - **Dynamic list**: Add/remove sort fields
|
|
16
|
+
*
|
|
17
|
+
* The component generates an `OrderByItem[]` array where each item specifies
|
|
18
|
+
* a property path and sort direction.
|
|
19
|
+
*
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
export declare class OrderByEditor implements LimeWebComponent {
|
|
23
|
+
/**
|
|
24
|
+
* Platform service provider
|
|
25
|
+
*/
|
|
26
|
+
platform: LimeWebComponentPlatform;
|
|
27
|
+
/**
|
|
28
|
+
* Component context
|
|
29
|
+
*/
|
|
30
|
+
context: LimeWebComponentContext;
|
|
31
|
+
/**
|
|
32
|
+
* The limetype to select properties from
|
|
33
|
+
*/
|
|
34
|
+
limetype: string;
|
|
35
|
+
/**
|
|
36
|
+
* Current order by specification
|
|
37
|
+
*/
|
|
38
|
+
value?: OrderByItem[];
|
|
39
|
+
/**
|
|
40
|
+
* Optional label
|
|
41
|
+
*/
|
|
42
|
+
label: string;
|
|
43
|
+
private items;
|
|
44
|
+
/**
|
|
45
|
+
* Emitted when the order by specification changes
|
|
46
|
+
*/
|
|
47
|
+
change: EventEmitter<OrderByItem[]>;
|
|
48
|
+
componentWillLoad(): void;
|
|
49
|
+
handleValueChange(newValue?: OrderByItem[]): void;
|
|
50
|
+
render(): any;
|
|
51
|
+
private renderOrderByList;
|
|
52
|
+
private renderActions;
|
|
53
|
+
private renderItem;
|
|
54
|
+
private handleItemChange;
|
|
55
|
+
private handleAddSortField;
|
|
56
|
+
private emitChange;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=order-by-editor.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { EventEmitter } from '../../../stencil-public-runtime';
|
|
2
|
+
import { OrderByItem } from '../lime-query.types';
|
|
3
|
+
import { LimeWebComponent, LimeWebComponentContext, LimeWebComponentPlatform } from '@limetech/lime-web-components';
|
|
4
|
+
/**
|
|
5
|
+
* Order By Item Component
|
|
6
|
+
*
|
|
7
|
+
* Represents a single order by specification with property selection and direction toggle
|
|
8
|
+
* Part of the order by editor
|
|
9
|
+
* @private
|
|
10
|
+
*/
|
|
11
|
+
export declare class OrderByItemComponent implements LimeWebComponent {
|
|
12
|
+
/**
|
|
13
|
+
* Platform service provider
|
|
14
|
+
*/
|
|
15
|
+
platform: LimeWebComponentPlatform;
|
|
16
|
+
/**
|
|
17
|
+
* Component context
|
|
18
|
+
*/
|
|
19
|
+
context: LimeWebComponentContext;
|
|
20
|
+
/**
|
|
21
|
+
* The limetype to select properties from
|
|
22
|
+
*/
|
|
23
|
+
limetype: string;
|
|
24
|
+
/**
|
|
25
|
+
* The order by item (e.g., { "company.name": "ASC" })
|
|
26
|
+
*/
|
|
27
|
+
item: OrderByItem;
|
|
28
|
+
/**
|
|
29
|
+
* Emitted when the item changes or should be removed
|
|
30
|
+
*/
|
|
31
|
+
itemChange: EventEmitter<OrderByItem | null>;
|
|
32
|
+
render(): any;
|
|
33
|
+
private handlePathChange;
|
|
34
|
+
private handleToggleDirection;
|
|
35
|
+
private handleRemove;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=order-by-item.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EventEmitter } from '
|
|
1
|
+
import { EventEmitter } from '../../../stencil-public-runtime';
|
|
2
2
|
import { LimeWebComponent, LimeWebComponentContext, LimeWebComponentPlatform } from '@limetech/lime-web-components';
|
|
3
|
-
import { ResponseFormat } from '
|
|
3
|
+
import { ResponseFormat } from '../lime-query.types';
|
|
4
4
|
/**
|
|
5
5
|
* Response Format Editor Component
|
|
6
6
|
*
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper functions for working with ResponseFormat objects
|
|
3
|
+
*
|
|
4
|
+
* These utilities handle parsing, stringifying, and default values
|
|
5
|
+
* for ResponseFormat in isolation (without full LimeQuery wrapper)
|
|
6
|
+
*/
|
|
7
|
+
import { ResponseFormat } from '../lime-query.types';
|
|
8
|
+
/**
|
|
9
|
+
* Parse JSON string to ResponseFormat
|
|
10
|
+
*
|
|
11
|
+
* @param json - JSON string to parse
|
|
12
|
+
* @returns Parsed ResponseFormat object
|
|
13
|
+
* @throws Error if JSON is invalid or not a ResponseFormat
|
|
14
|
+
*/
|
|
15
|
+
export declare function parseResponseFormat(json: string): ResponseFormat;
|
|
16
|
+
/**
|
|
17
|
+
* Stringify ResponseFormat to JSON
|
|
18
|
+
*
|
|
19
|
+
* @param format - ResponseFormat object to stringify
|
|
20
|
+
* @returns Pretty-printed JSON string
|
|
21
|
+
*/
|
|
22
|
+
export declare function stringifyResponseFormat(format: ResponseFormat): string;
|
|
23
|
+
/**
|
|
24
|
+
* Get default ResponseFormat (just _id)
|
|
25
|
+
*
|
|
26
|
+
* @returns Default ResponseFormat with only _id selected
|
|
27
|
+
*/
|
|
28
|
+
export declare function getDefaultResponseFormat(): ResponseFormat;
|
|
29
|
+
/**
|
|
30
|
+
* Check if a parsed JSON object is a valid ResponseFormat
|
|
31
|
+
*
|
|
32
|
+
* This is a more lenient check than parseResponseFormat - it doesn't throw,
|
|
33
|
+
* just returns a boolean with optional error message
|
|
34
|
+
*
|
|
35
|
+
* @param json - Parsed JSON object to check
|
|
36
|
+
* @returns Object with `valid` boolean and optional `error` message
|
|
37
|
+
*/
|
|
38
|
+
export declare function isValidResponseFormatStructure(json: any): {
|
|
39
|
+
valid: boolean;
|
|
40
|
+
error?: string;
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=response-format-helpers.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EventEmitter } from '
|
|
1
|
+
import { EventEmitter } from '../../../stencil-public-runtime';
|
|
2
2
|
import { LimeWebComponent, LimeWebComponentContext, LimeWebComponentPlatform } from '@limetech/lime-web-components';
|
|
3
|
-
import { PropertySelectionItem } from '
|
|
3
|
+
import { PropertySelectionItem } from '../property-selection-format';
|
|
4
4
|
/**
|
|
5
5
|
* Response Format Property Item Component
|
|
6
6
|
*
|