@limetech/lime-crm-building-blocks 1.95.0 → 1.97.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 (246) 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-document-item.cjs.entry.js +174 -0
  13. package/dist/cjs/limebb-document-picker.cjs.entry.js +82 -0
  14. package/dist/cjs/limebb-feed-item-thumbnail-file-info.cjs.entry.js +1 -1
  15. package/dist/cjs/limebb-feed-timeline-item.cjs.entry.js +1 -1
  16. package/dist/cjs/limebb-feed.cjs.entry.js +1 -1
  17. package/dist/cjs/limebb-icon-picker.cjs.entry.js +1 -1
  18. package/dist/cjs/limebb-info-tile-format.cjs.entry.js +1 -1
  19. package/dist/cjs/limebb-info-tile.cjs.entry.js +1 -1
  20. package/dist/cjs/limebb-kanban-group.cjs.entry.js +1 -1
  21. package/dist/cjs/limebb-kanban-item.cjs.entry.js +1 -1
  22. package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +382 -150
  23. package/dist/cjs/limebb-lime-query-filter-and_5.cjs.entry.js +278 -0
  24. package/dist/cjs/limebb-lime-query-value-input.cjs.entry.js +239 -0
  25. package/dist/cjs/limebb-limetype-field_2.cjs.entry.js +406 -0
  26. package/dist/cjs/limebb-live-docs-info.cjs.entry.js +2 -2
  27. package/dist/cjs/limebb-locale-picker.cjs.entry.js +13 -498
  28. package/dist/cjs/limebb-mention-group-counter.cjs.entry.js +2 -2
  29. package/dist/cjs/limebb-navigation-button_2.cjs.entry.js +3 -3
  30. package/dist/cjs/limebb-notification-item.cjs.entry.js +1 -1
  31. package/dist/cjs/limebb-percentage-visualizer.cjs.entry.js +2 -2
  32. package/dist/cjs/limebb-property-selector.cjs.entry.js +234 -0
  33. package/dist/cjs/limebb-response-format-item.cjs.entry.js +80 -0
  34. package/dist/cjs/limebb-text-editor.cjs.entry.js +22 -83
  35. package/dist/cjs/limebb-trend-indicator.cjs.entry.js +1 -1
  36. package/dist/cjs/limetype-1fe0207f.js +90 -0
  37. package/dist/cjs/loader.cjs.js +1 -1
  38. package/dist/cjs/property-resolution-fb42a46b.js +66 -0
  39. package/dist/cjs/random-string-aac0a74b.js +24 -0
  40. package/dist/collection/collection-manifest.json +12 -0
  41. package/dist/collection/components/document-picker/document-item/document-item.css +64 -0
  42. package/dist/collection/components/document-picker/document-item/document-item.js +265 -0
  43. package/dist/collection/components/document-picker/document-item/document-item.types.js +1 -0
  44. package/dist/collection/components/document-picker/document-picker.css +139 -0
  45. package/dist/collection/components/document-picker/document-picker.js +304 -0
  46. package/dist/collection/components/document-picker/document.types.js +1 -0
  47. package/dist/collection/components/feed/feed-item/feed-timeline-item.js +1 -1
  48. package/dist/collection/components/feed/feed-item-thumbnail-file-info/feed-item-thumbnail-file-info.js +1 -1
  49. package/dist/collection/components/feed/feed.js +1 -1
  50. package/dist/collection/components/icon-picker/icon-picker.js +1 -1
  51. package/dist/collection/components/info-tile/format/config/info-tile-format.js +1 -1
  52. package/dist/collection/components/info-tile/info-tile.js +1 -1
  53. package/dist/collection/components/kanban/kanban-group/kanban-group.js +1 -1
  54. package/dist/collection/components/kanban/kanban-item/kanban-item.js +1 -1
  55. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-and.css +121 -0
  56. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-and.js +257 -0
  57. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison.css +39 -0
  58. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison.js +246 -0
  59. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-expression.css +104 -0
  60. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-expression.js +220 -0
  61. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-not.css +107 -0
  62. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-not.js +212 -0
  63. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-or.css +123 -0
  64. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-or.js +237 -0
  65. package/dist/collection/components/lime-query-builder/expressions/lime-query-value-input.css +48 -0
  66. package/dist/collection/components/lime-query-builder/expressions/lime-query-value-input.js +457 -0
  67. package/dist/collection/components/lime-query-builder/filter-conversion.js +118 -21
  68. package/dist/collection/components/lime-query-builder/lime-query-builder.css +30 -17
  69. package/dist/collection/components/lime-query-builder/lime-query-builder.js +233 -28
  70. package/dist/collection/components/lime-query-builder/limetype-field/limetype-field.js +435 -0
  71. package/dist/collection/components/lime-query-builder/property-selection-format.js +158 -0
  72. package/dist/collection/components/lime-query-builder/property-selector/property-selector.css +8 -0
  73. package/dist/collection/components/lime-query-builder/property-selector/property-selector.js +422 -0
  74. package/dist/collection/components/lime-query-builder/response-format-editor.css +72 -0
  75. package/dist/collection/components/lime-query-builder/response-format-editor.js +249 -0
  76. package/dist/collection/components/lime-query-builder/response-format-item.css +61 -0
  77. package/dist/collection/components/lime-query-builder/response-format-item.js +208 -0
  78. package/dist/collection/components/limeobject/file-viewer/live-docs-info.js +2 -2
  79. package/dist/collection/components/locale-picker/locale-picker.js +1 -1
  80. package/dist/collection/components/notification-list/notification-item/notification-item.js +1 -1
  81. package/dist/collection/components/percentage-visualizer/percentage-visualizer.js +2 -2
  82. package/dist/collection/components/summary-popover/summary-popover.js +3 -3
  83. package/dist/collection/components/text-editor/mention-group-counter.js +2 -2
  84. package/dist/collection/components/text-editor/text-editor.js +1 -1
  85. package/dist/collection/components/trend-indicator/trend-indicator.js +1 -1
  86. package/dist/collection/util/format-bytes.js +36 -0
  87. package/dist/components/_MapCache.js +2 -27
  88. package/dist/components/_Uint8Array.js +2 -12
  89. package/dist/components/_baseIsEqual.js +494 -0
  90. package/dist/components/_defineProperty.js +13 -0
  91. package/dist/components/document-item.js +190 -0
  92. package/dist/components/feed-item-thumbnail-file-info.js +1 -1
  93. package/dist/components/feed-timeline-item.js +1 -1
  94. package/dist/components/get.js +2 -1
  95. package/dist/components/isEqual.js +35 -0
  96. package/dist/components/isSymbol.js +28 -0
  97. package/dist/components/kanban-group.js +1 -1
  98. package/dist/components/kanban-item.js +1 -1
  99. package/dist/components/lime-query-filter-and.js +408 -0
  100. package/dist/components/lime-query-filter-comparison.js +152 -0
  101. package/dist/components/lime-query-value-input.js +266 -0
  102. package/dist/components/limebb-document-item.d.ts +11 -0
  103. package/dist/components/limebb-document-item.js +6 -0
  104. package/dist/components/limebb-document-picker.d.ts +11 -0
  105. package/dist/components/limebb-document-picker.js +111 -0
  106. package/dist/components/limebb-feed.js +1 -1
  107. package/dist/components/limebb-icon-picker.js +1 -1
  108. package/dist/components/limebb-info-tile-format.js +1 -1
  109. package/dist/components/limebb-info-tile.js +1 -1
  110. package/dist/components/limebb-lime-query-builder.js +441 -149
  111. package/dist/components/limebb-lime-query-filter-and.d.ts +11 -0
  112. package/dist/components/limebb-lime-query-filter-and.js +6 -0
  113. package/dist/components/limebb-lime-query-filter-comparison.d.ts +11 -0
  114. package/dist/components/limebb-lime-query-filter-comparison.js +6 -0
  115. package/dist/components/limebb-lime-query-filter-expression.d.ts +11 -0
  116. package/dist/components/limebb-lime-query-filter-expression.js +6 -0
  117. package/dist/components/limebb-lime-query-filter-not.d.ts +11 -0
  118. package/dist/components/limebb-lime-query-filter-not.js +6 -0
  119. package/dist/components/limebb-lime-query-filter-or.d.ts +11 -0
  120. package/dist/components/limebb-lime-query-filter-or.js +6 -0
  121. package/dist/components/limebb-lime-query-value-input.d.ts +11 -0
  122. package/dist/components/limebb-lime-query-value-input.js +6 -0
  123. package/dist/components/limebb-limetype-field.d.ts +11 -0
  124. package/dist/components/limebb-limetype-field.js +6 -0
  125. package/dist/components/limebb-locale-picker.js +8 -493
  126. package/dist/components/limebb-mention-group-counter.js +2 -2
  127. package/dist/components/limebb-percentage-visualizer.js +2 -2
  128. package/dist/components/limebb-property-selector.d.ts +11 -0
  129. package/dist/components/limebb-property-selector.js +6 -0
  130. package/dist/components/limebb-response-format-editor.d.ts +11 -0
  131. package/dist/components/limebb-response-format-editor.js +6 -0
  132. package/dist/components/limebb-response-format-item.d.ts +11 -0
  133. package/dist/components/limebb-response-format-item.js +6 -0
  134. package/dist/components/limebb-text-editor.js +8 -69
  135. package/dist/components/limebb-trend-indicator.js +1 -1
  136. package/dist/components/limetype-field.js +184 -0
  137. package/dist/components/limetype.js +85 -0
  138. package/dist/components/live-docs-info.js +2 -2
  139. package/dist/components/notification-item.js +1 -1
  140. package/dist/components/property-selector.js +317 -0
  141. package/dist/components/random-string.js +22 -0
  142. package/dist/components/response-format-editor.js +278 -0
  143. package/dist/components/response-format-item.js +104 -0
  144. package/dist/components/summary-popover.js +3 -3
  145. package/dist/esm/{_MapCache-6484495d.js → _MapCache-af496e9d.js} +2 -27
  146. package/dist/esm/{_Uint8Array-e5cac922.js → _Uint8Array-d6ebd526.js} +3 -13
  147. package/dist/esm/_baseIsEqual-28053b81.js +494 -0
  148. package/dist/esm/_defineProperty-e6a185c3.js +13 -0
  149. package/dist/esm/{get-f9e0b2e1.js → get-3e42932b.js} +2 -1
  150. package/dist/esm/isEqual-57d0c223.js +35 -0
  151. package/dist/esm/isSymbol-1c5f65cc.js +28 -0
  152. package/dist/esm/lime-crm-building-blocks.js +1 -1
  153. package/dist/esm/lime-query.types-f72355e1.js +59 -0
  154. package/dist/esm/limebb-component-config.entry.js +3 -2
  155. package/dist/esm/limebb-document-item.entry.js +170 -0
  156. package/dist/esm/limebb-document-picker.entry.js +78 -0
  157. package/dist/esm/limebb-feed-item-thumbnail-file-info.entry.js +1 -1
  158. package/dist/esm/limebb-feed-timeline-item.entry.js +1 -1
  159. package/dist/esm/limebb-feed.entry.js +1 -1
  160. package/dist/esm/limebb-icon-picker.entry.js +1 -1
  161. package/dist/esm/limebb-info-tile-format.entry.js +1 -1
  162. package/dist/esm/limebb-info-tile.entry.js +1 -1
  163. package/dist/esm/limebb-kanban-group.entry.js +1 -1
  164. package/dist/esm/limebb-kanban-item.entry.js +1 -1
  165. package/dist/esm/limebb-lime-query-builder.entry.js +379 -147
  166. package/dist/esm/limebb-lime-query-filter-and_5.entry.js +270 -0
  167. package/dist/esm/limebb-lime-query-value-input.entry.js +235 -0
  168. package/dist/esm/limebb-limetype-field_2.entry.js +401 -0
  169. package/dist/esm/limebb-live-docs-info.entry.js +2 -2
  170. package/dist/esm/limebb-locale-picker.entry.js +9 -494
  171. package/dist/esm/limebb-mention-group-counter.entry.js +2 -2
  172. package/dist/esm/limebb-navigation-button_2.entry.js +3 -3
  173. package/dist/esm/limebb-notification-item.entry.js +1 -1
  174. package/dist/esm/limebb-percentage-visualizer.entry.js +2 -2
  175. package/dist/esm/limebb-property-selector.entry.js +230 -0
  176. package/dist/esm/limebb-response-format-item.entry.js +76 -0
  177. package/dist/esm/limebb-text-editor.entry.js +8 -69
  178. package/dist/esm/limebb-trend-indicator.entry.js +1 -1
  179. package/dist/esm/limetype-6e7552a7.js +85 -0
  180. package/dist/esm/loader.js +1 -1
  181. package/dist/esm/property-resolution-fde2375e.js +63 -0
  182. package/dist/esm/random-string-f6ef6fbf.js +22 -0
  183. package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
  184. package/dist/lime-crm-building-blocks/{p-85e11ff7.entry.js → p-00da9b24.entry.js} +1 -1
  185. package/dist/lime-crm-building-blocks/p-02c0cc04.entry.js +1 -0
  186. package/dist/lime-crm-building-blocks/p-123190c3.js +1 -0
  187. package/dist/lime-crm-building-blocks/p-244ee55b.entry.js +1 -0
  188. package/dist/lime-crm-building-blocks/p-35897ec3.js +1 -0
  189. package/dist/lime-crm-building-blocks/{p-d6a07ea4.entry.js → p-3932077b.entry.js} +1 -1
  190. package/dist/lime-crm-building-blocks/p-3b0a15ec.js +1 -0
  191. package/dist/lime-crm-building-blocks/p-4a82410e.entry.js +1 -0
  192. package/dist/lime-crm-building-blocks/{p-a694aae5.entry.js → p-50d3d61a.entry.js} +1 -1
  193. package/dist/lime-crm-building-blocks/p-5a6d2e7f.js +1 -0
  194. package/dist/lime-crm-building-blocks/p-60971d64.js +1 -0
  195. package/dist/lime-crm-building-blocks/{p-a44f543c.entry.js → p-61282e1a.entry.js} +1 -1
  196. package/dist/lime-crm-building-blocks/p-6c1146ca.entry.js +1 -0
  197. package/dist/lime-crm-building-blocks/p-70a28b93.entry.js +1 -0
  198. package/dist/lime-crm-building-blocks/{p-16199127.entry.js → p-79d4668a.entry.js} +1 -1
  199. package/dist/lime-crm-building-blocks/p-7e6fb4af.js +1 -0
  200. package/dist/lime-crm-building-blocks/{p-88cc5b66.entry.js → p-82d33d43.entry.js} +1 -1
  201. package/dist/lime-crm-building-blocks/{p-7db8652e.entry.js → p-8c4eb49f.entry.js} +1 -1
  202. package/dist/lime-crm-building-blocks/p-96beaabc.entry.js +1 -0
  203. package/dist/lime-crm-building-blocks/p-9d25ed5a.entry.js +1 -0
  204. package/dist/lime-crm-building-blocks/{p-8dce83ad.entry.js → p-9d9f25da.entry.js} +1 -1
  205. package/dist/lime-crm-building-blocks/p-a659d55a.js +1 -0
  206. package/dist/lime-crm-building-blocks/p-b7c72179.entry.js +1 -0
  207. package/dist/lime-crm-building-blocks/p-baf4e428.entry.js +1 -0
  208. package/dist/lime-crm-building-blocks/{p-516210d4.entry.js → p-beb0d164.entry.js} +1 -1
  209. package/dist/lime-crm-building-blocks/p-d298b34e.js +1 -0
  210. package/dist/lime-crm-building-blocks/{p-047c89de.entry.js → p-d89c44ad.entry.js} +1 -1
  211. package/dist/lime-crm-building-blocks/p-e0ab1554.js +1 -0
  212. package/dist/lime-crm-building-blocks/{p-46d2f604.entry.js → p-e35299e0.entry.js} +1 -1
  213. package/dist/lime-crm-building-blocks/{p-8ef39ab8.entry.js → p-e9d23ef7.entry.js} +1 -1
  214. package/dist/lime-crm-building-blocks/p-ef8a5266.entry.js +1 -0
  215. package/dist/lime-crm-building-blocks/{p-abf1c197.entry.js → p-f52125a0.entry.js} +1 -1
  216. package/dist/lime-crm-building-blocks/p-f99c611d.entry.js +1 -0
  217. package/dist/lime-crm-building-blocks/p-fbda77a7.js +1 -0
  218. package/dist/lime-crm-building-blocks/p-fe2b91d9.js +1 -0
  219. package/dist/lime-crm-building-blocks/{p-d6af09a8.entry.js → p-ff0b244b.entry.js} +1 -1
  220. package/dist/types/components/document-picker/document-item/document-item.d.ts +46 -0
  221. package/dist/types/components/document-picker/document-item/document-item.types.d.ts +37 -0
  222. package/dist/types/components/document-picker/document-picker.d.ts +80 -0
  223. package/dist/types/components/document-picker/document.types.d.ts +2 -0
  224. package/dist/types/components/lime-query-builder/expressions/lime-query-filter-and.d.ts +56 -0
  225. package/dist/types/components/lime-query-builder/expressions/lime-query-filter-comparison.d.ts +64 -0
  226. package/dist/types/components/lime-query-builder/expressions/lime-query-filter-expression.d.ts +53 -0
  227. package/dist/types/components/lime-query-builder/expressions/lime-query-filter-not.d.ts +54 -0
  228. package/dist/types/components/lime-query-builder/expressions/lime-query-filter-or.d.ts +55 -0
  229. package/dist/types/components/lime-query-builder/expressions/lime-query-value-input.d.ts +92 -0
  230. package/dist/types/components/lime-query-builder/filter-conversion.d.ts +18 -0
  231. package/dist/types/components/lime-query-builder/lime-query-builder.d.ts +30 -8
  232. package/dist/types/components/lime-query-builder/limetype-field/limetype-field.d.ts +96 -0
  233. package/dist/types/components/lime-query-builder/property-selection-format.d.ts +23 -0
  234. package/dist/types/components/lime-query-builder/property-selector/property-selector.d.ts +71 -0
  235. package/dist/types/components/lime-query-builder/response-format-editor.d.ts +57 -0
  236. package/dist/types/components/lime-query-builder/response-format-item.d.ts +46 -0
  237. package/dist/types/components.d.ts +1795 -114
  238. package/dist/types/util/format-bytes.d.ts +20 -0
  239. package/package.json +2 -2
  240. package/dist/lime-crm-building-blocks/p-29346b1a.entry.js +0 -1
  241. package/dist/lime-crm-building-blocks/p-4ccce5cc.entry.js +0 -1
  242. package/dist/lime-crm-building-blocks/p-7ef3bace.entry.js +0 -1
  243. package/dist/lime-crm-building-blocks/p-8044ffbd.js +0 -1
  244. package/dist/lime-crm-building-blocks/p-92ec9205.entry.js +0 -1
  245. package/dist/lime-crm-building-blocks/p-bcc23575.js +0 -1
  246. package/dist/lime-crm-building-blocks/p-c40a3f4b.js +0 -1
@@ -1,146 +1,63 @@
1
1
  import { r as registerInstance, c as createEvent, h } from './index-96dd111f.js';
2
2
  import { T as Te } from './index.esm-d8fdeb18.js';
3
+ import { L as LIME_QUERY_OPERATORS } from './lime-query.types-f72355e1.js';
4
+ import { g as getNormalizedProperties, a as getPropertyFromPath } from './property-resolution-fde2375e.js';
3
5
 
4
6
  /**
5
- * Get normalized properties for a limetype
6
- * Adds system properties (_id, _timestamp, etc.) that map to the actual limeobject attributes
7
- * @param limetype The limetype to normalize
8
- * @returns Normalized properties with system properties prefixed with underscore
9
- */
10
- function getNormalizedProperties(limetype) {
11
- if (!(limetype === null || limetype === void 0 ? void 0 : limetype.properties)) {
12
- return {};
13
- }
14
- const properties = Object.assign({}, limetype.properties);
15
- // System properties that are exposed by the backend
16
- // Map from internal property name to API property name
17
- const systemProperties = {
18
- id: '_id',
19
- timestamp: '_timestamp',
20
- descriptive: '_descriptive',
21
- createduser: '_createduser',
22
- createdtime: '_createdtime',
23
- updateduser: '_updateduser',
24
- };
25
- // Find and normalize system properties by name
26
- for (const [propName, systemPropName] of Object.entries(systemProperties)) {
27
- const property = properties[propName];
28
- if (property) {
29
- properties[systemPropName] = property;
30
- delete properties[propName];
31
- }
32
- }
33
- return properties;
34
- }
35
- /**
36
- * Get property from limetype by path (e.g., "company.name")
37
- * Supports relation traversal with dot-notation
38
- * @param limetypes
39
- * @param limetype
40
- * @param path
7
+ * Convert UI filter representation to Lime Query filter format
8
+ * @param filter
41
9
  */
42
- function getPropertyFromPath(limetypes, limetype, path) {
43
- if (!path || !limetype || !limetypes) {
10
+ function guiFilterToLimeQuery(filter) {
11
+ if (filter.filter_type === '') {
44
12
  return undefined;
45
13
  }
46
- const parts = path.split('.');
47
- let currentType = limetypes[limetype];
48
- let property;
49
- for (const part of parts) {
50
- if (!currentType) {
14
+ if (filter.filter_type === 'comparison') {
15
+ return {
16
+ key: filter.property,
17
+ op: filter.operator,
18
+ exp: filter.value,
19
+ };
20
+ }
21
+ if (filter.filter_type === 'AND') {
22
+ const expressions = filter.expressions
23
+ .map(guiFilterToLimeQuery)
24
+ .filter((f) => f !== undefined);
25
+ if (expressions.length === 0) {
51
26
  return undefined;
52
27
  }
53
- const normalizedProperties = getNormalizedProperties(currentType);
54
- property = normalizedProperties[part];
55
- if (!property) {
28
+ if (expressions.length === 1) {
29
+ return expressions[0];
30
+ }
31
+ return {
32
+ op: 'AND',
33
+ exp: expressions,
34
+ };
35
+ }
36
+ if (filter.filter_type === 'OR') {
37
+ const expressions = filter.expressions
38
+ .map(guiFilterToLimeQuery)
39
+ .filter((f) => f !== undefined);
40
+ if (expressions.length === 0) {
56
41
  return undefined;
57
42
  }
58
- // If this is a relation, get the related limetype for next iteration
59
- if (property.relation) {
60
- currentType = property.relation.getLimetype();
43
+ if (expressions.length === 1) {
44
+ return expressions[0];
61
45
  }
62
- }
63
- return property;
64
- }
65
-
66
- /**
67
- * TypeScript type definitions for Lime Query DSL
68
- *
69
- * These types represent the structure of Lime Query as defined in:
70
- * - lime-core/lime_query/schema.py
71
- * - lime-core/lime_filter/schema.py
72
- */
73
- /**
74
- * Available operators with display metadata
75
- */
76
- const LIME_QUERY_OPERATORS = [
77
- { value: '=', label: 'Equals', icon: 'equals' },
78
- { value: '!=', label: 'Not Equals', icon: 'not-equal' },
79
- {
80
- value: '>',
81
- label: 'Greater Than',
82
- icon: 'greater-than',
83
- applicableTypes: ['integer', 'decimal', 'date', 'time'],
84
- },
85
- {
86
- value: '>=',
87
- label: 'Greater or Equal',
88
- icon: 'greater-or-equal',
89
- applicableTypes: ['integer', 'decimal', 'date', 'time'],
90
- },
91
- {
92
- value: '<',
93
- label: 'Less Than',
94
- icon: 'less-than',
95
- applicableTypes: ['integer', 'decimal', 'date', 'time'],
96
- },
97
- {
98
- value: '<=',
99
- label: 'Less or Equal',
100
- icon: 'less-or-equal',
101
- applicableTypes: ['integer', 'decimal', 'date', 'time'],
102
- },
103
- { value: 'IN', label: 'In List', icon: 'list' },
104
- {
105
- value: '?',
106
- label: 'Contains',
107
- icon: '-lime-filter-contain',
108
- applicableTypes: ['string', 'text'],
109
- },
110
- {
111
- value: '=?',
112
- label: 'Begins With',
113
- icon: '-lime-filter-begin',
114
- applicableTypes: ['string', 'text'],
115
- },
116
- {
117
- value: '=$',
118
- label: 'Ends With',
119
- icon: '-lime-filter-end',
120
- applicableTypes: ['string', 'text'],
121
- },
122
- ];
123
-
124
- /**
125
- * Convert Lime Query filter to UI filter representation
126
- * Throws errors for unsupported filter structures
127
- * @param filter
128
- */
129
- function limeQueryToGuiFilter(filter) {
130
- if (!filter) {
131
- // Return empty AND instead of missing expression
132
- // This ensures users see the "Add a condition" button
133
46
  return {
134
- filter_type: 'AND',
135
- expressions: [],
47
+ op: 'OR',
48
+ exp: expressions,
136
49
  };
137
50
  }
138
- // Check if it's a FilterExpression (has 'key' property)
139
- if ('key' in filter) {
140
- return validateAndConvertFilterExpression(filter);
51
+ if (filter.filter_type === 'NOT') {
52
+ const innerFilter = guiFilterToLimeQuery(filter.expression);
53
+ if (innerFilter) {
54
+ return {
55
+ op: '!',
56
+ exp: innerFilter,
57
+ };
58
+ }
141
59
  }
142
- // It's a FilterGroup
143
- return validateAndConvertFilterGroup(filter);
60
+ return undefined;
144
61
  }
145
62
  /**
146
63
  * Validate and convert a FilterExpression (comparison filter)
@@ -222,6 +139,124 @@ function validateAndConvertFilterGroup(filter) {
222
139
  // If we reach here, the operator is unsupported
223
140
  throw new Error(`Unsupported filter operator: ${filter.op}`);
224
141
  }
142
+ /**
143
+ * Convert Lime Query filter to UI filter representation
144
+ * Throws errors for unsupported filter structures
145
+ * @param filter
146
+ */
147
+ function limeQueryToGuiFilter(filter) {
148
+ if (!filter) {
149
+ // Return empty AND instead of missing expression
150
+ // This ensures users see the "Add a condition" button
151
+ return {
152
+ filter_type: 'AND',
153
+ expressions: [],
154
+ };
155
+ }
156
+ // Check if it's a FilterExpression (has 'key' property)
157
+ if ('key' in filter) {
158
+ return validateAndConvertFilterExpression(filter);
159
+ }
160
+ // It's a FilterGroup
161
+ return validateAndConvertFilterGroup(filter);
162
+ }
163
+ /**
164
+ * Normalize filter for GUI mode by ensuring proper AND/OR wrapper structure.
165
+ * GUI mode requires filters to be wrapped in AND([OR(...)]) so users have
166
+ * access to add/remove buttons on the AND and OR components.
167
+ *
168
+ * This function ensures that:
169
+ * - Single comparisons are wrapped in AND([OR([comparison])])
170
+ * - OR groups are wrapped in AND([OR group])
171
+ * - AND groups have their comparison children wrapped in OR
172
+ * - Empty/undefined filters become AND([])
173
+ *
174
+ * When converting back to Lime Query JSON, limeQueryFilterToLimeQuery()
175
+ * automatically unwraps single-item AND/OR groups.
176
+ *
177
+ * @param filter The filter expression from limeQueryToLimeQueryFilter
178
+ * @returns Normalized filter suitable for GUI editing
179
+ */
180
+ function normalizeLimeQueryFilterForGui(filter) {
181
+ // Empty AND is already correct for GUI
182
+ if (filter.filter_type === 'AND' && filter.expressions.length === 0) {
183
+ return filter;
184
+ }
185
+ // Single comparison needs wrapping
186
+ if (filter.filter_type === 'comparison') {
187
+ return {
188
+ filter_type: 'AND',
189
+ expressions: [
190
+ {
191
+ filter_type: 'OR',
192
+ expressions: [filter],
193
+ },
194
+ ],
195
+ };
196
+ }
197
+ // OR needs wrapping in AND
198
+ if (filter.filter_type === 'OR') {
199
+ return {
200
+ filter_type: 'AND',
201
+ expressions: [filter],
202
+ };
203
+ }
204
+ // NOT needs wrapping
205
+ if (filter.filter_type === 'NOT') {
206
+ return {
207
+ filter_type: 'AND',
208
+ expressions: [
209
+ {
210
+ filter_type: 'OR',
211
+ expressions: [filter],
212
+ },
213
+ ],
214
+ };
215
+ }
216
+ // AND group - check if children need OR wrappers
217
+ if (filter.filter_type === 'AND') {
218
+ const normalizedChildren = filter.expressions.map((child) => {
219
+ // If child is already OR, keep it
220
+ if (child.filter_type === 'OR') {
221
+ return child;
222
+ }
223
+ // If child is NOT, keep it (NOT can be a direct child of AND)
224
+ if (child.filter_type === 'NOT') {
225
+ return child;
226
+ }
227
+ // If child is comparison, wrap in OR
228
+ if (child.filter_type === 'comparison') {
229
+ return {
230
+ filter_type: 'OR',
231
+ expressions: [child],
232
+ };
233
+ }
234
+ // If child is nested AND, recursively normalize and wrap in OR
235
+ if (child.filter_type === 'AND') {
236
+ return {
237
+ filter_type: 'OR',
238
+ expressions: [normalizeLimeQueryFilterForGui(child)],
239
+ };
240
+ }
241
+ // Unknown filter type, keep as is
242
+ return child;
243
+ });
244
+ return {
245
+ filter_type: 'AND',
246
+ expressions: normalizedChildren,
247
+ };
248
+ }
249
+ // Fallback: wrap in AND/OR structure
250
+ return {
251
+ filter_type: 'AND',
252
+ expressions: [
253
+ {
254
+ filter_type: 'OR',
255
+ expressions: [filter],
256
+ },
257
+ ],
258
+ };
259
+ }
225
260
 
226
261
  /**
227
262
  * Dynamic filter values and placeholders that are valid in Lime Query
@@ -600,7 +635,7 @@ function isLimeQuerySupported(limeQuery, limetypes, activeLimetype, guiModeEnabl
600
635
  };
601
636
  }
602
637
 
603
- const limeQueryBuilderCss = ":host(limebb-lime-query-builder){display:block;width:100%}.lime-query-builder{display:flex;flex-direction:column;gap:2rem}.mode-controls{display:flex;align-items:center;gap:0.5rem;padding:0.5rem;background-color:rgb(var(--contrast-100));border-radius:var(--border-radius)}.mode-switch{display:flex;align-items:center;gap:0.5rem}.mode-switch limel-button{min-width:5rem}.mode-switch limel-helper-text{margin-left:1rem;color:rgb(var(--color-red-default))}.gui-mode,.code-mode{display:block}.code-editor-container{--code-editor-max-height:70vh;display:flex;flex-direction:column;gap:1rem}.code-editor-container .validation-errors{padding:0.75rem 1rem;color:rgb(var(--color-red-default));background-color:rgb(var(--color-red-lighter));border-left:0.25rem solid rgb(var(--color-red-default));border-radius:0.25rem;font-size:0.875rem}.code-editor-container .validation-errors strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-editor-container .validation-errors ul{margin:0;padding-left:1.5rem}.code-editor-container .validation-errors li{margin:0.25rem 0}.code-editor-container .gui-limitations{padding:0.75rem 1rem;color:rgb(var(--color-blue-dark));background-color:rgb(var(--color-blue-lighter));border-left:0.25rem solid rgb(var(--color-blue-default));border-radius:0.25rem;font-size:0.875rem}.code-editor-container .gui-limitations strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-editor-container .gui-limitations ul{margin:0;padding-left:1.5rem}.code-editor-container .gui-limitations li{margin:0.25rem 0}.lime-query-builder-label{margin:0;font-size:1.5rem;font-weight:600;color:rgb(var(--contrast-1100))}.placeholder-message{padding:2rem;text-align:center;background-color:rgb(var(--contrast-100));border-radius:var(--border-radius);border:1px solid rgb(var(--contrast-300))}.placeholder-message h4{margin:0 0 1rem 0;font-size:1.125rem;font-weight:600;color:rgb(var(--contrast-1100))}.placeholder-message p{margin:0;color:rgb(var(--contrast-900));line-height:1.5}";
638
+ const limeQueryBuilderCss = ":host(limebb-lime-lime-query-builder){display:block;width:100%}.lime-query-builder{display:flex;flex-direction:column;gap:2rem}.mode-controls{display:flex;align-items:center;gap:0.5rem;padding:0.5rem}.mode-switch{display:flex;align-items:center;gap:0.5rem}.mode-switch limel-button{min-width:5rem}.mode-switch limel-helper-text{margin-left:1rem;color:rgb(var(--color-red-default))}.gui-mode,.code-mode{display:block}.code-editor-container{--code-editor-max-height:70vh;display:flex;flex-direction:column;gap:1rem}.code-editor-container .validation-errors{padding:0.75rem 1rem;color:rgb(var(--color-red-default));background-color:rgb(var(--color-red-lighter));border-left:0.25rem solid rgb(var(--color-red-default));border-radius:0.25rem;font-size:0.875rem}.code-editor-container .validation-errors strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-editor-container .validation-errors ul{margin:0;padding-left:1.5rem}.code-editor-container .validation-errors li{margin:0.25rem 0}.code-editor-container .gui-limitations{padding:0.75rem 1rem;color:rgb(var(--color-blue-dark));background-color:rgb(var(--color-blue-lighter));border-left:0.25rem solid rgb(var(--color-blue-default));border-radius:0.25rem;font-size:0.875rem}.code-editor-container .gui-limitations strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-editor-container .gui-limitations ul{margin:0;padding-left:1.5rem}.code-editor-container .gui-limitations li{margin:0.25rem 0}.lime-query-builder-label{margin:0;font-size:1.5rem;font-weight:600;color:rgb(var(--contrast-1100))}.limetype-section{display:flex;flex-direction:column}.filter-section,.query-options-section{display:flex;flex-direction:column;gap:1rem}.section-label{margin:0;font-size:1.125rem;font-weight:600;color:rgb(var(--contrast-1000))}.query-options-controls{display:grid;grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));gap:1rem}@media (max-width: 768px){.lime-query-builder{gap:1.5rem}.query-options-controls{grid-template-columns:1fr}}";
604
639
  const LimebbLimeQueryBuilderStyle0 = limeQueryBuilderCss;
605
640
 
606
641
  var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
@@ -619,10 +654,80 @@ const LimeQueryBuilder = class {
619
654
  this.change = createEvent(this, "change", 7);
620
655
  this.mode = 'gui';
621
656
  this.codeValue = '';
657
+ this.limetype = '';
658
+ this.filter = {
659
+ filter_type: 'AND',
660
+ expressions: [],
661
+ };
662
+ this.handleLimetypeChange = (event) => {
663
+ event.stopPropagation();
664
+ this.limetype = event.detail;
665
+ // Reset filter when limetype changes
666
+ this.filter = {
667
+ filter_type: 'AND',
668
+ expressions: [],
669
+ };
670
+ // Reset response format when limetype changes
671
+ this.internalResponseFormat = {
672
+ object: {
673
+ _id: null,
674
+ },
675
+ };
676
+ this.emitChange();
677
+ };
678
+ this.handleFilterChange = (event) => {
679
+ event.stopPropagation();
680
+ // Convert missing expression back to empty AND to keep the UI consistent
681
+ if (event.detail.filter_type === '') {
682
+ this.filter = {
683
+ filter_type: 'AND',
684
+ expressions: [],
685
+ };
686
+ }
687
+ else {
688
+ this.filter = event.detail;
689
+ }
690
+ this.emitChange();
691
+ };
692
+ this.handleResponseFormatChange = (event) => {
693
+ event.stopPropagation();
694
+ this.internalResponseFormat = event.detail;
695
+ this.emitChange();
696
+ };
697
+ this.handleLimitChange = (event) => {
698
+ event.stopPropagation();
699
+ const value = event.detail;
700
+ this.limit = value ? Number.parseInt(value, 10) : undefined;
701
+ this.emitChange();
702
+ };
703
+ this.handleActiveLimetypeChange = (event) => {
704
+ event.stopPropagation();
705
+ this.activeLimetype = event.detail || undefined;
706
+ };
622
707
  this.switchToGui = () => {
623
- this.mode = 'gui';
708
+ // Validate JSON before switching
709
+ try {
710
+ const parsed = JSON.parse(this.codeValue);
711
+ // Check if it's supported in GUI
712
+ const support = this.checkGuiSupport();
713
+ if (!support.guiSupported) {
714
+ // Don't switch if GUI can't render this query
715
+ return;
716
+ }
717
+ // Update internal state from parsed query
718
+ this.limetype = parsed.limetype || '';
719
+ this.filter = normalizeLimeQueryFilterForGui(limeQueryToGuiFilter(parsed.filter));
720
+ this.internalResponseFormat = parsed.responseFormat;
721
+ this.limit = parsed.limit;
722
+ this.mode = 'gui';
723
+ this.change.emit(parsed);
724
+ }
725
+ catch (_a) {
726
+ // Don't switch if JSON is invalid (linter will show the error)
727
+ }
624
728
  };
625
729
  this.switchToCode = () => {
730
+ this.updateCodeValue();
626
731
  this.mode = 'code';
627
732
  };
628
733
  this.handleCodeChange = (event) => {
@@ -643,43 +748,130 @@ const LimeQueryBuilder = class {
643
748
  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);
644
749
  }
645
750
  componentWillLoad() {
646
- // Initialize code value from input prop
647
- this.codeValue = JSON.stringify(this.value || {}, null, 2);
648
751
  // Force code mode if GUI is disabled
649
752
  if (!this.guiModeEnabled) {
650
753
  this.mode = 'code';
754
+ // Initialize code value from prop
755
+ this.updateCodeValue();
756
+ return;
757
+ }
758
+ if (this.value) {
759
+ this.limetype = this.value.limetype || '';
760
+ this.filter = normalizeLimeQueryFilterForGui(limeQueryToGuiFilter(this.value.filter));
761
+ this.internalResponseFormat = this.value.responseFormat;
762
+ this.limit = this.value.limit;
763
+ }
764
+ // Initialize code value from prop
765
+ this.updateCodeValue();
766
+ // Check if GUI mode is supported
767
+ const support = this.checkGuiSupport();
768
+ if (!support.guiSupported) {
769
+ this.mode = 'code';
651
770
  }
652
771
  }
653
772
  render() {
654
773
  const guiSupported = this.checkGuiSupport();
655
- return (h("div", { key: '48ec80b81ffb7765b9965219bfd343be84fb1dd1', class: "lime-query-builder" }, this.label && (h("h3", { key: '91034a7b8354b5e40858ededbbf9bcac76682a40', class: "lime-query-builder-label" }, this.label)), this.guiModeEnabled && (h("div", { key: '167fd8fb8673ba540e9bb1eec3518f0742cf7325', 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."))))));
774
+ const showCodeMode = !this.guiModeEnabled || this.mode === 'code';
775
+ return (h("div", { key: 'd179549c02b40689f61a47f327c9b4ab3e578258', class: "lime-query-builder" }, this.renderLabel(), this.renderModeControls(guiSupported), showCodeMode
776
+ ? this.renderCodeMode(guiSupported)
777
+ : this.renderGuiMode()));
778
+ }
779
+ emitChange() {
780
+ // Only emit in GUI mode
781
+ if (this.mode === 'code') {
782
+ return;
783
+ }
784
+ if (!this.limetype) {
785
+ return;
786
+ }
787
+ // Use internal state, then default to returning just _id
788
+ const responseFormat = this.internalResponseFormat || {
789
+ object: {
790
+ _id: null,
791
+ },
792
+ };
793
+ const limeQuery = {
794
+ limetype: this.limetype,
795
+ responseFormat: responseFormat,
796
+ filter: guiFilterToLimeQuery(this.filter),
797
+ };
798
+ if (this.limit !== undefined && this.limit > 0) {
799
+ limeQuery.limit = this.limit;
800
+ }
801
+ this.change.emit(limeQuery);
802
+ }
803
+ updateCodeValue() {
804
+ if (!this.limetype) {
805
+ this.codeValue = JSON.stringify(this.value || {}, null, 2);
806
+ return;
807
+ }
808
+ // Use internal state, then default to returning just _id
809
+ const responseFormat = this.internalResponseFormat || {
810
+ object: {
811
+ _id: null,
812
+ },
813
+ };
814
+ const limeQuery = {
815
+ limetype: this.limetype,
816
+ responseFormat: responseFormat,
817
+ filter: guiFilterToLimeQuery(this.filter),
818
+ };
819
+ if (this.limit !== undefined && this.limit > 0) {
820
+ limeQuery.limit = this.limit;
821
+ }
822
+ this.codeValue = JSON.stringify(limeQuery, null, 2);
656
823
  }
657
824
  checkGuiSupport() {
658
- if (!this.limetypes || !this.codeValue) {
825
+ if (!this.limetypes) {
659
826
  // Can't validate yet, assume all is good
660
827
  return {
661
828
  valid: true,
662
- guiSupported: false,
829
+ guiSupported: true,
663
830
  validationErrors: [],
664
831
  guiLimitations: [],
665
832
  };
666
833
  }
667
- // Parse and validate the code value
668
- let limeQueryToCheck;
669
- try {
670
- limeQueryToCheck = JSON.parse(this.codeValue);
834
+ // When in code mode, validate the parsed code value instead of current state
835
+ let queryToCheck;
836
+ if (this.mode === 'code' && this.codeValue) {
837
+ try {
838
+ queryToCheck = JSON.parse(this.codeValue);
839
+ }
840
+ catch (_a) {
841
+ return {
842
+ valid: false,
843
+ guiSupported: false,
844
+ validationErrors: ['Invalid JSON'],
845
+ guiLimitations: [],
846
+ };
847
+ }
671
848
  }
672
- catch (_a) {
673
- return {
674
- valid: false,
675
- guiSupported: false,
676
- validationErrors: ['Invalid JSON'],
677
- guiLimitations: [],
849
+ else {
850
+ // Build query from current GUI state
851
+ if (!this.limetype) {
852
+ return {
853
+ valid: true,
854
+ guiSupported: true,
855
+ validationErrors: [],
856
+ guiLimitations: [],
857
+ };
858
+ }
859
+ const responseFormat = this
860
+ .internalResponseFormat || {
861
+ object: {
862
+ _id: null,
863
+ },
678
864
  };
865
+ queryToCheck = {
866
+ limetype: this.limetype,
867
+ responseFormat: responseFormat,
868
+ filter: guiFilterToLimeQuery(this.filter),
869
+ };
870
+ if (this.limit !== undefined && this.limit > 0) {
871
+ queryToCheck.limit = this.limit;
872
+ }
679
873
  }
680
- // In code-only mode, we don't track activeLimetype separately
681
- // Pass undefined since it's not needed for code mode validation
682
- return isLimeQuerySupported(limeQueryToCheck, this.limetypes, undefined, this.guiModeEnabled);
874
+ return isLimeQuerySupported(queryToCheck, this.limetypes, this.activeLimetype, this.guiModeEnabled);
683
875
  }
684
876
  renderModeSwitch(support) {
685
877
  const guiDisabled = !support.guiSupported;
@@ -692,6 +884,46 @@ const LimeQueryBuilder = class {
692
884
  !guiSupported.guiSupported &&
693
885
  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))))))));
694
886
  }
887
+ renderLimetypeSection() {
888
+ 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 })));
889
+ }
890
+ renderResponseFormatSection() {
891
+ if (!this.limetype) {
892
+ return;
893
+ }
894
+ 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 })));
895
+ }
896
+ renderFilterSection() {
897
+ if (!this.limetype) {
898
+ return;
899
+ }
900
+ 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 })));
901
+ }
902
+ renderQueryOptionsSection() {
903
+ var _a;
904
+ if (!this.limetype) {
905
+ return;
906
+ }
907
+ return (h("div", { class: "query-options-section" }, h("h4", { class: "section-label" }, "Query Options"), h("div", { class: "query-options-controls" }, h("limebb-limetype-field", { platform: this.platform, context: this.context, label: "Active Object Type", value: this.activeLimetype, required: false, fieldName: "activeLimetype", helperText: "Limetype of the active object (for %activeObject% placeholders)", onChange: this.handleActiveLimetypeChange }), 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 }))));
908
+ }
909
+ renderGuiMode() {
910
+ return (h("div", { class: "gui-mode" }, this.renderLimetypeSection(), this.renderResponseFormatSection(), this.renderFilterSection(), this.renderQueryOptionsSection()));
911
+ }
912
+ renderLabel() {
913
+ if (!this.label) {
914
+ return;
915
+ }
916
+ return h("h3", { class: "lime-query-builder-label" }, this.label);
917
+ }
918
+ renderModeControls(support) {
919
+ if (!this.guiModeEnabled) {
920
+ return;
921
+ }
922
+ return (h("div", { class: "mode-controls" }, this.renderModeSwitch(support)));
923
+ }
924
+ renderCodeMode(support) {
925
+ return h("div", { class: "code-mode" }, this.renderCodeEditor(support));
926
+ }
695
927
  };
696
928
  __decorate([
697
929
  Te()