@limetech/lime-crm-building-blocks 1.96.0 → 1.97.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/{_MapCache-2e84a981.js → _MapCache-8b125fbb.js} +0 -26
- package/dist/cjs/{_Uint8Array-1e99726d.js → _Uint8Array-95263550.js} +1 -12
- package/dist/cjs/_baseIsEqual-cb7951b0.js +496 -0
- package/dist/cjs/_defineProperty-40a6ad5d.js +15 -0
- package/dist/cjs/{get-1acf79ce.js → get-932b213e.js} +5 -4
- package/dist/cjs/isEqual-e77cce75.js +37 -0
- package/dist/cjs/isSymbol-5b36aeee.js +30 -0
- package/dist/cjs/lime-crm-building-blocks.cjs.js +1 -1
- package/dist/cjs/lime-query.types-bcb63a22.js +61 -0
- package/dist/cjs/limebb-component-config.cjs.entry.js +3 -2
- package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +382 -150
- package/dist/cjs/limebb-lime-query-filter-and_5.cjs.entry.js +278 -0
- package/dist/cjs/limebb-lime-query-value-input.cjs.entry.js +239 -0
- package/dist/cjs/limebb-limetype-field_2.cjs.entry.js +406 -0
- package/dist/cjs/limebb-live-docs-info.cjs.entry.js +2 -2
- package/dist/cjs/limebb-locale-picker.cjs.entry.js +13 -498
- 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-response-format-item.cjs.entry.js +80 -0
- package/dist/cjs/limebb-text-editor.cjs.entry.js +20 -61
- package/dist/cjs/limebb-trend-indicator.cjs.entry.js +1 -1
- package/dist/cjs/limetype-1fe0207f.js +90 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/property-resolution-fb42a46b.js +66 -0
- package/dist/collection/collection-manifest.json +10 -0
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-and.css +121 -0
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-and.js +257 -0
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison.css +39 -0
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison.js +246 -0
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-expression.css +104 -0
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-expression.js +220 -0
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-not.css +107 -0
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-not.js +212 -0
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-or.css +123 -0
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-or.js +237 -0
- package/dist/collection/components/lime-query-builder/expressions/lime-query-value-input.css +48 -0
- package/dist/collection/components/lime-query-builder/expressions/lime-query-value-input.js +457 -0
- package/dist/collection/components/lime-query-builder/filter-conversion.js +118 -21
- package/dist/collection/components/lime-query-builder/lime-query-builder.css +30 -17
- package/dist/collection/components/lime-query-builder/lime-query-builder.js +233 -28
- package/dist/collection/components/lime-query-builder/limetype-field/limetype-field.js +435 -0
- package/dist/collection/components/lime-query-builder/property-selection-format.js +158 -0
- package/dist/collection/components/lime-query-builder/property-selector/property-selector.css +8 -0
- package/dist/collection/components/lime-query-builder/property-selector/property-selector.js +422 -0
- package/dist/collection/components/lime-query-builder/response-format-editor.css +72 -0
- package/dist/collection/components/lime-query-builder/response-format-editor.js +249 -0
- package/dist/collection/components/lime-query-builder/response-format-item.css +61 -0
- package/dist/collection/components/lime-query-builder/response-format-item.js +208 -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/_MapCache.js +2 -27
- package/dist/components/_Uint8Array.js +2 -12
- package/dist/components/_baseIsEqual.js +494 -0
- package/dist/components/_defineProperty.js +13 -0
- package/dist/components/get.js +2 -1
- package/dist/components/isEqual.js +35 -0
- package/dist/components/isSymbol.js +28 -0
- package/dist/components/lime-query-filter-and.js +408 -0
- package/dist/components/lime-query-filter-comparison.js +152 -0
- package/dist/components/lime-query-value-input.js +266 -0
- package/dist/components/limebb-lime-query-builder.js +441 -149
- package/dist/components/limebb-lime-query-filter-and.d.ts +11 -0
- package/dist/components/limebb-lime-query-filter-and.js +6 -0
- package/dist/components/limebb-lime-query-filter-comparison.d.ts +11 -0
- package/dist/components/limebb-lime-query-filter-comparison.js +6 -0
- package/dist/components/limebb-lime-query-filter-expression.d.ts +11 -0
- package/dist/components/limebb-lime-query-filter-expression.js +6 -0
- package/dist/components/limebb-lime-query-filter-not.d.ts +11 -0
- package/dist/components/limebb-lime-query-filter-not.js +6 -0
- package/dist/components/limebb-lime-query-filter-or.d.ts +11 -0
- package/dist/components/limebb-lime-query-filter-or.js +6 -0
- package/dist/components/limebb-lime-query-value-input.d.ts +11 -0
- package/dist/components/limebb-lime-query-value-input.js +6 -0
- package/dist/components/limebb-limetype-field.d.ts +11 -0
- package/dist/components/limebb-limetype-field.js +6 -0
- package/dist/components/limebb-locale-picker.js +8 -493
- package/dist/components/limebb-mention-group-counter.js +2 -2
- package/dist/components/limebb-percentage-visualizer.js +2 -2
- package/dist/components/limebb-property-selector.d.ts +11 -0
- package/dist/components/limebb-property-selector.js +6 -0
- package/dist/components/limebb-response-format-editor.d.ts +11 -0
- package/dist/components/limebb-response-format-editor.js +6 -0
- package/dist/components/limebb-response-format-item.d.ts +11 -0
- package/dist/components/limebb-response-format-item.js +6 -0
- package/dist/components/limebb-text-editor.js +7 -48
- package/dist/components/limebb-trend-indicator.js +1 -1
- package/dist/components/limetype-field.js +184 -0
- package/dist/components/limetype.js +85 -0
- package/dist/components/live-docs-info.js +2 -2
- package/dist/components/notification-item.js +1 -1
- package/dist/components/property-selector.js +317 -0
- package/dist/components/response-format-editor.js +278 -0
- package/dist/components/response-format-item.js +104 -0
- package/dist/components/summary-popover.js +3 -3
- package/dist/esm/{_MapCache-6484495d.js → _MapCache-af496e9d.js} +2 -27
- package/dist/esm/{_Uint8Array-e5cac922.js → _Uint8Array-d6ebd526.js} +3 -13
- package/dist/esm/_baseIsEqual-28053b81.js +494 -0
- package/dist/esm/_defineProperty-e6a185c3.js +13 -0
- package/dist/esm/{get-f9e0b2e1.js → get-3e42932b.js} +2 -1
- package/dist/esm/isEqual-57d0c223.js +35 -0
- package/dist/esm/isSymbol-1c5f65cc.js +28 -0
- package/dist/esm/lime-crm-building-blocks.js +1 -1
- package/dist/esm/lime-query.types-f72355e1.js +59 -0
- package/dist/esm/limebb-component-config.entry.js +3 -2
- package/dist/esm/limebb-lime-query-builder.entry.js +379 -147
- package/dist/esm/limebb-lime-query-filter-and_5.entry.js +270 -0
- package/dist/esm/limebb-lime-query-value-input.entry.js +235 -0
- package/dist/esm/limebb-limetype-field_2.entry.js +401 -0
- package/dist/esm/limebb-live-docs-info.entry.js +2 -2
- package/dist/esm/limebb-locale-picker.entry.js +9 -494
- 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-response-format-item.entry.js +76 -0
- package/dist/esm/limebb-text-editor.entry.js +7 -48
- package/dist/esm/limebb-trend-indicator.entry.js +1 -1
- package/dist/esm/limetype-6e7552a7.js +85 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/property-resolution-fde2375e.js +63 -0
- package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
- package/dist/lime-crm-building-blocks/{p-88c64360.entry.js → p-00da9b24.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-02c0cc04.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-123190c3.js +1 -0
- package/dist/lime-crm-building-blocks/p-244ee55b.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-35897ec3.js +1 -0
- package/dist/lime-crm-building-blocks/{p-85b7291c.entry.js → p-3932077b.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-3b0a15ec.js +1 -0
- package/dist/lime-crm-building-blocks/p-5a6d2e7f.js +1 -0
- package/dist/lime-crm-building-blocks/p-60971d64.js +1 -0
- package/dist/lime-crm-building-blocks/p-6c1146ca.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-70a28b93.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-7e6fb4af.js +1 -0
- package/dist/lime-crm-building-blocks/{p-8664381a.entry.js → p-8c4eb49f.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-96beaabc.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-a659d55a.js +1 -0
- package/dist/lime-crm-building-blocks/p-b7c72179.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-baf4e428.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-d298b34e.js +1 -0
- package/dist/lime-crm-building-blocks/{p-7c4bdc1b.entry.js → p-d89c44ad.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-e0ab1554.js +1 -0
- package/dist/lime-crm-building-blocks/{p-8064cbfb.entry.js → p-e9d23ef7.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-ef8a5266.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-c9126885.entry.js → p-f52125a0.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-f99c611d.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-fe2b91d9.js +1 -0
- package/dist/types/components/lime-query-builder/expressions/lime-query-filter-and.d.ts +56 -0
- package/dist/types/components/lime-query-builder/expressions/lime-query-filter-comparison.d.ts +64 -0
- package/dist/types/components/lime-query-builder/expressions/lime-query-filter-expression.d.ts +53 -0
- package/dist/types/components/lime-query-builder/expressions/lime-query-filter-not.d.ts +54 -0
- package/dist/types/components/lime-query-builder/expressions/lime-query-filter-or.d.ts +55 -0
- package/dist/types/components/lime-query-builder/expressions/lime-query-value-input.d.ts +92 -0
- package/dist/types/components/lime-query-builder/filter-conversion.d.ts +18 -0
- package/dist/types/components/lime-query-builder/lime-query-builder.d.ts +30 -8
- package/dist/types/components/lime-query-builder/limetype-field/limetype-field.d.ts +96 -0
- package/dist/types/components/lime-query-builder/property-selection-format.d.ts +23 -0
- package/dist/types/components/lime-query-builder/property-selector/property-selector.d.ts +71 -0
- package/dist/types/components/lime-query-builder/response-format-editor.d.ts +57 -0
- package/dist/types/components/lime-query-builder/response-format-item.d.ts +46 -0
- package/dist/types/components.d.ts +1558 -117
- package/package.json +1 -1
- package/dist/lime-crm-building-blocks/p-00e7e0d4.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-11ac105b.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-5abe3fff.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-8044ffbd.js +0 -1
- package/dist/lime-crm-building-blocks/p-92ec9205.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-bcc23575.js +0 -1
- package/dist/lime-crm-building-blocks/p-c40a3f4b.js +0 -1
|
@@ -10,23 +10,26 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
10
10
|
};
|
|
11
11
|
import { h } from "@stencil/core";
|
|
12
12
|
import { SelectLimeTypes as Limetypes, } from "@limetech/lime-web-components";
|
|
13
|
+
import { guiFilterToLimeQuery, limeQueryToGuiFilter, normalizeLimeQueryFilterForGui, } from "./filter-conversion";
|
|
13
14
|
import { isLimeQuerySupported, } from "./lime-query-validation";
|
|
14
15
|
/**
|
|
15
16
|
* Lime Query Builder Component
|
|
16
17
|
*
|
|
17
|
-
* A
|
|
18
|
+
* A comprehensive query builder for constructing Lime Query DSL queries.
|
|
19
|
+
* This is the main component that combines limetype selection with the filter builder.
|
|
18
20
|
*
|
|
19
21
|
* Features:
|
|
20
|
-
* - **
|
|
21
|
-
* - **
|
|
22
|
-
* - **
|
|
22
|
+
* - **Limetype selection**: Choose which object type to query
|
|
23
|
+
* - **Filter builder**: Build complex filters with AND/OR/NOT logic
|
|
24
|
+
* - **Property path selection**: Navigate through relations
|
|
25
|
+
* - **Type-aware inputs**: Automatic input types based on property type
|
|
26
|
+
* - **Response format**: Select which properties to return
|
|
27
|
+
* - **Query options**: Configure limit and other query parameters
|
|
28
|
+
* - **Real-time output**: See the Lime Query JSON as you build
|
|
23
29
|
*
|
|
24
|
-
* The component
|
|
30
|
+
* The component produces a complete `LimeQuery` object that can be sent
|
|
25
31
|
* directly to the Lime CRM backend.
|
|
26
32
|
*
|
|
27
|
-
* When the feature flag `useLimeQueryBuilderGuiMode` is enabled, a mode toggle
|
|
28
|
-
* becomes available, but GUI mode currently shows a placeholder message.
|
|
29
|
-
*
|
|
30
33
|
* @exampleComponent limebb-example-lime-query-builder-basic
|
|
31
34
|
* @private
|
|
32
35
|
*/
|
|
@@ -34,10 +37,80 @@ export class LimeQueryBuilder {
|
|
|
34
37
|
constructor() {
|
|
35
38
|
this.mode = 'gui';
|
|
36
39
|
this.codeValue = '';
|
|
40
|
+
this.limetype = '';
|
|
41
|
+
this.filter = {
|
|
42
|
+
filter_type: 'AND',
|
|
43
|
+
expressions: [],
|
|
44
|
+
};
|
|
45
|
+
this.handleLimetypeChange = (event) => {
|
|
46
|
+
event.stopPropagation();
|
|
47
|
+
this.limetype = event.detail;
|
|
48
|
+
// Reset filter when limetype changes
|
|
49
|
+
this.filter = {
|
|
50
|
+
filter_type: 'AND',
|
|
51
|
+
expressions: [],
|
|
52
|
+
};
|
|
53
|
+
// Reset response format when limetype changes
|
|
54
|
+
this.internalResponseFormat = {
|
|
55
|
+
object: {
|
|
56
|
+
_id: null,
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
this.emitChange();
|
|
60
|
+
};
|
|
61
|
+
this.handleFilterChange = (event) => {
|
|
62
|
+
event.stopPropagation();
|
|
63
|
+
// Convert missing expression back to empty AND to keep the UI consistent
|
|
64
|
+
if (event.detail.filter_type === '') {
|
|
65
|
+
this.filter = {
|
|
66
|
+
filter_type: 'AND',
|
|
67
|
+
expressions: [],
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
this.filter = event.detail;
|
|
72
|
+
}
|
|
73
|
+
this.emitChange();
|
|
74
|
+
};
|
|
75
|
+
this.handleResponseFormatChange = (event) => {
|
|
76
|
+
event.stopPropagation();
|
|
77
|
+
this.internalResponseFormat = event.detail;
|
|
78
|
+
this.emitChange();
|
|
79
|
+
};
|
|
80
|
+
this.handleLimitChange = (event) => {
|
|
81
|
+
event.stopPropagation();
|
|
82
|
+
const value = event.detail;
|
|
83
|
+
this.limit = value ? Number.parseInt(value, 10) : undefined;
|
|
84
|
+
this.emitChange();
|
|
85
|
+
};
|
|
86
|
+
this.handleActiveLimetypeChange = (event) => {
|
|
87
|
+
event.stopPropagation();
|
|
88
|
+
this.activeLimetype = event.detail || undefined;
|
|
89
|
+
};
|
|
37
90
|
this.switchToGui = () => {
|
|
38
|
-
|
|
91
|
+
// Validate JSON before switching
|
|
92
|
+
try {
|
|
93
|
+
const parsed = JSON.parse(this.codeValue);
|
|
94
|
+
// Check if it's supported in GUI
|
|
95
|
+
const support = this.checkGuiSupport();
|
|
96
|
+
if (!support.guiSupported) {
|
|
97
|
+
// Don't switch if GUI can't render this query
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
// Update internal state from parsed query
|
|
101
|
+
this.limetype = parsed.limetype || '';
|
|
102
|
+
this.filter = normalizeLimeQueryFilterForGui(limeQueryToGuiFilter(parsed.filter));
|
|
103
|
+
this.internalResponseFormat = parsed.responseFormat;
|
|
104
|
+
this.limit = parsed.limit;
|
|
105
|
+
this.mode = 'gui';
|
|
106
|
+
this.change.emit(parsed);
|
|
107
|
+
}
|
|
108
|
+
catch (_a) {
|
|
109
|
+
// Don't switch if JSON is invalid (linter will show the error)
|
|
110
|
+
}
|
|
39
111
|
};
|
|
40
112
|
this.switchToCode = () => {
|
|
113
|
+
this.updateCodeValue();
|
|
41
114
|
this.mode = 'code';
|
|
42
115
|
};
|
|
43
116
|
this.handleCodeChange = (event) => {
|
|
@@ -58,43 +131,130 @@ export class LimeQueryBuilder {
|
|
|
58
131
|
return ((_c = (_b = (_a = this.platform) === null || _a === void 0 ? void 0 : _a.isFeatureEnabled) === null || _b === void 0 ? void 0 : _b.call(_a, 'useLimeQueryBuilderGuiMode')) !== null && _c !== void 0 ? _c : false);
|
|
59
132
|
}
|
|
60
133
|
componentWillLoad() {
|
|
61
|
-
// Initialize code value from input prop
|
|
62
|
-
this.codeValue = JSON.stringify(this.value || {}, null, 2);
|
|
63
134
|
// Force code mode if GUI is disabled
|
|
64
135
|
if (!this.guiModeEnabled) {
|
|
65
136
|
this.mode = 'code';
|
|
137
|
+
// Initialize code value from prop
|
|
138
|
+
this.updateCodeValue();
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (this.value) {
|
|
142
|
+
this.limetype = this.value.limetype || '';
|
|
143
|
+
this.filter = normalizeLimeQueryFilterForGui(limeQueryToGuiFilter(this.value.filter));
|
|
144
|
+
this.internalResponseFormat = this.value.responseFormat;
|
|
145
|
+
this.limit = this.value.limit;
|
|
146
|
+
}
|
|
147
|
+
// Initialize code value from prop
|
|
148
|
+
this.updateCodeValue();
|
|
149
|
+
// Check if GUI mode is supported
|
|
150
|
+
const support = this.checkGuiSupport();
|
|
151
|
+
if (!support.guiSupported) {
|
|
152
|
+
this.mode = 'code';
|
|
66
153
|
}
|
|
67
154
|
}
|
|
68
155
|
render() {
|
|
69
156
|
const guiSupported = this.checkGuiSupport();
|
|
70
|
-
|
|
157
|
+
const showCodeMode = !this.guiModeEnabled || this.mode === 'code';
|
|
158
|
+
return (h("div", { key: 'd179549c02b40689f61a47f327c9b4ab3e578258', class: "lime-query-builder" }, this.renderLabel(), this.renderModeControls(guiSupported), showCodeMode
|
|
159
|
+
? this.renderCodeMode(guiSupported)
|
|
160
|
+
: this.renderGuiMode()));
|
|
161
|
+
}
|
|
162
|
+
emitChange() {
|
|
163
|
+
// Only emit in GUI mode
|
|
164
|
+
if (this.mode === 'code') {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (!this.limetype) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
// Use internal state, then default to returning just _id
|
|
171
|
+
const responseFormat = this.internalResponseFormat || {
|
|
172
|
+
object: {
|
|
173
|
+
_id: null,
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
const limeQuery = {
|
|
177
|
+
limetype: this.limetype,
|
|
178
|
+
responseFormat: responseFormat,
|
|
179
|
+
filter: guiFilterToLimeQuery(this.filter),
|
|
180
|
+
};
|
|
181
|
+
if (this.limit !== undefined && this.limit > 0) {
|
|
182
|
+
limeQuery.limit = this.limit;
|
|
183
|
+
}
|
|
184
|
+
this.change.emit(limeQuery);
|
|
185
|
+
}
|
|
186
|
+
updateCodeValue() {
|
|
187
|
+
if (!this.limetype) {
|
|
188
|
+
this.codeValue = JSON.stringify(this.value || {}, null, 2);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
// Use internal state, then default to returning just _id
|
|
192
|
+
const responseFormat = this.internalResponseFormat || {
|
|
193
|
+
object: {
|
|
194
|
+
_id: null,
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
const limeQuery = {
|
|
198
|
+
limetype: this.limetype,
|
|
199
|
+
responseFormat: responseFormat,
|
|
200
|
+
filter: guiFilterToLimeQuery(this.filter),
|
|
201
|
+
};
|
|
202
|
+
if (this.limit !== undefined && this.limit > 0) {
|
|
203
|
+
limeQuery.limit = this.limit;
|
|
204
|
+
}
|
|
205
|
+
this.codeValue = JSON.stringify(limeQuery, null, 2);
|
|
71
206
|
}
|
|
72
207
|
checkGuiSupport() {
|
|
73
|
-
if (!this.limetypes
|
|
208
|
+
if (!this.limetypes) {
|
|
74
209
|
// Can't validate yet, assume all is good
|
|
75
210
|
return {
|
|
76
211
|
valid: true,
|
|
77
|
-
guiSupported:
|
|
212
|
+
guiSupported: true,
|
|
78
213
|
validationErrors: [],
|
|
79
214
|
guiLimitations: [],
|
|
80
215
|
};
|
|
81
216
|
}
|
|
82
|
-
//
|
|
83
|
-
let
|
|
84
|
-
|
|
85
|
-
|
|
217
|
+
// When in code mode, validate the parsed code value instead of current state
|
|
218
|
+
let queryToCheck;
|
|
219
|
+
if (this.mode === 'code' && this.codeValue) {
|
|
220
|
+
try {
|
|
221
|
+
queryToCheck = JSON.parse(this.codeValue);
|
|
222
|
+
}
|
|
223
|
+
catch (_a) {
|
|
224
|
+
return {
|
|
225
|
+
valid: false,
|
|
226
|
+
guiSupported: false,
|
|
227
|
+
validationErrors: ['Invalid JSON'],
|
|
228
|
+
guiLimitations: [],
|
|
229
|
+
};
|
|
230
|
+
}
|
|
86
231
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
232
|
+
else {
|
|
233
|
+
// Build query from current GUI state
|
|
234
|
+
if (!this.limetype) {
|
|
235
|
+
return {
|
|
236
|
+
valid: true,
|
|
237
|
+
guiSupported: true,
|
|
238
|
+
validationErrors: [],
|
|
239
|
+
guiLimitations: [],
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
const responseFormat = this
|
|
243
|
+
.internalResponseFormat || {
|
|
244
|
+
object: {
|
|
245
|
+
_id: null,
|
|
246
|
+
},
|
|
93
247
|
};
|
|
248
|
+
queryToCheck = {
|
|
249
|
+
limetype: this.limetype,
|
|
250
|
+
responseFormat: responseFormat,
|
|
251
|
+
filter: guiFilterToLimeQuery(this.filter),
|
|
252
|
+
};
|
|
253
|
+
if (this.limit !== undefined && this.limit > 0) {
|
|
254
|
+
queryToCheck.limit = this.limit;
|
|
255
|
+
}
|
|
94
256
|
}
|
|
95
|
-
|
|
96
|
-
// Pass undefined since it's not needed for code mode validation
|
|
97
|
-
return isLimeQuerySupported(limeQueryToCheck, this.limetypes, undefined, this.guiModeEnabled);
|
|
257
|
+
return isLimeQuerySupported(queryToCheck, this.limetypes, this.activeLimetype, this.guiModeEnabled);
|
|
98
258
|
}
|
|
99
259
|
renderModeSwitch(support) {
|
|
100
260
|
const guiDisabled = !support.guiSupported;
|
|
@@ -107,6 +267,46 @@ export class LimeQueryBuilder {
|
|
|
107
267
|
!guiSupported.guiSupported &&
|
|
108
268
|
guiSupported.guiLimitations.length > 0 && (h("div", { class: "gui-limitations" }, h("strong", null, "Cannot switch to GUI mode:"), h("ul", null, guiSupported.guiLimitations.map((limitation) => (h("li", null, limitation))))))));
|
|
109
269
|
}
|
|
270
|
+
renderLimetypeSection() {
|
|
271
|
+
return (h("div", { class: "limetype-section" }, h("limebb-limetype-field", { platform: this.platform, context: this.context, label: "Object Type", value: this.limetype, required: true, fieldName: "limetype", helperText: "Select the type of object you want to query", onChange: this.handleLimetypeChange })));
|
|
272
|
+
}
|
|
273
|
+
renderResponseFormatSection() {
|
|
274
|
+
if (!this.limetype) {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
return (h("div", { class: "response-format-section" }, h("limebb-response-format-editor", { platform: this.platform, context: this.context, limetype: this.limetype, value: this.internalResponseFormat, onChange: this.handleResponseFormatChange })));
|
|
278
|
+
}
|
|
279
|
+
renderFilterSection() {
|
|
280
|
+
if (!this.limetype) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
return (h("div", { class: "filter-section" }, h("h4", { class: "section-label" }, "Filter Conditions"), h("limebb-lime-query-filter-expression", { platform: this.platform, context: this.context, limetype: this.limetype, activeLimetype: this.activeLimetype, expression: this.filter, onExpressionChange: this.handleFilterChange })));
|
|
284
|
+
}
|
|
285
|
+
renderQueryOptionsSection() {
|
|
286
|
+
var _a;
|
|
287
|
+
if (!this.limetype) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
return (h("div", { class: "query-options-section" }, h("h4", { class: "section-label" }, "Query Options"), h("div", { class: "query-options-controls" }, h("limebb-limetype-field", { platform: this.platform, context: this.context, label: "Active Object Type", value: this.activeLimetype, required: false, fieldName: "activeLimetype", helperText: "Limetype of the active object (for %activeObject% placeholders)", onChange: this.handleActiveLimetypeChange }), h("limel-input-field", { label: "Limit", type: "number", value: ((_a = this.limit) === null || _a === void 0 ? void 0 : _a.toString()) || '', placeholder: "No limit", helperText: "Maximum number of results", onChange: this.handleLimitChange }))));
|
|
291
|
+
}
|
|
292
|
+
renderGuiMode() {
|
|
293
|
+
return (h("div", { class: "gui-mode" }, this.renderLimetypeSection(), this.renderResponseFormatSection(), this.renderFilterSection(), this.renderQueryOptionsSection()));
|
|
294
|
+
}
|
|
295
|
+
renderLabel() {
|
|
296
|
+
if (!this.label) {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
return h("h3", { class: "lime-query-builder-label" }, this.label);
|
|
300
|
+
}
|
|
301
|
+
renderModeControls(support) {
|
|
302
|
+
if (!this.guiModeEnabled) {
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
return (h("div", { class: "mode-controls" }, this.renderModeSwitch(support)));
|
|
306
|
+
}
|
|
307
|
+
renderCodeMode(support) {
|
|
308
|
+
return h("div", { class: "code-mode" }, this.renderCodeEditor(support));
|
|
309
|
+
}
|
|
110
310
|
static get is() { return "limebb-lime-query-builder"; }
|
|
111
311
|
static get encapsulation() { return "shadow"; }
|
|
112
312
|
static get originalStyleUrls() {
|
|
@@ -215,7 +415,12 @@ export class LimeQueryBuilder {
|
|
|
215
415
|
return {
|
|
216
416
|
"limetypes": {},
|
|
217
417
|
"mode": {},
|
|
218
|
-
"codeValue": {}
|
|
418
|
+
"codeValue": {},
|
|
419
|
+
"limetype": {},
|
|
420
|
+
"filter": {},
|
|
421
|
+
"internalResponseFormat": {},
|
|
422
|
+
"limit": {},
|
|
423
|
+
"activeLimetype": {}
|
|
219
424
|
};
|
|
220
425
|
}
|
|
221
426
|
static get events() {
|