@limetech/lime-crm-building-blocks 1.104.0 → 1.104.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/cjs/{lime-query-validation-6be10fa7.js → lime-query-validation-82aa2855.js} +84 -84
- package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +44 -43
- package/dist/cjs/limebb-lime-query-filter-builder_3.cjs.entry.js +1 -1
- package/dist/cjs/limebb-lime-query-response-format-builder.cjs.entry.js +42 -42
- package/dist/collection/components/lime-query-builder/lime-query-builder.css +9 -9
- package/dist/collection/components/lime-query-builder/lime-query-builder.js +42 -41
- package/dist/collection/components/lime-query-builder/lime-query-response-format-builder.css +5 -5
- package/dist/collection/components/lime-query-builder/lime-query-response-format-builder.js +42 -42
- package/dist/collection/components/lime-query-builder/lime-query-validation.js +84 -84
- package/dist/collection/components/lime-query-builder/order-by/order-by-editor.css +2 -2
- package/dist/collection/components/lime-query-builder/response-format/response-format-helpers.js +2 -2
- package/dist/components/lime-query-validation.js +84 -84
- package/dist/components/limebb-lime-query-builder.js +43 -42
- package/dist/components/limebb-lime-query-response-format-builder.js +41 -41
- package/dist/components/order-by-editor.js +1 -1
- package/dist/esm/{lime-query-validation-573223a5.js → lime-query-validation-9e386da8.js} +84 -84
- package/dist/esm/limebb-lime-query-builder.entry.js +44 -43
- package/dist/esm/limebb-lime-query-filter-builder_3.entry.js +1 -1
- package/dist/esm/limebb-lime-query-response-format-builder.entry.js +42 -42
- package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
- package/dist/lime-crm-building-blocks/{p-6c7af6bb.entry.js → p-7d2188aa.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-7fbb6eba.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-ac9e81c9.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-efa5bcd4.js +1 -0
- package/dist/types/components/lime-query-builder/lime-query-builder.d.ts +3 -3
- package/dist/types/components/lime-query-builder/lime-query-response-format-builder.d.ts +13 -13
- package/dist/types/components/lime-query-builder/lime-query-validation.d.ts +17 -17
- package/dist/types/components.d.ts +12 -12
- package/package.json +1 -1
- package/dist/lime-crm-building-blocks/p-96fee7ee.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-fa2da6bc.js +0 -1
- package/dist/lime-crm-building-blocks/p-fe6a94a1.entry.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.104.1](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.104.0...v1.104.1) (2025-11-17)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
* **lime-query-builder:** rename "GUI mode" to "visual mode" ([294d731](https://github.com/Lundalogik/lime-crm-building-blocks/commit/294d73177ae1f954344ac8c9793d05c53825d6fb))
|
|
7
|
+
|
|
1
8
|
## [1.104.0](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.103.7...v1.104.0) (2025-11-17)
|
|
2
9
|
|
|
3
10
|
### Features
|
|
@@ -90,47 +90,47 @@ function validatePlaceholder(value, activeLimetype, limetypes) {
|
|
|
90
90
|
/**
|
|
91
91
|
* Validate a response format against limetype schemas
|
|
92
92
|
* Throws errors for invalid property references
|
|
93
|
-
* Returns
|
|
93
|
+
* Returns visual mode limitations for features not yet supported in visual mode
|
|
94
94
|
* @param responseFormat
|
|
95
95
|
* @param limetypes Record of all available limetypes
|
|
96
96
|
* @param limetype The root limetype for this query
|
|
97
|
-
* @param
|
|
98
|
-
* @returns
|
|
97
|
+
* @param visualModeEnabled Whether visual mode is enabled
|
|
98
|
+
* @returns Visual mode limitations found (if any)
|
|
99
99
|
*/
|
|
100
|
-
function validateResponseFormat(responseFormat, limetypes, limetype,
|
|
101
|
-
const
|
|
102
|
-
// Check for
|
|
103
|
-
if (
|
|
104
|
-
|
|
100
|
+
function validateResponseFormat(responseFormat, limetypes, limetype, visualModeEnabled = true) {
|
|
101
|
+
const visualModeLimitations = [];
|
|
102
|
+
// Check for visual-mode-unsupported features
|
|
103
|
+
if (visualModeEnabled && responseFormat.aggregates) {
|
|
104
|
+
visualModeLimitations.push('responseFormat.aggregates is not yet supported in visual mode');
|
|
105
105
|
}
|
|
106
106
|
// Validate object properties (throws on invalid properties)
|
|
107
107
|
if (responseFormat.object) {
|
|
108
|
-
const objectLimitations = validatePropertySelection(responseFormat.object, limetypes, limetype,
|
|
109
|
-
|
|
108
|
+
const objectLimitations = validatePropertySelection(responseFormat.object, limetypes, limetype, visualModeEnabled);
|
|
109
|
+
visualModeLimitations.push(...objectLimitations);
|
|
110
110
|
}
|
|
111
|
-
return
|
|
111
|
+
return visualModeLimitations;
|
|
112
112
|
}
|
|
113
113
|
/**
|
|
114
114
|
* Extract non-metadata keys from a property value object
|
|
115
115
|
* Filters out _alias and all # properties (which are treated as comments)
|
|
116
116
|
* @param propValue Property value object
|
|
117
117
|
* @param propName Property name (for error messages)
|
|
118
|
-
* @param
|
|
119
|
-
* @returns Object with non-metadata keys and any
|
|
118
|
+
* @param visualModeEnabled Whether visual mode is enabled (affects validation)
|
|
119
|
+
* @returns Object with non-metadata keys and any visual mode limitations found
|
|
120
120
|
*/
|
|
121
|
-
function extractNonMetadataKeys(propValue, propName,
|
|
121
|
+
function extractNonMetadataKeys(propValue, propName, visualModeEnabled = true) {
|
|
122
122
|
const keys = Object.keys(propValue);
|
|
123
|
-
const
|
|
124
|
-
// Check for # properties other than #description (
|
|
125
|
-
if (
|
|
123
|
+
const visualModeLimitations = [];
|
|
124
|
+
// Check for # properties other than #description (visual mode limitation)
|
|
125
|
+
if (visualModeEnabled) {
|
|
126
126
|
const unsupportedHashProps = keys.filter((k) => k.startsWith('#') && k !== '#description');
|
|
127
127
|
if (unsupportedHashProps.length > 0) {
|
|
128
|
-
|
|
128
|
+
visualModeLimitations.push(`Property '${propName}' contains # properties not supported in visual mode: ${unsupportedHashProps.join(', ')}`);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
// Filter out _alias and all # properties (they are metadata/comments)
|
|
132
132
|
const nonMetadataKeys = keys.filter((k) => k !== '_alias' && !k.startsWith('#'));
|
|
133
|
-
return { keys: nonMetadataKeys,
|
|
133
|
+
return { keys: nonMetadataKeys, visualModeLimitations };
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
136
136
|
* Validate a relation property value
|
|
@@ -138,10 +138,10 @@ function extractNonMetadataKeys(propValue, propName, guiModeEnabled = true) {
|
|
|
138
138
|
* @param propValue Property value
|
|
139
139
|
* @param limetypes Record of all available limetypes
|
|
140
140
|
* @param property
|
|
141
|
-
* @param
|
|
142
|
-
* @returns
|
|
141
|
+
* @param visualModeEnabled Whether visual mode is enabled (affects validation)
|
|
142
|
+
* @returns Visual mode limitations found (if any)
|
|
143
143
|
*/
|
|
144
|
-
function validateRelationProperty(propName, propValue, limetypes, property,
|
|
144
|
+
function validateRelationProperty(propName, propValue, limetypes, property, visualModeEnabled = true) {
|
|
145
145
|
// null is valid - just return the relation ID
|
|
146
146
|
if (propValue === null) {
|
|
147
147
|
return [];
|
|
@@ -150,10 +150,10 @@ function validateRelationProperty(propName, propValue, limetypes, property, guiM
|
|
|
150
150
|
throw new TypeError(`Relation property '${propName}' must be null or an object`);
|
|
151
151
|
}
|
|
152
152
|
const propValueObj = propValue;
|
|
153
|
-
const { keys: otherKeys,
|
|
153
|
+
const { keys: otherKeys, visualModeLimitations } = extractNonMetadataKeys(propValueObj, propName, visualModeEnabled);
|
|
154
154
|
// If it's just {} or { _alias: "...", "#...": "..." }, that's valid
|
|
155
155
|
if (otherKeys.length === 0) {
|
|
156
|
-
return
|
|
156
|
+
return visualModeLimitations;
|
|
157
157
|
}
|
|
158
158
|
// Otherwise, validate nested properties
|
|
159
159
|
const relatedLimetype = property.relation.getLimetype();
|
|
@@ -165,27 +165,27 @@ function validateRelationProperty(propName, propValue, limetypes, property, guiM
|
|
|
165
165
|
for (const key of otherKeys) {
|
|
166
166
|
cleanSelection[key] = propValueObj[key];
|
|
167
167
|
}
|
|
168
|
-
const nestedLimitations = validatePropertySelection(cleanSelection, limetypes, relatedLimetype.name,
|
|
169
|
-
return [...
|
|
168
|
+
const nestedLimitations = validatePropertySelection(cleanSelection, limetypes, relatedLimetype.name, visualModeEnabled);
|
|
169
|
+
return [...visualModeLimitations, ...nestedLimitations];
|
|
170
170
|
}
|
|
171
171
|
/**
|
|
172
172
|
* Validate a non-relation property value
|
|
173
173
|
* @param propName Property name
|
|
174
174
|
* @param propValue Property value
|
|
175
|
-
* @param
|
|
176
|
-
* @returns
|
|
175
|
+
* @param visualModeEnabled Whether visual mode is enabled (affects validation)
|
|
176
|
+
* @returns Visual mode limitations found (if any)
|
|
177
177
|
*/
|
|
178
|
-
function validateNonRelationProperty(propName, propValue,
|
|
178
|
+
function validateNonRelationProperty(propName, propValue, visualModeEnabled = true) {
|
|
179
179
|
// null is valid
|
|
180
180
|
if (propValue === null) {
|
|
181
181
|
return [];
|
|
182
182
|
}
|
|
183
183
|
// Allow empty object {} or object with only metadata (_alias, #...)
|
|
184
184
|
if (typeof propValue === 'object') {
|
|
185
|
-
const { keys: nonMetadataKeys,
|
|
185
|
+
const { keys: nonMetadataKeys, visualModeLimitations } = extractNonMetadataKeys(propValue, propName, visualModeEnabled);
|
|
186
186
|
if (nonMetadataKeys.length === 0) {
|
|
187
187
|
// {} or { _alias: "...", "#...": "..." } is valid
|
|
188
|
-
return
|
|
188
|
+
return visualModeLimitations;
|
|
189
189
|
}
|
|
190
190
|
throw new Error(`Non-relation property '${propName}' cannot have nested properties other than _alias or # properties (got: ${nonMetadataKeys.join(', ')})`);
|
|
191
191
|
}
|
|
@@ -198,14 +198,14 @@ function validateNonRelationProperty(propName, propValue, guiModeEnabled = true)
|
|
|
198
198
|
* @param normalizedProperties Normalized properties of the limetype
|
|
199
199
|
* @param limetypes Record of all available limetypes
|
|
200
200
|
* @param limetype Current limetype name
|
|
201
|
-
* @param
|
|
202
|
-
* @returns
|
|
201
|
+
* @param visualModeEnabled Whether visual mode is enabled (affects validation)
|
|
202
|
+
* @returns Visual mode limitations found (if any)
|
|
203
203
|
*/
|
|
204
|
-
function validateSinglePropertyEntry(propName, propValue, normalizedProperties, limetypes, limetype,
|
|
205
|
-
// Allow empty string (editing state in
|
|
204
|
+
function validateSinglePropertyEntry(propName, propValue, normalizedProperties, limetypes, limetype, visualModeEnabled = true) {
|
|
205
|
+
// Allow empty string (editing state in visual mode)
|
|
206
206
|
if (propName === '') {
|
|
207
|
-
// Only validate empty property name in
|
|
208
|
-
if (
|
|
207
|
+
// Only validate empty property name in visual mode
|
|
208
|
+
if (visualModeEnabled && propValue !== null) {
|
|
209
209
|
throw new Error('Empty property name must have null value');
|
|
210
210
|
}
|
|
211
211
|
return [];
|
|
@@ -217,10 +217,10 @@ function validateSinglePropertyEntry(propName, propValue, normalizedProperties,
|
|
|
217
217
|
}
|
|
218
218
|
// Validate value based on property type
|
|
219
219
|
if (property.relation) {
|
|
220
|
-
return validateRelationProperty(propName, propValue, limetypes, property,
|
|
220
|
+
return validateRelationProperty(propName, propValue, limetypes, property, visualModeEnabled);
|
|
221
221
|
}
|
|
222
222
|
else {
|
|
223
|
-
return validateNonRelationProperty(propName, propValue,
|
|
223
|
+
return validateNonRelationProperty(propName, propValue, visualModeEnabled);
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
/**
|
|
@@ -229,26 +229,26 @@ function validateSinglePropertyEntry(propName, propValue, normalizedProperties,
|
|
|
229
229
|
* @param selection
|
|
230
230
|
* @param limetypes Record of all available limetypes
|
|
231
231
|
* @param limetype The limetype for this level of the selection
|
|
232
|
-
* @param
|
|
233
|
-
* @returns
|
|
232
|
+
* @param visualModeEnabled Whether visual mode is enabled (affects validation)
|
|
233
|
+
* @returns Visual mode limitations found (if any)
|
|
234
234
|
*/
|
|
235
|
-
function validatePropertySelection(selection, limetypes, limetype,
|
|
235
|
+
function validatePropertySelection(selection, limetypes, limetype, visualModeEnabled = true) {
|
|
236
236
|
const limetypeObj = limetypes[limetype];
|
|
237
237
|
if (!limetypeObj) {
|
|
238
238
|
throw new Error(`Unknown limetype: ${limetype}`);
|
|
239
239
|
}
|
|
240
240
|
const normalizedProperties = propertyResolution.getNormalizedProperties(limetypeObj);
|
|
241
|
-
const
|
|
241
|
+
const allVisualModeLimitations = [];
|
|
242
242
|
for (const [propName, propValue] of Object.entries(selection)) {
|
|
243
243
|
// Skip # properties (comments/metadata that backend accepts via unknown=INCLUDE)
|
|
244
244
|
// Note: _alias only appears inside property value objects, not at this level
|
|
245
245
|
if (propName.startsWith('#')) {
|
|
246
246
|
continue;
|
|
247
247
|
}
|
|
248
|
-
const limitations = validateSinglePropertyEntry(propName, propValue, normalizedProperties, limetypes, limetype,
|
|
249
|
-
|
|
248
|
+
const limitations = validateSinglePropertyEntry(propName, propValue, normalizedProperties, limetypes, limetype, visualModeEnabled);
|
|
249
|
+
allVisualModeLimitations.push(...limitations);
|
|
250
250
|
}
|
|
251
|
-
return
|
|
251
|
+
return allVisualModeLimitations;
|
|
252
252
|
}
|
|
253
253
|
/**
|
|
254
254
|
* Validate a comparison expression (has 'key' property)
|
|
@@ -273,9 +273,9 @@ function validateComparisonExpression(filter, activeLimetype, limetypes) {
|
|
|
273
273
|
* @param filter
|
|
274
274
|
* @param activeLimetype
|
|
275
275
|
* @param limetypes
|
|
276
|
-
* @param
|
|
276
|
+
* @param visualModeEnabled
|
|
277
277
|
*/
|
|
278
|
-
function validateGroupExpression(filter, activeLimetype, limetypes,
|
|
278
|
+
function validateGroupExpression(filter, activeLimetype, limetypes, visualModeEnabled) {
|
|
279
279
|
// Validate operator
|
|
280
280
|
if (filter.op !== index_esm.Zt.AND &&
|
|
281
281
|
filter.op !== index_esm.Zt.OR &&
|
|
@@ -284,12 +284,12 @@ function validateGroupExpression(filter, activeLimetype, limetypes, guiModeEnabl
|
|
|
284
284
|
}
|
|
285
285
|
// Recursively validate children
|
|
286
286
|
if (filter.op === index_esm.Zt.NOT) {
|
|
287
|
-
validateFilterPlaceholders(filter.exp, activeLimetype, limetypes,
|
|
287
|
+
validateFilterPlaceholders(filter.exp, activeLimetype, limetypes, visualModeEnabled);
|
|
288
288
|
}
|
|
289
289
|
else if (filter.op === index_esm.Zt.AND || filter.op === index_esm.Zt.OR) {
|
|
290
290
|
const expressions = filter.exp;
|
|
291
291
|
for (const expr of expressions) {
|
|
292
|
-
validateFilterPlaceholders(expr, activeLimetype, limetypes,
|
|
292
|
+
validateFilterPlaceholders(expr, activeLimetype, limetypes, visualModeEnabled);
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
295
|
}
|
|
@@ -298,9 +298,9 @@ function validateGroupExpression(filter, activeLimetype, limetypes, guiModeEnabl
|
|
|
298
298
|
* @param filter Filter expression to validate
|
|
299
299
|
* @param activeLimetype The limetype of the active object
|
|
300
300
|
* @param limetypes Record of all available limetypes
|
|
301
|
-
* @param
|
|
301
|
+
* @param visualModeEnabled Whether visual mode is enabled (affects validation)
|
|
302
302
|
*/
|
|
303
|
-
function validateFilterPlaceholders(filter, activeLimetype, limetypes,
|
|
303
|
+
function validateFilterPlaceholders(filter, activeLimetype, limetypes, visualModeEnabled = true) {
|
|
304
304
|
if (!filter) {
|
|
305
305
|
return;
|
|
306
306
|
}
|
|
@@ -309,7 +309,7 @@ function validateFilterPlaceholders(filter, activeLimetype, limetypes, guiModeEn
|
|
|
309
309
|
return;
|
|
310
310
|
}
|
|
311
311
|
if ('exp' in filter) {
|
|
312
|
-
validateGroupExpression(filter, activeLimetype, limetypes,
|
|
312
|
+
validateGroupExpression(filter, activeLimetype, limetypes, visualModeEnabled);
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
/**
|
|
@@ -317,13 +317,13 @@ function validateFilterPlaceholders(filter, activeLimetype, limetypes, guiModeEn
|
|
|
317
317
|
* @param filter The filter expression or group to validate
|
|
318
318
|
* @param activeLimetype Optional active object limetype for placeholder validation
|
|
319
319
|
* @param limetypes Record of all available limetypes
|
|
320
|
-
* @param
|
|
320
|
+
* @param visualModeEnabled Whether visual mode is enabled
|
|
321
321
|
* @returns Array of validation error messages
|
|
322
322
|
*/
|
|
323
|
-
function validateLimeQueryFilterInternal(filter, activeLimetype, limetypes,
|
|
323
|
+
function validateLimeQueryFilterInternal(filter, activeLimetype, limetypes, visualModeEnabled) {
|
|
324
324
|
const errors = [];
|
|
325
325
|
try {
|
|
326
|
-
validateFilterPlaceholders(filter, activeLimetype, limetypes,
|
|
326
|
+
validateFilterPlaceholders(filter, activeLimetype, limetypes, visualModeEnabled);
|
|
327
327
|
}
|
|
328
328
|
catch (error) {
|
|
329
329
|
errors.push(`Invalid filter: ${error.message}`);
|
|
@@ -442,14 +442,14 @@ function validateOrderByPropertyPath(propertyPath, limetypes, limetype, index) {
|
|
|
442
442
|
* @param responseFormat The response format to validate
|
|
443
443
|
* @param limetypes Record of all available limetypes
|
|
444
444
|
* @param limetype The limetype for this Lime Query
|
|
445
|
-
* @param
|
|
446
|
-
* @returns Object with validation errors and
|
|
445
|
+
* @param visualModeEnabled Whether visual mode is enabled
|
|
446
|
+
* @returns Object with validation errors and visual mode limitations
|
|
447
447
|
*/
|
|
448
|
-
function validateLimeQueryResponseFormatInternal(responseFormat, limetypes, limetype,
|
|
448
|
+
function validateLimeQueryResponseFormatInternal(responseFormat, limetypes, limetype, visualModeEnabled) {
|
|
449
449
|
const errors = [];
|
|
450
450
|
const limitations = [];
|
|
451
451
|
try {
|
|
452
|
-
const formatLimitations = validateResponseFormat(responseFormat, limetypes, limetype,
|
|
452
|
+
const formatLimitations = validateResponseFormat(responseFormat, limetypes, limetype, visualModeEnabled);
|
|
453
453
|
limitations.push(...formatLimitations);
|
|
454
454
|
}
|
|
455
455
|
catch (error) {
|
|
@@ -459,25 +459,25 @@ function validateLimeQueryResponseFormatInternal(responseFormat, limetypes, lime
|
|
|
459
459
|
}
|
|
460
460
|
/**
|
|
461
461
|
* Validate a Lime Query
|
|
462
|
-
* Returns validation result with separate arrays for validity errors and
|
|
462
|
+
* Returns validation result with separate arrays for validity errors and visual mode limitations
|
|
463
463
|
* @param limeQuery The Lime Query to validate
|
|
464
464
|
* @param limetypes Record of all available limetypes
|
|
465
465
|
* @param activeLimetype Optional active object limetype for placeholder validation
|
|
466
|
-
* @param
|
|
466
|
+
* @param visualModeEnabled Whether visual mode is enabled (affects validation)
|
|
467
467
|
* @returns LimeQueryValidationResult with validity status and any errors/limitations
|
|
468
468
|
*/
|
|
469
|
-
function isLimeQuerySupported(limeQuery, limetypes, activeLimetype,
|
|
469
|
+
function isLimeQuerySupported(limeQuery, limetypes, activeLimetype, visualModeEnabled = true) {
|
|
470
470
|
// Handle empty/undefined Lime Query
|
|
471
471
|
if (!limeQuery) {
|
|
472
472
|
return {
|
|
473
473
|
valid: true,
|
|
474
|
-
|
|
474
|
+
visualModeSupported: true,
|
|
475
475
|
validationErrors: [],
|
|
476
|
-
|
|
476
|
+
visualModeLimitations: [],
|
|
477
477
|
};
|
|
478
478
|
}
|
|
479
479
|
const validationErrors = [];
|
|
480
|
-
const
|
|
480
|
+
const visualModeLimitations = [];
|
|
481
481
|
// Validate limetype exists
|
|
482
482
|
if (limeQuery.limetype && !limetypes[limeQuery.limetype]) {
|
|
483
483
|
validationErrors.push(`Unknown limetype: ${limeQuery.limetype}`);
|
|
@@ -491,26 +491,26 @@ function isLimeQuerySupported(limeQuery, limetypes, activeLimetype, guiModeEnabl
|
|
|
491
491
|
const orderByErrors = validateOrderBy(limeQuery.orderBy, limetypes, limeQuery.limetype);
|
|
492
492
|
validationErrors.push(...orderByErrors);
|
|
493
493
|
}
|
|
494
|
-
// Check for
|
|
495
|
-
if (
|
|
496
|
-
|
|
494
|
+
// Check for visual-mode-unsupported top-level properties
|
|
495
|
+
if (visualModeEnabled && limeQuery.offset !== undefined) {
|
|
496
|
+
visualModeLimitations.push('offset is not yet supported in visual mode');
|
|
497
497
|
}
|
|
498
498
|
// Validate filter
|
|
499
499
|
if (limeQuery.filter) {
|
|
500
|
-
const filterErrors = validateLimeQueryFilterInternal(limeQuery.filter, activeLimetype, limetypes,
|
|
500
|
+
const filterErrors = validateLimeQueryFilterInternal(limeQuery.filter, activeLimetype, limetypes, visualModeEnabled);
|
|
501
501
|
validationErrors.push(...filterErrors);
|
|
502
502
|
}
|
|
503
503
|
// Validate responseFormat
|
|
504
504
|
if (limeQuery.responseFormat) {
|
|
505
|
-
const { errors, limitations } = validateLimeQueryResponseFormatInternal(limeQuery.responseFormat, limetypes, limeQuery.limetype,
|
|
505
|
+
const { errors, limitations } = validateLimeQueryResponseFormatInternal(limeQuery.responseFormat, limetypes, limeQuery.limetype, visualModeEnabled);
|
|
506
506
|
validationErrors.push(...errors);
|
|
507
|
-
|
|
507
|
+
visualModeLimitations.push(...limitations);
|
|
508
508
|
}
|
|
509
509
|
return {
|
|
510
510
|
valid: validationErrors.length === 0,
|
|
511
|
-
|
|
511
|
+
visualModeSupported: visualModeLimitations.length === 0,
|
|
512
512
|
validationErrors,
|
|
513
|
-
|
|
513
|
+
visualModeLimitations,
|
|
514
514
|
};
|
|
515
515
|
}
|
|
516
516
|
// ============================================================================
|
|
@@ -525,32 +525,32 @@ function isLimeQuerySupported(limeQuery, limetypes, activeLimetype, guiModeEnabl
|
|
|
525
525
|
* @param responseFormat - The response format to validate
|
|
526
526
|
* @param limetypes - Record of all available limetypes
|
|
527
527
|
* @param limetype - The limetype context for validation
|
|
528
|
-
* @param
|
|
529
|
-
* @returns Validation result with errors and
|
|
528
|
+
* @param visualModeEnabled - Whether visual mode is enabled (affects validation)
|
|
529
|
+
* @returns Validation result with errors and visual mode limitations
|
|
530
530
|
*/
|
|
531
|
-
function validateResponseFormatOnly(responseFormat, limetypes, limetype,
|
|
531
|
+
function validateResponseFormatOnly(responseFormat, limetypes, limetype, visualModeEnabled = true) {
|
|
532
532
|
const validationErrors = [];
|
|
533
|
-
const
|
|
533
|
+
const visualModeLimitations = [];
|
|
534
534
|
// Validate limetype exists
|
|
535
535
|
if (!limetypes[limetype]) {
|
|
536
536
|
validationErrors.push(`Unknown limetype: ${limetype}`);
|
|
537
537
|
// Can't proceed with property validation if limetype is unknown
|
|
538
538
|
return {
|
|
539
539
|
valid: false,
|
|
540
|
-
|
|
540
|
+
visualModeSupported: false,
|
|
541
541
|
validationErrors,
|
|
542
|
-
|
|
542
|
+
visualModeLimitations,
|
|
543
543
|
};
|
|
544
544
|
}
|
|
545
545
|
// Use internal validation logic
|
|
546
|
-
const { errors, limitations } = validateLimeQueryResponseFormatInternal(responseFormat, limetypes, limetype,
|
|
546
|
+
const { errors, limitations } = validateLimeQueryResponseFormatInternal(responseFormat, limetypes, limetype, visualModeEnabled);
|
|
547
547
|
validationErrors.push(...errors);
|
|
548
|
-
|
|
548
|
+
visualModeLimitations.push(...limitations);
|
|
549
549
|
return {
|
|
550
550
|
valid: validationErrors.length === 0,
|
|
551
|
-
|
|
551
|
+
visualModeSupported: visualModeLimitations.length === 0,
|
|
552
552
|
validationErrors,
|
|
553
|
-
|
|
553
|
+
visualModeLimitations,
|
|
554
554
|
};
|
|
555
555
|
}
|
|
556
556
|
|
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-ff255a0d.js');
|
|
6
6
|
const index_esm = require('./index.esm-d785eb6e.js');
|
|
7
|
-
const limeQueryValidation = require('./lime-query-validation-
|
|
7
|
+
const limeQueryValidation = require('./lime-query-validation-82aa2855.js');
|
|
8
8
|
require('./property-resolution-fb42a46b.js');
|
|
9
9
|
|
|
10
|
-
const limeQueryBuilderCss = "*,*: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-
|
|
10
|
+
const limeQueryBuilderCss = "*,*: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-visual-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)}.visual-mode{display:flex;flex-direction:column;gap:1rem;padding:var(--limebb-lime-query-builder-visual-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 .visual-mode-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 .visual-mode-limitations strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-mode .visual-mode-limitations ul{margin:0;padding-left:1.5rem}.code-mode .visual-mode-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-visual-mode-padding) * 2);margin-left:calc(var(--limebb-lime-query-builder-visual-mode-padding) * -1)}.query-options-controls{display:flex;flex-direction:column;gap:1rem}";
|
|
11
11
|
const LimebbLimeQueryBuilderStyle0 = limeQueryBuilderCss;
|
|
12
12
|
|
|
13
13
|
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -24,7 +24,7 @@ const LimeQueryBuilder = class {
|
|
|
24
24
|
constructor(hostRef) {
|
|
25
25
|
index.registerInstance(this, hostRef);
|
|
26
26
|
this.change = index.createEvent(this, "change", 7);
|
|
27
|
-
this.mode = '
|
|
27
|
+
this.mode = 'visual';
|
|
28
28
|
this.codeValue = '';
|
|
29
29
|
this.limetype = '';
|
|
30
30
|
this.handleLimetypeChange = (event) => {
|
|
@@ -63,11 +63,11 @@ const LimeQueryBuilder = class {
|
|
|
63
63
|
this.handleChange = (event) => {
|
|
64
64
|
event.stopPropagation();
|
|
65
65
|
const mode = event.detail.id;
|
|
66
|
-
if (mode === '
|
|
66
|
+
if (mode === 'visual') {
|
|
67
67
|
try {
|
|
68
68
|
const parsed = JSON.parse(this.codeValue);
|
|
69
|
-
const support = this.
|
|
70
|
-
if (!support.
|
|
69
|
+
const support = this.checkVisualModeSupport();
|
|
70
|
+
if (!support.visualModeSupported) {
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
73
|
this.limetype = parsed.limetype || '';
|
|
@@ -75,7 +75,7 @@ const LimeQueryBuilder = class {
|
|
|
75
75
|
this.internalResponseFormat = parsed.responseFormat;
|
|
76
76
|
this.limit = parsed.limit;
|
|
77
77
|
this.orderBy = parsed.orderBy;
|
|
78
|
-
this.mode = '
|
|
78
|
+
this.mode = 'visual';
|
|
79
79
|
this.change.emit(parsed);
|
|
80
80
|
}
|
|
81
81
|
catch (_a) {
|
|
@@ -104,19 +104,19 @@ const LimeQueryBuilder = class {
|
|
|
104
104
|
getButtons() {
|
|
105
105
|
return [
|
|
106
106
|
{
|
|
107
|
-
id: '
|
|
107
|
+
id: 'visual',
|
|
108
108
|
title: 'Visual',
|
|
109
109
|
},
|
|
110
110
|
{ id: 'code', title: 'Code' },
|
|
111
111
|
];
|
|
112
112
|
}
|
|
113
|
-
get
|
|
113
|
+
get visualModeEnabled() {
|
|
114
114
|
var _a, _b, _c;
|
|
115
115
|
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);
|
|
116
116
|
}
|
|
117
117
|
componentWillLoad() {
|
|
118
|
-
// Force code mode if
|
|
119
|
-
if (!this.
|
|
118
|
+
// Force code mode if visual mode is disabled
|
|
119
|
+
if (!this.visualModeEnabled) {
|
|
120
120
|
this.mode = 'code';
|
|
121
121
|
// Initialize code value from prop
|
|
122
122
|
this.updateCodeValue();
|
|
@@ -131,24 +131,24 @@ const LimeQueryBuilder = class {
|
|
|
131
131
|
}
|
|
132
132
|
// Initialize code value from prop
|
|
133
133
|
this.updateCodeValue();
|
|
134
|
-
// Check if
|
|
135
|
-
const support = this.
|
|
136
|
-
if (!support.
|
|
134
|
+
// Check if visual mode is supported
|
|
135
|
+
const support = this.checkVisualModeSupport();
|
|
136
|
+
if (!support.visualModeSupported) {
|
|
137
137
|
this.mode = 'code';
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
render() {
|
|
141
|
-
return (index.h(index.Host, { key: '
|
|
141
|
+
return (index.h(index.Host, { key: '4f1481f575b1afdd63a3115761a52a62699d7f84' }, this.renderHeader(), this.renderContent()));
|
|
142
142
|
}
|
|
143
143
|
renderContent() {
|
|
144
|
-
const
|
|
145
|
-
const showCodeMode = !this.
|
|
144
|
+
const visualModeSupported = this.checkVisualModeSupport();
|
|
145
|
+
const showCodeMode = !this.visualModeEnabled || this.mode === 'code';
|
|
146
146
|
return showCodeMode
|
|
147
|
-
? this.renderCodeMode(
|
|
148
|
-
: this.
|
|
147
|
+
? this.renderCodeMode(visualModeSupported)
|
|
148
|
+
: this.renderVisualMode();
|
|
149
149
|
}
|
|
150
150
|
emitChange() {
|
|
151
|
-
// Only emit in
|
|
151
|
+
// Only emit in visual mode
|
|
152
152
|
if (this.mode === 'code') {
|
|
153
153
|
return;
|
|
154
154
|
}
|
|
@@ -184,14 +184,14 @@ const LimeQueryBuilder = class {
|
|
|
184
184
|
}
|
|
185
185
|
return limeQuery;
|
|
186
186
|
}
|
|
187
|
-
|
|
187
|
+
checkVisualModeSupport() {
|
|
188
188
|
if (!this.limetypes) {
|
|
189
189
|
// Can't validate yet, assume all is good
|
|
190
190
|
return {
|
|
191
191
|
valid: true,
|
|
192
|
-
|
|
192
|
+
visualModeSupported: true,
|
|
193
193
|
validationErrors: [],
|
|
194
|
-
|
|
194
|
+
visualModeLimitations: [],
|
|
195
195
|
};
|
|
196
196
|
}
|
|
197
197
|
// When in code mode, validate the parsed code value instead of current state
|
|
@@ -203,20 +203,20 @@ const LimeQueryBuilder = class {
|
|
|
203
203
|
catch (_a) {
|
|
204
204
|
return {
|
|
205
205
|
valid: false,
|
|
206
|
-
|
|
206
|
+
visualModeSupported: false,
|
|
207
207
|
validationErrors: ['Invalid JSON'],
|
|
208
|
-
|
|
208
|
+
visualModeLimitations: [],
|
|
209
209
|
};
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
else {
|
|
213
|
-
// Build query from current
|
|
213
|
+
// Build query from current visual state
|
|
214
214
|
if (!this.limetype) {
|
|
215
215
|
return {
|
|
216
216
|
valid: true,
|
|
217
|
-
|
|
217
|
+
visualModeSupported: true,
|
|
218
218
|
validationErrors: [],
|
|
219
|
-
|
|
219
|
+
visualModeLimitations: [],
|
|
220
220
|
};
|
|
221
221
|
}
|
|
222
222
|
const responseFormat = this
|
|
@@ -234,23 +234,24 @@ const LimeQueryBuilder = class {
|
|
|
234
234
|
queryToCheck.limit = this.limit;
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
|
-
return limeQueryValidation.isLimeQuerySupported(queryToCheck, this.limetypes, this.activeLimetype, this.
|
|
237
|
+
return limeQueryValidation.isLimeQuerySupported(queryToCheck, this.limetypes, this.activeLimetype, this.visualModeEnabled);
|
|
238
238
|
}
|
|
239
239
|
renderModeSwitch(support) {
|
|
240
|
-
const
|
|
240
|
+
const visualDisabled = !support.visualModeSupported;
|
|
241
241
|
const buttons = this.getButtons().map((button) => (Object.assign(Object.assign({}, button), { selected: button.id === this.mode })));
|
|
242
|
-
return (index.h("limel-button-group", { slot: "actions", onChange: this.handleChange, value: buttons, disabled:
|
|
242
|
+
return (index.h("limel-button-group", { slot: "actions", onChange: this.handleChange, value: buttons, disabled: visualDisabled }));
|
|
243
243
|
}
|
|
244
|
-
renderCodeEditor(
|
|
244
|
+
renderCodeEditor(visualModeSupported) {
|
|
245
245
|
return [
|
|
246
246
|
index.h("limel-code-editor", { value: this.codeValue, language: "json", lineNumbers: true, fold: true, lint: true, onChange: this.handleCodeChange }),
|
|
247
247
|
/* Show validation errors (invalid Lime Query) */
|
|
248
|
-
!
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
248
|
+
!visualModeSupported.valid &&
|
|
249
|
+
visualModeSupported.validationErrors.length > 0 && (index.h("div", { class: "validation-errors" }, index.h("strong", null, "Invalid Lime Query:"), index.h("ul", null, visualModeSupported.validationErrors.map((error) => (index.h("li", null, error)))))),
|
|
250
|
+
/* Show visual mode limitations (only when visual mode is enabled and Lime Query is valid) */
|
|
251
|
+
this.visualModeEnabled &&
|
|
252
|
+
visualModeSupported.valid &&
|
|
253
|
+
!visualModeSupported.visualModeSupported &&
|
|
254
|
+
visualModeSupported.visualModeLimitations.length > 0 && (index.h("div", { class: "visual-mode-limitations" }, index.h("strong", null, "Cannot switch to visual mode:"), index.h("ul", null, visualModeSupported.visualModeLimitations.map((limitation) => (index.h("li", null, limitation)))))),
|
|
254
255
|
];
|
|
255
256
|
}
|
|
256
257
|
renderLimetypeSection() {
|
|
@@ -275,15 +276,15 @@ const LimeQueryBuilder = class {
|
|
|
275
276
|
}
|
|
276
277
|
return (index.h("section", { class: "query-options" }, index.h("limel-header", { class: "is-narrow", heading: "Query Options", icon: "ask_question" }), index.h("div", { class: "query-options-controls" }, index.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 }), index.h("limebb-lime-query-order-by-editor", { platform: this.platform, context: this.context, limetype: this.limetype, value: this.orderBy, onChange: this.handleOrderByChange }))));
|
|
277
278
|
}
|
|
278
|
-
|
|
279
|
-
return (index.h("div", { class: "
|
|
279
|
+
renderVisualMode() {
|
|
280
|
+
return (index.h("div", { class: "visual-mode" }, this.renderLimetypeSection(), this.renderResponseFormatSection(), this.renderFilterSection(), this.renderQueryOptionsSection()));
|
|
280
281
|
}
|
|
281
282
|
renderHeader() {
|
|
282
|
-
const
|
|
283
|
-
return (index.h("limel-header", { heading: this.label }, this.renderModeControls(
|
|
283
|
+
const visualModeSupported = this.checkVisualModeSupport();
|
|
284
|
+
return (index.h("limel-header", { heading: this.label }, this.renderModeControls(visualModeSupported)));
|
|
284
285
|
}
|
|
285
286
|
renderModeControls(support) {
|
|
286
|
-
if (!this.
|
|
287
|
+
if (!this.visualModeEnabled) {
|
|
287
288
|
return;
|
|
288
289
|
}
|
|
289
290
|
return this.renderModeSwitch(support);
|
|
@@ -142,7 +142,7 @@ const LimeQueryFilterBuilderComponent = class {
|
|
|
142
142
|
};
|
|
143
143
|
LimeQueryFilterBuilderComponent.style = LimebbLimeQueryFilterBuilderStyle0;
|
|
144
144
|
|
|
145
|
-
const orderByEditorCss = ":host(limebb-lime-query-order-by-editor){display:flex;flex-direction:column;gap:1rem;padding:1rem 0}.header{display:flex;justify-content:space-between;align-items:center;gap:1rem}.header h4{margin:0;font-size:1rem;font-weight:600;color:rgb(var(--contrast-1000))}.order-by-list{display:flex;flex-direction:column;gap:1rem;border:1px solid rgb(var(--contrast-300));border-radius:0.25rem;background-color:rgb(var(--contrast-50));min-height:4rem}.order-by-item{padding:0.5rem;border-radius:0.25rem;transition:background-color 0.2s}.order-by-item:hover{background-color:rgb(var(--contrast-100))}.actions{display:flex;width:100%}.summary{display:flex;justify-content:space-between;align-items:center;padding-top:0.5rem;border-top:1px solid rgb(var(--contrast-300))}.summary .count{font-size:0.875rem;font-weight:500;color:rgb(var(--contrast-900))}limel-header.is-narrow{--header-top-right-left-border-radius:0;width:calc(100% + var(--limebb-lime-query-builder-
|
|
145
|
+
const orderByEditorCss = ":host(limebb-lime-query-order-by-editor){display:flex;flex-direction:column;gap:1rem;padding:1rem 0}.header{display:flex;justify-content:space-between;align-items:center;gap:1rem}.header h4{margin:0;font-size:1rem;font-weight:600;color:rgb(var(--contrast-1000))}.order-by-list{display:flex;flex-direction:column;gap:1rem;border:1px solid rgb(var(--contrast-300));border-radius:0.25rem;background-color:rgb(var(--contrast-50));min-height:4rem}.order-by-item{padding:0.5rem;border-radius:0.25rem;transition:background-color 0.2s}.order-by-item:hover{background-color:rgb(var(--contrast-100))}.actions{display:flex;width:100%}.summary{display:flex;justify-content:space-between;align-items:center;padding-top:0.5rem;border-top:1px solid rgb(var(--contrast-300))}.summary .count{font-size:0.875rem;font-weight:500;color:rgb(var(--contrast-900))}limel-header.is-narrow{--header-top-right-left-border-radius:0;width:calc(100% + var(--limebb-lime-query-builder-visual-mode-padding) * 2);margin-left:calc(var(--limebb-lime-query-builder-visual-mode-padding) * -1)}.empty-state{padding:0 2rem;text-align:center;color:rgb(var(--contrast-700))}";
|
|
146
146
|
const LimebbLimeQueryOrderByEditorStyle0 = orderByEditorCss;
|
|
147
147
|
|
|
148
148
|
const OrderByEditor = class {
|