@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
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { h, } from "@stencil/core";
|
|
2
|
+
/**
|
|
3
|
+
* Order By Editor Component
|
|
4
|
+
*
|
|
5
|
+
* Allows users to specify the order in which query results should be sorted.
|
|
6
|
+
* Supports sorting by multiple properties with ascending or descending order.
|
|
7
|
+
*
|
|
8
|
+
* Features:
|
|
9
|
+
* - **Property selection**: Choose properties using dropdown navigation
|
|
10
|
+
* - **Sort direction**: Toggle between ascending (ASC) and descending (DESC)
|
|
11
|
+
* - **Multiple sort fields**: Add multiple properties to create complex sorting
|
|
12
|
+
* - **Order matters**: Properties are sorted in the order they appear in the list
|
|
13
|
+
* - **Dynamic list**: Add/remove sort fields
|
|
14
|
+
*
|
|
15
|
+
* The component generates an `OrderByItem[]` array where each item specifies
|
|
16
|
+
* a property path and sort direction.
|
|
17
|
+
*
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
export class OrderByEditor {
|
|
21
|
+
constructor() {
|
|
22
|
+
/**
|
|
23
|
+
* Optional label
|
|
24
|
+
*/
|
|
25
|
+
this.label = 'Sort Order';
|
|
26
|
+
this.items = [];
|
|
27
|
+
this.handleItemChange = (index) => (event) => {
|
|
28
|
+
event.stopPropagation();
|
|
29
|
+
const newItems = [...this.items];
|
|
30
|
+
if (event.detail === null) {
|
|
31
|
+
// Remove item
|
|
32
|
+
newItems.splice(index, 1);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
// Update item
|
|
36
|
+
newItems[index] = event.detail;
|
|
37
|
+
}
|
|
38
|
+
this.items = newItems;
|
|
39
|
+
this.emitChange();
|
|
40
|
+
};
|
|
41
|
+
this.handleAddSortField = () => {
|
|
42
|
+
// Add new item with empty path and ASC direction
|
|
43
|
+
this.items = [...this.items, { '': 'ASC' }];
|
|
44
|
+
this.emitChange();
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
componentWillLoad() {
|
|
48
|
+
if (this.value && this.value.length > 0) {
|
|
49
|
+
this.items = [...this.value];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
handleValueChange(newValue) {
|
|
53
|
+
if (!newValue) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
// Check if items have changed
|
|
57
|
+
const itemsChanged = newValue.length !== this.items.length ||
|
|
58
|
+
!newValue.every((item, index) => {
|
|
59
|
+
const currentItem = this.items[index];
|
|
60
|
+
if (!currentItem)
|
|
61
|
+
return false;
|
|
62
|
+
const itemKey = Object.keys(item)[0];
|
|
63
|
+
const currentKey = Object.keys(currentItem)[0];
|
|
64
|
+
return (itemKey === currentKey &&
|
|
65
|
+
item[itemKey] === currentItem[currentKey]);
|
|
66
|
+
});
|
|
67
|
+
if (itemsChanged) {
|
|
68
|
+
this.items = newValue.length > 0 ? [...newValue] : [];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
render() {
|
|
72
|
+
if (!this.limetype) {
|
|
73
|
+
return (h("div", { class: "empty-state" }, h("p", null, "Select a limetype to configure sorting")));
|
|
74
|
+
}
|
|
75
|
+
return (h("div", { class: "order-by-editor" }, h("div", { class: "header" }, h("h4", null, this.label)), this.renderOrderByList(), this.renderActions()));
|
|
76
|
+
}
|
|
77
|
+
renderOrderByList() {
|
|
78
|
+
if (this.items.length === 0) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
return (h("div", { class: "order-by-list" }, this.items.map((item, index) => this.renderItem(item, index))));
|
|
82
|
+
}
|
|
83
|
+
renderActions() {
|
|
84
|
+
return (h("div", { class: "actions" }, h("limel-button", { label: "Add Sort Field", icon: "plus_math", onClick: this.handleAddSortField })));
|
|
85
|
+
}
|
|
86
|
+
renderItem(item, index) {
|
|
87
|
+
const propertyPath = Object.keys(item)[0] || '';
|
|
88
|
+
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) }));
|
|
89
|
+
}
|
|
90
|
+
emitChange() {
|
|
91
|
+
this.change.emit(this.items);
|
|
92
|
+
}
|
|
93
|
+
static get is() { return "limebb-lime-query-order-by-editor"; }
|
|
94
|
+
static get encapsulation() { return "shadow"; }
|
|
95
|
+
static get originalStyleUrls() {
|
|
96
|
+
return {
|
|
97
|
+
"$": ["order-by-editor.scss"]
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
static get styleUrls() {
|
|
101
|
+
return {
|
|
102
|
+
"$": ["order-by-editor.css"]
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
static get properties() {
|
|
106
|
+
return {
|
|
107
|
+
"platform": {
|
|
108
|
+
"type": "unknown",
|
|
109
|
+
"mutable": false,
|
|
110
|
+
"complexType": {
|
|
111
|
+
"original": "LimeWebComponentPlatform",
|
|
112
|
+
"resolved": "LimeWebComponentPlatform",
|
|
113
|
+
"references": {
|
|
114
|
+
"LimeWebComponentPlatform": {
|
|
115
|
+
"location": "import",
|
|
116
|
+
"path": "@limetech/lime-web-components",
|
|
117
|
+
"id": "node_modules::LimeWebComponentPlatform"
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"required": false,
|
|
122
|
+
"optional": false,
|
|
123
|
+
"docs": {
|
|
124
|
+
"tags": [],
|
|
125
|
+
"text": "Platform service provider"
|
|
126
|
+
},
|
|
127
|
+
"getter": false,
|
|
128
|
+
"setter": false
|
|
129
|
+
},
|
|
130
|
+
"context": {
|
|
131
|
+
"type": "unknown",
|
|
132
|
+
"mutable": false,
|
|
133
|
+
"complexType": {
|
|
134
|
+
"original": "LimeWebComponentContext",
|
|
135
|
+
"resolved": "LimeWebComponentContext",
|
|
136
|
+
"references": {
|
|
137
|
+
"LimeWebComponentContext": {
|
|
138
|
+
"location": "import",
|
|
139
|
+
"path": "@limetech/lime-web-components",
|
|
140
|
+
"id": "node_modules::LimeWebComponentContext"
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
"required": false,
|
|
145
|
+
"optional": false,
|
|
146
|
+
"docs": {
|
|
147
|
+
"tags": [],
|
|
148
|
+
"text": "Component context"
|
|
149
|
+
},
|
|
150
|
+
"getter": false,
|
|
151
|
+
"setter": false
|
|
152
|
+
},
|
|
153
|
+
"limetype": {
|
|
154
|
+
"type": "string",
|
|
155
|
+
"mutable": false,
|
|
156
|
+
"complexType": {
|
|
157
|
+
"original": "string",
|
|
158
|
+
"resolved": "string",
|
|
159
|
+
"references": {}
|
|
160
|
+
},
|
|
161
|
+
"required": false,
|
|
162
|
+
"optional": false,
|
|
163
|
+
"docs": {
|
|
164
|
+
"tags": [],
|
|
165
|
+
"text": "The limetype to select properties from"
|
|
166
|
+
},
|
|
167
|
+
"getter": false,
|
|
168
|
+
"setter": false,
|
|
169
|
+
"attribute": "limetype",
|
|
170
|
+
"reflect": false
|
|
171
|
+
},
|
|
172
|
+
"value": {
|
|
173
|
+
"type": "unknown",
|
|
174
|
+
"mutable": false,
|
|
175
|
+
"complexType": {
|
|
176
|
+
"original": "OrderByItem[]",
|
|
177
|
+
"resolved": "OrderByItem[] | undefined",
|
|
178
|
+
"references": {
|
|
179
|
+
"OrderByItem": {
|
|
180
|
+
"location": "import",
|
|
181
|
+
"path": "../lime-query.types",
|
|
182
|
+
"id": "src/components/lime-query-builder/lime-query.types.ts::OrderByItem"
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
"required": false,
|
|
187
|
+
"optional": true,
|
|
188
|
+
"docs": {
|
|
189
|
+
"tags": [],
|
|
190
|
+
"text": "Current order by specification"
|
|
191
|
+
},
|
|
192
|
+
"getter": false,
|
|
193
|
+
"setter": false
|
|
194
|
+
},
|
|
195
|
+
"label": {
|
|
196
|
+
"type": "string",
|
|
197
|
+
"mutable": false,
|
|
198
|
+
"complexType": {
|
|
199
|
+
"original": "string",
|
|
200
|
+
"resolved": "string",
|
|
201
|
+
"references": {}
|
|
202
|
+
},
|
|
203
|
+
"required": false,
|
|
204
|
+
"optional": false,
|
|
205
|
+
"docs": {
|
|
206
|
+
"tags": [],
|
|
207
|
+
"text": "Optional label"
|
|
208
|
+
},
|
|
209
|
+
"getter": false,
|
|
210
|
+
"setter": false,
|
|
211
|
+
"attribute": "label",
|
|
212
|
+
"reflect": false,
|
|
213
|
+
"defaultValue": "'Sort Order'"
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
static get states() {
|
|
218
|
+
return {
|
|
219
|
+
"items": {}
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
static get events() {
|
|
223
|
+
return [{
|
|
224
|
+
"method": "change",
|
|
225
|
+
"name": "change",
|
|
226
|
+
"bubbles": true,
|
|
227
|
+
"cancelable": true,
|
|
228
|
+
"composed": true,
|
|
229
|
+
"docs": {
|
|
230
|
+
"tags": [],
|
|
231
|
+
"text": "Emitted when the order by specification changes"
|
|
232
|
+
},
|
|
233
|
+
"complexType": {
|
|
234
|
+
"original": "OrderByItem[]",
|
|
235
|
+
"resolved": "OrderByItem[]",
|
|
236
|
+
"references": {
|
|
237
|
+
"OrderByItem": {
|
|
238
|
+
"location": "import",
|
|
239
|
+
"path": "../lime-query.types",
|
|
240
|
+
"id": "src/components/lime-query-builder/lime-query.types.ts::OrderByItem"
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}];
|
|
245
|
+
}
|
|
246
|
+
static get watchers() {
|
|
247
|
+
return [{
|
|
248
|
+
"propName": "value",
|
|
249
|
+
"methodName": "handleValueChange"
|
|
250
|
+
}];
|
|
251
|
+
}
|
|
252
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
:host(limebb-lime-query-order-by-item) {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 0.5rem;
|
|
5
|
+
width: 100%;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.order-by-controls {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: row;
|
|
11
|
+
align-items: flex-start;
|
|
12
|
+
gap: 0.5rem;
|
|
13
|
+
width: 100%;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.property-path {
|
|
17
|
+
flex-grow: 1;
|
|
18
|
+
min-width: min(20rem, 100%);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.control-buttons {
|
|
22
|
+
flex-shrink: 0;
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: row;
|
|
25
|
+
gap: 0.25rem;
|
|
26
|
+
align-items: center;
|
|
27
|
+
padding-top: 0.5rem;
|
|
28
|
+
}
|
|
29
|
+
.control-buttons limel-icon-button {
|
|
30
|
+
opacity: 0.6;
|
|
31
|
+
transition: opacity 0.2s ease;
|
|
32
|
+
}
|
|
33
|
+
.control-buttons limel-icon-button:hover {
|
|
34
|
+
opacity: 1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@media (max-width: 768px) {
|
|
38
|
+
.order-by-controls {
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
gap: 0.5rem;
|
|
41
|
+
}
|
|
42
|
+
.control-buttons {
|
|
43
|
+
padding-top: 0;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
/**
|
|
3
|
+
* Order By Item Component
|
|
4
|
+
*
|
|
5
|
+
* Represents a single order by specification with property selection and direction toggle
|
|
6
|
+
* Part of the order by editor
|
|
7
|
+
* @private
|
|
8
|
+
*/
|
|
9
|
+
export class OrderByItemComponent {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.handlePathChange = (event) => {
|
|
12
|
+
event.stopPropagation();
|
|
13
|
+
const newPath = event.detail;
|
|
14
|
+
if (!newPath) {
|
|
15
|
+
// If path is cleared, keep the current item but with empty path
|
|
16
|
+
const currentDirection = this.item[Object.keys(this.item)[0]] || 'ASC';
|
|
17
|
+
this.itemChange.emit({ '': currentDirection });
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
// Get current direction
|
|
21
|
+
const currentPath = Object.keys(this.item)[0];
|
|
22
|
+
const currentDirection = this.item[currentPath] || 'ASC';
|
|
23
|
+
// Create new item with new path but same direction
|
|
24
|
+
const newItem = { [newPath]: currentDirection };
|
|
25
|
+
this.itemChange.emit(newItem);
|
|
26
|
+
};
|
|
27
|
+
this.handleToggleDirection = () => {
|
|
28
|
+
const propertyPath = Object.keys(this.item)[0] || '';
|
|
29
|
+
const currentDirection = this.item[propertyPath] || 'ASC';
|
|
30
|
+
const newDirection = currentDirection === 'ASC' ? 'DESC' : 'ASC';
|
|
31
|
+
const newItem = { [propertyPath]: newDirection };
|
|
32
|
+
this.itemChange.emit(newItem);
|
|
33
|
+
};
|
|
34
|
+
this.handleRemove = () => {
|
|
35
|
+
this.itemChange.emit(null);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
render() {
|
|
39
|
+
const propertyPath = Object.keys(this.item)[0] || '';
|
|
40
|
+
const direction = this.item[propertyPath] || 'ASC';
|
|
41
|
+
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'
|
|
42
|
+
? 'sort_ascending'
|
|
43
|
+
: 'sort_descending', label: direction === 'ASC' ? 'Ascending' : 'Descending', onClick: this.handleToggleDirection }), h("limel-icon-button", { key: '5bc160b38c565e30cca03a88d6f2d181284cefdd', icon: "trash", label: "Remove", onClick: this.handleRemove }))));
|
|
44
|
+
}
|
|
45
|
+
static get is() { return "limebb-lime-query-order-by-item"; }
|
|
46
|
+
static get encapsulation() { return "shadow"; }
|
|
47
|
+
static get originalStyleUrls() {
|
|
48
|
+
return {
|
|
49
|
+
"$": ["order-by-item.scss"]
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
static get styleUrls() {
|
|
53
|
+
return {
|
|
54
|
+
"$": ["order-by-item.css"]
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
static get properties() {
|
|
58
|
+
return {
|
|
59
|
+
"platform": {
|
|
60
|
+
"type": "unknown",
|
|
61
|
+
"mutable": false,
|
|
62
|
+
"complexType": {
|
|
63
|
+
"original": "LimeWebComponentPlatform",
|
|
64
|
+
"resolved": "LimeWebComponentPlatform",
|
|
65
|
+
"references": {
|
|
66
|
+
"LimeWebComponentPlatform": {
|
|
67
|
+
"location": "import",
|
|
68
|
+
"path": "@limetech/lime-web-components",
|
|
69
|
+
"id": "node_modules::LimeWebComponentPlatform"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"required": false,
|
|
74
|
+
"optional": false,
|
|
75
|
+
"docs": {
|
|
76
|
+
"tags": [],
|
|
77
|
+
"text": "Platform service provider"
|
|
78
|
+
},
|
|
79
|
+
"getter": false,
|
|
80
|
+
"setter": false
|
|
81
|
+
},
|
|
82
|
+
"context": {
|
|
83
|
+
"type": "unknown",
|
|
84
|
+
"mutable": false,
|
|
85
|
+
"complexType": {
|
|
86
|
+
"original": "LimeWebComponentContext",
|
|
87
|
+
"resolved": "LimeWebComponentContext",
|
|
88
|
+
"references": {
|
|
89
|
+
"LimeWebComponentContext": {
|
|
90
|
+
"location": "import",
|
|
91
|
+
"path": "@limetech/lime-web-components",
|
|
92
|
+
"id": "node_modules::LimeWebComponentContext"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"required": false,
|
|
97
|
+
"optional": false,
|
|
98
|
+
"docs": {
|
|
99
|
+
"tags": [],
|
|
100
|
+
"text": "Component context"
|
|
101
|
+
},
|
|
102
|
+
"getter": false,
|
|
103
|
+
"setter": false
|
|
104
|
+
},
|
|
105
|
+
"limetype": {
|
|
106
|
+
"type": "string",
|
|
107
|
+
"mutable": false,
|
|
108
|
+
"complexType": {
|
|
109
|
+
"original": "string",
|
|
110
|
+
"resolved": "string",
|
|
111
|
+
"references": {}
|
|
112
|
+
},
|
|
113
|
+
"required": false,
|
|
114
|
+
"optional": false,
|
|
115
|
+
"docs": {
|
|
116
|
+
"tags": [],
|
|
117
|
+
"text": "The limetype to select properties from"
|
|
118
|
+
},
|
|
119
|
+
"getter": false,
|
|
120
|
+
"setter": false,
|
|
121
|
+
"attribute": "limetype",
|
|
122
|
+
"reflect": false
|
|
123
|
+
},
|
|
124
|
+
"item": {
|
|
125
|
+
"type": "unknown",
|
|
126
|
+
"mutable": false,
|
|
127
|
+
"complexType": {
|
|
128
|
+
"original": "OrderByItem",
|
|
129
|
+
"resolved": "{ [propertyPath: string]: \"ASC\" | \"DESC\"; }",
|
|
130
|
+
"references": {
|
|
131
|
+
"OrderByItem": {
|
|
132
|
+
"location": "import",
|
|
133
|
+
"path": "../lime-query.types",
|
|
134
|
+
"id": "src/components/lime-query-builder/lime-query.types.ts::OrderByItem"
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"required": false,
|
|
139
|
+
"optional": false,
|
|
140
|
+
"docs": {
|
|
141
|
+
"tags": [],
|
|
142
|
+
"text": "The order by item (e.g., { \"company.name\": \"ASC\" })"
|
|
143
|
+
},
|
|
144
|
+
"getter": false,
|
|
145
|
+
"setter": false
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
static get events() {
|
|
150
|
+
return [{
|
|
151
|
+
"method": "itemChange",
|
|
152
|
+
"name": "itemChange",
|
|
153
|
+
"bubbles": true,
|
|
154
|
+
"cancelable": true,
|
|
155
|
+
"composed": true,
|
|
156
|
+
"docs": {
|
|
157
|
+
"tags": [],
|
|
158
|
+
"text": "Emitted when the item changes or should be removed"
|
|
159
|
+
},
|
|
160
|
+
"complexType": {
|
|
161
|
+
"original": "OrderByItem | null",
|
|
162
|
+
"resolved": "null | { [propertyPath: string]: \"ASC\" | \"DESC\"; }",
|
|
163
|
+
"references": {
|
|
164
|
+
"OrderByItem": {
|
|
165
|
+
"location": "import",
|
|
166
|
+
"path": "../lime-query.types",
|
|
167
|
+
"id": "src/components/lime-query-builder/lime-query.types.ts::OrderByItem"
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}];
|
|
172
|
+
}
|
|
173
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
|
-
import { propertySelectionToItems, itemsToPropertySelection, } from "
|
|
2
|
+
import { propertySelectionToItems, itemsToPropertySelection, } from "../property-selection-format";
|
|
3
3
|
/**
|
|
4
4
|
* Response Format Editor Component
|
|
5
5
|
*
|
|
@@ -84,7 +84,7 @@ export class ResponseFormatEditor {
|
|
|
84
84
|
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"))));
|
|
85
85
|
}
|
|
86
86
|
renderItem(item, index) {
|
|
87
|
-
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) }));
|
|
87
|
+
return (h("limebb-lime-query-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) }));
|
|
88
88
|
}
|
|
89
89
|
emitChange() {
|
|
90
90
|
const propertySelection = itemsToPropertySelection(this.items);
|
|
@@ -93,7 +93,7 @@ export class ResponseFormatEditor {
|
|
|
93
93
|
};
|
|
94
94
|
this.change.emit(responseFormat);
|
|
95
95
|
}
|
|
96
|
-
static get is() { return "limebb-response-format-editor"; }
|
|
96
|
+
static get is() { return "limebb-lime-query-response-format-editor"; }
|
|
97
97
|
static get encapsulation() { return "shadow"; }
|
|
98
98
|
static get originalStyleUrls() {
|
|
99
99
|
return {
|
|
@@ -181,7 +181,7 @@ export class ResponseFormatEditor {
|
|
|
181
181
|
"references": {
|
|
182
182
|
"ResponseFormat": {
|
|
183
183
|
"location": "import",
|
|
184
|
-
"path": "
|
|
184
|
+
"path": "../lime-query.types",
|
|
185
185
|
"id": "src/components/lime-query-builder/lime-query.types.ts::ResponseFormat"
|
|
186
186
|
}
|
|
187
187
|
}
|
|
@@ -239,7 +239,7 @@ export class ResponseFormatEditor {
|
|
|
239
239
|
"references": {
|
|
240
240
|
"ResponseFormat": {
|
|
241
241
|
"location": "import",
|
|
242
|
-
"path": "
|
|
242
|
+
"path": "../lime-query.types",
|
|
243
243
|
"id": "src/components/lime-query-builder/lime-query.types.ts::ResponseFormat"
|
|
244
244
|
}
|
|
245
245
|
}
|
package/dist/collection/components/lime-query-builder/response-format/response-format-helpers.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper functions for working with ResponseFormat objects
|
|
3
|
+
*
|
|
4
|
+
* These utilities handle parsing, stringifying, and default values
|
|
5
|
+
* for ResponseFormat in isolation (without full LimeQuery wrapper)
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Parse JSON string to ResponseFormat
|
|
9
|
+
*
|
|
10
|
+
* @param json - JSON string to parse
|
|
11
|
+
* @returns Parsed ResponseFormat object
|
|
12
|
+
* @throws Error if JSON is invalid or not a ResponseFormat
|
|
13
|
+
*/
|
|
14
|
+
export function parseResponseFormat(json) {
|
|
15
|
+
let parsed;
|
|
16
|
+
try {
|
|
17
|
+
parsed = JSON.parse(json);
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
throw new Error(`Invalid JSON: ${error.message}`);
|
|
21
|
+
}
|
|
22
|
+
if (parsed === null || typeof parsed !== 'object') {
|
|
23
|
+
throw new Error('Response format must be an object');
|
|
24
|
+
}
|
|
25
|
+
// Validate structure
|
|
26
|
+
const validKeys = new Set(['object', 'aggregates']);
|
|
27
|
+
const keys = Object.keys(parsed);
|
|
28
|
+
// Check for unexpected keys
|
|
29
|
+
const unexpectedKeys = keys.filter((key) => !validKeys.has(key));
|
|
30
|
+
if (unexpectedKeys.length > 0) {
|
|
31
|
+
throw new Error(`Unexpected properties in response format: ${unexpectedKeys.join(', ')}. ` +
|
|
32
|
+
`Only 'object' and 'aggregates' are allowed.`);
|
|
33
|
+
}
|
|
34
|
+
// Must have at least one of object or aggregates
|
|
35
|
+
if (!parsed.object && !parsed.aggregates) {
|
|
36
|
+
throw new Error('Response format must contain at least one of: object, aggregates');
|
|
37
|
+
}
|
|
38
|
+
return parsed;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Stringify ResponseFormat to JSON
|
|
42
|
+
*
|
|
43
|
+
* @param format - ResponseFormat object to stringify
|
|
44
|
+
* @returns Pretty-printed JSON string
|
|
45
|
+
*/
|
|
46
|
+
export function stringifyResponseFormat(format) {
|
|
47
|
+
return JSON.stringify(format, null, 2);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get default ResponseFormat (just _id)
|
|
51
|
+
*
|
|
52
|
+
* @returns Default ResponseFormat with only _id selected
|
|
53
|
+
*/
|
|
54
|
+
export function getDefaultResponseFormat() {
|
|
55
|
+
return {
|
|
56
|
+
object: {
|
|
57
|
+
_id: null,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Check if a parsed JSON object is a valid ResponseFormat
|
|
63
|
+
*
|
|
64
|
+
* This is a more lenient check than parseResponseFormat - it doesn't throw,
|
|
65
|
+
* just returns a boolean with optional error message
|
|
66
|
+
*
|
|
67
|
+
* @param json - Parsed JSON object to check
|
|
68
|
+
* @returns Object with `valid` boolean and optional `error` message
|
|
69
|
+
*/
|
|
70
|
+
export function isValidResponseFormatStructure(json) {
|
|
71
|
+
if (json === null || typeof json !== 'object') {
|
|
72
|
+
return { valid: false, error: 'Response format must be an object' };
|
|
73
|
+
}
|
|
74
|
+
const validKeys = new Set(['object', 'aggregates']);
|
|
75
|
+
const keys = Object.keys(json);
|
|
76
|
+
// Check for unexpected keys
|
|
77
|
+
const unexpectedKeys = keys.filter((key) => !validKeys.has(key));
|
|
78
|
+
if (unexpectedKeys.length > 0) {
|
|
79
|
+
return {
|
|
80
|
+
valid: false,
|
|
81
|
+
error: `Unexpected properties: ${unexpectedKeys.join(', ')}. Only 'object' and 'aggregates' are allowed.`,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
// Must have at least one of object or aggregates
|
|
85
|
+
if (!json.object && !json.aggregates) {
|
|
86
|
+
return {
|
|
87
|
+
valid: false,
|
|
88
|
+
error: 'Response format must contain at least one of: object, aggregates',
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return { valid: true };
|
|
92
|
+
}
|
|
@@ -66,12 +66,12 @@ export class ResponseFormatItem {
|
|
|
66
66
|
}
|
|
67
67
|
render() {
|
|
68
68
|
return [
|
|
69
|
-
h("div", { key: '
|
|
70
|
-
this.showAliasInput && (h("div", { key: '
|
|
71
|
-
this.showDescriptionInput && (h("div", { key: '
|
|
69
|
+
h("div", { key: 'e804c4feb61b44aeb2f141c5b5d3269a76ac9320', class: "property-controls" }, h("div", { key: 'becbf35e823b8b16df5366c099b98ce6566d514a', class: "property-path" }, h("limebb-property-selector", { key: '2b35ccefecb9dbd4d2c418566482d9903a1c0d02', platform: this.platform, context: this.context, limetype: this.limetype, label: "Property", value: this.item.path, required: true, onChange: this.handlePathChange })), h("div", { key: '1e598bbbb6df1c5e93bd4ae5f6b112a745a68df9', class: "control-buttons" }, h("limel-icon-button", { key: 'da7ec3bf553900c96149f2d762c2d40ab97d2fbd', icon: "add_tag", label: "Add alias", class: this.item.alias ? 'has-value' : '', onClick: this.toggleAliasInput }), h("limel-icon-button", { key: '3936855dd72388fc581770f561be809b4ebc0267', icon: "comments", label: "Add description", class: this.item.description ? 'has-value' : '', onClick: this.toggleDescriptionInput }), h("limel-icon-button", { key: '221a2f7399c7c781a583bc344c273f03ae181efb', icon: "trash", label: "Remove property", onClick: this.handleRemove }))),
|
|
70
|
+
this.showAliasInput && (h("div", { key: 'ddd9a21a4a83a3e8fd7d41b13c293746cf5467ae', class: "alias" }, h("limel-input-field", { key: '1c2ec668aa6d864897a57f8aebaf8b60012addb5', label: "Alias", value: this.item.alias || '', placeholder: "Custom property name...", onChange: this.handleAliasChange, onBlur: this.handleAliasBlur }))),
|
|
71
|
+
this.showDescriptionInput && (h("div", { key: 'e989a6293fb50b760e6e7e46a650f27cd44722ba', class: "description" }, h("limel-input-field", { key: '201e61a233a14d832fe450322e782d947ff7187a', label: "Description", value: this.item.description || '', placeholder: "Describe this property for AI...", onChange: this.handleDescriptionChange, onBlur: this.handleDescriptionBlur }))),
|
|
72
72
|
];
|
|
73
73
|
}
|
|
74
|
-
static get is() { return "limebb-response-format-item"; }
|
|
74
|
+
static get is() { return "limebb-lime-query-response-format-item"; }
|
|
75
75
|
static get encapsulation() { return "shadow"; }
|
|
76
76
|
static get originalStyleUrls() {
|
|
77
77
|
return {
|
|
@@ -159,7 +159,7 @@ export class ResponseFormatItem {
|
|
|
159
159
|
"references": {
|
|
160
160
|
"PropertySelectionItem": {
|
|
161
161
|
"location": "import",
|
|
162
|
-
"path": "
|
|
162
|
+
"path": "../property-selection-format",
|
|
163
163
|
"id": "src/components/lime-query-builder/property-selection-format.ts::PropertySelectionItem"
|
|
164
164
|
}
|
|
165
165
|
}
|
|
@@ -198,7 +198,7 @@ export class ResponseFormatItem {
|
|
|
198
198
|
"references": {
|
|
199
199
|
"PropertySelectionItem": {
|
|
200
200
|
"location": "import",
|
|
201
|
-
"path": "
|
|
201
|
+
"path": "../property-selection-format",
|
|
202
202
|
"id": "src/components/lime-query-builder/property-selection-format.ts::PropertySelectionItem"
|
|
203
203
|
}
|
|
204
204
|
}
|