@limetech/lime-crm-building-blocks 1.99.0 → 1.100.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/lime-crm-building-blocks.cjs.js +1 -1
- package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +52 -216
- package/dist/cjs/{limebb-limetype-field_2.cjs.entry.js → limebb-lime-query-filter-builder_3.cjs.entry.js} +72 -1
- package/dist/cjs/limebb-lime-query-filter-comparison_2.cjs.entry.js +1 -1
- package/dist/cjs/{limebb-lime-query-filter-group_4.cjs.entry.js → limebb-lime-query-filter-group_3.cjs.entry.js} +5 -231
- package/dist/cjs/limebb-live-docs-info.cjs.entry.js +2 -2
- package/dist/cjs/limebb-locale-picker.cjs.entry.js +1 -1
- package/dist/cjs/limebb-mention-group-counter.cjs.entry.js +2 -2
- package/dist/cjs/limebb-navigation-button_2.cjs.entry.js +3 -3
- package/dist/cjs/limebb-notification-item.cjs.entry.js +1 -1
- package/dist/cjs/limebb-percentage-visualizer.cjs.entry.js +2 -2
- package/dist/cjs/limebb-property-selector.cjs.entry.js +234 -0
- package/dist/cjs/limebb-text-editor.cjs.entry.js +1 -1
- package/dist/cjs/limebb-trend-indicator.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -2
- 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-and.js → lime-query-filter-builder.js} +59 -83
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison.js +1 -1
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-group.js +1 -1
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-not.js +1 -1
- package/dist/collection/components/lime-query-builder/expressions/lime-query-value-input.js +7 -7
- package/dist/collection/components/lime-query-builder/lime-query-builder.js +9 -39
- package/dist/collection/components/lime-query-builder/lime-query-validation.js +46 -19
- package/dist/collection/components/lime-query-builder/lime-query.types.js +1 -57
- package/dist/collection/components/lime-query-builder/limetype-field/limetype-field.js +1 -1
- package/dist/collection/components/limeobject/file-viewer/live-docs-info.js +2 -2
- package/dist/collection/components/locale-picker/locale-picker.js +1 -1
- package/dist/collection/components/notification-list/notification-item/notification-item.js +1 -1
- package/dist/collection/components/percentage-visualizer/percentage-visualizer.js +2 -2
- package/dist/collection/components/summary-popover/summary-popover.js +3 -3
- package/dist/collection/components/text-editor/mention-group-counter.js +2 -2
- package/dist/collection/components/text-editor/text-editor.js +1 -1
- package/dist/collection/components/trend-indicator/trend-indicator.js +1 -1
- package/dist/components/lime-query-filter-builder.js +129 -0
- package/dist/components/lime-query-filter-comparison.js +1 -1
- package/dist/components/lime-query-filter-expression.js +2 -2
- package/dist/components/lime-query-value-input.js +2 -2
- package/dist/components/limebb-lime-query-builder.js +60 -218
- 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/components/limebb-locale-picker.js +1 -1
- package/dist/components/limebb-mention-group-counter.js +2 -2
- package/dist/components/limebb-percentage-visualizer.js +2 -2
- package/dist/components/limebb-text-editor.js +1 -1
- package/dist/components/limebb-trend-indicator.js +1 -1
- package/dist/components/limetype-field.js +1 -1
- package/dist/components/live-docs-info.js +2 -2
- package/dist/components/notification-item.js +1 -1
- package/dist/components/summary-popover.js +3 -3
- package/dist/esm/lime-crm-building-blocks.js +1 -1
- package/dist/esm/limebb-lime-query-builder.entry.js +53 -217
- package/dist/esm/{limebb-limetype-field_2.entry.js → limebb-lime-query-filter-builder_3.entry.js} +73 -3
- package/dist/esm/limebb-lime-query-filter-comparison_2.entry.js +1 -1
- package/dist/esm/{limebb-lime-query-filter-group_4.entry.js → limebb-lime-query-filter-group_3.entry.js} +7 -232
- package/dist/esm/limebb-live-docs-info.entry.js +2 -2
- package/dist/esm/limebb-locale-picker.entry.js +1 -1
- package/dist/esm/limebb-mention-group-counter.entry.js +2 -2
- package/dist/esm/limebb-navigation-button_2.entry.js +3 -3
- package/dist/esm/limebb-notification-item.entry.js +1 -1
- package/dist/esm/limebb-percentage-visualizer.entry.js +2 -2
- package/dist/esm/limebb-property-selector.entry.js +230 -0
- package/dist/esm/limebb-text-editor.entry.js +1 -1
- package/dist/esm/limebb-trend-indicator.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
- package/dist/lime-crm-building-blocks/{p-b9b954d9.entry.js → p-1034b4a5.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-93cadc1e.entry.js → p-2048ac67.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-323c49bc.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-631ca5a5.entry.js → p-58782467.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-aa646df7.entry.js → p-6aa216ec.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-9cac4de2.entry.js → p-76d81eee.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-e8946134.entry.js → p-79b8b09b.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-569c86b5.entry.js → p-8581245a.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-89a6c396.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-36ea13c0.entry.js → p-8fb2e192.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-3122ea05.entry.js → p-b57dafef.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-f22b66f6.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-f79e354b.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/expressions/lime-query-value-input.d.ts +2 -3
- package/dist/types/components/lime-query-builder/lime-query-builder.d.ts +1 -6
- package/dist/types/components/lime-query-builder/lime-query.types.d.ts +0 -72
- package/dist/types/components.d.ts +58 -198
- package/package.json +1 -1
- package/dist/cjs/limebb-lime-query-filter-and.cjs.entry.js +0 -80
- package/dist/cjs/limebb-lime-query-filter-or.cjs.entry.js +0 -68
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-and.css +0 -121
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-or.css +0 -123
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-or.js +0 -237
- package/dist/collection/components/lime-query-builder/filter-conversion.js +0 -255
- package/dist/components/limebb-lime-query-filter-and.d.ts +0 -11
- package/dist/components/limebb-lime-query-filter-and.js +0 -135
- package/dist/components/limebb-lime-query-filter-or.d.ts +0 -11
- package/dist/components/limebb-lime-query-filter-or.js +0 -123
- package/dist/esm/limebb-lime-query-filter-and.entry.js +0 -76
- package/dist/esm/limebb-lime-query-filter-or.entry.js +0 -64
- 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-67dbaa4c.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-91732502.entry.js +0 -1
- package/dist/types/components/lime-query-builder/expressions/lime-query-filter-and.d.ts +0 -57
- package/dist/types/components/lime-query-builder/expressions/lime-query-filter-or.d.ts +0 -56
- package/dist/types/components/lime-query-builder/filter-conversion.d.ts +0 -31
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,h as r,H as
|
|
1
|
+
import{r as o,h as r,H as e}from"./p-1556b545.js";import{g as t}from"./p-10e16feb.js";const a=class{valueChanged(o){this.numValue=this.parseValue(o)}constructor(e){o(this,e),this.suffix="%",this.reducePresence=!0,this.labelId="a"+crypto.randomUUID(),this.tooltipId="a"+crypto.randomUUID(),this.helperTextId="a"+crypto.randomUUID(),this.renderHelperLine=()=>{if(this.hasHelperText())return r("limel-helper-line",{helperTextId:this.helperTextId,helperText:this.helperText,invalid:this.invalid})},this.hasHelperText=()=>null!=this.helperText,this.numValue=this.parseValue(this.value)}render(){return r(e,{key:"33119aa80ea39fbe4ad0fd7da3c89d844efd7bd6",class:this.getContainerClassList()},r("limel-notched-outline",{key:"9357919d89ea26063f9c0bbf85a48e3e235364c7",id:this.tooltipId,label:this.label,labelId:this.labelId,invalid:this.invalid,required:this.required,hasValue:!0,hasFloatingLabel:!0,"aria-labelledby":this.labelId,"aria-describedby":this.helperTextId,"aria-controls":this.helperTextId},r("div",{key:"b29c00421943e45fed684e63dfebf895686f6d45",slot:"content",tabIndex:0},this.renderVisualization())),this.renderHelperLine(),this.renderTooltip())}renderVisualization(){if(!this.reducePresence||0!==this.numValue&&this.hasValue())return this.hasValue()?[this.getArrowIcon(),r("span",null,this.renderGrowthPercentage(),this.renderGrowthAmount())]:r("span",{class:"no-value"},"–")}renderTooltip(){if(void 0===this.formerValue)return;const o=`${this.value} - ${this.formerValue>0?this.formerValue:"("+this.formerValue+")"} = ${this.calculateGrowth()} ${this.suffix} `,e=this.calculatePercentage();return r("limel-tooltip",{openDirection:"top-start",elementId:this.tooltipId,label:e+"%",helperLabel:o})}renderGrowthPercentage(){if(void 0===this.formerValue)return this.formatValue(this.numValue,this.suffix);const o=this.calculatePercentage();return null!==o?this.formatValue(o,"%"):void 0}renderGrowthAmount(){if(void 0===this.formerValue)return;const o=this.calculateGrowth();return r("span",{class:"growth-unit"},"( ",this.formatValue(o,this.suffix)," )")}hasValue(){return null!=this.value&&""!==this.value}getContainerClassList(){if(!this.hasValue())return;const o=this.getPercentage(),r=t(o);return Object.assign({},r&&{[r]:!0})}getPercentage(){return void 0===this.formerValue?this.numValue:this.calculatePercentage()}calculateGrowth(){return this.numValue-this.formerValue}calculatePercentage(){if(0===this.formerValue)return null;const o=((this.numValue-this.formerValue)/Math.abs(this.formerValue)*100).toFixed(2);return Number.parseFloat(o)}unifyMinusSign(o){return o.replaceAll("−","-")}convertToUnicodeMinus(o){return o.replaceAll("-","−")}parseValue(o){return"string"==typeof o?Number.parseFloat(this.unifyMinusSign(o)):o}formatValue(o,r){const e=`${o} ${r}`;return o>0?"+"+e:this.convertToUnicodeMinus(e)}getArrowIcon(){return r("limel-icon",{class:"icon",name:"right","aria-hidden":"true",role:"presentation"})}static get watchers(){return{value:["valueChanged"]}}};a.style='@charset "UTF-8";*{box-sizing:border-box}:host(limebb-trend-indicator){position:relative;display:block;height:100%;width:100%}limel-notched-outline:not([invalid]:not([invalid=false])) .limel-notched-outline--outlines{--limel-notched-outline-border-color:transparent}div[slot=content]{display:flex;align-items:center;gap:0.5rem;border-radius:inherit;background-color:transparent !important}div[slot=content]:focus{outline:none}div[slot=content]:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}:host(limebb-trend-indicator):has(label) div[slot=content]{min-height:2.5rem;padding:0 0.375rem 0 1rem}:host(limebb-trend-indicator[former-value]) div[slot=content]{cursor:help}div[slot=content] span{flex-shrink:0}.icon{flex-shrink:0;display:flex;transition-property:color, background-color, transform;transition-duration:0.4s;transition-timing-function:ease;width:1.25rem;height:1.25rem;border-radius:50%;padding:0.12rem;color:rgb(var(--color-white));background-color:rgb(var(--color-gray-default), 0.5)}:host(.has-value-40to30-negative) .icon{color:rgb(var(--color-gray-darker))}:host(.has-value-30to20-negative) .icon{color:rgb(var(--color-gray-darker))}:host(.has-value-20to10-negative) .icon{color:rgb(var(--color-gray-darker))}:host(.has-value-10to0-negative) .icon{color:rgb(var(--color-gray-darker))}:host(.has-value-0to10-positive) .icon{color:rgb(var(--color-gray-dark))}:host(.has-value-10to20-positive) .icon{color:rgb(var(--color-gray-dark))}:host(.has-value-20to30-positive) .icon{color:rgb(var(--color-gray-dark))}:host(.has-value-30to40-positive) .icon{color:rgb(var(--color-gray-dark))}:host(.has-value-200or-larger-negative) .icon{background-color:rgb(var(--color-red-darker));transform:rotate(90deg)}:host(.has-value-200to100-negative) .icon{background-color:rgb(var(--color-red-dark));transform:rotate(90deg)}:host(.has-value-100to90-negative) .icon{background-color:rgb(var(--color-red-dark));transform:rotate(90deg)}:host(.has-value-90to80-negative) .icon{background-color:rgb(var(--color-red-dark));transform:rotate(81deg)}:host(.has-value-80to70-negative) .icon{background-color:rgb(var(--color-red-default));transform:rotate(72deg)}:host(.has-value-70to60-negative) .icon{background-color:rgb(var(--color-red-default));transform:rotate(63deg)}:host(.has-value-60to50-negative) .icon{background-color:rgb(var(--color-coral-default));transform:rotate(54deg)}:host(.has-value-50to40-negative) .icon{background-color:rgb(var(--color-coral-default));transform:rotate(45deg)}:host(.has-value-40to30-negative) .icon{background-color:rgb(var(--color-orange-default));transform:rotate(36deg)}:host(.has-value-30to20-negative) .icon{background-color:rgb(var(--color-orange-default));transform:rotate(27deg)}:host(.has-value-20to10-negative) .icon{background-color:rgb(var(--color-amber-default));transform:rotate(18deg)}:host(.has-value-10to0-negative) .icon{background-color:rgb(var(--color-amber-default));transform:rotate(9deg)}:host(.has-value-0) .icon{background-color:rgb(var(--color-gray-default));transform:rotate(0deg)}:host(.has-value-0to10-positive) .icon{background-color:rgb(var(--color-yellow-default));transform:rotate(-9deg)}:host(.has-value-10to20-positive) .icon{background-color:rgb(var(--color-yellow-default));transform:rotate(-18deg)}:host(.has-value-20to30-positive) .icon{background-color:rgb(var(--color-grass-default));transform:rotate(-27deg)}:host(.has-value-30to40-positive) .icon{background-color:rgb(var(--color-grass-default));transform:rotate(-36deg)}:host(.has-value-40to50-positive) .icon{background-color:rgb(var(--color-lime-default));transform:rotate(-45deg)}:host(.has-value-50to60-positive) .icon{background-color:rgb(var(--color-lime-default));transform:rotate(-54deg)}:host(.has-value-60to70-positive) .icon{background-color:rgb(var(--color-teal-default));transform:rotate(-63deg)}:host(.has-value-70to80-positive) .icon{background-color:rgb(var(--color-teal-default));transform:rotate(-72deg)}:host(.has-value-80to90-positive) .icon{background-color:rgb(var(--color-teal-dark));transform:rotate(-81deg)}:host(.has-value-90to100-positive) .icon{background-color:rgb(var(--color-teal-dark));transform:rotate(-90deg)}:host(.has-value-100to200-positive) .icon{background-color:rgb(var(--color-teal-dark));transform:rotate(-90deg)}:host(.has-value-200or-larger-positive) .icon{background-color:rgb(var(--color-teal-darker));transform:rotate(-90deg)}:host(.has-value-0) .icon{background-color:rgb(var(--color-gray-default), 0.5);transform:rotate(0deg)}:host(.has-value-0) .icon polyline{color:transparent}:host(.has-value-200or-larger-negative) .icon:after,:host(.has-value-200or-larger-negative) .icon:before,:host(.has-value-200to100-negative) .icon:after,:host(.has-value-200to100-negative) .icon:before,:host(.has-value-100to200-positive) .icon:after,:host(.has-value-100to200-positive) .icon:before,:host(.has-value-200or-larger-positive) .icon:after,:host(.has-value-200or-larger-positive) .icon:before{transition:border-color 0.6s ease;content:"";position:absolute;inset:0;margin:auto;border:1px solid transparent;border-radius:50%}:host(.has-value-200or-larger-negative) .icon:before,:host(.has-value-200to100-negative) .icon:before,:host(.has-value-100to200-positive) .icon:before,:host(.has-value-200or-larger-positive) .icon:before{transform:scale(1.2)}:host(.has-value-200or-larger-negative) .icon:after,:host(.has-value-200to100-negative) .icon:after,:host(.has-value-100to200-positive) .icon:after,:host(.has-value-200or-larger-positive) .icon:after{transform:scale(1.4);opacity:0.4}:host(.has-value-200to100-negative) .icon:before,:host(.has-value-200or-larger-negative) .icon:before{border-color:rgb(var(--color-red-dark))}:host(.has-value-200or-larger-negative) .icon:after{border-color:rgb(var(--color-red-darker))}:host(.has-value-100to200-positive) .icon:before,:host(.has-value-200or-larger-positive) .icon:before{border-color:rgb(var(--color-teal-dark))}:host(.has-value-200or-larger-positive) .icon:after{border-color:rgb(var(--color-teal-darker))}.no-value{transform:translateY(0.5rem)}.growth-unit{padding-left:0.5rem;opacity:0.5}:host(limebb-trend-indicator:focus),:host(limebb-trend-indicator:focus-visible),:host(limebb-trend-indicator:focus-within){--limel-h-l-grid-template-rows-transition-speed:0.46s;--limel-h-l-grid-template-rows:1fr}:host(limebb-trend-indicator){--limel-h-l-grid-template-rows-transition-speed:0.3s;--limel-h-l-grid-template-rows:0fr}:host(limebb-trend-indicator:focus) limel-helper-line,:host(limebb-trend-indicator:focus-visible) limel-helper-line,:host(limebb-trend-indicator:focus-within) limel-helper-line,:host(limebb-trend-indicator:hover) limel-helper-line{will-change:grid-template-rows}';export{a as limebb_trend_indicator}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as i,h as e}from"./p-1556b545.js";import{Z as r,T as o}from"./p-4838284a.js";import{g as n,a as s}from"./p-e0ab1554.js";const l=new Set(["$yesterday","$now","$today","$tomorrow","$this_week","$this_month","$this_quarter","$this_year"]),a=/^\$(previous|next)_(day|week|month|quarter|year)\(\d+\)$/,d=/^\$me(\.\w+)*$/;function c(t,i,e=!0){const r=Object.keys(t),o=[];if(e){const t=r.filter((t=>t.startsWith("#")&&"#description"!==t));t.length>0&&o.push(`Property '${i}' contains # properties not supported in GUI: ${t.join(", ")}`)}return{keys:r.filter((t=>"_alias"!==t&&!t.startsWith("#"))),guiLimitations:o}}function u(t,i,e,r,o,n=!0){if(""===t){if(n&&null!==i)throw new Error("Empty property name must have null value");return[]}const s=e[t];if(!s)throw new Error(`Property '${t}' does not exist on limetype '${o}'`);return s.relation?function(t,i,e,r,o=!0){if(null===i)return[];if("object"!=typeof i)throw new TypeError(`Relation property '${t}' must be null or an object`);const n=i,{keys:s,guiLimitations:l}=c(n,t,o);if(0===s.length)return l;const a=r.relation.getLimetype();if(!a)throw new Error(`Could not determine related limetype for property '${t}'`);const d={};for(const t of s)d[t]=n[t];const u=h(d,e,a.name,o);return[...l,...u]}(t,i,r,s,n):function(t,i,e=!0){if(null===i)return[];if("object"==typeof i){const{keys:r,guiLimitations:o}=c(i,t,e);if(0===r.length)return o;throw new Error(`Non-relation property '${t}' cannot have nested properties other than _alias or # properties (got: ${r.join(", ")})`)}throw new Error(`Non-relation property '${t}' must be null or an object (got ${typeof i})`)}(t,i,n)}function h(t,i,e,r=!0){const o=i[e];if(!o)throw new Error(`Unknown limetype: ${e}`);const s=n(o),l=[];for(const[o,n]of Object.entries(t)){if(o.startsWith("#"))continue;const t=u(o,n,s,i,e,r);l.push(...t)}return l}function m(t,i,e,o=!0){t&&("key"in t?function(t,i,e){if(!Object.values(r).includes(t.op))throw new Error(`Unsupported filter operator: ${t.op}`);const o=function(t,i,e){if(function(t){return"string"==typeof t&&(l.has(t)||a.test(t)||d.test(t))}(t))return{valid:!0};if("string"!=typeof t||!t.startsWith("%activeObject%"))return{valid:!0};if(!i)return{valid:!0};const r=t.replace(/^%activeObject%\.?/,"");if(!r)return{valid:!0};try{return s(e,i,r)?{valid:!0}:{valid:!1,error:`Property path '${r}' does not exist on limetype '${i}'`}}catch(t){return{valid:!1,error:`Invalid placeholder path: ${t.message}`}}}(t.exp,i,e);if(!o.valid)throw new Error(`Invalid placeholder in filter '${t.key}': ${o.error}`)}(t,i,e):"exp"in t&&function(t,i,e,o){if(t.op!==r.AND&&t.op!==r.OR&&t.op!==r.NOT)throw new Error(`Unsupported group operator: ${t.op}`);if(t.op===r.NOT)m(t.exp,i,e,o);else if(t.op===r.AND||t.op===r.OR){const r=t.exp;for(const t of r)m(t,i,e,o)}}(t,i,e,o))}function p(t,i,e,r=!0){if(!t)return{valid:!0,guiSupported:!0,validationErrors:[],guiLimitations:[]};const o=[],n=[];if(t.limetype&&!i[t.limetype]&&o.push(`Unknown limetype: ${t.limetype}`),void 0===t.offset||t.orderBy||o.push("offset requires orderBy to be specified"),r&&(t.orderBy&&n.push("orderBy is not yet supported in GUI mode"),void 0!==t.offset&&n.push("offset is not yet supported in GUI mode")),t.filter){const n=function(t,i,e,r){const o=[];try{m(t,i,e,r)}catch(t){o.push(`Invalid filter: ${t.message}`)}return o}(t.filter,e,i,r);o.push(...n)}if(t.responseFormat){const{errors:e,limitations:s}=function(t,i,e,r){const o=[],n=[];try{const o=function(t,i,e,r=!0){const o=[];if(r&&t.aggregates&&o.push("responseFormat.aggregates is not yet supported in GUI mode"),t.object){const n=h(t.object,i,e,r);o.push(...n)}return o}(t,i,e,r);n.push(...o)}catch(t){o.push(`Invalid responseFormat: ${t.message}`)}return{errors:o,limitations:n}}(t.responseFormat,i,t.limetype,r);o.push(...e),n.push(...s)}return{valid:0===o.length,guiSupported:0===n.length,validationErrors:o,guiLimitations:n}}const f=class{constructor(e){t(this,e),this.change=i(this,"change",7),this.mode="gui",this.codeValue="",this.limetype="",this.handleLimetypeChange=t=>{t.stopPropagation(),this.limetype=t.detail,this.filter=void 0,this.internalResponseFormat={object:{_id:null}},this.emitChange()},this.handleFilterChange=t=>{var i;t.stopPropagation(),this.filter=null!==(i=t.detail)&&void 0!==i?i:void 0,this.emitChange()},this.handleResponseFormatChange=t=>{t.stopPropagation(),this.internalResponseFormat=t.detail,this.emitChange()},this.handleLimitChange=t=>{t.stopPropagation();const i=t.detail;this.limit=i?Number.parseInt(i,10):void 0,this.emitChange()},this.switchToGui=()=>{try{const t=JSON.parse(this.codeValue);if(!this.checkGuiSupport().guiSupported)return;this.limetype=t.limetype||"",this.filter=t.filter,this.internalResponseFormat=t.responseFormat,this.limit=t.limit,this.mode="gui",this.change.emit(t)}catch(t){}},this.switchToCode=()=>{this.updateCodeValue(),this.mode="code"},this.handleCodeChange=t=>{t.stopPropagation(),this.codeValue=t.detail;try{const t=JSON.parse(this.codeValue);this.change.emit(t)}catch(t){}}}get guiModeEnabled(){var t,i,e;return null!==(e=null===(i=null===(t=this.platform)||void 0===t?void 0:t.isFeatureEnabled)||void 0===i?void 0:i.call(t,"useLimeQueryBuilderGuiMode"))&&void 0!==e&&e}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 t=this.checkGuiSupport(),i=!this.guiModeEnabled||"code"===this.mode;return e("div",{key:"0b4d2bb5b4d503a775d8d3215e1e4c74fdb1eceb",class:"lime-query-builder"},this.renderLabel(),this.renderModeControls(t),i?this.renderCodeMode(t):this.renderGuiMode())}emitChange(){if("code"===this.mode)return;if(!this.limetype)return;const t={limetype:this.limetype,responseFormat:this.internalResponseFormat||{object:{_id:null}},filter:this.filter};void 0!==this.limit&&this.limit>0&&(t.limit=this.limit),this.change.emit(t)}updateCodeValue(){if(!this.limetype)return void(this.codeValue=JSON.stringify(this.value||{},null,2));const t={limetype:this.limetype,responseFormat:this.internalResponseFormat||{object:{_id:null}},filter:this.filter};void 0!==this.limit&&this.limit>0&&(t.limit=this.limit),this.codeValue=JSON.stringify(t,null,2)}checkGuiSupport(){if(!this.limetypes)return{valid:!0,guiSupported:!0,validationErrors:[],guiLimitations:[]};let t;if("code"===this.mode&&this.codeValue)try{t=JSON.parse(this.codeValue)}catch(t){return{valid:!1,guiSupported:!1,validationErrors:["Invalid JSON"],guiLimitations:[]}}else{if(!this.limetype)return{valid:!0,guiSupported:!0,validationErrors:[],guiLimitations:[]};t={limetype:this.limetype,responseFormat:this.internalResponseFormat||{object:{_id:null}},filter:this.filter},void 0!==this.limit&&this.limit>0&&(t.limit=this.limit)}return p(t,this.limetypes,this.activeLimetype,this.guiModeEnabled)}renderModeSwitch(t){return e("div",{class:"mode-switch"},e("limel-button",{label:"GUI",primary:"gui"===this.mode,disabled:!t.guiSupported,onClick:this.switchToGui}),e("limel-button",{label:"Code",primary:"code"===this.mode,onClick:this.switchToCode}))}renderCodeEditor(t){return e("div",{class:"code-editor-container"},e("limel-code-editor",{value:this.codeValue,language:"json",lineNumbers:!0,fold:!0,lint:!0,onChange:this.handleCodeChange}),!t.valid&&t.validationErrors.length>0&&e("div",{class:"validation-errors"},e("strong",null,"Invalid Lime Query:"),e("ul",null,t.validationErrors.map((t=>e("li",null,t))))),this.guiModeEnabled&&t.valid&&!t.guiSupported&&t.guiLimitations.length>0&&e("div",{class:"gui-limitations"},e("strong",null,"Cannot switch to GUI mode:"),e("ul",null,t.guiLimitations.map((t=>e("li",null,t))))))}renderLimetypeSection(){return e("div",{class:"limetype-section"},e("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 e("div",{class:"response-format-section"},e("limebb-response-format-editor",{platform:this.platform,context:this.context,limetype:this.limetype,value:this.internalResponseFormat,onChange:this.handleResponseFormatChange}))}renderFilterSection(){if(this.limetype)return e("div",{class:"filter-section"},e("h4",{class:"section-label"},"Filter Conditions"),e("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 t;if(this.limetype)return e("div",{class:"query-options-section"},e("h4",{class:"section-label"},"Query Options"),e("div",{class:"query-options-controls"},e("limel-input-field",{label:"Limit",type:"number",value:(null===(t=this.limit)||void 0===t?void 0:t.toString())||"",placeholder:"No limit",helperText:"Maximum number of results",onChange:this.handleLimitChange})))}renderGuiMode(){return e("div",{class:"gui-mode"},this.renderLimetypeSection(),this.renderResponseFormatSection(),this.renderFilterSection(),this.renderQueryOptionsSection())}renderLabel(){if(this.label)return e("h3",{class:"lime-query-builder-label"},this.label)}renderModeControls(t){if(this.guiModeEnabled)return e("div",{class:"mode-controls"},this.renderModeSwitch(t))}renderCodeMode(t){return e("div",{class:"code-mode"},this.renderCodeEditor(t))}};(function(t,i,e,r){var o,n=arguments.length,s=n<3?i:null===r?r=Object.getOwnPropertyDescriptor(i,e):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,i,e,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(s=(n<3?o(s):n>3?o(i,e,s):o(i,e))||s);n>3&&s&&Object.defineProperty(i,e,s)})([o()],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 @@
|
|
|
1
|
+
import{r as t,c as i,h as s}from"./p-1556b545.js";import{T as e}from"./p-4838284a.js";import{a as o,g as r}from"./p-e0ab1554.js";const n=class{constructor(s){t(this,s),this.change=i(this,"change",7),this.label="Property",this.required=!1,this.isOpen=!1,this.navigationPath="",this.menuItems=[],this.handleChipSetWrapperClick=t=>{t.stopPropagation()},this.handleChipSetFocus=()=>{this.isOpen||(this.navigationPath=this.value||"",this.loadMenuItems(),this.isOpen=!0)},this.handleSelect=t=>{t.stopPropagation();const i=t.detail.value;if(!i)return;const s=o(this.limetypes,this.limetype,i);(null==s?void 0:s.relation)?this.navigationPath=i:(this.change.emit(i),this.isOpen=!1,this.navigationPath="")},this.handleNavigateMenu=t=>{var i;t.stopPropagation(),(null===(i=t.detail)||void 0===i?void 0:i.value)&&(this.navigationPath=t.detail.value)},this.handleCancel=()=>{this.isOpen=!1,this.navigationPath=""},this.handleChipSetChange=t=>{t.stopPropagation();const i=t.detail;if(!i)return this.change.emit(""),void(this.navigationPath="");const s=Array.isArray(i)?i:[i];if(0===s.length)this.change.emit(""),this.navigationPath="";else{const t=s.at(-1);t&&this.change.emit(t.value),this.navigationPath=""}}}render(){if(!this.limetype||!this.limetypes)return null;const t=this.getChipsForPath(this.navigationPath||this.value||"");return s("limel-menu",{items:this.menuItems,open:this.isOpen,emptyResultMessage:"No available properties",surfaceWidth:"inherit-from-trigger",openDirection:"bottom-end",onSelect:this.handleSelect,onNavigateMenu:this.handleNavigateMenu,onCancel:this.handleCancel},s("div",{slot:"trigger"},s("div",{onClick:this.handleChipSetWrapperClick},s("limel-chip-set",{type:"input",label:this.label,value:t,required:this.required,helperText:this.helperText,delimiter:"›",maxItems:1,onChange:this.handleChipSetChange,onFocus:this.handleChipSetFocus}))))}loadMenuItems(){const t=this.getCurrentLimetype();this.menuItems=t?this.createMenuItems(t,""):[]}getCurrentLimetype(){if(!this.navigationPath)return this.limetypes[this.limetype];const t=o(this.limetypes,this.limetype,this.navigationPath);return(null==t?void 0:t.relation)?t.relation.getLimetype():this.limetypes[this.limetype]}createMenuItems(t,i){const s=[];if(!t)return s;const e=r(t);for(const[t,o]of Object.entries(e)){if("hasmany"===o.type||"hasandbelongstomany"===o.type)continue;const e=i?`${i}.${t}`:t;let r;if(o.relation&&o.relation){const t=o.relation.getLimetype();t&&(r=async()=>this.createMenuItems(t,e))}s.push({text:o.localname||t,secondaryText:this.getSecondaryText(o),icon:this.getIconForProperty(o),value:e,items:r})}return 0===s.length?[{text:"No available properties",value:"",disabled:!0}]:s}getSecondaryText(t){var i;if(t.relation){const s=t.relation.getLimetype();return(null===(i=null==s?void 0:s.localname)||void 0===i?void 0:i.singular)||"Object"}return t.type.charAt(0).toUpperCase()+t.type.slice(1)}getIconForProperty(t){return t.relation?{name:"link",color:"rgb(var(--color-sky-default))"}:{name:"decision",color:"rgb(var(--color-gray-default))"}}getChipsForPath(t){if(!t)return[];const i=t.split("."),s=[];let e=this.limetypes[this.limetype],o="";for(const t of i){o=o?`${o}.${t}`:t;const i=r(e)[t];i&&(s.push({id:o,text:i.localname||t,icon:this.getIconForProperty(i),value:o}),i.relation&&(e=i.relation.getLimetype()))}return s}};(function(t,i,s,e){var o,r=arguments.length,n=r<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,s):e;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,i,s,e);else for(var h=t.length-1;h>=0;h--)(o=t[h])&&(n=(r<3?o(n):r>3?o(i,s,n):o(i,s))||n);r>3&&n&&Object.defineProperty(i,s,n)})([e()],n.prototype,"limetypes",void 0),n.style=":host(limebb-property-selector){display:block}limel-menu{display:block;width:100%}";export{n as limebb_property_selector}
|
|
@@ -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
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from '../../../stencil-public-runtime';
|
|
2
|
-
import { LimeWebComponentContext, LimeWebComponentPlatform } from '@limetech/lime-web-components';
|
|
3
|
-
import { FilterOperator } from '../lime-query.types';
|
|
2
|
+
import { LimeWebComponentContext, LimeWebComponentPlatform, Operator } from '@limetech/lime-web-components';
|
|
4
3
|
/**
|
|
5
4
|
* Query Value Input Component
|
|
6
5
|
*
|
|
@@ -49,7 +48,7 @@ export declare class LimeQueryValueInput {
|
|
|
49
48
|
/**
|
|
50
49
|
* The operator being used
|
|
51
50
|
*/
|
|
52
|
-
operator:
|
|
51
|
+
operator: Operator;
|
|
53
52
|
/**
|
|
54
53
|
* The current value
|
|
55
54
|
*/
|
|
@@ -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;
|
|
@@ -59,39 +59,6 @@ export interface AggregateOperationWithKey {
|
|
|
59
59
|
op: 'GROUP' | 'SUM' | 'AVG' | 'MAX' | 'MIN';
|
|
60
60
|
key: string;
|
|
61
61
|
}
|
|
62
|
-
/**
|
|
63
|
-
* Filter expression for simple comparisons
|
|
64
|
-
* Example: { "key": "dealstatus", "op": "=", "exp": "won" }
|
|
65
|
-
*/
|
|
66
|
-
export interface FilterExpression {
|
|
67
|
-
key: string;
|
|
68
|
-
op: FilterOperator;
|
|
69
|
-
exp: any;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Filter operators supported by Lime Query
|
|
73
|
-
*/
|
|
74
|
-
export type FilterOperator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'IN' | '?' | '=?' | '=$';
|
|
75
|
-
/**
|
|
76
|
-
* Filter group for combining multiple expressions
|
|
77
|
-
* Examples:
|
|
78
|
-
* - AND: { "op": "AND", "exp": [expr1, expr2] }
|
|
79
|
-
* - OR: { "op": "OR", "exp": [expr1, expr2] }
|
|
80
|
-
* - NOT: { "op": "!", "exp": expr }
|
|
81
|
-
*/
|
|
82
|
-
export type FilterGroup = FilterGroupAnd | FilterGroupOr | FilterGroupNot;
|
|
83
|
-
export interface FilterGroupAnd {
|
|
84
|
-
op: 'AND';
|
|
85
|
-
exp: (FilterExpression | FilterGroup)[];
|
|
86
|
-
}
|
|
87
|
-
export interface FilterGroupOr {
|
|
88
|
-
op: 'OR';
|
|
89
|
-
exp: (FilterExpression | FilterGroup)[];
|
|
90
|
-
}
|
|
91
|
-
export interface FilterGroupNot {
|
|
92
|
-
op: '!';
|
|
93
|
-
exp: FilterExpression | FilterGroup;
|
|
94
|
-
}
|
|
95
62
|
/**
|
|
96
63
|
* Order by specification
|
|
97
64
|
* Example: { "company.name": "ASC" }
|
|
@@ -99,43 +66,4 @@ export interface FilterGroupNot {
|
|
|
99
66
|
export type OrderByItem = {
|
|
100
67
|
[propertyPath: string]: 'ASC' | 'DESC';
|
|
101
68
|
};
|
|
102
|
-
/**
|
|
103
|
-
* Simplified filter representation for UI components
|
|
104
|
-
* Mirrors the structure used in automations but adapted for Lime Query
|
|
105
|
-
*/
|
|
106
|
-
export type LimeQueryFilterExpression = LimeQueryFilterAnd | LimeQueryFilterOr | LimeQueryFilterNot | LimeQueryFilterComparison | LimeQueryFilterMissing;
|
|
107
|
-
export interface LimeQueryFilterAnd {
|
|
108
|
-
filter_type: 'AND';
|
|
109
|
-
expressions: LimeQueryFilterExpression[];
|
|
110
|
-
}
|
|
111
|
-
export interface LimeQueryFilterOr {
|
|
112
|
-
filter_type: 'OR';
|
|
113
|
-
expressions: LimeQueryFilterExpression[];
|
|
114
|
-
}
|
|
115
|
-
export interface LimeQueryFilterNot {
|
|
116
|
-
filter_type: 'NOT';
|
|
117
|
-
expression: LimeQueryFilterExpression;
|
|
118
|
-
}
|
|
119
|
-
export interface LimeQueryFilterComparison {
|
|
120
|
-
filter_type: 'comparison';
|
|
121
|
-
property: string;
|
|
122
|
-
operator: FilterOperator;
|
|
123
|
-
value: any;
|
|
124
|
-
}
|
|
125
|
-
export interface LimeQueryFilterMissing {
|
|
126
|
-
filter_type: '';
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Metadata for operator display in UI
|
|
130
|
-
*/
|
|
131
|
-
export interface OperatorMetadata {
|
|
132
|
-
value: FilterOperator;
|
|
133
|
-
label: string;
|
|
134
|
-
icon?: string;
|
|
135
|
-
applicableTypes?: string[];
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Available operators with display metadata
|
|
139
|
-
*/
|
|
140
|
-
export declare const LIME_QUERY_OPERATORS: OperatorMetadata[];
|
|
141
69
|
//# sourceMappingURL=lime-query.types.d.ts.map
|