@limetech/lime-crm-building-blocks 1.102.4 → 1.103.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 +24 -0
- package/dist/cjs/lime-crm-building-blocks.cjs.js +1 -1
- package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +21 -15
- package/dist/cjs/limebb-lime-query-filter-builder_3.cjs.entry.js +4 -1
- package/dist/cjs/limebb-lime-query-filter-comparison_2.cjs.entry.js +41 -22
- package/dist/cjs/limebb-lime-query-filter-group_3.cjs.entry.js +42 -70
- package/dist/cjs/limebb-lime-query-response-format-editor_2.cjs.entry.js +12 -3
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/lime-query-builder/expressions/filter-group-logic.js +2 -32
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-builder.js +4 -1
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison.js +42 -23
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-group.css +0 -7
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-group.js +45 -38
- package/dist/collection/components/lime-query-builder/lime-query-builder.css +26 -36
- package/dist/collection/components/lime-query-builder/lime-query-builder.js +21 -15
- package/dist/collection/components/lime-query-builder/response-format/response-format-editor.css +5 -18
- package/dist/collection/components/lime-query-builder/response-format/response-format-editor.js +12 -3
- package/dist/components/lime-query-filter-builder.js +4 -1
- package/dist/components/lime-query-filter-comparison.js +42 -23
- package/dist/components/lime-query-filter-expression.js +44 -71
- package/dist/components/limebb-lime-query-builder.js +22 -16
- package/dist/components/response-format-editor.js +12 -3
- package/dist/esm/lime-crm-building-blocks.js +1 -1
- package/dist/esm/limebb-lime-query-builder.entry.js +22 -16
- package/dist/esm/limebb-lime-query-filter-builder_3.entry.js +4 -1
- package/dist/esm/limebb-lime-query-filter-comparison_2.entry.js +42 -23
- package/dist/esm/limebb-lime-query-filter-group_3.entry.js +42 -70
- package/dist/esm/limebb-lime-query-response-format-editor_2.entry.js +12 -3
- 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-18e9e1bc.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-81dbda15.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-91074d93.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-a5bd74fb.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-d18697e3.entry.js +1 -0
- package/dist/types/components/lime-query-builder/expressions/filter-group-logic.d.ts +0 -16
- package/dist/types/components/lime-query-builder/expressions/lime-query-filter-comparison.d.ts +1 -0
- package/dist/types/components/lime-query-builder/expressions/lime-query-filter-group.d.ts +5 -5
- package/dist/types/components/lime-query-builder/lime-query-builder.d.ts +2 -1
- package/dist/types/components/lime-query-builder/response-format/response-format-editor.d.ts +1 -0
- package/package.json +1 -1
- package/dist/lime-crm-building-blocks/p-186e9f1a.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-1f76540e.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-3384f1ee.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-8917c472.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-9167bc6c.entry.js +0 -1
|
@@ -11,38 +11,8 @@ export function getFilterGroupSubheading(operator, expressionCount) {
|
|
|
11
11
|
return '';
|
|
12
12
|
}
|
|
13
13
|
return operator === Operator.AND
|
|
14
|
-
? 'All of these conditions are
|
|
15
|
-
: 'Any of these conditions are
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Get the label for the "Add condition" button
|
|
19
|
-
*
|
|
20
|
-
* @param operator - The group's operator (AND or OR)
|
|
21
|
-
* @param expressionCount - Number of child expressions
|
|
22
|
-
* @returns Appropriate button label based on context
|
|
23
|
-
*/
|
|
24
|
-
export function getAddConditionButtonLabel(operator, expressionCount) {
|
|
25
|
-
if (expressionCount === 0) {
|
|
26
|
-
return 'Add a condition';
|
|
27
|
-
}
|
|
28
|
-
return operator === Operator.AND
|
|
29
|
-
? 'Add another condition'
|
|
30
|
-
: 'Add alternative';
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Get the label for the "Add group" button
|
|
34
|
-
*
|
|
35
|
-
* @param operator - The group's operator (AND or OR)
|
|
36
|
-
* @param expressionCount - Number of child expressions
|
|
37
|
-
* @returns Appropriate button label based on context
|
|
38
|
-
*/
|
|
39
|
-
export function getAddGroupButtonLabel(operator, expressionCount) {
|
|
40
|
-
if (expressionCount === 0) {
|
|
41
|
-
return 'Add a group';
|
|
42
|
-
}
|
|
43
|
-
return operator === Operator.AND
|
|
44
|
-
? 'Add another group'
|
|
45
|
-
: 'Add alternative group';
|
|
14
|
+
? 'All of these conditions are met'
|
|
15
|
+
: 'Any of these conditions are met';
|
|
46
16
|
}
|
|
47
17
|
/**
|
|
48
18
|
* Create a new empty comparison expression
|
package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-builder.js
CHANGED
|
@@ -70,7 +70,10 @@ export class LimeQueryFilterBuilderComponent {
|
|
|
70
70
|
return this.expression.op === Operator.NOT;
|
|
71
71
|
}
|
|
72
72
|
renderEmptyState() {
|
|
73
|
-
return (h("limel-button", { label: "
|
|
73
|
+
return (h("limel-button", { label: "Condition", icon: {
|
|
74
|
+
name: 'plus_math',
|
|
75
|
+
title: 'Add',
|
|
76
|
+
}, onClick: this.handleAddFirstCondition }));
|
|
74
77
|
}
|
|
75
78
|
renderWithPromotionButton() {
|
|
76
79
|
return (h("div", { class: "expression-with-promotion" }, h("limebb-lime-query-filter-expression", { platform: this.platform, context: this.context, limetype: this.limetype, activeLimetype: this.activeLimetype, expression: this.expression, onExpressionChange: this.handleExpressionChange }), h("limel-button", { label: "Add another condition", icon: "plus_math", onClick: this.handlePromoteAndAdd })));
|
package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison.js
CHANGED
|
@@ -1,49 +1,61 @@
|
|
|
1
|
-
import { Operator, } from "@limetech/lime-web-components";
|
|
1
|
+
import { Operator, PlatformServiceName, } from "@limetech/lime-web-components";
|
|
2
2
|
import { h } from "@stencil/core";
|
|
3
3
|
const LIME_QUERY_OPERATORS = [
|
|
4
|
-
{
|
|
5
|
-
|
|
4
|
+
{
|
|
5
|
+
value: Operator.EQUALS,
|
|
6
|
+
label: 'webclient.operator.equals',
|
|
7
|
+
icon: '-lime-filter-equal',
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
value: Operator.NOT_EQUALS,
|
|
11
|
+
label: 'webclient.operator.not-equals',
|
|
12
|
+
icon: '-lime-filter-equal-not',
|
|
13
|
+
},
|
|
6
14
|
{
|
|
7
15
|
value: Operator.GREATER,
|
|
8
|
-
label: '
|
|
9
|
-
icon: 'greater
|
|
16
|
+
label: 'webclient.operator.greater-than',
|
|
17
|
+
icon: '-lime-filter-greater',
|
|
10
18
|
applicableTypes: ['integer', 'decimal', 'date', 'time'],
|
|
11
19
|
},
|
|
12
20
|
{
|
|
13
21
|
value: Operator.GREATER_OR_EQUAL,
|
|
14
|
-
label: '
|
|
15
|
-
icon: 'greater-
|
|
22
|
+
label: 'webclient.operator.greater-than-or-equal-to',
|
|
23
|
+
icon: '-lime-filter-greater-equal',
|
|
16
24
|
applicableTypes: ['integer', 'decimal', 'date', 'time'],
|
|
17
25
|
},
|
|
18
26
|
{
|
|
19
27
|
value: Operator.LESS,
|
|
20
|
-
label: '
|
|
21
|
-
icon: 'less
|
|
28
|
+
label: 'webclient.operator.less-than',
|
|
29
|
+
icon: '-lime-filter-less',
|
|
22
30
|
applicableTypes: ['integer', 'decimal', 'date', 'time'],
|
|
23
31
|
},
|
|
24
32
|
{
|
|
25
33
|
value: Operator.LESS_OR_EQUAL,
|
|
26
|
-
label: '
|
|
27
|
-
icon: 'less-
|
|
34
|
+
label: 'webclient.operator.less-than-or-equal-to',
|
|
35
|
+
icon: '-lime-filter-less-equal',
|
|
28
36
|
applicableTypes: ['integer', 'decimal', 'date', 'time'],
|
|
29
37
|
},
|
|
30
|
-
{
|
|
38
|
+
{
|
|
39
|
+
value: Operator.IN,
|
|
40
|
+
label: 'webclient.operator.in-filter',
|
|
41
|
+
icon: '-lime-filter-set-included',
|
|
42
|
+
},
|
|
31
43
|
{
|
|
32
44
|
value: Operator.LIKE,
|
|
33
|
-
label: '
|
|
45
|
+
label: 'webclient.operator.contains',
|
|
34
46
|
icon: '-lime-filter-contain',
|
|
35
47
|
applicableTypes: ['string', 'text'],
|
|
36
48
|
},
|
|
37
49
|
{
|
|
38
50
|
value: Operator.BEGINS,
|
|
39
|
-
label: '
|
|
40
|
-
icon: '-lime-filter-
|
|
51
|
+
label: 'webclient.operator.begins-with',
|
|
52
|
+
icon: '-lime-filter-starts-with',
|
|
41
53
|
applicableTypes: ['string', 'text'],
|
|
42
54
|
},
|
|
43
55
|
{
|
|
44
56
|
value: Operator.ENDS,
|
|
45
|
-
label: '
|
|
46
|
-
icon: '-lime-filter-
|
|
57
|
+
label: 'webclient.operator.ends-with',
|
|
58
|
+
icon: '-lime-filter-ends-with',
|
|
47
59
|
applicableTypes: ['string', 'text'],
|
|
48
60
|
},
|
|
49
61
|
];
|
|
@@ -94,18 +106,21 @@ export class LimeQueryFilterComparisonComponent {
|
|
|
94
106
|
};
|
|
95
107
|
}
|
|
96
108
|
render() {
|
|
97
|
-
return (h("div", { key: '
|
|
109
|
+
return (h("div", { key: 'cc82394cb254423d27e3f3fd946155f59d4df995', class: "expression" }, this.label && h("limel-header", { key: '11b988d6f57b7f6c0f1df70b5ef28f6c328c2326', heading: this.label }), h("div", { key: '2ead8a31fd0af9e049096b3eb489eed809435f1a', class: "expression-container" }, this.renderPropertySelector(), this.renderOperator(), this.renderValueInput(), h("limel-icon-button", { key: '3f14064d07045c45321b59c2e41bc4f788dee0f8', class: "remove", icon: "trash", label: "Remove condition", onClick: this.removeExpression }))));
|
|
98
110
|
}
|
|
99
111
|
renderPropertySelector() {
|
|
100
112
|
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 }));
|
|
101
113
|
}
|
|
102
114
|
renderOperator() {
|
|
103
115
|
const operatorHasBeenSet = !!this.expression.op;
|
|
104
|
-
const options = LIME_QUERY_OPERATORS.map((op) =>
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
116
|
+
const options = LIME_QUERY_OPERATORS.map((op) => {
|
|
117
|
+
var _a, _b;
|
|
118
|
+
return ({
|
|
119
|
+
text: (_b = (_a = this.translator) === null || _a === void 0 ? void 0 : _a.get(op.label)) !== null && _b !== void 0 ? _b : op.label,
|
|
120
|
+
value: op.value,
|
|
121
|
+
icon: op.icon ? { name: op.icon } : undefined,
|
|
122
|
+
});
|
|
123
|
+
});
|
|
109
124
|
const selectedOption = options.find((o) => o.value === this.expression.op);
|
|
110
125
|
return (h("limel-select", { class: "operator", label: "Operator", value: selectedOption, options: options, disabled: !operatorHasBeenSet && !this.expression.key, onChange: this.handleOperatorChange }));
|
|
111
126
|
}
|
|
@@ -115,6 +130,10 @@ export class LimeQueryFilterComparisonComponent {
|
|
|
115
130
|
}
|
|
116
131
|
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 }));
|
|
117
132
|
}
|
|
133
|
+
get translator() {
|
|
134
|
+
var _a;
|
|
135
|
+
return (_a = this.platform) === null || _a === void 0 ? void 0 : _a.get(PlatformServiceName.Translate);
|
|
136
|
+
}
|
|
118
137
|
static get is() { return "limebb-lime-query-filter-comparison"; }
|
|
119
138
|
static get encapsulation() { return "shadow"; }
|
|
120
139
|
static get originalStyleUrls() {
|
package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-group.css
CHANGED
|
@@ -105,13 +105,6 @@
|
|
|
105
105
|
border: 1px solid rgb(var(--contrast-500));
|
|
106
106
|
border-radius: 0.75rem;
|
|
107
107
|
}
|
|
108
|
-
.expression .clickable-header {
|
|
109
|
-
cursor: pointer;
|
|
110
|
-
user-select: none;
|
|
111
|
-
}
|
|
112
|
-
.expression .clickable-header:hover {
|
|
113
|
-
background-color: rgb(var(--contrast-200));
|
|
114
|
-
}
|
|
115
108
|
.expression > ul {
|
|
116
109
|
list-style: none;
|
|
117
110
|
margin-top: 0;
|
package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-group.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
import { Operator, } from "@limetech/lime-web-components";
|
|
3
|
-
import { addExpressionToGroup, createEmptyComparison, createNestedGroup,
|
|
3
|
+
import { addExpressionToGroup, createEmptyComparison, createNestedGroup, getFilterGroupSubheading, toggleGroupOperator, updateChildExpression, } from "./filter-group-logic";
|
|
4
4
|
/**
|
|
5
5
|
* Lime Query Filter Group Component
|
|
6
6
|
*
|
|
@@ -21,13 +21,29 @@ import { addExpressionToGroup, createEmptyComparison, createNestedGroup, getAddC
|
|
|
21
21
|
*/
|
|
22
22
|
export class LimeQueryFilterGroupComponent {
|
|
23
23
|
constructor() {
|
|
24
|
-
this.
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
this.options = [
|
|
25
|
+
{
|
|
26
|
+
text: 'All',
|
|
27
|
+
secondaryText: 'AND operator',
|
|
28
|
+
value: 'and',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
text: 'Any',
|
|
32
|
+
secondaryText: 'OR operator',
|
|
33
|
+
value: 'or',
|
|
34
|
+
},
|
|
35
|
+
];
|
|
27
36
|
this.renderChildExpression = (expression, childIndex) => (h("li", null, h("limebb-lime-query-filter-expression", { platform: this.platform, context: this.context, limetype: this.limetype, activeLimetype: this.activeLimetype, expression: expression, onExpressionChange: this.handleExpressionChange(childIndex) })));
|
|
28
|
-
this.handleToggleOperator = () => {
|
|
29
|
-
const
|
|
30
|
-
|
|
37
|
+
this.handleToggleOperator = (event) => {
|
|
38
|
+
const selectedOption = Array.isArray(event.detail)
|
|
39
|
+
? event.detail[0]
|
|
40
|
+
: event.detail;
|
|
41
|
+
this.value = selectedOption;
|
|
42
|
+
const newOp = selectedOption.value === 'and' ? Operator.AND : Operator.OR;
|
|
43
|
+
if (newOp !== this.expression.op) {
|
|
44
|
+
const newGroup = toggleGroupOperator(this.expression);
|
|
45
|
+
this.expressionChange.emit(newGroup);
|
|
46
|
+
}
|
|
31
47
|
};
|
|
32
48
|
this.handleAddChildExpression = () => {
|
|
33
49
|
const newChild = createEmptyComparison();
|
|
@@ -46,47 +62,33 @@ export class LimeQueryFilterGroupComponent {
|
|
|
46
62
|
this.expressionChange.emit(result.expression);
|
|
47
63
|
};
|
|
48
64
|
}
|
|
65
|
+
// Initialize value to match current operator
|
|
66
|
+
componentWillLoad() {
|
|
67
|
+
this.value =
|
|
68
|
+
this.options.find((option) => option.value ===
|
|
69
|
+
(this.expression.op === Operator.AND ? 'and' : 'or')) || this.options[0];
|
|
70
|
+
}
|
|
49
71
|
render() {
|
|
50
72
|
const subheading = this.getSubheading();
|
|
51
|
-
return (h("div", { key: '
|
|
52
|
-
name: this.expression.op === Operator.AND
|
|
53
|
-
? 'dot_bricks'
|
|
54
|
-
: 'dot_circle',
|
|
55
|
-
color: 'rgb(var(--contrast-800))',
|
|
56
|
-
}, subheading: subheading, onClick: this.handleToggleOperator, class: "clickable-header" }, this.renderActions())), h("ul", { key: 'f3ae21204e082e81068c0e20b76e14ed4b577051' }, this.expression.exp.map(this.renderChildExpression), h("li", { key: 'd5958d8b61f348540b3dfb821de16ed0f2d0a1f4', class: "add-button" }, this.renderAddButton(), this.renderAddGroupButton()))));
|
|
73
|
+
return (h("div", { key: '741f2870c545d8e879a53244e0334d5c0cf0a4bd', class: "expression" }, subheading && (h("limel-header", { key: 'c08e664d2aaa539a47d3f5b4bbb4daa350c15131', subheading: subheading }, this.renderOperators())), h("ul", { key: '2bddf3cc8b4167845838844512aa6ab5688c46c5' }, this.expression.exp.map(this.renderChildExpression), h("li", { key: 'da86547dcf15b4c53a1991340f19d8bd54f4dee4', class: "add-button" }, this.renderAddButton(), this.renderAddGroupButton()))));
|
|
57
74
|
}
|
|
58
|
-
|
|
59
|
-
return
|
|
60
|
-
{
|
|
61
|
-
id: '1',
|
|
62
|
-
icon: this.expression.op === Operator.AND
|
|
63
|
-
? 'dot_circle'
|
|
64
|
-
: 'dot_bricks',
|
|
65
|
-
label: this.expression.op === Operator.AND
|
|
66
|
-
? 'Any condition (OR)'
|
|
67
|
-
: 'All conditions (AND)',
|
|
68
|
-
},
|
|
69
|
-
];
|
|
70
|
-
}
|
|
71
|
-
renderActions() {
|
|
72
|
-
return (h("div", { class: "actions" }, this.actions.map(this.renderActionButton)));
|
|
75
|
+
renderOperators() {
|
|
76
|
+
return (h("limel-select", { slot: "actions", value: this.value, options: this.options, onChange: this.handleToggleOperator }));
|
|
73
77
|
}
|
|
74
78
|
getSubheading() {
|
|
75
79
|
return getFilterGroupSubheading(this.expression.op, this.expression.exp.length);
|
|
76
80
|
}
|
|
77
81
|
renderAddButton() {
|
|
78
|
-
|
|
79
|
-
|
|
82
|
+
return (h("limel-button", { label: "Condition", icon: {
|
|
83
|
+
name: 'plus_math',
|
|
84
|
+
title: 'Add',
|
|
85
|
+
}, onClick: this.handleAddChildExpression }));
|
|
80
86
|
}
|
|
81
87
|
renderAddGroupButton() {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return getAddConditionButtonLabel(this.expression.op, this.expression.exp.length);
|
|
87
|
-
}
|
|
88
|
-
getAddGroupButtonLabel() {
|
|
89
|
-
return getAddGroupButtonLabel(this.expression.op, this.expression.exp.length);
|
|
88
|
+
return (h("limel-button", { label: "Group", icon: {
|
|
89
|
+
name: 'tree_structure',
|
|
90
|
+
title: 'Add',
|
|
91
|
+
}, onClick: this.handleAddChildGroup }));
|
|
90
92
|
}
|
|
91
93
|
static get is() { return "limebb-lime-query-filter-group"; }
|
|
92
94
|
static get encapsulation() { return "shadow"; }
|
|
@@ -211,6 +213,11 @@ export class LimeQueryFilterGroupComponent {
|
|
|
211
213
|
}
|
|
212
214
|
};
|
|
213
215
|
}
|
|
216
|
+
static get states() {
|
|
217
|
+
return {
|
|
218
|
+
"value": {}
|
|
219
|
+
};
|
|
220
|
+
}
|
|
214
221
|
static get events() {
|
|
215
222
|
return [{
|
|
216
223
|
"method": "expressionChange",
|
|
@@ -1,33 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
*,
|
|
2
|
+
*:before,
|
|
3
|
+
*:after {
|
|
4
|
+
box-sizing: border-box;
|
|
4
5
|
}
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
:host(limebb-lime-query-builder) {
|
|
8
|
+
--header-background-color: rgb(var(--contrast-400));
|
|
9
|
+
--limebb-lime-query-builder-background-color: rgb(var(--contrast-100));
|
|
10
|
+
--limebb-lime-query-builder-border-radius: 0.75rem;
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
width: calc(100% - 1.5rem);
|
|
13
|
+
margin: 0.75rem auto;
|
|
7
14
|
display: flex;
|
|
8
15
|
flex-direction: column;
|
|
9
|
-
|
|
10
|
-
|
|
16
|
+
border-radius: var(--limebb-lime-query-builder-border-radius);
|
|
17
|
+
background-color: var(--limebb-lime-query-builder-background-color);
|
|
18
|
+
box-shadow: var(--shadow-inflated-16);
|
|
11
19
|
}
|
|
12
20
|
|
|
13
|
-
.mode
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
21
|
+
.gui-mode {
|
|
22
|
+
padding: 1rem;
|
|
23
|
+
border: 1px solid var(--header-background-color);
|
|
24
|
+
border-radius: 0 0 0.754rem 0.75rem;
|
|
17
25
|
}
|
|
18
26
|
|
|
19
|
-
.gui-mode,
|
|
20
27
|
.code-mode {
|
|
21
|
-
display: block;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.code-editor-container {
|
|
25
28
|
--code-editor-max-height: 70vh;
|
|
26
29
|
display: flex;
|
|
27
30
|
flex-direction: column;
|
|
28
31
|
gap: 1rem;
|
|
29
32
|
}
|
|
30
|
-
.code-
|
|
33
|
+
.code-mode .validation-errors {
|
|
31
34
|
padding: 0.75rem 1rem;
|
|
32
35
|
color: rgb(var(--color-red-default));
|
|
33
36
|
background-color: rgb(var(--color-red-lighter));
|
|
@@ -35,19 +38,19 @@
|
|
|
35
38
|
border-radius: 0.25rem;
|
|
36
39
|
font-size: 0.875rem;
|
|
37
40
|
}
|
|
38
|
-
.code-
|
|
41
|
+
.code-mode .validation-errors strong {
|
|
39
42
|
display: block;
|
|
40
43
|
margin-bottom: 0.5rem;
|
|
41
44
|
font-weight: 600;
|
|
42
45
|
}
|
|
43
|
-
.code-
|
|
46
|
+
.code-mode .validation-errors ul {
|
|
44
47
|
margin: 0;
|
|
45
48
|
padding-left: 1.5rem;
|
|
46
49
|
}
|
|
47
|
-
.code-
|
|
50
|
+
.code-mode .validation-errors li {
|
|
48
51
|
margin: 0.25rem 0;
|
|
49
52
|
}
|
|
50
|
-
.code-
|
|
53
|
+
.code-mode .gui-limitations {
|
|
51
54
|
padding: 0.75rem 1rem;
|
|
52
55
|
color: rgb(var(--color-blue-dark));
|
|
53
56
|
background-color: rgb(var(--color-blue-lighter));
|
|
@@ -55,26 +58,19 @@
|
|
|
55
58
|
border-radius: 0.25rem;
|
|
56
59
|
font-size: 0.875rem;
|
|
57
60
|
}
|
|
58
|
-
.code-
|
|
61
|
+
.code-mode .gui-limitations strong {
|
|
59
62
|
display: block;
|
|
60
63
|
margin-bottom: 0.5rem;
|
|
61
64
|
font-weight: 600;
|
|
62
65
|
}
|
|
63
|
-
.code-
|
|
66
|
+
.code-mode .gui-limitations ul {
|
|
64
67
|
margin: 0;
|
|
65
68
|
padding-left: 1.5rem;
|
|
66
69
|
}
|
|
67
|
-
.code-
|
|
70
|
+
.code-mode .gui-limitations li {
|
|
68
71
|
margin: 0.25rem 0;
|
|
69
72
|
}
|
|
70
73
|
|
|
71
|
-
.lime-query-builder-label {
|
|
72
|
-
margin: 0;
|
|
73
|
-
font-size: 1.5rem;
|
|
74
|
-
font-weight: 600;
|
|
75
|
-
color: rgb(var(--contrast-1100));
|
|
76
|
-
}
|
|
77
|
-
|
|
78
74
|
.limetype-section {
|
|
79
75
|
display: flex;
|
|
80
76
|
flex-direction: column;
|
|
@@ -99,10 +95,4 @@
|
|
|
99
95
|
display: flex;
|
|
100
96
|
flex-direction: column;
|
|
101
97
|
gap: 1rem;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
@media (max-width: 768px) {
|
|
105
|
-
.lime-query-builder {
|
|
106
|
-
gap: 1.5rem;
|
|
107
|
-
}
|
|
108
98
|
}
|
|
@@ -8,7 +8,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9
9
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
10
|
};
|
|
11
|
-
import { h } from "@stencil/core";
|
|
11
|
+
import { h, Host, } from "@stencil/core";
|
|
12
12
|
import { SelectLimeTypes as Limetypes, } from "@limetech/lime-web-components";
|
|
13
13
|
import { isLimeQuerySupported, } from "./lime-query-validation";
|
|
14
14
|
/**
|
|
@@ -158,11 +158,14 @@ export class LimeQueryBuilder {
|
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
render() {
|
|
161
|
+
return (h(Host, { key: '02e7367fbc718a8625c8d49d5e546acca0986ce2' }, this.renderHeader(), this.renderContent()));
|
|
162
|
+
}
|
|
163
|
+
renderContent() {
|
|
161
164
|
const guiSupported = this.checkGuiSupport();
|
|
162
165
|
const showCodeMode = !this.guiModeEnabled || this.mode === 'code';
|
|
163
|
-
return
|
|
166
|
+
return showCodeMode
|
|
164
167
|
? this.renderCodeMode(guiSupported)
|
|
165
|
-
: this.renderGuiMode()
|
|
168
|
+
: this.renderGuiMode();
|
|
166
169
|
}
|
|
167
170
|
emitChange() {
|
|
168
171
|
// Only emit in GUI mode
|
|
@@ -256,14 +259,19 @@ export class LimeQueryBuilder {
|
|
|
256
259
|
renderModeSwitch(support) {
|
|
257
260
|
const guiDisabled = !support.guiSupported;
|
|
258
261
|
const buttons = this.getButtons().map((button) => (Object.assign(Object.assign({}, button), { selected: button.id === this.mode })));
|
|
259
|
-
return (h("limel-button-group", { onChange: this.handleChange, value: buttons, disabled: guiDisabled }));
|
|
262
|
+
return (h("limel-button-group", { slot: "actions", onChange: this.handleChange, value: buttons, disabled: guiDisabled }));
|
|
260
263
|
}
|
|
261
264
|
renderCodeEditor(guiSupported) {
|
|
262
|
-
return
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
!guiSupported.guiSupported &&
|
|
266
|
-
|
|
265
|
+
return [
|
|
266
|
+
h("limel-code-editor", { value: this.codeValue, language: "json", lineNumbers: true, fold: true, lint: true, onChange: this.handleCodeChange }),
|
|
267
|
+
/* Show validation errors (invalid Lime Query) */
|
|
268
|
+
!guiSupported.valid && guiSupported.validationErrors.length > 0 && (h("div", { class: "validation-errors" }, h("strong", null, "Invalid Lime Query:"), h("ul", null, guiSupported.validationErrors.map((error) => (h("li", null, error)))))),
|
|
269
|
+
/* Show GUI limitations (only when GUI mode is enabled and Lime Query is valid) */
|
|
270
|
+
this.guiModeEnabled &&
|
|
271
|
+
guiSupported.valid &&
|
|
272
|
+
!guiSupported.guiSupported &&
|
|
273
|
+
guiSupported.guiLimitations.length > 0 && (h("div", { class: "gui-limitations" }, h("strong", null, "Cannot switch to GUI mode:"), h("ul", null, guiSupported.guiLimitations.map((limitation) => (h("li", null, limitation)))))),
|
|
274
|
+
];
|
|
267
275
|
}
|
|
268
276
|
renderLimetypeSection() {
|
|
269
277
|
return (h("div", { class: "limetype-section" }, h("limebb-limetype-field", { platform: this.platform, context: this.context, label: "Object Type", value: this.limetype, required: true, fieldName: "limetype", helperText: "Select the type of object you want to query", onChange: this.handleLimetypeChange })));
|
|
@@ -290,17 +298,15 @@ export class LimeQueryBuilder {
|
|
|
290
298
|
renderGuiMode() {
|
|
291
299
|
return (h("div", { class: "gui-mode" }, this.renderLimetypeSection(), this.renderResponseFormatSection(), this.renderFilterSection(), this.renderQueryOptionsSection()));
|
|
292
300
|
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}
|
|
297
|
-
return h("h3", { class: "lime-query-builder-label" }, this.label);
|
|
301
|
+
renderHeader() {
|
|
302
|
+
const guiSupported = this.checkGuiSupport();
|
|
303
|
+
return (h("limel-header", { heading: this.label }, this.renderModeControls(guiSupported)));
|
|
298
304
|
}
|
|
299
305
|
renderModeControls(support) {
|
|
300
306
|
if (!this.guiModeEnabled) {
|
|
301
307
|
return;
|
|
302
308
|
}
|
|
303
|
-
return
|
|
309
|
+
return this.renderModeSwitch(support);
|
|
304
310
|
}
|
|
305
311
|
renderCodeMode(support) {
|
|
306
312
|
return h("div", { class: "code-mode" }, this.renderCodeEditor(support));
|
package/dist/collection/components/lime-query-builder/response-format/response-format-editor.css
CHANGED
|
@@ -6,19 +6,17 @@
|
|
|
6
6
|
.response-format-editor {
|
|
7
7
|
display: flex;
|
|
8
8
|
flex-direction: column;
|
|
9
|
-
gap: 0.5rem;
|
|
10
9
|
padding: 1rem 0;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
font-weight: 600;
|
|
17
|
-
color: rgb(var(--contrast-1000));
|
|
12
|
+
limel-badge[slot=actions] {
|
|
13
|
+
--badge-background-color: rgb(var(--contrast-200));
|
|
14
|
+
margin-right: 0.25rem;
|
|
18
15
|
}
|
|
19
16
|
|
|
20
17
|
.property {
|
|
21
|
-
border: 1px solid
|
|
18
|
+
border: 1px solid var(--header-background-color);
|
|
19
|
+
border-radius: 0 0 0.75rem 0.75rem;
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
.property-list {
|
|
@@ -46,17 +44,6 @@
|
|
|
46
44
|
width: 100%;
|
|
47
45
|
}
|
|
48
46
|
|
|
49
|
-
.summary {
|
|
50
|
-
display: flex;
|
|
51
|
-
justify-content: space-between;
|
|
52
|
-
align-items: center;
|
|
53
|
-
}
|
|
54
|
-
.summary .count {
|
|
55
|
-
font-size: 0.875rem;
|
|
56
|
-
font-weight: 500;
|
|
57
|
-
color: rgb(var(--contrast-900));
|
|
58
|
-
}
|
|
59
|
-
|
|
60
47
|
.empty-state {
|
|
61
48
|
padding: 2rem;
|
|
62
49
|
text-align: center;
|
package/dist/collection/components/lime-query-builder/response-format/response-format-editor.js
CHANGED
|
@@ -24,7 +24,7 @@ export class ResponseFormatEditor {
|
|
|
24
24
|
/**
|
|
25
25
|
* Optional label
|
|
26
26
|
*/
|
|
27
|
-
this.label = '
|
|
27
|
+
this.label = 'Properties';
|
|
28
28
|
this.items = [{ path: '_id' }];
|
|
29
29
|
this.handleItemChange = (index) => (event) => {
|
|
30
30
|
event.stopPropagation();
|
|
@@ -81,7 +81,16 @@ export class ResponseFormatEditor {
|
|
|
81
81
|
if (!this.limetype) {
|
|
82
82
|
return (h("div", { class: "empty-state" }, h("p", null, "Select a limetype to choose properties")));
|
|
83
83
|
}
|
|
84
|
-
return (h("div", { class: "response-format-editor" }, h("
|
|
84
|
+
return (h("div", { class: "response-format-editor" }, h("limel-header", { subheading: this.label }, this.renderPropertyCount()), h("div", { class: "property" }, h("div", { class: "property-list" }, this.items.map((item, index) => this.renderItem(item, index))), h("div", { class: "actions" }, h("limel-button", { label: "Property", icon: {
|
|
85
|
+
name: 'plus_math',
|
|
86
|
+
title: 'Add',
|
|
87
|
+
}, onClick: this.handleAddProperty })))));
|
|
88
|
+
}
|
|
89
|
+
renderPropertyCount() {
|
|
90
|
+
return [
|
|
91
|
+
h("limel-badge", { slot: "actions", id: "counter-badge", label: this.items.length.toString() }),
|
|
92
|
+
h("limel-tooltip", { elementId: "counter-badge", slot: "actions", label: "Number of selected properties" }),
|
|
93
|
+
];
|
|
85
94
|
}
|
|
86
95
|
renderItem(item, index) {
|
|
87
96
|
return (h("limebb-lime-query-response-format-item", { key: `${item.path}-${index}`, class: "property-item", platform: this.platform, context: this.context, limetype: this.limetype, item: item, onItemChange: this.handleItemChange(index) }));
|
|
@@ -213,7 +222,7 @@ export class ResponseFormatEditor {
|
|
|
213
222
|
"setter": false,
|
|
214
223
|
"attribute": "label",
|
|
215
224
|
"reflect": false,
|
|
216
|
-
"defaultValue": "'
|
|
225
|
+
"defaultValue": "'Properties'"
|
|
217
226
|
}
|
|
218
227
|
};
|
|
219
228
|
}
|
|
@@ -69,7 +69,10 @@ const LimeQueryFilterBuilderComponent = /*@__PURE__*/ proxyCustomElement(class L
|
|
|
69
69
|
return this.expression.op === Zt.NOT;
|
|
70
70
|
}
|
|
71
71
|
renderEmptyState() {
|
|
72
|
-
return (h("limel-button", { label: "
|
|
72
|
+
return (h("limel-button", { label: "Condition", icon: {
|
|
73
|
+
name: 'plus_math',
|
|
74
|
+
title: 'Add',
|
|
75
|
+
}, onClick: this.handleAddFirstCondition }));
|
|
73
76
|
}
|
|
74
77
|
renderWithPromotionButton() {
|
|
75
78
|
return (h("div", { class: "expression-with-promotion" }, h("limebb-lime-query-filter-expression", { platform: this.platform, context: this.context, limetype: this.limetype, activeLimetype: this.activeLimetype, expression: this.expression, onExpressionChange: this.handleExpressionChange }), h("limel-button", { label: "Add another condition", icon: "plus_math", onClick: this.handlePromoteAndAdd })));
|