@limetech/lime-crm-building-blocks 1.103.0 → 1.103.2

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 (45) hide show
  1. package/CHANGELOG.md +20 -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-group_3.cjs.entry.js +42 -70
  6. package/dist/cjs/limebb-lime-query-response-format-builder.cjs.entry.js +3 -1
  7. package/dist/cjs/limebb-lime-query-response-format-editor_2.cjs.entry.js +51 -12
  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-group.css +0 -7
  12. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-group.js +45 -38
  13. package/dist/collection/components/lime-query-builder/lime-query-builder.css +26 -36
  14. package/dist/collection/components/lime-query-builder/lime-query-builder.js +21 -15
  15. package/dist/collection/components/lime-query-builder/response-format/response-format-editor.css +13 -18
  16. package/dist/collection/components/lime-query-builder/response-format/response-format-editor.js +51 -12
  17. package/dist/collection/components/lime-query-builder/response-format/response-format-helpers.js +6 -2
  18. package/dist/components/lime-query-filter-builder.js +4 -1
  19. package/dist/components/lime-query-filter-expression.js +44 -71
  20. package/dist/components/limebb-lime-query-builder.js +22 -16
  21. package/dist/components/limebb-lime-query-response-format-builder.js +3 -1
  22. package/dist/components/response-format-editor.js +51 -12
  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-group_3.entry.js +42 -70
  27. package/dist/esm/limebb-lime-query-response-format-builder.entry.js +3 -1
  28. package/dist/esm/limebb-lime-query-response-format-editor_2.entry.js +51 -12
  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-81dbda15.entry.js +1 -0
  32. package/dist/lime-crm-building-blocks/p-91074d93.entry.js +1 -0
  33. package/dist/lime-crm-building-blocks/p-d18697e3.entry.js +1 -0
  34. package/dist/lime-crm-building-blocks/p-d724b3c6.entry.js +1 -0
  35. package/dist/lime-crm-building-blocks/p-f92ca0b8.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-group.d.ts +5 -5
  38. package/dist/types/components/lime-query-builder/lime-query-builder.d.ts +2 -1
  39. package/dist/types/components/lime-query-builder/response-format/response-format-editor.d.ts +1 -0
  40. package/package.json +1 -1
  41. package/dist/lime-crm-building-blocks/p-1f76540e.entry.js +0 -1
  42. package/dist/lime-crm-building-blocks/p-2d5f83bc.entry.js +0 -1
  43. package/dist/lime-crm-building-blocks/p-3384f1ee.entry.js +0 -1
  44. package/dist/lime-crm-building-blocks/p-8917c472.entry.js +0 -1
  45. 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 })));
@@ -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;
@@ -65,4 +52,12 @@
65
52
  }
66
53
  .empty-state p {
67
54
  margin: 0;
55
+ }
56
+ .empty-state .empty-state-message {
57
+ margin-bottom: 1rem;
58
+ font-size: 0.875rem;
59
+ }
60
+ .empty-state limel-button {
61
+ margin: 0 auto;
62
+ max-width: 200px;
68
63
  }
@@ -24,8 +24,8 @@ export class ResponseFormatEditor {
24
24
  /**
25
25
  * Optional label
26
26
  */
27
- this.label = 'Select Properties to Return';
28
- this.items = [{ path: '_id' }];
27
+ this.label = 'Properties';
28
+ this.items = [];
29
29
  this.handleItemChange = (index) => (event) => {
30
30
  event.stopPropagation();
31
31
  const newItems = [...this.items];
@@ -37,10 +37,7 @@ export class ResponseFormatEditor {
37
37
  // Update item
38
38
  newItems[index] = event.detail;
39
39
  }
40
- // Ensure we always have at least _id
41
- if (newItems.length === 0) {
42
- newItems.push({ path: '_id' });
43
- }
40
+ // Allow empty items - users can remove all properties
44
41
  this.items = newItems;
45
42
  this.emitChange();
46
43
  };
@@ -51,16 +48,45 @@ export class ResponseFormatEditor {
51
48
  }
52
49
  componentWillLoad() {
53
50
  var _a;
54
- if ((_a = this.value) === null || _a === void 0 ? void 0 : _a.object) {
51
+ // Check if value is truly empty ({}) - no object or aggregates
52
+ const isTrulyEmpty = this.value &&
53
+ Object.keys(this.value).length === 0 &&
54
+ !this.value.object &&
55
+ !this.value.aggregates;
56
+ if (isTrulyEmpty) {
57
+ // Keep items empty for truly empty objects
58
+ this.items = [];
59
+ }
60
+ else if ((_a = this.value) === null || _a === void 0 ? void 0 : _a.object) {
55
61
  const converted = propertySelectionToItems(this.value.object);
56
62
  if (converted.length > 0) {
57
63
  this.items = converted;
58
64
  }
65
+ else {
66
+ // Empty object property, but not a truly empty value
67
+ // Use default _id for backward compatibility
68
+ this.items = [{ path: '_id' }];
69
+ }
70
+ }
71
+ else if (!this.value) {
72
+ // No value provided at all, use default _id
73
+ this.items = [{ path: '_id' }];
59
74
  }
60
75
  }
61
76
  componentWillUpdate() {
62
77
  var _a;
63
- if ((_a = this.value) === null || _a === void 0 ? void 0 : _a.object) {
78
+ // Check if value is truly empty ({})
79
+ const isTrulyEmpty = this.value &&
80
+ Object.keys(this.value).length === 0 &&
81
+ !this.value.object &&
82
+ !this.value.aggregates;
83
+ if (isTrulyEmpty) {
84
+ // Keep items empty for truly empty objects
85
+ if (this.items.length > 0) {
86
+ this.items = [];
87
+ }
88
+ }
89
+ else if ((_a = this.value) === null || _a === void 0 ? void 0 : _a.object) {
64
90
  const currentItems = propertySelectionToItems(this.value.object);
65
91
  // Check if items have changed
66
92
  const itemsChanged = currentItems.length !== this.items.length ||
@@ -72,8 +98,8 @@ export class ResponseFormatEditor {
72
98
  item.description === current.description);
73
99
  });
74
100
  if (itemsChanged) {
75
- this.items =
76
- currentItems.length > 0 ? currentItems : [{ path: '_id' }];
101
+ // Allow empty items array - don't force _id
102
+ this.items = currentItems;
77
103
  }
78
104
  }
79
105
  }
@@ -81,7 +107,20 @@ export class ResponseFormatEditor {
81
107
  if (!this.limetype) {
82
108
  return (h("div", { class: "empty-state" }, h("p", null, "Select a limetype to choose properties")));
83
109
  }
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 })))));
110
+ // Render empty state when no properties are selected
111
+ if (this.items.length === 0) {
112
+ return (h("div", { class: "response-format-editor" }, h("h4", { class: "header" }, this.label), h("div", { class: "empty-state" }, h("p", { class: "empty-state-message" }, "No properties selected. The response will return empty objects."), h("limel-button", { label: "Add Property", icon: "plus_math", onClick: this.handleAddProperty }))));
113
+ }
114
+ 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: {
115
+ name: 'plus_math',
116
+ title: 'Add',
117
+ }, onClick: this.handleAddProperty })))));
118
+ }
119
+ renderPropertyCount() {
120
+ return [
121
+ h("limel-badge", { slot: "actions", id: "counter-badge", label: this.items.length.toString() }),
122
+ h("limel-tooltip", { elementId: "counter-badge", slot: "actions", label: "Number of selected properties" }),
123
+ ];
85
124
  }
86
125
  renderItem(item, index) {
87
126
  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 +252,7 @@ export class ResponseFormatEditor {
213
252
  "setter": false,
214
253
  "attribute": "label",
215
254
  "reflect": false,
216
- "defaultValue": "'Select Properties to Return'"
255
+ "defaultValue": "'Properties'"
217
256
  }
218
257
  };
219
258
  }
@@ -32,7 +32,9 @@ export function parseResponseFormat(json) {
32
32
  `Only 'object' and 'aggregates' are allowed.`);
33
33
  }
34
34
  // Must have at least one of object or aggregates
35
- if (!parsed.object && !parsed.aggregates) {
35
+ // Note: Empty objects {} are valid (starting point for GUI mode)
36
+ const hasProperties = keys.length > 0;
37
+ if (hasProperties && !parsed.object && !parsed.aggregates) {
36
38
  throw new Error('Response format must contain at least one of: object, aggregates');
37
39
  }
38
40
  return parsed;
@@ -82,7 +84,9 @@ export function isValidResponseFormatStructure(json) {
82
84
  };
83
85
  }
84
86
  // Must have at least one of object or aggregates
85
- if (!json.object && !json.aggregates) {
87
+ // Note: Empty objects {} are valid (starting point for GUI mode)
88
+ const hasProperties = keys.length > 0;
89
+ if (hasProperties && !json.object && !json.aggregates) {
86
90
  return {
87
91
  valid: false,
88
92
  error: 'Response format must contain at least one of: object, aggregates',
@@ -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 })));