@limetech/lime-crm-building-blocks 1.96.0 → 1.98.0

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 (179) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/{_MapCache-2e84a981.js → _MapCache-8b125fbb.js} +0 -26
  3. package/dist/cjs/{_Uint8Array-1e99726d.js → _Uint8Array-95263550.js} +1 -12
  4. package/dist/cjs/_baseIsEqual-cb7951b0.js +496 -0
  5. package/dist/cjs/_defineProperty-40a6ad5d.js +15 -0
  6. package/dist/cjs/{get-1acf79ce.js → get-932b213e.js} +5 -4
  7. package/dist/cjs/isEqual-e77cce75.js +37 -0
  8. package/dist/cjs/isSymbol-5b36aeee.js +30 -0
  9. package/dist/cjs/lime-crm-building-blocks.cjs.js +1 -1
  10. package/dist/cjs/lime-query.types-bcb63a22.js +61 -0
  11. package/dist/cjs/limebb-component-config.cjs.entry.js +3 -2
  12. package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +378 -150
  13. package/dist/cjs/limebb-lime-query-filter-and_5.cjs.entry.js +278 -0
  14. package/dist/cjs/limebb-lime-query-value-input.cjs.entry.js +239 -0
  15. package/dist/cjs/limebb-limetype-field_2.cjs.entry.js +406 -0
  16. package/dist/cjs/limebb-live-docs-info.cjs.entry.js +2 -2
  17. package/dist/cjs/limebb-locale-picker.cjs.entry.js +13 -498
  18. package/dist/cjs/limebb-mention-group-counter.cjs.entry.js +2 -2
  19. package/dist/cjs/limebb-navigation-button_2.cjs.entry.js +3 -3
  20. package/dist/cjs/limebb-notification-item.cjs.entry.js +1 -1
  21. package/dist/cjs/limebb-percentage-visualizer.cjs.entry.js +2 -2
  22. package/dist/cjs/limebb-property-selector.cjs.entry.js +234 -0
  23. package/dist/cjs/limebb-response-format-item.cjs.entry.js +80 -0
  24. package/dist/cjs/limebb-text-editor.cjs.entry.js +20 -61
  25. package/dist/cjs/limebb-trend-indicator.cjs.entry.js +1 -1
  26. package/dist/cjs/limetype-1fe0207f.js +90 -0
  27. package/dist/cjs/loader.cjs.js +1 -1
  28. package/dist/cjs/property-resolution-fb42a46b.js +66 -0
  29. package/dist/collection/collection-manifest.json +10 -0
  30. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-and.css +121 -0
  31. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-and.js +257 -0
  32. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison.css +39 -0
  33. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison.js +246 -0
  34. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-expression.css +104 -0
  35. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-expression.js +220 -0
  36. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-not.css +107 -0
  37. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-not.js +212 -0
  38. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-or.css +123 -0
  39. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-or.js +237 -0
  40. package/dist/collection/components/lime-query-builder/expressions/lime-query-value-input.css +48 -0
  41. package/dist/collection/components/lime-query-builder/expressions/lime-query-value-input.js +457 -0
  42. package/dist/collection/components/lime-query-builder/filter-conversion.js +118 -21
  43. package/dist/collection/components/lime-query-builder/lime-query-builder.css +30 -17
  44. package/dist/collection/components/lime-query-builder/lime-query-builder.js +253 -27
  45. package/dist/collection/components/lime-query-builder/limetype-field/limetype-field.js +435 -0
  46. package/dist/collection/components/lime-query-builder/property-selection-format.js +158 -0
  47. package/dist/collection/components/lime-query-builder/property-selector/property-selector.css +8 -0
  48. package/dist/collection/components/lime-query-builder/property-selector/property-selector.js +422 -0
  49. package/dist/collection/components/lime-query-builder/response-format-editor.css +72 -0
  50. package/dist/collection/components/lime-query-builder/response-format-editor.js +249 -0
  51. package/dist/collection/components/lime-query-builder/response-format-item.css +61 -0
  52. package/dist/collection/components/lime-query-builder/response-format-item.js +208 -0
  53. package/dist/collection/components/limeobject/file-viewer/live-docs-info.js +2 -2
  54. package/dist/collection/components/locale-picker/locale-picker.js +1 -1
  55. package/dist/collection/components/notification-list/notification-item/notification-item.js +1 -1
  56. package/dist/collection/components/percentage-visualizer/percentage-visualizer.js +2 -2
  57. package/dist/collection/components/summary-popover/summary-popover.js +3 -3
  58. package/dist/collection/components/text-editor/mention-group-counter.js +2 -2
  59. package/dist/collection/components/text-editor/text-editor.js +1 -1
  60. package/dist/collection/components/trend-indicator/trend-indicator.js +1 -1
  61. package/dist/components/_MapCache.js +2 -27
  62. package/dist/components/_Uint8Array.js +2 -12
  63. package/dist/components/_baseIsEqual.js +494 -0
  64. package/dist/components/_defineProperty.js +13 -0
  65. package/dist/components/get.js +2 -1
  66. package/dist/components/isEqual.js +35 -0
  67. package/dist/components/isSymbol.js +28 -0
  68. package/dist/components/lime-query-filter-and.js +408 -0
  69. package/dist/components/lime-query-filter-comparison.js +152 -0
  70. package/dist/components/lime-query-value-input.js +266 -0
  71. package/dist/components/limebb-lime-query-builder.js +437 -149
  72. package/dist/components/limebb-lime-query-filter-and.d.ts +11 -0
  73. package/dist/components/limebb-lime-query-filter-and.js +6 -0
  74. package/dist/components/limebb-lime-query-filter-comparison.d.ts +11 -0
  75. package/dist/components/limebb-lime-query-filter-comparison.js +6 -0
  76. package/dist/components/limebb-lime-query-filter-expression.d.ts +11 -0
  77. package/dist/components/limebb-lime-query-filter-expression.js +6 -0
  78. package/dist/components/limebb-lime-query-filter-not.d.ts +11 -0
  79. package/dist/components/limebb-lime-query-filter-not.js +6 -0
  80. package/dist/components/limebb-lime-query-filter-or.d.ts +11 -0
  81. package/dist/components/limebb-lime-query-filter-or.js +6 -0
  82. package/dist/components/limebb-lime-query-value-input.d.ts +11 -0
  83. package/dist/components/limebb-lime-query-value-input.js +6 -0
  84. package/dist/components/limebb-limetype-field.d.ts +11 -0
  85. package/dist/components/limebb-limetype-field.js +6 -0
  86. package/dist/components/limebb-locale-picker.js +8 -493
  87. package/dist/components/limebb-mention-group-counter.js +2 -2
  88. package/dist/components/limebb-percentage-visualizer.js +2 -2
  89. package/dist/components/limebb-property-selector.d.ts +11 -0
  90. package/dist/components/limebb-property-selector.js +6 -0
  91. package/dist/components/limebb-response-format-editor.d.ts +11 -0
  92. package/dist/components/limebb-response-format-editor.js +6 -0
  93. package/dist/components/limebb-response-format-item.d.ts +11 -0
  94. package/dist/components/limebb-response-format-item.js +6 -0
  95. package/dist/components/limebb-text-editor.js +7 -48
  96. package/dist/components/limebb-trend-indicator.js +1 -1
  97. package/dist/components/limetype-field.js +184 -0
  98. package/dist/components/limetype.js +85 -0
  99. package/dist/components/live-docs-info.js +2 -2
  100. package/dist/components/notification-item.js +1 -1
  101. package/dist/components/property-selector.js +317 -0
  102. package/dist/components/response-format-editor.js +278 -0
  103. package/dist/components/response-format-item.js +104 -0
  104. package/dist/components/summary-popover.js +3 -3
  105. package/dist/esm/{_MapCache-6484495d.js → _MapCache-af496e9d.js} +2 -27
  106. package/dist/esm/{_Uint8Array-e5cac922.js → _Uint8Array-d6ebd526.js} +3 -13
  107. package/dist/esm/_baseIsEqual-28053b81.js +494 -0
  108. package/dist/esm/_defineProperty-e6a185c3.js +13 -0
  109. package/dist/esm/{get-f9e0b2e1.js → get-3e42932b.js} +2 -1
  110. package/dist/esm/isEqual-57d0c223.js +35 -0
  111. package/dist/esm/isSymbol-1c5f65cc.js +28 -0
  112. package/dist/esm/lime-crm-building-blocks.js +1 -1
  113. package/dist/esm/lime-query.types-f72355e1.js +59 -0
  114. package/dist/esm/limebb-component-config.entry.js +3 -2
  115. package/dist/esm/limebb-lime-query-builder.entry.js +375 -147
  116. package/dist/esm/limebb-lime-query-filter-and_5.entry.js +270 -0
  117. package/dist/esm/limebb-lime-query-value-input.entry.js +235 -0
  118. package/dist/esm/limebb-limetype-field_2.entry.js +401 -0
  119. package/dist/esm/limebb-live-docs-info.entry.js +2 -2
  120. package/dist/esm/limebb-locale-picker.entry.js +9 -494
  121. package/dist/esm/limebb-mention-group-counter.entry.js +2 -2
  122. package/dist/esm/limebb-navigation-button_2.entry.js +3 -3
  123. package/dist/esm/limebb-notification-item.entry.js +1 -1
  124. package/dist/esm/limebb-percentage-visualizer.entry.js +2 -2
  125. package/dist/esm/limebb-property-selector.entry.js +230 -0
  126. package/dist/esm/limebb-response-format-item.entry.js +76 -0
  127. package/dist/esm/limebb-text-editor.entry.js +7 -48
  128. package/dist/esm/limebb-trend-indicator.entry.js +1 -1
  129. package/dist/esm/limetype-6e7552a7.js +85 -0
  130. package/dist/esm/loader.js +1 -1
  131. package/dist/esm/property-resolution-fde2375e.js +63 -0
  132. package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
  133. package/dist/lime-crm-building-blocks/{p-88c64360.entry.js → p-00da9b24.entry.js} +1 -1
  134. package/dist/lime-crm-building-blocks/p-02c0cc04.entry.js +1 -0
  135. package/dist/lime-crm-building-blocks/p-0957b2a6.entry.js +1 -0
  136. package/dist/lime-crm-building-blocks/p-123190c3.js +1 -0
  137. package/dist/lime-crm-building-blocks/p-244ee55b.entry.js +1 -0
  138. package/dist/lime-crm-building-blocks/p-35897ec3.js +1 -0
  139. package/dist/lime-crm-building-blocks/{p-85b7291c.entry.js → p-3932077b.entry.js} +1 -1
  140. package/dist/lime-crm-building-blocks/p-3b0a15ec.js +1 -0
  141. package/dist/lime-crm-building-blocks/p-5a6d2e7f.js +1 -0
  142. package/dist/lime-crm-building-blocks/p-60971d64.js +1 -0
  143. package/dist/lime-crm-building-blocks/p-6c1146ca.entry.js +1 -0
  144. package/dist/lime-crm-building-blocks/p-70a28b93.entry.js +1 -0
  145. package/dist/lime-crm-building-blocks/p-7e6fb4af.js +1 -0
  146. package/dist/lime-crm-building-blocks/{p-8664381a.entry.js → p-8c4eb49f.entry.js} +1 -1
  147. package/dist/lime-crm-building-blocks/p-96beaabc.entry.js +1 -0
  148. package/dist/lime-crm-building-blocks/p-a659d55a.js +1 -0
  149. package/dist/lime-crm-building-blocks/p-baf4e428.entry.js +1 -0
  150. package/dist/lime-crm-building-blocks/p-d298b34e.js +1 -0
  151. package/dist/lime-crm-building-blocks/{p-7c4bdc1b.entry.js → p-d89c44ad.entry.js} +1 -1
  152. package/dist/lime-crm-building-blocks/p-e0ab1554.js +1 -0
  153. package/dist/lime-crm-building-blocks/{p-8064cbfb.entry.js → p-e9d23ef7.entry.js} +1 -1
  154. package/dist/lime-crm-building-blocks/p-ef8a5266.entry.js +1 -0
  155. package/dist/lime-crm-building-blocks/{p-c9126885.entry.js → p-f52125a0.entry.js} +1 -1
  156. package/dist/lime-crm-building-blocks/p-f99c611d.entry.js +1 -0
  157. package/dist/lime-crm-building-blocks/p-fe2b91d9.js +1 -0
  158. package/dist/types/components/lime-query-builder/expressions/lime-query-filter-and.d.ts +56 -0
  159. package/dist/types/components/lime-query-builder/expressions/lime-query-filter-comparison.d.ts +64 -0
  160. package/dist/types/components/lime-query-builder/expressions/lime-query-filter-expression.d.ts +53 -0
  161. package/dist/types/components/lime-query-builder/expressions/lime-query-filter-not.d.ts +54 -0
  162. package/dist/types/components/lime-query-builder/expressions/lime-query-filter-or.d.ts +55 -0
  163. package/dist/types/components/lime-query-builder/expressions/lime-query-value-input.d.ts +92 -0
  164. package/dist/types/components/lime-query-builder/filter-conversion.d.ts +18 -0
  165. package/dist/types/components/lime-query-builder/lime-query-builder.d.ts +40 -7
  166. package/dist/types/components/lime-query-builder/limetype-field/limetype-field.d.ts +96 -0
  167. package/dist/types/components/lime-query-builder/property-selection-format.d.ts +23 -0
  168. package/dist/types/components/lime-query-builder/property-selector/property-selector.d.ts +71 -0
  169. package/dist/types/components/lime-query-builder/response-format-editor.d.ts +57 -0
  170. package/dist/types/components/lime-query-builder/response-format-item.d.ts +46 -0
  171. package/dist/types/components.d.ts +1587 -114
  172. package/package.json +1 -1
  173. package/dist/lime-crm-building-blocks/p-00e7e0d4.entry.js +0 -1
  174. package/dist/lime-crm-building-blocks/p-11ac105b.entry.js +0 -1
  175. package/dist/lime-crm-building-blocks/p-5abe3fff.entry.js +0 -1
  176. package/dist/lime-crm-building-blocks/p-8044ffbd.js +0 -1
  177. package/dist/lime-crm-building-blocks/p-92ec9205.entry.js +0 -1
  178. package/dist/lime-crm-building-blocks/p-bcc23575.js +0 -1
  179. package/dist/lime-crm-building-blocks/p-c40a3f4b.js +0 -1
@@ -10,22 +10,32 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
10
10
  };
11
11
  import { h } from "@stencil/core";
12
12
  import { SelectLimeTypes as Limetypes, } from "@limetech/lime-web-components";
13
+ import { guiFilterToLimeQuery, limeQueryToGuiFilter, normalizeLimeQueryFilterForGui, } from "./filter-conversion";
13
14
  import { isLimeQuerySupported, } from "./lime-query-validation";
14
15
  /**
15
16
  * Lime Query Builder Component
16
17
  *
17
- * A code editor for constructing Lime Query DSL queries in JSON format.
18
+ * A comprehensive query builder for constructing Lime Query DSL queries.
19
+ * This is the main component that combines limetype selection with the filter builder.
18
20
  *
19
21
  * Features:
20
- * - **JSON code editor**: Write queries using the Lime Query DSL
21
- * - **Syntax validation**: Real-time validation of query structure
22
- * - **Feature flag support**: GUI mode placeholder (not yet implemented)
22
+ * - **Limetype selection**: Choose which object type to query
23
+ * - **Filter builder**: Build complex filters with AND/OR/NOT logic
24
+ * - **Property path selection**: Navigate through relations
25
+ * - **Type-aware inputs**: Automatic input types based on property type
26
+ * - **Response format**: Select which properties to return
27
+ * - **Query options**: Configure limit and other query parameters
28
+ * - **Placeholder support**: Use `%activeObject%` placeholders in filter values
29
+ * - **Real-time output**: See the Lime Query JSON as you build
23
30
  *
24
- * The component allows editing of complete `LimeQuery` objects that can be sent
31
+ * The component produces a complete `LimeQuery` object that can be sent
25
32
  * directly to the Lime CRM backend.
26
33
  *
27
- * When the feature flag `useLimeQueryBuilderGuiMode` is enabled, a mode toggle
28
- * becomes available, but GUI mode currently shows a placeholder message.
34
+ * **Active Object Placeholders**:
35
+ * When the `activeLimetype` prop is provided, the component enables validation
36
+ * and UI support for `%activeObject%` placeholders in filter expressions.
37
+ * These placeholders reference properties of a contextual "active object"
38
+ * (e.g., `%activeObject%.company` references the company of the active object).
29
39
  *
30
40
  * @exampleComponent limebb-example-lime-query-builder-basic
31
41
  * @private
@@ -34,10 +44,76 @@ export class LimeQueryBuilder {
34
44
  constructor() {
35
45
  this.mode = 'gui';
36
46
  this.codeValue = '';
47
+ this.limetype = '';
48
+ this.filter = {
49
+ filter_type: 'AND',
50
+ expressions: [],
51
+ };
52
+ this.handleLimetypeChange = (event) => {
53
+ event.stopPropagation();
54
+ this.limetype = event.detail;
55
+ // Reset filter when limetype changes
56
+ this.filter = {
57
+ filter_type: 'AND',
58
+ expressions: [],
59
+ };
60
+ // Reset response format when limetype changes
61
+ this.internalResponseFormat = {
62
+ object: {
63
+ _id: null,
64
+ },
65
+ };
66
+ this.emitChange();
67
+ };
68
+ this.handleFilterChange = (event) => {
69
+ event.stopPropagation();
70
+ // Convert missing expression back to empty AND to keep the UI consistent
71
+ if (event.detail.filter_type === '') {
72
+ this.filter = {
73
+ filter_type: 'AND',
74
+ expressions: [],
75
+ };
76
+ }
77
+ else {
78
+ this.filter = event.detail;
79
+ }
80
+ this.emitChange();
81
+ };
82
+ this.handleResponseFormatChange = (event) => {
83
+ event.stopPropagation();
84
+ this.internalResponseFormat = event.detail;
85
+ this.emitChange();
86
+ };
87
+ this.handleLimitChange = (event) => {
88
+ event.stopPropagation();
89
+ const value = event.detail;
90
+ this.limit = value ? Number.parseInt(value, 10) : undefined;
91
+ this.emitChange();
92
+ };
37
93
  this.switchToGui = () => {
38
- this.mode = 'gui';
94
+ // Validate JSON before switching
95
+ try {
96
+ const parsed = JSON.parse(this.codeValue);
97
+ // Check if it's supported in GUI
98
+ const support = this.checkGuiSupport();
99
+ if (!support.guiSupported) {
100
+ // Don't switch if GUI can't render this query
101
+ return;
102
+ }
103
+ // Update internal state from parsed query
104
+ this.limetype = parsed.limetype || '';
105
+ this.filter = normalizeLimeQueryFilterForGui(limeQueryToGuiFilter(parsed.filter));
106
+ this.internalResponseFormat = parsed.responseFormat;
107
+ this.limit = parsed.limit;
108
+ this.mode = 'gui';
109
+ this.change.emit(parsed);
110
+ }
111
+ catch (_a) {
112
+ // Don't switch if JSON is invalid (linter will show the error)
113
+ }
39
114
  };
40
115
  this.switchToCode = () => {
116
+ this.updateCodeValue();
41
117
  this.mode = 'code';
42
118
  };
43
119
  this.handleCodeChange = (event) => {
@@ -58,43 +134,130 @@ export class LimeQueryBuilder {
58
134
  return ((_c = (_b = (_a = this.platform) === null || _a === void 0 ? void 0 : _a.isFeatureEnabled) === null || _b === void 0 ? void 0 : _b.call(_a, 'useLimeQueryBuilderGuiMode')) !== null && _c !== void 0 ? _c : false);
59
135
  }
60
136
  componentWillLoad() {
61
- // Initialize code value from input prop
62
- this.codeValue = JSON.stringify(this.value || {}, null, 2);
63
137
  // Force code mode if GUI is disabled
64
138
  if (!this.guiModeEnabled) {
65
139
  this.mode = 'code';
140
+ // Initialize code value from prop
141
+ this.updateCodeValue();
142
+ return;
143
+ }
144
+ if (this.value) {
145
+ this.limetype = this.value.limetype || '';
146
+ this.filter = normalizeLimeQueryFilterForGui(limeQueryToGuiFilter(this.value.filter));
147
+ this.internalResponseFormat = this.value.responseFormat;
148
+ this.limit = this.value.limit;
149
+ }
150
+ // Initialize code value from prop
151
+ this.updateCodeValue();
152
+ // Check if GUI mode is supported
153
+ const support = this.checkGuiSupport();
154
+ if (!support.guiSupported) {
155
+ this.mode = 'code';
66
156
  }
67
157
  }
68
158
  render() {
69
159
  const guiSupported = this.checkGuiSupport();
70
- return (h("div", { key: '77e93d0277a99b8ff1c777d7ee0b63259755f740', class: "lime-query-builder" }, this.label && (h("h3", { key: '4089d69ea3404c656f1c24ec73aef6df2cc8baec', class: "lime-query-builder-label" }, this.label)), this.guiModeEnabled && (h("div", { key: '5d18a749386651cc1361b712693bad105dba9b03', class: "mode-controls" }, this.renderModeSwitch(guiSupported))), !this.guiModeEnabled || this.mode === 'code' ? (h("div", { class: "code-mode" }, this.renderCodeEditor(guiSupported))) : (h("div", { class: "gui-mode" }, h("div", { class: "placeholder-message" }, h("h4", null, "GUI Mode Not Yet Supported"), h("p", null, "The visual query builder interface is not yet available. Please use Code mode to write queries in JSON format."))))));
160
+ const showCodeMode = !this.guiModeEnabled || this.mode === 'code';
161
+ return (h("div", { key: '96d1a933f699404c3806af3742e9ad30d53562aa', class: "lime-query-builder" }, this.renderLabel(), this.renderModeControls(guiSupported), showCodeMode
162
+ ? this.renderCodeMode(guiSupported)
163
+ : this.renderGuiMode()));
164
+ }
165
+ emitChange() {
166
+ // Only emit in GUI mode
167
+ if (this.mode === 'code') {
168
+ return;
169
+ }
170
+ if (!this.limetype) {
171
+ return;
172
+ }
173
+ // Use internal state, then default to returning just _id
174
+ const responseFormat = this.internalResponseFormat || {
175
+ object: {
176
+ _id: null,
177
+ },
178
+ };
179
+ const limeQuery = {
180
+ limetype: this.limetype,
181
+ responseFormat: responseFormat,
182
+ filter: guiFilterToLimeQuery(this.filter),
183
+ };
184
+ if (this.limit !== undefined && this.limit > 0) {
185
+ limeQuery.limit = this.limit;
186
+ }
187
+ this.change.emit(limeQuery);
188
+ }
189
+ updateCodeValue() {
190
+ if (!this.limetype) {
191
+ this.codeValue = JSON.stringify(this.value || {}, null, 2);
192
+ return;
193
+ }
194
+ // Use internal state, then default to returning just _id
195
+ const responseFormat = this.internalResponseFormat || {
196
+ object: {
197
+ _id: null,
198
+ },
199
+ };
200
+ const limeQuery = {
201
+ limetype: this.limetype,
202
+ responseFormat: responseFormat,
203
+ filter: guiFilterToLimeQuery(this.filter),
204
+ };
205
+ if (this.limit !== undefined && this.limit > 0) {
206
+ limeQuery.limit = this.limit;
207
+ }
208
+ this.codeValue = JSON.stringify(limeQuery, null, 2);
71
209
  }
72
210
  checkGuiSupport() {
73
- if (!this.limetypes || !this.codeValue) {
211
+ if (!this.limetypes) {
74
212
  // Can't validate yet, assume all is good
75
213
  return {
76
214
  valid: true,
77
- guiSupported: false,
215
+ guiSupported: true,
78
216
  validationErrors: [],
79
217
  guiLimitations: [],
80
218
  };
81
219
  }
82
- // Parse and validate the code value
83
- let limeQueryToCheck;
84
- try {
85
- limeQueryToCheck = JSON.parse(this.codeValue);
220
+ // When in code mode, validate the parsed code value instead of current state
221
+ let queryToCheck;
222
+ if (this.mode === 'code' && this.codeValue) {
223
+ try {
224
+ queryToCheck = JSON.parse(this.codeValue);
225
+ }
226
+ catch (_a) {
227
+ return {
228
+ valid: false,
229
+ guiSupported: false,
230
+ validationErrors: ['Invalid JSON'],
231
+ guiLimitations: [],
232
+ };
233
+ }
86
234
  }
87
- catch (_a) {
88
- return {
89
- valid: false,
90
- guiSupported: false,
91
- validationErrors: ['Invalid JSON'],
92
- guiLimitations: [],
235
+ else {
236
+ // Build query from current GUI state
237
+ if (!this.limetype) {
238
+ return {
239
+ valid: true,
240
+ guiSupported: true,
241
+ validationErrors: [],
242
+ guiLimitations: [],
243
+ };
244
+ }
245
+ const responseFormat = this
246
+ .internalResponseFormat || {
247
+ object: {
248
+ _id: null,
249
+ },
250
+ };
251
+ queryToCheck = {
252
+ limetype: this.limetype,
253
+ responseFormat: responseFormat,
254
+ filter: guiFilterToLimeQuery(this.filter),
93
255
  };
256
+ if (this.limit !== undefined && this.limit > 0) {
257
+ queryToCheck.limit = this.limit;
258
+ }
94
259
  }
95
- // In code-only mode, we don't track activeLimetype separately
96
- // Pass undefined since it's not needed for code mode validation
97
- return isLimeQuerySupported(limeQueryToCheck, this.limetypes, undefined, this.guiModeEnabled);
260
+ return isLimeQuerySupported(queryToCheck, this.limetypes, this.activeLimetype, this.guiModeEnabled);
98
261
  }
99
262
  renderModeSwitch(support) {
100
263
  const guiDisabled = !support.guiSupported;
@@ -107,6 +270,46 @@ export class LimeQueryBuilder {
107
270
  !guiSupported.guiSupported &&
108
271
  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))))))));
109
272
  }
273
+ renderLimetypeSection() {
274
+ 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 })));
275
+ }
276
+ renderResponseFormatSection() {
277
+ if (!this.limetype) {
278
+ return;
279
+ }
280
+ return (h("div", { class: "response-format-section" }, h("limebb-response-format-editor", { platform: this.platform, context: this.context, limetype: this.limetype, value: this.internalResponseFormat, onChange: this.handleResponseFormatChange })));
281
+ }
282
+ renderFilterSection() {
283
+ if (!this.limetype) {
284
+ return;
285
+ }
286
+ return (h("div", { class: "filter-section" }, h("h4", { class: "section-label" }, "Filter Conditions"), h("limebb-lime-query-filter-expression", { platform: this.platform, context: this.context, limetype: this.limetype, activeLimetype: this.activeLimetype, expression: this.filter, onExpressionChange: this.handleFilterChange })));
287
+ }
288
+ renderQueryOptionsSection() {
289
+ var _a;
290
+ if (!this.limetype) {
291
+ return;
292
+ }
293
+ return (h("div", { class: "query-options-section" }, h("h4", { class: "section-label" }, "Query Options"), h("div", { class: "query-options-controls" }, h("limel-input-field", { label: "Limit", type: "number", value: ((_a = this.limit) === null || _a === void 0 ? void 0 : _a.toString()) || '', placeholder: "No limit", helperText: "Maximum number of results", onChange: this.handleLimitChange }))));
294
+ }
295
+ renderGuiMode() {
296
+ return (h("div", { class: "gui-mode" }, this.renderLimetypeSection(), this.renderResponseFormatSection(), this.renderFilterSection(), this.renderQueryOptionsSection()));
297
+ }
298
+ renderLabel() {
299
+ if (!this.label) {
300
+ return;
301
+ }
302
+ return h("h3", { class: "lime-query-builder-label" }, this.label);
303
+ }
304
+ renderModeControls(support) {
305
+ if (!this.guiModeEnabled) {
306
+ return;
307
+ }
308
+ return (h("div", { class: "mode-controls" }, this.renderModeSwitch(support)));
309
+ }
310
+ renderCodeMode(support) {
311
+ return h("div", { class: "code-mode" }, this.renderCodeEditor(support));
312
+ }
110
313
  static get is() { return "limebb-lime-query-builder"; }
111
314
  static get encapsulation() { return "shadow"; }
112
315
  static get originalStyleUrls() {
@@ -208,6 +411,25 @@ export class LimeQueryBuilder {
208
411
  "setter": false,
209
412
  "attribute": "label",
210
413
  "reflect": false
414
+ },
415
+ "activeLimetype": {
416
+ "type": "string",
417
+ "mutable": false,
418
+ "complexType": {
419
+ "original": "string",
420
+ "resolved": "string | undefined",
421
+ "references": {}
422
+ },
423
+ "required": false,
424
+ "optional": true,
425
+ "docs": {
426
+ "tags": [],
427
+ "text": "The limetype of the active object (for %activeObject% placeholder validation).\nWhen provided, enables placeholder validation and the placeholder input mode.\nWhen omitted, placeholders are accepted without validation."
428
+ },
429
+ "getter": false,
430
+ "setter": false,
431
+ "attribute": "active-limetype",
432
+ "reflect": false
211
433
  }
212
434
  };
213
435
  }
@@ -215,7 +437,11 @@ export class LimeQueryBuilder {
215
437
  return {
216
438
  "limetypes": {},
217
439
  "mode": {},
218
- "codeValue": {}
440
+ "codeValue": {},
441
+ "limetype": {},
442
+ "filter": {},
443
+ "internalResponseFormat": {},
444
+ "limit": {}
219
445
  };
220
446
  }
221
447
  static get events() {