@limetech/lime-crm-building-blocks 1.100.0 → 1.101.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/lime-crm-building-blocks.cjs.js +1 -1
- package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +177 -204
- package/dist/cjs/{limebb-lime-query-filter-builder_3.cjs.entry.js → limebb-lime-query-filter-builder_4.cjs.entry.js} +86 -1
- package/dist/cjs/limebb-lime-query-filter-comparison_2.cjs.entry.js +147 -0
- package/dist/cjs/{limebb-lime-query-filter-comparison_5.cjs.entry.js → limebb-lime-query-filter-group_3.cjs.entry.js} +5 -333
- package/dist/cjs/limebb-lime-query-order-by-item.cjs.entry.js +51 -0
- package/dist/cjs/limebb-live-docs-info.cjs.entry.js +2 -2
- package/dist/cjs/limebb-locale-picker.cjs.entry.js +1 -1
- package/dist/cjs/limebb-mention-group-counter.cjs.entry.js +2 -2
- package/dist/cjs/limebb-navigation-button_2.cjs.entry.js +3 -3
- package/dist/cjs/limebb-notification-item.cjs.entry.js +1 -1
- package/dist/cjs/limebb-percentage-visualizer.cjs.entry.js +2 -2
- package/dist/cjs/limebb-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 +2 -2
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison.js +1 -1
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-group.js +1 -1
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-not.js +1 -1
- package/dist/collection/components/lime-query-builder/expressions/lime-query-value-input.js +7 -7
- package/dist/collection/components/lime-query-builder/lime-query-builder.css +2 -5
- package/dist/collection/components/lime-query-builder/lime-query-builder.js +19 -19
- package/dist/collection/components/lime-query-builder/lime-query-validation.js +160 -26
- 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/lime-query-builder/order-by/order-by-editor.css +72 -0
- package/dist/collection/components/lime-query-builder/order-by/order-by-editor.js +252 -0
- package/dist/collection/components/lime-query-builder/order-by/order-by-item.css +45 -0
- package/dist/collection/components/lime-query-builder/order-by/order-by-item.js +173 -0
- package/dist/collection/components/limeobject/file-viewer/live-docs-info.js +2 -2
- package/dist/collection/components/locale-picker/locale-picker.js +1 -1
- package/dist/collection/components/notification-list/notification-item/notification-item.js +1 -1
- package/dist/collection/components/percentage-visualizer/percentage-visualizer.js +2 -2
- package/dist/collection/components/summary-popover/summary-popover.js +3 -3
- package/dist/collection/components/text-editor/mention-group-counter.js +2 -2
- package/dist/collection/components/text-editor/text-editor.js +1 -1
- package/dist/collection/components/trend-indicator/trend-indicator.js +1 -1
- package/dist/components/lime-query-filter-comparison.js +1 -1
- package/dist/components/lime-query-filter-expression.js +2 -2
- package/dist/components/lime-query-value-input.js +3 -3
- package/dist/components/limebb-lime-query-builder.js +201 -215
- package/dist/components/limebb-lime-query-order-by-editor.d.ts +11 -0
- package/dist/components/limebb-lime-query-order-by-editor.js +6 -0
- package/dist/components/limebb-lime-query-order-by-item.d.ts +11 -0
- package/dist/components/limebb-lime-query-order-by-item.js +6 -0
- package/dist/components/limebb-locale-picker.js +1 -1
- package/dist/components/limebb-mention-group-counter.js +2 -2
- package/dist/components/limebb-percentage-visualizer.js +2 -2
- package/dist/components/limebb-text-editor.js +1 -1
- package/dist/components/limebb-trend-indicator.js +1 -1
- package/dist/components/limetype-field.js +1 -1
- package/dist/components/live-docs-info.js +2 -2
- package/dist/components/notification-item.js +1 -1
- package/dist/components/order-by-editor.js +123 -0
- package/dist/components/order-by-item.js +73 -0
- package/dist/components/property-selector.js +1 -1
- package/dist/components/summary-popover.js +3 -3
- package/dist/esm/lime-crm-building-blocks.js +1 -1
- package/dist/esm/limebb-lime-query-builder.entry.js +179 -206
- package/dist/esm/{limebb-lime-query-filter-builder_3.entry.js → limebb-lime-query-filter-builder_4.entry.js} +86 -2
- package/dist/esm/limebb-lime-query-filter-comparison_2.entry.js +142 -0
- package/dist/esm/{limebb-lime-query-filter-comparison_5.entry.js → limebb-lime-query-filter-group_3.entry.js} +7 -333
- package/dist/esm/limebb-lime-query-order-by-item.entry.js +47 -0
- package/dist/esm/limebb-live-docs-info.entry.js +2 -2
- package/dist/esm/limebb-locale-picker.entry.js +1 -1
- package/dist/esm/limebb-mention-group-counter.entry.js +2 -2
- package/dist/esm/limebb-navigation-button_2.entry.js +3 -3
- package/dist/esm/limebb-notification-item.entry.js +1 -1
- package/dist/esm/limebb-percentage-visualizer.entry.js +2 -2
- package/dist/esm/limebb-property-selector.entry.js +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/esm/{property-resolution-fde2375e.js → property-resolution-c21a1369.js} +1 -1
- package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
- package/dist/lime-crm-building-blocks/{p-631ca5a5.entry.js → p-0cd036ed.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-2725671e.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-9cac4de2.entry.js → p-425eaba2.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-e8946134.entry.js → p-5cf4898d.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-67c174d0.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-6aa216ec.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-93cadc1e.entry.js → p-8601eab5.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-b9b954d9.entry.js → p-8c2fb1c9.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-3122ea05.entry.js → p-92dfc5f8.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-569c86b5.entry.js → p-a1ee8990.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-abfc7815.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-e0ab1554.js → p-b748c770.js} +1 -1
- package/dist/lime-crm-building-blocks/p-ccf34631.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-36ea13c0.entry.js → p-d84874dc.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-f9efca1d.entry.js +1 -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 +9 -6
- package/dist/types/components/lime-query-builder/lime-query.types.d.ts +0 -72
- package/dist/types/components/lime-query-builder/order-by/order-by-editor.d.ts +58 -0
- package/dist/types/components/lime-query-builder/order-by/order-by-item.d.ts +37 -0
- package/dist/types/components.d.ts +165 -205
- 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-expression.cjs.entry.js +0 -45
- 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-and.js +0 -249
- 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-expression.entry.js +0 -41
- package/dist/esm/limebb-lime-query-filter-or.entry.js +0 -64
- package/dist/lime-crm-building-blocks/p-24aeb928.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-422f6d51.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-67dbaa4c.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-6d119dab.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-91732502.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-b198194a.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,237 +0,0 @@
|
|
|
1
|
-
import { h } from "@stencil/core";
|
|
2
|
-
import { Operator, } from "@limetech/lime-web-components";
|
|
3
|
-
/**
|
|
4
|
-
* Lime Query Filter OR Component
|
|
5
|
-
*
|
|
6
|
-
* Renders a group of filter expressions where **at least one condition must be true**.
|
|
7
|
-
* Users can add multiple alternative expressions, and a record only needs to match
|
|
8
|
-
* one of them to be included in the result set.
|
|
9
|
-
*
|
|
10
|
-
* This component displays:
|
|
11
|
-
* - A header with "Any of these conditions is true" when there are multiple conditions
|
|
12
|
-
* - A list of child expressions (which can be comparisons or nested AND/OR/NOT groups)
|
|
13
|
-
* - An "Add alternative" button to add more options
|
|
14
|
-
*
|
|
15
|
-
* Clicking the trash icon on a child expression removes it from the OR group.
|
|
16
|
-
*
|
|
17
|
-
* @private
|
|
18
|
-
*/
|
|
19
|
-
export class LimeQueryFilterOrComponent {
|
|
20
|
-
constructor() {
|
|
21
|
-
this.renderChildExpression = (expression, childIndex) => {
|
|
22
|
-
const label = this.expression.exp.length === 1 ? this.label : undefined;
|
|
23
|
-
return (h("li", null, h("limebb-lime-query-filter-expression", { platform: this.platform, context: this.context, label: label, limetype: this.limetype, activeLimetype: this.activeLimetype, expression: expression, onExpressionChange: this.handleExpressionChange(childIndex) })));
|
|
24
|
-
};
|
|
25
|
-
this.handleExpressionChange = (updatedChildIndex) => (event) => {
|
|
26
|
-
var _a;
|
|
27
|
-
event.stopPropagation();
|
|
28
|
-
const updatedExpression = (_a = event.detail) !== null && _a !== void 0 ? _a : undefined;
|
|
29
|
-
const expressions = [...this.expression.exp];
|
|
30
|
-
if (updatedExpression === undefined) {
|
|
31
|
-
expressions.splice(updatedChildIndex, 1);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
expressions[updatedChildIndex] = updatedExpression;
|
|
35
|
-
}
|
|
36
|
-
if (expressions.length === 0) {
|
|
37
|
-
this.expressionChange.emit(undefined);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (expressions.length === 1) {
|
|
41
|
-
this.expressionChange.emit(expressions[0]);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
this.expressionChange.emit({
|
|
45
|
-
op: Operator.OR,
|
|
46
|
-
exp: expressions,
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
this.handleAddChildExpression = () => {
|
|
50
|
-
const newComparison = {
|
|
51
|
-
key: '',
|
|
52
|
-
op: Operator.EQUALS,
|
|
53
|
-
exp: '',
|
|
54
|
-
};
|
|
55
|
-
const updatedExpressionsList = [
|
|
56
|
-
...this.expression.exp,
|
|
57
|
-
newComparison,
|
|
58
|
-
];
|
|
59
|
-
this.expressionChange.emit({
|
|
60
|
-
op: Operator.OR,
|
|
61
|
-
exp: updatedExpressionsList,
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
render() {
|
|
66
|
-
return (h("div", { key: '8efd3bba832388365d89313ebc007514fd3478e0', class: "expression" }, this.expression.exp.length > 1 && (h("limel-header", { key: 'eb65924d2e9b7e0e4e47f769b3af76773ae98266', heading: this.label, subheading: "Any of these conditions is true" })), h("ul", { key: 'cc6a4c9d7532096f054e9e20d54e67d14d45a038' }, this.expression.exp.map(this.renderChildExpression), h("li", { key: 'ad876db1e6435657d2263351b75ae4acb3a6a234', class: "add-button" }, this.renderAddChildExpression()))));
|
|
67
|
-
}
|
|
68
|
-
renderAddChildExpression() {
|
|
69
|
-
return (h("limel-icon-button", { label: "Add alternative", icon: "plus_math", onClick: this.handleAddChildExpression }));
|
|
70
|
-
}
|
|
71
|
-
static get is() { return "limebb-lime-query-filter-or"; }
|
|
72
|
-
static get encapsulation() { return "shadow"; }
|
|
73
|
-
static get originalStyleUrls() {
|
|
74
|
-
return {
|
|
75
|
-
"$": ["lime-query-filter-or.scss"]
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
static get styleUrls() {
|
|
79
|
-
return {
|
|
80
|
-
"$": ["lime-query-filter-or.css"]
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
static get properties() {
|
|
84
|
-
return {
|
|
85
|
-
"platform": {
|
|
86
|
-
"type": "unknown",
|
|
87
|
-
"mutable": false,
|
|
88
|
-
"complexType": {
|
|
89
|
-
"original": "LimeWebComponentPlatform",
|
|
90
|
-
"resolved": "LimeWebComponentPlatform",
|
|
91
|
-
"references": {
|
|
92
|
-
"LimeWebComponentPlatform": {
|
|
93
|
-
"location": "import",
|
|
94
|
-
"path": "@limetech/lime-web-components",
|
|
95
|
-
"id": "node_modules::LimeWebComponentPlatform"
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
"required": false,
|
|
100
|
-
"optional": false,
|
|
101
|
-
"docs": {
|
|
102
|
-
"tags": [],
|
|
103
|
-
"text": "Platform service provider"
|
|
104
|
-
},
|
|
105
|
-
"getter": false,
|
|
106
|
-
"setter": false
|
|
107
|
-
},
|
|
108
|
-
"context": {
|
|
109
|
-
"type": "unknown",
|
|
110
|
-
"mutable": false,
|
|
111
|
-
"complexType": {
|
|
112
|
-
"original": "LimeWebComponentContext",
|
|
113
|
-
"resolved": "LimeWebComponentContext",
|
|
114
|
-
"references": {
|
|
115
|
-
"LimeWebComponentContext": {
|
|
116
|
-
"location": "import",
|
|
117
|
-
"path": "@limetech/lime-web-components",
|
|
118
|
-
"id": "node_modules::LimeWebComponentContext"
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
"required": false,
|
|
123
|
-
"optional": false,
|
|
124
|
-
"docs": {
|
|
125
|
-
"tags": [],
|
|
126
|
-
"text": "Component context"
|
|
127
|
-
},
|
|
128
|
-
"getter": false,
|
|
129
|
-
"setter": false
|
|
130
|
-
},
|
|
131
|
-
"label": {
|
|
132
|
-
"type": "string",
|
|
133
|
-
"mutable": false,
|
|
134
|
-
"complexType": {
|
|
135
|
-
"original": "string",
|
|
136
|
-
"resolved": "string",
|
|
137
|
-
"references": {}
|
|
138
|
-
},
|
|
139
|
-
"required": false,
|
|
140
|
-
"optional": false,
|
|
141
|
-
"docs": {
|
|
142
|
-
"tags": [],
|
|
143
|
-
"text": "Optional label for the OR group"
|
|
144
|
-
},
|
|
145
|
-
"getter": false,
|
|
146
|
-
"setter": false,
|
|
147
|
-
"attribute": "label",
|
|
148
|
-
"reflect": false
|
|
149
|
-
},
|
|
150
|
-
"limetype": {
|
|
151
|
-
"type": "string",
|
|
152
|
-
"mutable": false,
|
|
153
|
-
"complexType": {
|
|
154
|
-
"original": "string",
|
|
155
|
-
"resolved": "string",
|
|
156
|
-
"references": {}
|
|
157
|
-
},
|
|
158
|
-
"required": false,
|
|
159
|
-
"optional": false,
|
|
160
|
-
"docs": {
|
|
161
|
-
"tags": [],
|
|
162
|
-
"text": "The limetype being queried (e.g., \"deal\", \"company\")"
|
|
163
|
-
},
|
|
164
|
-
"getter": false,
|
|
165
|
-
"setter": false,
|
|
166
|
-
"attribute": "limetype",
|
|
167
|
-
"reflect": false
|
|
168
|
-
},
|
|
169
|
-
"activeLimetype": {
|
|
170
|
-
"type": "string",
|
|
171
|
-
"mutable": false,
|
|
172
|
-
"complexType": {
|
|
173
|
-
"original": "string",
|
|
174
|
-
"resolved": "string | undefined",
|
|
175
|
-
"references": {}
|
|
176
|
-
},
|
|
177
|
-
"required": false,
|
|
178
|
-
"optional": true,
|
|
179
|
-
"docs": {
|
|
180
|
-
"tags": [],
|
|
181
|
-
"text": "The limetype of the active object (for %activeObject% placeholders)"
|
|
182
|
-
},
|
|
183
|
-
"getter": false,
|
|
184
|
-
"setter": false,
|
|
185
|
-
"attribute": "active-limetype",
|
|
186
|
-
"reflect": false
|
|
187
|
-
},
|
|
188
|
-
"expression": {
|
|
189
|
-
"type": "unknown",
|
|
190
|
-
"mutable": false,
|
|
191
|
-
"complexType": {
|
|
192
|
-
"original": "AndOrExpression",
|
|
193
|
-
"resolved": "{ op: Operator.AND | Operator.OR; exp: Expression[]; }",
|
|
194
|
-
"references": {
|
|
195
|
-
"AndOrExpression": {
|
|
196
|
-
"location": "import",
|
|
197
|
-
"path": "@limetech/lime-web-components",
|
|
198
|
-
"id": "node_modules::AndOrExpression"
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
"required": false,
|
|
203
|
-
"optional": false,
|
|
204
|
-
"docs": {
|
|
205
|
-
"tags": [],
|
|
206
|
-
"text": "The OR expression containing child expressions"
|
|
207
|
-
},
|
|
208
|
-
"getter": false,
|
|
209
|
-
"setter": false
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
static get events() {
|
|
214
|
-
return [{
|
|
215
|
-
"method": "expressionChange",
|
|
216
|
-
"name": "expressionChange",
|
|
217
|
-
"bubbles": true,
|
|
218
|
-
"cancelable": true,
|
|
219
|
-
"composed": true,
|
|
220
|
-
"docs": {
|
|
221
|
-
"tags": [],
|
|
222
|
-
"text": "Emitted when the OR expression changes (expressions added/removed/modified)\nEmits undefined when expression should be removed\nCan emit any Expression type when unwrapping (single child)"
|
|
223
|
-
},
|
|
224
|
-
"complexType": {
|
|
225
|
-
"original": "Expression | undefined",
|
|
226
|
-
"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; }",
|
|
227
|
-
"references": {
|
|
228
|
-
"Expression": {
|
|
229
|
-
"location": "import",
|
|
230
|
-
"path": "@limetech/lime-web-components",
|
|
231
|
-
"id": "node_modules::Expression"
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}];
|
|
236
|
-
}
|
|
237
|
-
}
|
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
import { LIME_QUERY_OPERATORS, } from "./lime-query.types";
|
|
2
|
-
/**
|
|
3
|
-
* Convert UI filter representation to Lime Query filter format
|
|
4
|
-
* @param filter
|
|
5
|
-
*/
|
|
6
|
-
export function guiFilterToLimeQuery(filter) {
|
|
7
|
-
if (filter.filter_type === '') {
|
|
8
|
-
return undefined;
|
|
9
|
-
}
|
|
10
|
-
if (filter.filter_type === 'comparison') {
|
|
11
|
-
return {
|
|
12
|
-
key: filter.property,
|
|
13
|
-
op: filter.operator,
|
|
14
|
-
exp: filter.value,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
if (filter.filter_type === 'AND') {
|
|
18
|
-
const expressions = filter.expressions
|
|
19
|
-
.map(guiFilterToLimeQuery)
|
|
20
|
-
.filter((f) => f !== undefined);
|
|
21
|
-
if (expressions.length === 0) {
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
if (expressions.length === 1) {
|
|
25
|
-
return expressions[0];
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
op: 'AND',
|
|
29
|
-
exp: expressions,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
if (filter.filter_type === 'OR') {
|
|
33
|
-
const expressions = filter.expressions
|
|
34
|
-
.map(guiFilterToLimeQuery)
|
|
35
|
-
.filter((f) => f !== undefined);
|
|
36
|
-
if (expressions.length === 0) {
|
|
37
|
-
return undefined;
|
|
38
|
-
}
|
|
39
|
-
if (expressions.length === 1) {
|
|
40
|
-
return expressions[0];
|
|
41
|
-
}
|
|
42
|
-
return {
|
|
43
|
-
op: 'OR',
|
|
44
|
-
exp: expressions,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
if (filter.filter_type === 'NOT') {
|
|
48
|
-
const innerFilter = guiFilterToLimeQuery(filter.expression);
|
|
49
|
-
if (innerFilter) {
|
|
50
|
-
return {
|
|
51
|
-
op: '!',
|
|
52
|
-
exp: innerFilter,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return undefined;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Validate and convert a FilterExpression (comparison filter)
|
|
60
|
-
* @param filter
|
|
61
|
-
*/
|
|
62
|
-
function validateAndConvertFilterExpression(filter) {
|
|
63
|
-
// Validate required properties exist
|
|
64
|
-
if (!('op' in filter) || !('exp' in filter)) {
|
|
65
|
-
throw new Error('Invalid filter: comparison must have key, op, and exp properties');
|
|
66
|
-
}
|
|
67
|
-
// Validate operator is supported
|
|
68
|
-
const supportedOps = LIME_QUERY_OPERATORS.map((o) => o.value);
|
|
69
|
-
if (!supportedOps.includes(filter.op)) {
|
|
70
|
-
throw new Error(`Unsupported filter operator: ${filter.op}`);
|
|
71
|
-
}
|
|
72
|
-
// Check for unexpected properties
|
|
73
|
-
// Note: 'type' property is allowed for filter references
|
|
74
|
-
const knownProps = new Set(['key', 'op', 'exp', 'type']);
|
|
75
|
-
const unexpectedProps = Object.keys(filter).filter((k) => !knownProps.has(k));
|
|
76
|
-
if (unexpectedProps.length > 0) {
|
|
77
|
-
throw new Error(`Unexpected properties in filter comparison: ${unexpectedProps.join(', ')}`);
|
|
78
|
-
}
|
|
79
|
-
return {
|
|
80
|
-
filter_type: 'comparison',
|
|
81
|
-
property: filter.key,
|
|
82
|
-
operator: filter.op,
|
|
83
|
-
value: filter.exp,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Validate and convert a FilterGroup (AND/OR/NOT filter)
|
|
88
|
-
* @param filter
|
|
89
|
-
*/
|
|
90
|
-
function validateAndConvertFilterGroup(filter) {
|
|
91
|
-
// Validate it has 'op' property
|
|
92
|
-
if (!('op' in filter)) {
|
|
93
|
-
throw new Error('Invalid filter: filter group must have op property');
|
|
94
|
-
}
|
|
95
|
-
// Validate it has 'exp' property
|
|
96
|
-
if (!('exp' in filter)) {
|
|
97
|
-
throw new Error('Invalid filter: filter group must have exp property');
|
|
98
|
-
}
|
|
99
|
-
// Check for unexpected properties in filter groups
|
|
100
|
-
const knownGroupProps = new Set(['op', 'exp']);
|
|
101
|
-
const unexpectedGroupProps = Object.keys(filter).filter((k) => !knownGroupProps.has(k));
|
|
102
|
-
if (unexpectedGroupProps.length > 0) {
|
|
103
|
-
throw new Error(`Unexpected properties in filter group: ${unexpectedGroupProps.join(', ')}`);
|
|
104
|
-
}
|
|
105
|
-
if (filter.op === '!') {
|
|
106
|
-
// NOT filter: exp should be a single expression (not array)
|
|
107
|
-
if (Array.isArray(filter.exp)) {
|
|
108
|
-
throw new TypeError('Invalid NOT filter: exp should be a single expression, not an array');
|
|
109
|
-
}
|
|
110
|
-
return {
|
|
111
|
-
filter_type: 'NOT',
|
|
112
|
-
expression: limeQueryToGuiFilter(filter.exp),
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
if (filter.op === 'AND') {
|
|
116
|
-
// AND filter: exp should be an array
|
|
117
|
-
if (!Array.isArray(filter.exp)) {
|
|
118
|
-
throw new TypeError('Invalid AND filter: exp must be an array');
|
|
119
|
-
}
|
|
120
|
-
return {
|
|
121
|
-
filter_type: 'AND',
|
|
122
|
-
expressions: filter.exp.map(limeQueryToGuiFilter),
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
if (filter.op === 'OR') {
|
|
126
|
-
// OR filter: exp should be an array
|
|
127
|
-
if (!Array.isArray(filter.exp)) {
|
|
128
|
-
throw new TypeError('Invalid OR filter: exp must be an array');
|
|
129
|
-
}
|
|
130
|
-
return {
|
|
131
|
-
filter_type: 'OR',
|
|
132
|
-
expressions: filter.exp.map(limeQueryToGuiFilter),
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
// If we reach here, the operator is unsupported
|
|
136
|
-
throw new Error(`Unsupported filter operator: ${filter.op}`);
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Convert Lime Query filter to UI filter representation
|
|
140
|
-
* Throws errors for unsupported filter structures
|
|
141
|
-
* @param filter
|
|
142
|
-
*/
|
|
143
|
-
export function limeQueryToGuiFilter(filter) {
|
|
144
|
-
if (!filter) {
|
|
145
|
-
// Return empty AND instead of missing expression
|
|
146
|
-
// This ensures users see the "Add a condition" button
|
|
147
|
-
return {
|
|
148
|
-
filter_type: 'AND',
|
|
149
|
-
expressions: [],
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
// Check if it's a FilterExpression (has 'key' property)
|
|
153
|
-
if ('key' in filter) {
|
|
154
|
-
return validateAndConvertFilterExpression(filter);
|
|
155
|
-
}
|
|
156
|
-
// It's a FilterGroup
|
|
157
|
-
return validateAndConvertFilterGroup(filter);
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Normalize filter for GUI mode by ensuring proper AND/OR wrapper structure.
|
|
161
|
-
* GUI mode requires filters to be wrapped in AND([OR(...)]) so users have
|
|
162
|
-
* access to add/remove buttons on the AND and OR components.
|
|
163
|
-
*
|
|
164
|
-
* This function ensures that:
|
|
165
|
-
* - Single comparisons are wrapped in AND([OR([comparison])])
|
|
166
|
-
* - OR groups are wrapped in AND([OR group])
|
|
167
|
-
* - AND groups have their comparison children wrapped in OR
|
|
168
|
-
* - Empty/undefined filters become AND([])
|
|
169
|
-
*
|
|
170
|
-
* When converting back to Lime Query JSON, limeQueryFilterToLimeQuery()
|
|
171
|
-
* automatically unwraps single-item AND/OR groups.
|
|
172
|
-
*
|
|
173
|
-
* @param filter The filter expression from limeQueryToLimeQueryFilter
|
|
174
|
-
* @returns Normalized filter suitable for GUI editing
|
|
175
|
-
*/
|
|
176
|
-
export function normalizeLimeQueryFilterForGui(filter) {
|
|
177
|
-
// Empty AND is already correct for GUI
|
|
178
|
-
if (filter.filter_type === 'AND' && filter.expressions.length === 0) {
|
|
179
|
-
return filter;
|
|
180
|
-
}
|
|
181
|
-
// Single comparison needs wrapping
|
|
182
|
-
if (filter.filter_type === 'comparison') {
|
|
183
|
-
return {
|
|
184
|
-
filter_type: 'AND',
|
|
185
|
-
expressions: [
|
|
186
|
-
{
|
|
187
|
-
filter_type: 'OR',
|
|
188
|
-
expressions: [filter],
|
|
189
|
-
},
|
|
190
|
-
],
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
// OR needs wrapping in AND
|
|
194
|
-
if (filter.filter_type === 'OR') {
|
|
195
|
-
return {
|
|
196
|
-
filter_type: 'AND',
|
|
197
|
-
expressions: [filter],
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
// NOT needs wrapping
|
|
201
|
-
if (filter.filter_type === 'NOT') {
|
|
202
|
-
return {
|
|
203
|
-
filter_type: 'AND',
|
|
204
|
-
expressions: [
|
|
205
|
-
{
|
|
206
|
-
filter_type: 'OR',
|
|
207
|
-
expressions: [filter],
|
|
208
|
-
},
|
|
209
|
-
],
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
// AND group - check if children need OR wrappers
|
|
213
|
-
if (filter.filter_type === 'AND') {
|
|
214
|
-
const normalizedChildren = filter.expressions.map((child) => {
|
|
215
|
-
// If child is already OR, keep it
|
|
216
|
-
if (child.filter_type === 'OR') {
|
|
217
|
-
return child;
|
|
218
|
-
}
|
|
219
|
-
// If child is NOT, keep it (NOT can be a direct child of AND)
|
|
220
|
-
if (child.filter_type === 'NOT') {
|
|
221
|
-
return child;
|
|
222
|
-
}
|
|
223
|
-
// If child is comparison, wrap in OR
|
|
224
|
-
if (child.filter_type === 'comparison') {
|
|
225
|
-
return {
|
|
226
|
-
filter_type: 'OR',
|
|
227
|
-
expressions: [child],
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
// If child is nested AND, recursively normalize and wrap in OR
|
|
231
|
-
if (child.filter_type === 'AND') {
|
|
232
|
-
return {
|
|
233
|
-
filter_type: 'OR',
|
|
234
|
-
expressions: [normalizeLimeQueryFilterForGui(child)],
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
// Unknown filter type, keep as is
|
|
238
|
-
return child;
|
|
239
|
-
});
|
|
240
|
-
return {
|
|
241
|
-
filter_type: 'AND',
|
|
242
|
-
expressions: normalizedChildren,
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
// Fallback: wrap in AND/OR structure
|
|
246
|
-
return {
|
|
247
|
-
filter_type: 'AND',
|
|
248
|
-
expressions: [
|
|
249
|
-
{
|
|
250
|
-
filter_type: 'OR',
|
|
251
|
-
expressions: [filter],
|
|
252
|
-
},
|
|
253
|
-
],
|
|
254
|
-
};
|
|
255
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Components, JSX } from "../types/components";
|
|
2
|
-
|
|
3
|
-
interface LimebbLimeQueryFilterAnd extends Components.LimebbLimeQueryFilterAnd, HTMLElement {}
|
|
4
|
-
export const LimebbLimeQueryFilterAnd: {
|
|
5
|
-
prototype: LimebbLimeQueryFilterAnd;
|
|
6
|
-
new (): LimebbLimeQueryFilterAnd;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Used to define this component and all nested components recursively.
|
|
10
|
-
*/
|
|
11
|
-
export const defineCustomElement: () => void;
|
|
@@ -1,135 +0,0 @@
|
|
|
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$7 } from './lime-query-filter-comparison.js';
|
|
4
|
-
import { d as defineCustomElement$4, a as defineCustomElement$5, b as defineCustomElement$6 } from './lime-query-filter-expression.js';
|
|
5
|
-
import { d as defineCustomElement$3 } from './lime-query-value-input.js';
|
|
6
|
-
import { d as defineCustomElement$2 } from './property-selector.js';
|
|
7
|
-
|
|
8
|
-
const limeQueryFilterAndCss = "@charset \"UTF-8\";.expression{display:flex;flex-direction:column;margin-bottom:1rem;gap:0;background-color:rgb(var(--contrast-100));border:1px solid rgb(var(--contrast-500));border-radius:0.75rem}.expression>ul{margin-top:0;margin-right:1rem;margin-bottom:1rem;margin-left:1rem;padding-left:1rem;list-style:disc}.expression>ul li{margin-top:1rem}.expression>ul li.add-button{list-style:none}";
|
|
9
|
-
const LimebbLimeQueryFilterAndStyle0 = limeQueryFilterAndCss;
|
|
10
|
-
|
|
11
|
-
const LimeQueryFilterAndComponent = /*@__PURE__*/ proxyCustomElement(class LimeQueryFilterAndComponent extends HTMLElement {
|
|
12
|
-
constructor() {
|
|
13
|
-
super();
|
|
14
|
-
this.__registerHost();
|
|
15
|
-
this.__attachShadow();
|
|
16
|
-
this.expressionChange = createEvent(this, "expressionChange", 7);
|
|
17
|
-
this.renderChildExpression = (expression, childIndex) => (h("li", null, h("limebb-lime-query-filter-expression", { platform: this.platform, context: this.context, limetype: this.limetype, activeLimetype: this.activeLimetype, expression: expression, onExpressionChange: this.handleExpressionChange(childIndex) })));
|
|
18
|
-
this.handleAddChildExpression = () => {
|
|
19
|
-
const newOrGroup = {
|
|
20
|
-
op: Zt.OR,
|
|
21
|
-
exp: [
|
|
22
|
-
{
|
|
23
|
-
key: '',
|
|
24
|
-
op: Zt.EQUALS,
|
|
25
|
-
exp: '',
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
};
|
|
29
|
-
const updatedExpressionsList = [
|
|
30
|
-
...this.expression.exp,
|
|
31
|
-
newOrGroup,
|
|
32
|
-
];
|
|
33
|
-
this.expressionChange.emit({
|
|
34
|
-
op: Zt.AND,
|
|
35
|
-
exp: updatedExpressionsList,
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
this.handleExpressionChange = (updatedChildIndex) => (event) => {
|
|
39
|
-
var _a;
|
|
40
|
-
event.stopPropagation();
|
|
41
|
-
const updatedExpression = (_a = event.detail) !== null && _a !== void 0 ? _a : undefined;
|
|
42
|
-
const expressions = [...this.expression.exp];
|
|
43
|
-
if (updatedExpression === undefined) {
|
|
44
|
-
expressions.splice(updatedChildIndex, 1);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
expressions[updatedChildIndex] = updatedExpression;
|
|
48
|
-
}
|
|
49
|
-
if (expressions.length === 0) {
|
|
50
|
-
this.expressionChange.emit(undefined);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
if (expressions.length === 1) {
|
|
54
|
-
this.expressionChange.emit(expressions[0]);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
this.expressionChange.emit({
|
|
58
|
-
op: Zt.AND,
|
|
59
|
-
exp: expressions,
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
render() {
|
|
64
|
-
let subheading = 'All of these conditions are true';
|
|
65
|
-
if (this.expression.exp.length <= 1) {
|
|
66
|
-
subheading = '';
|
|
67
|
-
}
|
|
68
|
-
return (h("div", { key: 'f07c53808d6be8d846f5a45223abb5c94b1a0b16', class: "expression" }, (this.label || subheading) && (h("limel-header", { key: '229f0d58ff15743fbb12da53ad9c593bfba801d1', heading: this.label, subheading: subheading })), h("ul", { key: '2600c2bee2b958036ea606141bcfcac0e277114c' }, this.expression.exp.map(this.renderChildExpression), h("li", { key: '6395e605ee8f454a820ac73601da89b19686187a', class: "add-button" }, this.renderAddChildExpression()))));
|
|
69
|
-
}
|
|
70
|
-
renderAddChildExpression() {
|
|
71
|
-
return (h("limel-button", { label: this.getAddButtonLabel(), icon: "plus_math", onClick: this.handleAddChildExpression }));
|
|
72
|
-
}
|
|
73
|
-
getAddButtonLabel() {
|
|
74
|
-
if (this.expression.exp.length === 0) {
|
|
75
|
-
return 'Add a condition';
|
|
76
|
-
}
|
|
77
|
-
return 'Add another condition';
|
|
78
|
-
}
|
|
79
|
-
static get style() { return LimebbLimeQueryFilterAndStyle0; }
|
|
80
|
-
}, [1, "limebb-lime-query-filter-and", {
|
|
81
|
-
"platform": [16],
|
|
82
|
-
"context": [16],
|
|
83
|
-
"label": [1],
|
|
84
|
-
"limetype": [1],
|
|
85
|
-
"activeLimetype": [1, "active-limetype"],
|
|
86
|
-
"expression": [16]
|
|
87
|
-
}]);
|
|
88
|
-
function defineCustomElement$1() {
|
|
89
|
-
if (typeof customElements === "undefined") {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
const components = ["limebb-lime-query-filter-and", "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"];
|
|
93
|
-
components.forEach(tagName => { switch (tagName) {
|
|
94
|
-
case "limebb-lime-query-filter-and":
|
|
95
|
-
if (!customElements.get(tagName)) {
|
|
96
|
-
customElements.define(tagName, LimeQueryFilterAndComponent);
|
|
97
|
-
}
|
|
98
|
-
break;
|
|
99
|
-
case "limebb-lime-query-filter-comparison":
|
|
100
|
-
if (!customElements.get(tagName)) {
|
|
101
|
-
defineCustomElement$7();
|
|
102
|
-
}
|
|
103
|
-
break;
|
|
104
|
-
case "limebb-lime-query-filter-expression":
|
|
105
|
-
if (!customElements.get(tagName)) {
|
|
106
|
-
defineCustomElement$6();
|
|
107
|
-
}
|
|
108
|
-
break;
|
|
109
|
-
case "limebb-lime-query-filter-group":
|
|
110
|
-
if (!customElements.get(tagName)) {
|
|
111
|
-
defineCustomElement$5();
|
|
112
|
-
}
|
|
113
|
-
break;
|
|
114
|
-
case "limebb-lime-query-filter-not":
|
|
115
|
-
if (!customElements.get(tagName)) {
|
|
116
|
-
defineCustomElement$4();
|
|
117
|
-
}
|
|
118
|
-
break;
|
|
119
|
-
case "limebb-lime-query-value-input":
|
|
120
|
-
if (!customElements.get(tagName)) {
|
|
121
|
-
defineCustomElement$3();
|
|
122
|
-
}
|
|
123
|
-
break;
|
|
124
|
-
case "limebb-property-selector":
|
|
125
|
-
if (!customElements.get(tagName)) {
|
|
126
|
-
defineCustomElement$2();
|
|
127
|
-
}
|
|
128
|
-
break;
|
|
129
|
-
} });
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const LimebbLimeQueryFilterAnd = LimeQueryFilterAndComponent;
|
|
133
|
-
const defineCustomElement = defineCustomElement$1;
|
|
134
|
-
|
|
135
|
-
export { LimebbLimeQueryFilterAnd, defineCustomElement };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Components, JSX } from "../types/components";
|
|
2
|
-
|
|
3
|
-
interface LimebbLimeQueryFilterOr extends Components.LimebbLimeQueryFilterOr, HTMLElement {}
|
|
4
|
-
export const LimebbLimeQueryFilterOr: {
|
|
5
|
-
prototype: LimebbLimeQueryFilterOr;
|
|
6
|
-
new (): LimebbLimeQueryFilterOr;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Used to define this component and all nested components recursively.
|
|
10
|
-
*/
|
|
11
|
-
export const defineCustomElement: () => void;
|