@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.
Files changed (46) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/cjs/lime-crm-building-blocks.cjs.js +1 -1
  3. package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +21 -15
  4. package/dist/cjs/limebb-lime-query-filter-builder_3.cjs.entry.js +4 -1
  5. package/dist/cjs/limebb-lime-query-filter-comparison_2.cjs.entry.js +41 -22
  6. package/dist/cjs/limebb-lime-query-filter-group_3.cjs.entry.js +42 -70
  7. package/dist/cjs/limebb-lime-query-response-format-editor_2.cjs.entry.js +12 -3
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/collection/components/lime-query-builder/expressions/filter-group-logic.js +2 -32
  10. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-builder.js +4 -1
  11. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison.js +42 -23
  12. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-group.css +0 -7
  13. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-group.js +45 -38
  14. package/dist/collection/components/lime-query-builder/lime-query-builder.css +26 -36
  15. package/dist/collection/components/lime-query-builder/lime-query-builder.js +21 -15
  16. package/dist/collection/components/lime-query-builder/response-format/response-format-editor.css +5 -18
  17. package/dist/collection/components/lime-query-builder/response-format/response-format-editor.js +12 -3
  18. package/dist/components/lime-query-filter-builder.js +4 -1
  19. package/dist/components/lime-query-filter-comparison.js +42 -23
  20. package/dist/components/lime-query-filter-expression.js +44 -71
  21. package/dist/components/limebb-lime-query-builder.js +22 -16
  22. package/dist/components/response-format-editor.js +12 -3
  23. package/dist/esm/lime-crm-building-blocks.js +1 -1
  24. package/dist/esm/limebb-lime-query-builder.entry.js +22 -16
  25. package/dist/esm/limebb-lime-query-filter-builder_3.entry.js +4 -1
  26. package/dist/esm/limebb-lime-query-filter-comparison_2.entry.js +42 -23
  27. package/dist/esm/limebb-lime-query-filter-group_3.entry.js +42 -70
  28. package/dist/esm/limebb-lime-query-response-format-editor_2.entry.js +12 -3
  29. package/dist/esm/loader.js +1 -1
  30. package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
  31. package/dist/lime-crm-building-blocks/p-18e9e1bc.entry.js +1 -0
  32. package/dist/lime-crm-building-blocks/p-81dbda15.entry.js +1 -0
  33. package/dist/lime-crm-building-blocks/p-91074d93.entry.js +1 -0
  34. package/dist/lime-crm-building-blocks/p-a5bd74fb.entry.js +1 -0
  35. package/dist/lime-crm-building-blocks/p-d18697e3.entry.js +1 -0
  36. package/dist/types/components/lime-query-builder/expressions/filter-group-logic.d.ts +0 -16
  37. package/dist/types/components/lime-query-builder/expressions/lime-query-filter-comparison.d.ts +1 -0
  38. package/dist/types/components/lime-query-builder/expressions/lime-query-filter-group.d.ts +5 -5
  39. package/dist/types/components/lime-query-builder/lime-query-builder.d.ts +2 -1
  40. package/dist/types/components/lime-query-builder/response-format/response-format-editor.d.ts +1 -0
  41. package/package.json +1 -1
  42. package/dist/lime-crm-building-blocks/p-186e9f1a.entry.js +0 -1
  43. package/dist/lime-crm-building-blocks/p-1f76540e.entry.js +0 -1
  44. package/dist/lime-crm-building-blocks/p-3384f1ee.entry.js +0 -1
  45. package/dist/lime-crm-building-blocks/p-8917c472.entry.js +0 -1
  46. 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 true'
15
- : 'Any of these conditions are true';
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
@@ -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: "Add a condition", icon: "plus_math", onClick: this.handleAddFirstCondition }));
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 })));
@@ -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
- { value: Operator.EQUALS, label: 'Equals', icon: 'equals' },
5
- { value: Operator.NOT_EQUALS, label: 'Not Equals', icon: 'not-equal' },
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: 'Greater Than',
9
- icon: 'greater-than',
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: 'Greater or Equal',
15
- icon: 'greater-or-equal',
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: 'Less Than',
21
- icon: 'less-than',
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: 'Less or Equal',
27
- icon: 'less-or-equal',
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
- { value: Operator.IN, label: 'In List', icon: 'list' },
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: 'Contains',
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: 'Begins With',
40
- icon: '-lime-filter-begin',
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: 'Ends With',
46
- icon: '-lime-filter-end',
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: '41fc60ed4ce76de8bbed05ee8cc658a188347cbd', class: "expression" }, this.label && h("limel-header", { key: '95cb9b556e2e0f2c8f3fd8ebe3909c402a844fe3', heading: this.label }), h("div", { key: 'feac7dcf059a0a20ad499d1549fa45d775d6bec8', class: "expression-container" }, this.renderPropertySelector(), this.renderOperator(), this.renderValueInput(), h("limel-icon-button", { key: '0fee01518c1c4a29c347a47ce1ce7856b32dfa8f', class: "remove", icon: "trash", label: "Remove condition", onClick: this.removeExpression }))));
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
- text: op.label,
106
- value: op.value,
107
- icon: op.icon ? { name: op.icon } : undefined,
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() {
@@ -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;
@@ -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, getAddConditionButtonLabel, getAddGroupButtonLabel, getFilterGroupSubheading, toggleGroupOperator, updateChildExpression, } from "./filter-group-logic";
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.renderActionButton = (action) => {
25
- return (h("limel-icon-button", { class: "action-icon", elevated: true, icon: action.icon, label: action.label, onClick: this.handleToggleOperator }));
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 newGroup = toggleGroupOperator(this.expression);
30
- this.expressionChange.emit(newGroup);
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: 'b7972fb9e34b8b0b57ae82b3bf4de3e55b66169f', class: "expression" }, subheading && (h("limel-header", { key: '9721388fa6a60018f95dbe27b2959dcc1c11211e', icon: {
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
- get actions() {
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
- const label = this.getAddButtonLabel();
79
- return (h("limel-button", { label: label, icon: "plus_math", onClick: this.handleAddChildExpression }));
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
- const label = this.getAddGroupButtonLabel();
83
- return (h("limel-button", { label: label, icon: "tree_structure", onClick: this.handleAddChildGroup }));
84
- }
85
- getAddButtonLabel() {
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
- :host(limebb-lime-lime-query-builder) {
2
- display: block;
3
- width: 100%;
1
+ *,
2
+ *:before,
3
+ *:after {
4
+ box-sizing: border-box;
4
5
  }
5
6
 
6
- .lime-query-builder {
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
- gap: 1rem;
10
- padding: 1rem;
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-controls {
14
- display: flex;
15
- justify-content: flex-end;
16
- padding: 0.5rem;
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-editor-container .validation-errors {
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-editor-container .validation-errors strong {
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-editor-container .validation-errors ul {
46
+ .code-mode .validation-errors ul {
44
47
  margin: 0;
45
48
  padding-left: 1.5rem;
46
49
  }
47
- .code-editor-container .validation-errors li {
50
+ .code-mode .validation-errors li {
48
51
  margin: 0.25rem 0;
49
52
  }
50
- .code-editor-container .gui-limitations {
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-editor-container .gui-limitations strong {
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-editor-container .gui-limitations ul {
66
+ .code-mode .gui-limitations ul {
64
67
  margin: 0;
65
68
  padding-left: 1.5rem;
66
69
  }
67
- .code-editor-container .gui-limitations li {
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 (h("div", { key: '5e9c8bb860cf348b08272831bc2e252752fad24d', class: "lime-query-builder" }, this.renderLabel(), this.renderModeControls(guiSupported), showCodeMode
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 (h("div", { class: "code-editor-container" }, h("limel-code-editor", { value: this.codeValue, language: "json", lineNumbers: true, fold: true, lint: true, onChange: this.handleCodeChange }), !guiSupported.valid &&
263
- 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)))))), this.guiModeEnabled &&
264
- guiSupported.valid &&
265
- !guiSupported.guiSupported &&
266
- 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))))))));
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
- renderLabel() {
294
- if (!this.label) {
295
- return;
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 (h("div", { class: "mode-controls" }, this.renderModeSwitch(support)));
309
+ return this.renderModeSwitch(support);
304
310
  }
305
311
  renderCodeMode(support) {
306
312
  return h("div", { class: "code-mode" }, this.renderCodeEditor(support));
@@ -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
- .header {
14
- margin: 0;
15
- font-size: 1rem;
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 rgb(var(--contrast-500));
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;
@@ -24,7 +24,7 @@ export class ResponseFormatEditor {
24
24
  /**
25
25
  * Optional label
26
26
  */
27
- this.label = 'Select Properties to Return';
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("h4", { class: "header" }, this.label), h("div", { class: "summary" }, h("span", { class: "count" }, "(", this.items.length, ' ', this.items.length === 1 ? 'property' : 'properties', ' ', "selected)")), 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: "Add Property", icon: "plus_math", onClick: this.handleAddProperty })))));
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": "'Select Properties to Return'"
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: "Add a condition", icon: "plus_math", onClick: this.handleAddFirstCondition }));
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 })));