@limetech/lime-crm-building-blocks 1.103.0 → 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 +13 -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-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-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-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-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-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-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-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
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 })));
|
|
@@ -16,38 +16,8 @@ function getFilterGroupSubheading(operator, expressionCount) {
|
|
|
16
16
|
return '';
|
|
17
17
|
}
|
|
18
18
|
return operator === Zt.AND
|
|
19
|
-
? 'All of these conditions are
|
|
20
|
-
: 'Any of these conditions are
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Get the label for the "Add condition" button
|
|
24
|
-
*
|
|
25
|
-
* @param operator - The group's operator (AND or OR)
|
|
26
|
-
* @param expressionCount - Number of child expressions
|
|
27
|
-
* @returns Appropriate button label based on context
|
|
28
|
-
*/
|
|
29
|
-
function getAddConditionButtonLabel(operator, expressionCount) {
|
|
30
|
-
if (expressionCount === 0) {
|
|
31
|
-
return 'Add a condition';
|
|
32
|
-
}
|
|
33
|
-
return operator === Zt.AND
|
|
34
|
-
? 'Add another condition'
|
|
35
|
-
: 'Add alternative';
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Get the label for the "Add group" button
|
|
39
|
-
*
|
|
40
|
-
* @param operator - The group's operator (AND or OR)
|
|
41
|
-
* @param expressionCount - Number of child expressions
|
|
42
|
-
* @returns Appropriate button label based on context
|
|
43
|
-
*/
|
|
44
|
-
function getAddGroupButtonLabel(operator, expressionCount) {
|
|
45
|
-
if (expressionCount === 0) {
|
|
46
|
-
return 'Add a group';
|
|
47
|
-
}
|
|
48
|
-
return operator === Zt.AND
|
|
49
|
-
? 'Add another group'
|
|
50
|
-
: 'Add alternative group';
|
|
19
|
+
? 'All of these conditions are met'
|
|
20
|
+
: 'Any of these conditions are met';
|
|
51
21
|
}
|
|
52
22
|
/**
|
|
53
23
|
* Create a new empty comparison expression
|
|
@@ -223,7 +193,7 @@ function defineCustomElement$2() {
|
|
|
223
193
|
} });
|
|
224
194
|
}
|
|
225
195
|
|
|
226
|
-
const limeQueryFilterGroupCss = "@charset \"UTF-8\";.expression{display:flex;flex-direction:column;margin-bottom:1rem;gap:0;background-color:rgb(var(--contrast-100));border:1px solid rgb(var(--contrast-500));border-radius:0.75rem}.expression
|
|
196
|
+
const limeQueryFilterGroupCss = "@charset \"UTF-8\";.expression{display:flex;flex-direction:column;margin-bottom:1rem;gap:0;background-color:rgb(var(--contrast-100));border:1px solid rgb(var(--contrast-500));border-radius:0.75rem}.expression>ul{list-style:none;margin-top:0;margin-right:1rem;margin-bottom:1rem;padding-left:1rem;list-style:disc}.expression>ul li{list-style:none;margin-top:1rem}.expression>ul li.add-button{list-style:none;display:flex;gap:0.5rem}";
|
|
227
197
|
const LimebbLimeQueryFilterGroupStyle0 = limeQueryFilterGroupCss;
|
|
228
198
|
|
|
229
199
|
const LimeQueryFilterGroupComponent = /*@__PURE__*/ proxyCustomElement(class LimeQueryFilterGroupComponent extends HTMLElement {
|
|
@@ -232,13 +202,29 @@ const LimeQueryFilterGroupComponent = /*@__PURE__*/ proxyCustomElement(class Lim
|
|
|
232
202
|
this.__registerHost();
|
|
233
203
|
this.__attachShadow();
|
|
234
204
|
this.expressionChange = createEvent(this, "expressionChange", 7);
|
|
235
|
-
this.
|
|
236
|
-
|
|
237
|
-
|
|
205
|
+
this.options = [
|
|
206
|
+
{
|
|
207
|
+
text: 'All',
|
|
208
|
+
secondaryText: 'AND operator',
|
|
209
|
+
value: 'and',
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
text: 'Any',
|
|
213
|
+
secondaryText: 'OR operator',
|
|
214
|
+
value: 'or',
|
|
215
|
+
},
|
|
216
|
+
];
|
|
238
217
|
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) })));
|
|
239
|
-
this.handleToggleOperator = () => {
|
|
240
|
-
const
|
|
241
|
-
|
|
218
|
+
this.handleToggleOperator = (event) => {
|
|
219
|
+
const selectedOption = Array.isArray(event.detail)
|
|
220
|
+
? event.detail[0]
|
|
221
|
+
: event.detail;
|
|
222
|
+
this.value = selectedOption;
|
|
223
|
+
const newOp = selectedOption.value === 'and' ? Zt.AND : Zt.OR;
|
|
224
|
+
if (newOp !== this.expression.op) {
|
|
225
|
+
const newGroup = toggleGroupOperator(this.expression);
|
|
226
|
+
this.expressionChange.emit(newGroup);
|
|
227
|
+
}
|
|
242
228
|
};
|
|
243
229
|
this.handleAddChildExpression = () => {
|
|
244
230
|
const newChild = createEmptyComparison();
|
|
@@ -257,47 +243,33 @@ const LimeQueryFilterGroupComponent = /*@__PURE__*/ proxyCustomElement(class Lim
|
|
|
257
243
|
this.expressionChange.emit(result.expression);
|
|
258
244
|
};
|
|
259
245
|
}
|
|
246
|
+
// Initialize value to match current operator
|
|
247
|
+
componentWillLoad() {
|
|
248
|
+
this.value =
|
|
249
|
+
this.options.find((option) => option.value ===
|
|
250
|
+
(this.expression.op === Zt.AND ? 'and' : 'or')) || this.options[0];
|
|
251
|
+
}
|
|
260
252
|
render() {
|
|
261
253
|
const subheading = this.getSubheading();
|
|
262
|
-
return (h("div", { key: '
|
|
263
|
-
name: this.expression.op === Zt.AND
|
|
264
|
-
? 'dot_bricks'
|
|
265
|
-
: 'dot_circle',
|
|
266
|
-
color: 'rgb(var(--contrast-800))',
|
|
267
|
-
}, 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()))));
|
|
268
|
-
}
|
|
269
|
-
get actions() {
|
|
270
|
-
return [
|
|
271
|
-
{
|
|
272
|
-
id: '1',
|
|
273
|
-
icon: this.expression.op === Zt.AND
|
|
274
|
-
? 'dot_circle'
|
|
275
|
-
: 'dot_bricks',
|
|
276
|
-
label: this.expression.op === Zt.AND
|
|
277
|
-
? 'Any condition (OR)'
|
|
278
|
-
: 'All conditions (AND)',
|
|
279
|
-
},
|
|
280
|
-
];
|
|
254
|
+
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()))));
|
|
281
255
|
}
|
|
282
|
-
|
|
283
|
-
return (h("
|
|
256
|
+
renderOperators() {
|
|
257
|
+
return (h("limel-select", { slot: "actions", value: this.value, options: this.options, onChange: this.handleToggleOperator }));
|
|
284
258
|
}
|
|
285
259
|
getSubheading() {
|
|
286
260
|
return getFilterGroupSubheading(this.expression.op, this.expression.exp.length);
|
|
287
261
|
}
|
|
288
262
|
renderAddButton() {
|
|
289
|
-
|
|
290
|
-
|
|
263
|
+
return (h("limel-button", { label: "Condition", icon: {
|
|
264
|
+
name: 'plus_math',
|
|
265
|
+
title: 'Add',
|
|
266
|
+
}, onClick: this.handleAddChildExpression }));
|
|
291
267
|
}
|
|
292
268
|
renderAddGroupButton() {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
return getAddConditionButtonLabel(this.expression.op, this.expression.exp.length);
|
|
298
|
-
}
|
|
299
|
-
getAddGroupButtonLabel() {
|
|
300
|
-
return getAddGroupButtonLabel(this.expression.op, this.expression.exp.length);
|
|
269
|
+
return (h("limel-button", { label: "Group", icon: {
|
|
270
|
+
name: 'tree_structure',
|
|
271
|
+
title: 'Add',
|
|
272
|
+
}, onClick: this.handleAddChildGroup }));
|
|
301
273
|
}
|
|
302
274
|
static get style() { return LimebbLimeQueryFilterGroupStyle0; }
|
|
303
275
|
}, [1, "limebb-lime-query-filter-group", {
|
|
@@ -305,7 +277,8 @@ const LimeQueryFilterGroupComponent = /*@__PURE__*/ proxyCustomElement(class Lim
|
|
|
305
277
|
"context": [16],
|
|
306
278
|
"limetype": [1],
|
|
307
279
|
"activeLimetype": [1, "active-limetype"],
|
|
308
|
-
"expression": [16]
|
|
280
|
+
"expression": [16],
|
|
281
|
+
"value": [32]
|
|
309
282
|
}]);
|
|
310
283
|
function defineCustomElement$1() {
|
|
311
284
|
if (typeof customElements === "undefined") {
|