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