@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
package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-builder.js
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { Operator, } 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 class LimeQueryFilterBuilderComponent {
|
|
17
|
+
constructor() {
|
|
18
|
+
this.handleAddFirstCondition = () => {
|
|
19
|
+
const newExpression = {
|
|
20
|
+
key: '',
|
|
21
|
+
op: Operator.EQUALS,
|
|
22
|
+
exp: '',
|
|
23
|
+
};
|
|
24
|
+
this.expressionChange.emit(newExpression);
|
|
25
|
+
};
|
|
26
|
+
this.handlePromoteAndAdd = () => {
|
|
27
|
+
if (!this.expression) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
// Wrap current expression in AND and add a new comparison
|
|
31
|
+
const newExpression = {
|
|
32
|
+
op: Operator.AND,
|
|
33
|
+
exp: [
|
|
34
|
+
this.expression,
|
|
35
|
+
{
|
|
36
|
+
key: '',
|
|
37
|
+
op: Operator.EQUALS,
|
|
38
|
+
exp: '',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
this.expressionChange.emit(newExpression);
|
|
43
|
+
};
|
|
44
|
+
this.handleExpressionChange = (event) => {
|
|
45
|
+
var _a;
|
|
46
|
+
event.stopPropagation();
|
|
47
|
+
this.expressionChange.emit((_a = event.detail) !== null && _a !== void 0 ? _a : undefined);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
render() {
|
|
51
|
+
if (!this.expression) {
|
|
52
|
+
return this.renderEmptyState();
|
|
53
|
+
}
|
|
54
|
+
// Check if we need to show promotion UI (comparison or NOT)
|
|
55
|
+
if (this.needsPromotion()) {
|
|
56
|
+
return this.renderWithPromotionButton();
|
|
57
|
+
}
|
|
58
|
+
// AND/OR groups handle their own Add buttons
|
|
59
|
+
return (h("limebb-lime-query-filter-expression", { platform: this.platform, context: this.context, limetype: this.limetype, activeLimetype: this.activeLimetype, expression: this.expression, onExpressionChange: this.handleExpressionChange }));
|
|
60
|
+
}
|
|
61
|
+
needsPromotion() {
|
|
62
|
+
if (!this.expression) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
// Basic comparison needs promotion
|
|
66
|
+
if ('key' in this.expression) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
// NOT needs promotion
|
|
70
|
+
return this.expression.op === Operator.NOT;
|
|
71
|
+
}
|
|
72
|
+
renderEmptyState() {
|
|
73
|
+
return (h("limel-button", { label: "Add a condition", icon: "plus_math", onClick: this.handleAddFirstCondition }));
|
|
74
|
+
}
|
|
75
|
+
renderWithPromotionButton() {
|
|
76
|
+
return (h("div", { class: "expression-with-promotion" }, h("limebb-lime-query-filter-expression", { platform: this.platform, context: this.context, limetype: this.limetype, activeLimetype: this.activeLimetype, expression: this.expression, onExpressionChange: this.handleExpressionChange }), h("limel-button", { label: "Add another condition", icon: "plus_math", onClick: this.handlePromoteAndAdd })));
|
|
77
|
+
}
|
|
78
|
+
static get is() { return "limebb-lime-query-filter-builder"; }
|
|
79
|
+
static get encapsulation() { return "shadow"; }
|
|
80
|
+
static get originalStyleUrls() {
|
|
81
|
+
return {
|
|
82
|
+
"$": ["lime-query-filter-builder.scss"]
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
static get styleUrls() {
|
|
86
|
+
return {
|
|
87
|
+
"$": ["lime-query-filter-builder.css"]
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
static get properties() {
|
|
91
|
+
return {
|
|
92
|
+
"platform": {
|
|
93
|
+
"type": "unknown",
|
|
94
|
+
"mutable": false,
|
|
95
|
+
"complexType": {
|
|
96
|
+
"original": "LimeWebComponentPlatform",
|
|
97
|
+
"resolved": "LimeWebComponentPlatform",
|
|
98
|
+
"references": {
|
|
99
|
+
"LimeWebComponentPlatform": {
|
|
100
|
+
"location": "import",
|
|
101
|
+
"path": "@limetech/lime-web-components",
|
|
102
|
+
"id": "node_modules::LimeWebComponentPlatform"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"required": false,
|
|
107
|
+
"optional": false,
|
|
108
|
+
"docs": {
|
|
109
|
+
"tags": [],
|
|
110
|
+
"text": "Platform service provider"
|
|
111
|
+
},
|
|
112
|
+
"getter": false,
|
|
113
|
+
"setter": false
|
|
114
|
+
},
|
|
115
|
+
"context": {
|
|
116
|
+
"type": "unknown",
|
|
117
|
+
"mutable": false,
|
|
118
|
+
"complexType": {
|
|
119
|
+
"original": "LimeWebComponentContext",
|
|
120
|
+
"resolved": "LimeWebComponentContext",
|
|
121
|
+
"references": {
|
|
122
|
+
"LimeWebComponentContext": {
|
|
123
|
+
"location": "import",
|
|
124
|
+
"path": "@limetech/lime-web-components",
|
|
125
|
+
"id": "node_modules::LimeWebComponentContext"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"required": false,
|
|
130
|
+
"optional": false,
|
|
131
|
+
"docs": {
|
|
132
|
+
"tags": [],
|
|
133
|
+
"text": "Component context"
|
|
134
|
+
},
|
|
135
|
+
"getter": false,
|
|
136
|
+
"setter": false
|
|
137
|
+
},
|
|
138
|
+
"limetype": {
|
|
139
|
+
"type": "string",
|
|
140
|
+
"mutable": false,
|
|
141
|
+
"complexType": {
|
|
142
|
+
"original": "string",
|
|
143
|
+
"resolved": "string",
|
|
144
|
+
"references": {}
|
|
145
|
+
},
|
|
146
|
+
"required": false,
|
|
147
|
+
"optional": false,
|
|
148
|
+
"docs": {
|
|
149
|
+
"tags": [],
|
|
150
|
+
"text": "The limetype being queried (e.g., \"deal\", \"company\")"
|
|
151
|
+
},
|
|
152
|
+
"getter": false,
|
|
153
|
+
"setter": false,
|
|
154
|
+
"attribute": "limetype",
|
|
155
|
+
"reflect": false
|
|
156
|
+
},
|
|
157
|
+
"activeLimetype": {
|
|
158
|
+
"type": "string",
|
|
159
|
+
"mutable": false,
|
|
160
|
+
"complexType": {
|
|
161
|
+
"original": "string",
|
|
162
|
+
"resolved": "string | undefined",
|
|
163
|
+
"references": {}
|
|
164
|
+
},
|
|
165
|
+
"required": false,
|
|
166
|
+
"optional": true,
|
|
167
|
+
"docs": {
|
|
168
|
+
"tags": [],
|
|
169
|
+
"text": "The limetype of the active object (for %activeObject% placeholders)"
|
|
170
|
+
},
|
|
171
|
+
"getter": false,
|
|
172
|
+
"setter": false,
|
|
173
|
+
"attribute": "active-limetype",
|
|
174
|
+
"reflect": false
|
|
175
|
+
},
|
|
176
|
+
"expression": {
|
|
177
|
+
"type": "unknown",
|
|
178
|
+
"mutable": false,
|
|
179
|
+
"complexType": {
|
|
180
|
+
"original": "Expression | undefined",
|
|
181
|
+
"resolved": "undefined | { key: string; op: BasicOperator; exp: ExpressionValue; } | { key: string; op: Operator.IN; exp: ExpressionValue[]; } | { op: Operator.AND | Operator.OR; exp: Expression[]; } | { op: Operator.NOT; exp: Expression; } | { type: \"filter\"; key: string; op: Operator.IN; exp: string; }",
|
|
182
|
+
"references": {
|
|
183
|
+
"Expression": {
|
|
184
|
+
"location": "import",
|
|
185
|
+
"path": "@limetech/lime-web-components",
|
|
186
|
+
"id": "node_modules::Expression"
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
"required": false,
|
|
191
|
+
"optional": false,
|
|
192
|
+
"docs": {
|
|
193
|
+
"tags": [],
|
|
194
|
+
"text": "The filter expression to build"
|
|
195
|
+
},
|
|
196
|
+
"getter": false,
|
|
197
|
+
"setter": false
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
static get events() {
|
|
202
|
+
return [{
|
|
203
|
+
"method": "expressionChange",
|
|
204
|
+
"name": "expressionChange",
|
|
205
|
+
"bubbles": true,
|
|
206
|
+
"cancelable": true,
|
|
207
|
+
"composed": true,
|
|
208
|
+
"docs": {
|
|
209
|
+
"tags": [],
|
|
210
|
+
"text": "Emitted when the filter expression changes\nEmits undefined when expression should be removed"
|
|
211
|
+
},
|
|
212
|
+
"complexType": {
|
|
213
|
+
"original": "Expression | undefined",
|
|
214
|
+
"resolved": "undefined | { key: string; op: BasicOperator; exp: ExpressionValue; } | { key: string; op: Operator.IN; exp: ExpressionValue[]; } | { op: Operator.AND | Operator.OR; exp: Expression[]; } | { op: Operator.NOT; exp: Expression; } | { type: \"filter\"; key: string; op: Operator.IN; exp: string; }",
|
|
215
|
+
"references": {
|
|
216
|
+
"Expression": {
|
|
217
|
+
"location": "import",
|
|
218
|
+
"path": "@limetech/lime-web-components",
|
|
219
|
+
"id": "node_modules::Expression"
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}];
|
|
224
|
+
}
|
|
225
|
+
}
|
|
@@ -9,7 +9,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
9
9
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
10
|
};
|
|
11
11
|
import { h } from "@stencil/core";
|
|
12
|
-
import {
|
|
12
|
+
import { SelectLimeTypes as Limetypes, } from "@limetech/lime-web-components";
|
|
13
13
|
import { isLimeQuerySupported, } from "./lime-query-validation";
|
|
14
14
|
/**
|
|
15
15
|
* Lime Query Builder Component
|
|
@@ -37,6 +37,7 @@ import { isLimeQuerySupported, } from "./lime-query-validation";
|
|
|
37
37
|
* (e.g., `%activeObject%.company` references the company of the active object).
|
|
38
38
|
*
|
|
39
39
|
* @exampleComponent limebb-example-lime-query-builder-basic
|
|
40
|
+
* @exampleComponent limebb-example-lime-query-builder-with-active-limetype
|
|
40
41
|
* @private
|
|
41
42
|
*/
|
|
42
43
|
export class LimeQueryBuilder {
|
|
@@ -44,18 +45,11 @@ export class LimeQueryBuilder {
|
|
|
44
45
|
this.mode = 'gui';
|
|
45
46
|
this.codeValue = '';
|
|
46
47
|
this.limetype = '';
|
|
47
|
-
this.filter = {
|
|
48
|
-
op: Operator.AND,
|
|
49
|
-
exp: [],
|
|
50
|
-
};
|
|
51
48
|
this.handleLimetypeChange = (event) => {
|
|
52
49
|
event.stopPropagation();
|
|
53
50
|
this.limetype = event.detail;
|
|
54
51
|
// Reset filter when limetype changes
|
|
55
|
-
this.filter =
|
|
56
|
-
op: Operator.AND,
|
|
57
|
-
exp: [],
|
|
58
|
-
};
|
|
52
|
+
this.filter = undefined;
|
|
59
53
|
// Reset response format when limetype changes
|
|
60
54
|
this.internalResponseFormat = {
|
|
61
55
|
object: {
|
|
@@ -65,17 +59,9 @@ export class LimeQueryBuilder {
|
|
|
65
59
|
this.emitChange();
|
|
66
60
|
};
|
|
67
61
|
this.handleFilterChange = (event) => {
|
|
62
|
+
var _a;
|
|
68
63
|
event.stopPropagation();
|
|
69
|
-
|
|
70
|
-
if (expression === undefined) {
|
|
71
|
-
this.filter = {
|
|
72
|
-
op: Operator.AND,
|
|
73
|
-
exp: [],
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
this.filter = expression;
|
|
78
|
-
}
|
|
64
|
+
this.filter = (_a = event.detail) !== null && _a !== void 0 ? _a : undefined;
|
|
79
65
|
this.emitChange();
|
|
80
66
|
};
|
|
81
67
|
this.handleResponseFormatChange = (event) => {
|
|
@@ -101,7 +87,7 @@ export class LimeQueryBuilder {
|
|
|
101
87
|
}
|
|
102
88
|
// Update internal state from parsed query
|
|
103
89
|
this.limetype = parsed.limetype || '';
|
|
104
|
-
this.filter =
|
|
90
|
+
this.filter = parsed.filter;
|
|
105
91
|
this.internalResponseFormat = parsed.responseFormat;
|
|
106
92
|
this.limit = parsed.limit;
|
|
107
93
|
this.mode = 'gui';
|
|
@@ -142,7 +128,7 @@ export class LimeQueryBuilder {
|
|
|
142
128
|
}
|
|
143
129
|
if (this.value) {
|
|
144
130
|
this.limetype = this.value.limetype || '';
|
|
145
|
-
this.filter = this.
|
|
131
|
+
this.filter = this.value.filter;
|
|
146
132
|
this.internalResponseFormat = this.value.responseFormat;
|
|
147
133
|
this.limit = this.value.limit;
|
|
148
134
|
}
|
|
@@ -157,26 +143,10 @@ export class LimeQueryBuilder {
|
|
|
157
143
|
render() {
|
|
158
144
|
const guiSupported = this.checkGuiSupport();
|
|
159
145
|
const showCodeMode = !this.guiModeEnabled || this.mode === 'code';
|
|
160
|
-
return (h("div", { key: '
|
|
146
|
+
return (h("div", { key: '0b4d2bb5b4d503a775d8d3215e1e4c74fdb1eceb', class: "lime-query-builder" }, this.renderLabel(), this.renderModeControls(guiSupported), showCodeMode
|
|
161
147
|
? this.renderCodeMode(guiSupported)
|
|
162
148
|
: this.renderGuiMode()));
|
|
163
149
|
}
|
|
164
|
-
/**
|
|
165
|
-
* Normalize filter to ensure top-level is an AND group.
|
|
166
|
-
* This ensures Add buttons are available in the UI.
|
|
167
|
-
* @param filter
|
|
168
|
-
*/
|
|
169
|
-
normalizeFilter(filter) {
|
|
170
|
-
if (!filter) {
|
|
171
|
-
return { op: Operator.AND, exp: [] };
|
|
172
|
-
}
|
|
173
|
-
// If it's already an AND at the top level, keep it
|
|
174
|
-
if ('op' in filter && filter.op === Operator.AND) {
|
|
175
|
-
return filter;
|
|
176
|
-
}
|
|
177
|
-
// Otherwise wrap in AND
|
|
178
|
-
return { op: Operator.AND, exp: [filter] };
|
|
179
|
-
}
|
|
180
150
|
emitChange() {
|
|
181
151
|
// Only emit in GUI mode
|
|
182
152
|
if (this.mode === 'code') {
|
|
@@ -298,7 +268,7 @@ export class LimeQueryBuilder {
|
|
|
298
268
|
if (!this.limetype) {
|
|
299
269
|
return;
|
|
300
270
|
}
|
|
301
|
-
return (h("div", { class: "filter-section" }, h("h4", { class: "section-label" }, "Filter Conditions"), h("limebb-lime-query-filter-
|
|
271
|
+
return (h("div", { class: "filter-section" }, h("h4", { class: "section-label" }, "Filter Conditions"), h("limebb-lime-query-filter-builder", { platform: this.platform, context: this.context, limetype: this.limetype, activeLimetype: this.activeLimetype, expression: this.filter, onExpressionChange: this.handleFilterChange })));
|
|
302
272
|
}
|
|
303
273
|
renderQueryOptionsSection() {
|
|
304
274
|
var _a;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { Z as Zt } from './index.esm.js';
|
|
3
|
+
import { d as defineCustomElement$6 } from './lime-query-filter-comparison.js';
|
|
4
|
+
import { d as defineCustomElement$3, a as defineCustomElement$4, b as defineCustomElement$5 } from './lime-query-filter-expression.js';
|
|
5
|
+
import { d as defineCustomElement$2 } from './lime-query-value-input.js';
|
|
6
|
+
import { d as defineCustomElement$1 } from './property-selector.js';
|
|
7
|
+
|
|
8
|
+
const limeQueryFilterBuilderCss = ".expression-with-promotion{display:flex;flex-direction:column;gap:1rem}";
|
|
9
|
+
const LimebbLimeQueryFilterBuilderStyle0 = limeQueryFilterBuilderCss;
|
|
10
|
+
|
|
11
|
+
const LimeQueryFilterBuilderComponent = /*@__PURE__*/ proxyCustomElement(class LimeQueryFilterBuilderComponent extends HTMLElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
this.__registerHost();
|
|
15
|
+
this.__attachShadow();
|
|
16
|
+
this.expressionChange = createEvent(this, "expressionChange", 7);
|
|
17
|
+
this.handleAddFirstCondition = () => {
|
|
18
|
+
const newExpression = {
|
|
19
|
+
key: '',
|
|
20
|
+
op: Zt.EQUALS,
|
|
21
|
+
exp: '',
|
|
22
|
+
};
|
|
23
|
+
this.expressionChange.emit(newExpression);
|
|
24
|
+
};
|
|
25
|
+
this.handlePromoteAndAdd = () => {
|
|
26
|
+
if (!this.expression) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
// Wrap current expression in AND and add a new comparison
|
|
30
|
+
const newExpression = {
|
|
31
|
+
op: Zt.AND,
|
|
32
|
+
exp: [
|
|
33
|
+
this.expression,
|
|
34
|
+
{
|
|
35
|
+
key: '',
|
|
36
|
+
op: Zt.EQUALS,
|
|
37
|
+
exp: '',
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
};
|
|
41
|
+
this.expressionChange.emit(newExpression);
|
|
42
|
+
};
|
|
43
|
+
this.handleExpressionChange = (event) => {
|
|
44
|
+
var _a;
|
|
45
|
+
event.stopPropagation();
|
|
46
|
+
this.expressionChange.emit((_a = event.detail) !== null && _a !== void 0 ? _a : undefined);
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
render() {
|
|
50
|
+
if (!this.expression) {
|
|
51
|
+
return this.renderEmptyState();
|
|
52
|
+
}
|
|
53
|
+
// Check if we need to show promotion UI (comparison or NOT)
|
|
54
|
+
if (this.needsPromotion()) {
|
|
55
|
+
return this.renderWithPromotionButton();
|
|
56
|
+
}
|
|
57
|
+
// AND/OR groups handle their own Add buttons
|
|
58
|
+
return (h("limebb-lime-query-filter-expression", { platform: this.platform, context: this.context, limetype: this.limetype, activeLimetype: this.activeLimetype, expression: this.expression, onExpressionChange: this.handleExpressionChange }));
|
|
59
|
+
}
|
|
60
|
+
needsPromotion() {
|
|
61
|
+
if (!this.expression) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
// Basic comparison needs promotion
|
|
65
|
+
if ('key' in this.expression) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
// NOT needs promotion
|
|
69
|
+
return this.expression.op === Zt.NOT;
|
|
70
|
+
}
|
|
71
|
+
renderEmptyState() {
|
|
72
|
+
return (h("limel-button", { label: "Add a condition", icon: "plus_math", onClick: this.handleAddFirstCondition }));
|
|
73
|
+
}
|
|
74
|
+
renderWithPromotionButton() {
|
|
75
|
+
return (h("div", { class: "expression-with-promotion" }, h("limebb-lime-query-filter-expression", { platform: this.platform, context: this.context, limetype: this.limetype, activeLimetype: this.activeLimetype, expression: this.expression, onExpressionChange: this.handleExpressionChange }), h("limel-button", { label: "Add another condition", icon: "plus_math", onClick: this.handlePromoteAndAdd })));
|
|
76
|
+
}
|
|
77
|
+
static get style() { return LimebbLimeQueryFilterBuilderStyle0; }
|
|
78
|
+
}, [1, "limebb-lime-query-filter-builder", {
|
|
79
|
+
"platform": [16],
|
|
80
|
+
"context": [16],
|
|
81
|
+
"limetype": [1],
|
|
82
|
+
"activeLimetype": [1, "active-limetype"],
|
|
83
|
+
"expression": [16]
|
|
84
|
+
}]);
|
|
85
|
+
function defineCustomElement() {
|
|
86
|
+
if (typeof customElements === "undefined") {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const components = ["limebb-lime-query-filter-builder", "limebb-lime-query-filter-comparison", "limebb-lime-query-filter-expression", "limebb-lime-query-filter-group", "limebb-lime-query-filter-not", "limebb-lime-query-value-input", "limebb-property-selector"];
|
|
90
|
+
components.forEach(tagName => { switch (tagName) {
|
|
91
|
+
case "limebb-lime-query-filter-builder":
|
|
92
|
+
if (!customElements.get(tagName)) {
|
|
93
|
+
customElements.define(tagName, LimeQueryFilterBuilderComponent);
|
|
94
|
+
}
|
|
95
|
+
break;
|
|
96
|
+
case "limebb-lime-query-filter-comparison":
|
|
97
|
+
if (!customElements.get(tagName)) {
|
|
98
|
+
defineCustomElement$6();
|
|
99
|
+
}
|
|
100
|
+
break;
|
|
101
|
+
case "limebb-lime-query-filter-expression":
|
|
102
|
+
if (!customElements.get(tagName)) {
|
|
103
|
+
defineCustomElement$5();
|
|
104
|
+
}
|
|
105
|
+
break;
|
|
106
|
+
case "limebb-lime-query-filter-group":
|
|
107
|
+
if (!customElements.get(tagName)) {
|
|
108
|
+
defineCustomElement$4();
|
|
109
|
+
}
|
|
110
|
+
break;
|
|
111
|
+
case "limebb-lime-query-filter-not":
|
|
112
|
+
if (!customElements.get(tagName)) {
|
|
113
|
+
defineCustomElement$3();
|
|
114
|
+
}
|
|
115
|
+
break;
|
|
116
|
+
case "limebb-lime-query-value-input":
|
|
117
|
+
if (!customElements.get(tagName)) {
|
|
118
|
+
defineCustomElement$2();
|
|
119
|
+
}
|
|
120
|
+
break;
|
|
121
|
+
case "limebb-property-selector":
|
|
122
|
+
if (!customElements.get(tagName)) {
|
|
123
|
+
defineCustomElement$1();
|
|
124
|
+
}
|
|
125
|
+
break;
|
|
126
|
+
} });
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export { LimeQueryFilterBuilderComponent as L, defineCustomElement as d };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import { T as Te
|
|
2
|
+
import { T as Te } from './index.esm.js';
|
|
3
3
|
import { g as getNormalizedProperties, a as getPropertyFromPath, d as defineCustomElement$4 } from './property-selector.js';
|
|
4
|
+
import { d as defineCustomElement$b } from './lime-query-filter-builder.js';
|
|
4
5
|
import { d as defineCustomElement$a } from './lime-query-filter-comparison.js';
|
|
5
6
|
import { d as defineCustomElement$7, a as defineCustomElement$8, b as defineCustomElement$9 } from './lime-query-filter-expression.js';
|
|
6
7
|
import { d as defineCustomElement$6 } from './lime-query-value-input.js';
|
|
@@ -567,18 +568,11 @@ const LimeQueryBuilder = /*@__PURE__*/ proxyCustomElement(class LimeQueryBuilder
|
|
|
567
568
|
this.mode = 'gui';
|
|
568
569
|
this.codeValue = '';
|
|
569
570
|
this.limetype = '';
|
|
570
|
-
this.filter = {
|
|
571
|
-
op: Zt.AND,
|
|
572
|
-
exp: [],
|
|
573
|
-
};
|
|
574
571
|
this.handleLimetypeChange = (event) => {
|
|
575
572
|
event.stopPropagation();
|
|
576
573
|
this.limetype = event.detail;
|
|
577
574
|
// Reset filter when limetype changes
|
|
578
|
-
this.filter =
|
|
579
|
-
op: Zt.AND,
|
|
580
|
-
exp: [],
|
|
581
|
-
};
|
|
575
|
+
this.filter = undefined;
|
|
582
576
|
// Reset response format when limetype changes
|
|
583
577
|
this.internalResponseFormat = {
|
|
584
578
|
object: {
|
|
@@ -588,17 +582,9 @@ const LimeQueryBuilder = /*@__PURE__*/ proxyCustomElement(class LimeQueryBuilder
|
|
|
588
582
|
this.emitChange();
|
|
589
583
|
};
|
|
590
584
|
this.handleFilterChange = (event) => {
|
|
585
|
+
var _a;
|
|
591
586
|
event.stopPropagation();
|
|
592
|
-
|
|
593
|
-
if (expression === undefined) {
|
|
594
|
-
this.filter = {
|
|
595
|
-
op: Zt.AND,
|
|
596
|
-
exp: [],
|
|
597
|
-
};
|
|
598
|
-
}
|
|
599
|
-
else {
|
|
600
|
-
this.filter = expression;
|
|
601
|
-
}
|
|
587
|
+
this.filter = (_a = event.detail) !== null && _a !== void 0 ? _a : undefined;
|
|
602
588
|
this.emitChange();
|
|
603
589
|
};
|
|
604
590
|
this.handleResponseFormatChange = (event) => {
|
|
@@ -624,7 +610,7 @@ const LimeQueryBuilder = /*@__PURE__*/ proxyCustomElement(class LimeQueryBuilder
|
|
|
624
610
|
}
|
|
625
611
|
// Update internal state from parsed query
|
|
626
612
|
this.limetype = parsed.limetype || '';
|
|
627
|
-
this.filter =
|
|
613
|
+
this.filter = parsed.filter;
|
|
628
614
|
this.internalResponseFormat = parsed.responseFormat;
|
|
629
615
|
this.limit = parsed.limit;
|
|
630
616
|
this.mode = 'gui';
|
|
@@ -665,7 +651,7 @@ const LimeQueryBuilder = /*@__PURE__*/ proxyCustomElement(class LimeQueryBuilder
|
|
|
665
651
|
}
|
|
666
652
|
if (this.value) {
|
|
667
653
|
this.limetype = this.value.limetype || '';
|
|
668
|
-
this.filter = this.
|
|
654
|
+
this.filter = this.value.filter;
|
|
669
655
|
this.internalResponseFormat = this.value.responseFormat;
|
|
670
656
|
this.limit = this.value.limit;
|
|
671
657
|
}
|
|
@@ -680,26 +666,10 @@ const LimeQueryBuilder = /*@__PURE__*/ proxyCustomElement(class LimeQueryBuilder
|
|
|
680
666
|
render() {
|
|
681
667
|
const guiSupported = this.checkGuiSupport();
|
|
682
668
|
const showCodeMode = !this.guiModeEnabled || this.mode === 'code';
|
|
683
|
-
return (h("div", { key: '
|
|
669
|
+
return (h("div", { key: '0b4d2bb5b4d503a775d8d3215e1e4c74fdb1eceb', class: "lime-query-builder" }, this.renderLabel(), this.renderModeControls(guiSupported), showCodeMode
|
|
684
670
|
? this.renderCodeMode(guiSupported)
|
|
685
671
|
: this.renderGuiMode()));
|
|
686
672
|
}
|
|
687
|
-
/**
|
|
688
|
-
* Normalize filter to ensure top-level is an AND group.
|
|
689
|
-
* This ensures Add buttons are available in the UI.
|
|
690
|
-
* @param filter
|
|
691
|
-
*/
|
|
692
|
-
normalizeFilter(filter) {
|
|
693
|
-
if (!filter) {
|
|
694
|
-
return { op: Zt.AND, exp: [] };
|
|
695
|
-
}
|
|
696
|
-
// If it's already an AND at the top level, keep it
|
|
697
|
-
if ('op' in filter && filter.op === Zt.AND) {
|
|
698
|
-
return filter;
|
|
699
|
-
}
|
|
700
|
-
// Otherwise wrap in AND
|
|
701
|
-
return { op: Zt.AND, exp: [filter] };
|
|
702
|
-
}
|
|
703
673
|
emitChange() {
|
|
704
674
|
// Only emit in GUI mode
|
|
705
675
|
if (this.mode === 'code') {
|
|
@@ -821,7 +791,7 @@ const LimeQueryBuilder = /*@__PURE__*/ proxyCustomElement(class LimeQueryBuilder
|
|
|
821
791
|
if (!this.limetype) {
|
|
822
792
|
return;
|
|
823
793
|
}
|
|
824
|
-
return (h("div", { class: "filter-section" }, h("h4", { class: "section-label" }, "Filter Conditions"), h("limebb-lime-query-filter-
|
|
794
|
+
return (h("div", { class: "filter-section" }, h("h4", { class: "section-label" }, "Filter Conditions"), h("limebb-lime-query-filter-builder", { platform: this.platform, context: this.context, limetype: this.limetype, activeLimetype: this.activeLimetype, expression: this.filter, onExpressionChange: this.handleFilterChange })));
|
|
825
795
|
}
|
|
826
796
|
renderQueryOptionsSection() {
|
|
827
797
|
var _a;
|
|
@@ -870,13 +840,18 @@ function defineCustomElement$1() {
|
|
|
870
840
|
if (typeof customElements === "undefined") {
|
|
871
841
|
return;
|
|
872
842
|
}
|
|
873
|
-
const components = ["limebb-lime-query-builder", "limebb-lime-query-filter-comparison", "limebb-lime-query-filter-expression", "limebb-lime-query-filter-group", "limebb-lime-query-filter-not", "limebb-lime-query-value-input", "limebb-limetype-field", "limebb-property-selector", "limebb-response-format-editor", "limebb-response-format-item"];
|
|
843
|
+
const components = ["limebb-lime-query-builder", "limebb-lime-query-filter-builder", "limebb-lime-query-filter-comparison", "limebb-lime-query-filter-expression", "limebb-lime-query-filter-group", "limebb-lime-query-filter-not", "limebb-lime-query-value-input", "limebb-limetype-field", "limebb-property-selector", "limebb-response-format-editor", "limebb-response-format-item"];
|
|
874
844
|
components.forEach(tagName => { switch (tagName) {
|
|
875
845
|
case "limebb-lime-query-builder":
|
|
876
846
|
if (!customElements.get(tagName)) {
|
|
877
847
|
customElements.define(tagName, LimeQueryBuilder);
|
|
878
848
|
}
|
|
879
849
|
break;
|
|
850
|
+
case "limebb-lime-query-filter-builder":
|
|
851
|
+
if (!customElements.get(tagName)) {
|
|
852
|
+
defineCustomElement$b();
|
|
853
|
+
}
|
|
854
|
+
break;
|
|
880
855
|
case "limebb-lime-query-filter-comparison":
|
|
881
856
|
if (!customElements.get(tagName)) {
|
|
882
857
|
defineCustomElement$a();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface LimebbLimeQueryFilterBuilder extends Components.LimebbLimeQueryFilterBuilder, HTMLElement {}
|
|
4
|
+
export const LimebbLimeQueryFilterBuilder: {
|
|
5
|
+
prototype: LimebbLimeQueryFilterBuilder;
|
|
6
|
+
new (): LimebbLimeQueryFilterBuilder;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { L as LimeQueryFilterBuilderComponent, d as defineCustomElement$1 } from './lime-query-filter-builder.js';
|
|
2
|
+
|
|
3
|
+
const LimebbLimeQueryFilterBuilder = LimeQueryFilterBuilderComponent;
|
|
4
|
+
const defineCustomElement = defineCustomElement$1;
|
|
5
|
+
|
|
6
|
+
export { LimebbLimeQueryFilterBuilder, defineCustomElement };
|