@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
@@ -0,0 +1,457 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
4
+ r = Reflect.decorate(decorators, target, key, desc);
5
+ else
6
+ for (var i = decorators.length - 1; i >= 0; i--)
7
+ if (d = decorators[i])
8
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
10
+ };
11
+ import { h } from "@stencil/core";
12
+ import { SelectLimeTypes as Limetypes, } from "@limetech/lime-web-components";
13
+ import { getPropertyFromPath } from "../property-resolution";
14
+ /**
15
+ * Query Value Input Component
16
+ *
17
+ * Renders an appropriate input control based on the property type and operator.
18
+ * This component automatically adapts its UI to match the data type of the selected
19
+ * property, providing a better user experience and data validation.
20
+ *
21
+ * Supported input types:
22
+ * - **String/Text**: Standard text input field
23
+ * - **Integer/Decimal**: Number input with appropriate step values
24
+ * - **Date**: Date picker returning ISO date strings
25
+ * - **Time**: Time input field
26
+ * - **Boolean (yesno)**: True/False dropdown
27
+ * - **Option**: Dropdown populated with valid options from property definition
28
+ * - **IN operator**: Comma-separated input for multiple values (any type)
29
+ * - **Placeholder mode**: Select properties from active object using %activeObject%
30
+ *
31
+ * The component handles type conversions automatically:
32
+ * - Numbers are parsed from string inputs
33
+ * - Dates are converted to/from ISO strings
34
+ * - Booleans are converted to/from strings for dropdown compatibility
35
+ *
36
+ * @private
37
+ */
38
+ export class LimeQueryValueInput {
39
+ constructor() {
40
+ /**
41
+ * Optional label for the input
42
+ */
43
+ this.label = 'Value';
44
+ this.inputMode = 'value';
45
+ this.handleTextChange = (event) => {
46
+ event.stopPropagation();
47
+ // Try to parse as number for number inputs
48
+ const value = event.detail;
49
+ const numValue = Number(value);
50
+ if (!Number.isNaN(numValue) && value !== '') {
51
+ this.change.emit(numValue);
52
+ }
53
+ else {
54
+ this.change.emit(value);
55
+ }
56
+ };
57
+ this.handleSelectChange = (event) => {
58
+ event.stopPropagation();
59
+ const detail = event.detail;
60
+ if (Array.isArray(detail)) {
61
+ this.change.emit(detail.map((o) => o.value));
62
+ }
63
+ else {
64
+ this.change.emit(detail === null || detail === void 0 ? void 0 : detail.value);
65
+ }
66
+ };
67
+ this.handleBooleanChange = (event) => {
68
+ event.stopPropagation();
69
+ const detail = event.detail;
70
+ if (!Array.isArray(detail)) {
71
+ // Convert string back to boolean
72
+ this.change.emit((detail === null || detail === void 0 ? void 0 : detail.value) === 'true');
73
+ }
74
+ };
75
+ this.handleDateChange = (event) => {
76
+ event.stopPropagation();
77
+ // Convert Date to ISO string for storage
78
+ const date = event.detail;
79
+ this.change.emit(date ? date.toISOString() : null);
80
+ };
81
+ this.handleMultiValueChange = (event) => {
82
+ event.stopPropagation();
83
+ // Split by comma and trim whitespace
84
+ const values = event.detail
85
+ .split(',')
86
+ .map((v) => v.trim())
87
+ .filter((v) => v.length > 0);
88
+ this.change.emit(values);
89
+ };
90
+ this.handleModeToggle = () => {
91
+ if (this.inputMode === 'value') {
92
+ // Switching to placeholder mode
93
+ this.inputMode = 'placeholder';
94
+ // Emit placeholder value (empty initially)
95
+ this.change.emit('%activeObject%');
96
+ }
97
+ else {
98
+ // Switching to value mode
99
+ this.inputMode = 'value';
100
+ // Emit empty value
101
+ this.change.emit('');
102
+ }
103
+ };
104
+ this.handlePlaceholderPropertyChange = (event) => {
105
+ event.stopPropagation();
106
+ const propertyPath = event.detail;
107
+ const placeholderValue = this.buildPlaceholderValue(propertyPath);
108
+ this.change.emit(placeholderValue);
109
+ };
110
+ }
111
+ componentWillLoad() {
112
+ // Detect if the current value is a placeholder
113
+ if (this.isPlaceholder(this.value)) {
114
+ this.inputMode = 'placeholder';
115
+ }
116
+ }
117
+ componentWillUpdate() {
118
+ // Update mode if value changes externally
119
+ if (this.isPlaceholder(this.value) &&
120
+ this.inputMode !== 'placeholder') {
121
+ this.inputMode = 'placeholder';
122
+ }
123
+ else if (!this.isPlaceholder(this.value) &&
124
+ this.inputMode === 'placeholder') {
125
+ this.inputMode = 'value';
126
+ }
127
+ }
128
+ isPlaceholder(value) {
129
+ return typeof value === 'string' && value.startsWith('%activeObject%');
130
+ }
131
+ parsePlaceholderPath(value) {
132
+ if (!this.isPlaceholder(value)) {
133
+ return '';
134
+ }
135
+ // Extract path after %activeObject%. (e.g., "%activeObject%.company.name" → "company.name")
136
+ return value.replace(/^%activeObject%\.?/, '');
137
+ }
138
+ buildPlaceholderValue(propertyPath) {
139
+ if (!propertyPath) {
140
+ return '%activeObject%';
141
+ }
142
+ return `%activeObject%.${propertyPath}`;
143
+ }
144
+ render() {
145
+ if (!this.operator) {
146
+ return null;
147
+ }
148
+ return (h("div", { class: "value-input-container" }, this.renderModeToggle(), this.inputMode === 'placeholder'
149
+ ? this.renderPlaceholderInput()
150
+ : this.renderValueInputByType()));
151
+ }
152
+ renderModeToggle() {
153
+ // Only show toggle if activeLimetype is set
154
+ if (!this.activeLimetype) {
155
+ return null;
156
+ }
157
+ const isPlaceholderMode = this.inputMode === 'placeholder';
158
+ const buttonLabel = isPlaceholderMode ? 'Use Value' : 'Use Placeholder';
159
+ const buttonIcon = isPlaceholderMode ? 'text' : 'link';
160
+ return (h("limel-icon-button", { class: "mode-toggle", icon: buttonIcon, label: buttonLabel, onClick: this.handleModeToggle }));
161
+ }
162
+ renderPlaceholderInput() {
163
+ const propertyPath = this.parsePlaceholderPath(this.value);
164
+ return (h("div", { class: "placeholder-input" }, h("limebb-property-selector", { platform: this.platform, context: this.context, limetype: this.activeLimetype, label: "Active Object Property", value: propertyPath, required: false, helperText: "Select property from the active object", onChange: this.handlePlaceholderPropertyChange }), this.isPlaceholder(this.value) && (h("div", { class: "placeholder-preview" }, h("limel-icon", { name: "info", size: "small" }), h("span", null, "Placeholder: ", this.value)))));
165
+ }
166
+ renderValueInputByType() {
167
+ // Special handling for IN operator - always use chip set for arrays
168
+ if (this.operator === 'IN') {
169
+ return this.renderMultiValueInput();
170
+ }
171
+ const property = this.getProperty();
172
+ if (!property) {
173
+ return this.renderTextInput();
174
+ }
175
+ switch (property.type) {
176
+ case 'integer':
177
+ case 'decimal': {
178
+ return this.renderNumberInput(property.type);
179
+ }
180
+ case 'yesno': {
181
+ return this.renderBooleanInput();
182
+ }
183
+ case 'option': {
184
+ return this.renderOptionInput(property);
185
+ }
186
+ case 'date': {
187
+ return this.renderDateInput();
188
+ }
189
+ case 'time': {
190
+ return this.renderTimeInput();
191
+ }
192
+ default: {
193
+ return this.renderTextInput();
194
+ }
195
+ }
196
+ }
197
+ renderTextInput() {
198
+ var _a;
199
+ return (h("limel-input-field", { label: this.label, value: ((_a = this.value) === null || _a === void 0 ? void 0 : _a.toString()) || '', placeholder: "Enter value", onChange: this.handleTextChange }));
200
+ }
201
+ renderNumberInput(type) {
202
+ var _a;
203
+ const step = type === 'integer' ? 1 : 0.01;
204
+ return (h("limel-input-field", { label: this.label, type: "number", value: ((_a = this.value) === null || _a === void 0 ? void 0 : _a.toString()) || '', step: step, onChange: this.handleTextChange }));
205
+ }
206
+ renderBooleanInput() {
207
+ const options = [
208
+ { text: 'True', value: 'true' },
209
+ { text: 'False', value: 'false' },
210
+ ];
211
+ const valueAsString = this.value === true || this.value === 'true' ? 'true' : 'false';
212
+ const selectedOption = options.find((o) => o.value === valueAsString);
213
+ return (h("limel-select", { label: this.label, options: options, value: selectedOption, onChange: this.handleBooleanChange }));
214
+ }
215
+ renderOptionInput(property) {
216
+ if (!property.options || property.options.length === 0) {
217
+ return this.renderTextInput();
218
+ }
219
+ const options = property.options.map((opt) => ({
220
+ text: opt.text || opt.key,
221
+ value: opt.key,
222
+ }));
223
+ const selectedOption = options.find((o) => o.value === this.value);
224
+ return (h("limel-select", { label: this.label, options: options, value: selectedOption, onChange: this.handleSelectChange }));
225
+ }
226
+ renderDateInput() {
227
+ // Convert string to Date if needed
228
+ const dateValue = typeof this.value === 'string' ? new Date(this.value) : this.value;
229
+ return (h("limel-date-picker", { label: this.label, value: dateValue, onChange: this.handleDateChange }));
230
+ }
231
+ renderTimeInput() {
232
+ return (h("limel-input-field", { label: this.label, type: "time", value: this.value || '', onChange: this.handleTextChange }));
233
+ }
234
+ renderMultiValueInput() {
235
+ // For IN operator, allow comma-separated values
236
+ const displayValue = Array.isArray(this.value)
237
+ ? this.value.join(', ')
238
+ : this.value || '';
239
+ return (h("limel-input-field", { label: this.label + ' (comma-separated)', value: displayValue, placeholder: "e.g., won, lost, tender", onChange: this.handleMultiValueChange }));
240
+ }
241
+ getProperty() {
242
+ if (!this.limetypes || !this.limetype || !this.propertyPath) {
243
+ return;
244
+ }
245
+ return getPropertyFromPath(this.limetypes, this.limetype, this.propertyPath);
246
+ }
247
+ static get is() { return "limebb-lime-query-value-input"; }
248
+ static get encapsulation() { return "shadow"; }
249
+ static get originalStyleUrls() {
250
+ return {
251
+ "$": ["lime-query-value-input.scss"]
252
+ };
253
+ }
254
+ static get styleUrls() {
255
+ return {
256
+ "$": ["lime-query-value-input.css"]
257
+ };
258
+ }
259
+ static get properties() {
260
+ return {
261
+ "platform": {
262
+ "type": "unknown",
263
+ "mutable": false,
264
+ "complexType": {
265
+ "original": "LimeWebComponentPlatform",
266
+ "resolved": "LimeWebComponentPlatform",
267
+ "references": {
268
+ "LimeWebComponentPlatform": {
269
+ "location": "import",
270
+ "path": "@limetech/lime-web-components",
271
+ "id": "node_modules::LimeWebComponentPlatform"
272
+ }
273
+ }
274
+ },
275
+ "required": false,
276
+ "optional": false,
277
+ "docs": {
278
+ "tags": [],
279
+ "text": "Platform service provider"
280
+ },
281
+ "getter": false,
282
+ "setter": false
283
+ },
284
+ "context": {
285
+ "type": "unknown",
286
+ "mutable": false,
287
+ "complexType": {
288
+ "original": "LimeWebComponentContext",
289
+ "resolved": "LimeWebComponentContext",
290
+ "references": {
291
+ "LimeWebComponentContext": {
292
+ "location": "import",
293
+ "path": "@limetech/lime-web-components",
294
+ "id": "node_modules::LimeWebComponentContext"
295
+ }
296
+ }
297
+ },
298
+ "required": false,
299
+ "optional": false,
300
+ "docs": {
301
+ "tags": [],
302
+ "text": "Component context"
303
+ },
304
+ "getter": false,
305
+ "setter": false
306
+ },
307
+ "limetype": {
308
+ "type": "string",
309
+ "mutable": false,
310
+ "complexType": {
311
+ "original": "string",
312
+ "resolved": "string",
313
+ "references": {}
314
+ },
315
+ "required": false,
316
+ "optional": false,
317
+ "docs": {
318
+ "tags": [],
319
+ "text": "The limetype being queried"
320
+ },
321
+ "getter": false,
322
+ "setter": false,
323
+ "attribute": "limetype",
324
+ "reflect": false
325
+ },
326
+ "activeLimetype": {
327
+ "type": "string",
328
+ "mutable": false,
329
+ "complexType": {
330
+ "original": "string",
331
+ "resolved": "string | undefined",
332
+ "references": {}
333
+ },
334
+ "required": false,
335
+ "optional": true,
336
+ "docs": {
337
+ "tags": [],
338
+ "text": "The limetype of the active object (for %activeObject% placeholders)"
339
+ },
340
+ "getter": false,
341
+ "setter": false,
342
+ "attribute": "active-limetype",
343
+ "reflect": false
344
+ },
345
+ "propertyPath": {
346
+ "type": "string",
347
+ "mutable": false,
348
+ "complexType": {
349
+ "original": "string",
350
+ "resolved": "string",
351
+ "references": {}
352
+ },
353
+ "required": false,
354
+ "optional": false,
355
+ "docs": {
356
+ "tags": [],
357
+ "text": "The property path (e.g., \"dealstatus\", \"company.name\")"
358
+ },
359
+ "getter": false,
360
+ "setter": false,
361
+ "attribute": "property-path",
362
+ "reflect": false
363
+ },
364
+ "operator": {
365
+ "type": "string",
366
+ "mutable": false,
367
+ "complexType": {
368
+ "original": "FilterOperator",
369
+ "resolved": "\"!=\" | \"<\" | \"<=\" | \"=\" | \"=$\" | \"=?\" | \">\" | \">=\" | \"?\" | \"IN\"",
370
+ "references": {
371
+ "FilterOperator": {
372
+ "location": "import",
373
+ "path": "../lime-query.types",
374
+ "id": "src/components/lime-query-builder/lime-query.types.ts::FilterOperator"
375
+ }
376
+ }
377
+ },
378
+ "required": false,
379
+ "optional": false,
380
+ "docs": {
381
+ "tags": [],
382
+ "text": "The operator being used"
383
+ },
384
+ "getter": false,
385
+ "setter": false,
386
+ "attribute": "operator",
387
+ "reflect": false
388
+ },
389
+ "value": {
390
+ "type": "any",
391
+ "mutable": false,
392
+ "complexType": {
393
+ "original": "any",
394
+ "resolved": "any",
395
+ "references": {}
396
+ },
397
+ "required": false,
398
+ "optional": false,
399
+ "docs": {
400
+ "tags": [],
401
+ "text": "The current value"
402
+ },
403
+ "getter": false,
404
+ "setter": false,
405
+ "attribute": "value",
406
+ "reflect": false
407
+ },
408
+ "label": {
409
+ "type": "string",
410
+ "mutable": false,
411
+ "complexType": {
412
+ "original": "string",
413
+ "resolved": "string",
414
+ "references": {}
415
+ },
416
+ "required": false,
417
+ "optional": false,
418
+ "docs": {
419
+ "tags": [],
420
+ "text": "Optional label for the input"
421
+ },
422
+ "getter": false,
423
+ "setter": false,
424
+ "attribute": "label",
425
+ "reflect": false,
426
+ "defaultValue": "'Value'"
427
+ }
428
+ };
429
+ }
430
+ static get states() {
431
+ return {
432
+ "limetypes": {},
433
+ "inputMode": {}
434
+ };
435
+ }
436
+ static get events() {
437
+ return [{
438
+ "method": "change",
439
+ "name": "change",
440
+ "bubbles": true,
441
+ "cancelable": true,
442
+ "composed": true,
443
+ "docs": {
444
+ "tags": [],
445
+ "text": "Emitted when the value changes"
446
+ },
447
+ "complexType": {
448
+ "original": "any",
449
+ "resolved": "any",
450
+ "references": {}
451
+ }
452
+ }];
453
+ }
454
+ }
455
+ __decorate([
456
+ Limetypes()
457
+ ], LimeQueryValueInput.prototype, "limetypes", void 0);
@@ -55,27 +55,6 @@ export function guiFilterToLimeQuery(filter) {
55
55
  }
56
56
  return undefined;
57
57
  }
58
- /**
59
- * Convert Lime Query filter to UI filter representation
60
- * Throws errors for unsupported filter structures
61
- * @param filter
62
- */
63
- export function limeQueryToGuiFilter(filter) {
64
- if (!filter) {
65
- // Return empty AND instead of missing expression
66
- // This ensures users see the "Add a condition" button
67
- return {
68
- filter_type: 'AND',
69
- expressions: [],
70
- };
71
- }
72
- // Check if it's a FilterExpression (has 'key' property)
73
- if ('key' in filter) {
74
- return validateAndConvertFilterExpression(filter);
75
- }
76
- // It's a FilterGroup
77
- return validateAndConvertFilterGroup(filter);
78
- }
79
58
  /**
80
59
  * Validate and convert a FilterExpression (comparison filter)
81
60
  * @param filter
@@ -156,3 +135,121 @@ function validateAndConvertFilterGroup(filter) {
156
135
  // If we reach here, the operator is unsupported
157
136
  throw new Error(`Unsupported filter operator: ${filter.op}`);
158
137
  }
138
+ /**
139
+ * Convert Lime Query filter to UI filter representation
140
+ * Throws errors for unsupported filter structures
141
+ * @param filter
142
+ */
143
+ export function limeQueryToGuiFilter(filter) {
144
+ if (!filter) {
145
+ // Return empty AND instead of missing expression
146
+ // This ensures users see the "Add a condition" button
147
+ return {
148
+ filter_type: 'AND',
149
+ expressions: [],
150
+ };
151
+ }
152
+ // Check if it's a FilterExpression (has 'key' property)
153
+ if ('key' in filter) {
154
+ return validateAndConvertFilterExpression(filter);
155
+ }
156
+ // It's a FilterGroup
157
+ return validateAndConvertFilterGroup(filter);
158
+ }
159
+ /**
160
+ * Normalize filter for GUI mode by ensuring proper AND/OR wrapper structure.
161
+ * GUI mode requires filters to be wrapped in AND([OR(...)]) so users have
162
+ * access to add/remove buttons on the AND and OR components.
163
+ *
164
+ * This function ensures that:
165
+ * - Single comparisons are wrapped in AND([OR([comparison])])
166
+ * - OR groups are wrapped in AND([OR group])
167
+ * - AND groups have their comparison children wrapped in OR
168
+ * - Empty/undefined filters become AND([])
169
+ *
170
+ * When converting back to Lime Query JSON, limeQueryFilterToLimeQuery()
171
+ * automatically unwraps single-item AND/OR groups.
172
+ *
173
+ * @param filter The filter expression from limeQueryToLimeQueryFilter
174
+ * @returns Normalized filter suitable for GUI editing
175
+ */
176
+ export function normalizeLimeQueryFilterForGui(filter) {
177
+ // Empty AND is already correct for GUI
178
+ if (filter.filter_type === 'AND' && filter.expressions.length === 0) {
179
+ return filter;
180
+ }
181
+ // Single comparison needs wrapping
182
+ if (filter.filter_type === 'comparison') {
183
+ return {
184
+ filter_type: 'AND',
185
+ expressions: [
186
+ {
187
+ filter_type: 'OR',
188
+ expressions: [filter],
189
+ },
190
+ ],
191
+ };
192
+ }
193
+ // OR needs wrapping in AND
194
+ if (filter.filter_type === 'OR') {
195
+ return {
196
+ filter_type: 'AND',
197
+ expressions: [filter],
198
+ };
199
+ }
200
+ // NOT needs wrapping
201
+ if (filter.filter_type === 'NOT') {
202
+ return {
203
+ filter_type: 'AND',
204
+ expressions: [
205
+ {
206
+ filter_type: 'OR',
207
+ expressions: [filter],
208
+ },
209
+ ],
210
+ };
211
+ }
212
+ // AND group - check if children need OR wrappers
213
+ if (filter.filter_type === 'AND') {
214
+ const normalizedChildren = filter.expressions.map((child) => {
215
+ // If child is already OR, keep it
216
+ if (child.filter_type === 'OR') {
217
+ return child;
218
+ }
219
+ // If child is NOT, keep it (NOT can be a direct child of AND)
220
+ if (child.filter_type === 'NOT') {
221
+ return child;
222
+ }
223
+ // If child is comparison, wrap in OR
224
+ if (child.filter_type === 'comparison') {
225
+ return {
226
+ filter_type: 'OR',
227
+ expressions: [child],
228
+ };
229
+ }
230
+ // If child is nested AND, recursively normalize and wrap in OR
231
+ if (child.filter_type === 'AND') {
232
+ return {
233
+ filter_type: 'OR',
234
+ expressions: [normalizeLimeQueryFilterForGui(child)],
235
+ };
236
+ }
237
+ // Unknown filter type, keep as is
238
+ return child;
239
+ });
240
+ return {
241
+ filter_type: 'AND',
242
+ expressions: normalizedChildren,
243
+ };
244
+ }
245
+ // Fallback: wrap in AND/OR structure
246
+ return {
247
+ filter_type: 'AND',
248
+ expressions: [
249
+ {
250
+ filter_type: 'OR',
251
+ expressions: [filter],
252
+ },
253
+ ],
254
+ };
255
+ }
@@ -1,4 +1,4 @@
1
- :host(limebb-lime-query-builder) {
1
+ :host(limebb-lime-lime-query-builder) {
2
2
  display: block;
3
3
  width: 100%;
4
4
  }
@@ -14,8 +14,6 @@
14
14
  align-items: center;
15
15
  gap: 0.5rem;
16
16
  padding: 0.5rem;
17
- background-color: rgb(var(--contrast-100));
18
- border-radius: var(--border-radius);
19
17
  }
20
18
 
21
19
  .mode-switch {
@@ -90,21 +88,36 @@
90
88
  color: rgb(var(--contrast-1100));
91
89
  }
92
90
 
93
- .placeholder-message {
94
- padding: 2rem;
95
- text-align: center;
96
- background-color: rgb(var(--contrast-100));
97
- border-radius: var(--border-radius);
98
- border: 1px solid rgb(var(--contrast-300));
99
- }
100
- .placeholder-message h4 {
101
- margin: 0 0 1rem 0;
91
+ .limetype-section {
92
+ display: flex;
93
+ flex-direction: column;
94
+ }
95
+
96
+ .filter-section,
97
+ .query-options-section {
98
+ display: flex;
99
+ flex-direction: column;
100
+ gap: 1rem;
101
+ }
102
+
103
+ .section-label {
104
+ margin: 0;
102
105
  font-size: 1.125rem;
103
106
  font-weight: 600;
104
- color: rgb(var(--contrast-1100));
107
+ color: rgb(var(--contrast-1000));
105
108
  }
106
- .placeholder-message p {
107
- margin: 0;
108
- color: rgb(var(--contrast-900));
109
- line-height: 1.5;
109
+
110
+ .query-options-controls {
111
+ display: grid;
112
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
113
+ gap: 1rem;
114
+ }
115
+
116
+ @media (max-width: 768px) {
117
+ .lime-query-builder {
118
+ gap: 1.5rem;
119
+ }
120
+ .query-options-controls {
121
+ grid-template-columns: 1fr;
122
+ }
110
123
  }