@limetech/lime-crm-building-blocks 1.99.0 → 1.100.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 +7 -0
- package/dist/cjs/lime-crm-building-blocks.cjs.js +1 -1
- package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +7 -38
- package/dist/cjs/{limebb-limetype-field_2.cjs.entry.js → limebb-lime-query-filter-builder_3.cjs.entry.js} +71 -0
- package/dist/cjs/{limebb-lime-query-filter-group_4.cjs.entry.js → limebb-lime-query-filter-comparison_5.cjs.entry.js} +102 -0
- package/dist/cjs/limebb-lime-query-filter-expression.cjs.entry.js +45 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-builder.css +5 -0
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-builder.js +225 -0
- package/dist/collection/components/lime-query-builder/lime-query-builder.js +9 -39
- package/dist/components/lime-query-filter-builder.js +129 -0
- package/dist/components/limebb-lime-query-builder.js +15 -40
- package/dist/components/limebb-lime-query-filter-builder.d.ts +11 -0
- package/dist/components/limebb-lime-query-filter-builder.js +6 -0
- package/dist/esm/lime-crm-building-blocks.js +1 -1
- package/dist/esm/limebb-lime-query-builder.entry.js +8 -39
- package/dist/esm/{limebb-limetype-field_2.entry.js → limebb-lime-query-filter-builder_3.entry.js} +72 -2
- package/dist/esm/{limebb-lime-query-filter-group_4.entry.js → limebb-lime-query-filter-comparison_5.entry.js} +102 -1
- package/dist/esm/limebb-lime-query-filter-expression.entry.js +41 -0
- package/dist/esm/loader.js +1 -1
- package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
- package/dist/lime-crm-building-blocks/p-24aeb928.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-422f6d51.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-6d119dab.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-b198194a.entry.js +1 -0
- package/dist/types/components/lime-query-builder/expressions/lime-query-filter-builder.d.ts +50 -0
- package/dist/types/components/lime-query-builder/lime-query-builder.d.ts +1 -6
- package/dist/types/components.d.ts +116 -0
- package/package.json +1 -1
- package/dist/cjs/limebb-lime-query-filter-comparison_2.cjs.entry.js +0 -147
- package/dist/esm/limebb-lime-query-filter-comparison_2.entry.js +0 -142
- package/dist/lime-crm-building-blocks/p-03accd53.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-4715210d.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-5f7644b5.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-aa646df7.entry.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,c as i,h as s}from"./p-1556b545.js";import{Z as t}from"./p-4838284a.js";const r=class{constructor(s){e(this,s),this.expressionChange=i(this,"expressionChange",7),this.handleExpressionChange=e=>{e.stopPropagation(),this.expressionChange.emit(e.detail)}}render(){if(!this.expression)return;const e={platform:this.platform,context:this.context,label:this.label,limetype:this.limetype,activeLimetype:this.activeLimetype};return"key"in this.expression?s("limebb-lime-query-filter-comparison",Object.assign({},e,{expression:this.expression,onExpressionChange:this.handleExpressionChange})):this.expression.op===t.AND||this.expression.op===t.OR?s("limebb-lime-query-filter-group",Object.assign({},e,{expression:this.expression,onExpressionChange:this.handleExpressionChange})):this.expression.op===t.NOT?s("limebb-lime-query-filter-not",Object.assign({},e,{expression:this.expression,onExpressionChange:this.handleExpressionChange})):void 0}};r.style='@charset "UTF-8";.expression{display:flex;flex-direction:column;margin-bottom:1rem;gap:1rem}';export{r as limebb_lime_query_filter_expression}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as e,h as i}from"./p-1556b545.js";import{Z as s,c as o}from"./p-4838284a.js";import{b as r}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 c}from"./p-b31772c8.js";import"./p-35897ec3.js";import"./p-fe2b91d9.js";import"./p-5322fd19.js";function p(t){return"string"==typeof t||!a(t)&&h(t)&&"[object String]"==c(t)}const d=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}))}};d.style=".expression-with-promotion{display:flex;flex-direction:column;gap:1rem}";const m=["string","text","phone","integer","decimal","percent","time","date","year","quarter","month","yesno","link","user","xml","option","set","file","system"],u=m.filter((t=>"system"!==t));u.push("belongsto","hasone","hasmany","hasandbelongstomany");const f=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(o.Application).getLanguage();this.collator=new Intl.Collator(t,{numeric:!0,sensitivity:"base"})}componentShouldUpdate(t,e,i){var s,o,r,n;return"formInfo"!==i||(r=null===(s=null==t?void 0:t.schema)||void 0===s?void 0:s.oneOf,n=null===(o=null==e?void 0:e.schema)||void 0===o?void 0:o.oneOf,!l(r,n))}render(){var t;const e=this.getLimeTypes().map(b);e.sort(((t,e)=>this.collator.compare(t.text,e.text)));let s=e.find((t=>t.value===this.value)),o=this.invalid;return this.value&&!s&&(o=!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:"cf27b83c4751838e85436af443a275b3d7c9dfee",label:this.label,options:e,value:s,required:this.required,helperText:this.helperText,invalid:o,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(p)),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===m&&(e.allowedPropertyTypes=u)}get limeTypeRepository(){return this.platform.get(o.LimeTypeRepository)}},b=t=>({text:t.localname.singular,value:t.name,icon:r(t)});function y(t,e,i){if(null===i)return void t.push({path:e});const s=i,o="_alias"in s,r="#description"in s,n=Object.keys(s).filter((t=>"_alias"!==t&&"#description"!==t));if(0!==n.length)if(o||r){const i={};for(const t of n)i[t]=s[t];t.push(...v(i,e))}else t.push(...v(i,e));else{const i=s._alias,o=s["#description"];t.push(i||o?{path:e,alias:i,description:o}:{path:e})}}function v(t,e=""){if(!t)return[];const i=[];for(const[s,o]of Object.entries(t))"object"==typeof o&&y(i,e?`${e}.${s}`:s,o);return i}function g(t,e,i){const s=t[e];if(s&&"object"==typeof s&&!("_alias"in s)&&!("#description"in s))return;const o={};i.alias&&""!==i.alias.trim()&&(o._alias=i.alias),i.description&&""!==i.description.trim()&&(o["#description"]=i.description),t[e]=Object.keys(o).length>0?o:null}function x(t,e){const i=t[e];if(!i)return t[e]={},t[e];if("object"==typeof i){const t=i;return Object.keys(t).filter((t=>"_alias"!==t&&"#description"!==t)),t}return t[e]={},t[e]}const j=class{constructor(i){t(this,i),this.change=e(this,"change",7),this.label="Select Properties to Return",this.items=[{path:"_id"}],this.handleItemChange=t=>e=>{e.stopPropagation();const i=[...this.items];null===e.detail?i.splice(t,1):i[t]=e.detail,0===i.length&&i.push({path:"_id"}),this.items=i,this.emitChange()},this.handleAddProperty=()=>{this.items=[...this.items,{path:""}],this.emitChange()}}componentWillLoad(){var t;if(null===(t=this.value)||void 0===t?void 0:t.object){const t=v(this.value.object);t.length>0&&(this.items=t)}}componentWillUpdate(){var t;if(null===(t=this.value)||void 0===t?void 0:t.object){const t=v(this.value.object);(t.length!==this.items.length||!t.every(((t,e)=>{const i=this.items[e];return i&&t.path===i.path&&t.alias===i.alias&&t.description===i.description})))&&(this.items=t.length>0?t:[{path:"_id"}])}}render(){return this.limetype?i("div",{class:"response-format-editor"},i("div",{class:"header"},i("h4",null,this.label)),i("div",{class:"property-list"},this.items.map(((t,e)=>this.renderItem(t,e)))),i("div",{class:"actions"},i("limel-button",{label:"Add Property",icon:"plus_math",onClick:this.handleAddProperty})),i("div",{class:"summary"},i("span",{class:"count"},this.items.length," ",1===this.items.length?"property":"properties"," ","selected"))):i("div",{class:"empty-state"},i("p",null,"Select a limetype to choose properties"))}renderItem(t,e){return i("limebb-response-format-item",{key:`${t.path}-${e}`,class:"property-item",platform:this.platform,context:this.context,limetype:this.limetype,item:t,onItemChange:this.handleItemChange(e)})}emitChange(){const t=function(t){const e={};for(const i of t){const t=i.path.split(".");let s=e;for(let e=0;e<t.length;e++){const o=t[e];e===t.length-1?g(s,o,i):s=x(s,o)}}return e}(this.items);this.change.emit({object:t})}};j.style=":host(limebb-response-format-editor){display:block;width:100%}.response-format-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))}.property-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}.property-item{padding:0.5rem;border-radius:0.25rem;transition:background-color 0.2s}.property-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}";export{d as limebb_lime_query_filter_builder,f as limebb_limetype_field,j as limebb_response_format_editor}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,c as t,h as i}from"./p-1556b545.js";import{T as r}from"./p-4838284a.js";import{g as o,a as n}from"./p-e0ab1554.js";const s=[{value:"=",label:"Equals",icon:"equals"},{value:"!=",label:"Not Equals",icon:"not-equal"},{value:">",label:"Greater Than",icon:"greater-than",applicableTypes:["integer","decimal","date","time"]},{value:">=",label:"Greater or Equal",icon:"greater-or-equal",applicableTypes:["integer","decimal","date","time"]},{value:"<",label:"Less Than",icon:"less-than",applicableTypes:["integer","decimal","date","time"]},{value:"<=",label:"Less or Equal",icon:"less-or-equal",applicableTypes:["integer","decimal","date","time"]},{value:"IN",label:"In List",icon:"list"},{value:"?",label:"Contains",icon:"-lime-filter-contain",applicableTypes:["string","text"]},{value:"=?",label:"Begins With",icon:"-lime-filter-begin",applicableTypes:["string","text"]},{value:"=$",label:"Ends With",icon:"-lime-filter-end",applicableTypes:["string","text"]}];function l(e){return e?"key"in e?function(e){if(!("op"in e)||!("exp"in e))throw new Error("Invalid filter: comparison must have key, op, and exp properties");if(!s.map((e=>e.value)).includes(e.op))throw new Error(`Unsupported filter operator: ${e.op}`);const t=new Set(["key","op","exp","type"]),i=Object.keys(e).filter((e=>!t.has(e)));if(i.length>0)throw new Error(`Unexpected properties in filter comparison: ${i.join(", ")}`);return{filter_type:"comparison",property:e.key,operator:e.op,value:e.exp}}(e):function(e){if(!("op"in e))throw new Error("Invalid filter: filter group must have op property");if(!("exp"in e))throw new Error("Invalid filter: filter group must have exp property");const t=new Set(["op","exp"]),i=Object.keys(e).filter((e=>!t.has(e)));if(i.length>0)throw new Error(`Unexpected properties in filter group: ${i.join(", ")}`);if("!"===e.op){if(Array.isArray(e.exp))throw new TypeError("Invalid NOT filter: exp should be a single expression, not an array");return{filter_type:"NOT",expression:l(e.exp)}}if("AND"===e.op){if(!Array.isArray(e.exp))throw new TypeError("Invalid AND filter: exp must be an array");return{filter_type:"AND",expressions:e.exp.map(l)}}if("OR"===e.op){if(!Array.isArray(e.exp))throw new TypeError("Invalid OR filter: exp must be an array");return{filter_type:"OR",expressions:e.exp.map(l)}}throw new Error(`Unsupported filter operator: ${e.op}`)}(e):{filter_type:"AND",expressions:[]}}const a=new Set(["$yesterday","$now","$today","$tomorrow","$this_week","$this_month","$this_quarter","$this_year"]),d=/^\$(previous|next)_(day|week|month|quarter|year)\(\d+\)$/,c=/^\$me(\.\w+)*$/;function u(e,t,i=!0){const r=Object.keys(e),o=[];if(i){const e=r.filter((e=>e.startsWith("#")&&"#description"!==e));e.length>0&&o.push(`Property '${t}' contains # properties not supported in GUI: ${e.join(", ")}`)}return{keys:r.filter((e=>"_alias"!==e&&!e.startsWith("#"))),guiLimitations:o}}function p(e,t,i,r,o,n=!0){if(""===e){if(n&&null!==t)throw new Error("Empty property name must have null value");return[]}const s=i[e];if(!s)throw new Error(`Property '${e}' does not exist on limetype '${o}'`);return s.relation?function(e,t,i,r,o=!0){if(null===t)return[];if("object"!=typeof t)throw new TypeError(`Relation property '${e}' must be null or an object`);const n=t,{keys:s,guiLimitations:l}=u(n,e,o);if(0===s.length)return l;const a=r.relation.getLimetype();if(!a)throw new Error(`Could not determine related limetype for property '${e}'`);const d={};for(const e of s)d[e]=n[e];const c=h(d,i,a.name,o);return[...l,...c]}(e,t,r,s,n):function(e,t,i=!0){if(null===t)return[];if("object"==typeof t){const{keys:r,guiLimitations:o}=u(t,e,i);if(0===r.length)return o;throw new Error(`Non-relation property '${e}' cannot have nested properties other than _alias or # properties (got: ${r.join(", ")})`)}throw new Error(`Non-relation property '${e}' must be null or an object (got ${typeof t})`)}(e,t,n)}function h(e,t,i,r=!0){const n=t[i];if(!n)throw new Error(`Unknown limetype: ${i}`);const s=o(n),l=[];for(const[o,n]of Object.entries(e)){if(o.startsWith("#"))continue;const e=p(o,n,s,t,i,r);l.push(...e)}return l}function m(e,t,i,r=!0){if(e)if("key"in e){const r=function(e,t,i){if(function(e){return"string"==typeof e&&(a.has(e)||d.test(e)||c.test(e))}(e))return{valid:!0};if("string"!=typeof e||!e.startsWith("%activeObject%"))return{valid:!0};if(!t)return{valid:!0};const r=e.replace(/^%activeObject%\.?/,"");if(!r)return{valid:!0};try{return n(i,t,r)?{valid:!0}:{valid:!1,error:`Property path '${r}' does not exist on limetype '${t}'`}}catch(e){return{valid:!1,error:`Invalid placeholder path: ${e.message}`}}}(e.exp,t,i);if(!r.valid)throw new Error(`Invalid placeholder in filter '${e.key}': ${r.error}`)}else if("exp"in e)if("!"===e.op)m(e.exp,t,i,r);else if("AND"===e.op||"OR"===e.op){const o=e.exp;for(const e of o)m(e,t,i,r)}}const f=class{constructor(i){e(this,i),this.change=t(this,"change",7),this.mode="gui",this.codeValue="",this.limetype="",this.handleLimetypeChange=e=>{e.stopPropagation(),this.limetype=e.detail,this.filter=void 0,this.internalResponseFormat={object:{_id:null}},this.emitChange()},this.handleFilterChange=e=>{var t;e.stopPropagation(),this.filter=null!==(t=e.detail)&&void 0!==t?t:void 0,this.emitChange()},this.handleResponseFormatChange=e=>{e.stopPropagation(),this.internalResponseFormat=e.detail,this.emitChange()},this.handleLimitChange=e=>{e.stopPropagation();const t=e.detail;this.limit=t?Number.parseInt(t,10):void 0,this.emitChange()},this.switchToGui=()=>{try{const e=JSON.parse(this.codeValue);if(!this.checkGuiSupport().guiSupported)return;this.limetype=e.limetype||"",this.filter=e.filter,this.internalResponseFormat=e.responseFormat,this.limit=e.limit,this.mode="gui",this.change.emit(e)}catch(e){}},this.switchToCode=()=>{this.updateCodeValue(),this.mode="code"},this.handleCodeChange=e=>{e.stopPropagation(),this.codeValue=e.detail;try{const e=JSON.parse(this.codeValue);this.change.emit(e)}catch(e){}}}get guiModeEnabled(){var e,t,i;return null!==(i=null===(t=null===(e=this.platform)||void 0===e?void 0:e.isFeatureEnabled)||void 0===t?void 0:t.call(e,"useLimeQueryBuilderGuiMode"))&&void 0!==i&&i}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.updateCodeValue(),this.checkGuiSupport().guiSupported||(this.mode="code")}render(){const e=this.checkGuiSupport(),t=!this.guiModeEnabled||"code"===this.mode;return i("div",{key:"0b4d2bb5b4d503a775d8d3215e1e4c74fdb1eceb",class:"lime-query-builder"},this.renderLabel(),this.renderModeControls(e),t?this.renderCodeMode(e):this.renderGuiMode())}emitChange(){if("code"===this.mode)return;if(!this.limetype)return;const e={limetype:this.limetype,responseFormat:this.internalResponseFormat||{object:{_id:null}},filter:this.filter};void 0!==this.limit&&this.limit>0&&(e.limit=this.limit),this.change.emit(e)}updateCodeValue(){if(!this.limetype)return void(this.codeValue=JSON.stringify(this.value||{},null,2));const e={limetype:this.limetype,responseFormat:this.internalResponseFormat||{object:{_id:null}},filter:this.filter};void 0!==this.limit&&this.limit>0&&(e.limit=this.limit),this.codeValue=JSON.stringify(e,null,2)}checkGuiSupport(){if(!this.limetypes)return{valid:!0,guiSupported:!0,validationErrors:[],guiLimitations:[]};let e;if("code"===this.mode&&this.codeValue)try{e=JSON.parse(this.codeValue)}catch(e){return{valid:!1,guiSupported:!1,validationErrors:["Invalid JSON"],guiLimitations:[]}}else{if(!this.limetype)return{valid:!0,guiSupported:!0,validationErrors:[],guiLimitations:[]};e={limetype:this.limetype,responseFormat:this.internalResponseFormat||{object:{_id:null}},filter:this.filter},void 0!==this.limit&&this.limit>0&&(e.limit=this.limit)}return function(e,t,i,r=!0){if(!e)return{valid:!0,guiSupported:!0,validationErrors:[],guiLimitations:[]};const o=[],n=[];if(e.limetype&&!t[e.limetype]&&o.push(`Unknown limetype: ${e.limetype}`),void 0===e.offset||e.orderBy||o.push("offset requires orderBy to be specified"),r&&(e.orderBy&&n.push("orderBy is not yet supported in GUI mode"),void 0!==e.offset&&n.push("offset is not yet supported in GUI mode")),e.filter){const n=function(e,t,i,r){const o=[];try{l(e),m(e,t,i,r)}catch(e){o.push(`Invalid filter: ${e.message}`)}return o}(e.filter,i,t,r);o.push(...n)}if(e.responseFormat){const{errors:i,limitations:s}=function(e,t,i,r){const o=[],n=[];try{const o=function(e,t,i,r=!0){const o=[];if(r&&e.aggregates&&o.push("responseFormat.aggregates is not yet supported in GUI mode"),e.object){const n=h(e.object,t,i,r);o.push(...n)}return o}(e,t,i,r);n.push(...o)}catch(e){o.push(`Invalid responseFormat: ${e.message}`)}return{errors:o,limitations:n}}(e.responseFormat,t,e.limetype,r);o.push(...i),n.push(...s)}return{valid:0===o.length,guiSupported:0===n.length,validationErrors:o,guiLimitations:n}}(e,this.limetypes,this.activeLimetype,this.guiModeEnabled)}renderModeSwitch(e){return i("div",{class:"mode-switch"},i("limel-button",{label:"GUI",primary:"gui"===this.mode,disabled:!e.guiSupported,onClick:this.switchToGui}),i("limel-button",{label:"Code",primary:"code"===this.mode,onClick:this.switchToCode}))}renderCodeEditor(e){return i("div",{class:"code-editor-container"},i("limel-code-editor",{value:this.codeValue,language:"json",lineNumbers:!0,fold:!0,lint:!0,onChange:this.handleCodeChange}),!e.valid&&e.validationErrors.length>0&&i("div",{class:"validation-errors"},i("strong",null,"Invalid Lime Query:"),i("ul",null,e.validationErrors.map((e=>i("li",null,e))))),this.guiModeEnabled&&e.valid&&!e.guiSupported&&e.guiLimitations.length>0&&i("div",{class:"gui-limitations"},i("strong",null,"Cannot switch to GUI mode:"),i("ul",null,e.guiLimitations.map((e=>i("li",null,e))))))}renderLimetypeSection(){return i("div",{class:"limetype-section"},i("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 i("div",{class:"response-format-section"},i("limebb-response-format-editor",{platform:this.platform,context:this.context,limetype:this.limetype,value:this.internalResponseFormat,onChange:this.handleResponseFormatChange}))}renderFilterSection(){if(this.limetype)return i("div",{class:"filter-section"},i("h4",{class:"section-label"},"Filter Conditions"),i("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 e;if(this.limetype)return i("div",{class:"query-options-section"},i("h4",{class:"section-label"},"Query Options"),i("div",{class:"query-options-controls"},i("limel-input-field",{label:"Limit",type:"number",value:(null===(e=this.limit)||void 0===e?void 0:e.toString())||"",placeholder:"No limit",helperText:"Maximum number of results",onChange:this.handleLimitChange})))}renderGuiMode(){return i("div",{class:"gui-mode"},this.renderLimetypeSection(),this.renderResponseFormatSection(),this.renderFilterSection(),this.renderQueryOptionsSection())}renderLabel(){if(this.label)return i("h3",{class:"lime-query-builder-label"},this.label)}renderModeControls(e){if(this.guiModeEnabled)return i("div",{class:"mode-controls"},this.renderModeSwitch(e))}renderCodeMode(e){return i("div",{class:"code-mode"},this.renderCodeEditor(e))}};(function(e,t,i,r){var o,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(s=(n<3?o(s):n>3?o(t,i,s):o(t,i))||s);n>3&&s&&Object.defineProperty(t,i,s)})([r()],f.prototype,"limetypes",void 0),f.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:grid;grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));gap:1rem}@media (max-width: 768px){.lime-query-builder{gap:1.5rem}.query-options-controls{grid-template-columns:1fr}}";export{f as limebb_lime_query_builder}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { EventEmitter } from '../../../stencil-public-runtime';
|
|
2
|
+
import { Expression, LimeWebComponent, LimeWebComponentContext, LimeWebComponentPlatform } from '@limetech/lime-web-components';
|
|
3
|
+
/**
|
|
4
|
+
* Lime Query Filter Builder
|
|
5
|
+
*
|
|
6
|
+
* Entry component for building Lime Query filter expressions.
|
|
7
|
+
* This component wraps the expression router and adds promotion logic
|
|
8
|
+
* for handling Add buttons and expression structure.
|
|
9
|
+
*
|
|
10
|
+
* Unlike the expression router (which is pure routing), this component
|
|
11
|
+
* contains business logic for promoting expressions and managing the
|
|
12
|
+
* filter structure.
|
|
13
|
+
*
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
16
|
+
export declare class LimeQueryFilterBuilderComponent implements LimeWebComponent {
|
|
17
|
+
/**
|
|
18
|
+
* Platform service provider
|
|
19
|
+
*/
|
|
20
|
+
platform: LimeWebComponentPlatform;
|
|
21
|
+
/**
|
|
22
|
+
* Component context
|
|
23
|
+
*/
|
|
24
|
+
context: LimeWebComponentContext;
|
|
25
|
+
/**
|
|
26
|
+
* The limetype being queried (e.g., "deal", "company")
|
|
27
|
+
*/
|
|
28
|
+
limetype: string;
|
|
29
|
+
/**
|
|
30
|
+
* The limetype of the active object (for %activeObject% placeholders)
|
|
31
|
+
*/
|
|
32
|
+
activeLimetype?: string;
|
|
33
|
+
/**
|
|
34
|
+
* The filter expression to build
|
|
35
|
+
*/
|
|
36
|
+
expression: Expression | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Emitted when the filter expression changes
|
|
39
|
+
* Emits undefined when expression should be removed
|
|
40
|
+
*/
|
|
41
|
+
expressionChange: EventEmitter<Expression | undefined>;
|
|
42
|
+
render(): any;
|
|
43
|
+
private needsPromotion;
|
|
44
|
+
private renderEmptyState;
|
|
45
|
+
private renderWithPromotionButton;
|
|
46
|
+
private handleAddFirstCondition;
|
|
47
|
+
private handlePromoteAndAdd;
|
|
48
|
+
private handleExpressionChange;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=lime-query-filter-builder.d.ts.map
|
|
@@ -27,6 +27,7 @@ import { LimeQuery } from './lime-query.types';
|
|
|
27
27
|
* (e.g., `%activeObject%.company` references the company of the active object).
|
|
28
28
|
*
|
|
29
29
|
* @exampleComponent limebb-example-lime-query-builder-basic
|
|
30
|
+
* @exampleComponent limebb-example-lime-query-builder-with-active-limetype
|
|
30
31
|
* @private
|
|
31
32
|
*/
|
|
32
33
|
export declare class LimeQueryBuilder implements LimeWebComponent {
|
|
@@ -70,12 +71,6 @@ export declare class LimeQueryBuilder implements LimeWebComponent {
|
|
|
70
71
|
private handleFilterChange;
|
|
71
72
|
private handleResponseFormatChange;
|
|
72
73
|
private handleLimitChange;
|
|
73
|
-
/**
|
|
74
|
-
* Normalize filter to ensure top-level is an AND group.
|
|
75
|
-
* This ensures Add buttons are available in the UI.
|
|
76
|
-
* @param filter
|
|
77
|
-
*/
|
|
78
|
-
private normalizeFilter;
|
|
79
74
|
private emitChange;
|
|
80
75
|
private updateCodeValue;
|
|
81
76
|
private checkGuiSupport;
|
|
@@ -968,6 +968,7 @@ export namespace Components {
|
|
|
968
968
|
* These placeholders reference properties of a contextual "active object"
|
|
969
969
|
* (e.g., `%activeObject%.company` references the company of the active object).
|
|
970
970
|
* @exampleComponent limebb-example-lime-query-builder-basic
|
|
971
|
+
* @exampleComponent limebb-example-lime-query-builder-with-active-limetype
|
|
971
972
|
* @private
|
|
972
973
|
*/
|
|
973
974
|
interface LimebbLimeQueryBuilder {
|
|
@@ -1030,6 +1031,38 @@ export namespace Components {
|
|
|
1030
1031
|
*/
|
|
1031
1032
|
"platform": LimeWebComponentPlatform;
|
|
1032
1033
|
}
|
|
1034
|
+
/**
|
|
1035
|
+
* Lime Query Filter Builder
|
|
1036
|
+
* Entry component for building Lime Query filter expressions.
|
|
1037
|
+
* This component wraps the expression router and adds promotion logic
|
|
1038
|
+
* for handling Add buttons and expression structure.
|
|
1039
|
+
* Unlike the expression router (which is pure routing), this component
|
|
1040
|
+
* contains business logic for promoting expressions and managing the
|
|
1041
|
+
* filter structure.
|
|
1042
|
+
* @private
|
|
1043
|
+
*/
|
|
1044
|
+
interface LimebbLimeQueryFilterBuilder {
|
|
1045
|
+
/**
|
|
1046
|
+
* The limetype of the active object (for %activeObject% placeholders)
|
|
1047
|
+
*/
|
|
1048
|
+
"activeLimetype"?: string;
|
|
1049
|
+
/**
|
|
1050
|
+
* Component context
|
|
1051
|
+
*/
|
|
1052
|
+
"context": LimeWebComponentContext;
|
|
1053
|
+
/**
|
|
1054
|
+
* The filter expression to build
|
|
1055
|
+
*/
|
|
1056
|
+
"expression": Expression | undefined;
|
|
1057
|
+
/**
|
|
1058
|
+
* The limetype being queried (e.g., "deal", "company")
|
|
1059
|
+
*/
|
|
1060
|
+
"limetype": string;
|
|
1061
|
+
/**
|
|
1062
|
+
* Platform service provider
|
|
1063
|
+
*/
|
|
1064
|
+
"platform": LimeWebComponentPlatform;
|
|
1065
|
+
}
|
|
1033
1066
|
/**
|
|
1034
1067
|
* Lime Query Filter Comparison Component
|
|
1035
1068
|
* Renders a single comparison expression with three parts:
|
|
@@ -2123,6 +2156,10 @@ export interface LimebbLimeQueryFilterAndCustomEvent<T> extends CustomEvent<T> {
|
|
|
2123
2156
|
detail: T;
|
|
2124
2157
|
target: HTMLLimebbLimeQueryFilterAndElement;
|
|
2125
2158
|
}
|
|
2159
|
+
export interface LimebbLimeQueryFilterBuilderCustomEvent<T> extends CustomEvent<T> {
|
|
2160
|
+
detail: T;
|
|
2161
|
+
target: HTMLLimebbLimeQueryFilterBuilderElement;
|
|
2162
|
+
}
|
|
2126
2163
|
export interface LimebbLimeQueryFilterComparisonCustomEvent<T> extends CustomEvent<T> {
|
|
2127
2164
|
detail: T;
|
|
2128
2165
|
target: HTMLLimebbLimeQueryFilterComparisonElement;
|
|
@@ -2828,6 +2865,7 @@ declare global {
|
|
|
2828
2865
|
* These placeholders reference properties of a contextual "active object"
|
|
2829
2866
|
* (e.g., `%activeObject%.company` references the company of the active object).
|
|
2830
2867
|
* @exampleComponent limebb-example-lime-query-builder-basic
|
|
2868
|
+
* @exampleComponent limebb-example-lime-query-builder-with-active-limetype
|
|
2831
2869
|
* @private
|
|
2832
2870
|
*/
|
|
2833
2871
|
interface HTMLLimebbLimeQueryBuilderElement extends Components.LimebbLimeQueryBuilder, HTMLStencilElement {
|
|
@@ -2873,6 +2911,33 @@ declare global {
|
|
|
2873
2911
|
prototype: HTMLLimebbLimeQueryFilterAndElement;
|
|
2874
2912
|
new (): HTMLLimebbLimeQueryFilterAndElement;
|
|
2875
2913
|
};
|
|
2914
|
+
interface HTMLLimebbLimeQueryFilterBuilderElementEventMap {
|
|
2915
|
+
"expressionChange": Expression | undefined;
|
|
2916
|
+
}
|
|
2917
|
+
/**
|
|
2918
|
+
* Lime Query Filter Builder
|
|
2919
|
+
* Entry component for building Lime Query filter expressions.
|
|
2920
|
+
* This component wraps the expression router and adds promotion logic
|
|
2921
|
+
* for handling Add buttons and expression structure.
|
|
2922
|
+
* Unlike the expression router (which is pure routing), this component
|
|
2923
|
+
* contains business logic for promoting expressions and managing the
|
|
2924
|
+
* filter structure.
|
|
2925
|
+
* @private
|
|
2926
|
+
*/
|
|
2927
|
+
interface HTMLLimebbLimeQueryFilterBuilderElement extends Components.LimebbLimeQueryFilterBuilder, HTMLStencilElement {
|
|
2928
|
+
addEventListener<K extends keyof HTMLLimebbLimeQueryFilterBuilderElementEventMap>(type: K, listener: (this: HTMLLimebbLimeQueryFilterBuilderElement, ev: LimebbLimeQueryFilterBuilderCustomEvent<HTMLLimebbLimeQueryFilterBuilderElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
2929
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
2930
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
2931
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
2932
|
+
removeEventListener<K extends keyof HTMLLimebbLimeQueryFilterBuilderElementEventMap>(type: K, listener: (this: HTMLLimebbLimeQueryFilterBuilderElement, ev: LimebbLimeQueryFilterBuilderCustomEvent<HTMLLimebbLimeQueryFilterBuilderElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
|
2933
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
2934
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
2935
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
2936
|
+
}
|
|
2937
|
+
var HTMLLimebbLimeQueryFilterBuilderElement: {
|
|
2938
|
+
prototype: HTMLLimebbLimeQueryFilterBuilderElement;
|
|
2939
|
+
new (): HTMLLimebbLimeQueryFilterBuilderElement;
|
|
2940
|
+
};
|
|
2876
2941
|
interface HTMLLimebbLimeQueryFilterComparisonElementEventMap {
|
|
2877
2942
|
"expressionChange": ComparisonExpression | undefined;
|
|
2878
2943
|
}
|
|
@@ -3564,6 +3629,7 @@ declare global {
|
|
|
3564
3629
|
"limebb-kanban-item": HTMLLimebbKanbanItemElement;
|
|
3565
3630
|
"limebb-lime-query-builder": HTMLLimebbLimeQueryBuilderElement;
|
|
3566
3631
|
"limebb-lime-query-filter-and": HTMLLimebbLimeQueryFilterAndElement;
|
|
3632
|
+
"limebb-lime-query-filter-builder": HTMLLimebbLimeQueryFilterBuilderElement;
|
|
3567
3633
|
"limebb-lime-query-filter-comparison": HTMLLimebbLimeQueryFilterComparisonElement;
|
|
3568
3634
|
"limebb-lime-query-filter-expression": HTMLLimebbLimeQueryFilterExpressionElement;
|
|
3569
3635
|
"limebb-lime-query-filter-group": HTMLLimebbLimeQueryFilterGroupElement;
|
|
@@ -4608,6 +4674,7 @@ declare namespace LocalJSX {
|
|
|
4608
4674
|
* These placeholders reference properties of a contextual "active object"
|
|
4609
4675
|
* (e.g., `%activeObject%.company` references the company of the active object).
|
|
4610
4676
|
* @exampleComponent limebb-example-lime-query-builder-basic
|
|
4677
|
+
* @exampleComponent limebb-example-lime-query-builder-with-active-limetype
|
|
4611
4678
|
* @private
|
|
4612
4679
|
*/
|
|
4613
4680
|
interface LimebbLimeQueryBuilder {
|
|
@@ -4678,6 +4745,42 @@ declare namespace LocalJSX {
|
|
|
4678
4745
|
*/
|
|
4679
4746
|
"platform"?: LimeWebComponentPlatform;
|
|
4680
4747
|
}
|
|
4748
|
+
/**
|
|
4749
|
+
* Lime Query Filter Builder
|
|
4750
|
+
* Entry component for building Lime Query filter expressions.
|
|
4751
|
+
* This component wraps the expression router and adds promotion logic
|
|
4752
|
+
* for handling Add buttons and expression structure.
|
|
4753
|
+
* Unlike the expression router (which is pure routing), this component
|
|
4754
|
+
* contains business logic for promoting expressions and managing the
|
|
4755
|
+
* filter structure.
|
|
4756
|
+
* @private
|
|
4757
|
+
*/
|
|
4758
|
+
interface LimebbLimeQueryFilterBuilder {
|
|
4759
|
+
/**
|
|
4760
|
+
* The limetype of the active object (for %activeObject% placeholders)
|
|
4761
|
+
*/
|
|
4762
|
+
"activeLimetype"?: string;
|
|
4763
|
+
/**
|
|
4764
|
+
* Component context
|
|
4765
|
+
*/
|
|
4766
|
+
"context"?: LimeWebComponentContext;
|
|
4767
|
+
/**
|
|
4768
|
+
* The filter expression to build
|
|
4769
|
+
*/
|
|
4770
|
+
"expression"?: Expression | undefined;
|
|
4771
|
+
/**
|
|
4772
|
+
* The limetype being queried (e.g., "deal", "company")
|
|
4773
|
+
*/
|
|
4774
|
+
"limetype"?: string;
|
|
4775
|
+
/**
|
|
4776
|
+
* Emitted when the filter expression changes Emits undefined when expression should be removed
|
|
4777
|
+
*/
|
|
4778
|
+
"onExpressionChange"?: (event: LimebbLimeQueryFilterBuilderCustomEvent<Expression | undefined>) => void;
|
|
4779
|
+
/**
|
|
4780
|
+
* Platform service provider
|
|
4781
|
+
*/
|
|
4782
|
+
"platform"?: LimeWebComponentPlatform;
|
|
4783
|
+
}
|
|
4681
4784
|
/**
|
|
4682
4785
|
* Lime Query Filter Comparison Component
|
|
4683
4786
|
* Renders a single comparison expression with three parts:
|
|
@@ -5790,6 +5893,7 @@ declare namespace LocalJSX {
|
|
|
5790
5893
|
"limebb-kanban-item": LimebbKanbanItem;
|
|
5791
5894
|
"limebb-lime-query-builder": LimebbLimeQueryBuilder;
|
|
5792
5895
|
"limebb-lime-query-filter-and": LimebbLimeQueryFilterAnd;
|
|
5896
|
+
"limebb-lime-query-filter-builder": LimebbLimeQueryFilterBuilder;
|
|
5793
5897
|
"limebb-lime-query-filter-comparison": LimebbLimeQueryFilterComparison;
|
|
5794
5898
|
"limebb-lime-query-filter-expression": LimebbLimeQueryFilterExpression;
|
|
5795
5899
|
"limebb-lime-query-filter-group": LimebbLimeQueryFilterGroup;
|
|
@@ -6111,6 +6215,7 @@ declare module "@stencil/core" {
|
|
|
6111
6215
|
* These placeholders reference properties of a contextual "active object"
|
|
6112
6216
|
* (e.g., `%activeObject%.company` references the company of the active object).
|
|
6113
6217
|
* @exampleComponent limebb-example-lime-query-builder-basic
|
|
6218
|
+
* @exampleComponent limebb-example-lime-query-builder-with-active-limetype
|
|
6114
6219
|
* @private
|
|
6115
6220
|
*/
|
|
6116
6221
|
"limebb-lime-query-builder": LocalJSX.LimebbLimeQueryBuilder & JSXBase.HTMLAttributes<HTMLLimebbLimeQueryBuilderElement>;
|
|
@@ -6127,6 +6232,17 @@ declare module "@stencil/core" {
|
|
|
6127
6232
|
* @private
|
|
6128
6233
|
*/
|
|
6129
6234
|
"limebb-lime-query-filter-and": LocalJSX.LimebbLimeQueryFilterAnd & JSXBase.HTMLAttributes<HTMLLimebbLimeQueryFilterAndElement>;
|
|
6235
|
+
/**
|
|
6236
|
+
* Lime Query Filter Builder
|
|
6237
|
+
* Entry component for building Lime Query filter expressions.
|
|
6238
|
+
* This component wraps the expression router and adds promotion logic
|
|
6239
|
+
* for handling Add buttons and expression structure.
|
|
6240
|
+
* Unlike the expression router (which is pure routing), this component
|
|
6241
|
+
* contains business logic for promoting expressions and managing the
|
|
6242
|
+
* filter structure.
|
|
6243
|
+
* @private
|
|
6244
|
+
*/
|
|
6245
|
+
"limebb-lime-query-filter-builder": LocalJSX.LimebbLimeQueryFilterBuilder & JSXBase.HTMLAttributes<HTMLLimebbLimeQueryFilterBuilderElement>;
|
|
6130
6246
|
/**
|
|
6131
6247
|
* Lime Query Filter Comparison Component
|
|
6132
6248
|
* Renders a single comparison expression with three parts:
|
package/package.json
CHANGED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-ff255a0d.js');
|
|
6
|
-
const index_esm = require('./index.esm-d785eb6e.js');
|
|
7
|
-
|
|
8
|
-
const limeQueryFilterComparisonCss = ".expression-container{display:flex;flex-direction:row;align-items:flex-start;gap:1rem;flex-wrap:wrap}.expression-container>*{flex-grow:2;width:30%;max-width:calc(100% - 3.25rem)}.expression-container>.operator{flex-grow:1;width:calc(30% + 1rem);min-width:4rem}.expression-container>.remove{flex-grow:0;width:auto;margin-left:auto}@media (max-width: 768px){.expression-container{flex-direction:column}.expression-container>*{width:100%;max-width:100%}.expression-container>.operator{width:100%}.expression-container>.remove{margin-left:0;align-self:flex-end}}";
|
|
9
|
-
const LimebbLimeQueryFilterComparisonStyle0 = limeQueryFilterComparisonCss;
|
|
10
|
-
|
|
11
|
-
const LIME_QUERY_OPERATORS = [
|
|
12
|
-
{ value: index_esm.Zt.EQUALS, label: 'Equals', icon: 'equals' },
|
|
13
|
-
{ value: index_esm.Zt.NOT_EQUALS, label: 'Not Equals', icon: 'not-equal' },
|
|
14
|
-
{
|
|
15
|
-
value: index_esm.Zt.GREATER,
|
|
16
|
-
label: 'Greater Than',
|
|
17
|
-
icon: 'greater-than',
|
|
18
|
-
applicableTypes: ['integer', 'decimal', 'date', 'time'],
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
value: index_esm.Zt.GREATER_OR_EQUAL,
|
|
22
|
-
label: 'Greater or Equal',
|
|
23
|
-
icon: 'greater-or-equal',
|
|
24
|
-
applicableTypes: ['integer', 'decimal', 'date', 'time'],
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
value: index_esm.Zt.LESS,
|
|
28
|
-
label: 'Less Than',
|
|
29
|
-
icon: 'less-than',
|
|
30
|
-
applicableTypes: ['integer', 'decimal', 'date', 'time'],
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
value: index_esm.Zt.LESS_OR_EQUAL,
|
|
34
|
-
label: 'Less or Equal',
|
|
35
|
-
icon: 'less-or-equal',
|
|
36
|
-
applicableTypes: ['integer', 'decimal', 'date', 'time'],
|
|
37
|
-
},
|
|
38
|
-
{ value: index_esm.Zt.IN, label: 'In List', icon: 'list' },
|
|
39
|
-
{
|
|
40
|
-
value: index_esm.Zt.LIKE,
|
|
41
|
-
label: 'Contains',
|
|
42
|
-
icon: '-lime-filter-contain',
|
|
43
|
-
applicableTypes: ['string', 'text'],
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
value: index_esm.Zt.BEGINS,
|
|
47
|
-
label: 'Begins With',
|
|
48
|
-
icon: '-lime-filter-begin',
|
|
49
|
-
applicableTypes: ['string', 'text'],
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
value: index_esm.Zt.ENDS,
|
|
53
|
-
label: 'Ends With',
|
|
54
|
-
icon: '-lime-filter-end',
|
|
55
|
-
applicableTypes: ['string', 'text'],
|
|
56
|
-
},
|
|
57
|
-
];
|
|
58
|
-
const LimeQueryFilterComparisonComponent = class {
|
|
59
|
-
constructor(hostRef) {
|
|
60
|
-
index.registerInstance(this, hostRef);
|
|
61
|
-
this.expressionChange = index.createEvent(this, "expressionChange", 7);
|
|
62
|
-
this.handlePropertyChange = (event) => {
|
|
63
|
-
event.stopPropagation();
|
|
64
|
-
this.expressionChange.emit(Object.assign(Object.assign({}, this.expression), { key: event.detail }));
|
|
65
|
-
};
|
|
66
|
-
this.handleOperatorChange = (event) => {
|
|
67
|
-
event.stopPropagation();
|
|
68
|
-
// TODO: Clear value when switching between IN and other operators
|
|
69
|
-
// since array values are incompatible with single-value operators
|
|
70
|
-
this.expressionChange.emit({
|
|
71
|
-
key: this.expression.key,
|
|
72
|
-
op: event.detail.value,
|
|
73
|
-
exp: this.expression.exp,
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
this.handleValueChange = (event) => {
|
|
77
|
-
event.stopPropagation();
|
|
78
|
-
this.expressionChange.emit(Object.assign(Object.assign({}, this.expression), { exp: event.detail }));
|
|
79
|
-
};
|
|
80
|
-
this.removeExpression = () => {
|
|
81
|
-
this.expressionChange.emit(undefined);
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
render() {
|
|
85
|
-
return (index.h("div", { key: '668e0f05bdb1fb25ffd652ea650c34e5431a3332', class: "expression" }, this.label && index.h("limel-header", { key: '5034070b58afe31cf90699dd2a27f884e647f540', heading: this.label }), index.h("div", { key: '14a2b1270e5e6d7e158e29ebc5f61051e5670e80', class: "expression-container" }, this.renderPropertySelector(), this.renderOperator(), this.renderValueInput(), index.h("limel-icon-button", { key: 'b69bde6e88c40d2623ef015794db28cec3676c73', class: "remove", icon: "trash", label: "Remove condition", onClick: this.removeExpression }))));
|
|
86
|
-
}
|
|
87
|
-
renderPropertySelector() {
|
|
88
|
-
return (index.h("limebb-property-selector", { platform: this.platform, context: this.context, label: "Property", limetype: this.limetype, value: this.expression.key, required: true, onChange: this.handlePropertyChange }));
|
|
89
|
-
}
|
|
90
|
-
renderOperator() {
|
|
91
|
-
const operatorHasBeenSet = !!this.expression.op;
|
|
92
|
-
const options = LIME_QUERY_OPERATORS.map((op) => ({
|
|
93
|
-
text: op.label,
|
|
94
|
-
value: op.value,
|
|
95
|
-
icon: op.icon ? { name: op.icon } : undefined,
|
|
96
|
-
}));
|
|
97
|
-
const selectedOption = options.find((o) => o.value === this.expression.op);
|
|
98
|
-
return (index.h("limel-select", { class: "operator", label: "Operator", value: selectedOption, options: options, disabled: !operatorHasBeenSet && !this.expression.key, onChange: this.handleOperatorChange }));
|
|
99
|
-
}
|
|
100
|
-
renderValueInput() {
|
|
101
|
-
if (!this.expression.op) {
|
|
102
|
-
return null;
|
|
103
|
-
}
|
|
104
|
-
return (index.h("limebb-lime-query-value-input", { platform: this.platform, context: this.context, limetype: this.limetype, activeLimetype: this.activeLimetype, propertyPath: this.expression.key, operator: this.expression.op, value: this.expression.exp, onChange: this.handleValueChange }));
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
LimeQueryFilterComparisonComponent.style = LimebbLimeQueryFilterComparisonStyle0;
|
|
108
|
-
|
|
109
|
-
const limeQueryFilterExpressionCss = "@charset \"UTF-8\";.expression{display:flex;flex-direction:column;margin-bottom:1rem;gap:1rem}";
|
|
110
|
-
const LimebbLimeQueryFilterExpressionStyle0 = limeQueryFilterExpressionCss;
|
|
111
|
-
|
|
112
|
-
const LimeQueryFilterExpressionComponent = class {
|
|
113
|
-
constructor(hostRef) {
|
|
114
|
-
index.registerInstance(this, hostRef);
|
|
115
|
-
this.expressionChange = index.createEvent(this, "expressionChange", 7);
|
|
116
|
-
this.handleExpressionChange = (event) => {
|
|
117
|
-
event.stopPropagation();
|
|
118
|
-
this.expressionChange.emit(event.detail);
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
render() {
|
|
122
|
-
if (!this.expression) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
const props = {
|
|
126
|
-
platform: this.platform,
|
|
127
|
-
context: this.context,
|
|
128
|
-
label: this.label,
|
|
129
|
-
limetype: this.limetype,
|
|
130
|
-
activeLimetype: this.activeLimetype,
|
|
131
|
-
};
|
|
132
|
-
if ('key' in this.expression) {
|
|
133
|
-
return (index.h("limebb-lime-query-filter-comparison", Object.assign({}, props, { expression: this.expression, onExpressionChange: this.handleExpressionChange })));
|
|
134
|
-
}
|
|
135
|
-
if (this.expression.op === index_esm.Zt.AND ||
|
|
136
|
-
this.expression.op === index_esm.Zt.OR) {
|
|
137
|
-
return (index.h("limebb-lime-query-filter-group", Object.assign({}, props, { expression: this.expression, onExpressionChange: this.handleExpressionChange })));
|
|
138
|
-
}
|
|
139
|
-
if (this.expression.op === index_esm.Zt.NOT) {
|
|
140
|
-
return (index.h("limebb-lime-query-filter-not", Object.assign({}, props, { expression: this.expression, onExpressionChange: this.handleExpressionChange })));
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
LimeQueryFilterExpressionComponent.style = LimebbLimeQueryFilterExpressionStyle0;
|
|
145
|
-
|
|
146
|
-
exports.limebb_lime_query_filter_comparison = LimeQueryFilterComparisonComponent;
|
|
147
|
-
exports.limebb_lime_query_filter_expression = LimeQueryFilterExpressionComponent;
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h } from './index-96dd111f.js';
|
|
2
|
-
import { Z as Zt } from './index.esm-bb569663.js';
|
|
3
|
-
|
|
4
|
-
const limeQueryFilterComparisonCss = ".expression-container{display:flex;flex-direction:row;align-items:flex-start;gap:1rem;flex-wrap:wrap}.expression-container>*{flex-grow:2;width:30%;max-width:calc(100% - 3.25rem)}.expression-container>.operator{flex-grow:1;width:calc(30% + 1rem);min-width:4rem}.expression-container>.remove{flex-grow:0;width:auto;margin-left:auto}@media (max-width: 768px){.expression-container{flex-direction:column}.expression-container>*{width:100%;max-width:100%}.expression-container>.operator{width:100%}.expression-container>.remove{margin-left:0;align-self:flex-end}}";
|
|
5
|
-
const LimebbLimeQueryFilterComparisonStyle0 = limeQueryFilterComparisonCss;
|
|
6
|
-
|
|
7
|
-
const LIME_QUERY_OPERATORS = [
|
|
8
|
-
{ value: Zt.EQUALS, label: 'Equals', icon: 'equals' },
|
|
9
|
-
{ value: Zt.NOT_EQUALS, label: 'Not Equals', icon: 'not-equal' },
|
|
10
|
-
{
|
|
11
|
-
value: Zt.GREATER,
|
|
12
|
-
label: 'Greater Than',
|
|
13
|
-
icon: 'greater-than',
|
|
14
|
-
applicableTypes: ['integer', 'decimal', 'date', 'time'],
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
value: Zt.GREATER_OR_EQUAL,
|
|
18
|
-
label: 'Greater or Equal',
|
|
19
|
-
icon: 'greater-or-equal',
|
|
20
|
-
applicableTypes: ['integer', 'decimal', 'date', 'time'],
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
value: Zt.LESS,
|
|
24
|
-
label: 'Less Than',
|
|
25
|
-
icon: 'less-than',
|
|
26
|
-
applicableTypes: ['integer', 'decimal', 'date', 'time'],
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
value: Zt.LESS_OR_EQUAL,
|
|
30
|
-
label: 'Less or Equal',
|
|
31
|
-
icon: 'less-or-equal',
|
|
32
|
-
applicableTypes: ['integer', 'decimal', 'date', 'time'],
|
|
33
|
-
},
|
|
34
|
-
{ value: Zt.IN, label: 'In List', icon: 'list' },
|
|
35
|
-
{
|
|
36
|
-
value: Zt.LIKE,
|
|
37
|
-
label: 'Contains',
|
|
38
|
-
icon: '-lime-filter-contain',
|
|
39
|
-
applicableTypes: ['string', 'text'],
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
value: Zt.BEGINS,
|
|
43
|
-
label: 'Begins With',
|
|
44
|
-
icon: '-lime-filter-begin',
|
|
45
|
-
applicableTypes: ['string', 'text'],
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
value: Zt.ENDS,
|
|
49
|
-
label: 'Ends With',
|
|
50
|
-
icon: '-lime-filter-end',
|
|
51
|
-
applicableTypes: ['string', 'text'],
|
|
52
|
-
},
|
|
53
|
-
];
|
|
54
|
-
const LimeQueryFilterComparisonComponent = class {
|
|
55
|
-
constructor(hostRef) {
|
|
56
|
-
registerInstance(this, hostRef);
|
|
57
|
-
this.expressionChange = createEvent(this, "expressionChange", 7);
|
|
58
|
-
this.handlePropertyChange = (event) => {
|
|
59
|
-
event.stopPropagation();
|
|
60
|
-
this.expressionChange.emit(Object.assign(Object.assign({}, this.expression), { key: event.detail }));
|
|
61
|
-
};
|
|
62
|
-
this.handleOperatorChange = (event) => {
|
|
63
|
-
event.stopPropagation();
|
|
64
|
-
// TODO: Clear value when switching between IN and other operators
|
|
65
|
-
// since array values are incompatible with single-value operators
|
|
66
|
-
this.expressionChange.emit({
|
|
67
|
-
key: this.expression.key,
|
|
68
|
-
op: event.detail.value,
|
|
69
|
-
exp: this.expression.exp,
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
this.handleValueChange = (event) => {
|
|
73
|
-
event.stopPropagation();
|
|
74
|
-
this.expressionChange.emit(Object.assign(Object.assign({}, this.expression), { exp: event.detail }));
|
|
75
|
-
};
|
|
76
|
-
this.removeExpression = () => {
|
|
77
|
-
this.expressionChange.emit(undefined);
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
render() {
|
|
81
|
-
return (h("div", { key: '668e0f05bdb1fb25ffd652ea650c34e5431a3332', class: "expression" }, this.label && h("limel-header", { key: '5034070b58afe31cf90699dd2a27f884e647f540', heading: this.label }), h("div", { key: '14a2b1270e5e6d7e158e29ebc5f61051e5670e80', class: "expression-container" }, this.renderPropertySelector(), this.renderOperator(), this.renderValueInput(), h("limel-icon-button", { key: 'b69bde6e88c40d2623ef015794db28cec3676c73', class: "remove", icon: "trash", label: "Remove condition", onClick: this.removeExpression }))));
|
|
82
|
-
}
|
|
83
|
-
renderPropertySelector() {
|
|
84
|
-
return (h("limebb-property-selector", { platform: this.platform, context: this.context, label: "Property", limetype: this.limetype, value: this.expression.key, required: true, onChange: this.handlePropertyChange }));
|
|
85
|
-
}
|
|
86
|
-
renderOperator() {
|
|
87
|
-
const operatorHasBeenSet = !!this.expression.op;
|
|
88
|
-
const options = LIME_QUERY_OPERATORS.map((op) => ({
|
|
89
|
-
text: op.label,
|
|
90
|
-
value: op.value,
|
|
91
|
-
icon: op.icon ? { name: op.icon } : undefined,
|
|
92
|
-
}));
|
|
93
|
-
const selectedOption = options.find((o) => o.value === this.expression.op);
|
|
94
|
-
return (h("limel-select", { class: "operator", label: "Operator", value: selectedOption, options: options, disabled: !operatorHasBeenSet && !this.expression.key, onChange: this.handleOperatorChange }));
|
|
95
|
-
}
|
|
96
|
-
renderValueInput() {
|
|
97
|
-
if (!this.expression.op) {
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
return (h("limebb-lime-query-value-input", { platform: this.platform, context: this.context, limetype: this.limetype, activeLimetype: this.activeLimetype, propertyPath: this.expression.key, operator: this.expression.op, value: this.expression.exp, onChange: this.handleValueChange }));
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
LimeQueryFilterComparisonComponent.style = LimebbLimeQueryFilterComparisonStyle0;
|
|
104
|
-
|
|
105
|
-
const limeQueryFilterExpressionCss = "@charset \"UTF-8\";.expression{display:flex;flex-direction:column;margin-bottom:1rem;gap:1rem}";
|
|
106
|
-
const LimebbLimeQueryFilterExpressionStyle0 = limeQueryFilterExpressionCss;
|
|
107
|
-
|
|
108
|
-
const LimeQueryFilterExpressionComponent = class {
|
|
109
|
-
constructor(hostRef) {
|
|
110
|
-
registerInstance(this, hostRef);
|
|
111
|
-
this.expressionChange = createEvent(this, "expressionChange", 7);
|
|
112
|
-
this.handleExpressionChange = (event) => {
|
|
113
|
-
event.stopPropagation();
|
|
114
|
-
this.expressionChange.emit(event.detail);
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
render() {
|
|
118
|
-
if (!this.expression) {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
const props = {
|
|
122
|
-
platform: this.platform,
|
|
123
|
-
context: this.context,
|
|
124
|
-
label: this.label,
|
|
125
|
-
limetype: this.limetype,
|
|
126
|
-
activeLimetype: this.activeLimetype,
|
|
127
|
-
};
|
|
128
|
-
if ('key' in this.expression) {
|
|
129
|
-
return (h("limebb-lime-query-filter-comparison", Object.assign({}, props, { expression: this.expression, onExpressionChange: this.handleExpressionChange })));
|
|
130
|
-
}
|
|
131
|
-
if (this.expression.op === Zt.AND ||
|
|
132
|
-
this.expression.op === Zt.OR) {
|
|
133
|
-
return (h("limebb-lime-query-filter-group", Object.assign({}, props, { expression: this.expression, onExpressionChange: this.handleExpressionChange })));
|
|
134
|
-
}
|
|
135
|
-
if (this.expression.op === Zt.NOT) {
|
|
136
|
-
return (h("limebb-lime-query-filter-not", Object.assign({}, props, { expression: this.expression, onExpressionChange: this.handleExpressionChange })));
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
LimeQueryFilterExpressionComponent.style = LimebbLimeQueryFilterExpressionStyle0;
|
|
141
|
-
|
|
142
|
-
export { LimeQueryFilterComparisonComponent as limebb_lime_query_filter_comparison, LimeQueryFilterExpressionComponent as limebb_lime_query_filter_expression };
|