@limetech/lime-crm-building-blocks 1.100.1 → 1.101.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 +7 -0
- package/dist/cjs/lime-crm-building-blocks.cjs.js +1 -1
- package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +132 -26
- package/dist/cjs/{limebb-lime-query-filter-builder_3.cjs.entry.js → limebb-lime-query-filter-builder_4.cjs.entry.js} +85 -0
- package/dist/cjs/limebb-lime-query-order-by-item.cjs.entry.js +51 -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 +2 -0
- package/dist/collection/components/lime-query-builder/lime-query-builder.css +2 -5
- package/dist/collection/components/lime-query-builder/lime-query-builder.js +19 -19
- package/dist/collection/components/lime-query-builder/lime-query-validation.js +114 -7
- 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/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-value-input.js +1 -1
- package/dist/components/limebb-lime-query-builder.js +155 -36
- 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-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/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/summary-popover.js +3 -3
- package/dist/esm/lime-crm-building-blocks.js +1 -1
- package/dist/esm/limebb-lime-query-builder.entry.js +133 -27
- package/dist/esm/{limebb-lime-query-filter-builder_3.entry.js → limebb-lime-query-filter-builder_4.entry.js} +85 -1
- package/dist/esm/limebb-lime-query-filter-group_3.entry.js +1 -1
- package/dist/esm/limebb-lime-query-order-by-item.entry.js +47 -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-58782467.entry.js → p-0cd036ed.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-2725671e.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-76d81eee.entry.js → p-425eaba2.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-79b8b09b.entry.js → p-5cf4898d.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-67c174d0.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-2048ac67.entry.js → p-8601eab5.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-1034b4a5.entry.js → p-8c2fb1c9.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-b57dafef.entry.js → p-92dfc5f8.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-8581245a.entry.js → p-a1ee8990.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-89a6c396.entry.js → p-ccf34631.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-8fb2e192.entry.js → p-d84874dc.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-f9efca1d.entry.js +1 -0
- package/dist/types/components/lime-query-builder/lime-query-builder.d.ts +9 -6
- 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.d.ts +218 -2
- package/package.json +1 -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 @@
|
|
|
1
|
+
import{r as e,c as t,h as i}from"./p-1556b545.js";const o=class{constructor(i){e(this,i),this.itemChange=t(this,"itemChange",7),this.handlePathChange=e=>{e.stopPropagation();const t=e.detail;if(!t){const e=this.item[Object.keys(this.item)[0]]||"ASC";return void this.itemChange.emit({"":e})}const i=Object.keys(this.item)[0],o=this.item[i]||"ASC";this.itemChange.emit({[t]:o})},this.handleToggleDirection=()=>{const e=Object.keys(this.item)[0]||"",t="ASC"===(this.item[e]||"ASC")?"DESC":"ASC";this.itemChange.emit({[e]:t})},this.handleRemove=()=>{this.itemChange.emit(null)}}render(){const e=Object.keys(this.item)[0]||"",t=this.item[e]||"ASC";return i("div",{key:"e0faeb5b370d8aba00a668f0861e8e1cb4eec495",class:"order-by-controls"},i("div",{key:"d013e829ca193b6ce9cc3756c3700584984f4478",class:"property-path"},i("limebb-property-selector",{key:"11dee28e5de28d0dc6934abdfe613e87a8b8fbed",platform:this.platform,context:this.context,limetype:this.limetype,label:"Property",value:e,required:!0,onChange:this.handlePathChange})),i("div",{key:"66aa416b1f9683a15357d609e3685379d8993733",class:"control-buttons"},i("limel-icon-button",{key:"360f271ecd3cf42581ae21617d297c84ee93569e",icon:"ASC"===t?"sort_ascending":"sort_descending",label:"ASC"===t?"Ascending":"Descending",onClick:this.handleToggleDirection}),i("limel-icon-button",{key:"3cbb13bff679a0ca95bb30b7853551b8bc276520",icon:"trash",label:"Remove",onClick:this.handleRemove})))}};o.style=":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}}";export{o as limebb_lime_query_order_by_item}
|
|
@@ -47,6 +47,12 @@ export declare class LimeQueryBuilder implements LimeWebComponent {
|
|
|
47
47
|
* Optional label for the Lime Query builder
|
|
48
48
|
*/
|
|
49
49
|
label: string;
|
|
50
|
+
/**
|
|
51
|
+
* The limetype of the active object (for %activeObject% placeholder validation).
|
|
52
|
+
* When provided, enables placeholder validation and the placeholder input mode.
|
|
53
|
+
* When omitted, placeholders are accepted without validation.
|
|
54
|
+
*/
|
|
55
|
+
activeLimetype?: string;
|
|
50
56
|
/**
|
|
51
57
|
* Emitted when the Lime Query changes
|
|
52
58
|
*/
|
|
@@ -58,12 +64,7 @@ export declare class LimeQueryBuilder implements LimeWebComponent {
|
|
|
58
64
|
private filter;
|
|
59
65
|
private internalResponseFormat?;
|
|
60
66
|
private limit?;
|
|
61
|
-
|
|
62
|
-
* The limetype of the active object (for %activeObject% placeholder validation).
|
|
63
|
-
* When provided, enables placeholder validation and the placeholder input mode.
|
|
64
|
-
* When omitted, placeholders are accepted without validation.
|
|
65
|
-
*/
|
|
66
|
-
activeLimetype?: string;
|
|
67
|
+
private orderBy?;
|
|
67
68
|
private get guiModeEnabled();
|
|
68
69
|
componentWillLoad(): void;
|
|
69
70
|
render(): any;
|
|
@@ -71,8 +72,10 @@ export declare class LimeQueryBuilder implements LimeWebComponent {
|
|
|
71
72
|
private handleFilterChange;
|
|
72
73
|
private handleResponseFormatChange;
|
|
73
74
|
private handleLimitChange;
|
|
75
|
+
private handleOrderByChange;
|
|
74
76
|
private emitChange;
|
|
75
77
|
private updateCodeValue;
|
|
78
|
+
private buildLimeQuery;
|
|
76
79
|
private checkGuiSupport;
|
|
77
80
|
private renderModeSwitch;
|
|
78
81
|
private renderCodeEditor;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { EventEmitter } from '../../../stencil-public-runtime';
|
|
2
|
+
import { LimeWebComponent, LimeWebComponentContext, LimeWebComponentPlatform } from '@limetech/lime-web-components';
|
|
3
|
+
import { OrderByItem } from '../lime-query.types';
|
|
4
|
+
/**
|
|
5
|
+
* Order By Editor Component
|
|
6
|
+
*
|
|
7
|
+
* Allows users to specify the order in which query results should be sorted.
|
|
8
|
+
* Supports sorting by multiple properties with ascending or descending order.
|
|
9
|
+
*
|
|
10
|
+
* Features:
|
|
11
|
+
* - **Property selection**: Choose properties using dropdown navigation
|
|
12
|
+
* - **Sort direction**: Toggle between ascending (ASC) and descending (DESC)
|
|
13
|
+
* - **Multiple sort fields**: Add multiple properties to create complex sorting
|
|
14
|
+
* - **Order matters**: Properties are sorted in the order they appear in the list
|
|
15
|
+
* - **Dynamic list**: Add/remove sort fields
|
|
16
|
+
*
|
|
17
|
+
* The component generates an `OrderByItem[]` array where each item specifies
|
|
18
|
+
* a property path and sort direction.
|
|
19
|
+
*
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
export declare class OrderByEditor implements LimeWebComponent {
|
|
23
|
+
/**
|
|
24
|
+
* Platform service provider
|
|
25
|
+
*/
|
|
26
|
+
platform: LimeWebComponentPlatform;
|
|
27
|
+
/**
|
|
28
|
+
* Component context
|
|
29
|
+
*/
|
|
30
|
+
context: LimeWebComponentContext;
|
|
31
|
+
/**
|
|
32
|
+
* The limetype to select properties from
|
|
33
|
+
*/
|
|
34
|
+
limetype: string;
|
|
35
|
+
/**
|
|
36
|
+
* Current order by specification
|
|
37
|
+
*/
|
|
38
|
+
value?: OrderByItem[];
|
|
39
|
+
/**
|
|
40
|
+
* Optional label
|
|
41
|
+
*/
|
|
42
|
+
label: string;
|
|
43
|
+
private items;
|
|
44
|
+
/**
|
|
45
|
+
* Emitted when the order by specification changes
|
|
46
|
+
*/
|
|
47
|
+
change: EventEmitter<OrderByItem[]>;
|
|
48
|
+
componentWillLoad(): void;
|
|
49
|
+
handleValueChange(newValue?: OrderByItem[]): void;
|
|
50
|
+
render(): any;
|
|
51
|
+
private renderOrderByList;
|
|
52
|
+
private renderActions;
|
|
53
|
+
private renderItem;
|
|
54
|
+
private handleItemChange;
|
|
55
|
+
private handleAddSortField;
|
|
56
|
+
private emitChange;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=order-by-editor.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { EventEmitter } from '../../../stencil-public-runtime';
|
|
2
|
+
import { OrderByItem } from '../lime-query.types';
|
|
3
|
+
import { LimeWebComponent, LimeWebComponentContext, LimeWebComponentPlatform } from '@limetech/lime-web-components';
|
|
4
|
+
/**
|
|
5
|
+
* Order By Item Component
|
|
6
|
+
*
|
|
7
|
+
* Represents a single order by specification with property selection and direction toggle
|
|
8
|
+
* Part of the order by editor
|
|
9
|
+
* @private
|
|
10
|
+
*/
|
|
11
|
+
export declare class OrderByItemComponent implements LimeWebComponent {
|
|
12
|
+
/**
|
|
13
|
+
* Platform service provider
|
|
14
|
+
*/
|
|
15
|
+
platform: LimeWebComponentPlatform;
|
|
16
|
+
/**
|
|
17
|
+
* Component context
|
|
18
|
+
*/
|
|
19
|
+
context: LimeWebComponentContext;
|
|
20
|
+
/**
|
|
21
|
+
* The limetype to select properties from
|
|
22
|
+
*/
|
|
23
|
+
limetype: string;
|
|
24
|
+
/**
|
|
25
|
+
* The order by item (e.g., { "company.name": "ASC" })
|
|
26
|
+
*/
|
|
27
|
+
item: OrderByItem;
|
|
28
|
+
/**
|
|
29
|
+
* Emitted when the item changes or should be removed
|
|
30
|
+
*/
|
|
31
|
+
itemChange: EventEmitter<OrderByItem | null>;
|
|
32
|
+
render(): any;
|
|
33
|
+
private handlePathChange;
|
|
34
|
+
private handleToggleDirection;
|
|
35
|
+
private handleRemove;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=order-by-item.d.ts.map
|
|
@@ -17,7 +17,7 @@ import { DateTimeFormat, NumberFormat, RelativeDateTimeFormat } from "./componen
|
|
|
17
17
|
import { InfoTile } from "./components/info-tile/info-tile";
|
|
18
18
|
import { KanbanGroup } from "./components/kanban/kanban-group/kanban-group.types";
|
|
19
19
|
import { KanbanItem } from "./components/kanban/kanban-item/kanban-item.types";
|
|
20
|
-
import { LimeQuery, ResponseFormat } from "./components/lime-query-builder/lime-query.types";
|
|
20
|
+
import { LimeQuery, OrderByItem, ResponseFormat } from "./components/lime-query-builder/lime-query.types";
|
|
21
21
|
import { LanguagePickerType } from "./components/locale-picker/language-picker.types";
|
|
22
22
|
import { NavigationButtonType } from "./components/navigation-button/navigation-button.types";
|
|
23
23
|
import { NotificationItem } from "./components/notification-list/notification-item/notification-item.types";
|
|
@@ -36,7 +36,7 @@ export { DateTimeFormat, NumberFormat, RelativeDateTimeFormat } from "./componen
|
|
|
36
36
|
export { InfoTile } from "./components/info-tile/info-tile";
|
|
37
37
|
export { KanbanGroup } from "./components/kanban/kanban-group/kanban-group.types";
|
|
38
38
|
export { KanbanItem } from "./components/kanban/kanban-item/kanban-item.types";
|
|
39
|
-
export { LimeQuery, ResponseFormat } from "./components/lime-query-builder/lime-query.types";
|
|
39
|
+
export { LimeQuery, OrderByItem, ResponseFormat } from "./components/lime-query-builder/lime-query.types";
|
|
40
40
|
export { LanguagePickerType } from "./components/locale-picker/language-picker.types";
|
|
41
41
|
export { NavigationButtonType } from "./components/navigation-button/navigation-button.types";
|
|
42
42
|
export { NotificationItem } from "./components/notification-list/notification-item/notification-item.types";
|
|
@@ -1179,6 +1179,66 @@ export namespace Components {
|
|
|
1179
1179
|
*/
|
|
1180
1180
|
"platform": LimeWebComponentPlatform;
|
|
1181
1181
|
}
|
|
1182
|
+
/**
|
|
1183
|
+
* Order By Editor Component
|
|
1184
|
+
* Allows users to specify the order in which query results should be sorted.
|
|
1185
|
+
* Supports sorting by multiple properties with ascending or descending order.
|
|
1186
|
+
* Features:
|
|
1187
|
+
* - **Property selection**: Choose properties using dropdown navigation
|
|
1188
|
+
* - **Sort direction**: Toggle between ascending (ASC) and descending (DESC)
|
|
1189
|
+
* - **Multiple sort fields**: Add multiple properties to create complex sorting
|
|
1190
|
+
* - **Order matters**: Properties are sorted in the order they appear in the list
|
|
1191
|
+
* - **Dynamic list**: Add/remove sort fields
|
|
1192
|
+
* The component generates an `OrderByItem[]` array where each item specifies
|
|
1193
|
+
* a property path and sort direction.
|
|
1194
|
+
* @private
|
|
1195
|
+
*/
|
|
1196
|
+
interface LimebbLimeQueryOrderByEditor {
|
|
1197
|
+
/**
|
|
1198
|
+
* Component context
|
|
1199
|
+
*/
|
|
1200
|
+
"context": LimeWebComponentContext;
|
|
1201
|
+
/**
|
|
1202
|
+
* Optional label
|
|
1203
|
+
*/
|
|
1204
|
+
"label": string;
|
|
1205
|
+
/**
|
|
1206
|
+
* The limetype to select properties from
|
|
1207
|
+
*/
|
|
1208
|
+
"limetype": string;
|
|
1209
|
+
/**
|
|
1210
|
+
* Platform service provider
|
|
1211
|
+
*/
|
|
1212
|
+
"platform": LimeWebComponentPlatform;
|
|
1213
|
+
/**
|
|
1214
|
+
* Current order by specification
|
|
1215
|
+
*/
|
|
1216
|
+
"value"?: OrderByItem[];
|
|
1217
|
+
}
|
|
1218
|
+
/**
|
|
1219
|
+
* Order By Item Component
|
|
1220
|
+
* Represents a single order by specification with property selection and direction toggle
|
|
1221
|
+
* Part of the order by editor
|
|
1222
|
+
* @private
|
|
1223
|
+
*/
|
|
1224
|
+
interface LimebbLimeQueryOrderByItem {
|
|
1225
|
+
/**
|
|
1226
|
+
* Component context
|
|
1227
|
+
*/
|
|
1228
|
+
"context": LimeWebComponentContext;
|
|
1229
|
+
/**
|
|
1230
|
+
* The order by item (e.g., { "company.name": "ASC" })
|
|
1231
|
+
*/
|
|
1232
|
+
"item": OrderByItem;
|
|
1233
|
+
/**
|
|
1234
|
+
* The limetype to select properties from
|
|
1235
|
+
*/
|
|
1236
|
+
"limetype": string;
|
|
1237
|
+
/**
|
|
1238
|
+
* Platform service provider
|
|
1239
|
+
*/
|
|
1240
|
+
"platform": LimeWebComponentPlatform;
|
|
1241
|
+
}
|
|
1182
1242
|
/**
|
|
1183
1243
|
* Query Value Input Component
|
|
1184
1244
|
* Renders an appropriate input control based on the property type and operator.
|
|
@@ -2096,6 +2156,14 @@ export interface LimebbLimeQueryFilterNotCustomEvent<T> extends CustomEvent<T> {
|
|
|
2096
2156
|
detail: T;
|
|
2097
2157
|
target: HTMLLimebbLimeQueryFilterNotElement;
|
|
2098
2158
|
}
|
|
2159
|
+
export interface LimebbLimeQueryOrderByEditorCustomEvent<T> extends CustomEvent<T> {
|
|
2160
|
+
detail: T;
|
|
2161
|
+
target: HTMLLimebbLimeQueryOrderByEditorElement;
|
|
2162
|
+
}
|
|
2163
|
+
export interface LimebbLimeQueryOrderByItemCustomEvent<T> extends CustomEvent<T> {
|
|
2164
|
+
detail: T;
|
|
2165
|
+
target: HTMLLimebbLimeQueryOrderByItemElement;
|
|
2166
|
+
}
|
|
2099
2167
|
export interface LimebbLimeQueryValueInputCustomEvent<T> extends CustomEvent<T> {
|
|
2100
2168
|
detail: T;
|
|
2101
2169
|
target: HTMLLimebbLimeQueryValueInputElement;
|
|
@@ -2947,6 +3015,60 @@ declare global {
|
|
|
2947
3015
|
prototype: HTMLLimebbLimeQueryFilterNotElement;
|
|
2948
3016
|
new (): HTMLLimebbLimeQueryFilterNotElement;
|
|
2949
3017
|
};
|
|
3018
|
+
interface HTMLLimebbLimeQueryOrderByEditorElementEventMap {
|
|
3019
|
+
"change": OrderByItem[];
|
|
3020
|
+
}
|
|
3021
|
+
/**
|
|
3022
|
+
* Order By Editor Component
|
|
3023
|
+
* Allows users to specify the order in which query results should be sorted.
|
|
3024
|
+
* Supports sorting by multiple properties with ascending or descending order.
|
|
3025
|
+
* Features:
|
|
3026
|
+
* - **Property selection**: Choose properties using dropdown navigation
|
|
3027
|
+
* - **Sort direction**: Toggle between ascending (ASC) and descending (DESC)
|
|
3028
|
+
* - **Multiple sort fields**: Add multiple properties to create complex sorting
|
|
3029
|
+
* - **Order matters**: Properties are sorted in the order they appear in the list
|
|
3030
|
+
* - **Dynamic list**: Add/remove sort fields
|
|
3031
|
+
* The component generates an `OrderByItem[]` array where each item specifies
|
|
3032
|
+
* a property path and sort direction.
|
|
3033
|
+
* @private
|
|
3034
|
+
*/
|
|
3035
|
+
interface HTMLLimebbLimeQueryOrderByEditorElement extends Components.LimebbLimeQueryOrderByEditor, HTMLStencilElement {
|
|
3036
|
+
addEventListener<K extends keyof HTMLLimebbLimeQueryOrderByEditorElementEventMap>(type: K, listener: (this: HTMLLimebbLimeQueryOrderByEditorElement, ev: LimebbLimeQueryOrderByEditorCustomEvent<HTMLLimebbLimeQueryOrderByEditorElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
3037
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
3038
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
3039
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
3040
|
+
removeEventListener<K extends keyof HTMLLimebbLimeQueryOrderByEditorElementEventMap>(type: K, listener: (this: HTMLLimebbLimeQueryOrderByEditorElement, ev: LimebbLimeQueryOrderByEditorCustomEvent<HTMLLimebbLimeQueryOrderByEditorElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
|
3041
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
3042
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
3043
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
3044
|
+
}
|
|
3045
|
+
var HTMLLimebbLimeQueryOrderByEditorElement: {
|
|
3046
|
+
prototype: HTMLLimebbLimeQueryOrderByEditorElement;
|
|
3047
|
+
new (): HTMLLimebbLimeQueryOrderByEditorElement;
|
|
3048
|
+
};
|
|
3049
|
+
interface HTMLLimebbLimeQueryOrderByItemElementEventMap {
|
|
3050
|
+
"itemChange": OrderByItem | null;
|
|
3051
|
+
}
|
|
3052
|
+
/**
|
|
3053
|
+
* Order By Item Component
|
|
3054
|
+
* Represents a single order by specification with property selection and direction toggle
|
|
3055
|
+
* Part of the order by editor
|
|
3056
|
+
* @private
|
|
3057
|
+
*/
|
|
3058
|
+
interface HTMLLimebbLimeQueryOrderByItemElement extends Components.LimebbLimeQueryOrderByItem, HTMLStencilElement {
|
|
3059
|
+
addEventListener<K extends keyof HTMLLimebbLimeQueryOrderByItemElementEventMap>(type: K, listener: (this: HTMLLimebbLimeQueryOrderByItemElement, ev: LimebbLimeQueryOrderByItemCustomEvent<HTMLLimebbLimeQueryOrderByItemElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
3060
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
3061
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
3062
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
3063
|
+
removeEventListener<K extends keyof HTMLLimebbLimeQueryOrderByItemElementEventMap>(type: K, listener: (this: HTMLLimebbLimeQueryOrderByItemElement, ev: LimebbLimeQueryOrderByItemCustomEvent<HTMLLimebbLimeQueryOrderByItemElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
|
3064
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
3065
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
3066
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
3067
|
+
}
|
|
3068
|
+
var HTMLLimebbLimeQueryOrderByItemElement: {
|
|
3069
|
+
prototype: HTMLLimebbLimeQueryOrderByItemElement;
|
|
3070
|
+
new (): HTMLLimebbLimeQueryOrderByItemElement;
|
|
3071
|
+
};
|
|
2950
3072
|
interface HTMLLimebbLimeQueryValueInputElementEventMap {
|
|
2951
3073
|
"change": any;
|
|
2952
3074
|
}
|
|
@@ -3491,6 +3613,8 @@ declare global {
|
|
|
3491
3613
|
"limebb-lime-query-filter-expression": HTMLLimebbLimeQueryFilterExpressionElement;
|
|
3492
3614
|
"limebb-lime-query-filter-group": HTMLLimebbLimeQueryFilterGroupElement;
|
|
3493
3615
|
"limebb-lime-query-filter-not": HTMLLimebbLimeQueryFilterNotElement;
|
|
3616
|
+
"limebb-lime-query-order-by-editor": HTMLLimebbLimeQueryOrderByEditorElement;
|
|
3617
|
+
"limebb-lime-query-order-by-item": HTMLLimebbLimeQueryOrderByItemElement;
|
|
3494
3618
|
"limebb-lime-query-value-input": HTMLLimebbLimeQueryValueInputElement;
|
|
3495
3619
|
"limebb-limeobject-file-viewer": HTMLLimebbLimeobjectFileViewerElement;
|
|
3496
3620
|
"limebb-limetype-field": HTMLLimebbLimetypeFieldElement;
|
|
@@ -4765,6 +4889,74 @@ declare namespace LocalJSX {
|
|
|
4765
4889
|
*/
|
|
4766
4890
|
"platform"?: LimeWebComponentPlatform;
|
|
4767
4891
|
}
|
|
4892
|
+
/**
|
|
4893
|
+
* Order By Editor Component
|
|
4894
|
+
* Allows users to specify the order in which query results should be sorted.
|
|
4895
|
+
* Supports sorting by multiple properties with ascending or descending order.
|
|
4896
|
+
* Features:
|
|
4897
|
+
* - **Property selection**: Choose properties using dropdown navigation
|
|
4898
|
+
* - **Sort direction**: Toggle between ascending (ASC) and descending (DESC)
|
|
4899
|
+
* - **Multiple sort fields**: Add multiple properties to create complex sorting
|
|
4900
|
+
* - **Order matters**: Properties are sorted in the order they appear in the list
|
|
4901
|
+
* - **Dynamic list**: Add/remove sort fields
|
|
4902
|
+
* The component generates an `OrderByItem[]` array where each item specifies
|
|
4903
|
+
* a property path and sort direction.
|
|
4904
|
+
* @private
|
|
4905
|
+
*/
|
|
4906
|
+
interface LimebbLimeQueryOrderByEditor {
|
|
4907
|
+
/**
|
|
4908
|
+
* Component context
|
|
4909
|
+
*/
|
|
4910
|
+
"context"?: LimeWebComponentContext;
|
|
4911
|
+
/**
|
|
4912
|
+
* Optional label
|
|
4913
|
+
*/
|
|
4914
|
+
"label"?: string;
|
|
4915
|
+
/**
|
|
4916
|
+
* The limetype to select properties from
|
|
4917
|
+
*/
|
|
4918
|
+
"limetype"?: string;
|
|
4919
|
+
/**
|
|
4920
|
+
* Emitted when the order by specification changes
|
|
4921
|
+
*/
|
|
4922
|
+
"onChange"?: (event: LimebbLimeQueryOrderByEditorCustomEvent<OrderByItem[]>) => void;
|
|
4923
|
+
/**
|
|
4924
|
+
* Platform service provider
|
|
4925
|
+
*/
|
|
4926
|
+
"platform"?: LimeWebComponentPlatform;
|
|
4927
|
+
/**
|
|
4928
|
+
* Current order by specification
|
|
4929
|
+
*/
|
|
4930
|
+
"value"?: OrderByItem[];
|
|
4931
|
+
}
|
|
4932
|
+
/**
|
|
4933
|
+
* Order By Item Component
|
|
4934
|
+
* Represents a single order by specification with property selection and direction toggle
|
|
4935
|
+
* Part of the order by editor
|
|
4936
|
+
* @private
|
|
4937
|
+
*/
|
|
4938
|
+
interface LimebbLimeQueryOrderByItem {
|
|
4939
|
+
/**
|
|
4940
|
+
* Component context
|
|
4941
|
+
*/
|
|
4942
|
+
"context"?: LimeWebComponentContext;
|
|
4943
|
+
/**
|
|
4944
|
+
* The order by item (e.g., { "company.name": "ASC" })
|
|
4945
|
+
*/
|
|
4946
|
+
"item"?: OrderByItem;
|
|
4947
|
+
/**
|
|
4948
|
+
* The limetype to select properties from
|
|
4949
|
+
*/
|
|
4950
|
+
"limetype"?: string;
|
|
4951
|
+
/**
|
|
4952
|
+
* Emitted when the item changes or should be removed
|
|
4953
|
+
*/
|
|
4954
|
+
"onItemChange"?: (event: LimebbLimeQueryOrderByItemCustomEvent<OrderByItem | null>) => void;
|
|
4955
|
+
/**
|
|
4956
|
+
* Platform service provider
|
|
4957
|
+
*/
|
|
4958
|
+
"platform"?: LimeWebComponentPlatform;
|
|
4959
|
+
}
|
|
4768
4960
|
/**
|
|
4769
4961
|
* Query Value Input Component
|
|
4770
4962
|
* Renders an appropriate input control based on the property type and operator.
|
|
@@ -5669,6 +5861,8 @@ declare namespace LocalJSX {
|
|
|
5669
5861
|
"limebb-lime-query-filter-expression": LimebbLimeQueryFilterExpression;
|
|
5670
5862
|
"limebb-lime-query-filter-group": LimebbLimeQueryFilterGroup;
|
|
5671
5863
|
"limebb-lime-query-filter-not": LimebbLimeQueryFilterNot;
|
|
5864
|
+
"limebb-lime-query-order-by-editor": LimebbLimeQueryOrderByEditor;
|
|
5865
|
+
"limebb-lime-query-order-by-item": LimebbLimeQueryOrderByItem;
|
|
5672
5866
|
"limebb-lime-query-value-input": LimebbLimeQueryValueInput;
|
|
5673
5867
|
"limebb-limeobject-file-viewer": LimebbLimeobjectFileViewer;
|
|
5674
5868
|
"limebb-limetype-field": LimebbLimetypeField;
|
|
@@ -6058,6 +6252,28 @@ declare module "@stencil/core" {
|
|
|
6058
6252
|
* @private
|
|
6059
6253
|
*/
|
|
6060
6254
|
"limebb-lime-query-filter-not": LocalJSX.LimebbLimeQueryFilterNot & JSXBase.HTMLAttributes<HTMLLimebbLimeQueryFilterNotElement>;
|
|
6255
|
+
/**
|
|
6256
|
+
* Order By Editor Component
|
|
6257
|
+
* Allows users to specify the order in which query results should be sorted.
|
|
6258
|
+
* Supports sorting by multiple properties with ascending or descending order.
|
|
6259
|
+
* Features:
|
|
6260
|
+
* - **Property selection**: Choose properties using dropdown navigation
|
|
6261
|
+
* - **Sort direction**: Toggle between ascending (ASC) and descending (DESC)
|
|
6262
|
+
* - **Multiple sort fields**: Add multiple properties to create complex sorting
|
|
6263
|
+
* - **Order matters**: Properties are sorted in the order they appear in the list
|
|
6264
|
+
* - **Dynamic list**: Add/remove sort fields
|
|
6265
|
+
* The component generates an `OrderByItem[]` array where each item specifies
|
|
6266
|
+
* a property path and sort direction.
|
|
6267
|
+
* @private
|
|
6268
|
+
*/
|
|
6269
|
+
"limebb-lime-query-order-by-editor": LocalJSX.LimebbLimeQueryOrderByEditor & JSXBase.HTMLAttributes<HTMLLimebbLimeQueryOrderByEditorElement>;
|
|
6270
|
+
/**
|
|
6271
|
+
* Order By Item Component
|
|
6272
|
+
* Represents a single order by specification with property selection and direction toggle
|
|
6273
|
+
* Part of the order by editor
|
|
6274
|
+
* @private
|
|
6275
|
+
*/
|
|
6276
|
+
"limebb-lime-query-order-by-item": LocalJSX.LimebbLimeQueryOrderByItem & JSXBase.HTMLAttributes<HTMLLimebbLimeQueryOrderByItemElement>;
|
|
6061
6277
|
/**
|
|
6062
6278
|
* Query Value Input Component
|
|
6063
6279
|
* Renders an appropriate input control based on the property type and operator.
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as e,h as i}from"./p-1556b545.js";import{Z as s,c as o}from"./p-4838284a.js";import{b as r}from"./p-20bfca36.js";import{i as n}from"./p-1484e300.js";import{b as l}from"./p-a659d55a.js";import{i as a,a as h,b as c}from"./p-b31772c8.js";import"./p-35897ec3.js";import"./p-fe2b91d9.js";import"./p-5322fd19.js";function p(t){return"string"==typeof t||!a(t)&&h(t)&&"[object String]"==c(t)}const d=class{constructor(i){t(this,i),this.expressionChange=e(this,"expressionChange",7),this.handleAddFirstCondition=()=>{this.expressionChange.emit({key:"",op:s.EQUALS,exp:""})},this.handlePromoteAndAdd=()=>{this.expression&&this.expressionChange.emit({op:s.AND,exp:[this.expression,{key:"",op:s.EQUALS,exp:""}]})},this.handleExpressionChange=t=>{var e;t.stopPropagation(),this.expressionChange.emit(null!==(e=t.detail)&&void 0!==e?e:void 0)}}render(){return this.expression?this.needsPromotion()?this.renderWithPromotionButton():i("limebb-lime-query-filter-expression",{platform:this.platform,context:this.context,limetype:this.limetype,activeLimetype:this.activeLimetype,expression:this.expression,onExpressionChange:this.handleExpressionChange}):this.renderEmptyState()}needsPromotion(){return!!this.expression&&("key"in this.expression||this.expression.op===s.NOT)}renderEmptyState(){return i("limel-button",{label:"Add a condition",icon:"plus_math",onClick:this.handleAddFirstCondition})}renderWithPromotionButton(){return i("div",{class:"expression-with-promotion"},i("limebb-lime-query-filter-expression",{platform:this.platform,context:this.context,limetype:this.limetype,activeLimetype:this.activeLimetype,expression:this.expression,onExpressionChange:this.handleExpressionChange}),i("limel-button",{label:"Add another condition",icon:"plus_math",onClick:this.handlePromoteAndAdd}))}};d.style=".expression-with-promotion{display:flex;flex-direction:column;gap:1rem}";const m=["string","text","phone","integer","decimal","percent","time","date","year","quarter","month","yesno","link","user","xml","option","set","file","system"],u=m.filter((t=>"system"!==t));u.push("belongsto","hasone","hasmany","hasandbelongstomany");const f=class{constructor(i){t(this,i),this.change=e(this,"change",7),this.propertyFields=[],this.fieldName="limetype",this.handleChange=t=>{t.stopPropagation();let e="";t.detail&&"value"in t.detail&&(e=t.detail.value),this.change.emit(e||void 0)}}componentWillLoad(){const t=this.platform.get(o.Application).getLanguage();this.collator=new Intl.Collator(t,{numeric:!0,sensitivity:"base"})}componentShouldUpdate(t,e,i){var s,o,r,n;return"formInfo"!==i||(r=null===(s=null==t?void 0:t.schema)||void 0===s?void 0:s.oneOf,n=null===(o=null==e?void 0:e.schema)||void 0===o?void 0:o.oneOf,!l(r,n))}render(){var t;const e=this.getLimeTypes().map(b);e.sort(((t,e)=>this.collator.compare(t.text,e.text)));let s=e.find((t=>t.value===this.value)),o=this.invalid;return this.value&&!s&&(o=!0,e.unshift({text:(null===(t=this.limeTypeRepository.getLimeType(this.value))||void 0===t?void 0:t.localname.singular)||this.value,value:this.value}),s=e[0]),e.unshift({text:"",value:""}),i("limel-select",{key:"fd9522c5df730f65a5ac57140bca6c05c5acd63d",label:this.label,options:e,value:s,required:this.required,helperText:this.helperText,invalid:o,disabled:this.disabled||this.readonly,onChange:this.handleChange})}componentWillRender(){this.updatePropertyFields(this.value||"")}getLimeTypes(){var t,e;let i=this.limetypes;return(null===(e=null===(t=this.formInfo)||void 0===t?void 0:t.schema)||void 0===e?void 0:e.oneOf)&&(i=this.formInfo.schema.oneOf.map((t=>t.const)).filter(p)),i?i.map((t=>this.limeTypeRepository.getLimeType(t))).filter(n):this.limeTypeRepository.getLimeTypes()}updatePropertyFields(t){for(const e of this.propertyFields)e.limetype=t,e.allowedPropertyTypes===m&&(e.allowedPropertyTypes=u)}get limeTypeRepository(){return this.platform.get(o.LimeTypeRepository)}},b=t=>({text:t.localname.singular,value:t.name,icon:r(t)});function y(t,e,i){if(null===i)return void t.push({path:e});const s=i,o="_alias"in s,r="#description"in s,n=Object.keys(s).filter((t=>"_alias"!==t&&"#description"!==t));if(0!==n.length)if(o||r){const i={};for(const t of n)i[t]=s[t];t.push(...v(i,e))}else t.push(...v(i,e));else{const i=s._alias,o=s["#description"];t.push(i||o?{path:e,alias:i,description:o}:{path:e})}}function v(t,e=""){if(!t)return[];const i=[];for(const[s,o]of Object.entries(t))"object"==typeof o&&y(i,e?`${e}.${s}`:s,o);return i}function g(t,e,i){const s=t[e];if(s&&"object"==typeof s&&!("_alias"in s)&&!("#description"in s))return;const o={};i.alias&&""!==i.alias.trim()&&(o._alias=i.alias),i.description&&""!==i.description.trim()&&(o["#description"]=i.description),t[e]=Object.keys(o).length>0?o:null}function x(t,e){const i=t[e];if(!i)return t[e]={},t[e];if("object"==typeof i){const t=i;return Object.keys(t).filter((t=>"_alias"!==t&&"#description"!==t)),t}return t[e]={},t[e]}const j=class{constructor(i){t(this,i),this.change=e(this,"change",7),this.label="Select Properties to Return",this.items=[{path:"_id"}],this.handleItemChange=t=>e=>{e.stopPropagation();const i=[...this.items];null===e.detail?i.splice(t,1):i[t]=e.detail,0===i.length&&i.push({path:"_id"}),this.items=i,this.emitChange()},this.handleAddProperty=()=>{this.items=[...this.items,{path:""}],this.emitChange()}}componentWillLoad(){var t;if(null===(t=this.value)||void 0===t?void 0:t.object){const t=v(this.value.object);t.length>0&&(this.items=t)}}componentWillUpdate(){var t;if(null===(t=this.value)||void 0===t?void 0:t.object){const t=v(this.value.object);(t.length!==this.items.length||!t.every(((t,e)=>{const i=this.items[e];return i&&t.path===i.path&&t.alias===i.alias&&t.description===i.description})))&&(this.items=t.length>0?t:[{path:"_id"}])}}render(){return this.limetype?i("div",{class:"response-format-editor"},i("div",{class:"header"},i("h4",null,this.label)),i("div",{class:"property-list"},this.items.map(((t,e)=>this.renderItem(t,e)))),i("div",{class:"actions"},i("limel-button",{label:"Add Property",icon:"plus_math",onClick:this.handleAddProperty})),i("div",{class:"summary"},i("span",{class:"count"},this.items.length," ",1===this.items.length?"property":"properties"," ","selected"))):i("div",{class:"empty-state"},i("p",null,"Select a limetype to choose properties"))}renderItem(t,e){return i("limebb-response-format-item",{key:`${t.path}-${e}`,class:"property-item",platform:this.platform,context:this.context,limetype:this.limetype,item:t,onItemChange:this.handleItemChange(e)})}emitChange(){const t=function(t){const e={};for(const i of t){const t=i.path.split(".");let s=e;for(let e=0;e<t.length;e++){const o=t[e];e===t.length-1?g(s,o,i):s=x(s,o)}}return e}(this.items);this.change.emit({object:t})}};j.style=":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}";export{d as limebb_lime_query_filter_builder,f as limebb_limetype_field,j as limebb_response_format_editor}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as i,h as e}from"./p-1556b545.js";import{Z as r,T as o}from"./p-4838284a.js";import{g as n,a as s}from"./p-e0ab1554.js";const l=new Set(["$yesterday","$now","$today","$tomorrow","$this_week","$this_month","$this_quarter","$this_year"]),a=/^\$(previous|next)_(day|week|month|quarter|year)\(\d+\)$/,d=/^\$me(\.\w+)*$/;function c(t,i,e=!0){const r=Object.keys(t),o=[];if(e){const t=r.filter((t=>t.startsWith("#")&&"#description"!==t));t.length>0&&o.push(`Property '${i}' contains # properties not supported in GUI: ${t.join(", ")}`)}return{keys:r.filter((t=>"_alias"!==t&&!t.startsWith("#"))),guiLimitations:o}}function u(t,i,e,r,o,n=!0){if(""===t){if(n&&null!==i)throw new Error("Empty property name must have null value");return[]}const s=e[t];if(!s)throw new Error(`Property '${t}' does not exist on limetype '${o}'`);return s.relation?function(t,i,e,r,o=!0){if(null===i)return[];if("object"!=typeof i)throw new TypeError(`Relation property '${t}' must be null or an object`);const n=i,{keys:s,guiLimitations:l}=c(n,t,o);if(0===s.length)return l;const a=r.relation.getLimetype();if(!a)throw new Error(`Could not determine related limetype for property '${t}'`);const d={};for(const t of s)d[t]=n[t];const u=h(d,e,a.name,o);return[...l,...u]}(t,i,r,s,n):function(t,i,e=!0){if(null===i)return[];if("object"==typeof i){const{keys:r,guiLimitations:o}=c(i,t,e);if(0===r.length)return o;throw new Error(`Non-relation property '${t}' cannot have nested properties other than _alias or # properties (got: ${r.join(", ")})`)}throw new Error(`Non-relation property '${t}' must be null or an object (got ${typeof i})`)}(t,i,n)}function h(t,i,e,r=!0){const o=i[e];if(!o)throw new Error(`Unknown limetype: ${e}`);const s=n(o),l=[];for(const[o,n]of Object.entries(t)){if(o.startsWith("#"))continue;const t=u(o,n,s,i,e,r);l.push(...t)}return l}function m(t,i,e,o=!0){t&&("key"in t?function(t,i,e){if(!Object.values(r).includes(t.op))throw new Error(`Unsupported filter operator: ${t.op}`);const o=function(t,i,e){if(function(t){return"string"==typeof t&&(l.has(t)||a.test(t)||d.test(t))}(t))return{valid:!0};if("string"!=typeof t||!t.startsWith("%activeObject%"))return{valid:!0};if(!i)return{valid:!0};const r=t.replace(/^%activeObject%\.?/,"");if(!r)return{valid:!0};try{return s(e,i,r)?{valid:!0}:{valid:!1,error:`Property path '${r}' does not exist on limetype '${i}'`}}catch(t){return{valid:!1,error:`Invalid placeholder path: ${t.message}`}}}(t.exp,i,e);if(!o.valid)throw new Error(`Invalid placeholder in filter '${t.key}': ${o.error}`)}(t,i,e):"exp"in t&&function(t,i,e,o){if(t.op!==r.AND&&t.op!==r.OR&&t.op!==r.NOT)throw new Error(`Unsupported group operator: ${t.op}`);if(t.op===r.NOT)m(t.exp,i,e,o);else if(t.op===r.AND||t.op===r.OR){const r=t.exp;for(const t of r)m(t,i,e,o)}}(t,i,e,o))}function p(t,i,e,r=!0){if(!t)return{valid:!0,guiSupported:!0,validationErrors:[],guiLimitations:[]};const o=[],n=[];if(t.limetype&&!i[t.limetype]&&o.push(`Unknown limetype: ${t.limetype}`),void 0===t.offset||t.orderBy||o.push("offset requires orderBy to be specified"),r&&(t.orderBy&&n.push("orderBy is not yet supported in GUI mode"),void 0!==t.offset&&n.push("offset is not yet supported in GUI mode")),t.filter){const n=function(t,i,e,r){const o=[];try{m(t,i,e,r)}catch(t){o.push(`Invalid filter: ${t.message}`)}return o}(t.filter,e,i,r);o.push(...n)}if(t.responseFormat){const{errors:e,limitations:s}=function(t,i,e,r){const o=[],n=[];try{const o=function(t,i,e,r=!0){const o=[];if(r&&t.aggregates&&o.push("responseFormat.aggregates is not yet supported in GUI mode"),t.object){const n=h(t.object,i,e,r);o.push(...n)}return o}(t,i,e,r);n.push(...o)}catch(t){o.push(`Invalid responseFormat: ${t.message}`)}return{errors:o,limitations:n}}(t.responseFormat,i,t.limetype,r);o.push(...e),n.push(...s)}return{valid:0===o.length,guiSupported:0===n.length,validationErrors:o,guiLimitations:n}}const f=class{constructor(e){t(this,e),this.change=i(this,"change",7),this.mode="gui",this.codeValue="",this.limetype="",this.handleLimetypeChange=t=>{t.stopPropagation(),this.limetype=t.detail,this.filter=void 0,this.internalResponseFormat={object:{_id:null}},this.emitChange()},this.handleFilterChange=t=>{var i;t.stopPropagation(),this.filter=null!==(i=t.detail)&&void 0!==i?i:void 0,this.emitChange()},this.handleResponseFormatChange=t=>{t.stopPropagation(),this.internalResponseFormat=t.detail,this.emitChange()},this.handleLimitChange=t=>{t.stopPropagation();const i=t.detail;this.limit=i?Number.parseInt(i,10):void 0,this.emitChange()},this.switchToGui=()=>{try{const t=JSON.parse(this.codeValue);if(!this.checkGuiSupport().guiSupported)return;this.limetype=t.limetype||"",this.filter=t.filter,this.internalResponseFormat=t.responseFormat,this.limit=t.limit,this.mode="gui",this.change.emit(t)}catch(t){}},this.switchToCode=()=>{this.updateCodeValue(),this.mode="code"},this.handleCodeChange=t=>{t.stopPropagation(),this.codeValue=t.detail;try{const t=JSON.parse(this.codeValue);this.change.emit(t)}catch(t){}}}get guiModeEnabled(){var t,i,e;return null!==(e=null===(i=null===(t=this.platform)||void 0===t?void 0:t.isFeatureEnabled)||void 0===i?void 0:i.call(t,"useLimeQueryBuilderGuiMode"))&&void 0!==e&&e}componentWillLoad(){if(!this.guiModeEnabled)return this.mode="code",void this.updateCodeValue();this.value&&(this.limetype=this.value.limetype||"",this.filter=this.value.filter,this.internalResponseFormat=this.value.responseFormat,this.limit=this.value.limit),this.updateCodeValue(),this.checkGuiSupport().guiSupported||(this.mode="code")}render(){const t=this.checkGuiSupport(),i=!this.guiModeEnabled||"code"===this.mode;return e("div",{key:"0b4d2bb5b4d503a775d8d3215e1e4c74fdb1eceb",class:"lime-query-builder"},this.renderLabel(),this.renderModeControls(t),i?this.renderCodeMode(t):this.renderGuiMode())}emitChange(){if("code"===this.mode)return;if(!this.limetype)return;const t={limetype:this.limetype,responseFormat:this.internalResponseFormat||{object:{_id:null}},filter:this.filter};void 0!==this.limit&&this.limit>0&&(t.limit=this.limit),this.change.emit(t)}updateCodeValue(){if(!this.limetype)return void(this.codeValue=JSON.stringify(this.value||{},null,2));const t={limetype:this.limetype,responseFormat:this.internalResponseFormat||{object:{_id:null}},filter:this.filter};void 0!==this.limit&&this.limit>0&&(t.limit=this.limit),this.codeValue=JSON.stringify(t,null,2)}checkGuiSupport(){if(!this.limetypes)return{valid:!0,guiSupported:!0,validationErrors:[],guiLimitations:[]};let t;if("code"===this.mode&&this.codeValue)try{t=JSON.parse(this.codeValue)}catch(t){return{valid:!1,guiSupported:!1,validationErrors:["Invalid JSON"],guiLimitations:[]}}else{if(!this.limetype)return{valid:!0,guiSupported:!0,validationErrors:[],guiLimitations:[]};t={limetype:this.limetype,responseFormat:this.internalResponseFormat||{object:{_id:null}},filter:this.filter},void 0!==this.limit&&this.limit>0&&(t.limit=this.limit)}return p(t,this.limetypes,this.activeLimetype,this.guiModeEnabled)}renderModeSwitch(t){return e("div",{class:"mode-switch"},e("limel-button",{label:"GUI",primary:"gui"===this.mode,disabled:!t.guiSupported,onClick:this.switchToGui}),e("limel-button",{label:"Code",primary:"code"===this.mode,onClick:this.switchToCode}))}renderCodeEditor(t){return e("div",{class:"code-editor-container"},e("limel-code-editor",{value:this.codeValue,language:"json",lineNumbers:!0,fold:!0,lint:!0,onChange:this.handleCodeChange}),!t.valid&&t.validationErrors.length>0&&e("div",{class:"validation-errors"},e("strong",null,"Invalid Lime Query:"),e("ul",null,t.validationErrors.map((t=>e("li",null,t))))),this.guiModeEnabled&&t.valid&&!t.guiSupported&&t.guiLimitations.length>0&&e("div",{class:"gui-limitations"},e("strong",null,"Cannot switch to GUI mode:"),e("ul",null,t.guiLimitations.map((t=>e("li",null,t))))))}renderLimetypeSection(){return e("div",{class:"limetype-section"},e("limebb-limetype-field",{platform:this.platform,context:this.context,label:"Object Type",value:this.limetype,required:!0,fieldName:"limetype",helperText:"Select the type of object you want to query",onChange:this.handleLimetypeChange}))}renderResponseFormatSection(){if(this.limetype)return e("div",{class:"response-format-section"},e("limebb-response-format-editor",{platform:this.platform,context:this.context,limetype:this.limetype,value:this.internalResponseFormat,onChange:this.handleResponseFormatChange}))}renderFilterSection(){if(this.limetype)return e("div",{class:"filter-section"},e("h4",{class:"section-label"},"Filter Conditions"),e("limebb-lime-query-filter-builder",{platform:this.platform,context:this.context,limetype:this.limetype,activeLimetype:this.activeLimetype,expression:this.filter,onExpressionChange:this.handleFilterChange}))}renderQueryOptionsSection(){var t;if(this.limetype)return e("div",{class:"query-options-section"},e("h4",{class:"section-label"},"Query Options"),e("div",{class:"query-options-controls"},e("limel-input-field",{label:"Limit",type:"number",value:(null===(t=this.limit)||void 0===t?void 0:t.toString())||"",placeholder:"No limit",helperText:"Maximum number of results",onChange:this.handleLimitChange})))}renderGuiMode(){return e("div",{class:"gui-mode"},this.renderLimetypeSection(),this.renderResponseFormatSection(),this.renderFilterSection(),this.renderQueryOptionsSection())}renderLabel(){if(this.label)return e("h3",{class:"lime-query-builder-label"},this.label)}renderModeControls(t){if(this.guiModeEnabled)return e("div",{class:"mode-controls"},this.renderModeSwitch(t))}renderCodeMode(t){return e("div",{class:"code-mode"},this.renderCodeEditor(t))}};(function(t,i,e,r){var o,n=arguments.length,s=n<3?i:null===r?r=Object.getOwnPropertyDescriptor(i,e):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,i,e,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(s=(n<3?o(s):n>3?o(i,e,s):o(i,e))||s);n>3&&s&&Object.defineProperty(i,e,s)})([o()],f.prototype,"limetypes",void 0),f.style=":host(limebb-lime-lime-query-builder){display:block;width:100%}.lime-query-builder{display:flex;flex-direction:column;gap:2rem}.mode-controls{display:flex;align-items:center;gap:0.5rem;padding:0.5rem}.mode-switch{display:flex;align-items:center;gap:0.5rem}.mode-switch limel-button{min-width:5rem}.mode-switch limel-helper-text{margin-left:1rem;color:rgb(var(--color-red-default))}.gui-mode,.code-mode{display:block}.code-editor-container{--code-editor-max-height:70vh;display:flex;flex-direction:column;gap:1rem}.code-editor-container .validation-errors{padding:0.75rem 1rem;color:rgb(var(--color-red-default));background-color:rgb(var(--color-red-lighter));border-left:0.25rem solid rgb(var(--color-red-default));border-radius:0.25rem;font-size:0.875rem}.code-editor-container .validation-errors strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-editor-container .validation-errors ul{margin:0;padding-left:1.5rem}.code-editor-container .validation-errors li{margin:0.25rem 0}.code-editor-container .gui-limitations{padding:0.75rem 1rem;color:rgb(var(--color-blue-dark));background-color:rgb(var(--color-blue-lighter));border-left:0.25rem solid rgb(var(--color-blue-default));border-radius:0.25rem;font-size:0.875rem}.code-editor-container .gui-limitations strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-editor-container .gui-limitations ul{margin:0;padding-left:1.5rem}.code-editor-container .gui-limitations li{margin:0.25rem 0}.lime-query-builder-label{margin:0;font-size:1.5rem;font-weight:600;color:rgb(var(--contrast-1100))}.limetype-section{display:flex;flex-direction:column}.filter-section,.query-options-section{display:flex;flex-direction:column;gap:1rem}.section-label{margin:0;font-size:1.125rem;font-weight:600;color:rgb(var(--contrast-1000))}.query-options-controls{display:grid;grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));gap:1rem}@media (max-width: 768px){.lime-query-builder{gap:1.5rem}.query-options-controls{grid-template-columns:1fr}}";export{f as limebb_lime_query_builder}
|