@limetech/lime-crm-building-blocks 1.104.0 → 1.104.1
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-query-validation-6be10fa7.js → lime-query-validation-82aa2855.js} +84 -84
- package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +44 -43
- package/dist/cjs/limebb-lime-query-filter-builder_3.cjs.entry.js +1 -1
- package/dist/cjs/limebb-lime-query-response-format-builder.cjs.entry.js +42 -42
- package/dist/collection/components/lime-query-builder/lime-query-builder.css +9 -9
- package/dist/collection/components/lime-query-builder/lime-query-builder.js +42 -41
- package/dist/collection/components/lime-query-builder/lime-query-response-format-builder.css +5 -5
- package/dist/collection/components/lime-query-builder/lime-query-response-format-builder.js +42 -42
- package/dist/collection/components/lime-query-builder/lime-query-validation.js +84 -84
- package/dist/collection/components/lime-query-builder/order-by/order-by-editor.css +2 -2
- package/dist/collection/components/lime-query-builder/response-format/response-format-helpers.js +2 -2
- package/dist/components/lime-query-validation.js +84 -84
- package/dist/components/limebb-lime-query-builder.js +43 -42
- package/dist/components/limebb-lime-query-response-format-builder.js +41 -41
- package/dist/components/order-by-editor.js +1 -1
- package/dist/esm/{lime-query-validation-573223a5.js → lime-query-validation-9e386da8.js} +84 -84
- package/dist/esm/limebb-lime-query-builder.entry.js +44 -43
- package/dist/esm/limebb-lime-query-filter-builder_3.entry.js +1 -1
- package/dist/esm/limebb-lime-query-response-format-builder.entry.js +42 -42
- package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
- package/dist/lime-crm-building-blocks/{p-6c7af6bb.entry.js → p-7d2188aa.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-7fbb6eba.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-ac9e81c9.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-efa5bcd4.js +1 -0
- package/dist/types/components/lime-query-builder/lime-query-builder.d.ts +3 -3
- package/dist/types/components/lime-query-builder/lime-query-response-format-builder.d.ts +13 -13
- package/dist/types/components/lime-query-builder/lime-query-validation.d.ts +17 -17
- package/dist/types/components.d.ts +12 -12
- package/package.json +1 -1
- package/dist/lime-crm-building-blocks/p-96fee7ee.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-fa2da6bc.js +0 -1
- package/dist/lime-crm-building-blocks/p-fe6a94a1.entry.js +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host } from './index-96dd111f.js';
|
|
2
2
|
import { T as Te } from './index.esm-bb569663.js';
|
|
3
|
-
import { i as isLimeQuerySupported } from './lime-query-validation-
|
|
3
|
+
import { i as isLimeQuerySupported } from './lime-query-validation-9e386da8.js';
|
|
4
4
|
import './property-resolution-c21a1369.js';
|
|
5
5
|
|
|
6
|
-
const limeQueryBuilderCss = "*,*:before,*:after{box-sizing:border-box}:host(limebb-lime-query-builder){--header-background-color:rgb(var(--contrast-400));--limebb-lime-query-builder-background-color:rgb(var(--contrast-100));--limebb-lime-query-builder-border-radius:0.75rem;--limebb-lime-query-builder-
|
|
6
|
+
const limeQueryBuilderCss = "*,*:before,*:after{box-sizing:border-box}:host(limebb-lime-query-builder){--header-background-color:rgb(var(--contrast-400));--limebb-lime-query-builder-background-color:rgb(var(--contrast-100));--limebb-lime-query-builder-border-radius:0.75rem;--limebb-lime-query-builder-visual-mode-padding:1rem;--limebb-lime-query-builder-group-color:rgb(var(--color-sky-lighter));box-sizing:border-box;width:calc(100% - 1.5rem);margin:0.75rem auto;display:flex;flex-direction:column;border-radius:var(--limebb-lime-query-builder-border-radius);background-color:var(--limebb-lime-query-builder-background-color);box-shadow:var(--shadow-inflated-16)}.visual-mode{display:flex;flex-direction:column;gap:1rem;padding:var(--limebb-lime-query-builder-visual-mode-padding);border:1px solid var(--header-background-color);border-radius:0 0 var(--limebb-lime-query-builder-border-radius) var(--limebb-lime-query-builder-border-radius)}.code-mode{--code-editor-max-height:70vh;display:flex;flex-direction:column;gap:1rem}.code-mode .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-mode .validation-errors strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-mode .validation-errors ul{margin:0;padding-left:1.5rem}.code-mode .validation-errors li{margin:0.25rem 0}.code-mode .visual-mode-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-mode .visual-mode-limitations strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-mode .visual-mode-limitations ul{margin:0;padding-left:1.5rem}.code-mode .visual-mode-limitations li{margin:0.25rem 0}section.filter,section.query-options{display:flex;flex-direction:column;gap:1rem}section h4{margin:0;font-size:1.125rem;font-weight:600;color:rgb(var(--contrast-1000))}limel-header.is-narrow{--header-top-right-left-border-radius:0;width:calc(100% + var(--limebb-lime-query-builder-visual-mode-padding) * 2);margin-left:calc(var(--limebb-lime-query-builder-visual-mode-padding) * -1)}.query-options-controls{display:flex;flex-direction:column;gap:1rem}";
|
|
7
7
|
const LimebbLimeQueryBuilderStyle0 = limeQueryBuilderCss;
|
|
8
8
|
|
|
9
9
|
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -20,7 +20,7 @@ const LimeQueryBuilder = class {
|
|
|
20
20
|
constructor(hostRef) {
|
|
21
21
|
registerInstance(this, hostRef);
|
|
22
22
|
this.change = createEvent(this, "change", 7);
|
|
23
|
-
this.mode = '
|
|
23
|
+
this.mode = 'visual';
|
|
24
24
|
this.codeValue = '';
|
|
25
25
|
this.limetype = '';
|
|
26
26
|
this.handleLimetypeChange = (event) => {
|
|
@@ -59,11 +59,11 @@ const LimeQueryBuilder = class {
|
|
|
59
59
|
this.handleChange = (event) => {
|
|
60
60
|
event.stopPropagation();
|
|
61
61
|
const mode = event.detail.id;
|
|
62
|
-
if (mode === '
|
|
62
|
+
if (mode === 'visual') {
|
|
63
63
|
try {
|
|
64
64
|
const parsed = JSON.parse(this.codeValue);
|
|
65
|
-
const support = this.
|
|
66
|
-
if (!support.
|
|
65
|
+
const support = this.checkVisualModeSupport();
|
|
66
|
+
if (!support.visualModeSupported) {
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
69
|
this.limetype = parsed.limetype || '';
|
|
@@ -71,7 +71,7 @@ const LimeQueryBuilder = class {
|
|
|
71
71
|
this.internalResponseFormat = parsed.responseFormat;
|
|
72
72
|
this.limit = parsed.limit;
|
|
73
73
|
this.orderBy = parsed.orderBy;
|
|
74
|
-
this.mode = '
|
|
74
|
+
this.mode = 'visual';
|
|
75
75
|
this.change.emit(parsed);
|
|
76
76
|
}
|
|
77
77
|
catch (_a) {
|
|
@@ -100,19 +100,19 @@ const LimeQueryBuilder = class {
|
|
|
100
100
|
getButtons() {
|
|
101
101
|
return [
|
|
102
102
|
{
|
|
103
|
-
id: '
|
|
103
|
+
id: 'visual',
|
|
104
104
|
title: 'Visual',
|
|
105
105
|
},
|
|
106
106
|
{ id: 'code', title: 'Code' },
|
|
107
107
|
];
|
|
108
108
|
}
|
|
109
|
-
get
|
|
109
|
+
get visualModeEnabled() {
|
|
110
110
|
var _a, _b, _c;
|
|
111
111
|
return ((_c = (_b = (_a = this.platform) === null || _a === void 0 ? void 0 : _a.isFeatureEnabled) === null || _b === void 0 ? void 0 : _b.call(_a, 'useLimeQueryBuilderGuiMode')) !== null && _c !== void 0 ? _c : false);
|
|
112
112
|
}
|
|
113
113
|
componentWillLoad() {
|
|
114
|
-
// Force code mode if
|
|
115
|
-
if (!this.
|
|
114
|
+
// Force code mode if visual mode is disabled
|
|
115
|
+
if (!this.visualModeEnabled) {
|
|
116
116
|
this.mode = 'code';
|
|
117
117
|
// Initialize code value from prop
|
|
118
118
|
this.updateCodeValue();
|
|
@@ -127,24 +127,24 @@ const LimeQueryBuilder = class {
|
|
|
127
127
|
}
|
|
128
128
|
// Initialize code value from prop
|
|
129
129
|
this.updateCodeValue();
|
|
130
|
-
// Check if
|
|
131
|
-
const support = this.
|
|
132
|
-
if (!support.
|
|
130
|
+
// Check if visual mode is supported
|
|
131
|
+
const support = this.checkVisualModeSupport();
|
|
132
|
+
if (!support.visualModeSupported) {
|
|
133
133
|
this.mode = 'code';
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
render() {
|
|
137
|
-
return (h(Host, { key: '
|
|
137
|
+
return (h(Host, { key: '4f1481f575b1afdd63a3115761a52a62699d7f84' }, this.renderHeader(), this.renderContent()));
|
|
138
138
|
}
|
|
139
139
|
renderContent() {
|
|
140
|
-
const
|
|
141
|
-
const showCodeMode = !this.
|
|
140
|
+
const visualModeSupported = this.checkVisualModeSupport();
|
|
141
|
+
const showCodeMode = !this.visualModeEnabled || this.mode === 'code';
|
|
142
142
|
return showCodeMode
|
|
143
|
-
? this.renderCodeMode(
|
|
144
|
-
: this.
|
|
143
|
+
? this.renderCodeMode(visualModeSupported)
|
|
144
|
+
: this.renderVisualMode();
|
|
145
145
|
}
|
|
146
146
|
emitChange() {
|
|
147
|
-
// Only emit in
|
|
147
|
+
// Only emit in visual mode
|
|
148
148
|
if (this.mode === 'code') {
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
@@ -180,14 +180,14 @@ const LimeQueryBuilder = class {
|
|
|
180
180
|
}
|
|
181
181
|
return limeQuery;
|
|
182
182
|
}
|
|
183
|
-
|
|
183
|
+
checkVisualModeSupport() {
|
|
184
184
|
if (!this.limetypes) {
|
|
185
185
|
// Can't validate yet, assume all is good
|
|
186
186
|
return {
|
|
187
187
|
valid: true,
|
|
188
|
-
|
|
188
|
+
visualModeSupported: true,
|
|
189
189
|
validationErrors: [],
|
|
190
|
-
|
|
190
|
+
visualModeLimitations: [],
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
193
|
// When in code mode, validate the parsed code value instead of current state
|
|
@@ -199,20 +199,20 @@ const LimeQueryBuilder = class {
|
|
|
199
199
|
catch (_a) {
|
|
200
200
|
return {
|
|
201
201
|
valid: false,
|
|
202
|
-
|
|
202
|
+
visualModeSupported: false,
|
|
203
203
|
validationErrors: ['Invalid JSON'],
|
|
204
|
-
|
|
204
|
+
visualModeLimitations: [],
|
|
205
205
|
};
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
else {
|
|
209
|
-
// Build query from current
|
|
209
|
+
// Build query from current visual state
|
|
210
210
|
if (!this.limetype) {
|
|
211
211
|
return {
|
|
212
212
|
valid: true,
|
|
213
|
-
|
|
213
|
+
visualModeSupported: true,
|
|
214
214
|
validationErrors: [],
|
|
215
|
-
|
|
215
|
+
visualModeLimitations: [],
|
|
216
216
|
};
|
|
217
217
|
}
|
|
218
218
|
const responseFormat = this
|
|
@@ -230,23 +230,24 @@ const LimeQueryBuilder = class {
|
|
|
230
230
|
queryToCheck.limit = this.limit;
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
return isLimeQuerySupported(queryToCheck, this.limetypes, this.activeLimetype, this.
|
|
233
|
+
return isLimeQuerySupported(queryToCheck, this.limetypes, this.activeLimetype, this.visualModeEnabled);
|
|
234
234
|
}
|
|
235
235
|
renderModeSwitch(support) {
|
|
236
|
-
const
|
|
236
|
+
const visualDisabled = !support.visualModeSupported;
|
|
237
237
|
const buttons = this.getButtons().map((button) => (Object.assign(Object.assign({}, button), { selected: button.id === this.mode })));
|
|
238
|
-
return (h("limel-button-group", { slot: "actions", onChange: this.handleChange, value: buttons, disabled:
|
|
238
|
+
return (h("limel-button-group", { slot: "actions", onChange: this.handleChange, value: buttons, disabled: visualDisabled }));
|
|
239
239
|
}
|
|
240
|
-
renderCodeEditor(
|
|
240
|
+
renderCodeEditor(visualModeSupported) {
|
|
241
241
|
return [
|
|
242
242
|
h("limel-code-editor", { value: this.codeValue, language: "json", lineNumbers: true, fold: true, lint: true, onChange: this.handleCodeChange }),
|
|
243
243
|
/* Show validation errors (invalid Lime Query) */
|
|
244
|
-
!
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
244
|
+
!visualModeSupported.valid &&
|
|
245
|
+
visualModeSupported.validationErrors.length > 0 && (h("div", { class: "validation-errors" }, h("strong", null, "Invalid Lime Query:"), h("ul", null, visualModeSupported.validationErrors.map((error) => (h("li", null, error)))))),
|
|
246
|
+
/* Show visual mode limitations (only when visual mode is enabled and Lime Query is valid) */
|
|
247
|
+
this.visualModeEnabled &&
|
|
248
|
+
visualModeSupported.valid &&
|
|
249
|
+
!visualModeSupported.visualModeSupported &&
|
|
250
|
+
visualModeSupported.visualModeLimitations.length > 0 && (h("div", { class: "visual-mode-limitations" }, h("strong", null, "Cannot switch to visual mode:"), h("ul", null, visualModeSupported.visualModeLimitations.map((limitation) => (h("li", null, limitation)))))),
|
|
250
251
|
];
|
|
251
252
|
}
|
|
252
253
|
renderLimetypeSection() {
|
|
@@ -271,15 +272,15 @@ const LimeQueryBuilder = class {
|
|
|
271
272
|
}
|
|
272
273
|
return (h("section", { class: "query-options" }, h("limel-header", { class: "is-narrow", heading: "Query Options", icon: "ask_question" }), h("div", { class: "query-options-controls" }, h("limel-input-field", { label: "Limit", type: "number", value: ((_a = this.limit) === null || _a === void 0 ? void 0 : _a.toString()) || '', placeholder: "No limit", helperText: "Maximum number of results", onChange: this.handleLimitChange }), h("limebb-lime-query-order-by-editor", { platform: this.platform, context: this.context, limetype: this.limetype, value: this.orderBy, onChange: this.handleOrderByChange }))));
|
|
273
274
|
}
|
|
274
|
-
|
|
275
|
-
return (h("div", { class: "
|
|
275
|
+
renderVisualMode() {
|
|
276
|
+
return (h("div", { class: "visual-mode" }, this.renderLimetypeSection(), this.renderResponseFormatSection(), this.renderFilterSection(), this.renderQueryOptionsSection()));
|
|
276
277
|
}
|
|
277
278
|
renderHeader() {
|
|
278
|
-
const
|
|
279
|
-
return (h("limel-header", { heading: this.label }, this.renderModeControls(
|
|
279
|
+
const visualModeSupported = this.checkVisualModeSupport();
|
|
280
|
+
return (h("limel-header", { heading: this.label }, this.renderModeControls(visualModeSupported)));
|
|
280
281
|
}
|
|
281
282
|
renderModeControls(support) {
|
|
282
|
-
if (!this.
|
|
283
|
+
if (!this.visualModeEnabled) {
|
|
283
284
|
return;
|
|
284
285
|
}
|
|
285
286
|
return this.renderModeSwitch(support);
|
|
@@ -138,7 +138,7 @@ const LimeQueryFilterBuilderComponent = class {
|
|
|
138
138
|
};
|
|
139
139
|
LimeQueryFilterBuilderComponent.style = LimebbLimeQueryFilterBuilderStyle0;
|
|
140
140
|
|
|
141
|
-
const orderByEditorCss = ":host(limebb-lime-query-order-by-editor){display:flex;flex-direction:column;gap:1rem;padding:1rem 0}.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;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;width:100%}.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))}limel-header.is-narrow{--header-top-right-left-border-radius:0;width:calc(100% + var(--limebb-lime-query-builder-
|
|
141
|
+
const orderByEditorCss = ":host(limebb-lime-query-order-by-editor){display:flex;flex-direction:column;gap:1rem;padding:1rem 0}.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;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;width:100%}.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))}limel-header.is-narrow{--header-top-right-left-border-radius:0;width:calc(100% + var(--limebb-lime-query-builder-visual-mode-padding) * 2);margin-left:calc(var(--limebb-lime-query-builder-visual-mode-padding) * -1)}.empty-state{padding:0 2rem;text-align:center;color:rgb(var(--contrast-700))}";
|
|
142
142
|
const LimebbLimeQueryOrderByEditorStyle0 = orderByEditorCss;
|
|
143
143
|
|
|
144
144
|
const OrderByEditor = class {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h } from './index-96dd111f.js';
|
|
2
2
|
import { T as Te } from './index.esm-bb569663.js';
|
|
3
|
-
import { v as validateResponseFormatOnly } from './lime-query-validation-
|
|
3
|
+
import { v as validateResponseFormatOnly } from './lime-query-validation-9e386da8.js';
|
|
4
4
|
import './property-resolution-c21a1369.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -37,7 +37,7 @@ function parseResponseFormat(json) {
|
|
|
37
37
|
`Only 'object' and 'aggregates' are allowed.`);
|
|
38
38
|
}
|
|
39
39
|
// Must have at least one of object or aggregates
|
|
40
|
-
// Note: Empty objects {} are valid (starting point for
|
|
40
|
+
// Note: Empty objects {} are valid (starting point for visual mode)
|
|
41
41
|
const hasProperties = keys.length > 0;
|
|
42
42
|
if (hasProperties && !parsed.object && !parsed.aggregates) {
|
|
43
43
|
throw new Error('Response format must contain at least one of: object, aggregates');
|
|
@@ -66,7 +66,7 @@ function getDefaultResponseFormat() {
|
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
const limeQueryResponseFormatBuilderCss = ":host(limebb-lime-query-response-format-builder){display:block;width:100%}.response-format-builder{display:flex;flex-direction:column}.builder-label{color:rgb(var(--contrast-1100));font-size:1.625rem;line-height:1.25rem;font-weight:300;margin-top:1rem;margin-bottom:0.25rem}.builder-helper-text{margin-top:0px;margin-bottom:0.5rem;font-size:var(--limel-theme-default-font-size);color:rgb(var(--contrast-1100))}.mode-controls{display:flex;justify-content:flex-end;padding:0.5rem}.
|
|
69
|
+
const limeQueryResponseFormatBuilderCss = ":host(limebb-lime-query-response-format-builder){display:block;width:100%}.response-format-builder{display:flex;flex-direction:column}.builder-label{color:rgb(var(--contrast-1100));font-size:1.625rem;line-height:1.25rem;font-weight:300;margin-top:1rem;margin-bottom:0.25rem}.builder-helper-text{margin-top:0px;margin-bottom:0.5rem;font-size:var(--limel-theme-default-font-size);color:rgb(var(--contrast-1100))}.mode-controls{display:flex;justify-content:flex-end;padding:0.5rem}.visual-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 .visual-mode-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 .visual-mode-limitations strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-editor-container .visual-mode-limitations ul{margin:0;padding-left:1.5rem}.code-editor-container .visual-mode-limitations li{margin:0.25rem 0}";
|
|
70
70
|
const LimebbLimeQueryResponseFormatBuilderStyle0 = limeQueryResponseFormatBuilderCss;
|
|
71
71
|
|
|
72
72
|
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -91,34 +91,34 @@ const LimeQueryResponseFormatBuilder = class {
|
|
|
91
91
|
* Optional helper text for the builder
|
|
92
92
|
*/
|
|
93
93
|
this.helperText = '';
|
|
94
|
-
this.mode = '
|
|
94
|
+
this.mode = 'visual';
|
|
95
95
|
this.codeValue = '';
|
|
96
96
|
this.handleModeChange = (event) => {
|
|
97
97
|
event.stopPropagation();
|
|
98
98
|
const mode = event.detail.id;
|
|
99
|
-
if (mode === '
|
|
100
|
-
this.
|
|
99
|
+
if (mode === 'visual') {
|
|
100
|
+
this.switchToVisualMode();
|
|
101
101
|
}
|
|
102
102
|
else if (mode === 'code') {
|
|
103
103
|
this.switchToCode();
|
|
104
104
|
}
|
|
105
105
|
};
|
|
106
106
|
/**
|
|
107
|
-
* Switch from code mode to
|
|
107
|
+
* Switch from code mode to visual mode
|
|
108
108
|
*/
|
|
109
|
-
this.
|
|
109
|
+
this.switchToVisualMode = () => {
|
|
110
110
|
// Validate JSON before switching
|
|
111
111
|
try {
|
|
112
112
|
const parsed = parseResponseFormat(this.codeValue);
|
|
113
|
-
// Check if it's supported in
|
|
114
|
-
const support = validateResponseFormatOnly(parsed, this.limetypes, this.limetype, this.
|
|
115
|
-
if (!support.
|
|
116
|
-
// Don't switch if
|
|
113
|
+
// Check if it's supported in visual mode
|
|
114
|
+
const support = validateResponseFormatOnly(parsed, this.limetypes, this.limetype, this.visualModeEnabled);
|
|
115
|
+
if (!support.visualModeSupported) {
|
|
116
|
+
// Don't switch if visual mode can't render this response format
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
119
|
// Update internal state from parsed value
|
|
120
120
|
this.internalValue = parsed;
|
|
121
|
-
this.mode = '
|
|
121
|
+
this.mode = 'visual';
|
|
122
122
|
this.change.emit(parsed);
|
|
123
123
|
}
|
|
124
124
|
catch (_a) {
|
|
@@ -126,7 +126,7 @@ const LimeQueryResponseFormatBuilder = class {
|
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
128
|
/**
|
|
129
|
-
* Switch from
|
|
129
|
+
* Switch from visual mode to code mode
|
|
130
130
|
*/
|
|
131
131
|
this.switchToCode = () => {
|
|
132
132
|
this.updateCodeValue();
|
|
@@ -147,14 +147,14 @@ const LimeQueryResponseFormatBuilder = class {
|
|
|
147
147
|
}
|
|
148
148
|
catch (_a) {
|
|
149
149
|
// Invalid JSON - don't emit change
|
|
150
|
-
// Validation errors will be shown by
|
|
150
|
+
// Validation errors will be shown by checkVisualModeSupport()
|
|
151
151
|
}
|
|
152
152
|
};
|
|
153
153
|
/**
|
|
154
|
-
* Handle
|
|
154
|
+
* Handle visual mode changes
|
|
155
155
|
* @param event
|
|
156
156
|
*/
|
|
157
|
-
this.
|
|
157
|
+
this.handleVisualModeChange = (event) => {
|
|
158
158
|
event.stopPropagation();
|
|
159
159
|
this.internalValue = event.detail;
|
|
160
160
|
this.updateCodeValue();
|
|
@@ -162,9 +162,9 @@ const LimeQueryResponseFormatBuilder = class {
|
|
|
162
162
|
};
|
|
163
163
|
}
|
|
164
164
|
/**
|
|
165
|
-
* Check if
|
|
165
|
+
* Check if visual mode is enabled via feature flag
|
|
166
166
|
*/
|
|
167
|
-
get
|
|
167
|
+
get visualModeEnabled() {
|
|
168
168
|
var _a, _b, _c;
|
|
169
169
|
return ((_c = (_b = (_a = this.platform) === null || _a === void 0 ? void 0 : _a.isFeatureEnabled) === null || _b === void 0 ? void 0 : _b.call(_a, 'useLimeQueryBuilderGuiMode')) !== null && _c !== void 0 ? _c : false);
|
|
170
170
|
}
|
|
@@ -173,32 +173,32 @@ const LimeQueryResponseFormatBuilder = class {
|
|
|
173
173
|
this.internalValue = this.value || getDefaultResponseFormat();
|
|
174
174
|
// Update code value from internal value
|
|
175
175
|
this.updateCodeValue();
|
|
176
|
-
// Force code mode if
|
|
177
|
-
if (!this.
|
|
176
|
+
// Force code mode if visual mode is disabled
|
|
177
|
+
if (!this.visualModeEnabled) {
|
|
178
178
|
this.mode = 'code';
|
|
179
179
|
return;
|
|
180
180
|
}
|
|
181
|
-
// Check if
|
|
182
|
-
const support = this.
|
|
183
|
-
if (!support.
|
|
181
|
+
// Check if visual mode is supported for current value
|
|
182
|
+
const support = this.checkVisualModeSupport();
|
|
183
|
+
if (!support.visualModeSupported) {
|
|
184
184
|
this.mode = 'code';
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
componentWillUpdate() {
|
|
188
188
|
// Sync internal value when prop changes externally
|
|
189
|
-
if (this.value && this.mode === '
|
|
189
|
+
if (this.value && this.mode === 'visual') {
|
|
190
190
|
this.internalValue = this.value;
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
render() {
|
|
194
|
-
const
|
|
195
|
-
return (h("div", { key: '
|
|
194
|
+
const visualModeSupported = this.checkVisualModeSupport();
|
|
195
|
+
return (h("div", { key: '7ae23c1366da49b591c0914f49f25c179e4d6712', class: "response-format-builder" }, this.label && h("h1", { key: '0cd528a69dd1b05769c678151f0827de15d167a8', class: "builder-label" }, this.label), this.helperText && (h("p", { key: 'b636ca0d32b244d051e74ed538cbd11438f29cd1', class: "builder-helper-text" }, this.helperText)), this.visualModeEnabled && (h("div", { key: 'dc7248cb27d99aa654b0f1659938c3f2933d89e0', class: "mode-controls" }, this.renderModeSwitch(visualModeSupported))), !this.visualModeEnabled || this.mode === 'code' ? (h("div", { class: "code-mode" }, this.renderCodeEditor(visualModeSupported))) : (h("div", { class: "visual-mode" }, this.renderVisualMode()))));
|
|
196
196
|
}
|
|
197
197
|
renderModeSwitch(support) {
|
|
198
|
-
const
|
|
198
|
+
const visualDisabled = !support.visualModeSupported;
|
|
199
199
|
const buttons = [
|
|
200
200
|
{
|
|
201
|
-
id: '
|
|
201
|
+
id: 'visual',
|
|
202
202
|
title: 'Visual',
|
|
203
203
|
},
|
|
204
204
|
{
|
|
@@ -206,27 +206,27 @@ const LimeQueryResponseFormatBuilder = class {
|
|
|
206
206
|
title: 'Code',
|
|
207
207
|
},
|
|
208
208
|
].map((button) => (Object.assign(Object.assign({}, button), { selected: button.id === this.mode })));
|
|
209
|
-
return (h("limel-button-group", { value: buttons, disabled:
|
|
209
|
+
return (h("limel-button-group", { value: buttons, disabled: visualDisabled, onChange: this.handleModeChange }));
|
|
210
210
|
}
|
|
211
211
|
renderCodeEditor(support) {
|
|
212
|
-
return (h("div", { class: "code-editor-container" }, h("limel-code-editor", { value: this.codeValue, language: "json", lineNumbers: true, fold: true, lint: true, onChange: this.handleCodeChange }), !support.valid && support.validationErrors.length > 0 && (h("div", { class: "validation-errors" }, h("strong", null, "Invalid Response Format:"), h("ul", null, support.validationErrors.map((error) => (h("li", null, error)))))), this.
|
|
212
|
+
return (h("div", { class: "code-editor-container" }, h("limel-code-editor", { value: this.codeValue, language: "json", lineNumbers: true, fold: true, lint: true, onChange: this.handleCodeChange }), !support.valid && support.validationErrors.length > 0 && (h("div", { class: "validation-errors" }, h("strong", null, "Invalid Response Format:"), h("ul", null, support.validationErrors.map((error) => (h("li", null, error)))))), this.visualModeEnabled &&
|
|
213
213
|
support.valid &&
|
|
214
|
-
!support.
|
|
215
|
-
support.
|
|
214
|
+
!support.visualModeSupported &&
|
|
215
|
+
support.visualModeLimitations.length > 0 && (h("div", { class: "visual-mode-limitations" }, h("strong", null, "Cannot switch to visual mode:"), h("ul", null, support.visualModeLimitations.map((limitation) => (h("li", null, limitation))))))));
|
|
216
216
|
}
|
|
217
|
-
|
|
218
|
-
return (h("limebb-lime-query-response-format-editor", { platform: this.platform, context: this.context, limetype: this.limetype, value: this.internalValue, onChange: this.
|
|
217
|
+
renderVisualMode() {
|
|
218
|
+
return (h("limebb-lime-query-response-format-editor", { platform: this.platform, context: this.context, limetype: this.limetype, value: this.internalValue, onChange: this.handleVisualModeChange }));
|
|
219
219
|
}
|
|
220
220
|
/**
|
|
221
|
-
* Check if current value can be rendered in
|
|
221
|
+
* Check if current value can be rendered in visual mode
|
|
222
222
|
*/
|
|
223
|
-
|
|
223
|
+
checkVisualModeSupport() {
|
|
224
224
|
if (!this.limetypes) {
|
|
225
225
|
return {
|
|
226
226
|
valid: false,
|
|
227
|
-
|
|
227
|
+
visualModeSupported: false,
|
|
228
228
|
validationErrors: ['Limetypes not loaded'],
|
|
229
|
-
|
|
229
|
+
visualModeLimitations: [],
|
|
230
230
|
};
|
|
231
231
|
}
|
|
232
232
|
// Try to parse code value if in code mode
|
|
@@ -238,16 +238,16 @@ const LimeQueryResponseFormatBuilder = class {
|
|
|
238
238
|
catch (error) {
|
|
239
239
|
return {
|
|
240
240
|
valid: false,
|
|
241
|
-
|
|
241
|
+
visualModeSupported: false,
|
|
242
242
|
validationErrors: [error.message],
|
|
243
|
-
|
|
243
|
+
visualModeLimitations: [],
|
|
244
244
|
};
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
else {
|
|
248
248
|
valueToCheck = this.internalValue;
|
|
249
249
|
}
|
|
250
|
-
return validateResponseFormatOnly(valueToCheck, this.limetypes, this.limetype, this.
|
|
250
|
+
return validateResponseFormatOnly(valueToCheck, this.limetypes, this.limetype, this.visualModeEnabled);
|
|
251
251
|
}
|
|
252
252
|
/**
|
|
253
253
|
* Update code value from internal state
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as t}from"./p-1556b545.js";export{s as setNonce}from"./p-1556b545.js";import{g as i}from"./p-e1255160.js";(()=>{const t=import.meta.url,i={};return""!==t&&(i.resourcesUrl=new URL(".",t).href),e(i)})().then((async e=>(await i(),t(JSON.parse('[["p-fe6a94a1",[[1,"limebb-lime-query-builder",{"platform":[16],"context":[16],"value":[16],"label":[1],"activeLimetype":[1,"active-limetype"],"limetypes":[32],"mode":[32],"codeValue":[32],"limetype":[32],"filter":[32],"internalResponseFormat":[32],"limit":[32],"orderBy":[32]}]]],["p-ee1b00b9",[[1,"limebb-feed",{"platform":[16],"context":[16],"items":[16],"emptyStateMessage":[1,"empty-state-message"],"heading":[1],"loading":[4],"minutesOfProximity":[2,"minutes-of-proximity"],"totalCount":[2,"total-count"],"direction":[513],"lastVisitedTimestamp":[1,"last-visited-timestamp"],"highlightedItemId":[8,"highlighted-item-id"]},null,{"highlightedItemId":["highlightedItemIdChanged"]}]]],["p-3a406a20",[[1,"limebb-kanban",{"platform":[16],"context":[16],"groups":[16]}]]],["p-96fee7ee",[[1,"limebb-lime-query-response-format-builder",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"helperText":[1,"helper-text"],"limetypes":[32],"mode":[32],"codeValue":[32],"internalValue":[32]}]]],["p-32534eb7",[[1,"limebb-chat-list",{"platform":[16],"context":[16],"items":[16],"loading":[516],"isTypingIndicatorVisible":[516,"is-typing-indicator-visible"],"lastVisitedTimestamp":[513,"last-visited-timestamp"],"order":[513]},null,{"items":["handleItemsChange"]}]]],["p-03af0e66",[[1,"limebb-limeobject-file-viewer",{"platform":[16],"context":[16],"property":[1],"fileTypes":[16],"limeobject":[32],"limetype":[32]}]]],["p-36ea13c0",[[1,"limebb-text-editor",{"platform":[16],"context":[16],"allowMentioning":[4,"allow-mentioning"],"contentType":[1,"content-type"],"language":[513],"disabled":[516],"readonly":[516],"helperText":[513,"helper-text"],"placeholder":[513],"label":[513],"invalid":[516],"required":[516],"selectedContext":[16],"ui":[513],"allowResize":[4,"allow-resize"],"value":[1],"draftIdentifier":[1,"draft-identifier"],"triggerMap":[16],"customElements":[16],"allowInlineImages":[4,"allow-inline-images"],"items":[32],"highlightedItemIndex":[32],"editorPickerQuery":[32],"searchableLimetypes":[32],"isPickerOpen":[32],"isSearching":[32]},null,{"isPickerOpen":["watchOpen"],"editorPickerQuery":["watchQuery"]}]]],["p-8491aaa1",[[1,"limebb-date-range",{"platform":[16],"context":[16],"startTime":[16],"endTime":[16],"startTimeLabel":[1,"start-time-label"],"endTimeLabel":[1,"end-time-label"],"language":[1],"timeFormat":[1,"time-format"],"type":[1]}]]],["p-4a82410e",[[1,"limebb-document-picker",{"platform":[16],"context":[16],"items":[16],"label":[513],"helperText":[513,"helper-text"],"invalid":[516],"required":[516],"type":[513]}]]],["p-568b7520",[[1,"limebb-info-tile-currency-format",{"platform":[16],"context":[16],"value":[16]}]]],["p-2fdcb868",[[1,"limebb-notification-list",{"platform":[16],"context":[16],"items":[16],"loading":[4],"lastVisitedTimestamp":[1,"last-visited-timestamp"]},null,{"items":["handleItemsChange"]}]]],["p-5464f0de",[[17,"limebb-browser",{"platform":[16],"context":[16],"items":[16],"layout":[1],"filter":[32]}]]],["p-3175883d",[[1,"limebb-component-config",{"platform":[16],"context":[16],"value":[16],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"formInfo":[16],"type":[1],"nameField":[1,"name-field"],"configComponent":[32],"configViewType":[32]},null,{"formInfo":["watchFormInfo"],"configComponent":["watchconfigComponent"]}]]],["p-1be0eec7",[[1,"limebb-component-picker",{"platform":[16],"context":[16],"type":[1],"tags":[16],"value":[1],"copyLabel":[1,"copy-label"],"hideCopyButton":[4,"hide-copy-button"],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["p-10ac8b3e",[[1,"limebb-dashboard-widget",{"heading":[513],"subheading":[513],"supportingText":[513,"supporting-text"],"icon":[513]}]]],["p-ef042c82",[[1,"limebb-icon-picker",{"value":[1],"required":[4],"readonly":[4],"invalid":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["p-a200954f",[[1,"limebb-info-tile",{"platform":[16],"context":[16],"filterId":[513,"filter-id"],"disabled":[4],"icon":[513],"label":[1],"prefix":[1],"suffix":[1],"propertyName":[1,"property-name"],"aggregateOperator":[1,"aggregate-operator"],"format":[16],"config":[32],"filters":[32],"value":[32],"loading":[32],"error":[32]},null,{"filterId":["watchFilterId"],"propertyName":["watchPropertyName"],"aggregateOperator":["watchAggregateOperator"]}]]],["p-01cff04f",[[1,"limebb-info-tile-date-format",{"value":[16]}]]],["p-4caa8bbe",[[1,"limebb-info-tile-decimal-format",{"value":[16]}]]],["p-ff0b244b",[[1,"limebb-info-tile-format",{"platform":[16],"context":[16],"type":[1],"value":[16]}]]],["p-25e1a434",[[1,"limebb-info-tile-relative-date-format",{"value":[16]}]]],["p-6c56121c",[[1,"limebb-info-tile-unit-format",{"value":[16]}]]],["p-206575e4",[[1,"limebb-loader",{"platform":[16],"context":[16]}]]],["p-e8946134",[[1,"limebb-locale-picker",{"platform":[16],"context":[16],"value":[1],"required":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"readonly":[4],"multipleChoice":[4,"multiple-choice"],"allLanguages":[32]}]]],["p-cfa1a4ad",[[1,"limebb-mention",{"limetype":[1],"objectid":[2],"limeobject":[32]}]]],["p-9cac4de2",[[1,"limebb-mention-group-counter",{"count":[2],"limetype":[16],"helperLabel":[1,"helper-label"]}]]],["p-569c86b5",[[1,"limebb-percentage-visualizer",{"platform":[16],"context":[16],"value":[520],"rangeMax":[514,"range-max"],"rangeMin":[514,"range-min"],"multiplier":[514],"label":[513],"invalid":[516],"required":[516],"helperText":[513,"helper-text"],"reducePresence":[516,"reduce-presence"],"displayPercentageColors":[516,"display-percentage-colors"]},null,{"value":["valueChanged"]}]]],["p-3122ea05",[[1,"limebb-trend-indicator",{"platform":[16],"context":[16],"value":[520],"formerValue":[514,"former-value"],"suffix":[513],"label":[513],"invalid":[516],"required":[516],"helperText":[513,"helper-text"],"reducePresence":[516,"reduce-presence"]},null,{"value":["valueChanged"]}]]],["p-7271f47a",[[1,"limebb-feed-timeline-item",{"platform":[16],"context":[16],"item":[16],"ui":[513],"helperText":[1,"helper-text"],"hasError":[516,"has-error"],"isBundled":[516,"is-bundled"],"headingCanExpand":[32],"isHeadingExpanded":[32],"showMore":[32],"isTall":[32]}]]],["p-eb81bceb",[[1,"limebb-kanban-item",{"platform":[16],"context":[16],"item":[16]}]]],["p-2faaacbc",[[1,"limebb-kanban-group",{"platform":[16],"context":[16],"identifier":[1],"heading":[513],"help":[1],"items":[16],"summary":[1],"loading":[516],"totalCount":[514,"total-count"]}]]],["p-218b7f38",[[1,"limebb-text-editor-picker",{"items":[16],"open":[516],"isSearching":[4,"is-searching"],"emptyMessage":[1,"empty-message"]},null,{"open":["watchOpen"]}]]],["p-9031f136",[[1,"limebb-currency-picker",{"platform":[16],"context":[16],"label":[513],"currencies":[16],"helperText":[513,"helper-text"],"required":[516],"readonly":[516],"invalid":[516],"disabled":[516],"value":[1]}]]],["p-098ee6c1",[[1,"limebb-date-picker",{"platform":[16],"context":[16],"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[1],"type":[513]}]]],["p-9d25ed5a",[[17,"limebb-document-item",{"platform":[16],"context":[16],"item":[16],"type":[513]}]]],["p-93cadc1e",[[1,"limebb-live-docs-info"]]],["p-b9b954d9",[[1,"limebb-notification-item",{"platform":[16],"context":[16],"item":[16]}]]],["p-fdd5600b",[[1,"limebb-lime-query-order-by-item",{"platform":[16],"context":[16],"limetype":[1],"item":[16]}]]],["p-5dc574a3",[[1,"limebb-chat-item",{"platform":[16],"context":[16],"item":[16],"helperText":[1,"helper-text"],"hasError":[516,"has-error"]}],[1,"limebb-typing-indicator"]]],["p-61282e1a",[[1,"limebb-feed-item-thumbnail-file-info",{"description":[1]}]]],["p-6c7af6bb",[[1,"limebb-lime-query-filter-builder",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}],[1,"limebb-lime-query-order-by-editor",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"items":[32]},null,{"value":["handleValueChange"]}],[0,"limebb-limetype-field",{"platform":[16],"context":[16],"label":[513],"required":[516],"readonly":[516],"disabled":[516],"value":[513],"helperText":[513,"helper-text"],"invalid":[4],"limetypes":[16],"propertyFields":[16],"fieldName":[1,"field-name"],"formInfo":[16]}]]],["p-292631ea",[[1,"limebb-empty-state",{"heading":[513],"value":[513],"icon":[16]}]]],["p-d8696b23",[[1,"limebb-property-selector",{"platform":[16],"context":[16],"limetype":[1],"value":[1],"label":[1],"required":[4],"helperText":[1,"helper-text"],"limetypes":[32],"isOpen":[32],"navigationPath":[32]}]]],["p-adfb9e90",[[1,"limebb-lime-query-response-format-editor",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"items":[32]}],[1,"limebb-lime-query-response-format-item",{"platform":[16],"context":[16],"limetype":[1],"item":[16],"showAliasInput":[32],"showDescriptionInput":[32]}]]],["p-631ca5a5",[[1,"limebb-summary-popover",{"triggerDelay":[514,"trigger-delay"],"heading":[513],"subheading":[513],"image":[16],"icon":[513],"value":[1],"openDirection":[513,"open-direction"],"popoverMaxWidth":[513,"popover-max-width"],"popoverMaxHeight":[513,"popover-max-height"],"actions":[16],"isPopoverOpen":[32]}],[17,"limebb-navigation-button",{"href":[513],"tooltipLabel":[513,"tooltip-label"],"tooltipHelperLabel":[513,"tooltip-helper-label"],"type":[513]}]]],["p-908dd7d5",[[1,"limebb-lime-query-value-input",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"propertyPath":[1,"property-path"],"operator":[1],"value":[8],"label":[1],"limetypes":[32],"inputMode":[32]}],[1,"limebb-lime-query-filter-group",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16],"value":[32]}],[1,"limebb-lime-query-filter-not",{"platform":[16],"context":[16],"label":[1],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}]]],["p-761c7c7c",[[1,"limebb-lime-query-filter-expression",{"platform":[16],"context":[16],"label":[1],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}],[1,"limebb-lime-query-filter-comparison",{"platform":[16],"context":[16],"label":[513],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}]]]]'),e))));
|
|
1
|
+
import{p as e,b as t}from"./p-1556b545.js";export{s as setNonce}from"./p-1556b545.js";import{g as i}from"./p-e1255160.js";(()=>{const t=import.meta.url,i={};return""!==t&&(i.resourcesUrl=new URL(".",t).href),e(i)})().then((async e=>(await i(),t(JSON.parse('[["p-7fbb6eba",[[1,"limebb-lime-query-builder",{"platform":[16],"context":[16],"value":[16],"label":[1],"activeLimetype":[1,"active-limetype"],"limetypes":[32],"mode":[32],"codeValue":[32],"limetype":[32],"filter":[32],"internalResponseFormat":[32],"limit":[32],"orderBy":[32]}]]],["p-ee1b00b9",[[1,"limebb-feed",{"platform":[16],"context":[16],"items":[16],"emptyStateMessage":[1,"empty-state-message"],"heading":[1],"loading":[4],"minutesOfProximity":[2,"minutes-of-proximity"],"totalCount":[2,"total-count"],"direction":[513],"lastVisitedTimestamp":[1,"last-visited-timestamp"],"highlightedItemId":[8,"highlighted-item-id"]},null,{"highlightedItemId":["highlightedItemIdChanged"]}]]],["p-3a406a20",[[1,"limebb-kanban",{"platform":[16],"context":[16],"groups":[16]}]]],["p-ac9e81c9",[[1,"limebb-lime-query-response-format-builder",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"helperText":[1,"helper-text"],"limetypes":[32],"mode":[32],"codeValue":[32],"internalValue":[32]}]]],["p-32534eb7",[[1,"limebb-chat-list",{"platform":[16],"context":[16],"items":[16],"loading":[516],"isTypingIndicatorVisible":[516,"is-typing-indicator-visible"],"lastVisitedTimestamp":[513,"last-visited-timestamp"],"order":[513]},null,{"items":["handleItemsChange"]}]]],["p-03af0e66",[[1,"limebb-limeobject-file-viewer",{"platform":[16],"context":[16],"property":[1],"fileTypes":[16],"limeobject":[32],"limetype":[32]}]]],["p-36ea13c0",[[1,"limebb-text-editor",{"platform":[16],"context":[16],"allowMentioning":[4,"allow-mentioning"],"contentType":[1,"content-type"],"language":[513],"disabled":[516],"readonly":[516],"helperText":[513,"helper-text"],"placeholder":[513],"label":[513],"invalid":[516],"required":[516],"selectedContext":[16],"ui":[513],"allowResize":[4,"allow-resize"],"value":[1],"draftIdentifier":[1,"draft-identifier"],"triggerMap":[16],"customElements":[16],"allowInlineImages":[4,"allow-inline-images"],"items":[32],"highlightedItemIndex":[32],"editorPickerQuery":[32],"searchableLimetypes":[32],"isPickerOpen":[32],"isSearching":[32]},null,{"isPickerOpen":["watchOpen"],"editorPickerQuery":["watchQuery"]}]]],["p-8491aaa1",[[1,"limebb-date-range",{"platform":[16],"context":[16],"startTime":[16],"endTime":[16],"startTimeLabel":[1,"start-time-label"],"endTimeLabel":[1,"end-time-label"],"language":[1],"timeFormat":[1,"time-format"],"type":[1]}]]],["p-4a82410e",[[1,"limebb-document-picker",{"platform":[16],"context":[16],"items":[16],"label":[513],"helperText":[513,"helper-text"],"invalid":[516],"required":[516],"type":[513]}]]],["p-568b7520",[[1,"limebb-info-tile-currency-format",{"platform":[16],"context":[16],"value":[16]}]]],["p-2fdcb868",[[1,"limebb-notification-list",{"platform":[16],"context":[16],"items":[16],"loading":[4],"lastVisitedTimestamp":[1,"last-visited-timestamp"]},null,{"items":["handleItemsChange"]}]]],["p-5464f0de",[[17,"limebb-browser",{"platform":[16],"context":[16],"items":[16],"layout":[1],"filter":[32]}]]],["p-3175883d",[[1,"limebb-component-config",{"platform":[16],"context":[16],"value":[16],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"formInfo":[16],"type":[1],"nameField":[1,"name-field"],"configComponent":[32],"configViewType":[32]},null,{"formInfo":["watchFormInfo"],"configComponent":["watchconfigComponent"]}]]],["p-1be0eec7",[[1,"limebb-component-picker",{"platform":[16],"context":[16],"type":[1],"tags":[16],"value":[1],"copyLabel":[1,"copy-label"],"hideCopyButton":[4,"hide-copy-button"],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["p-10ac8b3e",[[1,"limebb-dashboard-widget",{"heading":[513],"subheading":[513],"supportingText":[513,"supporting-text"],"icon":[513]}]]],["p-ef042c82",[[1,"limebb-icon-picker",{"value":[1],"required":[4],"readonly":[4],"invalid":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["p-a200954f",[[1,"limebb-info-tile",{"platform":[16],"context":[16],"filterId":[513,"filter-id"],"disabled":[4],"icon":[513],"label":[1],"prefix":[1],"suffix":[1],"propertyName":[1,"property-name"],"aggregateOperator":[1,"aggregate-operator"],"format":[16],"config":[32],"filters":[32],"value":[32],"loading":[32],"error":[32]},null,{"filterId":["watchFilterId"],"propertyName":["watchPropertyName"],"aggregateOperator":["watchAggregateOperator"]}]]],["p-01cff04f",[[1,"limebb-info-tile-date-format",{"value":[16]}]]],["p-4caa8bbe",[[1,"limebb-info-tile-decimal-format",{"value":[16]}]]],["p-ff0b244b",[[1,"limebb-info-tile-format",{"platform":[16],"context":[16],"type":[1],"value":[16]}]]],["p-25e1a434",[[1,"limebb-info-tile-relative-date-format",{"value":[16]}]]],["p-6c56121c",[[1,"limebb-info-tile-unit-format",{"value":[16]}]]],["p-206575e4",[[1,"limebb-loader",{"platform":[16],"context":[16]}]]],["p-e8946134",[[1,"limebb-locale-picker",{"platform":[16],"context":[16],"value":[1],"required":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"readonly":[4],"multipleChoice":[4,"multiple-choice"],"allLanguages":[32]}]]],["p-cfa1a4ad",[[1,"limebb-mention",{"limetype":[1],"objectid":[2],"limeobject":[32]}]]],["p-9cac4de2",[[1,"limebb-mention-group-counter",{"count":[2],"limetype":[16],"helperLabel":[1,"helper-label"]}]]],["p-569c86b5",[[1,"limebb-percentage-visualizer",{"platform":[16],"context":[16],"value":[520],"rangeMax":[514,"range-max"],"rangeMin":[514,"range-min"],"multiplier":[514],"label":[513],"invalid":[516],"required":[516],"helperText":[513,"helper-text"],"reducePresence":[516,"reduce-presence"],"displayPercentageColors":[516,"display-percentage-colors"]},null,{"value":["valueChanged"]}]]],["p-3122ea05",[[1,"limebb-trend-indicator",{"platform":[16],"context":[16],"value":[520],"formerValue":[514,"former-value"],"suffix":[513],"label":[513],"invalid":[516],"required":[516],"helperText":[513,"helper-text"],"reducePresence":[516,"reduce-presence"]},null,{"value":["valueChanged"]}]]],["p-7271f47a",[[1,"limebb-feed-timeline-item",{"platform":[16],"context":[16],"item":[16],"ui":[513],"helperText":[1,"helper-text"],"hasError":[516,"has-error"],"isBundled":[516,"is-bundled"],"headingCanExpand":[32],"isHeadingExpanded":[32],"showMore":[32],"isTall":[32]}]]],["p-eb81bceb",[[1,"limebb-kanban-item",{"platform":[16],"context":[16],"item":[16]}]]],["p-2faaacbc",[[1,"limebb-kanban-group",{"platform":[16],"context":[16],"identifier":[1],"heading":[513],"help":[1],"items":[16],"summary":[1],"loading":[516],"totalCount":[514,"total-count"]}]]],["p-218b7f38",[[1,"limebb-text-editor-picker",{"items":[16],"open":[516],"isSearching":[4,"is-searching"],"emptyMessage":[1,"empty-message"]},null,{"open":["watchOpen"]}]]],["p-9031f136",[[1,"limebb-currency-picker",{"platform":[16],"context":[16],"label":[513],"currencies":[16],"helperText":[513,"helper-text"],"required":[516],"readonly":[516],"invalid":[516],"disabled":[516],"value":[1]}]]],["p-098ee6c1",[[1,"limebb-date-picker",{"platform":[16],"context":[16],"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[1],"type":[513]}]]],["p-9d25ed5a",[[17,"limebb-document-item",{"platform":[16],"context":[16],"item":[16],"type":[513]}]]],["p-93cadc1e",[[1,"limebb-live-docs-info"]]],["p-b9b954d9",[[1,"limebb-notification-item",{"platform":[16],"context":[16],"item":[16]}]]],["p-fdd5600b",[[1,"limebb-lime-query-order-by-item",{"platform":[16],"context":[16],"limetype":[1],"item":[16]}]]],["p-5dc574a3",[[1,"limebb-chat-item",{"platform":[16],"context":[16],"item":[16],"helperText":[1,"helper-text"],"hasError":[516,"has-error"]}],[1,"limebb-typing-indicator"]]],["p-61282e1a",[[1,"limebb-feed-item-thumbnail-file-info",{"description":[1]}]]],["p-7d2188aa",[[1,"limebb-lime-query-filter-builder",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}],[1,"limebb-lime-query-order-by-editor",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"items":[32]},null,{"value":["handleValueChange"]}],[0,"limebb-limetype-field",{"platform":[16],"context":[16],"label":[513],"required":[516],"readonly":[516],"disabled":[516],"value":[513],"helperText":[513,"helper-text"],"invalid":[4],"limetypes":[16],"propertyFields":[16],"fieldName":[1,"field-name"],"formInfo":[16]}]]],["p-292631ea",[[1,"limebb-empty-state",{"heading":[513],"value":[513],"icon":[16]}]]],["p-d8696b23",[[1,"limebb-property-selector",{"platform":[16],"context":[16],"limetype":[1],"value":[1],"label":[1],"required":[4],"helperText":[1,"helper-text"],"limetypes":[32],"isOpen":[32],"navigationPath":[32]}]]],["p-adfb9e90",[[1,"limebb-lime-query-response-format-editor",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"items":[32]}],[1,"limebb-lime-query-response-format-item",{"platform":[16],"context":[16],"limetype":[1],"item":[16],"showAliasInput":[32],"showDescriptionInput":[32]}]]],["p-631ca5a5",[[1,"limebb-summary-popover",{"triggerDelay":[514,"trigger-delay"],"heading":[513],"subheading":[513],"image":[16],"icon":[513],"value":[1],"openDirection":[513,"open-direction"],"popoverMaxWidth":[513,"popover-max-width"],"popoverMaxHeight":[513,"popover-max-height"],"actions":[16],"isPopoverOpen":[32]}],[17,"limebb-navigation-button",{"href":[513],"tooltipLabel":[513,"tooltip-label"],"tooltipHelperLabel":[513,"tooltip-helper-label"],"type":[513]}]]],["p-908dd7d5",[[1,"limebb-lime-query-value-input",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"propertyPath":[1,"property-path"],"operator":[1],"value":[8],"label":[1],"limetypes":[32],"inputMode":[32]}],[1,"limebb-lime-query-filter-group",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16],"value":[32]}],[1,"limebb-lime-query-filter-not",{"platform":[16],"context":[16],"label":[1],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}]]],["p-761c7c7c",[[1,"limebb-lime-query-filter-expression",{"platform":[16],"context":[16],"label":[1],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}],[1,"limebb-lime-query-filter-comparison",{"platform":[16],"context":[16],"label":[513],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}]]]]'),e))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as e,h as i,H as r}from"./p-1556b545.js";import{Z as s,c as o}from"./p-4838284a.js";import{b as n}from"./p-20bfca36.js";import{i as l}from"./p-1484e300.js";import{b as a}from"./p-a659d55a.js";import{i as h,a as d,b as m}from"./p-b31772c8.js";import"./p-35897ec3.js";import"./p-fe2b91d9.js";import"./p-5322fd19.js";function c(t){return"string"==typeof t||!h(t)&&d(t)&&"[object String]"==m(t)}const p=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:"Condition",icon:{name:"plus_math",title:"Add"},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}))}};p.style=".expression-with-promotion{display:flex;flex-direction:column;gap:1rem}limel-button{width:100%}.query-options-section{margin-top:1rem}";const u=class{constructor(i){t(this,i),this.change=e(this,"change",7),this.label="Sort Order",this.items=[],this.handleItemChange=t=>e=>{e.stopPropagation();const i=[...this.items];null===e.detail?i.splice(t,1):i[t]=e.detail,this.items=i,this.emitChange()},this.handleAddSortField=()=>{this.items=[...this.items,{"":"ASC"}],this.emitChange()}}componentWillLoad(){this.value&&this.value.length>0&&(this.items=[...this.value])}handleValueChange(t){t&&(t.length!==this.items.length||!t.every(((t,e)=>{const i=this.items[e];if(!i)return!1;const r=Object.keys(t)[0],s=Object.keys(i)[0];return r===s&&t[r]===i[s]})))&&(this.items=t.length>0?[...t]:[])}render(){return i(r,{key:"601436a1a47be391bf4768d25ef7f8da911fc80d"},this.renderEmptyState(),this.renderOrderByEditor())}renderEmptyState(){return this.limetype?null:i("div",{class:"empty-state"},i("p",null,"Select a limetype to configure sorting"))}renderOrderByEditor(){return this.limetype?[this.renderHeader(),this.renderOrderByList(),this.renderActions()]:null}renderHeader(){return i("limel-header",{class:"is-narrow",heading:this.label,icon:"sorting_arrows"})}renderOrderByList(){return 0===this.items.length?null:i("div",{class:"order-by-list"},this.items.map(((t,e)=>this.renderItem(t,e))))}renderActions(){return i("limel-button",{label:"Add Sort Field",icon:"plus_math",onClick:this.handleAddSortField})}renderItem(t,e){const r=Object.keys(t)[0]||"";return i("limebb-lime-query-order-by-item",{key:`${r}-${e}`,class:"order-by-item",platform:this.platform,context:this.context,limetype:this.limetype,item:t,onItemChange:this.handleItemChange(e)})}emitChange(){this.change.emit(this.items)}static get watchers(){return{value:["handleValueChange"]}}};u.style=":host(limebb-lime-query-order-by-editor){display:flex;flex-direction:column;gap:1rem;padding:1rem 0}.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;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;width:100%}.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))}limel-header.is-narrow{--header-top-right-left-border-radius:0;width:calc(100% + var(--limebb-lime-query-builder-
|
|
1
|
+
import{r as t,c as e,h as i,H as r}from"./p-1556b545.js";import{Z as s,c as o}from"./p-4838284a.js";import{b as n}from"./p-20bfca36.js";import{i as l}from"./p-1484e300.js";import{b as a}from"./p-a659d55a.js";import{i as h,a as d,b as m}from"./p-b31772c8.js";import"./p-35897ec3.js";import"./p-fe2b91d9.js";import"./p-5322fd19.js";function c(t){return"string"==typeof t||!h(t)&&d(t)&&"[object String]"==m(t)}const p=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:"Condition",icon:{name:"plus_math",title:"Add"},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}))}};p.style=".expression-with-promotion{display:flex;flex-direction:column;gap:1rem}limel-button{width:100%}.query-options-section{margin-top:1rem}";const u=class{constructor(i){t(this,i),this.change=e(this,"change",7),this.label="Sort Order",this.items=[],this.handleItemChange=t=>e=>{e.stopPropagation();const i=[...this.items];null===e.detail?i.splice(t,1):i[t]=e.detail,this.items=i,this.emitChange()},this.handleAddSortField=()=>{this.items=[...this.items,{"":"ASC"}],this.emitChange()}}componentWillLoad(){this.value&&this.value.length>0&&(this.items=[...this.value])}handleValueChange(t){t&&(t.length!==this.items.length||!t.every(((t,e)=>{const i=this.items[e];if(!i)return!1;const r=Object.keys(t)[0],s=Object.keys(i)[0];return r===s&&t[r]===i[s]})))&&(this.items=t.length>0?[...t]:[])}render(){return i(r,{key:"601436a1a47be391bf4768d25ef7f8da911fc80d"},this.renderEmptyState(),this.renderOrderByEditor())}renderEmptyState(){return this.limetype?null:i("div",{class:"empty-state"},i("p",null,"Select a limetype to configure sorting"))}renderOrderByEditor(){return this.limetype?[this.renderHeader(),this.renderOrderByList(),this.renderActions()]:null}renderHeader(){return i("limel-header",{class:"is-narrow",heading:this.label,icon:"sorting_arrows"})}renderOrderByList(){return 0===this.items.length?null:i("div",{class:"order-by-list"},this.items.map(((t,e)=>this.renderItem(t,e))))}renderActions(){return i("limel-button",{label:"Add Sort Field",icon:"plus_math",onClick:this.handleAddSortField})}renderItem(t,e){const r=Object.keys(t)[0]||"";return i("limebb-lime-query-order-by-item",{key:`${r}-${e}`,class:"order-by-item",platform:this.platform,context:this.context,limetype:this.limetype,item:t,onItemChange:this.handleItemChange(e)})}emitChange(){this.change.emit(this.items)}static get watchers(){return{value:["handleValueChange"]}}};u.style=":host(limebb-lime-query-order-by-editor){display:flex;flex-direction:column;gap:1rem;padding:1rem 0}.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;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;width:100%}.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))}limel-header.is-narrow{--header-top-right-left-border-radius:0;width:calc(100% + var(--limebb-lime-query-builder-visual-mode-padding) * 2);margin-left:calc(var(--limebb-lime-query-builder-visual-mode-padding) * -1)}.empty-state{padding:0 2rem;text-align:center;color:rgb(var(--contrast-700))}";const b=["string","text","phone","integer","decimal","percent","time","date","year","quarter","month","yesno","link","user","xml","option","set","file","system"],y=b.filter((t=>"system"!==t));y.push("belongsto","hasone","hasmany","hasandbelongstomany");const g=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 r,s,o,n;return"formInfo"!==i||(o=null===(r=null==t?void 0:t.schema)||void 0===r?void 0:r.oneOf,n=null===(s=null==e?void 0:e.schema)||void 0===s?void 0:s.oneOf,!a(o,n))}render(){var t;const e=this.getLimeTypes().map(f);e.sort(((t,e)=>this.collator.compare(t.text,e.text)));let r=e.find((t=>t.value===this.value)),s=this.invalid;return this.value&&!r&&(s=!0,e.unshift({text:(null===(t=this.limeTypeRepository.getLimeType(this.value))||void 0===t?void 0:t.localname.singular)||this.value,value:this.value}),r=e[0]),e.unshift({text:"",value:""}),i("limel-select",{key:"a6df4090bd93b2fb9d3745b69fcd32a51ff3755b",label:this.label,options:e,value:r,required:this.required,helperText:this.helperText,invalid:s,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(c)),i?i.map((t=>this.limeTypeRepository.getLimeType(t))).filter(l):this.limeTypeRepository.getLimeTypes()}updatePropertyFields(t){for(const e of this.propertyFields)e.limetype=t,e.allowedPropertyTypes===b&&(e.allowedPropertyTypes=y)}get limeTypeRepository(){return this.platform.get(o.LimeTypeRepository)}},f=t=>({text:t.localname.singular,value:t.name,icon:n(t)});export{p as limebb_lime_query_filter_builder,u as limebb_lime_query_order_by_editor,g as limebb_limetype_field}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as i,c as e,h as t,H as r}from"./p-1556b545.js";import{T as o}from"./p-4838284a.js";import{i as s}from"./p-efa5bcd4.js";import"./p-b748c770.js";const l=class{constructor(t){i(this,t),this.change=e(this,"change",7),this.mode="visual",this.codeValue="",this.limetype="",this.handleLimetypeChange=i=>{i.stopPropagation(),this.limetype=i.detail,this.filter=void 0,this.internalResponseFormat={object:{}},this.emitChange()},this.handleFilterChange=i=>{var e;i.stopPropagation(),this.filter=null!==(e=i.detail)&&void 0!==e?e:void 0,this.emitChange()},this.handleResponseFormatChange=i=>{i.stopPropagation(),this.internalResponseFormat=i.detail,this.emitChange()},this.handleLimitChange=i=>{i.stopPropagation();const e=i.detail;this.limit=e?Number.parseInt(e,10):void 0,this.emitChange()},this.handleOrderByChange=i=>{i.stopPropagation(),this.orderBy=i.detail,this.emitChange()},this.handleChange=i=>{i.stopPropagation();const e=i.detail.id;if("visual"===e)try{const i=JSON.parse(this.codeValue);if(!this.checkVisualModeSupport().visualModeSupported)return;this.limetype=i.limetype||"",this.filter=i.filter,this.internalResponseFormat=i.responseFormat,this.limit=i.limit,this.orderBy=i.orderBy,this.mode="visual",this.change.emit(i)}catch(i){}else"code"===e&&(this.updateCodeValue(),this.mode="code")},this.handleCodeChange=i=>{i.stopPropagation(),this.codeValue=i.detail;try{const i=JSON.parse(this.codeValue);this.change.emit(i)}catch(i){}}}getButtons(){return[{id:"visual",title:"Visual"},{id:"code",title:"Code"}]}get visualModeEnabled(){var i,e,t;return null!==(t=null===(e=null===(i=this.platform)||void 0===i?void 0:i.isFeatureEnabled)||void 0===e?void 0:e.call(i,"useLimeQueryBuilderGuiMode"))&&void 0!==t&&t}componentWillLoad(){if(!this.visualModeEnabled)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.orderBy=this.value.orderBy),this.updateCodeValue(),this.checkVisualModeSupport().visualModeSupported||(this.mode="code")}render(){return t(r,{key:"4f1481f575b1afdd63a3115761a52a62699d7f84"},this.renderHeader(),this.renderContent())}renderContent(){const i=this.checkVisualModeSupport();return this.visualModeEnabled&&"code"!==this.mode?this.renderVisualMode():this.renderCodeMode(i)}emitChange(){"code"!==this.mode&&this.limetype&&this.change.emit(this.buildLimeQuery())}updateCodeValue(){this.codeValue=this.limetype?JSON.stringify(this.buildLimeQuery(),null,2):JSON.stringify(this.value||{},null,2)}buildLimeQuery(){const i={limetype:this.limetype,responseFormat:this.internalResponseFormat||{object:{_id:null}},filter:this.filter};return void 0!==this.limit&&this.limit>0&&(i.limit=this.limit),this.orderBy&&this.orderBy.length>0&&(i.orderBy=this.orderBy),i}checkVisualModeSupport(){if(!this.limetypes)return{valid:!0,visualModeSupported:!0,validationErrors:[],visualModeLimitations:[]};let i;if("code"===this.mode&&this.codeValue)try{i=JSON.parse(this.codeValue)}catch(i){return{valid:!1,visualModeSupported:!1,validationErrors:["Invalid JSON"],visualModeLimitations:[]}}else{if(!this.limetype)return{valid:!0,visualModeSupported:!0,validationErrors:[],visualModeLimitations:[]};i={limetype:this.limetype,responseFormat:this.internalResponseFormat||{object:{_id:null}},filter:this.filter},void 0!==this.limit&&this.limit>0&&(i.limit=this.limit)}return s(i,this.limetypes,this.activeLimetype,this.visualModeEnabled)}renderModeSwitch(i){const e=!i.visualModeSupported,r=this.getButtons().map((i=>Object.assign(Object.assign({},i),{selected:i.id===this.mode})));return t("limel-button-group",{slot:"actions",onChange:this.handleChange,value:r,disabled:e})}renderCodeEditor(i){return[t("limel-code-editor",{value:this.codeValue,language:"json",lineNumbers:!0,fold:!0,lint:!0,onChange:this.handleCodeChange}),!i.valid&&i.validationErrors.length>0&&t("div",{class:"validation-errors"},t("strong",null,"Invalid Lime Query:"),t("ul",null,i.validationErrors.map((i=>t("li",null,i))))),this.visualModeEnabled&&i.valid&&!i.visualModeSupported&&i.visualModeLimitations.length>0&&t("div",{class:"visual-mode-limitations"},t("strong",null,"Cannot switch to visual mode:"),t("ul",null,i.visualModeLimitations.map((i=>t("li",null,i)))))]}renderLimetypeSection(){return t("limebb-limetype-field",{platform:this.platform,context:this.context,label:"Limetype",value:this.limetype,required:!0,fieldName:"limetype",onChange:this.handleLimetypeChange})}renderResponseFormatSection(){if(this.limetype)return t("section",{class:"response-format"},t("limebb-lime-query-response-format-editor",{platform:this.platform,context:this.context,limetype:this.limetype,value:this.internalResponseFormat,onChange:this.handleResponseFormatChange}))}renderFilterSection(){if(this.limetype)return t("section",{class:"filter"},t("limel-header",{class:"is-narrow",heading:"Filter Conditions",icon:"-lime-filter"}),t("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 i;if(this.limetype)return t("section",{class:"query-options"},t("limel-header",{class:"is-narrow",heading:"Query Options",icon:"ask_question"}),t("div",{class:"query-options-controls"},t("limel-input-field",{label:"Limit",type:"number",value:(null===(i=this.limit)||void 0===i?void 0:i.toString())||"",placeholder:"No limit",helperText:"Maximum number of results",onChange:this.handleLimitChange}),t("limebb-lime-query-order-by-editor",{platform:this.platform,context:this.context,limetype:this.limetype,value:this.orderBy,onChange:this.handleOrderByChange})))}renderVisualMode(){return t("div",{class:"visual-mode"},this.renderLimetypeSection(),this.renderResponseFormatSection(),this.renderFilterSection(),this.renderQueryOptionsSection())}renderHeader(){const i=this.checkVisualModeSupport();return t("limel-header",{heading:this.label},this.renderModeControls(i))}renderModeControls(i){if(this.visualModeEnabled)return this.renderModeSwitch(i)}renderCodeMode(i){return t("div",{class:"code-mode"},this.renderCodeEditor(i))}};(function(i,e,t,r){var o,s=arguments.length,l=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,t):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(i,e,t,r);else for(var d=i.length-1;d>=0;d--)(o=i[d])&&(l=(s<3?o(l):s>3?o(e,t,l):o(e,t))||l);s>3&&l&&Object.defineProperty(e,t,l)})([o()],l.prototype,"limetypes",void 0),l.style="*,*:before,*:after{box-sizing:border-box}:host(limebb-lime-query-builder){--header-background-color:rgb(var(--contrast-400));--limebb-lime-query-builder-background-color:rgb(var(--contrast-100));--limebb-lime-query-builder-border-radius:0.75rem;--limebb-lime-query-builder-visual-mode-padding:1rem;--limebb-lime-query-builder-group-color:rgb(var(--color-sky-lighter));box-sizing:border-box;width:calc(100% - 1.5rem);margin:0.75rem auto;display:flex;flex-direction:column;border-radius:var(--limebb-lime-query-builder-border-radius);background-color:var(--limebb-lime-query-builder-background-color);box-shadow:var(--shadow-inflated-16)}.visual-mode{display:flex;flex-direction:column;gap:1rem;padding:var(--limebb-lime-query-builder-visual-mode-padding);border:1px solid var(--header-background-color);border-radius:0 0 var(--limebb-lime-query-builder-border-radius) var(--limebb-lime-query-builder-border-radius)}.code-mode{--code-editor-max-height:70vh;display:flex;flex-direction:column;gap:1rem}.code-mode .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-mode .validation-errors strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-mode .validation-errors ul{margin:0;padding-left:1.5rem}.code-mode .validation-errors li{margin:0.25rem 0}.code-mode .visual-mode-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-mode .visual-mode-limitations strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-mode .visual-mode-limitations ul{margin:0;padding-left:1.5rem}.code-mode .visual-mode-limitations li{margin:0.25rem 0}section.filter,section.query-options{display:flex;flex-direction:column;gap:1rem}section h4{margin:0;font-size:1.125rem;font-weight:600;color:rgb(var(--contrast-1000))}limel-header.is-narrow{--header-top-right-left-border-radius:0;width:calc(100% + var(--limebb-lime-query-builder-visual-mode-padding) * 2);margin-left:calc(var(--limebb-lime-query-builder-visual-mode-padding) * -1)}.query-options-controls{display:flex;flex-direction:column;gap:1rem}";export{l as limebb_lime_query_builder}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,c as t,h as i}from"./p-1556b545.js";import{T as o}from"./p-4838284a.js";import{v as r}from"./p-efa5bcd4.js";import"./p-b748c770.js";function s(e){let t;try{t=JSON.parse(e)}catch(e){throw new Error(`Invalid JSON: ${e.message}`)}if(null===t||"object"!=typeof t)throw new Error("Response format must be an object");const i=new Set(["object","aggregates"]),o=Object.keys(t),r=o.filter((e=>!i.has(e)));if(r.length>0)throw new Error(`Unexpected properties in response format: ${r.join(", ")}. Only 'object' and 'aggregates' are allowed.`);if(o.length>0&&!t.object&&!t.aggregates)throw new Error("Response format must contain at least one of: object, aggregates");return t}const l=class{constructor(i){e(this,i),this.change=t(this,"change",7),this.label="Response Format",this.helperText="",this.mode="visual",this.codeValue="",this.handleModeChange=e=>{e.stopPropagation();const t=e.detail.id;"visual"===t?this.switchToVisualMode():"code"===t&&this.switchToCode()},this.switchToVisualMode=()=>{try{const e=s(this.codeValue);if(!r(e,this.limetypes,this.limetype,this.visualModeEnabled).visualModeSupported)return;this.internalValue=e,this.mode="visual",this.change.emit(e)}catch(e){}},this.switchToCode=()=>{this.updateCodeValue(),this.mode="code"},this.handleCodeChange=e=>{e.stopPropagation(),this.codeValue=e.detail;try{const e=s(this.codeValue);this.internalValue=e,this.change.emit(e)}catch(e){}},this.handleVisualModeChange=e=>{e.stopPropagation(),this.internalValue=e.detail,this.updateCodeValue(),this.change.emit(e.detail)}}get visualModeEnabled(){var e,t,i;return null!==(i=null===(t=null===(e=this.platform)||void 0===e?void 0:e.isFeatureEnabled)||void 0===t?void 0:t.call(e,"useLimeQueryBuilderGuiMode"))&&void 0!==i&&i}componentWillLoad(){this.internalValue=this.value||{object:{_id:null}},this.updateCodeValue(),this.visualModeEnabled&&this.checkVisualModeSupport().visualModeSupported||(this.mode="code")}componentWillUpdate(){this.value&&"visual"===this.mode&&(this.internalValue=this.value)}render(){const e=this.checkVisualModeSupport();return i("div",{key:"7ae23c1366da49b591c0914f49f25c179e4d6712",class:"response-format-builder"},this.label&&i("h1",{key:"0cd528a69dd1b05769c678151f0827de15d167a8",class:"builder-label"},this.label),this.helperText&&i("p",{key:"b636ca0d32b244d051e74ed538cbd11438f29cd1",class:"builder-helper-text"},this.helperText),this.visualModeEnabled&&i("div",{key:"dc7248cb27d99aa654b0f1659938c3f2933d89e0",class:"mode-controls"},this.renderModeSwitch(e)),this.visualModeEnabled&&"code"!==this.mode?i("div",{class:"visual-mode"},this.renderVisualMode()):i("div",{class:"code-mode"},this.renderCodeEditor(e)))}renderModeSwitch(e){const t=!e.visualModeSupported,o=[{id:"visual",title:"Visual"},{id:"code",title:"Code"}].map((e=>Object.assign(Object.assign({},e),{selected:e.id===this.mode})));return i("limel-button-group",{value:o,disabled:t,onChange:this.handleModeChange})}renderCodeEditor(e){return i("div",{class:"code-editor-container"},i("limel-code-editor",{value:this.codeValue,language:"json",lineNumbers:!0,fold:!0,lint:!0,onChange:this.handleCodeChange}),!e.valid&&e.validationErrors.length>0&&i("div",{class:"validation-errors"},i("strong",null,"Invalid Response Format:"),i("ul",null,e.validationErrors.map((e=>i("li",null,e))))),this.visualModeEnabled&&e.valid&&!e.visualModeSupported&&e.visualModeLimitations.length>0&&i("div",{class:"visual-mode-limitations"},i("strong",null,"Cannot switch to visual mode:"),i("ul",null,e.visualModeLimitations.map((e=>i("li",null,e))))))}renderVisualMode(){return i("limebb-lime-query-response-format-editor",{platform:this.platform,context:this.context,limetype:this.limetype,value:this.internalValue,onChange:this.handleVisualModeChange})}checkVisualModeSupport(){if(!this.limetypes)return{valid:!1,visualModeSupported:!1,validationErrors:["Limetypes not loaded"],visualModeLimitations:[]};let e;if("code"===this.mode)try{e=s(this.codeValue)}catch(e){return{valid:!1,visualModeSupported:!1,validationErrors:[e.message],visualModeLimitations:[]}}else e=this.internalValue;return r(e,this.limetypes,this.limetype,this.visualModeEnabled)}updateCodeValue(){this.codeValue=JSON.stringify(this.internalValue,null,2)}};(function(e,t,i,o){var r,s=arguments.length,l=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,o);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(l=(s<3?r(l):s>3?r(t,i,l):r(t,i))||l);s>3&&l&&Object.defineProperty(t,i,l)})([o()],l.prototype,"limetypes",void 0),l.style=":host(limebb-lime-query-response-format-builder){display:block;width:100%}.response-format-builder{display:flex;flex-direction:column}.builder-label{color:rgb(var(--contrast-1100));font-size:1.625rem;line-height:1.25rem;font-weight:300;margin-top:1rem;margin-bottom:0.25rem}.builder-helper-text{margin-top:0px;margin-bottom:0.5rem;font-size:var(--limel-theme-default-font-size);color:rgb(var(--contrast-1100))}.mode-controls{display:flex;justify-content:flex-end;padding:0.5rem}.visual-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 .visual-mode-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 .visual-mode-limitations strong{display:block;margin-bottom:0.5rem;font-weight:600}.code-editor-container .visual-mode-limitations ul{margin:0;padding-left:1.5rem}.code-editor-container .visual-mode-limitations li{margin:0.25rem 0}";export{l as limebb_lime_query_response_format_builder}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Z as t}from"./p-4838284a.js";import{g as r,a as o}from"./p-b748c770.js";const e=new Set(["$yesterday","$now","$today","$tomorrow","$this_week","$this_month","$this_quarter","$this_year"]),n=/^\$(previous|next)_(day|week|month|quarter|year)\(\d+\)$/,i=/^\$me(\.\w+)*$/;function s(t,r,o=!0){const e=Object.keys(t),n=[];if(o){const t=e.filter((t=>t.startsWith("#")&&"#description"!==t));t.length>0&&n.push(`Property '${r}' contains # properties not supported in visual mode: ${t.join(", ")}`)}return{keys:e.filter((t=>"_alias"!==t&&!t.startsWith("#"))),visualModeLimitations:n}}function u(t,r,o,e,n,i=!0){if(""===t){if(i&&null!==r)throw new Error("Empty property name must have null value");return[]}const u=o[t];if(!u)throw new Error(`Property '${t}' does not exist on limetype '${n}'`);return u.relation?function(t,r,o,e,n=!0){if(null===r)return[];if("object"!=typeof r)throw new TypeError(`Relation property '${t}' must be null or an object`);const i=r,{keys:u,visualModeLimitations:c}=s(i,t,n);if(0===u.length)return c;const l=e.relation.getLimetype();if(!l)throw new Error(`Could not determine related limetype for property '${t}'`);const f={};for(const t of u)f[t]=i[t];const p=a(f,o,l.name,n);return[...c,...p]}(t,r,e,u,i):function(t,r,o=!0){if(null===r)return[];if("object"==typeof r){const{keys:e,visualModeLimitations:n}=s(r,t,o);if(0===e.length)return n;throw new Error(`Non-relation property '${t}' cannot have nested properties other than _alias or # properties (got: ${e.join(", ")})`)}throw new Error(`Non-relation property '${t}' must be null or an object (got ${typeof r})`)}(t,r,i)}function a(t,r,e,n=!0){const i=r[e];if(!i)throw new Error(`Unknown limetype: ${e}`);const s=o(i),a=[];for(const[o,i]of Object.entries(t)){if(o.startsWith("#"))continue;const t=u(o,i,s,r,e,n);a.push(...t)}return a}function c(o,s,u,a=!0){o&&("key"in o?function(o,s,u){if(!Object.values(t).includes(o.op))throw new Error(`Unsupported filter operator: ${o.op}`);const a=function(t,o,s){if(function(t){return"string"==typeof t&&(e.has(t)||n.test(t)||i.test(t))}(t))return{valid:!0};if("string"!=typeof t||!t.startsWith("%activeObject%"))return{valid:!0};if(!o)return{valid:!0};const u=t.replace(/^%activeObject%\.?/,"");if(!u)return{valid:!0};try{return r(s,o,u)?{valid:!0}:{valid:!1,error:`Property path '${u}' does not exist on limetype '${o}'`}}catch(t){return{valid:!1,error:`Invalid placeholder path: ${t.message}`}}}(o.exp,s,u);if(!a.valid)throw new Error(`Invalid placeholder in filter '${o.key}': ${a.error}`)}(o,s,u):"exp"in o&&function(r,o,e,n){if(r.op!==t.AND&&r.op!==t.OR&&r.op!==t.NOT)throw new Error(`Unsupported group operator: ${r.op}`);if(r.op===t.NOT)c(r.exp,o,e,n);else if(r.op===t.AND||r.op===t.OR){const t=r.exp;for(const r of t)c(r,o,e,n)}}(o,s,u,a))}function l(t,o,e,n){const i=[],s=function(t,r){return"object"!=typeof t||null===t?`orderBy[${r}] must be an object`:null}(t,o);if(s)return[s];const u=Object.keys(t),a=function(t,r){return 0===t.length?`orderBy[${r}] must have a property path`:t.length>1?`orderBy[${r}] must have exactly one property, got ${t.length}`:null}(u,o);if(a)return[a];const c=u[0],l=function(t,r){return"ASC"!==t&&"DESC"!==t?`orderBy[${r}]: direction must be 'ASC' or 'DESC', got '${t}'`:null}(t[c],o);l&&i.push(l);const f=function(t,o,e,n){if(!t||""===t)return null;return r(o,e,t)?null:`orderBy[${n}]: property path '${t}' does not exist on limetype '${e}'`}(c,e,n,o);return f&&i.push(f),i}function f(t,r,o,e){const n=[],i=[];try{const n=function(t,r,o,e=!0){const n=[];if(e&&t.aggregates&&n.push("responseFormat.aggregates is not yet supported in visual mode"),t.object){const i=a(t.object,r,o,e);n.push(...i)}return n}(t,r,o,e);i.push(...n)}catch(t){n.push(`Invalid responseFormat: ${t.message}`)}return{errors:n,limitations:i}}function p(t,r,o,e=!0){if(!t)return{valid:!0,visualModeSupported:!0,validationErrors:[],visualModeLimitations:[]};const n=[],i=[];if(t.limetype&&!r[t.limetype]&&n.push(`Unknown limetype: ${t.limetype}`),void 0===t.offset||t.orderBy||n.push("offset requires orderBy to be specified"),t.orderBy){const o=function(t,r,o){const e=[];if(!Array.isArray(t))return e.push("orderBy must be an array"),e;if(!o||!r[o])return e;for(const[n,i]of t.entries()){const t=l(i,n,r,o);e.push(...t)}return e}(t.orderBy,r,t.limetype);n.push(...o)}if(e&&void 0!==t.offset&&i.push("offset is not yet supported in visual mode"),t.filter){const i=function(t,r,o,e){const n=[];try{c(t,r,o,e)}catch(t){n.push(`Invalid filter: ${t.message}`)}return n}(t.filter,o,r,e);n.push(...i)}if(t.responseFormat){const{errors:o,limitations:s}=f(t.responseFormat,r,t.limetype,e);n.push(...o),i.push(...s)}return{valid:0===n.length,visualModeSupported:0===i.length,validationErrors:n,visualModeLimitations:i}}function d(t,r,o,e=!0){const n=[],i=[];if(!r[o])return n.push(`Unknown limetype: ${o}`),{valid:!1,visualModeSupported:!1,validationErrors:n,visualModeLimitations:i};const{errors:s,limitations:u}=f(t,r,o,e);return n.push(...s),i.push(...u),{valid:0===n.length,visualModeSupported:0===i.length,validationErrors:n,visualModeLimitations:i}}export{p as i,d as v}
|