@limetech/lime-crm-building-blocks 1.103.6 → 1.103.7
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/limebb-lime-query-builder.cjs.entry.js +2 -4
- package/dist/cjs/limebb-lime-query-response-format-editor_2.cjs.entry.js +48 -34
- package/dist/collection/components/lime-query-builder/lime-query-builder.js +2 -4
- package/dist/collection/components/lime-query-builder/response-format/response-format-editor.js +48 -34
- package/dist/components/limebb-lime-query-builder.js +2 -4
- package/dist/components/response-format-editor.js +48 -34
- package/dist/esm/limebb-lime-query-builder.entry.js +2 -4
- package/dist/esm/limebb-lime-query-response-format-editor_2.entry.js +48 -34
- package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
- package/dist/lime-crm-building-blocks/p-adfb9e90.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-fe6a94a1.entry.js +1 -0
- package/dist/types/components/lime-query-builder/response-format/response-format-editor.d.ts +16 -0
- package/package.json +1 -1
- package/dist/lime-crm-building-blocks/p-4f605428.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-d635e6fc.entry.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.103.7](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.103.6...v1.103.7) (2025-11-17)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
* **lime-query-builder:** fix problem where visual mode would not be in sync with underlying value ([5333966](https://github.com/Lundalogik/lime-crm-building-blocks/commit/5333966b845ad7d980a0280d3e9d52331b37523b)), closes [Lundalogik/crm-insights-and-intelligence#149](https://github.com/Lundalogik/crm-insights-and-intelligence/issues/149)
|
|
7
|
+
|
|
1
8
|
## [1.103.6](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.103.5...v1.103.6) (2025-11-14)
|
|
2
9
|
|
|
3
10
|
### Bug Fixes
|
|
@@ -32,11 +32,9 @@ const LimeQueryBuilder = class {
|
|
|
32
32
|
this.limetype = event.detail;
|
|
33
33
|
// Reset filter when limetype changes
|
|
34
34
|
this.filter = undefined;
|
|
35
|
-
// Reset response format when limetype changes
|
|
35
|
+
// Reset response format when limetype changes - empty state
|
|
36
36
|
this.internalResponseFormat = {
|
|
37
|
-
object: {
|
|
38
|
-
_id: null,
|
|
39
|
-
},
|
|
37
|
+
object: {},
|
|
40
38
|
};
|
|
41
39
|
this.emitChange();
|
|
42
40
|
};
|
|
@@ -196,46 +196,29 @@ const ResponseFormatEditor = class {
|
|
|
196
196
|
};
|
|
197
197
|
}
|
|
198
198
|
componentWillLoad() {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
// Keep items empty for truly empty objects
|
|
199
|
+
if (!this.value) {
|
|
200
|
+
// No value provided at all, use default _id
|
|
201
|
+
this.items = [{ path: '_id' }];
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
if (this.isEmptyResponseFormat(this.value)) {
|
|
205
|
+
// Show empty state for explicit empty objects
|
|
207
206
|
this.items = [];
|
|
208
207
|
}
|
|
209
|
-
else if (
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
this.items = converted;
|
|
213
|
-
}
|
|
214
|
-
else {
|
|
215
|
-
// Empty object property, but not a truly empty value
|
|
216
|
-
// Use default _id for backward compatibility
|
|
217
|
-
this.items = [{ path: '_id' }];
|
|
218
|
-
}
|
|
208
|
+
else if (this.value.object) {
|
|
209
|
+
// Has object property with actual properties
|
|
210
|
+
this.items = propertySelectionToItems(this.value.object);
|
|
219
211
|
}
|
|
220
|
-
else
|
|
221
|
-
//
|
|
222
|
-
this.items = [
|
|
212
|
+
else {
|
|
213
|
+
// If value has aggregates but no object property, initialize items to empty array
|
|
214
|
+
this.items = [];
|
|
223
215
|
}
|
|
224
216
|
}
|
|
225
217
|
componentWillUpdate() {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
const isTrulyEmpty = this.value &&
|
|
229
|
-
Object.keys(this.value).length === 0 &&
|
|
230
|
-
!this.value.object &&
|
|
231
|
-
!this.value.aggregates;
|
|
232
|
-
if (isTrulyEmpty) {
|
|
233
|
-
// Keep items empty for truly empty objects
|
|
234
|
-
if (this.items.length > 0) {
|
|
235
|
-
this.items = [];
|
|
236
|
-
}
|
|
218
|
+
if (!this.value) {
|
|
219
|
+
return;
|
|
237
220
|
}
|
|
238
|
-
|
|
221
|
+
if (this.value.object && !this.isEmptyResponseFormat(this.value)) {
|
|
239
222
|
const currentItems = propertySelectionToItems(this.value.object);
|
|
240
223
|
// Check if items have changed
|
|
241
224
|
const itemsChanged = currentItems.length !== this.items.length ||
|
|
@@ -247,10 +230,15 @@ const ResponseFormatEditor = class {
|
|
|
247
230
|
item.description === current.description);
|
|
248
231
|
});
|
|
249
232
|
if (itemsChanged) {
|
|
250
|
-
// Allow empty items array - don't force _id
|
|
251
233
|
this.items = currentItems;
|
|
252
234
|
}
|
|
253
235
|
}
|
|
236
|
+
else {
|
|
237
|
+
// Either empty response format or no object property - clear items
|
|
238
|
+
if (this.items.length > 0) {
|
|
239
|
+
this.items = [];
|
|
240
|
+
}
|
|
241
|
+
}
|
|
254
242
|
}
|
|
255
243
|
render() {
|
|
256
244
|
if (!this.limetype) {
|
|
@@ -281,6 +269,32 @@ const ResponseFormatEditor = class {
|
|
|
281
269
|
};
|
|
282
270
|
this.change.emit(responseFormat);
|
|
283
271
|
}
|
|
272
|
+
/**
|
|
273
|
+
* Check if the response format is empty
|
|
274
|
+
*
|
|
275
|
+
* A response format is considered empty in the following cases:
|
|
276
|
+
* - Empty object: `{}`
|
|
277
|
+
* - Object with empty object property and no aggregates: `{ object: {} }`
|
|
278
|
+
*
|
|
279
|
+
* Returns false for:
|
|
280
|
+
* - `null` or `undefined`
|
|
281
|
+
* - Objects with properties: `{ object: { _id: null } }`
|
|
282
|
+
* - Objects with aggregates: `{ aggregates: {...} }`
|
|
283
|
+
*
|
|
284
|
+
* @param value - The ResponseFormat to check
|
|
285
|
+
* @returns True if the response format is empty, false otherwise
|
|
286
|
+
*/
|
|
287
|
+
isEmptyResponseFormat(value) {
|
|
288
|
+
if (!value) {
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
291
|
+
if (Object.keys(value).length === 0) {
|
|
292
|
+
return true;
|
|
293
|
+
}
|
|
294
|
+
return !!(value.object &&
|
|
295
|
+
Object.keys(value.object).length === 0 &&
|
|
296
|
+
!value.aggregates);
|
|
297
|
+
}
|
|
284
298
|
};
|
|
285
299
|
ResponseFormatEditor.style = LimebbLimeQueryResponseFormatEditorStyle0;
|
|
286
300
|
|
|
@@ -50,11 +50,9 @@ export class LimeQueryBuilder {
|
|
|
50
50
|
this.limetype = event.detail;
|
|
51
51
|
// Reset filter when limetype changes
|
|
52
52
|
this.filter = undefined;
|
|
53
|
-
// Reset response format when limetype changes
|
|
53
|
+
// Reset response format when limetype changes - empty state
|
|
54
54
|
this.internalResponseFormat = {
|
|
55
|
-
object: {
|
|
56
|
-
_id: null,
|
|
57
|
-
},
|
|
55
|
+
object: {},
|
|
58
56
|
};
|
|
59
57
|
this.emitChange();
|
|
60
58
|
};
|
package/dist/collection/components/lime-query-builder/response-format/response-format-editor.js
CHANGED
|
@@ -47,46 +47,29 @@ export class ResponseFormatEditor {
|
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
componentWillLoad() {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
// Keep items empty for truly empty objects
|
|
50
|
+
if (!this.value) {
|
|
51
|
+
// No value provided at all, use default _id
|
|
52
|
+
this.items = [{ path: '_id' }];
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (this.isEmptyResponseFormat(this.value)) {
|
|
56
|
+
// Show empty state for explicit empty objects
|
|
58
57
|
this.items = [];
|
|
59
58
|
}
|
|
60
|
-
else if (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
this.items = converted;
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
// Empty object property, but not a truly empty value
|
|
67
|
-
// Use default _id for backward compatibility
|
|
68
|
-
this.items = [{ path: '_id' }];
|
|
69
|
-
}
|
|
59
|
+
else if (this.value.object) {
|
|
60
|
+
// Has object property with actual properties
|
|
61
|
+
this.items = propertySelectionToItems(this.value.object);
|
|
70
62
|
}
|
|
71
|
-
else
|
|
72
|
-
//
|
|
73
|
-
this.items = [
|
|
63
|
+
else {
|
|
64
|
+
// If value has aggregates but no object property, initialize items to empty array
|
|
65
|
+
this.items = [];
|
|
74
66
|
}
|
|
75
67
|
}
|
|
76
68
|
componentWillUpdate() {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const isTrulyEmpty = this.value &&
|
|
80
|
-
Object.keys(this.value).length === 0 &&
|
|
81
|
-
!this.value.object &&
|
|
82
|
-
!this.value.aggregates;
|
|
83
|
-
if (isTrulyEmpty) {
|
|
84
|
-
// Keep items empty for truly empty objects
|
|
85
|
-
if (this.items.length > 0) {
|
|
86
|
-
this.items = [];
|
|
87
|
-
}
|
|
69
|
+
if (!this.value) {
|
|
70
|
+
return;
|
|
88
71
|
}
|
|
89
|
-
|
|
72
|
+
if (this.value.object && !this.isEmptyResponseFormat(this.value)) {
|
|
90
73
|
const currentItems = propertySelectionToItems(this.value.object);
|
|
91
74
|
// Check if items have changed
|
|
92
75
|
const itemsChanged = currentItems.length !== this.items.length ||
|
|
@@ -98,10 +81,15 @@ export class ResponseFormatEditor {
|
|
|
98
81
|
item.description === current.description);
|
|
99
82
|
});
|
|
100
83
|
if (itemsChanged) {
|
|
101
|
-
// Allow empty items array - don't force _id
|
|
102
84
|
this.items = currentItems;
|
|
103
85
|
}
|
|
104
86
|
}
|
|
87
|
+
else {
|
|
88
|
+
// Either empty response format or no object property - clear items
|
|
89
|
+
if (this.items.length > 0) {
|
|
90
|
+
this.items = [];
|
|
91
|
+
}
|
|
92
|
+
}
|
|
105
93
|
}
|
|
106
94
|
render() {
|
|
107
95
|
if (!this.limetype) {
|
|
@@ -132,6 +120,32 @@ export class ResponseFormatEditor {
|
|
|
132
120
|
};
|
|
133
121
|
this.change.emit(responseFormat);
|
|
134
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Check if the response format is empty
|
|
125
|
+
*
|
|
126
|
+
* A response format is considered empty in the following cases:
|
|
127
|
+
* - Empty object: `{}`
|
|
128
|
+
* - Object with empty object property and no aggregates: `{ object: {} }`
|
|
129
|
+
*
|
|
130
|
+
* Returns false for:
|
|
131
|
+
* - `null` or `undefined`
|
|
132
|
+
* - Objects with properties: `{ object: { _id: null } }`
|
|
133
|
+
* - Objects with aggregates: `{ aggregates: {...} }`
|
|
134
|
+
*
|
|
135
|
+
* @param value - The ResponseFormat to check
|
|
136
|
+
* @returns True if the response format is empty, false otherwise
|
|
137
|
+
*/
|
|
138
|
+
isEmptyResponseFormat(value) {
|
|
139
|
+
if (!value) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
if (Object.keys(value).length === 0) {
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
return !!(value.object &&
|
|
146
|
+
Object.keys(value.object).length === 0 &&
|
|
147
|
+
!value.aggregates);
|
|
148
|
+
}
|
|
135
149
|
static get is() { return "limebb-lime-query-response-format-editor"; }
|
|
136
150
|
static get encapsulation() { return "shadow"; }
|
|
137
151
|
static get originalStyleUrls() {
|
|
@@ -39,11 +39,9 @@ const LimeQueryBuilder = /*@__PURE__*/ proxyCustomElement(class LimeQueryBuilder
|
|
|
39
39
|
this.limetype = event.detail;
|
|
40
40
|
// Reset filter when limetype changes
|
|
41
41
|
this.filter = undefined;
|
|
42
|
-
// Reset response format when limetype changes
|
|
42
|
+
// Reset response format when limetype changes - empty state
|
|
43
43
|
this.internalResponseFormat = {
|
|
44
|
-
object: {
|
|
45
|
-
_id: null,
|
|
46
|
-
},
|
|
44
|
+
object: {},
|
|
47
45
|
};
|
|
48
46
|
this.emitChange();
|
|
49
47
|
};
|
|
@@ -196,46 +196,29 @@ const ResponseFormatEditor = /*@__PURE__*/ proxyCustomElement(class ResponseForm
|
|
|
196
196
|
};
|
|
197
197
|
}
|
|
198
198
|
componentWillLoad() {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
// Keep items empty for truly empty objects
|
|
199
|
+
if (!this.value) {
|
|
200
|
+
// No value provided at all, use default _id
|
|
201
|
+
this.items = [{ path: '_id' }];
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
if (this.isEmptyResponseFormat(this.value)) {
|
|
205
|
+
// Show empty state for explicit empty objects
|
|
207
206
|
this.items = [];
|
|
208
207
|
}
|
|
209
|
-
else if (
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
this.items = converted;
|
|
213
|
-
}
|
|
214
|
-
else {
|
|
215
|
-
// Empty object property, but not a truly empty value
|
|
216
|
-
// Use default _id for backward compatibility
|
|
217
|
-
this.items = [{ path: '_id' }];
|
|
218
|
-
}
|
|
208
|
+
else if (this.value.object) {
|
|
209
|
+
// Has object property with actual properties
|
|
210
|
+
this.items = propertySelectionToItems(this.value.object);
|
|
219
211
|
}
|
|
220
|
-
else
|
|
221
|
-
//
|
|
222
|
-
this.items = [
|
|
212
|
+
else {
|
|
213
|
+
// If value has aggregates but no object property, initialize items to empty array
|
|
214
|
+
this.items = [];
|
|
223
215
|
}
|
|
224
216
|
}
|
|
225
217
|
componentWillUpdate() {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
const isTrulyEmpty = this.value &&
|
|
229
|
-
Object.keys(this.value).length === 0 &&
|
|
230
|
-
!this.value.object &&
|
|
231
|
-
!this.value.aggregates;
|
|
232
|
-
if (isTrulyEmpty) {
|
|
233
|
-
// Keep items empty for truly empty objects
|
|
234
|
-
if (this.items.length > 0) {
|
|
235
|
-
this.items = [];
|
|
236
|
-
}
|
|
218
|
+
if (!this.value) {
|
|
219
|
+
return;
|
|
237
220
|
}
|
|
238
|
-
|
|
221
|
+
if (this.value.object && !this.isEmptyResponseFormat(this.value)) {
|
|
239
222
|
const currentItems = propertySelectionToItems(this.value.object);
|
|
240
223
|
// Check if items have changed
|
|
241
224
|
const itemsChanged = currentItems.length !== this.items.length ||
|
|
@@ -247,10 +230,15 @@ const ResponseFormatEditor = /*@__PURE__*/ proxyCustomElement(class ResponseForm
|
|
|
247
230
|
item.description === current.description);
|
|
248
231
|
});
|
|
249
232
|
if (itemsChanged) {
|
|
250
|
-
// Allow empty items array - don't force _id
|
|
251
233
|
this.items = currentItems;
|
|
252
234
|
}
|
|
253
235
|
}
|
|
236
|
+
else {
|
|
237
|
+
// Either empty response format or no object property - clear items
|
|
238
|
+
if (this.items.length > 0) {
|
|
239
|
+
this.items = [];
|
|
240
|
+
}
|
|
241
|
+
}
|
|
254
242
|
}
|
|
255
243
|
render() {
|
|
256
244
|
if (!this.limetype) {
|
|
@@ -281,6 +269,32 @@ const ResponseFormatEditor = /*@__PURE__*/ proxyCustomElement(class ResponseForm
|
|
|
281
269
|
};
|
|
282
270
|
this.change.emit(responseFormat);
|
|
283
271
|
}
|
|
272
|
+
/**
|
|
273
|
+
* Check if the response format is empty
|
|
274
|
+
*
|
|
275
|
+
* A response format is considered empty in the following cases:
|
|
276
|
+
* - Empty object: `{}`
|
|
277
|
+
* - Object with empty object property and no aggregates: `{ object: {} }`
|
|
278
|
+
*
|
|
279
|
+
* Returns false for:
|
|
280
|
+
* - `null` or `undefined`
|
|
281
|
+
* - Objects with properties: `{ object: { _id: null } }`
|
|
282
|
+
* - Objects with aggregates: `{ aggregates: {...} }`
|
|
283
|
+
*
|
|
284
|
+
* @param value - The ResponseFormat to check
|
|
285
|
+
* @returns True if the response format is empty, false otherwise
|
|
286
|
+
*/
|
|
287
|
+
isEmptyResponseFormat(value) {
|
|
288
|
+
if (!value) {
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
291
|
+
if (Object.keys(value).length === 0) {
|
|
292
|
+
return true;
|
|
293
|
+
}
|
|
294
|
+
return !!(value.object &&
|
|
295
|
+
Object.keys(value.object).length === 0 &&
|
|
296
|
+
!value.aggregates);
|
|
297
|
+
}
|
|
284
298
|
static get style() { return LimebbLimeQueryResponseFormatEditorStyle0; }
|
|
285
299
|
}, [1, "limebb-lime-query-response-format-editor", {
|
|
286
300
|
"platform": [16],
|
|
@@ -28,11 +28,9 @@ const LimeQueryBuilder = class {
|
|
|
28
28
|
this.limetype = event.detail;
|
|
29
29
|
// Reset filter when limetype changes
|
|
30
30
|
this.filter = undefined;
|
|
31
|
-
// Reset response format when limetype changes
|
|
31
|
+
// Reset response format when limetype changes - empty state
|
|
32
32
|
this.internalResponseFormat = {
|
|
33
|
-
object: {
|
|
34
|
-
_id: null,
|
|
35
|
-
},
|
|
33
|
+
object: {},
|
|
36
34
|
};
|
|
37
35
|
this.emitChange();
|
|
38
36
|
};
|
|
@@ -192,46 +192,29 @@ const ResponseFormatEditor = class {
|
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
194
|
componentWillLoad() {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
// Keep items empty for truly empty objects
|
|
195
|
+
if (!this.value) {
|
|
196
|
+
// No value provided at all, use default _id
|
|
197
|
+
this.items = [{ path: '_id' }];
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
if (this.isEmptyResponseFormat(this.value)) {
|
|
201
|
+
// Show empty state for explicit empty objects
|
|
203
202
|
this.items = [];
|
|
204
203
|
}
|
|
205
|
-
else if (
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
this.items = converted;
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
// Empty object property, but not a truly empty value
|
|
212
|
-
// Use default _id for backward compatibility
|
|
213
|
-
this.items = [{ path: '_id' }];
|
|
214
|
-
}
|
|
204
|
+
else if (this.value.object) {
|
|
205
|
+
// Has object property with actual properties
|
|
206
|
+
this.items = propertySelectionToItems(this.value.object);
|
|
215
207
|
}
|
|
216
|
-
else
|
|
217
|
-
//
|
|
218
|
-
this.items = [
|
|
208
|
+
else {
|
|
209
|
+
// If value has aggregates but no object property, initialize items to empty array
|
|
210
|
+
this.items = [];
|
|
219
211
|
}
|
|
220
212
|
}
|
|
221
213
|
componentWillUpdate() {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
const isTrulyEmpty = this.value &&
|
|
225
|
-
Object.keys(this.value).length === 0 &&
|
|
226
|
-
!this.value.object &&
|
|
227
|
-
!this.value.aggregates;
|
|
228
|
-
if (isTrulyEmpty) {
|
|
229
|
-
// Keep items empty for truly empty objects
|
|
230
|
-
if (this.items.length > 0) {
|
|
231
|
-
this.items = [];
|
|
232
|
-
}
|
|
214
|
+
if (!this.value) {
|
|
215
|
+
return;
|
|
233
216
|
}
|
|
234
|
-
|
|
217
|
+
if (this.value.object && !this.isEmptyResponseFormat(this.value)) {
|
|
235
218
|
const currentItems = propertySelectionToItems(this.value.object);
|
|
236
219
|
// Check if items have changed
|
|
237
220
|
const itemsChanged = currentItems.length !== this.items.length ||
|
|
@@ -243,10 +226,15 @@ const ResponseFormatEditor = class {
|
|
|
243
226
|
item.description === current.description);
|
|
244
227
|
});
|
|
245
228
|
if (itemsChanged) {
|
|
246
|
-
// Allow empty items array - don't force _id
|
|
247
229
|
this.items = currentItems;
|
|
248
230
|
}
|
|
249
231
|
}
|
|
232
|
+
else {
|
|
233
|
+
// Either empty response format or no object property - clear items
|
|
234
|
+
if (this.items.length > 0) {
|
|
235
|
+
this.items = [];
|
|
236
|
+
}
|
|
237
|
+
}
|
|
250
238
|
}
|
|
251
239
|
render() {
|
|
252
240
|
if (!this.limetype) {
|
|
@@ -277,6 +265,32 @@ const ResponseFormatEditor = class {
|
|
|
277
265
|
};
|
|
278
266
|
this.change.emit(responseFormat);
|
|
279
267
|
}
|
|
268
|
+
/**
|
|
269
|
+
* Check if the response format is empty
|
|
270
|
+
*
|
|
271
|
+
* A response format is considered empty in the following cases:
|
|
272
|
+
* - Empty object: `{}`
|
|
273
|
+
* - Object with empty object property and no aggregates: `{ object: {} }`
|
|
274
|
+
*
|
|
275
|
+
* Returns false for:
|
|
276
|
+
* - `null` or `undefined`
|
|
277
|
+
* - Objects with properties: `{ object: { _id: null } }`
|
|
278
|
+
* - Objects with aggregates: `{ aggregates: {...} }`
|
|
279
|
+
*
|
|
280
|
+
* @param value - The ResponseFormat to check
|
|
281
|
+
* @returns True if the response format is empty, false otherwise
|
|
282
|
+
*/
|
|
283
|
+
isEmptyResponseFormat(value) {
|
|
284
|
+
if (!value) {
|
|
285
|
+
return false;
|
|
286
|
+
}
|
|
287
|
+
if (Object.keys(value).length === 0) {
|
|
288
|
+
return true;
|
|
289
|
+
}
|
|
290
|
+
return !!(value.object &&
|
|
291
|
+
Object.keys(value.object).length === 0 &&
|
|
292
|
+
!value.aggregates);
|
|
293
|
+
}
|
|
280
294
|
};
|
|
281
295
|
ResponseFormatEditor.style = LimebbLimeQueryResponseFormatEditorStyle0;
|
|
282
296
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as t}from"./p-1556b545.js";export{s as setNonce}from"./p-1556b545.js";import{g as i}from"./p-e1255160.js";(()=>{const t=import.meta.url,i={};return""!==t&&(i.resourcesUrl=new URL(".",t).href),e(i)})().then((async e=>(await i(),t(JSON.parse('[["p-4f605428",[[1,"limebb-lime-query-builder",{"platform":[16],"context":[16],"value":[16],"label":[1],"activeLimetype":[1,"active-limetype"],"limetypes":[32],"mode":[32],"codeValue":[32],"limetype":[32],"filter":[32],"internalResponseFormat":[32],"limit":[32],"orderBy":[32]}]]],["p-ee1b00b9",[[1,"limebb-feed",{"platform":[16],"context":[16],"items":[16],"emptyStateMessage":[1,"empty-state-message"],"heading":[1],"loading":[4],"minutesOfProximity":[2,"minutes-of-proximity"],"totalCount":[2,"total-count"],"direction":[513],"lastVisitedTimestamp":[1,"last-visited-timestamp"],"highlightedItemId":[8,"highlighted-item-id"]},null,{"highlightedItemId":["highlightedItemIdChanged"]}]]],["p-3a406a20",[[1,"limebb-kanban",{"platform":[16],"context":[16],"groups":[16]}]]],["p-96fee7ee",[[1,"limebb-lime-query-response-format-builder",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"helperText":[1,"helper-text"],"limetypes":[32],"mode":[32],"codeValue":[32],"internalValue":[32]}]]],["p-32534eb7",[[1,"limebb-chat-list",{"platform":[16],"context":[16],"items":[16],"loading":[516],"isTypingIndicatorVisible":[516,"is-typing-indicator-visible"],"lastVisitedTimestamp":[513,"last-visited-timestamp"],"order":[513]},null,{"items":["handleItemsChange"]}]]],["p-03af0e66",[[1,"limebb-limeobject-file-viewer",{"platform":[16],"context":[16],"property":[1],"fileTypes":[16],"limeobject":[32],"limetype":[32]}]]],["p-36ea13c0",[[1,"limebb-text-editor",{"platform":[16],"context":[16],"allowMentioning":[4,"allow-mentioning"],"contentType":[1,"content-type"],"language":[513],"disabled":[516],"readonly":[516],"helperText":[513,"helper-text"],"placeholder":[513],"label":[513],"invalid":[516],"required":[516],"selectedContext":[16],"ui":[513],"allowResize":[4,"allow-resize"],"value":[1],"draftIdentifier":[1,"draft-identifier"],"triggerMap":[16],"customElements":[16],"allowInlineImages":[4,"allow-inline-images"],"items":[32],"highlightedItemIndex":[32],"editorPickerQuery":[32],"searchableLimetypes":[32],"isPickerOpen":[32],"isSearching":[32]},null,{"isPickerOpen":["watchOpen"],"editorPickerQuery":["watchQuery"]}]]],["p-8491aaa1",[[1,"limebb-date-range",{"platform":[16],"context":[16],"startTime":[16],"endTime":[16],"startTimeLabel":[1,"start-time-label"],"endTimeLabel":[1,"end-time-label"],"language":[1],"timeFormat":[1,"time-format"],"type":[1]}]]],["p-4a82410e",[[1,"limebb-document-picker",{"platform":[16],"context":[16],"items":[16],"label":[513],"helperText":[513,"helper-text"],"invalid":[516],"required":[516],"type":[513]}]]],["p-568b7520",[[1,"limebb-info-tile-currency-format",{"platform":[16],"context":[16],"value":[16]}]]],["p-2fdcb868",[[1,"limebb-notification-list",{"platform":[16],"context":[16],"items":[16],"loading":[4],"lastVisitedTimestamp":[1,"last-visited-timestamp"]},null,{"items":["handleItemsChange"]}]]],["p-5464f0de",[[17,"limebb-browser",{"platform":[16],"context":[16],"items":[16],"layout":[1],"filter":[32]}]]],["p-3175883d",[[1,"limebb-component-config",{"platform":[16],"context":[16],"value":[16],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"formInfo":[16],"type":[1],"nameField":[1,"name-field"],"configComponent":[32],"configViewType":[32]},null,{"formInfo":["watchFormInfo"],"configComponent":["watchconfigComponent"]}]]],["p-1be0eec7",[[1,"limebb-component-picker",{"platform":[16],"context":[16],"type":[1],"tags":[16],"value":[1],"copyLabel":[1,"copy-label"],"hideCopyButton":[4,"hide-copy-button"],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["p-10ac8b3e",[[1,"limebb-dashboard-widget",{"heading":[513],"subheading":[513],"supportingText":[513,"supporting-text"],"icon":[513]}]]],["p-e35299e0",[[1,"limebb-icon-picker",{"value":[1],"required":[4],"readonly":[4],"invalid":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["p-a200954f",[[1,"limebb-info-tile",{"platform":[16],"context":[16],"filterId":[513,"filter-id"],"disabled":[4],"icon":[513],"label":[1],"prefix":[1],"suffix":[1],"propertyName":[1,"property-name"],"aggregateOperator":[1,"aggregate-operator"],"format":[16],"config":[32],"filters":[32],"value":[32],"loading":[32],"error":[32]},null,{"filterId":["watchFilterId"],"propertyName":["watchPropertyName"],"aggregateOperator":["watchAggregateOperator"]}]]],["p-01cff04f",[[1,"limebb-info-tile-date-format",{"value":[16]}]]],["p-4caa8bbe",[[1,"limebb-info-tile-decimal-format",{"value":[16]}]]],["p-ff0b244b",[[1,"limebb-info-tile-format",{"platform":[16],"context":[16],"type":[1],"value":[16]}]]],["p-25e1a434",[[1,"limebb-info-tile-relative-date-format",{"value":[16]}]]],["p-6c56121c",[[1,"limebb-info-tile-unit-format",{"value":[16]}]]],["p-206575e4",[[1,"limebb-loader",{"platform":[16],"context":[16]}]]],["p-e8946134",[[1,"limebb-locale-picker",{"platform":[16],"context":[16],"value":[1],"required":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"readonly":[4],"multipleChoice":[4,"multiple-choice"],"allLanguages":[32]}]]],["p-cfa1a4ad",[[1,"limebb-mention",{"limetype":[1],"objectid":[2],"limeobject":[32]}]]],["p-9cac4de2",[[1,"limebb-mention-group-counter",{"count":[2],"limetype":[16],"helperLabel":[1,"helper-label"]}]]],["p-569c86b5",[[1,"limebb-percentage-visualizer",{"platform":[16],"context":[16],"value":[520],"rangeMax":[514,"range-max"],"rangeMin":[514,"range-min"],"multiplier":[514],"label":[513],"invalid":[516],"required":[516],"helperText":[513,"helper-text"],"reducePresence":[516,"reduce-presence"],"displayPercentageColors":[516,"display-percentage-colors"]},null,{"value":["valueChanged"]}]]],["p-3122ea05",[[1,"limebb-trend-indicator",{"platform":[16],"context":[16],"value":[520],"formerValue":[514,"former-value"],"suffix":[513],"label":[513],"invalid":[516],"required":[516],"helperText":[513,"helper-text"],"reducePresence":[516,"reduce-presence"]},null,{"value":["valueChanged"]}]]],["p-7271f47a",[[1,"limebb-feed-timeline-item",{"platform":[16],"context":[16],"item":[16],"ui":[513],"helperText":[1,"helper-text"],"hasError":[516,"has-error"],"isBundled":[516,"is-bundled"],"headingCanExpand":[32],"isHeadingExpanded":[32],"showMore":[32],"isTall":[32]}]]],["p-eb81bceb",[[1,"limebb-kanban-item",{"platform":[16],"context":[16],"item":[16]}]]],["p-2faaacbc",[[1,"limebb-kanban-group",{"platform":[16],"context":[16],"identifier":[1],"heading":[513],"help":[1],"items":[16],"summary":[1],"loading":[516],"totalCount":[514,"total-count"]}]]],["p-218b7f38",[[1,"limebb-text-editor-picker",{"items":[16],"open":[516],"isSearching":[4,"is-searching"],"emptyMessage":[1,"empty-message"]},null,{"open":["watchOpen"]}]]],["p-9031f136",[[1,"limebb-currency-picker",{"platform":[16],"context":[16],"label":[513],"currencies":[16],"helperText":[513,"helper-text"],"required":[516],"readonly":[516],"invalid":[516],"disabled":[516],"value":[1]}]]],["p-098ee6c1",[[1,"limebb-date-picker",{"platform":[16],"context":[16],"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[1],"type":[513]}]]],["p-9d25ed5a",[[17,"limebb-document-item",{"platform":[16],"context":[16],"item":[16],"type":[513]}]]],["p-93cadc1e",[[1,"limebb-live-docs-info"]]],["p-b9b954d9",[[1,"limebb-notification-item",{"platform":[16],"context":[16],"item":[16]}]]],["p-fdd5600b",[[1,"limebb-lime-query-order-by-item",{"platform":[16],"context":[16],"limetype":[1],"item":[16]}]]],["p-5dc574a3",[[1,"limebb-chat-item",{"platform":[16],"context":[16],"item":[16],"helperText":[1,"helper-text"],"hasError":[516,"has-error"]}],[1,"limebb-typing-indicator"]]],["p-61282e1a",[[1,"limebb-feed-item-thumbnail-file-info",{"description":[1]}]]],["p-6c7af6bb",[[1,"limebb-lime-query-filter-builder",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}],[1,"limebb-lime-query-order-by-editor",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"items":[32]},null,{"value":["handleValueChange"]}],[0,"limebb-limetype-field",{"platform":[16],"context":[16],"label":[513],"required":[516],"readonly":[516],"disabled":[516],"value":[513],"helperText":[513,"helper-text"],"invalid":[4],"limetypes":[16],"propertyFields":[16],"fieldName":[1,"field-name"],"formInfo":[16]}]]],["p-292631ea",[[1,"limebb-empty-state",{"heading":[513],"value":[513],"icon":[16]}]]],["p-d8696b23",[[1,"limebb-property-selector",{"platform":[16],"context":[16],"limetype":[1],"value":[1],"label":[1],"required":[4],"helperText":[1,"helper-text"],"limetypes":[32],"isOpen":[32],"navigationPath":[32]}]]],["p-d635e6fc",[[1,"limebb-lime-query-response-format-editor",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"items":[32]}],[1,"limebb-lime-query-response-format-item",{"platform":[16],"context":[16],"limetype":[1],"item":[16],"showAliasInput":[32],"showDescriptionInput":[32]}]]],["p-631ca5a5",[[1,"limebb-summary-popover",{"triggerDelay":[514,"trigger-delay"],"heading":[513],"subheading":[513],"image":[16],"icon":[513],"value":[1],"openDirection":[513,"open-direction"],"popoverMaxWidth":[513,"popover-max-width"],"popoverMaxHeight":[513,"popover-max-height"],"actions":[16],"isPopoverOpen":[32]}],[17,"limebb-navigation-button",{"href":[513],"tooltipLabel":[513,"tooltip-label"],"tooltipHelperLabel":[513,"tooltip-helper-label"],"type":[513]}]]],["p-908dd7d5",[[1,"limebb-lime-query-value-input",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"propertyPath":[1,"property-path"],"operator":[1],"value":[8],"label":[1],"limetypes":[32],"inputMode":[32]}],[1,"limebb-lime-query-filter-group",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16],"value":[32]}],[1,"limebb-lime-query-filter-not",{"platform":[16],"context":[16],"label":[1],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}]]],["p-761c7c7c",[[1,"limebb-lime-query-filter-expression",{"platform":[16],"context":[16],"label":[1],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}],[1,"limebb-lime-query-filter-comparison",{"platform":[16],"context":[16],"label":[513],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}]]]]'),e))));
|
|
1
|
+
import{p as e,b as t}from"./p-1556b545.js";export{s as setNonce}from"./p-1556b545.js";import{g as i}from"./p-e1255160.js";(()=>{const t=import.meta.url,i={};return""!==t&&(i.resourcesUrl=new URL(".",t).href),e(i)})().then((async e=>(await i(),t(JSON.parse('[["p-fe6a94a1",[[1,"limebb-lime-query-builder",{"platform":[16],"context":[16],"value":[16],"label":[1],"activeLimetype":[1,"active-limetype"],"limetypes":[32],"mode":[32],"codeValue":[32],"limetype":[32],"filter":[32],"internalResponseFormat":[32],"limit":[32],"orderBy":[32]}]]],["p-ee1b00b9",[[1,"limebb-feed",{"platform":[16],"context":[16],"items":[16],"emptyStateMessage":[1,"empty-state-message"],"heading":[1],"loading":[4],"minutesOfProximity":[2,"minutes-of-proximity"],"totalCount":[2,"total-count"],"direction":[513],"lastVisitedTimestamp":[1,"last-visited-timestamp"],"highlightedItemId":[8,"highlighted-item-id"]},null,{"highlightedItemId":["highlightedItemIdChanged"]}]]],["p-3a406a20",[[1,"limebb-kanban",{"platform":[16],"context":[16],"groups":[16]}]]],["p-96fee7ee",[[1,"limebb-lime-query-response-format-builder",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"helperText":[1,"helper-text"],"limetypes":[32],"mode":[32],"codeValue":[32],"internalValue":[32]}]]],["p-32534eb7",[[1,"limebb-chat-list",{"platform":[16],"context":[16],"items":[16],"loading":[516],"isTypingIndicatorVisible":[516,"is-typing-indicator-visible"],"lastVisitedTimestamp":[513,"last-visited-timestamp"],"order":[513]},null,{"items":["handleItemsChange"]}]]],["p-03af0e66",[[1,"limebb-limeobject-file-viewer",{"platform":[16],"context":[16],"property":[1],"fileTypes":[16],"limeobject":[32],"limetype":[32]}]]],["p-36ea13c0",[[1,"limebb-text-editor",{"platform":[16],"context":[16],"allowMentioning":[4,"allow-mentioning"],"contentType":[1,"content-type"],"language":[513],"disabled":[516],"readonly":[516],"helperText":[513,"helper-text"],"placeholder":[513],"label":[513],"invalid":[516],"required":[516],"selectedContext":[16],"ui":[513],"allowResize":[4,"allow-resize"],"value":[1],"draftIdentifier":[1,"draft-identifier"],"triggerMap":[16],"customElements":[16],"allowInlineImages":[4,"allow-inline-images"],"items":[32],"highlightedItemIndex":[32],"editorPickerQuery":[32],"searchableLimetypes":[32],"isPickerOpen":[32],"isSearching":[32]},null,{"isPickerOpen":["watchOpen"],"editorPickerQuery":["watchQuery"]}]]],["p-8491aaa1",[[1,"limebb-date-range",{"platform":[16],"context":[16],"startTime":[16],"endTime":[16],"startTimeLabel":[1,"start-time-label"],"endTimeLabel":[1,"end-time-label"],"language":[1],"timeFormat":[1,"time-format"],"type":[1]}]]],["p-4a82410e",[[1,"limebb-document-picker",{"platform":[16],"context":[16],"items":[16],"label":[513],"helperText":[513,"helper-text"],"invalid":[516],"required":[516],"type":[513]}]]],["p-568b7520",[[1,"limebb-info-tile-currency-format",{"platform":[16],"context":[16],"value":[16]}]]],["p-2fdcb868",[[1,"limebb-notification-list",{"platform":[16],"context":[16],"items":[16],"loading":[4],"lastVisitedTimestamp":[1,"last-visited-timestamp"]},null,{"items":["handleItemsChange"]}]]],["p-5464f0de",[[17,"limebb-browser",{"platform":[16],"context":[16],"items":[16],"layout":[1],"filter":[32]}]]],["p-3175883d",[[1,"limebb-component-config",{"platform":[16],"context":[16],"value":[16],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"formInfo":[16],"type":[1],"nameField":[1,"name-field"],"configComponent":[32],"configViewType":[32]},null,{"formInfo":["watchFormInfo"],"configComponent":["watchconfigComponent"]}]]],["p-1be0eec7",[[1,"limebb-component-picker",{"platform":[16],"context":[16],"type":[1],"tags":[16],"value":[1],"copyLabel":[1,"copy-label"],"hideCopyButton":[4,"hide-copy-button"],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["p-10ac8b3e",[[1,"limebb-dashboard-widget",{"heading":[513],"subheading":[513],"supportingText":[513,"supporting-text"],"icon":[513]}]]],["p-e35299e0",[[1,"limebb-icon-picker",{"value":[1],"required":[4],"readonly":[4],"invalid":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["p-a200954f",[[1,"limebb-info-tile",{"platform":[16],"context":[16],"filterId":[513,"filter-id"],"disabled":[4],"icon":[513],"label":[1],"prefix":[1],"suffix":[1],"propertyName":[1,"property-name"],"aggregateOperator":[1,"aggregate-operator"],"format":[16],"config":[32],"filters":[32],"value":[32],"loading":[32],"error":[32]},null,{"filterId":["watchFilterId"],"propertyName":["watchPropertyName"],"aggregateOperator":["watchAggregateOperator"]}]]],["p-01cff04f",[[1,"limebb-info-tile-date-format",{"value":[16]}]]],["p-4caa8bbe",[[1,"limebb-info-tile-decimal-format",{"value":[16]}]]],["p-ff0b244b",[[1,"limebb-info-tile-format",{"platform":[16],"context":[16],"type":[1],"value":[16]}]]],["p-25e1a434",[[1,"limebb-info-tile-relative-date-format",{"value":[16]}]]],["p-6c56121c",[[1,"limebb-info-tile-unit-format",{"value":[16]}]]],["p-206575e4",[[1,"limebb-loader",{"platform":[16],"context":[16]}]]],["p-e8946134",[[1,"limebb-locale-picker",{"platform":[16],"context":[16],"value":[1],"required":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"readonly":[4],"multipleChoice":[4,"multiple-choice"],"allLanguages":[32]}]]],["p-cfa1a4ad",[[1,"limebb-mention",{"limetype":[1],"objectid":[2],"limeobject":[32]}]]],["p-9cac4de2",[[1,"limebb-mention-group-counter",{"count":[2],"limetype":[16],"helperLabel":[1,"helper-label"]}]]],["p-569c86b5",[[1,"limebb-percentage-visualizer",{"platform":[16],"context":[16],"value":[520],"rangeMax":[514,"range-max"],"rangeMin":[514,"range-min"],"multiplier":[514],"label":[513],"invalid":[516],"required":[516],"helperText":[513,"helper-text"],"reducePresence":[516,"reduce-presence"],"displayPercentageColors":[516,"display-percentage-colors"]},null,{"value":["valueChanged"]}]]],["p-3122ea05",[[1,"limebb-trend-indicator",{"platform":[16],"context":[16],"value":[520],"formerValue":[514,"former-value"],"suffix":[513],"label":[513],"invalid":[516],"required":[516],"helperText":[513,"helper-text"],"reducePresence":[516,"reduce-presence"]},null,{"value":["valueChanged"]}]]],["p-7271f47a",[[1,"limebb-feed-timeline-item",{"platform":[16],"context":[16],"item":[16],"ui":[513],"helperText":[1,"helper-text"],"hasError":[516,"has-error"],"isBundled":[516,"is-bundled"],"headingCanExpand":[32],"isHeadingExpanded":[32],"showMore":[32],"isTall":[32]}]]],["p-eb81bceb",[[1,"limebb-kanban-item",{"platform":[16],"context":[16],"item":[16]}]]],["p-2faaacbc",[[1,"limebb-kanban-group",{"platform":[16],"context":[16],"identifier":[1],"heading":[513],"help":[1],"items":[16],"summary":[1],"loading":[516],"totalCount":[514,"total-count"]}]]],["p-218b7f38",[[1,"limebb-text-editor-picker",{"items":[16],"open":[516],"isSearching":[4,"is-searching"],"emptyMessage":[1,"empty-message"]},null,{"open":["watchOpen"]}]]],["p-9031f136",[[1,"limebb-currency-picker",{"platform":[16],"context":[16],"label":[513],"currencies":[16],"helperText":[513,"helper-text"],"required":[516],"readonly":[516],"invalid":[516],"disabled":[516],"value":[1]}]]],["p-098ee6c1",[[1,"limebb-date-picker",{"platform":[16],"context":[16],"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[1],"type":[513]}]]],["p-9d25ed5a",[[17,"limebb-document-item",{"platform":[16],"context":[16],"item":[16],"type":[513]}]]],["p-93cadc1e",[[1,"limebb-live-docs-info"]]],["p-b9b954d9",[[1,"limebb-notification-item",{"platform":[16],"context":[16],"item":[16]}]]],["p-fdd5600b",[[1,"limebb-lime-query-order-by-item",{"platform":[16],"context":[16],"limetype":[1],"item":[16]}]]],["p-5dc574a3",[[1,"limebb-chat-item",{"platform":[16],"context":[16],"item":[16],"helperText":[1,"helper-text"],"hasError":[516,"has-error"]}],[1,"limebb-typing-indicator"]]],["p-61282e1a",[[1,"limebb-feed-item-thumbnail-file-info",{"description":[1]}]]],["p-6c7af6bb",[[1,"limebb-lime-query-filter-builder",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}],[1,"limebb-lime-query-order-by-editor",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"items":[32]},null,{"value":["handleValueChange"]}],[0,"limebb-limetype-field",{"platform":[16],"context":[16],"label":[513],"required":[516],"readonly":[516],"disabled":[516],"value":[513],"helperText":[513,"helper-text"],"invalid":[4],"limetypes":[16],"propertyFields":[16],"fieldName":[1,"field-name"],"formInfo":[16]}]]],["p-292631ea",[[1,"limebb-empty-state",{"heading":[513],"value":[513],"icon":[16]}]]],["p-d8696b23",[[1,"limebb-property-selector",{"platform":[16],"context":[16],"limetype":[1],"value":[1],"label":[1],"required":[4],"helperText":[1,"helper-text"],"limetypes":[32],"isOpen":[32],"navigationPath":[32]}]]],["p-adfb9e90",[[1,"limebb-lime-query-response-format-editor",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"items":[32]}],[1,"limebb-lime-query-response-format-item",{"platform":[16],"context":[16],"limetype":[1],"item":[16],"showAliasInput":[32],"showDescriptionInput":[32]}]]],["p-631ca5a5",[[1,"limebb-summary-popover",{"triggerDelay":[514,"trigger-delay"],"heading":[513],"subheading":[513],"image":[16],"icon":[513],"value":[1],"openDirection":[513,"open-direction"],"popoverMaxWidth":[513,"popover-max-width"],"popoverMaxHeight":[513,"popover-max-height"],"actions":[16],"isPopoverOpen":[32]}],[17,"limebb-navigation-button",{"href":[513],"tooltipLabel":[513,"tooltip-label"],"tooltipHelperLabel":[513,"tooltip-helper-label"],"type":[513]}]]],["p-908dd7d5",[[1,"limebb-lime-query-value-input",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"propertyPath":[1,"property-path"],"operator":[1],"value":[8],"label":[1],"limetypes":[32],"inputMode":[32]}],[1,"limebb-lime-query-filter-group",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16],"value":[32]}],[1,"limebb-lime-query-filter-not",{"platform":[16],"context":[16],"label":[1],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}]]],["p-761c7c7c",[[1,"limebb-lime-query-filter-expression",{"platform":[16],"context":[16],"label":[1],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}],[1,"limebb-lime-query-filter-comparison",{"platform":[16],"context":[16],"label":[513],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}]]]]'),e))));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as e,h as i}from"./p-1556b545.js";function s(t,e,i){if(null===i)return void t.push({path:e});const s=i,r="_alias"in s,a="#description"in s,l=Object.keys(s).filter((t=>"_alias"!==t&&"#description"!==t));if(0!==l.length)if(r||a){const i={};for(const t of l)i[t]=s[t];t.push(...o(i,e))}else t.push(...o(i,e));else{const i=s._alias,o=s["#description"];t.push(i||o?{path:e,alias:i,description:o}:{path:e})}}function o(t,e=""){if(!t)return[];const i=[];for(const[o,r]of Object.entries(t))"object"==typeof r&&s(i,e?`${e}.${o}`:o,r);return i}function r(t,e,i){const s=t[e];if(s&&"object"==typeof s&&!("_alias"in s)&&!("#description"in s))return;const o={};i.alias&&""!==i.alias.trim()&&(o._alias=i.alias),i.description&&""!==i.description.trim()&&(o["#description"]=i.description),t[e]=Object.keys(o).length>0?o:null}function a(t,e){const i=t[e];if(!i)return t[e]={},t[e];if("object"==typeof i){const t=i;return Object.keys(t).filter((t=>"_alias"!==t&&"#description"!==t)),t}return t[e]={},t[e]}const l=class{constructor(i){t(this,i),this.change=e(this,"change",7),this.label="Properties",this.items=[],this.handleItemChange=t=>e=>{e.stopPropagation();const i=[...this.items];null===e.detail?i.splice(t,1):i[t]=e.detail,this.items=i,this.emitChange()},this.handleAddProperty=()=>{this.items=[...this.items,{path:""}],this.emitChange()}}componentWillLoad(){this.items=this.value?this.isEmptyResponseFormat(this.value)?[]:this.value.object?o(this.value.object):[]:[{path:"_id"}]}componentWillUpdate(){if(this.value)if(this.value.object&&!this.isEmptyResponseFormat(this.value)){const t=o(this.value.object);(t.length!==this.items.length||!t.every(((t,e)=>{const i=this.items[e];return i&&t.path===i.path&&t.alias===i.alias&&t.description===i.description})))&&(this.items=t)}else this.items.length>0&&(this.items=[])}render(){return this.limetype?0===this.items.length?i("div",{class:"response-format-editor"},i("h4",{class:"header"},this.label),i("div",{class:"empty-state"},i("p",{class:"empty-state-message"},"No properties selected. The response will return empty objects."),i("limel-button",{label:"Add Property",icon:"plus_math",onClick:this.handleAddProperty}))):i("div",{class:"response-format-editor"},i("limel-header",{subheading:this.label},this.renderPropertyCount()),i("div",{class:"property"},i("div",{class:"property-list"},this.items.map(((t,e)=>this.renderItem(t,e)))),i("div",{class:"actions"},i("limel-button",{label:"Property",disabled:this.items.some((t=>!t.path||""===t.path.trim())),icon:{name:"plus_math",title:"Add"},onClick:this.handleAddProperty})))):i("div",{class:"empty-state"},i("p",null,"Select a limetype to choose properties"))}renderPropertyCount(){return[i("limel-badge",{slot:"actions",id:"counter-badge",label:this.items.length.toString()}),i("limel-tooltip",{elementId:"counter-badge",slot:"actions",label:"Number of selected properties"})]}renderItem(t,e){return i("limebb-lime-query-response-format-item",{key:`${t.path}-${e}`,class:"property-item",platform:this.platform,context:this.context,limetype:this.limetype,item:t,onItemChange:this.handleItemChange(e)})}emitChange(){const t=function(t){const e={};for(const i of t){const t=i.path.split(".");let s=e;for(let e=0;e<t.length;e++){const o=t[e];e===t.length-1?r(s,o,i):s=a(s,o)}}return e}(this.items);this.change.emit({object:t})}isEmptyResponseFormat(t){return!(!t||0!==Object.keys(t).length&&(!t.object||0!==Object.keys(t.object).length||t.aggregates))}};l.style=":host(limebb-lime-query-response-format-editor){display:block;width:100%}.response-format-editor{display:flex;flex-direction:column;padding:1rem 0}limel-badge[slot=actions]{--badge-background-color:rgb(var(--contrast-200));margin-right:0.25rem}.property{border:1px solid var(--header-background-color);border-radius:0 0 0.75rem 0.75rem}.property-list{display:flex;flex-direction:column;border-radius:0.25rem;background-color:rgb(var(--contrast-100));gap:0.5rem;padding:0.5rem}.property-item{border-radius:0.25rem;transition:background-color 0.2s}.property-item:hover{background-color:rgb(var(--contrast-100))}.actions{display:flex}.actions limel-button{padding:0.5rem;width:100%}.empty-state{padding:2rem;text-align:center;color:rgb(var(--contrast-700));font-style:italic}.empty-state p{margin:0}.empty-state .empty-state-message{margin-bottom:1rem;font-size:0.875rem}.empty-state limel-button{margin:0 auto;max-width:200px}";const n=class{constructor(i){t(this,i),this.itemChange=e(this,"itemChange",7),this.showAliasInput=!1,this.showDescriptionInput=!1,this.handlePathChange=t=>{t.stopPropagation(),this.itemChange.emit(Object.assign(Object.assign({},this.item),{path:t.detail}))},this.toggleAliasInput=()=>{this.showAliasInput=!this.showAliasInput},this.toggleDescriptionInput=()=>{this.showDescriptionInput=!this.showDescriptionInput},this.handleAliasChange=t=>{t.stopPropagation();const e=t.detail;this.itemChange.emit(Object.assign(Object.assign({},this.item),{alias:e||void 0}))},this.handleDescriptionChange=t=>{t.stopPropagation();const e=t.detail;this.itemChange.emit(Object.assign(Object.assign({},this.item),{description:e||void 0}))},this.handleAliasBlur=()=>{if(this.item.alias){const t=this.item.alias.trim();t!==this.item.alias&&this.itemChange.emit(Object.assign(Object.assign({},this.item),{alias:t||void 0}))}},this.handleDescriptionBlur=()=>{if(this.item.description){const t=this.item.description.trim();t!==this.item.description&&this.itemChange.emit(Object.assign(Object.assign({},this.item),{description:t||void 0}))}},this.handleRemove=()=>{this.itemChange.emit(null)}}componentWillLoad(){this.showAliasInput=!!this.item.alias,this.showDescriptionInput=!!this.item.description}componentWillUpdate(){this.item.alias&&!this.showAliasInput&&(this.showAliasInput=!0),this.item.description&&!this.showDescriptionInput&&(this.showDescriptionInput=!0)}render(){return[i("div",{key:"f80b67734802324c50613070fd91fde35b1caaaa",class:"property-controls"},i("div",{key:"b481a96617ff29690329bff363ee408c42b746d7",class:"property-path"},i("limebb-property-selector",{key:"a936e9586348b27250e3b0404eefb0ee5f5a675e",platform:this.platform,context:this.context,limetype:this.limetype,label:"Property",value:this.item.path,required:!0,onChange:this.handlePathChange})),i("div",{key:"058b8ade00d076764327fbd85e968fbc9b96cb23",class:"control-buttons"},i("limel-icon-button",{key:"85614c39df85b3957aac7a31c2fcbb181cf1c351",icon:this.getAliasIcon(),label:"Add alias",class:this.item.alias?"has-value":"",onClick:this.toggleAliasInput}),i("limel-icon-button",{key:"e09875fdef378d3a4141ba1b428d6239c691dc9f",icon:this.getDescriptionIcon(),label:"Add description",class:this.item.description?"has-value":"",onClick:this.toggleDescriptionInput}),i("limel-icon-button",{key:"5bced548d2cf53d5097d3b6e84a2440d1bb84b11",icon:"trash",label:"Remove property",onClick:this.handleRemove}))),this.showAliasInput&&i("div",{key:"052d6e7f01089914a1b9e79e06cb04b1510c79c2",class:"alias"},i("limel-input-field",{key:"381874f03fdabcedbe07eaf23dd1c31541c42cf4",label:"Alias",value:this.item.alias||"",placeholder:"Custom property name...",onChange:this.handleAliasChange,onBlur:this.handleAliasBlur})),this.showDescriptionInput&&i("div",{key:"083508a61dadb201526b197f60b691bbea7b50df",class:"description"},i("limel-input-field",{key:"bd718e98091d4776394365aa7175d61d11856a9f",label:"Description",value:this.item.description||"",placeholder:"Describe this property for AI...",onChange:this.handleDescriptionChange,onBlur:this.handleDescriptionBlur}))]}getAliasIcon(){return this.showAliasInput?{name:"add_tag",color:"rgb(var(--color-teal-default))"}:{name:"add_tag",color:"rgb(var(--color-gray-600))"}}getDescriptionIcon(){return this.showDescriptionInput?{name:"comments",color:"rgb(var(--color-teal-default))"}:{name:"comments",color:"rgb(var(--color-gray-600))"}}};n.style=":host(limebb-lime-query-response-format-item){display:flex;flex-direction:column;gap:0.5rem}.property-controls{display:flex;flex-wrap:wrap;gap:0.5rem;width:100%}.property-path{flex-grow:1;min-width:min(10rem, 100%)}.control-buttons{flex-shrink:0;display:flex;flex-direction:row;gap:0.25rem;align-items:center}.control-buttons limel-icon-button{opacity:0.6;transition:opacity 0.2s ease}.control-buttons limel-icon-button:hover{opacity:1}.control-buttons limel-icon-button.has-value{opacity:1;color:rgb(var(--color-blue-default))}.alias,.description{padding-left:1rem;width:calc(100% - 8.75rem)}@media (max-width: 768px){.property-controls{flex-direction:column;gap:0.5rem}.alias,.description{padding-left:0;width:100%}}";export{l as limebb_lime_query_response_format_editor,n as limebb_lime_query_response_format_item}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as i,c as e,h as t,H as r}from"./p-1556b545.js";import{T as o}from"./p-4838284a.js";import{i as s}from"./p-fa2da6bc.js";import"./p-b748c770.js";const l=class{constructor(t){i(this,t),this.change=e(this,"change",7),this.mode="gui",this.codeValue="",this.limetype="",this.handleLimetypeChange=i=>{i.stopPropagation(),this.limetype=i.detail,this.filter=void 0,this.internalResponseFormat={object:{}},this.emitChange()},this.handleFilterChange=i=>{var e;i.stopPropagation(),this.filter=null!==(e=i.detail)&&void 0!==e?e:void 0,this.emitChange()},this.handleResponseFormatChange=i=>{i.stopPropagation(),this.internalResponseFormat=i.detail,this.emitChange()},this.handleLimitChange=i=>{i.stopPropagation();const e=i.detail;this.limit=e?Number.parseInt(e,10):void 0,this.emitChange()},this.handleOrderByChange=i=>{i.stopPropagation(),this.orderBy=i.detail,this.emitChange()},this.handleChange=i=>{i.stopPropagation();const e=i.detail.id;if("gui"===e)try{const i=JSON.parse(this.codeValue);if(!this.checkGuiSupport().guiSupported)return;this.limetype=i.limetype||"",this.filter=i.filter,this.internalResponseFormat=i.responseFormat,this.limit=i.limit,this.orderBy=i.orderBy,this.mode="gui",this.change.emit(i)}catch(i){}else"code"===e&&(this.updateCodeValue(),this.mode="code")},this.handleCodeChange=i=>{i.stopPropagation(),this.codeValue=i.detail;try{const i=JSON.parse(this.codeValue);this.change.emit(i)}catch(i){}}}getButtons(){return[{id:"gui",title:"Visual"},{id:"code",title:"Code"}]}get guiModeEnabled(){var i,e,t;return null!==(t=null===(e=null===(i=this.platform)||void 0===i?void 0:i.isFeatureEnabled)||void 0===e?void 0:e.call(i,"useLimeQueryBuilderGuiMode"))&&void 0!==t&&t}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.orderBy=this.value.orderBy),this.updateCodeValue(),this.checkGuiSupport().guiSupported||(this.mode="code")}render(){return t(r,{key:"02e7367fbc718a8625c8d49d5e546acca0986ce2"},this.renderHeader(),this.renderContent())}renderContent(){const i=this.checkGuiSupport();return this.guiModeEnabled&&"code"!==this.mode?this.renderGuiMode():this.renderCodeMode(i)}emitChange(){"code"!==this.mode&&this.limetype&&this.change.emit(this.buildLimeQuery())}updateCodeValue(){this.codeValue=this.limetype?JSON.stringify(this.buildLimeQuery(),null,2):JSON.stringify(this.value||{},null,2)}buildLimeQuery(){const i={limetype:this.limetype,responseFormat:this.internalResponseFormat||{object:{_id:null}},filter:this.filter};return void 0!==this.limit&&this.limit>0&&(i.limit=this.limit),this.orderBy&&this.orderBy.length>0&&(i.orderBy=this.orderBy),i}checkGuiSupport(){if(!this.limetypes)return{valid:!0,guiSupported:!0,validationErrors:[],guiLimitations:[]};let i;if("code"===this.mode&&this.codeValue)try{i=JSON.parse(this.codeValue)}catch(i){return{valid:!1,guiSupported:!1,validationErrors:["Invalid JSON"],guiLimitations:[]}}else{if(!this.limetype)return{valid:!0,guiSupported:!0,validationErrors:[],guiLimitations:[]};i={limetype:this.limetype,responseFormat:this.internalResponseFormat||{object:{_id:null}},filter:this.filter},void 0!==this.limit&&this.limit>0&&(i.limit=this.limit)}return s(i,this.limetypes,this.activeLimetype,this.guiModeEnabled)}renderModeSwitch(i){const e=!i.guiSupported,r=this.getButtons().map((i=>Object.assign(Object.assign({},i),{selected:i.id===this.mode})));return t("limel-button-group",{slot:"actions",onChange:this.handleChange,value:r,disabled:e})}renderCodeEditor(i){return[t("limel-code-editor",{value:this.codeValue,language:"json",lineNumbers:!0,fold:!0,lint:!0,onChange:this.handleCodeChange}),!i.valid&&i.validationErrors.length>0&&t("div",{class:"validation-errors"},t("strong",null,"Invalid Lime Query:"),t("ul",null,i.validationErrors.map((i=>t("li",null,i))))),this.guiModeEnabled&&i.valid&&!i.guiSupported&&i.guiLimitations.length>0&&t("div",{class:"gui-limitations"},t("strong",null,"Cannot switch to GUI mode:"),t("ul",null,i.guiLimitations.map((i=>t("li",null,i)))))]}renderLimetypeSection(){return t("limebb-limetype-field",{platform:this.platform,context:this.context,label:"Limetype",value:this.limetype,required:!0,fieldName:"limetype",onChange:this.handleLimetypeChange})}renderResponseFormatSection(){if(this.limetype)return t("section",{class:"response-format"},t("limebb-lime-query-response-format-editor",{platform:this.platform,context:this.context,limetype:this.limetype,value:this.internalResponseFormat,onChange:this.handleResponseFormatChange}))}renderFilterSection(){if(this.limetype)return t("section",{class:"filter"},t("limel-header",{class:"is-narrow",heading:"Filter Conditions",icon:"-lime-filter"}),t("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 i;if(this.limetype)return t("section",{class:"query-options"},t("limel-header",{class:"is-narrow",heading:"Query Options",icon:"ask_question"}),t("div",{class:"query-options-controls"},t("limel-input-field",{label:"Limit",type:"number",value:(null===(i=this.limit)||void 0===i?void 0:i.toString())||"",placeholder:"No limit",helperText:"Maximum number of results",onChange:this.handleLimitChange}),t("limebb-lime-query-order-by-editor",{platform:this.platform,context:this.context,limetype:this.limetype,value:this.orderBy,onChange:this.handleOrderByChange})))}renderGuiMode(){return t("div",{class:"gui-mode"},this.renderLimetypeSection(),this.renderResponseFormatSection(),this.renderFilterSection(),this.renderQueryOptionsSection())}renderHeader(){const i=this.checkGuiSupport();return t("limel-header",{heading:this.label},this.renderModeControls(i))}renderModeControls(i){if(this.guiModeEnabled)return this.renderModeSwitch(i)}renderCodeMode(i){return t("div",{class:"code-mode"},this.renderCodeEditor(i))}};(function(i,e,t,r){var o,s=arguments.length,l=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,t):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(i,e,t,r);else for(var d=i.length-1;d>=0;d--)(o=i[d])&&(l=(s<3?o(l):s>3?o(e,t,l):o(e,t))||l);s>3&&l&&Object.defineProperty(e,t,l)})([o()],l.prototype,"limetypes",void 0),l.style="*,*:before,*:after{box-sizing:border-box}:host(limebb-lime-query-builder){--header-background-color:rgb(var(--contrast-400));--limebb-lime-query-builder-background-color:rgb(var(--contrast-100));--limebb-lime-query-builder-border-radius:0.75rem;--limebb-lime-query-builder-gui-mode-padding:1rem;--limebb-lime-query-builder-group-color:rgb(var(--color-sky-lighter));box-sizing:border-box;width:calc(100% - 1.5rem);margin:0.75rem auto;display:flex;flex-direction:column;border-radius:var(--limebb-lime-query-builder-border-radius);background-color:var(--limebb-lime-query-builder-background-color);box-shadow:var(--shadow-inflated-16)}.gui-mode{display:flex;flex-direction:column;gap:1rem;padding:var(--limebb-lime-query-builder-gui-mode-padding);border:1px solid var(--header-background-color);border-radius:0 0 var(--limebb-lime-query-builder-border-radius) var(--limebb-lime-query-builder-border-radius)}.code-mode{--code-editor-max-height:70vh;display:flex;flex-direction:column;gap:1rem}.code-mode .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-mode .validation-errors strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-mode .validation-errors ul{margin:0;padding-left:1.5rem}.code-mode .validation-errors li{margin:0.25rem 0}.code-mode .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-mode .gui-limitations strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-mode .gui-limitations ul{margin:0;padding-left:1.5rem}.code-mode .gui-limitations li{margin:0.25rem 0}section.filter,section.query-options{display:flex;flex-direction:column;gap:1rem}section h4{margin:0;font-size:1.125rem;font-weight:600;color:rgb(var(--contrast-1000))}limel-header.is-narrow{--header-top-right-left-border-radius:0;width:calc(100% + var(--limebb-lime-query-builder-gui-mode-padding) * 2);margin-left:calc(var(--limebb-lime-query-builder-gui-mode-padding) * -1)}.query-options-controls{display:flex;flex-direction:column;gap:1rem}";export{l as limebb_lime_query_builder}
|
package/dist/types/components/lime-query-builder/response-format/response-format-editor.d.ts
CHANGED
|
@@ -54,5 +54,21 @@ export declare class ResponseFormatEditor implements LimeWebComponent {
|
|
|
54
54
|
private handleItemChange;
|
|
55
55
|
private handleAddProperty;
|
|
56
56
|
private emitChange;
|
|
57
|
+
/**
|
|
58
|
+
* Check if the response format is empty
|
|
59
|
+
*
|
|
60
|
+
* A response format is considered empty in the following cases:
|
|
61
|
+
* - Empty object: `{}`
|
|
62
|
+
* - Object with empty object property and no aggregates: `{ object: {} }`
|
|
63
|
+
*
|
|
64
|
+
* Returns false for:
|
|
65
|
+
* - `null` or `undefined`
|
|
66
|
+
* - Objects with properties: `{ object: { _id: null } }`
|
|
67
|
+
* - Objects with aggregates: `{ aggregates: {...} }`
|
|
68
|
+
*
|
|
69
|
+
* @param value - The ResponseFormat to check
|
|
70
|
+
* @returns True if the response format is empty, false otherwise
|
|
71
|
+
*/
|
|
72
|
+
private isEmptyResponseFormat;
|
|
57
73
|
}
|
|
58
74
|
//# sourceMappingURL=response-format-editor.d.ts.map
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as i,c as e,h as t,H as r}from"./p-1556b545.js";import{T as o}from"./p-4838284a.js";import{i as s}from"./p-fa2da6bc.js";import"./p-b748c770.js";const l=class{constructor(t){i(this,t),this.change=e(this,"change",7),this.mode="gui",this.codeValue="",this.limetype="",this.handleLimetypeChange=i=>{i.stopPropagation(),this.limetype=i.detail,this.filter=void 0,this.internalResponseFormat={object:{_id:null}},this.emitChange()},this.handleFilterChange=i=>{var e;i.stopPropagation(),this.filter=null!==(e=i.detail)&&void 0!==e?e:void 0,this.emitChange()},this.handleResponseFormatChange=i=>{i.stopPropagation(),this.internalResponseFormat=i.detail,this.emitChange()},this.handleLimitChange=i=>{i.stopPropagation();const e=i.detail;this.limit=e?Number.parseInt(e,10):void 0,this.emitChange()},this.handleOrderByChange=i=>{i.stopPropagation(),this.orderBy=i.detail,this.emitChange()},this.handleChange=i=>{i.stopPropagation();const e=i.detail.id;if("gui"===e)try{const i=JSON.parse(this.codeValue);if(!this.checkGuiSupport().guiSupported)return;this.limetype=i.limetype||"",this.filter=i.filter,this.internalResponseFormat=i.responseFormat,this.limit=i.limit,this.orderBy=i.orderBy,this.mode="gui",this.change.emit(i)}catch(i){}else"code"===e&&(this.updateCodeValue(),this.mode="code")},this.handleCodeChange=i=>{i.stopPropagation(),this.codeValue=i.detail;try{const i=JSON.parse(this.codeValue);this.change.emit(i)}catch(i){}}}getButtons(){return[{id:"gui",title:"Visual"},{id:"code",title:"Code"}]}get guiModeEnabled(){var i,e,t;return null!==(t=null===(e=null===(i=this.platform)||void 0===i?void 0:i.isFeatureEnabled)||void 0===e?void 0:e.call(i,"useLimeQueryBuilderGuiMode"))&&void 0!==t&&t}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.orderBy=this.value.orderBy),this.updateCodeValue(),this.checkGuiSupport().guiSupported||(this.mode="code")}render(){return t(r,{key:"02e7367fbc718a8625c8d49d5e546acca0986ce2"},this.renderHeader(),this.renderContent())}renderContent(){const i=this.checkGuiSupport();return this.guiModeEnabled&&"code"!==this.mode?this.renderGuiMode():this.renderCodeMode(i)}emitChange(){"code"!==this.mode&&this.limetype&&this.change.emit(this.buildLimeQuery())}updateCodeValue(){this.codeValue=this.limetype?JSON.stringify(this.buildLimeQuery(),null,2):JSON.stringify(this.value||{},null,2)}buildLimeQuery(){const i={limetype:this.limetype,responseFormat:this.internalResponseFormat||{object:{_id:null}},filter:this.filter};return void 0!==this.limit&&this.limit>0&&(i.limit=this.limit),this.orderBy&&this.orderBy.length>0&&(i.orderBy=this.orderBy),i}checkGuiSupport(){if(!this.limetypes)return{valid:!0,guiSupported:!0,validationErrors:[],guiLimitations:[]};let i;if("code"===this.mode&&this.codeValue)try{i=JSON.parse(this.codeValue)}catch(i){return{valid:!1,guiSupported:!1,validationErrors:["Invalid JSON"],guiLimitations:[]}}else{if(!this.limetype)return{valid:!0,guiSupported:!0,validationErrors:[],guiLimitations:[]};i={limetype:this.limetype,responseFormat:this.internalResponseFormat||{object:{_id:null}},filter:this.filter},void 0!==this.limit&&this.limit>0&&(i.limit=this.limit)}return s(i,this.limetypes,this.activeLimetype,this.guiModeEnabled)}renderModeSwitch(i){const e=!i.guiSupported,r=this.getButtons().map((i=>Object.assign(Object.assign({},i),{selected:i.id===this.mode})));return t("limel-button-group",{slot:"actions",onChange:this.handleChange,value:r,disabled:e})}renderCodeEditor(i){return[t("limel-code-editor",{value:this.codeValue,language:"json",lineNumbers:!0,fold:!0,lint:!0,onChange:this.handleCodeChange}),!i.valid&&i.validationErrors.length>0&&t("div",{class:"validation-errors"},t("strong",null,"Invalid Lime Query:"),t("ul",null,i.validationErrors.map((i=>t("li",null,i))))),this.guiModeEnabled&&i.valid&&!i.guiSupported&&i.guiLimitations.length>0&&t("div",{class:"gui-limitations"},t("strong",null,"Cannot switch to GUI mode:"),t("ul",null,i.guiLimitations.map((i=>t("li",null,i)))))]}renderLimetypeSection(){return t("limebb-limetype-field",{platform:this.platform,context:this.context,label:"Limetype",value:this.limetype,required:!0,fieldName:"limetype",onChange:this.handleLimetypeChange})}renderResponseFormatSection(){if(this.limetype)return t("section",{class:"response-format"},t("limebb-lime-query-response-format-editor",{platform:this.platform,context:this.context,limetype:this.limetype,value:this.internalResponseFormat,onChange:this.handleResponseFormatChange}))}renderFilterSection(){if(this.limetype)return t("section",{class:"filter"},t("limel-header",{class:"is-narrow",heading:"Filter Conditions",icon:"-lime-filter"}),t("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 i;if(this.limetype)return t("section",{class:"query-options"},t("limel-header",{class:"is-narrow",heading:"Query Options",icon:"ask_question"}),t("div",{class:"query-options-controls"},t("limel-input-field",{label:"Limit",type:"number",value:(null===(i=this.limit)||void 0===i?void 0:i.toString())||"",placeholder:"No limit",helperText:"Maximum number of results",onChange:this.handleLimitChange}),t("limebb-lime-query-order-by-editor",{platform:this.platform,context:this.context,limetype:this.limetype,value:this.orderBy,onChange:this.handleOrderByChange})))}renderGuiMode(){return t("div",{class:"gui-mode"},this.renderLimetypeSection(),this.renderResponseFormatSection(),this.renderFilterSection(),this.renderQueryOptionsSection())}renderHeader(){const i=this.checkGuiSupport();return t("limel-header",{heading:this.label},this.renderModeControls(i))}renderModeControls(i){if(this.guiModeEnabled)return this.renderModeSwitch(i)}renderCodeMode(i){return t("div",{class:"code-mode"},this.renderCodeEditor(i))}};(function(i,e,t,r){var o,s=arguments.length,l=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,t):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(i,e,t,r);else for(var d=i.length-1;d>=0;d--)(o=i[d])&&(l=(s<3?o(l):s>3?o(e,t,l):o(e,t))||l);s>3&&l&&Object.defineProperty(e,t,l)})([o()],l.prototype,"limetypes",void 0),l.style="*,*:before,*:after{box-sizing:border-box}:host(limebb-lime-query-builder){--header-background-color:rgb(var(--contrast-400));--limebb-lime-query-builder-background-color:rgb(var(--contrast-100));--limebb-lime-query-builder-border-radius:0.75rem;--limebb-lime-query-builder-gui-mode-padding:1rem;--limebb-lime-query-builder-group-color:rgb(var(--color-sky-lighter));box-sizing:border-box;width:calc(100% - 1.5rem);margin:0.75rem auto;display:flex;flex-direction:column;border-radius:var(--limebb-lime-query-builder-border-radius);background-color:var(--limebb-lime-query-builder-background-color);box-shadow:var(--shadow-inflated-16)}.gui-mode{display:flex;flex-direction:column;gap:1rem;padding:var(--limebb-lime-query-builder-gui-mode-padding);border:1px solid var(--header-background-color);border-radius:0 0 var(--limebb-lime-query-builder-border-radius) var(--limebb-lime-query-builder-border-radius)}.code-mode{--code-editor-max-height:70vh;display:flex;flex-direction:column;gap:1rem}.code-mode .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-mode .validation-errors strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-mode .validation-errors ul{margin:0;padding-left:1.5rem}.code-mode .validation-errors li{margin:0.25rem 0}.code-mode .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-mode .gui-limitations strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-mode .gui-limitations ul{margin:0;padding-left:1.5rem}.code-mode .gui-limitations li{margin:0.25rem 0}section.filter,section.query-options{display:flex;flex-direction:column;gap:1rem}section h4{margin:0;font-size:1.125rem;font-weight:600;color:rgb(var(--contrast-1000))}limel-header.is-narrow{--header-top-right-left-border-radius:0;width:calc(100% + var(--limebb-lime-query-builder-gui-mode-padding) * 2);margin-left:calc(var(--limebb-lime-query-builder-gui-mode-padding) * -1)}.query-options-controls{display:flex;flex-direction:column;gap:1rem}";export{l as limebb_lime_query_builder}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as e,h as i}from"./p-1556b545.js";function s(t,e,i){if(null===i)return void t.push({path:e});const s=i,r="_alias"in s,a="#description"in s,l=Object.keys(s).filter((t=>"_alias"!==t&&"#description"!==t));if(0!==l.length)if(r||a){const i={};for(const t of l)i[t]=s[t];t.push(...o(i,e))}else t.push(...o(i,e));else{const i=s._alias,o=s["#description"];t.push(i||o?{path:e,alias:i,description:o}:{path:e})}}function o(t,e=""){if(!t)return[];const i=[];for(const[o,r]of Object.entries(t))"object"==typeof r&&s(i,e?`${e}.${o}`:o,r);return i}function r(t,e,i){const s=t[e];if(s&&"object"==typeof s&&!("_alias"in s)&&!("#description"in s))return;const o={};i.alias&&""!==i.alias.trim()&&(o._alias=i.alias),i.description&&""!==i.description.trim()&&(o["#description"]=i.description),t[e]=Object.keys(o).length>0?o:null}function a(t,e){const i=t[e];if(!i)return t[e]={},t[e];if("object"==typeof i){const t=i;return Object.keys(t).filter((t=>"_alias"!==t&&"#description"!==t)),t}return t[e]={},t[e]}const l=class{constructor(i){t(this,i),this.change=e(this,"change",7),this.label="Properties",this.items=[],this.handleItemChange=t=>e=>{e.stopPropagation();const i=[...this.items];null===e.detail?i.splice(t,1):i[t]=e.detail,this.items=i,this.emitChange()},this.handleAddProperty=()=>{this.items=[...this.items,{path:""}],this.emitChange()}}componentWillLoad(){var t;if(!this.value||0!==Object.keys(this.value).length||this.value.object||this.value.aggregates)if(null===(t=this.value)||void 0===t?void 0:t.object){const t=o(this.value.object);this.items=t.length>0?t:[{path:"_id"}]}else this.value||(this.items=[{path:"_id"}]);else this.items=[]}componentWillUpdate(){var t;if(!this.value||0!==Object.keys(this.value).length||this.value.object||this.value.aggregates){if(null===(t=this.value)||void 0===t?void 0:t.object){const t=o(this.value.object);(t.length!==this.items.length||!t.every(((t,e)=>{const i=this.items[e];return i&&t.path===i.path&&t.alias===i.alias&&t.description===i.description})))&&(this.items=t)}}else this.items.length>0&&(this.items=[])}render(){return this.limetype?0===this.items.length?i("div",{class:"response-format-editor"},i("h4",{class:"header"},this.label),i("div",{class:"empty-state"},i("p",{class:"empty-state-message"},"No properties selected. The response will return empty objects."),i("limel-button",{label:"Add Property",icon:"plus_math",onClick:this.handleAddProperty}))):i("div",{class:"response-format-editor"},i("limel-header",{subheading:this.label},this.renderPropertyCount()),i("div",{class:"property"},i("div",{class:"property-list"},this.items.map(((t,e)=>this.renderItem(t,e)))),i("div",{class:"actions"},i("limel-button",{label:"Property",disabled:this.items.some((t=>!t.path||""===t.path.trim())),icon:{name:"plus_math",title:"Add"},onClick:this.handleAddProperty})))):i("div",{class:"empty-state"},i("p",null,"Select a limetype to choose properties"))}renderPropertyCount(){return[i("limel-badge",{slot:"actions",id:"counter-badge",label:this.items.length.toString()}),i("limel-tooltip",{elementId:"counter-badge",slot:"actions",label:"Number of selected properties"})]}renderItem(t,e){return i("limebb-lime-query-response-format-item",{key:`${t.path}-${e}`,class:"property-item",platform:this.platform,context:this.context,limetype:this.limetype,item:t,onItemChange:this.handleItemChange(e)})}emitChange(){const t=function(t){const e={};for(const i of t){const t=i.path.split(".");let s=e;for(let e=0;e<t.length;e++){const o=t[e];e===t.length-1?r(s,o,i):s=a(s,o)}}return e}(this.items);this.change.emit({object:t})}};l.style=":host(limebb-lime-query-response-format-editor){display:block;width:100%}.response-format-editor{display:flex;flex-direction:column;padding:1rem 0}limel-badge[slot=actions]{--badge-background-color:rgb(var(--contrast-200));margin-right:0.25rem}.property{border:1px solid var(--header-background-color);border-radius:0 0 0.75rem 0.75rem}.property-list{display:flex;flex-direction:column;border-radius:0.25rem;background-color:rgb(var(--contrast-100));gap:0.5rem;padding:0.5rem}.property-item{border-radius:0.25rem;transition:background-color 0.2s}.property-item:hover{background-color:rgb(var(--contrast-100))}.actions{display:flex}.actions limel-button{padding:0.5rem;width:100%}.empty-state{padding:2rem;text-align:center;color:rgb(var(--contrast-700));font-style:italic}.empty-state p{margin:0}.empty-state .empty-state-message{margin-bottom:1rem;font-size:0.875rem}.empty-state limel-button{margin:0 auto;max-width:200px}";const n=class{constructor(i){t(this,i),this.itemChange=e(this,"itemChange",7),this.showAliasInput=!1,this.showDescriptionInput=!1,this.handlePathChange=t=>{t.stopPropagation(),this.itemChange.emit(Object.assign(Object.assign({},this.item),{path:t.detail}))},this.toggleAliasInput=()=>{this.showAliasInput=!this.showAliasInput},this.toggleDescriptionInput=()=>{this.showDescriptionInput=!this.showDescriptionInput},this.handleAliasChange=t=>{t.stopPropagation();const e=t.detail;this.itemChange.emit(Object.assign(Object.assign({},this.item),{alias:e||void 0}))},this.handleDescriptionChange=t=>{t.stopPropagation();const e=t.detail;this.itemChange.emit(Object.assign(Object.assign({},this.item),{description:e||void 0}))},this.handleAliasBlur=()=>{if(this.item.alias){const t=this.item.alias.trim();t!==this.item.alias&&this.itemChange.emit(Object.assign(Object.assign({},this.item),{alias:t||void 0}))}},this.handleDescriptionBlur=()=>{if(this.item.description){const t=this.item.description.trim();t!==this.item.description&&this.itemChange.emit(Object.assign(Object.assign({},this.item),{description:t||void 0}))}},this.handleRemove=()=>{this.itemChange.emit(null)}}componentWillLoad(){this.showAliasInput=!!this.item.alias,this.showDescriptionInput=!!this.item.description}componentWillUpdate(){this.item.alias&&!this.showAliasInput&&(this.showAliasInput=!0),this.item.description&&!this.showDescriptionInput&&(this.showDescriptionInput=!0)}render(){return[i("div",{key:"f80b67734802324c50613070fd91fde35b1caaaa",class:"property-controls"},i("div",{key:"b481a96617ff29690329bff363ee408c42b746d7",class:"property-path"},i("limebb-property-selector",{key:"a936e9586348b27250e3b0404eefb0ee5f5a675e",platform:this.platform,context:this.context,limetype:this.limetype,label:"Property",value:this.item.path,required:!0,onChange:this.handlePathChange})),i("div",{key:"058b8ade00d076764327fbd85e968fbc9b96cb23",class:"control-buttons"},i("limel-icon-button",{key:"85614c39df85b3957aac7a31c2fcbb181cf1c351",icon:this.getAliasIcon(),label:"Add alias",class:this.item.alias?"has-value":"",onClick:this.toggleAliasInput}),i("limel-icon-button",{key:"e09875fdef378d3a4141ba1b428d6239c691dc9f",icon:this.getDescriptionIcon(),label:"Add description",class:this.item.description?"has-value":"",onClick:this.toggleDescriptionInput}),i("limel-icon-button",{key:"5bced548d2cf53d5097d3b6e84a2440d1bb84b11",icon:"trash",label:"Remove property",onClick:this.handleRemove}))),this.showAliasInput&&i("div",{key:"052d6e7f01089914a1b9e79e06cb04b1510c79c2",class:"alias"},i("limel-input-field",{key:"381874f03fdabcedbe07eaf23dd1c31541c42cf4",label:"Alias",value:this.item.alias||"",placeholder:"Custom property name...",onChange:this.handleAliasChange,onBlur:this.handleAliasBlur})),this.showDescriptionInput&&i("div",{key:"083508a61dadb201526b197f60b691bbea7b50df",class:"description"},i("limel-input-field",{key:"bd718e98091d4776394365aa7175d61d11856a9f",label:"Description",value:this.item.description||"",placeholder:"Describe this property for AI...",onChange:this.handleDescriptionChange,onBlur:this.handleDescriptionBlur}))]}getAliasIcon(){return this.showAliasInput?{name:"add_tag",color:"rgb(var(--color-teal-default))"}:{name:"add_tag",color:"rgb(var(--color-gray-600))"}}getDescriptionIcon(){return this.showDescriptionInput?{name:"comments",color:"rgb(var(--color-teal-default))"}:{name:"comments",color:"rgb(var(--color-gray-600))"}}};n.style=":host(limebb-lime-query-response-format-item){display:flex;flex-direction:column;gap:0.5rem}.property-controls{display:flex;flex-wrap:wrap;gap:0.5rem;width:100%}.property-path{flex-grow:1;min-width:min(10rem, 100%)}.control-buttons{flex-shrink:0;display:flex;flex-direction:row;gap:0.25rem;align-items:center}.control-buttons limel-icon-button{opacity:0.6;transition:opacity 0.2s ease}.control-buttons limel-icon-button:hover{opacity:1}.control-buttons limel-icon-button.has-value{opacity:1;color:rgb(var(--color-blue-default))}.alias,.description{padding-left:1rem;width:calc(100% - 8.75rem)}@media (max-width: 768px){.property-controls{flex-direction:column;gap:0.5rem}.alias,.description{padding-left:0;width:100%}}";export{l as limebb_lime_query_response_format_editor,n as limebb_lime_query_response_format_item}
|