@limetech/lime-crm-building-blocks 1.136.0 → 1.137.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 CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.137.0](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.136.0...v1.137.0) (2026-06-16)
2
+
3
+ ### Features
4
+
5
+
6
+ * **rule-gate:** reactive visibility via RuleRegistry.subscribe ([b6ed5bc](https://github.com/Lundalogik/lime-crm-building-blocks/commit/b6ed5bc9230eb047885cdcda7c365da4069f2eb8))
7
+
1
8
  ## [1.136.0](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.135.1...v1.136.0) (2026-06-15)
2
9
 
3
10
  ### Features
@@ -503,7 +503,7 @@ const InfoTile = class {
503
503
  return false;
504
504
  }
505
505
  try {
506
- return this.ruleRegistry.compile(this.reducedPresenceRule)(this.ruleRegistry.scope({
506
+ return this.ruleRegistry.compile(this.reducedPresenceRule).evaluate(this.ruleRegistry.scope({
507
507
  host: this.hostElement,
508
508
  with: { scalarValue: this.value },
509
509
  }));
@@ -11,30 +11,42 @@ const RuleGate = class {
11
11
  this.shouldRender = false;
12
12
  }
13
13
  componentWillLoad() {
14
- this.compileAndEvaluate();
14
+ this.evaluate();
15
+ }
16
+ disconnectedCallback() {
17
+ var _a;
18
+ (_a = this.stopSubscription) === null || _a === void 0 ? void 0 : _a.call(this);
15
19
  }
16
20
  onRuleChange() {
17
- this.compileAndEvaluate();
21
+ this.evaluate();
18
22
  }
19
23
  onScopeChange() {
20
- this.compileAndEvaluate();
24
+ this.evaluate();
21
25
  }
22
26
  render() {
23
- return (index.h(index.Host, { key: 'dcf210fbec22936a14f12f2571970e5ab65e9cfb', hidden: !this.shouldRender }, index.h("slot", { key: 'e7bfc24c5a0616ff4e3560cb7da3b485d820b466' })));
27
+ return (index.h(index.Host, { key: 'fd7edf7439ea87b25e48c6f39a92f957b08ed49a', hidden: !this.shouldRender }, index.h("slot", { key: 'b7996f2833b46fa5ed41e37047380b0f7ce46d17' })));
24
28
  }
25
29
  get ruleRegistry() {
26
30
  return this.platform.get(index_esm.n.RuleRegistry);
27
31
  }
28
- compileAndEvaluate() {
32
+ evaluate() {
29
33
  var _a;
34
+ (_a = this.stopSubscription) === null || _a === void 0 ? void 0 : _a.call(this);
35
+ this.stopSubscription = undefined;
30
36
  if (!this.rule) {
31
37
  this.shouldRender = true;
32
38
  return;
33
39
  }
34
40
  try {
35
41
  const compiled = this.ruleRegistry.compile(this.rule);
36
- const scope = (_a = this.scope) !== null && _a !== void 0 ? _a : this.ruleRegistry.scope({ host: this.host });
37
- this.shouldRender = compiled(scope);
42
+ // An explicit scope is the caller's; evaluate once, no subscription.
43
+ if (this.scope) {
44
+ this.shouldRender = compiled.evaluate(this.scope);
45
+ return;
46
+ }
47
+ this.stopSubscription = this.ruleRegistry.subscribe(compiled, { host: this.host }, (result) => {
48
+ this.shouldRender = result;
49
+ });
38
50
  }
39
51
  catch (error) {
40
52
  console.warn('rule-gate failed to compile rule; hiding slot', {
@@ -134,7 +134,7 @@ export class InfoTile {
134
134
  return false;
135
135
  }
136
136
  try {
137
- return this.ruleRegistry.compile(this.reducedPresenceRule)(this.ruleRegistry.scope({
137
+ return this.ruleRegistry.compile(this.reducedPresenceRule).evaluate(this.ruleRegistry.scope({
138
138
  host: this.hostElement,
139
139
  with: { scalarValue: this.value },
140
140
  }));
@@ -5,7 +5,10 @@ import { PlatformServiceName, } from "@limetech/lime-web-components";
5
5
  *
6
6
  * Pass a {@link Rule} and the gate compiles it on load and on prop
7
7
  * changes, then evaluates it against a scope obtained from the
8
- * {@link RuleRegistry} platform service.
8
+ * {@link RuleRegistry} platform service. When the gate builds that
9
+ * scope itself it subscribes through the rule registry and re-evaluates
10
+ * whenever a context key the rule reads changes, so a rule like
11
+ * `limeobject-is-saved` reflects edits and discards without a reload.
9
12
  *
10
13
  * @exampleComponent limebb-example-rule-gate
11
14
  *
@@ -17,30 +20,42 @@ export class RuleGate {
17
20
  this.shouldRender = false;
18
21
  }
19
22
  componentWillLoad() {
20
- this.compileAndEvaluate();
23
+ this.evaluate();
24
+ }
25
+ disconnectedCallback() {
26
+ var _a;
27
+ (_a = this.stopSubscription) === null || _a === void 0 ? void 0 : _a.call(this);
21
28
  }
22
29
  onRuleChange() {
23
- this.compileAndEvaluate();
30
+ this.evaluate();
24
31
  }
25
32
  onScopeChange() {
26
- this.compileAndEvaluate();
33
+ this.evaluate();
27
34
  }
28
35
  render() {
29
- return (h(Host, { key: 'dcf210fbec22936a14f12f2571970e5ab65e9cfb', hidden: !this.shouldRender }, h("slot", { key: 'e7bfc24c5a0616ff4e3560cb7da3b485d820b466' })));
36
+ return (h(Host, { key: 'fd7edf7439ea87b25e48c6f39a92f957b08ed49a', hidden: !this.shouldRender }, h("slot", { key: 'b7996f2833b46fa5ed41e37047380b0f7ce46d17' })));
30
37
  }
31
38
  get ruleRegistry() {
32
39
  return this.platform.get(PlatformServiceName.RuleRegistry);
33
40
  }
34
- compileAndEvaluate() {
41
+ evaluate() {
35
42
  var _a;
43
+ (_a = this.stopSubscription) === null || _a === void 0 ? void 0 : _a.call(this);
44
+ this.stopSubscription = undefined;
36
45
  if (!this.rule) {
37
46
  this.shouldRender = true;
38
47
  return;
39
48
  }
40
49
  try {
41
50
  const compiled = this.ruleRegistry.compile(this.rule);
42
- const scope = (_a = this.scope) !== null && _a !== void 0 ? _a : this.ruleRegistry.scope({ host: this.host });
43
- this.shouldRender = compiled(scope);
51
+ // An explicit scope is the caller's; evaluate once, no subscription.
52
+ if (this.scope) {
53
+ this.shouldRender = compiled.evaluate(this.scope);
54
+ return;
55
+ }
56
+ this.stopSubscription = this.ruleRegistry.subscribe(compiled, { host: this.host }, (result) => {
57
+ this.shouldRender = result;
58
+ });
44
59
  }
45
60
  catch (error) {
46
61
  console.warn('rule-gate failed to compile rule; hiding slot', {
@@ -1 +1 @@
1
- import{proxyCustomElement as t,HTMLElement as e,h as i,transformTag as r}from"@stencil/core/internal/client";import{b as s,n as o,l as n,d as a,L as l,r as h}from"./index.esm.js";import{a as c}from"./limetype.js";class u{constructor(t){this.getState=t,this.contextType="info-tile"}getContext(){const{limetype:t,filterId:e,filterName:i,aggregateOperator:r,propertyName:s,value:o,label:n}=this.getState();if(!t||!e)return console.debug("InfoTileContextProvider: No limetype or filterId available"),null;const a={widgetType:"info-tile",limetype:t,filterId:e};return i&&(a.filterName=i),a.aggregateOperator=r,s&&(a.propertyName=s),void 0!==o&&(a.value=o),n&&(a.label=n),{data:a,purpose:"Shows an aggregated value from a filter. Clicking navigates to the explorer with that filter applied."}}}class f{constructor(t,e=[]){this.platform=t,this.filters=e}async load(t,e){let i;return i=this.isObjectIdentifier(e)?await this.loadLimeObjectInfoTile(t,e):await this.loadBasicInfoTile(t),i}async loadBasicInfoTile(t){const e=this.getFilter(t.filter);if(!e)throw Error(`Filter "${t.filter}" not found`);return(await this.query.execute({limetype:e.limetype,responseFormat:{aggregates:{infotiles:{value:{op:t.operator,key:t.name}}}},filter:e.filter})).aggregates.infotiles[0].value}async loadLimeObjectInfoTile(t,e){await this.objectRepository.loadObject(e.limetype,e.id,{properties:[t]});const i=this.objectRepository.getObject(e.limetype,e.id);return null==i?void 0:i.getValue([t.name,t.key].join("."))}isObjectIdentifier(t){return!(!(null==t?void 0:t.limetype)||!(null==t?void 0:t.id))}getFilter(t){return this.filters.find((e=>e.id===t))}get query(){return this.platform.get(s.Query)}get objectRepository(){return this.platform.get(s.LimeObjectRepository)}}function d(t,e){return t&&(t[e]||t.en||t.en_us)||""}function p(t,e=[]){const{path:i,query:r}=function(t,e=[]){if(!t)return{path:"#"};const i=["explorer",t.limetype,t.id].join("/"),r=function(t,e){const i=[...e,t].filter((t=>void 0!==t));if(0!==i.length)return 1===i.length?i[0]:{op:o.AND,exp:i}}(t.filter,e);return r?{path:i,query:{filter:r}}:{path:i}}(t,e);return r?`${i}?${Object.entries(r).map((([t,e])=>`${t}=${encodeURIComponent(JSON.stringify(e))}`)).join("&")}`:i}class g{constructor(t){this.locale=t}format(t){let e=t+"";return"number"==typeof t?e=new Intl.NumberFormat(this.locale).format(t):new Date(t).getTime()&&(e=new Intl.DateTimeFormat(this.locale).format(new Date(t))),{value:e}}}class m{constructor(t){this.locale=t}format(t,e){const i=new Date(t);return{prefix:this.formatAffix("prefix",i,e),value:this.formatValue(i,e),suffix:this.formatAffix("suffix",i,e)}}formatValue(t,e){const i=Object.assign({},e.options);if(e.prefix)for(const t of e.prefix)delete i[t];if(e.suffix)for(const t of e.suffix)delete i[t];return new Intl.DateTimeFormat(this.locale,i).format(t)}formatAffix(t,e,i){const r=Object.assign({},i.options);for(const e of Object.keys(r))"hour12"!==e&&((i[t]||[]).includes(e)||delete r[e]);if(0!==Object.values(r).filter(Boolean).length)return new Intl.DateTimeFormat(this.locale,r).format(e)}}class v{constructor(t){this.locale=t}format(t,e){var i,r;const s=new Intl.NumberFormat(this.locale,e.options),o=s.formatToParts(t);let n="",a="",l="";for(const t of o)(null===(i=e.prefix)||void 0===i?void 0:i.includes(t.type))?n+=t.value:(null===(r=e.suffix)||void 0===r?void 0:r.includes(t.type))?l+=t.value:a+=t.value;return a||(a=s.format(t),n="",l=""),{prefix:n,value:a,suffix:l}}}class y{constructor(t){this.locale=t}format(t,e){const i=new Intl.RelativeTimeFormat(this.locale,e.options),{value:r,unit:s}=this.getRelativeTime(t),o=i.formatToParts(r,s);let n="",a="",l="";for(const t of o)"literal"!==t.type||a?"literal"===t.type&&a?l+=t.value:a+=t.value:n+=t.value;return a||(a=n||l,n="",l=""),{prefix:n,value:a,suffix:l}}getRelativeTime(t){const e=new Date(t),i=new Date,r=e.getTime()-i.getTime(),s=[{unit:"year",value:31536e6},{unit:"month",value:2592e6},{unit:"week",value:6048e5},{unit:"day",value:864e5},{unit:"hour",value:36e5},{unit:"minute",value:6e4},{unit:"second",value:1e3}];for(const t of s){const e=r/t.value;if(Math.abs(e)>=1)return{value:Math.round(e),unit:t.unit}}return{value:0,unit:"second"}}}class b{constructor(t){this.locale=t}createFormatter(t,e){return"number"===(null==t?void 0:t.type)&&"number"==typeof e?new v(this.locale):"date"===(null==t?void 0:t.type)&&"string"==typeof e?new m(this.locale):"relative-date"===(null==t?void 0:t.type)&&"string"==typeof e?new y(this.locale):new g(this.locale)}}var w=function(t,e,i,r){var s,o=arguments.length,n=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(n=(o<3?s(n):o>3?s(e,i,n):s(e,i))||n);return o>3&&n&&Object.defineProperty(e,i,n),n};const x=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.aggregateOperator=h.Count,this.loading=!1,this.error=!1}get hostElement(){return this.host}connectedCallback(){this.registerContextProvider()}disconnectedCallback(){var t;null===(t=this.unregisterContextProvider)||void 0===t||t.call(this)}componentWillLoad(){this.loadInfoTileValue()}watchFilterId(){this.loadInfoTileValue()}watchPropertyName(){this.loadInfoTileValue()}watchAggregateOperator(){this.loadInfoTileValue()}async loadInfoTileValue(){if(this.loading=!0,this.error=!1,this.getFilter()){try{const t={key:this.getKey(),name:this.propertyName,operator:this.aggregateOperator,filter:this.filterId};this.value=await this.loader.load(t,this.context)}catch(t){console.error(t),this.error=!0}this.loading=!1}else this.error=!0}getKey(){return Math.random().toString(36).slice(2)}render(){var t,e;const r=this.getFilter(),s=this.getFormattedValue(),o={disabled:this.disabled,icon:this.icon,prefix:(null===(t=null==s?void 0:s.prefix)||void 0===t?void 0:t.trim())||this.prefix,suffix:(null===(e=null==s?void 0:s.suffix)||void 0===e?void 0:e.trim())||this.suffix,reducedPresence:this.shouldReducePresence()},n=Object.assign(Object.assign({},o),{icon:"error",prefix:"ERROR",loading:!0,label:this.getLabel(r)}),a=Object.assign(Object.assign({},o),{label:this.getLabel(r),link:this.getLink(r),loading:this.loading,value:null==s?void 0:s.value.trim()});return i("limel-info-tile",Object.assign({key:"82a39b67ae1c9ce8c314de62102366c566f98b0a",class:{error:!r||this.error}},!r||this.error?n:a))}shouldReducePresence(){if(this.reducedPresence)return!0;if(!this.reducedPresenceRule||this.loading)return!1;try{return this.ruleRegistry.compile(this.reducedPresenceRule)(this.ruleRegistry.scope({host:this.hostElement,with:{scalarValue:this.value}}))}catch(t){return!1}}getFormattedValue(){if(!this.value&&0!==this.value)return{value:""};try{return this.getFormatter(this.value).format(this.value,this.format)}catch(t){return new g(this.language).format(this.value)}}getLabel(t){return t?"string"==typeof this.label?this.translator.get(this.label):d(this.label&&"object"==typeof this.label?this.label:t.name,this.language):"No filter set is selected"}getLink(t){const e=c({targetLimetype:t?this.limetypes[t.limetype]:void 0,currentLimetype:this.context.limetype?this.limetypes[this.context.limetype]:void 0,contextLimetypeName:this.context.limetype,contextId:this.context.id,propertyName:this.propertyName});return{href:p(t,e&&this.context.id?[{key:e,op:o.EQUALS,exp:this.context.id}]:[])}}getFilter(){return function(t,e){if(t&&e)return t.find((t=>t.id===e))}(this.filters,this.filterId)}getFormatter(t){return new b(this.language).createFormatter(this.format,t)}get translator(){return this.platform.get(s.Translate)}get ruleRegistry(){return this.platform.get(s.RuleRegistry)}get language(){return this.platform.get(s.Application).getLanguage()}get loader(){return new f(this.platform,this.filters)}registerContextProvider(){const t=this.platform.get(s.AIContextRegistry);if(!(null==t?void 0:t.register))return;const e=new u((()=>{const t=this.getFilter();return{limetype:null==t?void 0:t.limetype,filterId:this.filterId,filterName:t?d(t.name,this.language):void 0,aggregateOperator:this.aggregateOperator,propertyName:this.propertyName,value:this.value,label:this.getLabel(t)}}));this.unregisterContextProvider=t.register(e,this.hostElement)}get host(){return this}static get watchers(){return{filterId:[{watchFilterId:0}],propertyName:[{watchPropertyName:0}],aggregateOperator:[{watchAggregateOperator:0}]}}static get style(){return":host(limebb-info-tile){display:block;overflow:visible !important;background-color:transparent !important}limel-info-tile.error{--info-tile-icon-color:rgb(var(--color-red-dark));border:1px dashed rgb(var(--contrast-500));border-radius:var(--info-tile-border-radius, 1rem)}"}},[1,"limebb-info-tile",{platform:[16],context:[16],filterId:[513,"filter-id"],disabled:[4],icon:[513],label:[1],prefix:[1],suffix:[1],propertyName:[1,"property-name"],aggregateOperator:[1,"aggregate-operator"],format:[16],reducedPresence:[516,"reduced-presence"],reducedPresenceRule:[16],config:[32],filters:[32],value:[32],loading:[32],error:[32],limetypes:[32]},void 0,{filterId:[{watchFilterId:0}],propertyName:[{watchPropertyName:0}],aggregateOperator:[{watchAggregateOperator:0}]}]);w([n({})],x.prototype,"config",void 0),w([a()],x.prototype,"filters",void 0),w([l()],x.prototype,"limetypes",void 0);const O=x,I=function(){"undefined"!=typeof customElements&&["limebb-info-tile"].forEach((t=>{"limebb-info-tile"===t&&(customElements.get(r(t))||customElements.define(r(t),x))}))};export{O as LimebbInfoTile,I as defineCustomElement}
1
+ import{proxyCustomElement as t,HTMLElement as e,h as i,transformTag as r}from"@stencil/core/internal/client";import{b as s,n as o,l as n,d as a,L as l,r as h}from"./index.esm.js";import{a as c}from"./limetype.js";class u{constructor(t){this.getState=t,this.contextType="info-tile"}getContext(){const{limetype:t,filterId:e,filterName:i,aggregateOperator:r,propertyName:s,value:o,label:n}=this.getState();if(!t||!e)return console.debug("InfoTileContextProvider: No limetype or filterId available"),null;const a={widgetType:"info-tile",limetype:t,filterId:e};return i&&(a.filterName=i),a.aggregateOperator=r,s&&(a.propertyName=s),void 0!==o&&(a.value=o),n&&(a.label=n),{data:a,purpose:"Shows an aggregated value from a filter. Clicking navigates to the explorer with that filter applied."}}}class f{constructor(t,e=[]){this.platform=t,this.filters=e}async load(t,e){let i;return i=this.isObjectIdentifier(e)?await this.loadLimeObjectInfoTile(t,e):await this.loadBasicInfoTile(t),i}async loadBasicInfoTile(t){const e=this.getFilter(t.filter);if(!e)throw Error(`Filter "${t.filter}" not found`);return(await this.query.execute({limetype:e.limetype,responseFormat:{aggregates:{infotiles:{value:{op:t.operator,key:t.name}}}},filter:e.filter})).aggregates.infotiles[0].value}async loadLimeObjectInfoTile(t,e){await this.objectRepository.loadObject(e.limetype,e.id,{properties:[t]});const i=this.objectRepository.getObject(e.limetype,e.id);return null==i?void 0:i.getValue([t.name,t.key].join("."))}isObjectIdentifier(t){return!(!(null==t?void 0:t.limetype)||!(null==t?void 0:t.id))}getFilter(t){return this.filters.find((e=>e.id===t))}get query(){return this.platform.get(s.Query)}get objectRepository(){return this.platform.get(s.LimeObjectRepository)}}function d(t,e){return t&&(t[e]||t.en||t.en_us)||""}function p(t,e=[]){const{path:i,query:r}=function(t,e=[]){if(!t)return{path:"#"};const i=["explorer",t.limetype,t.id].join("/"),r=function(t,e){const i=[...e,t].filter((t=>void 0!==t));if(0!==i.length)return 1===i.length?i[0]:{op:o.AND,exp:i}}(t.filter,e);return r?{path:i,query:{filter:r}}:{path:i}}(t,e);return r?`${i}?${Object.entries(r).map((([t,e])=>`${t}=${encodeURIComponent(JSON.stringify(e))}`)).join("&")}`:i}class g{constructor(t){this.locale=t}format(t){let e=t+"";return"number"==typeof t?e=new Intl.NumberFormat(this.locale).format(t):new Date(t).getTime()&&(e=new Intl.DateTimeFormat(this.locale).format(new Date(t))),{value:e}}}class m{constructor(t){this.locale=t}format(t,e){const i=new Date(t);return{prefix:this.formatAffix("prefix",i,e),value:this.formatValue(i,e),suffix:this.formatAffix("suffix",i,e)}}formatValue(t,e){const i=Object.assign({},e.options);if(e.prefix)for(const t of e.prefix)delete i[t];if(e.suffix)for(const t of e.suffix)delete i[t];return new Intl.DateTimeFormat(this.locale,i).format(t)}formatAffix(t,e,i){const r=Object.assign({},i.options);for(const e of Object.keys(r))"hour12"!==e&&((i[t]||[]).includes(e)||delete r[e]);if(0!==Object.values(r).filter(Boolean).length)return new Intl.DateTimeFormat(this.locale,r).format(e)}}class v{constructor(t){this.locale=t}format(t,e){var i,r;const s=new Intl.NumberFormat(this.locale,e.options),o=s.formatToParts(t);let n="",a="",l="";for(const t of o)(null===(i=e.prefix)||void 0===i?void 0:i.includes(t.type))?n+=t.value:(null===(r=e.suffix)||void 0===r?void 0:r.includes(t.type))?l+=t.value:a+=t.value;return a||(a=s.format(t),n="",l=""),{prefix:n,value:a,suffix:l}}}class y{constructor(t){this.locale=t}format(t,e){const i=new Intl.RelativeTimeFormat(this.locale,e.options),{value:r,unit:s}=this.getRelativeTime(t),o=i.formatToParts(r,s);let n="",a="",l="";for(const t of o)"literal"!==t.type||a?"literal"===t.type&&a?l+=t.value:a+=t.value:n+=t.value;return a||(a=n||l,n="",l=""),{prefix:n,value:a,suffix:l}}getRelativeTime(t){const e=new Date(t),i=new Date,r=e.getTime()-i.getTime(),s=[{unit:"year",value:31536e6},{unit:"month",value:2592e6},{unit:"week",value:6048e5},{unit:"day",value:864e5},{unit:"hour",value:36e5},{unit:"minute",value:6e4},{unit:"second",value:1e3}];for(const t of s){const e=r/t.value;if(Math.abs(e)>=1)return{value:Math.round(e),unit:t.unit}}return{value:0,unit:"second"}}}class b{constructor(t){this.locale=t}createFormatter(t,e){return"number"===(null==t?void 0:t.type)&&"number"==typeof e?new v(this.locale):"date"===(null==t?void 0:t.type)&&"string"==typeof e?new m(this.locale):"relative-date"===(null==t?void 0:t.type)&&"string"==typeof e?new y(this.locale):new g(this.locale)}}var w=function(t,e,i,r){var s,o=arguments.length,n=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(n=(o<3?s(n):o>3?s(e,i,n):s(e,i))||n);return o>3&&n&&Object.defineProperty(e,i,n),n};const x=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.aggregateOperator=h.Count,this.loading=!1,this.error=!1}get hostElement(){return this.host}connectedCallback(){this.registerContextProvider()}disconnectedCallback(){var t;null===(t=this.unregisterContextProvider)||void 0===t||t.call(this)}componentWillLoad(){this.loadInfoTileValue()}watchFilterId(){this.loadInfoTileValue()}watchPropertyName(){this.loadInfoTileValue()}watchAggregateOperator(){this.loadInfoTileValue()}async loadInfoTileValue(){if(this.loading=!0,this.error=!1,this.getFilter()){try{const t={key:this.getKey(),name:this.propertyName,operator:this.aggregateOperator,filter:this.filterId};this.value=await this.loader.load(t,this.context)}catch(t){console.error(t),this.error=!0}this.loading=!1}else this.error=!0}getKey(){return Math.random().toString(36).slice(2)}render(){var t,e;const r=this.getFilter(),s=this.getFormattedValue(),o={disabled:this.disabled,icon:this.icon,prefix:(null===(t=null==s?void 0:s.prefix)||void 0===t?void 0:t.trim())||this.prefix,suffix:(null===(e=null==s?void 0:s.suffix)||void 0===e?void 0:e.trim())||this.suffix,reducedPresence:this.shouldReducePresence()},n=Object.assign(Object.assign({},o),{icon:"error",prefix:"ERROR",loading:!0,label:this.getLabel(r)}),a=Object.assign(Object.assign({},o),{label:this.getLabel(r),link:this.getLink(r),loading:this.loading,value:null==s?void 0:s.value.trim()});return i("limel-info-tile",Object.assign({key:"82a39b67ae1c9ce8c314de62102366c566f98b0a",class:{error:!r||this.error}},!r||this.error?n:a))}shouldReducePresence(){if(this.reducedPresence)return!0;if(!this.reducedPresenceRule||this.loading)return!1;try{return this.ruleRegistry.compile(this.reducedPresenceRule).evaluate(this.ruleRegistry.scope({host:this.hostElement,with:{scalarValue:this.value}}))}catch(t){return!1}}getFormattedValue(){if(!this.value&&0!==this.value)return{value:""};try{return this.getFormatter(this.value).format(this.value,this.format)}catch(t){return new g(this.language).format(this.value)}}getLabel(t){return t?"string"==typeof this.label?this.translator.get(this.label):d(this.label&&"object"==typeof this.label?this.label:t.name,this.language):"No filter set is selected"}getLink(t){const e=c({targetLimetype:t?this.limetypes[t.limetype]:void 0,currentLimetype:this.context.limetype?this.limetypes[this.context.limetype]:void 0,contextLimetypeName:this.context.limetype,contextId:this.context.id,propertyName:this.propertyName});return{href:p(t,e&&this.context.id?[{key:e,op:o.EQUALS,exp:this.context.id}]:[])}}getFilter(){return function(t,e){if(t&&e)return t.find((t=>t.id===e))}(this.filters,this.filterId)}getFormatter(t){return new b(this.language).createFormatter(this.format,t)}get translator(){return this.platform.get(s.Translate)}get ruleRegistry(){return this.platform.get(s.RuleRegistry)}get language(){return this.platform.get(s.Application).getLanguage()}get loader(){return new f(this.platform,this.filters)}registerContextProvider(){const t=this.platform.get(s.AIContextRegistry);if(!(null==t?void 0:t.register))return;const e=new u((()=>{const t=this.getFilter();return{limetype:null==t?void 0:t.limetype,filterId:this.filterId,filterName:t?d(t.name,this.language):void 0,aggregateOperator:this.aggregateOperator,propertyName:this.propertyName,value:this.value,label:this.getLabel(t)}}));this.unregisterContextProvider=t.register(e,this.hostElement)}get host(){return this}static get watchers(){return{filterId:[{watchFilterId:0}],propertyName:[{watchPropertyName:0}],aggregateOperator:[{watchAggregateOperator:0}]}}static get style(){return":host(limebb-info-tile){display:block;overflow:visible !important;background-color:transparent !important}limel-info-tile.error{--info-tile-icon-color:rgb(var(--color-red-dark));border:1px dashed rgb(var(--contrast-500));border-radius:var(--info-tile-border-radius, 1rem)}"}},[1,"limebb-info-tile",{platform:[16],context:[16],filterId:[513,"filter-id"],disabled:[4],icon:[513],label:[1],prefix:[1],suffix:[1],propertyName:[1,"property-name"],aggregateOperator:[1,"aggregate-operator"],format:[16],reducedPresence:[516,"reduced-presence"],reducedPresenceRule:[16],config:[32],filters:[32],value:[32],loading:[32],error:[32],limetypes:[32]},void 0,{filterId:[{watchFilterId:0}],propertyName:[{watchPropertyName:0}],aggregateOperator:[{watchAggregateOperator:0}]}]);w([n({})],x.prototype,"config",void 0),w([a()],x.prototype,"filters",void 0),w([l()],x.prototype,"limetypes",void 0);const O=x,I=function(){"undefined"!=typeof customElements&&["limebb-info-tile"].forEach((t=>{"limebb-info-tile"===t&&(customElements.get(r(t))||customElements.define(r(t),x))}))};export{O as LimebbInfoTile,I as defineCustomElement}
@@ -1 +1 @@
1
- import{proxyCustomElement as e,HTMLElement as t,h as s,Host as o,transformTag as i}from"@stencil/core/internal/client";import{b as n}from"./index.esm.js";const l=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.shouldRender=!1}componentWillLoad(){this.compileAndEvaluate()}onRuleChange(){this.compileAndEvaluate()}onScopeChange(){this.compileAndEvaluate()}render(){return s(o,{key:"dcf210fbec22936a14f12f2571970e5ab65e9cfb",hidden:!this.shouldRender},s("slot",{key:"e7bfc24c5a0616ff4e3560cb7da3b485d820b466"}))}get ruleRegistry(){return this.platform.get(n.RuleRegistry)}compileAndEvaluate(){var e;if(this.rule)try{const t=this.ruleRegistry.compile(this.rule),s=null!==(e=this.scope)&&void 0!==e?e:this.ruleRegistry.scope({host:this.host});this.shouldRender=t(s)}catch(e){console.warn("rule-gate failed to compile rule; hiding slot",{rule:this.rule,error:e}),this.shouldRender=!1}else this.shouldRender=!0}get host(){return this}static get watchers(){return{rule:[{onRuleChange:0}],scope:[{onScopeChange:0}]}}static get style(){return":host{display:block}:host([hidden]){display:none}"}},[257,"limebb-rule-gate",{platform:[16],rule:[16],scope:[16],shouldRender:[32]},void 0,{rule:[{onRuleChange:0}],scope:[{onScopeChange:0}]}]),r=l,h=function(){"undefined"!=typeof customElements&&["limebb-rule-gate"].forEach((e=>{"limebb-rule-gate"===e&&(customElements.get(i(e))||customElements.define(i(e),l))}))};export{r as LimebbRuleGate,h as defineCustomElement}
1
+ import{proxyCustomElement as e,HTMLElement as t,h as s,Host as i,transformTag as o}from"@stencil/core/internal/client";import{b as n}from"./index.esm.js";const l=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.shouldRender=!1}componentWillLoad(){this.evaluate()}disconnectedCallback(){var e;null===(e=this.stopSubscription)||void 0===e||e.call(this)}onRuleChange(){this.evaluate()}onScopeChange(){this.evaluate()}render(){return s(i,{key:"fd7edf7439ea87b25e48c6f39a92f957b08ed49a",hidden:!this.shouldRender},s("slot",{key:"b7996f2833b46fa5ed41e37047380b0f7ce46d17"}))}get ruleRegistry(){return this.platform.get(n.RuleRegistry)}evaluate(){var e;if(null===(e=this.stopSubscription)||void 0===e||e.call(this),this.stopSubscription=void 0,this.rule)try{const e=this.ruleRegistry.compile(this.rule);if(this.scope)return void(this.shouldRender=e.evaluate(this.scope));this.stopSubscription=this.ruleRegistry.subscribe(e,{host:this.host},(e=>{this.shouldRender=e}))}catch(e){console.warn("rule-gate failed to compile rule; hiding slot",{rule:this.rule,error:e}),this.shouldRender=!1}else this.shouldRender=!0}get host(){return this}static get watchers(){return{rule:[{onRuleChange:0}],scope:[{onScopeChange:0}]}}static get style(){return":host{display:block}:host([hidden]){display:none}"}},[257,"limebb-rule-gate",{platform:[16],rule:[16],scope:[16],shouldRender:[32]},void 0,{rule:[{onRuleChange:0}],scope:[{onScopeChange:0}]}]),r=l,h=function(){"undefined"!=typeof customElements&&["limebb-rule-gate"].forEach((e=>{"limebb-rule-gate"===e&&(customElements.get(o(e))||customElements.define(o(e),l))}))};export{r as LimebbRuleGate,h as defineCustomElement}
@@ -501,7 +501,7 @@ const InfoTile = class {
501
501
  return false;
502
502
  }
503
503
  try {
504
- return this.ruleRegistry.compile(this.reducedPresenceRule)(this.ruleRegistry.scope({
504
+ return this.ruleRegistry.compile(this.reducedPresenceRule).evaluate(this.ruleRegistry.scope({
505
505
  host: this.hostElement,
506
506
  with: { scalarValue: this.value },
507
507
  }));
@@ -9,30 +9,42 @@ const RuleGate = class {
9
9
  this.shouldRender = false;
10
10
  }
11
11
  componentWillLoad() {
12
- this.compileAndEvaluate();
12
+ this.evaluate();
13
+ }
14
+ disconnectedCallback() {
15
+ var _a;
16
+ (_a = this.stopSubscription) === null || _a === void 0 ? void 0 : _a.call(this);
13
17
  }
14
18
  onRuleChange() {
15
- this.compileAndEvaluate();
19
+ this.evaluate();
16
20
  }
17
21
  onScopeChange() {
18
- this.compileAndEvaluate();
22
+ this.evaluate();
19
23
  }
20
24
  render() {
21
- return (h(Host, { key: 'dcf210fbec22936a14f12f2571970e5ab65e9cfb', hidden: !this.shouldRender }, h("slot", { key: 'e7bfc24c5a0616ff4e3560cb7da3b485d820b466' })));
25
+ return (h(Host, { key: 'fd7edf7439ea87b25e48c6f39a92f957b08ed49a', hidden: !this.shouldRender }, h("slot", { key: 'b7996f2833b46fa5ed41e37047380b0f7ce46d17' })));
22
26
  }
23
27
  get ruleRegistry() {
24
28
  return this.platform.get(n.RuleRegistry);
25
29
  }
26
- compileAndEvaluate() {
30
+ evaluate() {
27
31
  var _a;
32
+ (_a = this.stopSubscription) === null || _a === void 0 ? void 0 : _a.call(this);
33
+ this.stopSubscription = undefined;
28
34
  if (!this.rule) {
29
35
  this.shouldRender = true;
30
36
  return;
31
37
  }
32
38
  try {
33
39
  const compiled = this.ruleRegistry.compile(this.rule);
34
- const scope = (_a = this.scope) !== null && _a !== void 0 ? _a : this.ruleRegistry.scope({ host: this.host });
35
- this.shouldRender = compiled(scope);
40
+ // An explicit scope is the caller's; evaluate once, no subscription.
41
+ if (this.scope) {
42
+ this.shouldRender = compiled.evaluate(this.scope);
43
+ return;
44
+ }
45
+ this.stopSubscription = this.ruleRegistry.subscribe(compiled, { host: this.host }, (result) => {
46
+ this.shouldRender = result;
47
+ });
36
48
  }
37
49
  catch (error) {
38
50
  console.warn('rule-gate failed to compile rule; hiding slot', {
@@ -1 +1 @@
1
- import{p as e,b as t}from"./p-LEJjPpY0.js";export{s as setNonce}from"./p-LEJjPpY0.js";import{g as l}from"./p-DQuL1Twl.js";(()=>{const t=import.meta.url,l={};return""!==t&&(l.resourcesUrl=new URL(".",t).href),e(l)})().then((async e=>(await l(),t(JSON.parse('[["p-e0107a69",[[1,"limebb-lime-query-builder",{"platform":[16],"context":[16],"value":[16],"label":[1],"activeLimetype":[1,"active-limetype"],"limetypes":[32],"mode":[32],"codeValue":[32],"limetype":[32],"filter":[32],"internalResponseFormat":[32],"limit":[32],"orderBy":[32],"description":[32]}]]],["p-a201e304",[[1,"limebb-rule-arg-filter-editor",{"platform":[16],"context":[16],"value":[16],"resolvedContext":[32]}]]],["p-6cfebec1",[[1,"limebb-feed",{"platform":[16],"context":[16],"items":[16],"emptyStateMessage":[1,"empty-state-message"],"heading":[1],"loading":[4],"minutesOfProximity":[2,"minutes-of-proximity"],"totalCount":[2,"total-count"],"direction":[513],"lastVisitedTimestamp":[1,"last-visited-timestamp"],"highlightedItemId":[8,"highlighted-item-id"]},null,{"highlightedItemId":[{"highlightedItemIdChanged":0}]}]]],["p-bec2bcef",[[1,"limebb-kanban",{"platform":[16],"context":[16],"groups":[16]}]]],["p-b8e4a0d1",[[1,"limebb-chat-list",{"platform":[16],"context":[16],"items":[16],"loading":[516],"isTypingIndicatorVisible":[516,"is-typing-indicator-visible"],"lastVisitedTimestamp":[513,"last-visited-timestamp"],"order":[513]},null,{"items":[{"handleItemsChange":0}],"order":[{"handleItemsChange":0}]}]]],["p-0bdfd7ab",[[1,"limebb-lime-query-response-format-builder",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"helperText":[1,"helper-text"],"limetypes":[32],"mode":[32],"codeValue":[32],"internalValue":[32]}]]],["p-cfc3f16b",[[1,"limebb-document-chips",{"accessibleLabel":[513,"accessible-label"],"files":[16]},null,{"files":[{"onFilesChanged":0}]}]]],["p-73fab4a9",[[1,"limebb-limeobject-file-viewer",{"platform":[16],"context":[16],"property":[1],"fileTypes":[16],"limeobject":[32],"limetype":[32]}]]],["p-b2b595cc",[[17,"limebb-text-editor",{"platform":[16],"context":[16],"allowMentioning":[4,"allow-mentioning"],"contentType":[1,"content-type"],"language":[513],"disabled":[516],"readonly":[516],"helperText":[513,"helper-text"],"placeholder":[513],"label":[513],"invalid":[516],"required":[516],"selectedContext":[16],"ui":[513],"allowResize":[4,"allow-resize"],"value":[1],"draftIdentifier":[1,"draft-identifier"],"triggerMap":[16],"customElements":[16],"allowInlineImages":[4,"allow-inline-images"],"items":[32],"highlightedItemIndex":[32],"editorPickerQuery":[32],"searchableLimetypes":[32],"isPickerOpen":[32],"isSearching":[32]},null,{"isPickerOpen":[{"watchOpen":0}],"editorPickerQuery":[{"watchQuery":0}]}]]],["p-15bb23c9",[[1,"limebb-data-cells",{"platform":[16],"context":[16],"limeobject":[8],"items":[16],"image":[16],"relativeDates":[4,"relative-dates"]}]]],["p-d8d30ec3",[[1,"limebb-date-range",{"platform":[16],"context":[16],"startTime":[16],"endTime":[16],"startTimeLabel":[1,"start-time-label"],"endTimeLabel":[1,"end-time-label"],"language":[1],"timeFormat":[1,"time-format"],"type":[1]}]]],["p-00860497",[[1,"limebb-document-picker",{"platform":[16],"context":[16],"items":[16],"label":[513],"helperText":[513,"helper-text"],"invalid":[516],"required":[516],"type":[513]}]]],["p-e2503bad",[[1,"limebb-info-tile-currency-format",{"platform":[16],"context":[16],"value":[16]}]]],["p-6db41866",[[1,"limebb-notification-list",{"platform":[16],"context":[16],"items":[16],"loading":[4],"lastVisitedTimestamp":[1,"last-visited-timestamp"]},null,{"items":[{"handleItemsChange":0}]}]]],["p-3c25e289",[[1,"limebb-rule-editor",{"platform":[16],"context":[16],"value":[16],"availableContexts":[16],"required":[516],"readonly":[516],"disabled":[516],"label":[513],"helperText":[1,"helper-text"],"resolvedContext":[32],"issues":[32],"openChipPath":[32],"availablePrimitiveOptions":[32]},null,{"value":[{"onValueChange":0}],"availableContexts":[{"onAvailableContextsChange":0}]}]]],["p-00be69ac",[[257,"limebb-alert-dialog",{"type":[513],"open":[516],"icon":[513],"heading":[513],"subheading":[1]}]]],["p-23556cb1",[[17,"limebb-browser",{"platform":[16],"context":[16],"items":[16],"layout":[1],"filter":[32]}]]],["p-5095a168",[[1,"limebb-color-palette-picker",{"value":[513],"required":[516],"readonly":[516],"invalid":[516],"disabled":[516],"label":[513],"helperText":[1,"helper-text"]}]]],["p-01ddcb14",[[1,"limebb-color-palette-swatches",{"colors":[16]}]]],["p-2caee700",[[1,"limebb-component-config",{"platform":[16],"context":[16],"value":[16],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"formInfo":[16],"type":[1],"nameField":[1,"name-field"],"configComponent":[32],"configViewType":[32]},null,{"formInfo":[{"watchFormInfo":0}],"configComponent":[{"watchconfigComponent":0}]}]]],["p-5960143c",[[1,"limebb-component-picker",{"platform":[16],"context":[16],"type":[1],"tags":[16],"value":[1],"copyLabel":[1,"copy-label"],"hideCopyButton":[4,"hide-copy-button"],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["p-4e66111a",[[257,"limebb-composer-toolbar",{"platform":[16],"mentions":[516],"textSnippets":[516,"text-snippets"],"internalLinks":[516,"internal-links"],"richText":[516,"rich-text"],"fileInput":[16]}]]],["p-c85e44a9",[[257,"limebb-dashboard-widget",{"heading":[513],"subheading":[513],"supportingText":[513,"supporting-text"],"icon":[513]}]]],["p-f5c44de2",[[1,"limebb-icon-picker",{"value":[1],"required":[4],"readonly":[4],"invalid":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["p-3a41d8ae",[[1,"limebb-info-tile",{"platform":[16],"context":[16],"filterId":[513,"filter-id"],"disabled":[4],"icon":[513],"label":[1],"prefix":[1],"suffix":[1],"propertyName":[1,"property-name"],"aggregateOperator":[1,"aggregate-operator"],"format":[16],"reducedPresence":[516,"reduced-presence"],"reducedPresenceRule":[16],"config":[32],"filters":[32],"value":[32],"loading":[32],"error":[32],"limetypes":[32]},null,{"filterId":[{"watchFilterId":0}],"propertyName":[{"watchPropertyName":0}],"aggregateOperator":[{"watchAggregateOperator":0}]}]]],["p-639032ba",[[1,"limebb-info-tile-date-format",{"value":[16]}]]],["p-37fbd50d",[[1,"limebb-info-tile-decimal-format",{"value":[16]}]]],["p-b9c4df08",[[1,"limebb-info-tile-format",{"platform":[16],"context":[16],"type":[1],"value":[16]}]]],["p-b6a8ad7a",[[1,"limebb-info-tile-relative-date-format",{"value":[16]}]]],["p-382ab76b",[[1,"limebb-info-tile-unit-format",{"value":[16]}]]],["p-5f940ea8",[[1,"limebb-loader",{"platform":[16],"context":[16]}]]],["p-4e7b8559",[[1,"limebb-locale-picker",{"platform":[16],"context":[16],"value":[1],"required":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"readonly":[4],"multipleChoice":[4,"multiple-choice"],"allLanguages":[32]}]]],["p-bb825e68",[[257,"limebb-mention",{"limetype":[1],"objectid":[2],"limeobject":[32]}]]],["p-9ad269dd",[[1,"limebb-mention-group-counter",{"count":[2],"limetype":[16],"helperLabel":[1,"helper-label"]}]]],["p-2091d4c8",[[1,"limebb-object-chip",{"limetype":[1],"objectid":[2],"size":[1],"platform":[16],"data":[32]},null,{"limetype":[{"handlePropChange":0}],"objectid":[{"handlePropChange":0}]}]]],["p-5d2d0f4d",[[257,"limebb-rule-gate",{"platform":[16],"rule":[16],"scope":[16],"shouldRender":[32]},null,{"rule":[{"onRuleChange":0}],"scope":[{"onScopeChange":0}]}]]],["p-90f3e299",[[1,"limebb-trend-indicator",{"platform":[16],"context":[16],"value":[520],"formerValue":[514,"former-value"],"suffix":[513],"label":[513],"invalid":[516],"required":[516],"helperText":[513,"helper-text"],"reducePresence":[516,"reduce-presence"]},null,{"value":[{"valueChanged":0}]}]]],["p-52f39097",[[1,"limebb-value-comparison-editor",{"value":[16]}]]],["p-c84136ae",[[1,"limebb-currency-picker",{"platform":[16],"context":[16],"label":[513],"currencies":[16],"helperText":[513,"helper-text"],"required":[516],"readonly":[516],"invalid":[516],"disabled":[516],"value":[1]}]]],["p-5e4c9115",[[1,"limebb-feed-item-thumbnail-file-info",{"description":[1]}]]],["p-8d41a7f8",[[1,"limebb-feed-timeline-item",{"platform":[16],"context":[16],"item":[16],"ui":[513],"helperText":[1,"helper-text"],"hasError":[516,"has-error"],"isBundled":[516,"is-bundled"],"headingCanExpand":[32],"isHeadingExpanded":[32],"showMore":[32],"isTall":[32]}]]],["p-840b817b",[[1,"limebb-kanban-group",{"platform":[16],"context":[16],"identifier":[1],"heading":[513],"help":[1],"items":[16],"summary":[1],"loading":[516],"totalCount":[514,"total-count"]}]]],["p-cf687fcd",[[17,"limebb-document-item",{"platform":[16],"context":[16],"item":[16],"type":[513],"fileTypes":[16]}]]],["p-4f398108",[[1,"limebb-empty-state",{"heading":[513],"value":[513],"icon":[16]}]]],["p-7597eb85",[[1,"limebb-text-editor-picker",{"items":[16],"open":[516],"isSearching":[4,"is-searching"],"emptyMessage":[1,"empty-message"]},null,{"open":[{"watchOpen":0}]}]]],["p-50f5380d",[[1,"limebb-date-picker",{"platform":[16],"context":[16],"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[1],"type":[513]}]]],["p-61ee03f9",[[1,"limebb-live-docs-info"]]],["p-46cc4edb",[[1,"limebb-notification-item",{"platform":[16],"context":[16],"item":[16]}]]],["p-4fcb97ea",[[1,"limebb-percentage-visualizer",{"platform":[16],"context":[16],"value":[520],"rangeMax":[514,"range-max"],"rangeMin":[514,"range-min"],"multiplier":[514],"label":[513],"invalid":[516],"required":[516],"helperText":[513,"helper-text"],"reducePresence":[516,"reduce-presence"],"displayPercentageColors":[516,"display-percentage-colors"]},null,{"value":[{"valueChanged":0}]}]]],["p-1c67e198",[[1,"limebb-rule-chip-popover",{"platform":[16],"context":[16],"refNode":[16],"isNegated":[4,"is-negated"],"metadata":[16],"readonly":[4],"disabled":[4],"isMutable":[4,"is-mutable"],"focusOnOpen":[4,"focus-on-open"]}]]],["p-f3d3ff7e",[[1,"limebb-lime-query-filter-builder",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}]]],["p-7b119566",[[257,"limebb-kanban-item",{"platform":[16],"context":[16],"item":[16]}]]],["p-db9ed6ed",[[17,"limebb-property-selector",{"platform":[16],"context":[16],"limetype":[1],"value":[1],"label":[1],"required":[4],"helperText":[1,"helper-text"],"limetypes":[32],"isOpen":[32],"navigationPath":[32]}]]],["p-88bdf554",[[1,"limebb-lime-query-order-by-item",{"platform":[16],"context":[16],"limetype":[1],"item":[16]}]]],["p-f382f2fa",[[1,"limebb-lime-query-order-by-editor",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"items":[32]},null,{"value":[{"handleValueChange":0}]}],[0,"limebb-limetype-field",{"platform":[16],"context":[16],"label":[513],"required":[516],"readonly":[516],"disabled":[516],"value":[513],"helperText":[513,"helper-text"],"invalid":[4],"limetypes":[16],"propertyFields":[16],"fieldName":[1,"field-name"],"formInfo":[16]}]]],["p-31580e01",[[1,"limebb-chat-icon-list",{"item":[16]}],[1,"limebb-chat-item",{"platform":[16],"context":[16],"item":[16],"helperText":[1,"helper-text"],"hasError":[516,"has-error"]}],[1,"limebb-typing-indicator"]]],["p-7dedd057",[[1,"limebb-lime-query-response-format-editor",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"items":[32]}],[1,"limebb-lime-query-response-format-item",{"platform":[16],"context":[16],"limetype":[1],"item":[16],"showAliasInput":[32],"showDescriptionInput":[32]}]]],["p-e3d8fd1b",[[2,"limebb-lime-query-filter-expression",{"platform":[16],"context":[16],"label":[1],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}],[1,"limebb-lime-query-filter-comparison",{"platform":[16],"context":[16],"label":[513],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16],"isOpen":[32]}]]],["p-342aae30",[[257,"limebb-summary-popover",{"triggerDelay":[514,"trigger-delay"],"heading":[513],"subheading":[513],"image":[16],"file":[16],"icon":[513],"value":[1],"openDirection":[513,"open-direction"],"popoverMaxWidth":[513,"popover-max-width"],"popoverMaxHeight":[513,"popover-max-height"],"actions":[16],"isPopoverOpen":[32]}],[17,"limebb-navigation-button",{"href":[513],"tooltipLabel":[513,"tooltip-label"],"tooltipHelperLabel":[513,"tooltip-helper-label"],"type":[513]}]]],["p-d7462e93",[[17,"limebb-lime-query-filter-comparison-editor",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}],[17,"limebb-filter-chip",{"label":[1],"value":[1],"conjunction":[1],"condition":[1],"propertyType":[1,"property-type"],"icon":[1],"helperLabel":[1,"helper-label"],"removable":[4],"readonly":[516],"disabled":[4],"invalid":[516],"selected":[516],"identifier":[8],"platform":[16],"maxLength":[2,"max-length"]},[[2,"click","filterClickWhenInactive"]]],[1,"limebb-lime-query-filter-group",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}],[1,"limebb-lime-query-filter-not",{"platform":[16],"context":[16],"label":[1],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}],[1,"limebb-lime-query-value-input",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"propertyPath":[1,"property-path"],"operator":[1],"value":[8],"label":[1],"limetypes":[32],"inputMode":[32]}]]]]'),e))));
1
+ import{p as e,b as t}from"./p-LEJjPpY0.js";export{s as setNonce}from"./p-LEJjPpY0.js";import{g as l}from"./p-DQuL1Twl.js";(()=>{const t=import.meta.url,l={};return""!==t&&(l.resourcesUrl=new URL(".",t).href),e(l)})().then((async e=>(await l(),t(JSON.parse('[["p-e0107a69",[[1,"limebb-lime-query-builder",{"platform":[16],"context":[16],"value":[16],"label":[1],"activeLimetype":[1,"active-limetype"],"limetypes":[32],"mode":[32],"codeValue":[32],"limetype":[32],"filter":[32],"internalResponseFormat":[32],"limit":[32],"orderBy":[32],"description":[32]}]]],["p-a201e304",[[1,"limebb-rule-arg-filter-editor",{"platform":[16],"context":[16],"value":[16],"resolvedContext":[32]}]]],["p-6cfebec1",[[1,"limebb-feed",{"platform":[16],"context":[16],"items":[16],"emptyStateMessage":[1,"empty-state-message"],"heading":[1],"loading":[4],"minutesOfProximity":[2,"minutes-of-proximity"],"totalCount":[2,"total-count"],"direction":[513],"lastVisitedTimestamp":[1,"last-visited-timestamp"],"highlightedItemId":[8,"highlighted-item-id"]},null,{"highlightedItemId":[{"highlightedItemIdChanged":0}]}]]],["p-bec2bcef",[[1,"limebb-kanban",{"platform":[16],"context":[16],"groups":[16]}]]],["p-b8e4a0d1",[[1,"limebb-chat-list",{"platform":[16],"context":[16],"items":[16],"loading":[516],"isTypingIndicatorVisible":[516,"is-typing-indicator-visible"],"lastVisitedTimestamp":[513,"last-visited-timestamp"],"order":[513]},null,{"items":[{"handleItemsChange":0}],"order":[{"handleItemsChange":0}]}]]],["p-0bdfd7ab",[[1,"limebb-lime-query-response-format-builder",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"helperText":[1,"helper-text"],"limetypes":[32],"mode":[32],"codeValue":[32],"internalValue":[32]}]]],["p-cfc3f16b",[[1,"limebb-document-chips",{"accessibleLabel":[513,"accessible-label"],"files":[16]},null,{"files":[{"onFilesChanged":0}]}]]],["p-73fab4a9",[[1,"limebb-limeobject-file-viewer",{"platform":[16],"context":[16],"property":[1],"fileTypes":[16],"limeobject":[32],"limetype":[32]}]]],["p-b2b595cc",[[17,"limebb-text-editor",{"platform":[16],"context":[16],"allowMentioning":[4,"allow-mentioning"],"contentType":[1,"content-type"],"language":[513],"disabled":[516],"readonly":[516],"helperText":[513,"helper-text"],"placeholder":[513],"label":[513],"invalid":[516],"required":[516],"selectedContext":[16],"ui":[513],"allowResize":[4,"allow-resize"],"value":[1],"draftIdentifier":[1,"draft-identifier"],"triggerMap":[16],"customElements":[16],"allowInlineImages":[4,"allow-inline-images"],"items":[32],"highlightedItemIndex":[32],"editorPickerQuery":[32],"searchableLimetypes":[32],"isPickerOpen":[32],"isSearching":[32]},null,{"isPickerOpen":[{"watchOpen":0}],"editorPickerQuery":[{"watchQuery":0}]}]]],["p-15bb23c9",[[1,"limebb-data-cells",{"platform":[16],"context":[16],"limeobject":[8],"items":[16],"image":[16],"relativeDates":[4,"relative-dates"]}]]],["p-d8d30ec3",[[1,"limebb-date-range",{"platform":[16],"context":[16],"startTime":[16],"endTime":[16],"startTimeLabel":[1,"start-time-label"],"endTimeLabel":[1,"end-time-label"],"language":[1],"timeFormat":[1,"time-format"],"type":[1]}]]],["p-00860497",[[1,"limebb-document-picker",{"platform":[16],"context":[16],"items":[16],"label":[513],"helperText":[513,"helper-text"],"invalid":[516],"required":[516],"type":[513]}]]],["p-e2503bad",[[1,"limebb-info-tile-currency-format",{"platform":[16],"context":[16],"value":[16]}]]],["p-6db41866",[[1,"limebb-notification-list",{"platform":[16],"context":[16],"items":[16],"loading":[4],"lastVisitedTimestamp":[1,"last-visited-timestamp"]},null,{"items":[{"handleItemsChange":0}]}]]],["p-3c25e289",[[1,"limebb-rule-editor",{"platform":[16],"context":[16],"value":[16],"availableContexts":[16],"required":[516],"readonly":[516],"disabled":[516],"label":[513],"helperText":[1,"helper-text"],"resolvedContext":[32],"issues":[32],"openChipPath":[32],"availablePrimitiveOptions":[32]},null,{"value":[{"onValueChange":0}],"availableContexts":[{"onAvailableContextsChange":0}]}]]],["p-00be69ac",[[257,"limebb-alert-dialog",{"type":[513],"open":[516],"icon":[513],"heading":[513],"subheading":[1]}]]],["p-23556cb1",[[17,"limebb-browser",{"platform":[16],"context":[16],"items":[16],"layout":[1],"filter":[32]}]]],["p-5095a168",[[1,"limebb-color-palette-picker",{"value":[513],"required":[516],"readonly":[516],"invalid":[516],"disabled":[516],"label":[513],"helperText":[1,"helper-text"]}]]],["p-01ddcb14",[[1,"limebb-color-palette-swatches",{"colors":[16]}]]],["p-2caee700",[[1,"limebb-component-config",{"platform":[16],"context":[16],"value":[16],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"formInfo":[16],"type":[1],"nameField":[1,"name-field"],"configComponent":[32],"configViewType":[32]},null,{"formInfo":[{"watchFormInfo":0}],"configComponent":[{"watchconfigComponent":0}]}]]],["p-5960143c",[[1,"limebb-component-picker",{"platform":[16],"context":[16],"type":[1],"tags":[16],"value":[1],"copyLabel":[1,"copy-label"],"hideCopyButton":[4,"hide-copy-button"],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["p-4e66111a",[[257,"limebb-composer-toolbar",{"platform":[16],"mentions":[516],"textSnippets":[516,"text-snippets"],"internalLinks":[516,"internal-links"],"richText":[516,"rich-text"],"fileInput":[16]}]]],["p-c85e44a9",[[257,"limebb-dashboard-widget",{"heading":[513],"subheading":[513],"supportingText":[513,"supporting-text"],"icon":[513]}]]],["p-f5c44de2",[[1,"limebb-icon-picker",{"value":[1],"required":[4],"readonly":[4],"invalid":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["p-22e4b5e9",[[1,"limebb-info-tile",{"platform":[16],"context":[16],"filterId":[513,"filter-id"],"disabled":[4],"icon":[513],"label":[1],"prefix":[1],"suffix":[1],"propertyName":[1,"property-name"],"aggregateOperator":[1,"aggregate-operator"],"format":[16],"reducedPresence":[516,"reduced-presence"],"reducedPresenceRule":[16],"config":[32],"filters":[32],"value":[32],"loading":[32],"error":[32],"limetypes":[32]},null,{"filterId":[{"watchFilterId":0}],"propertyName":[{"watchPropertyName":0}],"aggregateOperator":[{"watchAggregateOperator":0}]}]]],["p-639032ba",[[1,"limebb-info-tile-date-format",{"value":[16]}]]],["p-37fbd50d",[[1,"limebb-info-tile-decimal-format",{"value":[16]}]]],["p-b9c4df08",[[1,"limebb-info-tile-format",{"platform":[16],"context":[16],"type":[1],"value":[16]}]]],["p-b6a8ad7a",[[1,"limebb-info-tile-relative-date-format",{"value":[16]}]]],["p-382ab76b",[[1,"limebb-info-tile-unit-format",{"value":[16]}]]],["p-5f940ea8",[[1,"limebb-loader",{"platform":[16],"context":[16]}]]],["p-4e7b8559",[[1,"limebb-locale-picker",{"platform":[16],"context":[16],"value":[1],"required":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"readonly":[4],"multipleChoice":[4,"multiple-choice"],"allLanguages":[32]}]]],["p-bb825e68",[[257,"limebb-mention",{"limetype":[1],"objectid":[2],"limeobject":[32]}]]],["p-9ad269dd",[[1,"limebb-mention-group-counter",{"count":[2],"limetype":[16],"helperLabel":[1,"helper-label"]}]]],["p-2091d4c8",[[1,"limebb-object-chip",{"limetype":[1],"objectid":[2],"size":[1],"platform":[16],"data":[32]},null,{"limetype":[{"handlePropChange":0}],"objectid":[{"handlePropChange":0}]}]]],["p-45d89e49",[[257,"limebb-rule-gate",{"platform":[16],"rule":[16],"scope":[16],"shouldRender":[32]},null,{"rule":[{"onRuleChange":0}],"scope":[{"onScopeChange":0}]}]]],["p-90f3e299",[[1,"limebb-trend-indicator",{"platform":[16],"context":[16],"value":[520],"formerValue":[514,"former-value"],"suffix":[513],"label":[513],"invalid":[516],"required":[516],"helperText":[513,"helper-text"],"reducePresence":[516,"reduce-presence"]},null,{"value":[{"valueChanged":0}]}]]],["p-52f39097",[[1,"limebb-value-comparison-editor",{"value":[16]}]]],["p-c84136ae",[[1,"limebb-currency-picker",{"platform":[16],"context":[16],"label":[513],"currencies":[16],"helperText":[513,"helper-text"],"required":[516],"readonly":[516],"invalid":[516],"disabled":[516],"value":[1]}]]],["p-5e4c9115",[[1,"limebb-feed-item-thumbnail-file-info",{"description":[1]}]]],["p-8d41a7f8",[[1,"limebb-feed-timeline-item",{"platform":[16],"context":[16],"item":[16],"ui":[513],"helperText":[1,"helper-text"],"hasError":[516,"has-error"],"isBundled":[516,"is-bundled"],"headingCanExpand":[32],"isHeadingExpanded":[32],"showMore":[32],"isTall":[32]}]]],["p-840b817b",[[1,"limebb-kanban-group",{"platform":[16],"context":[16],"identifier":[1],"heading":[513],"help":[1],"items":[16],"summary":[1],"loading":[516],"totalCount":[514,"total-count"]}]]],["p-cf687fcd",[[17,"limebb-document-item",{"platform":[16],"context":[16],"item":[16],"type":[513],"fileTypes":[16]}]]],["p-4f398108",[[1,"limebb-empty-state",{"heading":[513],"value":[513],"icon":[16]}]]],["p-7597eb85",[[1,"limebb-text-editor-picker",{"items":[16],"open":[516],"isSearching":[4,"is-searching"],"emptyMessage":[1,"empty-message"]},null,{"open":[{"watchOpen":0}]}]]],["p-50f5380d",[[1,"limebb-date-picker",{"platform":[16],"context":[16],"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[1],"type":[513]}]]],["p-61ee03f9",[[1,"limebb-live-docs-info"]]],["p-46cc4edb",[[1,"limebb-notification-item",{"platform":[16],"context":[16],"item":[16]}]]],["p-4fcb97ea",[[1,"limebb-percentage-visualizer",{"platform":[16],"context":[16],"value":[520],"rangeMax":[514,"range-max"],"rangeMin":[514,"range-min"],"multiplier":[514],"label":[513],"invalid":[516],"required":[516],"helperText":[513,"helper-text"],"reducePresence":[516,"reduce-presence"],"displayPercentageColors":[516,"display-percentage-colors"]},null,{"value":[{"valueChanged":0}]}]]],["p-1c67e198",[[1,"limebb-rule-chip-popover",{"platform":[16],"context":[16],"refNode":[16],"isNegated":[4,"is-negated"],"metadata":[16],"readonly":[4],"disabled":[4],"isMutable":[4,"is-mutable"],"focusOnOpen":[4,"focus-on-open"]}]]],["p-f3d3ff7e",[[1,"limebb-lime-query-filter-builder",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}]]],["p-7b119566",[[257,"limebb-kanban-item",{"platform":[16],"context":[16],"item":[16]}]]],["p-db9ed6ed",[[17,"limebb-property-selector",{"platform":[16],"context":[16],"limetype":[1],"value":[1],"label":[1],"required":[4],"helperText":[1,"helper-text"],"limetypes":[32],"isOpen":[32],"navigationPath":[32]}]]],["p-88bdf554",[[1,"limebb-lime-query-order-by-item",{"platform":[16],"context":[16],"limetype":[1],"item":[16]}]]],["p-f382f2fa",[[1,"limebb-lime-query-order-by-editor",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"items":[32]},null,{"value":[{"handleValueChange":0}]}],[0,"limebb-limetype-field",{"platform":[16],"context":[16],"label":[513],"required":[516],"readonly":[516],"disabled":[516],"value":[513],"helperText":[513,"helper-text"],"invalid":[4],"limetypes":[16],"propertyFields":[16],"fieldName":[1,"field-name"],"formInfo":[16]}]]],["p-31580e01",[[1,"limebb-chat-icon-list",{"item":[16]}],[1,"limebb-chat-item",{"platform":[16],"context":[16],"item":[16],"helperText":[1,"helper-text"],"hasError":[516,"has-error"]}],[1,"limebb-typing-indicator"]]],["p-7dedd057",[[1,"limebb-lime-query-response-format-editor",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"items":[32]}],[1,"limebb-lime-query-response-format-item",{"platform":[16],"context":[16],"limetype":[1],"item":[16],"showAliasInput":[32],"showDescriptionInput":[32]}]]],["p-e3d8fd1b",[[2,"limebb-lime-query-filter-expression",{"platform":[16],"context":[16],"label":[1],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}],[1,"limebb-lime-query-filter-comparison",{"platform":[16],"context":[16],"label":[513],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16],"isOpen":[32]}]]],["p-342aae30",[[257,"limebb-summary-popover",{"triggerDelay":[514,"trigger-delay"],"heading":[513],"subheading":[513],"image":[16],"file":[16],"icon":[513],"value":[1],"openDirection":[513,"open-direction"],"popoverMaxWidth":[513,"popover-max-width"],"popoverMaxHeight":[513,"popover-max-height"],"actions":[16],"isPopoverOpen":[32]}],[17,"limebb-navigation-button",{"href":[513],"tooltipLabel":[513,"tooltip-label"],"tooltipHelperLabel":[513,"tooltip-helper-label"],"type":[513]}]]],["p-d7462e93",[[17,"limebb-lime-query-filter-comparison-editor",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}],[17,"limebb-filter-chip",{"label":[1],"value":[1],"conjunction":[1],"condition":[1],"propertyType":[1,"property-type"],"icon":[1],"helperLabel":[1,"helper-label"],"removable":[4],"readonly":[516],"disabled":[4],"invalid":[516],"selected":[516],"identifier":[8],"platform":[16],"maxLength":[2,"max-length"]},[[2,"click","filterClickWhenInactive"]]],[1,"limebb-lime-query-filter-group",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}],[1,"limebb-lime-query-filter-not",{"platform":[16],"context":[16],"label":[1],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}],[1,"limebb-lime-query-value-input",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"propertyPath":[1,"property-path"],"operator":[1],"value":[8],"label":[1],"limetypes":[32],"inputMode":[32]}]]]]'),e))));
@@ -1 +1 @@
1
- import{r as t,h as e,g as i}from"./p-LEJjPpY0.js";import{b as r,n as s,l as o,d as n,L as a,r as l}from"./p-Dtg8KAQt.js";import{a as h}from"./p-Bb18Bgig.js";class u{constructor(t){this.getState=t,this.contextType="info-tile"}getContext(){const{limetype:t,filterId:e,filterName:i,aggregateOperator:r,propertyName:s,value:o,label:n}=this.getState();if(!t||!e)return console.debug("InfoTileContextProvider: No limetype or filterId available"),null;const a={widgetType:"info-tile",limetype:t,filterId:e};return i&&(a.filterName=i),a.aggregateOperator=r,s&&(a.propertyName=s),void 0!==o&&(a.value=o),n&&(a.label=n),{data:a,purpose:"Shows an aggregated value from a filter. Clicking navigates to the explorer with that filter applied."}}}class c{constructor(t,e=[]){this.platform=t,this.filters=e}async load(t,e){let i;return i=this.isObjectIdentifier(e)?await this.loadLimeObjectInfoTile(t,e):await this.loadBasicInfoTile(t),i}async loadBasicInfoTile(t){const e=this.getFilter(t.filter);if(!e)throw new Error(`Filter "${t.filter}" not found`);return(await this.query.execute({limetype:e.limetype,responseFormat:{aggregates:{infotiles:{value:{op:t.operator,key:t.name}}}},filter:e.filter})).aggregates.infotiles[0].value}async loadLimeObjectInfoTile(t,e){await this.objectRepository.loadObject(e.limetype,e.id,{properties:[t]});const i=this.objectRepository.getObject(e.limetype,e.id);return null==i?void 0:i.getValue([t.name,t.key].join("."))}isObjectIdentifier(t){return Boolean((null==t?void 0:t.limetype)&&(null==t?void 0:t.id))}getFilter(t){return this.filters.find((e=>e.id===t))}get query(){return this.platform.get(r.Query)}get objectRepository(){return this.platform.get(r.LimeObjectRepository)}}function f(t,e){return t&&(t[e]||t.en||t.en_us)||""}function d(t,e=[]){const{path:i,query:r}=function(t,e=[]){if(!t)return{path:"#"};const i=["explorer",t.limetype,t.id].join("/"),r=function(t,e){const i=[...e,t].filter((t=>void 0!==t));if(0!==i.length)return 1===i.length?i[0]:{op:s.AND,exp:i}}(t.filter,e);return r?{path:i,query:{filter:r}}:{path:i}}(t,e);return r?`${i}?${Object.entries(r).map((([t,e])=>`${t}=${encodeURIComponent(JSON.stringify(e))}`)).join("&")}`:i}class p{constructor(t){this.locale=t}format(t){let e=String(t);return"number"==typeof t?e=new Intl.NumberFormat(this.locale).format(t):new Date(t).getTime()&&(e=new Intl.DateTimeFormat(this.locale).format(new Date(t))),{value:e}}}class v{constructor(t){this.locale=t}format(t,e){const i=new Date(t);return{prefix:this.formatAffix("prefix",i,e),value:this.formatValue(i,e),suffix:this.formatAffix("suffix",i,e)}}formatValue(t,e){const i=Object.assign({},e.options);if(e.prefix)for(const t of e.prefix)delete i[t];if(e.suffix)for(const t of e.suffix)delete i[t];return new Intl.DateTimeFormat(this.locale,i).format(t)}formatAffix(t,e,i){const r=Object.assign({},i.options);for(const e of Object.keys(r))"hour12"!==e&&((i[t]||[]).includes(e)||delete r[e]);if(0!==Object.values(r).filter(Boolean).length)return new Intl.DateTimeFormat(this.locale,r).format(e)}}class g{constructor(t){this.locale=t}format(t,e){var i,r;const s=new Intl.NumberFormat(this.locale,e.options),o=s.formatToParts(t);let n="",a="",l="";for(const t of o)(null===(i=e.prefix)||void 0===i?void 0:i.includes(t.type))?n+=t.value:(null===(r=e.suffix)||void 0===r?void 0:r.includes(t.type))?l+=t.value:a+=t.value;return a||(a=s.format(t),n="",l=""),{prefix:n,value:a,suffix:l}}}class m{constructor(t){this.locale=t}format(t,e){const i=new Intl.RelativeTimeFormat(this.locale,e.options),{value:r,unit:s}=this.getRelativeTime(t),o=i.formatToParts(r,s);let n="",a="",l="";for(const t of o)"literal"!==t.type||a?"literal"===t.type&&a?l+=t.value:a+=t.value:n+=t.value;return a||(a=n||l,n="",l=""),{prefix:n,value:a,suffix:l}}getRelativeTime(t){const e=new Date(t),i=new Date,r=e.getTime()-i.getTime(),s=[{unit:"year",value:31536e6},{unit:"month",value:2592e6},{unit:"week",value:6048e5},{unit:"day",value:864e5},{unit:"hour",value:36e5},{unit:"minute",value:6e4},{unit:"second",value:1e3}];for(const t of s){const e=r/t.value;if(Math.abs(e)>=1)return{value:Math.round(e),unit:t.unit}}return{value:0,unit:"second"}}}class b{constructor(t){this.locale=t}createFormatter(t,e){return"number"===(null==t?void 0:t.type)&&"number"==typeof e?new g(this.locale):"date"===(null==t?void 0:t.type)&&"string"==typeof e?new v(this.locale):"relative-date"===(null==t?void 0:t.type)&&"string"==typeof e?new m(this.locale):new p(this.locale)}}var y=function(t,e,i,r){var s,o=arguments.length,n=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(n=(o<3?s(n):o>3?s(e,i,n):s(e,i))||n);return o>3&&n&&Object.defineProperty(e,i,n),n};const w=class{constructor(e){t(this,e),this.aggregateOperator=l.Count,this.loading=!1,this.error=!1}get hostElement(){return this.host}connectedCallback(){this.registerContextProvider()}disconnectedCallback(){var t;null===(t=this.unregisterContextProvider)||void 0===t||t.call(this)}componentWillLoad(){this.loadInfoTileValue()}watchFilterId(){this.loadInfoTileValue()}watchPropertyName(){this.loadInfoTileValue()}watchAggregateOperator(){this.loadInfoTileValue()}async loadInfoTileValue(){if(this.loading=!0,this.error=!1,this.getFilter()){try{const t={key:this.getKey(),name:this.propertyName,operator:this.aggregateOperator,filter:this.filterId};this.value=await this.loader.load(t,this.context)}catch(t){console.error(t),this.error=!0}this.loading=!1}else this.error=!0}getKey(){return Math.random().toString(36).slice(2)}render(){var t,i;const r=this.getFilter(),s=this.getFormattedValue(),o={disabled:this.disabled,icon:this.icon,prefix:(null===(t=null==s?void 0:s.prefix)||void 0===t?void 0:t.trim())||this.prefix,suffix:(null===(i=null==s?void 0:s.suffix)||void 0===i?void 0:i.trim())||this.suffix,reducedPresence:this.shouldReducePresence()},n=Object.assign(Object.assign({},o),{icon:"error",prefix:"ERROR",loading:!0,label:this.getLabel(r)}),a=Object.assign(Object.assign({},o),{label:this.getLabel(r),link:this.getLink(r),loading:this.loading,value:null==s?void 0:s.value.trim()});return e("limel-info-tile",Object.assign({key:"82a39b67ae1c9ce8c314de62102366c566f98b0a",class:{error:!r||this.error}},!r||this.error?n:a))}shouldReducePresence(){if(this.reducedPresence)return!0;if(!this.reducedPresenceRule||this.loading)return!1;try{return this.ruleRegistry.compile(this.reducedPresenceRule)(this.ruleRegistry.scope({host:this.hostElement,with:{scalarValue:this.value}}))}catch(t){return!1}}getFormattedValue(){if(!this.value&&0!==this.value)return{value:""};try{return this.getFormatter(this.value).format(this.value,this.format)}catch(t){return new p(this.language).format(this.value)}}getLabel(t){return t?"string"==typeof this.label?this.translator.get(this.label):f(this.label&&"object"==typeof this.label?this.label:t.name,this.language):"No filter set is selected"}getLink(t){const e=h({targetLimetype:t?this.limetypes[t.limetype]:void 0,currentLimetype:this.context.limetype?this.limetypes[this.context.limetype]:void 0,contextLimetypeName:this.context.limetype,contextId:this.context.id,propertyName:this.propertyName});return{href:d(t,e&&this.context.id?[{key:e,op:s.EQUALS,exp:this.context.id}]:[])}}getFilter(){return function(t,e){if(t&&e)return t.find((t=>t.id===e))}(this.filters,this.filterId)}getFormatter(t){return new b(this.language).createFormatter(this.format,t)}get translator(){return this.platform.get(r.Translate)}get ruleRegistry(){return this.platform.get(r.RuleRegistry)}get language(){return this.platform.get(r.Application).getLanguage()}get loader(){return new c(this.platform,this.filters)}registerContextProvider(){const t=this.platform.get(r.AIContextRegistry);if(!(null==t?void 0:t.register))return;const e=new u((()=>{const t=this.getFilter();return{limetype:null==t?void 0:t.limetype,filterId:this.filterId,filterName:t?f(t.name,this.language):void 0,aggregateOperator:this.aggregateOperator,propertyName:this.propertyName,value:this.value,label:this.getLabel(t)}}));this.unregisterContextProvider=t.register(e,this.hostElement)}get host(){return i(this)}static get watchers(){return{filterId:[{watchFilterId:0}],propertyName:[{watchPropertyName:0}],aggregateOperator:[{watchAggregateOperator:0}]}}};y([o({})],w.prototype,"config",void 0),y([n()],w.prototype,"filters",void 0),y([a()],w.prototype,"limetypes",void 0),w.style=":host(limebb-info-tile){display:block;overflow:visible !important;background-color:transparent !important}limel-info-tile.error{--info-tile-icon-color:rgb(var(--color-red-dark));border:1px dashed rgb(var(--contrast-500));border-radius:var(--info-tile-border-radius, 1rem)}";export{w as limebb_info_tile}
1
+ import{r as t,h as e,g as i}from"./p-LEJjPpY0.js";import{b as r,n as s,l as o,d as n,L as a,r as l}from"./p-Dtg8KAQt.js";import{a as h}from"./p-Bb18Bgig.js";class u{constructor(t){this.getState=t,this.contextType="info-tile"}getContext(){const{limetype:t,filterId:e,filterName:i,aggregateOperator:r,propertyName:s,value:o,label:n}=this.getState();if(!t||!e)return console.debug("InfoTileContextProvider: No limetype or filterId available"),null;const a={widgetType:"info-tile",limetype:t,filterId:e};return i&&(a.filterName=i),a.aggregateOperator=r,s&&(a.propertyName=s),void 0!==o&&(a.value=o),n&&(a.label=n),{data:a,purpose:"Shows an aggregated value from a filter. Clicking navigates to the explorer with that filter applied."}}}class c{constructor(t,e=[]){this.platform=t,this.filters=e}async load(t,e){let i;return i=this.isObjectIdentifier(e)?await this.loadLimeObjectInfoTile(t,e):await this.loadBasicInfoTile(t),i}async loadBasicInfoTile(t){const e=this.getFilter(t.filter);if(!e)throw new Error(`Filter "${t.filter}" not found`);return(await this.query.execute({limetype:e.limetype,responseFormat:{aggregates:{infotiles:{value:{op:t.operator,key:t.name}}}},filter:e.filter})).aggregates.infotiles[0].value}async loadLimeObjectInfoTile(t,e){await this.objectRepository.loadObject(e.limetype,e.id,{properties:[t]});const i=this.objectRepository.getObject(e.limetype,e.id);return null==i?void 0:i.getValue([t.name,t.key].join("."))}isObjectIdentifier(t){return Boolean((null==t?void 0:t.limetype)&&(null==t?void 0:t.id))}getFilter(t){return this.filters.find((e=>e.id===t))}get query(){return this.platform.get(r.Query)}get objectRepository(){return this.platform.get(r.LimeObjectRepository)}}function f(t,e){return t&&(t[e]||t.en||t.en_us)||""}function d(t,e=[]){const{path:i,query:r}=function(t,e=[]){if(!t)return{path:"#"};const i=["explorer",t.limetype,t.id].join("/"),r=function(t,e){const i=[...e,t].filter((t=>void 0!==t));if(0!==i.length)return 1===i.length?i[0]:{op:s.AND,exp:i}}(t.filter,e);return r?{path:i,query:{filter:r}}:{path:i}}(t,e);return r?`${i}?${Object.entries(r).map((([t,e])=>`${t}=${encodeURIComponent(JSON.stringify(e))}`)).join("&")}`:i}class p{constructor(t){this.locale=t}format(t){let e=String(t);return"number"==typeof t?e=new Intl.NumberFormat(this.locale).format(t):new Date(t).getTime()&&(e=new Intl.DateTimeFormat(this.locale).format(new Date(t))),{value:e}}}class v{constructor(t){this.locale=t}format(t,e){const i=new Date(t);return{prefix:this.formatAffix("prefix",i,e),value:this.formatValue(i,e),suffix:this.formatAffix("suffix",i,e)}}formatValue(t,e){const i=Object.assign({},e.options);if(e.prefix)for(const t of e.prefix)delete i[t];if(e.suffix)for(const t of e.suffix)delete i[t];return new Intl.DateTimeFormat(this.locale,i).format(t)}formatAffix(t,e,i){const r=Object.assign({},i.options);for(const e of Object.keys(r))"hour12"!==e&&((i[t]||[]).includes(e)||delete r[e]);if(0!==Object.values(r).filter(Boolean).length)return new Intl.DateTimeFormat(this.locale,r).format(e)}}class g{constructor(t){this.locale=t}format(t,e){var i,r;const s=new Intl.NumberFormat(this.locale,e.options),o=s.formatToParts(t);let n="",a="",l="";for(const t of o)(null===(i=e.prefix)||void 0===i?void 0:i.includes(t.type))?n+=t.value:(null===(r=e.suffix)||void 0===r?void 0:r.includes(t.type))?l+=t.value:a+=t.value;return a||(a=s.format(t),n="",l=""),{prefix:n,value:a,suffix:l}}}class m{constructor(t){this.locale=t}format(t,e){const i=new Intl.RelativeTimeFormat(this.locale,e.options),{value:r,unit:s}=this.getRelativeTime(t),o=i.formatToParts(r,s);let n="",a="",l="";for(const t of o)"literal"!==t.type||a?"literal"===t.type&&a?l+=t.value:a+=t.value:n+=t.value;return a||(a=n||l,n="",l=""),{prefix:n,value:a,suffix:l}}getRelativeTime(t){const e=new Date(t),i=new Date,r=e.getTime()-i.getTime(),s=[{unit:"year",value:31536e6},{unit:"month",value:2592e6},{unit:"week",value:6048e5},{unit:"day",value:864e5},{unit:"hour",value:36e5},{unit:"minute",value:6e4},{unit:"second",value:1e3}];for(const t of s){const e=r/t.value;if(Math.abs(e)>=1)return{value:Math.round(e),unit:t.unit}}return{value:0,unit:"second"}}}class b{constructor(t){this.locale=t}createFormatter(t,e){return"number"===(null==t?void 0:t.type)&&"number"==typeof e?new g(this.locale):"date"===(null==t?void 0:t.type)&&"string"==typeof e?new v(this.locale):"relative-date"===(null==t?void 0:t.type)&&"string"==typeof e?new m(this.locale):new p(this.locale)}}var y=function(t,e,i,r){var s,o=arguments.length,n=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(n=(o<3?s(n):o>3?s(e,i,n):s(e,i))||n);return o>3&&n&&Object.defineProperty(e,i,n),n};const w=class{constructor(e){t(this,e),this.aggregateOperator=l.Count,this.loading=!1,this.error=!1}get hostElement(){return this.host}connectedCallback(){this.registerContextProvider()}disconnectedCallback(){var t;null===(t=this.unregisterContextProvider)||void 0===t||t.call(this)}componentWillLoad(){this.loadInfoTileValue()}watchFilterId(){this.loadInfoTileValue()}watchPropertyName(){this.loadInfoTileValue()}watchAggregateOperator(){this.loadInfoTileValue()}async loadInfoTileValue(){if(this.loading=!0,this.error=!1,this.getFilter()){try{const t={key:this.getKey(),name:this.propertyName,operator:this.aggregateOperator,filter:this.filterId};this.value=await this.loader.load(t,this.context)}catch(t){console.error(t),this.error=!0}this.loading=!1}else this.error=!0}getKey(){return Math.random().toString(36).slice(2)}render(){var t,i;const r=this.getFilter(),s=this.getFormattedValue(),o={disabled:this.disabled,icon:this.icon,prefix:(null===(t=null==s?void 0:s.prefix)||void 0===t?void 0:t.trim())||this.prefix,suffix:(null===(i=null==s?void 0:s.suffix)||void 0===i?void 0:i.trim())||this.suffix,reducedPresence:this.shouldReducePresence()},n=Object.assign(Object.assign({},o),{icon:"error",prefix:"ERROR",loading:!0,label:this.getLabel(r)}),a=Object.assign(Object.assign({},o),{label:this.getLabel(r),link:this.getLink(r),loading:this.loading,value:null==s?void 0:s.value.trim()});return e("limel-info-tile",Object.assign({key:"82a39b67ae1c9ce8c314de62102366c566f98b0a",class:{error:!r||this.error}},!r||this.error?n:a))}shouldReducePresence(){if(this.reducedPresence)return!0;if(!this.reducedPresenceRule||this.loading)return!1;try{return this.ruleRegistry.compile(this.reducedPresenceRule).evaluate(this.ruleRegistry.scope({host:this.hostElement,with:{scalarValue:this.value}}))}catch(t){return!1}}getFormattedValue(){if(!this.value&&0!==this.value)return{value:""};try{return this.getFormatter(this.value).format(this.value,this.format)}catch(t){return new p(this.language).format(this.value)}}getLabel(t){return t?"string"==typeof this.label?this.translator.get(this.label):f(this.label&&"object"==typeof this.label?this.label:t.name,this.language):"No filter set is selected"}getLink(t){const e=h({targetLimetype:t?this.limetypes[t.limetype]:void 0,currentLimetype:this.context.limetype?this.limetypes[this.context.limetype]:void 0,contextLimetypeName:this.context.limetype,contextId:this.context.id,propertyName:this.propertyName});return{href:d(t,e&&this.context.id?[{key:e,op:s.EQUALS,exp:this.context.id}]:[])}}getFilter(){return function(t,e){if(t&&e)return t.find((t=>t.id===e))}(this.filters,this.filterId)}getFormatter(t){return new b(this.language).createFormatter(this.format,t)}get translator(){return this.platform.get(r.Translate)}get ruleRegistry(){return this.platform.get(r.RuleRegistry)}get language(){return this.platform.get(r.Application).getLanguage()}get loader(){return new c(this.platform,this.filters)}registerContextProvider(){const t=this.platform.get(r.AIContextRegistry);if(!(null==t?void 0:t.register))return;const e=new u((()=>{const t=this.getFilter();return{limetype:null==t?void 0:t.limetype,filterId:this.filterId,filterName:t?f(t.name,this.language):void 0,aggregateOperator:this.aggregateOperator,propertyName:this.propertyName,value:this.value,label:this.getLabel(t)}}));this.unregisterContextProvider=t.register(e,this.hostElement)}get host(){return i(this)}static get watchers(){return{filterId:[{watchFilterId:0}],propertyName:[{watchPropertyName:0}],aggregateOperator:[{watchAggregateOperator:0}]}}};y([o({})],w.prototype,"config",void 0),y([n()],w.prototype,"filters",void 0),y([a()],w.prototype,"limetypes",void 0),w.style=":host(limebb-info-tile){display:block;overflow:visible !important;background-color:transparent !important}limel-info-tile.error{--info-tile-icon-color:rgb(var(--color-red-dark));border:1px dashed rgb(var(--contrast-500));border-radius:var(--info-tile-border-radius, 1rem)}";export{w as limebb_info_tile}
@@ -0,0 +1 @@
1
+ import{r as t,h as e,H as s,g as i}from"./p-LEJjPpY0.js";import{b as h}from"./p-Dtg8KAQt.js";const o=class{constructor(e){t(this,e),this.shouldRender=!1}componentWillLoad(){this.evaluate()}disconnectedCallback(){var t;null===(t=this.stopSubscription)||void 0===t||t.call(this)}onRuleChange(){this.evaluate()}onScopeChange(){this.evaluate()}render(){return e(s,{key:"fd7edf7439ea87b25e48c6f39a92f957b08ed49a",hidden:!this.shouldRender},e("slot",{key:"b7996f2833b46fa5ed41e37047380b0f7ce46d17"}))}get ruleRegistry(){return this.platform.get(h.RuleRegistry)}evaluate(){var t;if(null===(t=this.stopSubscription)||void 0===t||t.call(this),this.stopSubscription=void 0,this.rule)try{const t=this.ruleRegistry.compile(this.rule);if(this.scope)return void(this.shouldRender=t.evaluate(this.scope));this.stopSubscription=this.ruleRegistry.subscribe(t,{host:this.host},(t=>{this.shouldRender=t}))}catch(t){console.warn("rule-gate failed to compile rule; hiding slot",{rule:this.rule,error:t}),this.shouldRender=!1}else this.shouldRender=!0}get host(){return i(this)}static get watchers(){return{rule:[{onRuleChange:0}],scope:[{onScopeChange:0}]}}};o.style=":host{display:block}:host([hidden]){display:none}";export{o as limebb_rule_gate}
@@ -1,10 +1,13 @@
1
- import { LimeWebComponentPlatform, Rule, ContextScope } from '@limetech/lime-web-components';
1
+ import { ContextScope, LimeWebComponentPlatform, Rule } from '@limetech/lime-web-components';
2
2
  /**
3
3
  * Renders its slot only when the configured rule evaluates true.
4
4
  *
5
5
  * Pass a {@link Rule} and the gate compiles it on load and on prop
6
6
  * changes, then evaluates it against a scope obtained from the
7
- * {@link RuleRegistry} platform service.
7
+ * {@link RuleRegistry} platform service. When the gate builds that
8
+ * scope itself it subscribes through the rule registry and re-evaluates
9
+ * whenever a context key the rule reads changes, so a rule like
10
+ * `limeobject-is-saved` reflects edits and discards without a reload.
8
11
  *
9
12
  * @exampleComponent limebb-example-rule-gate
10
13
  *
@@ -27,11 +30,13 @@ export declare class RuleGate {
27
30
  */
28
31
  scope?: ContextScope;
29
32
  private shouldRender;
33
+ private stopSubscription?;
30
34
  componentWillLoad(): void;
35
+ disconnectedCallback(): void;
31
36
  protected onRuleChange(): void;
32
37
  protected onScopeChange(): void;
33
38
  render(): any;
34
39
  private get ruleRegistry();
35
- private compileAndEvaluate;
40
+ private evaluate;
36
41
  }
37
42
  //# sourceMappingURL=rule-gate.d.ts.map
@@ -2455,7 +2455,10 @@ export namespace Components {
2455
2455
  * Renders its slot only when the configured rule evaluates true.
2456
2456
  * Pass a {@link Rule} and the gate compiles it on load and on prop
2457
2457
  * changes, then evaluates it against a scope obtained from the
2458
- * {@link RuleRegistry} platform service.
2458
+ * {@link RuleRegistry} platform service. When the gate builds that
2459
+ * scope itself it subscribes through the rule registry and re-evaluates
2460
+ * whenever a context key the rule reads changes, so a rule like
2461
+ * `limeobject-is-saved` reflects edits and discards without a reload.
2459
2462
  * @exampleComponent limebb-example-rule-gate
2460
2463
  * @alpha
2461
2464
  * @private
@@ -4655,7 +4658,10 @@ declare global {
4655
4658
  * Renders its slot only when the configured rule evaluates true.
4656
4659
  * Pass a {@link Rule} and the gate compiles it on load and on prop
4657
4660
  * changes, then evaluates it against a scope obtained from the
4658
- * {@link RuleRegistry} platform service.
4661
+ * {@link RuleRegistry} platform service. When the gate builds that
4662
+ * scope itself it subscribes through the rule registry and re-evaluates
4663
+ * whenever a context key the rule reads changes, so a rule like
4664
+ * `limeobject-is-saved` reflects edits and discards without a reload.
4659
4665
  * @exampleComponent limebb-example-rule-gate
4660
4666
  * @alpha
4661
4667
  * @private
@@ -7532,7 +7538,10 @@ declare namespace LocalJSX {
7532
7538
  * Renders its slot only when the configured rule evaluates true.
7533
7539
  * Pass a {@link Rule} and the gate compiles it on load and on prop
7534
7540
  * changes, then evaluates it against a scope obtained from the
7535
- * {@link RuleRegistry} platform service.
7541
+ * {@link RuleRegistry} platform service. When the gate builds that
7542
+ * scope itself it subscribes through the rule registry and re-evaluates
7543
+ * whenever a context key the rule reads changes, so a rule like
7544
+ * `limeobject-is-saved` reflects edits and discards without a reload.
7536
7545
  * @exampleComponent limebb-example-rule-gate
7537
7546
  * @alpha
7538
7547
  * @private
@@ -9156,7 +9165,10 @@ declare module "@stencil/core" {
9156
9165
  * Renders its slot only when the configured rule evaluates true.
9157
9166
  * Pass a {@link Rule} and the gate compiles it on load and on prop
9158
9167
  * changes, then evaluates it against a scope obtained from the
9159
- * {@link RuleRegistry} platform service.
9168
+ * {@link RuleRegistry} platform service. When the gate builds that
9169
+ * scope itself it subscribes through the rule registry and re-evaluates
9170
+ * whenever a context key the rule reads changes, so a rule like
9171
+ * `limeobject-is-saved` reflects edits and discards without a reload.
9160
9172
  * @exampleComponent limebb-example-rule-gate
9161
9173
  * @alpha
9162
9174
  * @private
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limetech/lime-crm-building-blocks",
3
- "version": "1.136.0",
3
+ "version": "1.137.0",
4
4
  "description": "A home for shared components meant for use with Lime CRM",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -36,9 +36,9 @@
36
36
  "devDependencies": {
37
37
  "@limetech/eslint-config": "^4.0.1",
38
38
  "@limetech/lime-elements": "^39.34.0",
39
- "@limetech/lime-web-components": "^6.25.0",
39
+ "@limetech/lime-web-components": "^6.26.0",
40
40
  "@lundalogik/lime-icons8": "^2.41.0",
41
- "@lundalogik/limeclient.js": "^1.107.0",
41
+ "@lundalogik/limeclient.js": "^1.108.0",
42
42
  "@stencil/core": "^4.43.4",
43
43
  "@stencil/sass": "^3.1.9",
44
44
  "@types/jest": "^29.5.14",
@@ -1 +0,0 @@
1
- import{r as t,h as e,H as s,g as i}from"./p-LEJjPpY0.js";import{b as o}from"./p-Dtg8KAQt.js";const h=class{constructor(e){t(this,e),this.shouldRender=!1}componentWillLoad(){this.compileAndEvaluate()}onRuleChange(){this.compileAndEvaluate()}onScopeChange(){this.compileAndEvaluate()}render(){return e(s,{key:"dcf210fbec22936a14f12f2571970e5ab65e9cfb",hidden:!this.shouldRender},e("slot",{key:"e7bfc24c5a0616ff4e3560cb7da3b485d820b466"}))}get ruleRegistry(){return this.platform.get(o.RuleRegistry)}compileAndEvaluate(){var t;if(this.rule)try{const e=this.ruleRegistry.compile(this.rule),s=null!==(t=this.scope)&&void 0!==t?t:this.ruleRegistry.scope({host:this.host});this.shouldRender=e(s)}catch(t){console.warn("rule-gate failed to compile rule; hiding slot",{rule:this.rule,error:t}),this.shouldRender=!1}else this.shouldRender=!0}get host(){return i(this)}static get watchers(){return{rule:[{onRuleChange:0}],scope:[{onScopeChange:0}]}}};h.style=":host{display:block}:host([hidden]){display:none}";export{h as limebb_rule_gate}