@limetech/lime-crm-building-blocks 1.100.0 → 1.100.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-crm-building-blocks.cjs.js +1 -1
- package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +45 -178
- package/dist/cjs/limebb-lime-query-filter-builder_3.cjs.entry.js +1 -1
- package/dist/cjs/limebb-lime-query-filter-comparison_2.cjs.entry.js +147 -0
- package/dist/cjs/{limebb-lime-query-filter-comparison_5.cjs.entry.js → limebb-lime-query-filter-group_3.cjs.entry.js} +5 -333
- package/dist/cjs/limebb-live-docs-info.cjs.entry.js +2 -2
- package/dist/cjs/limebb-locale-picker.cjs.entry.js +1 -1
- package/dist/cjs/limebb-mention-group-counter.cjs.entry.js +2 -2
- package/dist/cjs/limebb-navigation-button_2.cjs.entry.js +3 -3
- package/dist/cjs/limebb-notification-item.cjs.entry.js +1 -1
- package/dist/cjs/limebb-percentage-visualizer.cjs.entry.js +2 -2
- package/dist/cjs/limebb-property-selector.cjs.entry.js +234 -0
- package/dist/cjs/limebb-text-editor.cjs.entry.js +1 -1
- package/dist/cjs/limebb-trend-indicator.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +0 -2
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison.js +1 -1
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-group.js +1 -1
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-not.js +1 -1
- package/dist/collection/components/lime-query-builder/expressions/lime-query-value-input.js +7 -7
- package/dist/collection/components/lime-query-builder/lime-query-validation.js +46 -19
- package/dist/collection/components/lime-query-builder/lime-query.types.js +1 -57
- package/dist/collection/components/lime-query-builder/limetype-field/limetype-field.js +1 -1
- package/dist/collection/components/limeobject/file-viewer/live-docs-info.js +2 -2
- package/dist/collection/components/locale-picker/locale-picker.js +1 -1
- package/dist/collection/components/notification-list/notification-item/notification-item.js +1 -1
- package/dist/collection/components/percentage-visualizer/percentage-visualizer.js +2 -2
- package/dist/collection/components/summary-popover/summary-popover.js +3 -3
- package/dist/collection/components/text-editor/mention-group-counter.js +2 -2
- package/dist/collection/components/text-editor/text-editor.js +1 -1
- package/dist/collection/components/trend-indicator/trend-indicator.js +1 -1
- package/dist/components/lime-query-filter-comparison.js +1 -1
- package/dist/components/lime-query-filter-expression.js +2 -2
- package/dist/components/lime-query-value-input.js +2 -2
- package/dist/components/limebb-lime-query-builder.js +46 -179
- package/dist/components/limebb-locale-picker.js +1 -1
- package/dist/components/limebb-mention-group-counter.js +2 -2
- package/dist/components/limebb-percentage-visualizer.js +2 -2
- package/dist/components/limebb-text-editor.js +1 -1
- package/dist/components/limebb-trend-indicator.js +1 -1
- package/dist/components/limetype-field.js +1 -1
- package/dist/components/live-docs-info.js +2 -2
- package/dist/components/notification-item.js +1 -1
- package/dist/components/summary-popover.js +3 -3
- package/dist/esm/lime-crm-building-blocks.js +1 -1
- package/dist/esm/limebb-lime-query-builder.entry.js +46 -179
- package/dist/esm/limebb-lime-query-filter-builder_3.entry.js +1 -1
- package/dist/esm/limebb-lime-query-filter-comparison_2.entry.js +142 -0
- package/dist/esm/{limebb-lime-query-filter-comparison_5.entry.js → limebb-lime-query-filter-group_3.entry.js} +7 -333
- package/dist/esm/limebb-live-docs-info.entry.js +2 -2
- package/dist/esm/limebb-locale-picker.entry.js +1 -1
- package/dist/esm/limebb-mention-group-counter.entry.js +2 -2
- package/dist/esm/limebb-navigation-button_2.entry.js +3 -3
- package/dist/esm/limebb-notification-item.entry.js +1 -1
- package/dist/esm/limebb-percentage-visualizer.entry.js +2 -2
- package/dist/esm/limebb-property-selector.entry.js +230 -0
- package/dist/esm/limebb-text-editor.entry.js +1 -1
- package/dist/esm/limebb-trend-indicator.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
- package/dist/lime-crm-building-blocks/{p-b9b954d9.entry.js → p-1034b4a5.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-93cadc1e.entry.js → p-2048ac67.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-6d119dab.entry.js → p-323c49bc.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-631ca5a5.entry.js → p-58782467.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-6aa216ec.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-9cac4de2.entry.js → p-76d81eee.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-e8946134.entry.js → p-79b8b09b.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-569c86b5.entry.js → p-8581245a.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-89a6c396.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-36ea13c0.entry.js → p-8fb2e192.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-3122ea05.entry.js → p-b57dafef.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-f22b66f6.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-f79e354b.entry.js +1 -0
- package/dist/types/components/lime-query-builder/expressions/lime-query-value-input.d.ts +2 -3
- package/dist/types/components/lime-query-builder/lime-query.types.d.ts +0 -72
- package/dist/types/components.d.ts +6 -262
- package/package.json +1 -1
- package/dist/cjs/limebb-lime-query-filter-and.cjs.entry.js +0 -80
- package/dist/cjs/limebb-lime-query-filter-expression.cjs.entry.js +0 -45
- package/dist/cjs/limebb-lime-query-filter-or.cjs.entry.js +0 -68
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-and.css +0 -121
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-and.js +0 -249
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-or.css +0 -123
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-or.js +0 -237
- package/dist/collection/components/lime-query-builder/filter-conversion.js +0 -255
- package/dist/components/limebb-lime-query-filter-and.d.ts +0 -11
- package/dist/components/limebb-lime-query-filter-and.js +0 -135
- package/dist/components/limebb-lime-query-filter-or.d.ts +0 -11
- package/dist/components/limebb-lime-query-filter-or.js +0 -123
- package/dist/esm/limebb-lime-query-filter-and.entry.js +0 -76
- package/dist/esm/limebb-lime-query-filter-expression.entry.js +0 -41
- package/dist/esm/limebb-lime-query-filter-or.entry.js +0 -64
- package/dist/lime-crm-building-blocks/p-24aeb928.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-422f6d51.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-67dbaa4c.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-91732502.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-b198194a.entry.js +0 -1
- package/dist/types/components/lime-query-builder/expressions/lime-query-filter-and.d.ts +0 -57
- package/dist/types/components/lime-query-builder/expressions/lime-query-filter-or.d.ts +0 -56
- package/dist/types/components/lime-query-builder/filter-conversion.d.ts +0 -31
|
@@ -1,167 +1,7 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h } from './index-96dd111f.js';
|
|
2
|
-
import { T as Te } from './index.esm-bb569663.js';
|
|
2
|
+
import { Z as Zt, T as Te } from './index.esm-bb569663.js';
|
|
3
3
|
import { g as getNormalizedProperties, a as getPropertyFromPath } from './property-resolution-fde2375e.js';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* TypeScript type definitions for Lime Query DSL
|
|
7
|
-
*
|
|
8
|
-
* These types represent the structure of Lime Query as defined in:
|
|
9
|
-
* - lime-core/lime_query/schema.py
|
|
10
|
-
* - lime-core/lime_filter/schema.py
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* Available operators with display metadata
|
|
14
|
-
*/
|
|
15
|
-
const LIME_QUERY_OPERATORS = [
|
|
16
|
-
{ value: '=', label: 'Equals', icon: 'equals' },
|
|
17
|
-
{ value: '!=', label: 'Not Equals', icon: 'not-equal' },
|
|
18
|
-
{
|
|
19
|
-
value: '>',
|
|
20
|
-
label: 'Greater Than',
|
|
21
|
-
icon: 'greater-than',
|
|
22
|
-
applicableTypes: ['integer', 'decimal', 'date', 'time'],
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
value: '>=',
|
|
26
|
-
label: 'Greater or Equal',
|
|
27
|
-
icon: 'greater-or-equal',
|
|
28
|
-
applicableTypes: ['integer', 'decimal', 'date', 'time'],
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
value: '<',
|
|
32
|
-
label: 'Less Than',
|
|
33
|
-
icon: 'less-than',
|
|
34
|
-
applicableTypes: ['integer', 'decimal', 'date', 'time'],
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
value: '<=',
|
|
38
|
-
label: 'Less or Equal',
|
|
39
|
-
icon: 'less-or-equal',
|
|
40
|
-
applicableTypes: ['integer', 'decimal', 'date', 'time'],
|
|
41
|
-
},
|
|
42
|
-
{ value: 'IN', label: 'In List', icon: 'list' },
|
|
43
|
-
{
|
|
44
|
-
value: '?',
|
|
45
|
-
label: 'Contains',
|
|
46
|
-
icon: '-lime-filter-contain',
|
|
47
|
-
applicableTypes: ['string', 'text'],
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
value: '=?',
|
|
51
|
-
label: 'Begins With',
|
|
52
|
-
icon: '-lime-filter-begin',
|
|
53
|
-
applicableTypes: ['string', 'text'],
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
value: '=$',
|
|
57
|
-
label: 'Ends With',
|
|
58
|
-
icon: '-lime-filter-end',
|
|
59
|
-
applicableTypes: ['string', 'text'],
|
|
60
|
-
},
|
|
61
|
-
];
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Validate and convert a FilterExpression (comparison filter)
|
|
65
|
-
* @param filter
|
|
66
|
-
*/
|
|
67
|
-
function validateAndConvertFilterExpression(filter) {
|
|
68
|
-
// Validate required properties exist
|
|
69
|
-
if (!('op' in filter) || !('exp' in filter)) {
|
|
70
|
-
throw new Error('Invalid filter: comparison must have key, op, and exp properties');
|
|
71
|
-
}
|
|
72
|
-
// Validate operator is supported
|
|
73
|
-
const supportedOps = LIME_QUERY_OPERATORS.map((o) => o.value);
|
|
74
|
-
if (!supportedOps.includes(filter.op)) {
|
|
75
|
-
throw new Error(`Unsupported filter operator: ${filter.op}`);
|
|
76
|
-
}
|
|
77
|
-
// Check for unexpected properties
|
|
78
|
-
// Note: 'type' property is allowed for filter references
|
|
79
|
-
const knownProps = new Set(['key', 'op', 'exp', 'type']);
|
|
80
|
-
const unexpectedProps = Object.keys(filter).filter((k) => !knownProps.has(k));
|
|
81
|
-
if (unexpectedProps.length > 0) {
|
|
82
|
-
throw new Error(`Unexpected properties in filter comparison: ${unexpectedProps.join(', ')}`);
|
|
83
|
-
}
|
|
84
|
-
return {
|
|
85
|
-
filter_type: 'comparison',
|
|
86
|
-
property: filter.key,
|
|
87
|
-
operator: filter.op,
|
|
88
|
-
value: filter.exp,
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Validate and convert a FilterGroup (AND/OR/NOT filter)
|
|
93
|
-
* @param filter
|
|
94
|
-
*/
|
|
95
|
-
function validateAndConvertFilterGroup(filter) {
|
|
96
|
-
// Validate it has 'op' property
|
|
97
|
-
if (!('op' in filter)) {
|
|
98
|
-
throw new Error('Invalid filter: filter group must have op property');
|
|
99
|
-
}
|
|
100
|
-
// Validate it has 'exp' property
|
|
101
|
-
if (!('exp' in filter)) {
|
|
102
|
-
throw new Error('Invalid filter: filter group must have exp property');
|
|
103
|
-
}
|
|
104
|
-
// Check for unexpected properties in filter groups
|
|
105
|
-
const knownGroupProps = new Set(['op', 'exp']);
|
|
106
|
-
const unexpectedGroupProps = Object.keys(filter).filter((k) => !knownGroupProps.has(k));
|
|
107
|
-
if (unexpectedGroupProps.length > 0) {
|
|
108
|
-
throw new Error(`Unexpected properties in filter group: ${unexpectedGroupProps.join(', ')}`);
|
|
109
|
-
}
|
|
110
|
-
if (filter.op === '!') {
|
|
111
|
-
// NOT filter: exp should be a single expression (not array)
|
|
112
|
-
if (Array.isArray(filter.exp)) {
|
|
113
|
-
throw new TypeError('Invalid NOT filter: exp should be a single expression, not an array');
|
|
114
|
-
}
|
|
115
|
-
return {
|
|
116
|
-
filter_type: 'NOT',
|
|
117
|
-
expression: limeQueryToGuiFilter(filter.exp),
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
if (filter.op === 'AND') {
|
|
121
|
-
// AND filter: exp should be an array
|
|
122
|
-
if (!Array.isArray(filter.exp)) {
|
|
123
|
-
throw new TypeError('Invalid AND filter: exp must be an array');
|
|
124
|
-
}
|
|
125
|
-
return {
|
|
126
|
-
filter_type: 'AND',
|
|
127
|
-
expressions: filter.exp.map(limeQueryToGuiFilter),
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
if (filter.op === 'OR') {
|
|
131
|
-
// OR filter: exp should be an array
|
|
132
|
-
if (!Array.isArray(filter.exp)) {
|
|
133
|
-
throw new TypeError('Invalid OR filter: exp must be an array');
|
|
134
|
-
}
|
|
135
|
-
return {
|
|
136
|
-
filter_type: 'OR',
|
|
137
|
-
expressions: filter.exp.map(limeQueryToGuiFilter),
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
// If we reach here, the operator is unsupported
|
|
141
|
-
throw new Error(`Unsupported filter operator: ${filter.op}`);
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Convert Lime Query filter to UI filter representation
|
|
145
|
-
* Throws errors for unsupported filter structures
|
|
146
|
-
* @param filter
|
|
147
|
-
*/
|
|
148
|
-
function limeQueryToGuiFilter(filter) {
|
|
149
|
-
if (!filter) {
|
|
150
|
-
// Return empty AND instead of missing expression
|
|
151
|
-
// This ensures users see the "Add a condition" button
|
|
152
|
-
return {
|
|
153
|
-
filter_type: 'AND',
|
|
154
|
-
expressions: [],
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
// Check if it's a FilterExpression (has 'key' property)
|
|
158
|
-
if ('key' in filter) {
|
|
159
|
-
return validateAndConvertFilterExpression(filter);
|
|
160
|
-
}
|
|
161
|
-
// It's a FilterGroup
|
|
162
|
-
return validateAndConvertFilterGroup(filter);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
5
|
/**
|
|
166
6
|
* Dynamic filter values and placeholders that are valid in Lime Query
|
|
167
7
|
*/
|
|
@@ -409,6 +249,49 @@ function validatePropertySelection(selection, limetypes, limetype, guiModeEnable
|
|
|
409
249
|
}
|
|
410
250
|
return allGuiLimitations;
|
|
411
251
|
}
|
|
252
|
+
/**
|
|
253
|
+
* Validate a comparison expression (has 'key' property)
|
|
254
|
+
* @param filter
|
|
255
|
+
* @param activeLimetype
|
|
256
|
+
* @param limetypes
|
|
257
|
+
*/
|
|
258
|
+
function validateComparisonExpression(filter, activeLimetype, limetypes) {
|
|
259
|
+
// Validate operator
|
|
260
|
+
const allValidOperators = Object.values(Zt);
|
|
261
|
+
if (!allValidOperators.includes(filter.op)) {
|
|
262
|
+
throw new Error(`Unsupported filter operator: ${filter.op}`);
|
|
263
|
+
}
|
|
264
|
+
// Validate placeholder
|
|
265
|
+
const result = validatePlaceholder(filter.exp, activeLimetype, limetypes);
|
|
266
|
+
if (!result.valid) {
|
|
267
|
+
throw new Error(`Invalid placeholder in filter '${filter.key}': ${result.error}`);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Validate a group expression (AND/OR/NOT)
|
|
272
|
+
* @param filter
|
|
273
|
+
* @param activeLimetype
|
|
274
|
+
* @param limetypes
|
|
275
|
+
* @param guiModeEnabled
|
|
276
|
+
*/
|
|
277
|
+
function validateGroupExpression(filter, activeLimetype, limetypes, guiModeEnabled) {
|
|
278
|
+
// Validate operator
|
|
279
|
+
if (filter.op !== Zt.AND &&
|
|
280
|
+
filter.op !== Zt.OR &&
|
|
281
|
+
filter.op !== Zt.NOT) {
|
|
282
|
+
throw new Error(`Unsupported group operator: ${filter.op}`);
|
|
283
|
+
}
|
|
284
|
+
// Recursively validate children
|
|
285
|
+
if (filter.op === Zt.NOT) {
|
|
286
|
+
validateFilterPlaceholders(filter.exp, activeLimetype, limetypes, guiModeEnabled);
|
|
287
|
+
}
|
|
288
|
+
else if (filter.op === Zt.AND || filter.op === Zt.OR) {
|
|
289
|
+
const expressions = filter.exp;
|
|
290
|
+
for (const expr of expressions) {
|
|
291
|
+
validateFilterPlaceholders(expr, activeLimetype, limetypes, guiModeEnabled);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
412
295
|
/**
|
|
413
296
|
* Validate placeholders in a filter expression
|
|
414
297
|
* @param filter Filter expression to validate
|
|
@@ -420,27 +303,12 @@ function validateFilterPlaceholders(filter, activeLimetype, limetypes, guiModeEn
|
|
|
420
303
|
if (!filter) {
|
|
421
304
|
return;
|
|
422
305
|
}
|
|
423
|
-
// Check if it's a FilterExpression (has 'key' property)
|
|
424
306
|
if ('key' in filter) {
|
|
425
|
-
|
|
426
|
-
if (!result.valid) {
|
|
427
|
-
throw new Error(`Invalid placeholder in filter '${filter.key}': ${result.error}`);
|
|
428
|
-
}
|
|
307
|
+
validateComparisonExpression(filter, activeLimetype, limetypes);
|
|
429
308
|
return;
|
|
430
309
|
}
|
|
431
|
-
// It's a FilterGroup - recursively validate children
|
|
432
310
|
if ('exp' in filter) {
|
|
433
|
-
|
|
434
|
-
// NOT has a single expression
|
|
435
|
-
validateFilterPlaceholders(filter.exp, activeLimetype, limetypes, guiModeEnabled);
|
|
436
|
-
}
|
|
437
|
-
else if (filter.op === 'AND' || filter.op === 'OR') {
|
|
438
|
-
// AND/OR have array of expressions
|
|
439
|
-
const expressions = filter.exp;
|
|
440
|
-
for (const expr of expressions) {
|
|
441
|
-
validateFilterPlaceholders(expr, activeLimetype, limetypes, guiModeEnabled);
|
|
442
|
-
}
|
|
443
|
-
}
|
|
311
|
+
validateGroupExpression(filter, activeLimetype, limetypes, guiModeEnabled);
|
|
444
312
|
}
|
|
445
313
|
}
|
|
446
314
|
/**
|
|
@@ -454,7 +322,6 @@ function validateFilterPlaceholders(filter, activeLimetype, limetypes, guiModeEn
|
|
|
454
322
|
function validateLimeQueryFilterInternal(filter, activeLimetype, limetypes, guiModeEnabled) {
|
|
455
323
|
const errors = [];
|
|
456
324
|
try {
|
|
457
|
-
limeQueryToGuiFilter(filter);
|
|
458
325
|
validateFilterPlaceholders(filter, activeLimetype, limetypes, guiModeEnabled);
|
|
459
326
|
}
|
|
460
327
|
catch (error) {
|
|
@@ -220,7 +220,7 @@ const LimetypeField = class {
|
|
|
220
220
|
value: '',
|
|
221
221
|
};
|
|
222
222
|
options.unshift(emptyOption);
|
|
223
|
-
return (h("limel-select", { key: '
|
|
223
|
+
return (h("limel-select", { key: 'fd9522c5df730f65a5ac57140bca6c05c5acd63d', label: this.label, options: options, value: selectedOption, required: this.required, helperText: this.helperText, invalid: invalid, disabled: this.disabled || this.readonly, onChange: this.handleChange }));
|
|
224
224
|
}
|
|
225
225
|
componentWillRender() {
|
|
226
226
|
this.updatePropertyFields(this.value || '');
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h } from './index-96dd111f.js';
|
|
2
|
+
import { Z as Zt } from './index.esm-bb569663.js';
|
|
3
|
+
|
|
4
|
+
const limeQueryFilterComparisonCss = ".expression-container{display:flex;flex-direction:row;align-items:flex-start;gap:1rem;flex-wrap:wrap}.expression-container>*{flex-grow:2;width:30%;max-width:calc(100% - 3.25rem)}.expression-container>.operator{flex-grow:1;width:calc(30% + 1rem);min-width:4rem}.expression-container>.remove{flex-grow:0;width:auto;margin-left:auto}@media (max-width: 768px){.expression-container{flex-direction:column}.expression-container>*{width:100%;max-width:100%}.expression-container>.operator{width:100%}.expression-container>.remove{margin-left:0;align-self:flex-end}}";
|
|
5
|
+
const LimebbLimeQueryFilterComparisonStyle0 = limeQueryFilterComparisonCss;
|
|
6
|
+
|
|
7
|
+
const LIME_QUERY_OPERATORS = [
|
|
8
|
+
{ value: Zt.EQUALS, label: 'Equals', icon: 'equals' },
|
|
9
|
+
{ value: Zt.NOT_EQUALS, label: 'Not Equals', icon: 'not-equal' },
|
|
10
|
+
{
|
|
11
|
+
value: Zt.GREATER,
|
|
12
|
+
label: 'Greater Than',
|
|
13
|
+
icon: 'greater-than',
|
|
14
|
+
applicableTypes: ['integer', 'decimal', 'date', 'time'],
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
value: Zt.GREATER_OR_EQUAL,
|
|
18
|
+
label: 'Greater or Equal',
|
|
19
|
+
icon: 'greater-or-equal',
|
|
20
|
+
applicableTypes: ['integer', 'decimal', 'date', 'time'],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
value: Zt.LESS,
|
|
24
|
+
label: 'Less Than',
|
|
25
|
+
icon: 'less-than',
|
|
26
|
+
applicableTypes: ['integer', 'decimal', 'date', 'time'],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
value: Zt.LESS_OR_EQUAL,
|
|
30
|
+
label: 'Less or Equal',
|
|
31
|
+
icon: 'less-or-equal',
|
|
32
|
+
applicableTypes: ['integer', 'decimal', 'date', 'time'],
|
|
33
|
+
},
|
|
34
|
+
{ value: Zt.IN, label: 'In List', icon: 'list' },
|
|
35
|
+
{
|
|
36
|
+
value: Zt.LIKE,
|
|
37
|
+
label: 'Contains',
|
|
38
|
+
icon: '-lime-filter-contain',
|
|
39
|
+
applicableTypes: ['string', 'text'],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
value: Zt.BEGINS,
|
|
43
|
+
label: 'Begins With',
|
|
44
|
+
icon: '-lime-filter-begin',
|
|
45
|
+
applicableTypes: ['string', 'text'],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
value: Zt.ENDS,
|
|
49
|
+
label: 'Ends With',
|
|
50
|
+
icon: '-lime-filter-end',
|
|
51
|
+
applicableTypes: ['string', 'text'],
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
const LimeQueryFilterComparisonComponent = class {
|
|
55
|
+
constructor(hostRef) {
|
|
56
|
+
registerInstance(this, hostRef);
|
|
57
|
+
this.expressionChange = createEvent(this, "expressionChange", 7);
|
|
58
|
+
this.handlePropertyChange = (event) => {
|
|
59
|
+
event.stopPropagation();
|
|
60
|
+
this.expressionChange.emit(Object.assign(Object.assign({}, this.expression), { key: event.detail }));
|
|
61
|
+
};
|
|
62
|
+
this.handleOperatorChange = (event) => {
|
|
63
|
+
event.stopPropagation();
|
|
64
|
+
// TODO: Clear value when switching between IN and other operators
|
|
65
|
+
// since array values are incompatible with single-value operators
|
|
66
|
+
this.expressionChange.emit({
|
|
67
|
+
key: this.expression.key,
|
|
68
|
+
op: event.detail.value,
|
|
69
|
+
exp: this.expression.exp,
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
this.handleValueChange = (event) => {
|
|
73
|
+
event.stopPropagation();
|
|
74
|
+
this.expressionChange.emit(Object.assign(Object.assign({}, this.expression), { exp: event.detail }));
|
|
75
|
+
};
|
|
76
|
+
this.removeExpression = () => {
|
|
77
|
+
this.expressionChange.emit(undefined);
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
render() {
|
|
81
|
+
return (h("div", { key: 'a077c982ced9840beec3e574cd3e2e336cff6071', class: "expression" }, this.label && h("limel-header", { key: 'fbcb5cf515aac2c8e68d29947c7560684f30822c', heading: this.label }), h("div", { key: 'ffea426ea1295ae11aaa3c910f835acbeed24cd9', class: "expression-container" }, this.renderPropertySelector(), this.renderOperator(), this.renderValueInput(), h("limel-icon-button", { key: '20064f9fe42a4dfa71b2e1e2d393d50bbe20e2cb', class: "remove", icon: "trash", label: "Remove condition", onClick: this.removeExpression }))));
|
|
82
|
+
}
|
|
83
|
+
renderPropertySelector() {
|
|
84
|
+
return (h("limebb-property-selector", { platform: this.platform, context: this.context, label: "Property", limetype: this.limetype, value: this.expression.key, required: true, onChange: this.handlePropertyChange }));
|
|
85
|
+
}
|
|
86
|
+
renderOperator() {
|
|
87
|
+
const operatorHasBeenSet = !!this.expression.op;
|
|
88
|
+
const options = LIME_QUERY_OPERATORS.map((op) => ({
|
|
89
|
+
text: op.label,
|
|
90
|
+
value: op.value,
|
|
91
|
+
icon: op.icon ? { name: op.icon } : undefined,
|
|
92
|
+
}));
|
|
93
|
+
const selectedOption = options.find((o) => o.value === this.expression.op);
|
|
94
|
+
return (h("limel-select", { class: "operator", label: "Operator", value: selectedOption, options: options, disabled: !operatorHasBeenSet && !this.expression.key, onChange: this.handleOperatorChange }));
|
|
95
|
+
}
|
|
96
|
+
renderValueInput() {
|
|
97
|
+
if (!this.expression.op) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
return (h("limebb-lime-query-value-input", { platform: this.platform, context: this.context, limetype: this.limetype, activeLimetype: this.activeLimetype, propertyPath: this.expression.key, operator: this.expression.op, value: this.expression.exp, onChange: this.handleValueChange }));
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
LimeQueryFilterComparisonComponent.style = LimebbLimeQueryFilterComparisonStyle0;
|
|
104
|
+
|
|
105
|
+
const limeQueryFilterExpressionCss = "@charset \"UTF-8\";.expression{display:flex;flex-direction:column;margin-bottom:1rem;gap:1rem}";
|
|
106
|
+
const LimebbLimeQueryFilterExpressionStyle0 = limeQueryFilterExpressionCss;
|
|
107
|
+
|
|
108
|
+
const LimeQueryFilterExpressionComponent = class {
|
|
109
|
+
constructor(hostRef) {
|
|
110
|
+
registerInstance(this, hostRef);
|
|
111
|
+
this.expressionChange = createEvent(this, "expressionChange", 7);
|
|
112
|
+
this.handleExpressionChange = (event) => {
|
|
113
|
+
event.stopPropagation();
|
|
114
|
+
this.expressionChange.emit(event.detail);
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
render() {
|
|
118
|
+
if (!this.expression) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const props = {
|
|
122
|
+
platform: this.platform,
|
|
123
|
+
context: this.context,
|
|
124
|
+
label: this.label,
|
|
125
|
+
limetype: this.limetype,
|
|
126
|
+
activeLimetype: this.activeLimetype,
|
|
127
|
+
};
|
|
128
|
+
if ('key' in this.expression) {
|
|
129
|
+
return (h("limebb-lime-query-filter-comparison", Object.assign({}, props, { expression: this.expression, onExpressionChange: this.handleExpressionChange })));
|
|
130
|
+
}
|
|
131
|
+
if (this.expression.op === Zt.AND ||
|
|
132
|
+
this.expression.op === Zt.OR) {
|
|
133
|
+
return (h("limebb-lime-query-filter-group", Object.assign({}, props, { expression: this.expression, onExpressionChange: this.handleExpressionChange })));
|
|
134
|
+
}
|
|
135
|
+
if (this.expression.op === Zt.NOT) {
|
|
136
|
+
return (h("limebb-lime-query-filter-not", Object.assign({}, props, { expression: this.expression, onExpressionChange: this.handleExpressionChange })));
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
LimeQueryFilterExpressionComponent.style = LimebbLimeQueryFilterExpressionStyle0;
|
|
141
|
+
|
|
142
|
+
export { LimeQueryFilterComparisonComponent as limebb_lime_query_filter_comparison, LimeQueryFilterExpressionComponent as limebb_lime_query_filter_expression };
|