@limetech/lime-crm-building-blocks 1.100.1 → 1.102.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 (131) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/lime-crm-building-blocks.cjs.js +1 -1
  3. package/dist/cjs/lime-query-validation-6be10fa7.js +558 -0
  4. package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +22 -426
  5. package/dist/cjs/limebb-lime-query-filter-builder_3.cjs.entry.js +86 -243
  6. package/dist/cjs/limebb-lime-query-filter-comparison_2.cjs.entry.js +1 -1
  7. package/dist/cjs/limebb-lime-query-filter-group_3.cjs.entry.js +2 -2
  8. package/dist/cjs/limebb-lime-query-order-by-item.cjs.entry.js +51 -0
  9. package/dist/cjs/limebb-lime-query-response-format-builder.cjs.entry.js +242 -0
  10. package/dist/cjs/limebb-lime-query-response-format-editor_2.cjs.entry.js +322 -0
  11. package/dist/cjs/limebb-live-docs-info.cjs.entry.js +2 -2
  12. package/dist/cjs/limebb-locale-picker.cjs.entry.js +1 -1
  13. package/dist/cjs/limebb-mention-group-counter.cjs.entry.js +2 -2
  14. package/dist/cjs/limebb-navigation-button_2.cjs.entry.js +3 -3
  15. package/dist/cjs/limebb-notification-item.cjs.entry.js +1 -1
  16. package/dist/cjs/limebb-percentage-visualizer.cjs.entry.js +2 -2
  17. package/dist/cjs/limebb-text-editor.cjs.entry.js +1 -1
  18. package/dist/cjs/limebb-trend-indicator.cjs.entry.js +1 -1
  19. package/dist/cjs/loader.cjs.js +1 -1
  20. package/dist/collection/collection-manifest.json +5 -2
  21. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison.js +1 -1
  22. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-group.js +1 -1
  23. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-not.js +1 -1
  24. package/dist/collection/components/lime-query-builder/lime-query-builder.css +2 -5
  25. package/dist/collection/components/lime-query-builder/lime-query-builder.js +20 -20
  26. package/dist/collection/components/lime-query-builder/lime-query-response-format-builder.css +91 -0
  27. package/dist/collection/components/lime-query-builder/lime-query-response-format-builder.js +355 -0
  28. package/dist/collection/components/lime-query-builder/lime-query-validation.js +154 -7
  29. package/dist/collection/components/lime-query-builder/limetype-field/limetype-field.js +1 -1
  30. package/dist/collection/components/lime-query-builder/order-by/order-by-editor.css +72 -0
  31. package/dist/collection/components/lime-query-builder/order-by/order-by-editor.js +252 -0
  32. package/dist/collection/components/lime-query-builder/order-by/order-by-item.css +45 -0
  33. package/dist/collection/components/lime-query-builder/order-by/order-by-item.js +173 -0
  34. package/dist/collection/components/lime-query-builder/{response-format-editor.css → response-format/response-format-editor.css} +1 -1
  35. package/dist/collection/components/lime-query-builder/{response-format-editor.js → response-format/response-format-editor.js} +5 -5
  36. package/dist/collection/components/lime-query-builder/response-format/response-format-helpers.js +92 -0
  37. package/dist/collection/components/lime-query-builder/{response-format-item.css → response-format/response-format-item.css} +1 -1
  38. package/dist/collection/components/lime-query-builder/{response-format-item.js → response-format/response-format-item.js} +6 -6
  39. package/dist/collection/components/limeobject/file-viewer/live-docs-info.js +2 -2
  40. package/dist/collection/components/locale-picker/locale-picker.js +1 -1
  41. package/dist/collection/components/notification-list/notification-item/notification-item.js +1 -1
  42. package/dist/collection/components/percentage-visualizer/percentage-visualizer.js +2 -2
  43. package/dist/collection/components/summary-popover/summary-popover.js +3 -3
  44. package/dist/collection/components/text-editor/mention-group-counter.js +2 -2
  45. package/dist/collection/components/text-editor/text-editor.js +1 -1
  46. package/dist/collection/components/trend-indicator/trend-indicator.js +1 -1
  47. package/dist/components/lime-query-filter-comparison.js +1 -1
  48. package/dist/components/lime-query-filter-expression.js +2 -2
  49. package/dist/components/lime-query-validation.js +555 -0
  50. package/dist/components/lime-query-value-input.js +1 -1
  51. package/dist/components/limebb-lime-query-builder.js +53 -444
  52. package/dist/components/limebb-lime-query-order-by-editor.d.ts +11 -0
  53. package/dist/components/limebb-lime-query-order-by-editor.js +6 -0
  54. package/dist/components/limebb-lime-query-order-by-item.d.ts +11 -0
  55. package/dist/components/limebb-lime-query-order-by-item.js +6 -0
  56. package/dist/components/limebb-lime-query-response-format-builder.d.ts +11 -0
  57. package/dist/components/limebb-lime-query-response-format-builder.js +283 -0
  58. package/dist/components/limebb-lime-query-response-format-editor.d.ts +11 -0
  59. package/dist/components/{limebb-response-format-editor.js → limebb-lime-query-response-format-editor.js} +2 -2
  60. package/dist/components/limebb-lime-query-response-format-item.d.ts +11 -0
  61. package/dist/components/{limebb-response-format-item.js → limebb-lime-query-response-format-item.js} +2 -2
  62. package/dist/components/limebb-locale-picker.js +1 -1
  63. package/dist/components/limebb-mention-group-counter.js +2 -2
  64. package/dist/components/limebb-percentage-visualizer.js +2 -2
  65. package/dist/components/limebb-text-editor.js +1 -1
  66. package/dist/components/limebb-trend-indicator.js +1 -1
  67. package/dist/components/limetype-field.js +1 -1
  68. package/dist/components/live-docs-info.js +2 -2
  69. package/dist/components/notification-item.js +1 -1
  70. package/dist/components/order-by-editor.js +123 -0
  71. package/dist/components/order-by-item.js +73 -0
  72. package/dist/components/property-selector.js +1 -1
  73. package/dist/components/response-format-editor.js +11 -11
  74. package/dist/components/response-format-item.js +9 -9
  75. package/dist/components/summary-popover.js +3 -3
  76. package/dist/esm/lime-crm-building-blocks.js +1 -1
  77. package/dist/esm/lime-query-validation-573223a5.js +555 -0
  78. package/dist/esm/limebb-lime-query-builder.entry.js +22 -426
  79. package/dist/esm/limebb-lime-query-filter-builder_3.entry.js +86 -243
  80. package/dist/esm/limebb-lime-query-filter-comparison_2.entry.js +1 -1
  81. package/dist/esm/limebb-lime-query-filter-group_3.entry.js +3 -3
  82. package/dist/esm/limebb-lime-query-order-by-item.entry.js +47 -0
  83. package/dist/esm/limebb-lime-query-response-format-builder.entry.js +238 -0
  84. package/dist/esm/limebb-lime-query-response-format-editor_2.entry.js +317 -0
  85. package/dist/esm/limebb-live-docs-info.entry.js +2 -2
  86. package/dist/esm/limebb-locale-picker.entry.js +1 -1
  87. package/dist/esm/limebb-mention-group-counter.entry.js +2 -2
  88. package/dist/esm/limebb-navigation-button_2.entry.js +3 -3
  89. package/dist/esm/limebb-notification-item.entry.js +1 -1
  90. package/dist/esm/limebb-percentage-visualizer.entry.js +2 -2
  91. package/dist/esm/limebb-property-selector.entry.js +1 -1
  92. package/dist/esm/limebb-text-editor.entry.js +1 -1
  93. package/dist/esm/limebb-trend-indicator.entry.js +1 -1
  94. package/dist/esm/loader.js +1 -1
  95. package/dist/esm/{property-resolution-fde2375e.js → property-resolution-c21a1369.js} +1 -1
  96. package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
  97. package/dist/lime-crm-building-blocks/{p-79b8b09b.entry.js → p-0de79b7f.entry.js} +1 -1
  98. package/dist/lime-crm-building-blocks/{p-1034b4a5.entry.js → p-0f7135ff.entry.js} +1 -1
  99. package/dist/lime-crm-building-blocks/{p-6aa216ec.entry.js → p-186e9f1a.entry.js} +1 -1
  100. package/dist/lime-crm-building-blocks/p-289ce8b9.entry.js +1 -0
  101. package/dist/lime-crm-building-blocks/p-3351395b.entry.js +1 -0
  102. package/dist/lime-crm-building-blocks/p-33e6d0ec.entry.js +1 -0
  103. package/dist/lime-crm-building-blocks/{p-8581245a.entry.js → p-3d1be1c9.entry.js} +1 -1
  104. package/dist/lime-crm-building-blocks/{p-b57dafef.entry.js → p-577d8909.entry.js} +1 -1
  105. package/dist/lime-crm-building-blocks/{p-89a6c396.entry.js → p-6579412e.entry.js} +1 -1
  106. package/dist/lime-crm-building-blocks/{p-8fb2e192.entry.js → p-6f6fed59.entry.js} +1 -1
  107. package/dist/lime-crm-building-blocks/{p-58782467.entry.js → p-7e5528f6.entry.js} +1 -1
  108. package/dist/lime-crm-building-blocks/{p-2048ac67.entry.js → p-a9ac501f.entry.js} +1 -1
  109. package/dist/lime-crm-building-blocks/{p-f79e354b.entry.js → p-abfc7815.entry.js} +1 -1
  110. package/dist/lime-crm-building-blocks/{p-e0ab1554.js → p-b748c770.js} +1 -1
  111. package/dist/lime-crm-building-blocks/p-be845252.entry.js +1 -0
  112. package/dist/lime-crm-building-blocks/p-cb338753.entry.js +1 -0
  113. package/dist/lime-crm-building-blocks/{p-76d81eee.entry.js → p-d0721b22.entry.js} +1 -1
  114. package/dist/lime-crm-building-blocks/p-fa2da6bc.js +1 -0
  115. package/dist/types/components/lime-query-builder/lime-query-builder.d.ts +9 -6
  116. package/dist/types/components/lime-query-builder/lime-query-response-format-builder.d.ts +102 -0
  117. package/dist/types/components/lime-query-builder/lime-query-validation.d.ts +13 -0
  118. package/dist/types/components/lime-query-builder/order-by/order-by-editor.d.ts +58 -0
  119. package/dist/types/components/lime-query-builder/order-by/order-by-item.d.ts +37 -0
  120. package/dist/types/components/lime-query-builder/{response-format-editor.d.ts → response-format/response-format-editor.d.ts} +2 -2
  121. package/dist/types/components/lime-query-builder/response-format/response-format-helpers.d.ts +42 -0
  122. package/dist/types/components/lime-query-builder/{response-format-item.d.ts → response-format/response-format-item.d.ts} +2 -2
  123. package/dist/types/components.d.ts +667 -279
  124. package/package.json +1 -1
  125. package/dist/cjs/limebb-response-format-item.cjs.entry.js +0 -80
  126. package/dist/components/limebb-response-format-editor.d.ts +0 -11
  127. package/dist/components/limebb-response-format-item.d.ts +0 -11
  128. package/dist/esm/limebb-response-format-item.entry.js +0 -76
  129. package/dist/lime-crm-building-blocks/p-244ee55b.entry.js +0 -1
  130. package/dist/lime-crm-building-blocks/p-323c49bc.entry.js +0 -1
  131. package/dist/lime-crm-building-blocks/p-f22b66f6.entry.js +0 -1
@@ -135,6 +135,90 @@ const LimeQueryFilterBuilderComponent = class {
135
135
  };
136
136
  LimeQueryFilterBuilderComponent.style = LimebbLimeQueryFilterBuilderStyle0;
137
137
 
138
+ const orderByEditorCss = ":host(limebb-lime-query-order-by-editor){display:block;width:100%}.order-by-editor{display:flex;flex-direction:column;gap:1rem;padding:1rem}.header{display:flex;justify-content:space-between;align-items:center;gap:1rem}.header h4{margin:0;font-size:1rem;font-weight:600;color:rgb(var(--contrast-1000))}.order-by-list{display:flex;flex-direction:column;gap:1rem;padding:0.5rem;border:1px solid rgb(var(--contrast-300));border-radius:0.25rem;background-color:rgb(var(--contrast-50));min-height:4rem}.order-by-item{padding:0.5rem;border-radius:0.25rem;transition:background-color 0.2s}.order-by-item:hover{background-color:rgb(var(--contrast-100))}.actions{display:flex;justify-content:flex-start}.summary{display:flex;justify-content:space-between;align-items:center;padding-top:0.5rem;border-top:1px solid rgb(var(--contrast-300))}.summary .count{font-size:0.875rem;font-weight:500;color:rgb(var(--contrast-900))}.empty-state{padding:2rem;text-align:center;color:rgb(var(--contrast-700));font-style:italic}.empty-state p{margin:0}";
139
+ const LimebbLimeQueryOrderByEditorStyle0 = orderByEditorCss;
140
+
141
+ const OrderByEditor = class {
142
+ constructor(hostRef) {
143
+ registerInstance(this, hostRef);
144
+ this.change = createEvent(this, "change", 7);
145
+ /**
146
+ * Optional label
147
+ */
148
+ this.label = 'Sort Order';
149
+ this.items = [];
150
+ this.handleItemChange = (index) => (event) => {
151
+ event.stopPropagation();
152
+ const newItems = [...this.items];
153
+ if (event.detail === null) {
154
+ // Remove item
155
+ newItems.splice(index, 1);
156
+ }
157
+ else {
158
+ // Update item
159
+ newItems[index] = event.detail;
160
+ }
161
+ this.items = newItems;
162
+ this.emitChange();
163
+ };
164
+ this.handleAddSortField = () => {
165
+ // Add new item with empty path and ASC direction
166
+ this.items = [...this.items, { '': 'ASC' }];
167
+ this.emitChange();
168
+ };
169
+ }
170
+ componentWillLoad() {
171
+ if (this.value && this.value.length > 0) {
172
+ this.items = [...this.value];
173
+ }
174
+ }
175
+ handleValueChange(newValue) {
176
+ if (!newValue) {
177
+ return;
178
+ }
179
+ // Check if items have changed
180
+ const itemsChanged = newValue.length !== this.items.length ||
181
+ !newValue.every((item, index) => {
182
+ const currentItem = this.items[index];
183
+ if (!currentItem)
184
+ return false;
185
+ const itemKey = Object.keys(item)[0];
186
+ const currentKey = Object.keys(currentItem)[0];
187
+ return (itemKey === currentKey &&
188
+ item[itemKey] === currentItem[currentKey]);
189
+ });
190
+ if (itemsChanged) {
191
+ this.items = newValue.length > 0 ? [...newValue] : [];
192
+ }
193
+ }
194
+ render() {
195
+ if (!this.limetype) {
196
+ return (h("div", { class: "empty-state" }, h("p", null, "Select a limetype to configure sorting")));
197
+ }
198
+ return (h("div", { class: "order-by-editor" }, h("div", { class: "header" }, h("h4", null, this.label)), this.renderOrderByList(), this.renderActions()));
199
+ }
200
+ renderOrderByList() {
201
+ if (this.items.length === 0) {
202
+ return null;
203
+ }
204
+ return (h("div", { class: "order-by-list" }, this.items.map((item, index) => this.renderItem(item, index))));
205
+ }
206
+ renderActions() {
207
+ return (h("div", { class: "actions" }, h("limel-button", { label: "Add Sort Field", icon: "plus_math", onClick: this.handleAddSortField })));
208
+ }
209
+ renderItem(item, index) {
210
+ const propertyPath = Object.keys(item)[0] || '';
211
+ return (h("limebb-lime-query-order-by-item", { key: `${propertyPath}-${index}`, class: "order-by-item", platform: this.platform, context: this.context, limetype: this.limetype, item: item, onItemChange: this.handleItemChange(index) }));
212
+ }
213
+ emitChange() {
214
+ this.change.emit(this.items);
215
+ }
216
+ static get watchers() { return {
217
+ "value": ["handleValueChange"]
218
+ }; }
219
+ };
220
+ OrderByEditor.style = LimebbLimeQueryOrderByEditorStyle0;
221
+
138
222
  const RELATION_PROPERTY_TYPES = [
139
223
  'belongsto',
140
224
  'hasone',
@@ -220,7 +304,7 @@ const LimetypeField = class {
220
304
  value: '',
221
305
  };
222
306
  options.unshift(emptyOption);
223
- return (h("limel-select", { key: 'fd9522c5df730f65a5ac57140bca6c05c5acd63d', label: this.label, options: options, value: selectedOption, required: this.required, helperText: this.helperText, invalid: invalid, disabled: this.disabled || this.readonly, onChange: this.handleChange }));
307
+ return (h("limel-select", { key: 'ee9fdc46424c9e6dc5897260cb16bcbedd43413a', label: this.label, options: options, value: selectedOption, required: this.required, helperText: this.helperText, invalid: invalid, disabled: this.disabled || this.readonly, onChange: this.handleChange }));
224
308
  }
225
309
  componentWillRender() {
226
310
  this.updatePropertyFields(this.value || '');
@@ -258,245 +342,4 @@ const limeTypeToOption = (limetype) => ({
258
342
  icon: getIcon(limetype),
259
343
  });
260
344
 
261
- /**
262
- * Process a single property value and add to items array
263
- * @param items Array to add items to
264
- * @param fullPath Full property path
265
- * @param value Property value to process
266
- */
267
- function processPropertyValue(items, fullPath, value) {
268
- if (value === null) {
269
- items.push({ path: fullPath });
270
- return;
271
- }
272
- // Cast to record for checking
273
- const valueObj = value;
274
- const keys = Object.keys(valueObj);
275
- const hasAlias = '_alias' in valueObj;
276
- const hasDescription = '#description' in valueObj;
277
- const otherKeys = keys.filter((k) => k !== '_alias' && k !== '#description');
278
- // If it's {} or only has metadata (_alias, #description), treat as simple property
279
- if (otherKeys.length === 0) {
280
- const aliasValue = valueObj._alias;
281
- const descriptionValue = valueObj['#description'];
282
- if (aliasValue || descriptionValue) {
283
- items.push({
284
- path: fullPath,
285
- alias: aliasValue,
286
- description: descriptionValue,
287
- });
288
- }
289
- else {
290
- items.push({ path: fullPath });
291
- }
292
- return;
293
- }
294
- // If has metadata + other properties, we need to handle both
295
- // Add the nested properties (metadata is preserved in conversion back)
296
- if (hasAlias || hasDescription) {
297
- // Build a PropertySelection without the metadata for recursion
298
- const nestedSelection = {};
299
- for (const key of otherKeys) {
300
- nestedSelection[key] = valueObj[key];
301
- }
302
- items.push(...propertySelectionToItems(nestedSelection, fullPath));
303
- return;
304
- }
305
- // Nested property selection without metadata
306
- items.push(...propertySelectionToItems(value, fullPath));
307
- }
308
- /**
309
- * Convert a nested PropertySelection to a flat list of property items
310
- * @param selection The nested PropertySelection object
311
- * @param prefix Current path prefix (used for recursion)
312
- * @returns Flat array of PropertySelectionItem objects
313
- */
314
- function propertySelectionToItems(selection, prefix = '') {
315
- if (!selection) {
316
- return [];
317
- }
318
- const items = [];
319
- for (const [key, value] of Object.entries(selection)) {
320
- const fullPath = prefix ? `${prefix}.${key}` : key;
321
- if (typeof value === 'object') {
322
- // NOTE: We want to send null values to the processPropertyValue
323
- // function but we don't need a special check for null, since
324
- // `typeof null === 'object'`
325
- processPropertyValue(items, fullPath, value);
326
- }
327
- }
328
- return items;
329
- }
330
- /**
331
- * Set the final property value (with or without alias/description)
332
- * @param current Current PropertySelection object
333
- * @param part Property name/key
334
- * @param item Property selection item with path and optional alias/description
335
- */
336
- function setPropertyValue(current, part, item) {
337
- // Check if there's already a nested PropertySelection with properties
338
- const existing = current[part];
339
- if (existing &&
340
- typeof existing === 'object' &&
341
- !('_alias' in existing) &&
342
- !('#description' in existing)) {
343
- // There's already a nested PropertySelection object with properties
344
- // Don't overwrite it - preserve the nested selections
345
- return;
346
- }
347
- // Build metadata object, stripping empty values
348
- const metadata = {};
349
- if (item.alias && item.alias.trim() !== '') {
350
- metadata._alias = item.alias;
351
- }
352
- if (item.description && item.description.trim() !== '') {
353
- metadata['#description'] = item.description;
354
- }
355
- // If we have metadata, use it; otherwise use null
356
- if (Object.keys(metadata).length > 0) {
357
- current[part] = metadata;
358
- }
359
- else {
360
- current[part] = null;
361
- }
362
- }
363
- /**
364
- * Ensure a nested object exists and return it
365
- * Preserves any existing _alias and #description when converting to nested object
366
- * @param current Current PropertySelection object
367
- * @param part Property name/key
368
- * @returns The nested PropertySelection object
369
- */
370
- function ensureNestedObject(current, part) {
371
- const existing = current[part];
372
- // If doesn't exist or is null, create empty object
373
- if (!existing) {
374
- current[part] = {};
375
- return current[part];
376
- }
377
- // If it's already a PropertySelection object, check for metadata
378
- if (typeof existing === 'object') {
379
- const existingObj = existing;
380
- // If it has metadata but no other properties, preserve the metadata
381
- const keys = Object.keys(existingObj);
382
- const hasMetadata = '_alias' in existingObj || '#description' in existingObj;
383
- const otherKeys = keys.filter((k) => k !== '_alias' && k !== '#description');
384
- if (hasMetadata && otherKeys.length === 0) {
385
- // Convert { _alias: "...", "#description": "..." } to { _alias: "...", "#description": "...", ...nested }
386
- // Keep the existing object and return it (caller will add nested props)
387
- return existingObj;
388
- }
389
- // Already has nested properties, return as is
390
- return existingObj;
391
- }
392
- // Shouldn't reach here, but fallback to creating new object
393
- current[part] = {};
394
- return current[part];
395
- }
396
- /**
397
- * Convert a flat list of property items to a nested PropertySelection structure
398
- * @param items Array of PropertySelectionItem objects
399
- * @returns Nested PropertySelection object
400
- */
401
- function itemsToPropertySelection(items) {
402
- const result = {};
403
- for (const item of items) {
404
- const parts = item.path.split('.');
405
- let current = result;
406
- for (let i = 0; i < parts.length; i++) {
407
- const part = parts[i];
408
- const isLast = i === parts.length - 1;
409
- if (isLast) {
410
- setPropertyValue(current, part, item);
411
- }
412
- else {
413
- current = ensureNestedObject(current, part);
414
- }
415
- }
416
- }
417
- return result;
418
- }
419
-
420
- const responseFormatEditorCss = ":host(limebb-response-format-editor){display:block;width:100%}.response-format-editor{display:flex;flex-direction:column;gap:1rem;padding:1rem}.header{display:flex;justify-content:space-between;align-items:center;gap:1rem}.header h4{margin:0;font-size:1rem;font-weight:600;color:rgb(var(--contrast-1000))}.property-list{display:flex;flex-direction:column;gap:1rem;padding:0.5rem;border:1px solid rgb(var(--contrast-300));border-radius:0.25rem;background-color:rgb(var(--contrast-50));min-height:4rem}.property-item{padding:0.5rem;border-radius:0.25rem;transition:background-color 0.2s}.property-item:hover{background-color:rgb(var(--contrast-100))}.actions{display:flex;justify-content:flex-start}.summary{display:flex;justify-content:space-between;align-items:center;padding-top:0.5rem;border-top:1px solid rgb(var(--contrast-300))}.summary .count{font-size:0.875rem;font-weight:500;color:rgb(var(--contrast-900))}.empty-state{padding:2rem;text-align:center;color:rgb(var(--contrast-700));font-style:italic}.empty-state p{margin:0}";
421
- const LimebbResponseFormatEditorStyle0 = responseFormatEditorCss;
422
-
423
- const ResponseFormatEditor = class {
424
- constructor(hostRef) {
425
- registerInstance(this, hostRef);
426
- this.change = createEvent(this, "change", 7);
427
- /**
428
- * Optional label
429
- */
430
- this.label = 'Select Properties to Return';
431
- this.items = [{ path: '_id' }];
432
- this.handleItemChange = (index) => (event) => {
433
- event.stopPropagation();
434
- const newItems = [...this.items];
435
- if (event.detail === null) {
436
- // Remove item
437
- newItems.splice(index, 1);
438
- }
439
- else {
440
- // Update item
441
- newItems[index] = event.detail;
442
- }
443
- // Ensure we always have at least _id
444
- if (newItems.length === 0) {
445
- newItems.push({ path: '_id' });
446
- }
447
- this.items = newItems;
448
- this.emitChange();
449
- };
450
- this.handleAddProperty = () => {
451
- this.items = [...this.items, { path: '' }];
452
- this.emitChange();
453
- };
454
- }
455
- componentWillLoad() {
456
- var _a;
457
- if ((_a = this.value) === null || _a === void 0 ? void 0 : _a.object) {
458
- const converted = propertySelectionToItems(this.value.object);
459
- if (converted.length > 0) {
460
- this.items = converted;
461
- }
462
- }
463
- }
464
- componentWillUpdate() {
465
- var _a;
466
- if ((_a = this.value) === null || _a === void 0 ? void 0 : _a.object) {
467
- const currentItems = propertySelectionToItems(this.value.object);
468
- // Check if items have changed
469
- const itemsChanged = currentItems.length !== this.items.length ||
470
- !currentItems.every((item, index) => {
471
- const current = this.items[index];
472
- return (current &&
473
- item.path === current.path &&
474
- item.alias === current.alias &&
475
- item.description === current.description);
476
- });
477
- if (itemsChanged) {
478
- this.items =
479
- currentItems.length > 0 ? currentItems : [{ path: '_id' }];
480
- }
481
- }
482
- }
483
- render() {
484
- if (!this.limetype) {
485
- return (h("div", { class: "empty-state" }, h("p", null, "Select a limetype to choose properties")));
486
- }
487
- return (h("div", { class: "response-format-editor" }, h("div", { class: "header" }, h("h4", null, this.label)), h("div", { class: "property-list" }, this.items.map((item, index) => this.renderItem(item, index))), h("div", { class: "actions" }, h("limel-button", { label: "Add Property", icon: "plus_math", onClick: this.handleAddProperty })), h("div", { class: "summary" }, h("span", { class: "count" }, this.items.length, ' ', this.items.length === 1 ? 'property' : 'properties', ' ', "selected"))));
488
- }
489
- renderItem(item, index) {
490
- return (h("limebb-response-format-item", { key: `${item.path}-${index}`, class: "property-item", platform: this.platform, context: this.context, limetype: this.limetype, item: item, onItemChange: this.handleItemChange(index) }));
491
- }
492
- emitChange() {
493
- const propertySelection = itemsToPropertySelection(this.items);
494
- const responseFormat = {
495
- object: propertySelection,
496
- };
497
- this.change.emit(responseFormat);
498
- }
499
- };
500
- ResponseFormatEditor.style = LimebbResponseFormatEditorStyle0;
501
-
502
- export { LimeQueryFilterBuilderComponent as limebb_lime_query_filter_builder, LimetypeField as limebb_limetype_field, ResponseFormatEditor as limebb_response_format_editor };
345
+ export { LimeQueryFilterBuilderComponent as limebb_lime_query_filter_builder, OrderByEditor as limebb_lime_query_order_by_editor, LimetypeField as limebb_limetype_field };
@@ -78,7 +78,7 @@ const LimeQueryFilterComparisonComponent = class {
78
78
  };
79
79
  }
80
80
  render() {
81
- return (h("div", { key: 'a077c982ced9840beec3e574cd3e2e336cff6071', class: "expression" }, this.label && h("limel-header", { key: 'fbcb5cf515aac2c8e68d29947c7560684f30822c', heading: this.label }), h("div", { key: 'ffea426ea1295ae11aaa3c910f835acbeed24cd9', class: "expression-container" }, this.renderPropertySelector(), this.renderOperator(), this.renderValueInput(), h("limel-icon-button", { key: '20064f9fe42a4dfa71b2e1e2d393d50bbe20e2cb', class: "remove", icon: "trash", label: "Remove condition", onClick: this.removeExpression }))));
81
+ return (h("div", { key: '41fc60ed4ce76de8bbed05ee8cc658a188347cbd', class: "expression" }, this.label && h("limel-header", { key: '95cb9b556e2e0f2c8f3fd8ebe3909c402a844fe3', heading: this.label }), h("div", { key: 'feac7dcf059a0a20ad499d1549fa45d775d6bec8', class: "expression-container" }, this.renderPropertySelector(), this.renderOperator(), this.renderValueInput(), h("limel-icon-button", { key: '0fee01518c1c4a29c347a47ce1ce7856b32dfa8f', class: "remove", icon: "trash", label: "Remove condition", onClick: this.removeExpression }))));
82
82
  }
83
83
  renderPropertySelector() {
84
84
  return (h("limebb-property-selector", { platform: this.platform, context: this.context, label: "Property", limetype: this.limetype, value: this.expression.key, required: true, onChange: this.handlePropertyChange }));
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, c as createEvent, h } from './index-96dd111f.js';
2
2
  import { Z as Zt, T as Te } from './index.esm-bb569663.js';
3
- import { a as getPropertyFromPath } from './property-resolution-fde2375e.js';
3
+ import { g as getPropertyFromPath } from './property-resolution-c21a1369.js';
4
4
 
5
5
  const limeQueryFilterGroupCss = "@charset \"UTF-8\";.expression{display:flex;flex-direction:column;margin-bottom:1rem;gap:0;background-color:rgb(var(--contrast-100));border:1px solid rgb(var(--contrast-500));border-radius:0.75rem}.expression .clickable-header{cursor:pointer;user-select:none}.expression .clickable-header:hover{background-color:rgb(var(--contrast-200))}.expression>ul{margin-top:0;margin-right:1rem;margin-bottom:1rem;margin-left:1rem;padding-left:1rem;list-style:disc}.expression>ul li{margin-top:1rem}.expression>ul li.add-button{list-style:none;display:flex;gap:0.5rem}";
6
6
  const LimebbLimeQueryFilterGroupStyle0 = limeQueryFilterGroupCss;
@@ -76,7 +76,7 @@ const LimeQueryFilterGroupComponent = class {
76
76
  }
77
77
  render() {
78
78
  const subheading = this.getSubheading();
79
- return (h("div", { key: '0ed5a1403d9641926cd6d474910cedf9c7bba89e', class: "expression" }, subheading && (h("limel-header", { key: 'ea88a97df09f0fb5a21bf9afb4745256a611c7f8', subheading: subheading, onClick: this.handleToggleOperator, class: "clickable-header" })), h("ul", { key: 'cfbcdd539e84f79bf1d778e075cd3317d7409647' }, this.expression.exp.map(this.renderChildExpression), h("li", { key: 'ec443459245bf5852920bb4d3e341f2490a7b75b', class: "add-button" }, this.renderAddButton(), this.renderAddGroupButton()))));
79
+ return (h("div", { key: '52195908487144bda718eada4e379e7ad3e413a0', class: "expression" }, subheading && (h("limel-header", { key: '71f29d49c8d071822a30990eb48fde1af579bec5', subheading: subheading, onClick: this.handleToggleOperator, class: "clickable-header" })), h("ul", { key: '39d798c1424755a8cd0c57ca26d3744ba299b7ad' }, this.expression.exp.map(this.renderChildExpression), h("li", { key: '0394f3ec7d63e195f184b081cb1a8179f586cedf', class: "add-button" }, this.renderAddButton(), this.renderAddGroupButton()))));
80
80
  }
81
81
  getSubheading() {
82
82
  if (this.expression.exp.length <= 1) {
@@ -133,7 +133,7 @@ const LimeQueryFilterNotComponent = class {
133
133
  };
134
134
  }
135
135
  render() {
136
- return (h("div", { key: '9ab4a6b1e99668a0bcee3e3ba8cbbbe5185222e0', class: "expression" }, this.label && h("limel-header", { key: '85e997b0f96db306dd7a4433da959a74303aacfa', heading: this.label }), h("limebb-lime-query-filter-expression", { key: '14f634e125ee78f2aa70c7537b270a31699ba7c2', platform: this.platform, context: this.context, label: "Not", limetype: this.limetype, activeLimetype: this.activeLimetype, expression: this.expression.exp, onExpressionChange: this.handleExpressionChange })));
136
+ return (h("div", { key: '29770b10d0b892750ad2aab3520cec5a82063774', class: "expression" }, this.label && h("limel-header", { key: '9e47d14c6cb526c9c31d67e11a5ed5ec665c7f62', heading: this.label }), h("limebb-lime-query-filter-expression", { key: '943c1529057aa6cc918dc935f1a5782b149351ae', platform: this.platform, context: this.context, label: "Not", limetype: this.limetype, activeLimetype: this.activeLimetype, expression: this.expression.exp, onExpressionChange: this.handleExpressionChange })));
137
137
  }
138
138
  };
139
139
  LimeQueryFilterNotComponent.style = LimebbLimeQueryFilterNotStyle0;
@@ -0,0 +1,47 @@
1
+ import { r as registerInstance, c as createEvent, h } from './index-96dd111f.js';
2
+
3
+ const orderByItemCss = ":host(limebb-lime-query-order-by-item){display:flex;flex-direction:column;gap:0.5rem;width:100%}.order-by-controls{display:flex;flex-direction:row;align-items:flex-start;gap:0.5rem;width:100%}.property-path{flex-grow:1;min-width:min(20rem, 100%)}.control-buttons{flex-shrink:0;display:flex;flex-direction:row;gap:0.25rem;align-items:center;padding-top:0.5rem}.control-buttons limel-icon-button{opacity:0.6;transition:opacity 0.2s ease}.control-buttons limel-icon-button:hover{opacity:1}@media (max-width: 768px){.order-by-controls{flex-direction:column;gap:0.5rem}.control-buttons{padding-top:0}}";
4
+ const LimebbLimeQueryOrderByItemStyle0 = orderByItemCss;
5
+
6
+ const OrderByItemComponent = class {
7
+ constructor(hostRef) {
8
+ registerInstance(this, hostRef);
9
+ this.itemChange = createEvent(this, "itemChange", 7);
10
+ this.handlePathChange = (event) => {
11
+ event.stopPropagation();
12
+ const newPath = event.detail;
13
+ if (!newPath) {
14
+ // If path is cleared, keep the current item but with empty path
15
+ const currentDirection = this.item[Object.keys(this.item)[0]] || 'ASC';
16
+ this.itemChange.emit({ '': currentDirection });
17
+ return;
18
+ }
19
+ // Get current direction
20
+ const currentPath = Object.keys(this.item)[0];
21
+ const currentDirection = this.item[currentPath] || 'ASC';
22
+ // Create new item with new path but same direction
23
+ const newItem = { [newPath]: currentDirection };
24
+ this.itemChange.emit(newItem);
25
+ };
26
+ this.handleToggleDirection = () => {
27
+ const propertyPath = Object.keys(this.item)[0] || '';
28
+ const currentDirection = this.item[propertyPath] || 'ASC';
29
+ const newDirection = currentDirection === 'ASC' ? 'DESC' : 'ASC';
30
+ const newItem = { [propertyPath]: newDirection };
31
+ this.itemChange.emit(newItem);
32
+ };
33
+ this.handleRemove = () => {
34
+ this.itemChange.emit(null);
35
+ };
36
+ }
37
+ render() {
38
+ const propertyPath = Object.keys(this.item)[0] || '';
39
+ const direction = this.item[propertyPath] || 'ASC';
40
+ return (h("div", { key: '1587617d84be8905a858059ea966b7a9e0d6df78', class: "order-by-controls" }, h("div", { key: '8d4f47423c56cad20e91142f82a5726a7325233b', class: "property-path" }, h("limebb-property-selector", { key: '42c54528d2d2ee72e5b3f6ca4b31eb7bbcb9b325', platform: this.platform, context: this.context, limetype: this.limetype, label: "Property", value: propertyPath, required: true, onChange: this.handlePathChange })), h("div", { key: '1011a34f626c94608a926567e464d380faded349', class: "control-buttons" }, h("limel-icon-button", { key: '510a7c333397792a66f3e17a3501f2af96183db9', icon: direction === 'ASC'
41
+ ? 'sort_ascending'
42
+ : 'sort_descending', label: direction === 'ASC' ? 'Ascending' : 'Descending', onClick: this.handleToggleDirection }), h("limel-icon-button", { key: '5bc160b38c565e30cca03a88d6f2d181284cefdd', icon: "trash", label: "Remove", onClick: this.handleRemove }))));
43
+ }
44
+ };
45
+ OrderByItemComponent.style = LimebbLimeQueryOrderByItemStyle0;
46
+
47
+ export { OrderByItemComponent as limebb_lime_query_order_by_item };