@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
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-ff255a0d.js');
|
|
6
6
|
const index_esm = require('./index.esm-d785eb6e.js');
|
|
7
|
-
const limeQueryValidation = require('./lime-query-validation-
|
|
7
|
+
const limeQueryValidation = require('./lime-query-validation-82aa2855.js');
|
|
8
8
|
require('./property-resolution-fb42a46b.js');
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -41,7 +41,7 @@ function parseResponseFormat(json) {
|
|
|
41
41
|
`Only 'object' and 'aggregates' are allowed.`);
|
|
42
42
|
}
|
|
43
43
|
// Must have at least one of object or aggregates
|
|
44
|
-
// Note: Empty objects {} are valid (starting point for
|
|
44
|
+
// Note: Empty objects {} are valid (starting point for visual mode)
|
|
45
45
|
const hasProperties = keys.length > 0;
|
|
46
46
|
if (hasProperties && !parsed.object && !parsed.aggregates) {
|
|
47
47
|
throw new Error('Response format must contain at least one of: object, aggregates');
|
|
@@ -70,7 +70,7 @@ function getDefaultResponseFormat() {
|
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
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}.
|
|
73
|
+
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}";
|
|
74
74
|
const LimebbLimeQueryResponseFormatBuilderStyle0 = limeQueryResponseFormatBuilderCss;
|
|
75
75
|
|
|
76
76
|
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -95,34 +95,34 @@ const LimeQueryResponseFormatBuilder = class {
|
|
|
95
95
|
* Optional helper text for the builder
|
|
96
96
|
*/
|
|
97
97
|
this.helperText = '';
|
|
98
|
-
this.mode = '
|
|
98
|
+
this.mode = 'visual';
|
|
99
99
|
this.codeValue = '';
|
|
100
100
|
this.handleModeChange = (event) => {
|
|
101
101
|
event.stopPropagation();
|
|
102
102
|
const mode = event.detail.id;
|
|
103
|
-
if (mode === '
|
|
104
|
-
this.
|
|
103
|
+
if (mode === 'visual') {
|
|
104
|
+
this.switchToVisualMode();
|
|
105
105
|
}
|
|
106
106
|
else if (mode === 'code') {
|
|
107
107
|
this.switchToCode();
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
110
|
/**
|
|
111
|
-
* Switch from code mode to
|
|
111
|
+
* Switch from code mode to visual mode
|
|
112
112
|
*/
|
|
113
|
-
this.
|
|
113
|
+
this.switchToVisualMode = () => {
|
|
114
114
|
// Validate JSON before switching
|
|
115
115
|
try {
|
|
116
116
|
const parsed = parseResponseFormat(this.codeValue);
|
|
117
|
-
// Check if it's supported in
|
|
118
|
-
const support = limeQueryValidation.validateResponseFormatOnly(parsed, this.limetypes, this.limetype, this.
|
|
119
|
-
if (!support.
|
|
120
|
-
// Don't switch if
|
|
117
|
+
// Check if it's supported in visual mode
|
|
118
|
+
const support = limeQueryValidation.validateResponseFormatOnly(parsed, this.limetypes, this.limetype, this.visualModeEnabled);
|
|
119
|
+
if (!support.visualModeSupported) {
|
|
120
|
+
// Don't switch if visual mode can't render this response format
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
123
|
// Update internal state from parsed value
|
|
124
124
|
this.internalValue = parsed;
|
|
125
|
-
this.mode = '
|
|
125
|
+
this.mode = 'visual';
|
|
126
126
|
this.change.emit(parsed);
|
|
127
127
|
}
|
|
128
128
|
catch (_a) {
|
|
@@ -130,7 +130,7 @@ const LimeQueryResponseFormatBuilder = class {
|
|
|
130
130
|
}
|
|
131
131
|
};
|
|
132
132
|
/**
|
|
133
|
-
* Switch from
|
|
133
|
+
* Switch from visual mode to code mode
|
|
134
134
|
*/
|
|
135
135
|
this.switchToCode = () => {
|
|
136
136
|
this.updateCodeValue();
|
|
@@ -151,14 +151,14 @@ const LimeQueryResponseFormatBuilder = class {
|
|
|
151
151
|
}
|
|
152
152
|
catch (_a) {
|
|
153
153
|
// Invalid JSON - don't emit change
|
|
154
|
-
// Validation errors will be shown by
|
|
154
|
+
// Validation errors will be shown by checkVisualModeSupport()
|
|
155
155
|
}
|
|
156
156
|
};
|
|
157
157
|
/**
|
|
158
|
-
* Handle
|
|
158
|
+
* Handle visual mode changes
|
|
159
159
|
* @param event
|
|
160
160
|
*/
|
|
161
|
-
this.
|
|
161
|
+
this.handleVisualModeChange = (event) => {
|
|
162
162
|
event.stopPropagation();
|
|
163
163
|
this.internalValue = event.detail;
|
|
164
164
|
this.updateCodeValue();
|
|
@@ -166,9 +166,9 @@ const LimeQueryResponseFormatBuilder = class {
|
|
|
166
166
|
};
|
|
167
167
|
}
|
|
168
168
|
/**
|
|
169
|
-
* Check if
|
|
169
|
+
* Check if visual mode is enabled via feature flag
|
|
170
170
|
*/
|
|
171
|
-
get
|
|
171
|
+
get visualModeEnabled() {
|
|
172
172
|
var _a, _b, _c;
|
|
173
173
|
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);
|
|
174
174
|
}
|
|
@@ -177,32 +177,32 @@ const LimeQueryResponseFormatBuilder = class {
|
|
|
177
177
|
this.internalValue = this.value || getDefaultResponseFormat();
|
|
178
178
|
// Update code value from internal value
|
|
179
179
|
this.updateCodeValue();
|
|
180
|
-
// Force code mode if
|
|
181
|
-
if (!this.
|
|
180
|
+
// Force code mode if visual mode is disabled
|
|
181
|
+
if (!this.visualModeEnabled) {
|
|
182
182
|
this.mode = 'code';
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
|
-
// Check if
|
|
186
|
-
const support = this.
|
|
187
|
-
if (!support.
|
|
185
|
+
// Check if visual mode is supported for current value
|
|
186
|
+
const support = this.checkVisualModeSupport();
|
|
187
|
+
if (!support.visualModeSupported) {
|
|
188
188
|
this.mode = 'code';
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
componentWillUpdate() {
|
|
192
192
|
// Sync internal value when prop changes externally
|
|
193
|
-
if (this.value && this.mode === '
|
|
193
|
+
if (this.value && this.mode === 'visual') {
|
|
194
194
|
this.internalValue = this.value;
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
render() {
|
|
198
|
-
const
|
|
199
|
-
return (index.h("div", { key: '
|
|
198
|
+
const visualModeSupported = this.checkVisualModeSupport();
|
|
199
|
+
return (index.h("div", { key: '7ae23c1366da49b591c0914f49f25c179e4d6712', class: "response-format-builder" }, this.label && index.h("h1", { key: '0cd528a69dd1b05769c678151f0827de15d167a8', class: "builder-label" }, this.label), this.helperText && (index.h("p", { key: 'b636ca0d32b244d051e74ed538cbd11438f29cd1', class: "builder-helper-text" }, this.helperText)), this.visualModeEnabled && (index.h("div", { key: 'dc7248cb27d99aa654b0f1659938c3f2933d89e0', class: "mode-controls" }, this.renderModeSwitch(visualModeSupported))), !this.visualModeEnabled || this.mode === 'code' ? (index.h("div", { class: "code-mode" }, this.renderCodeEditor(visualModeSupported))) : (index.h("div", { class: "visual-mode" }, this.renderVisualMode()))));
|
|
200
200
|
}
|
|
201
201
|
renderModeSwitch(support) {
|
|
202
|
-
const
|
|
202
|
+
const visualDisabled = !support.visualModeSupported;
|
|
203
203
|
const buttons = [
|
|
204
204
|
{
|
|
205
|
-
id: '
|
|
205
|
+
id: 'visual',
|
|
206
206
|
title: 'Visual',
|
|
207
207
|
},
|
|
208
208
|
{
|
|
@@ -210,27 +210,27 @@ const LimeQueryResponseFormatBuilder = class {
|
|
|
210
210
|
title: 'Code',
|
|
211
211
|
},
|
|
212
212
|
].map((button) => (Object.assign(Object.assign({}, button), { selected: button.id === this.mode })));
|
|
213
|
-
return (index.h("limel-button-group", { value: buttons, disabled:
|
|
213
|
+
return (index.h("limel-button-group", { value: buttons, disabled: visualDisabled, onChange: this.handleModeChange }));
|
|
214
214
|
}
|
|
215
215
|
renderCodeEditor(support) {
|
|
216
|
-
return (index.h("div", { class: "code-editor-container" }, index.h("limel-code-editor", { value: this.codeValue, language: "json", lineNumbers: true, fold: true, lint: true, onChange: this.handleCodeChange }), !support.valid && support.validationErrors.length > 0 && (index.h("div", { class: "validation-errors" }, index.h("strong", null, "Invalid Response Format:"), index.h("ul", null, support.validationErrors.map((error) => (index.h("li", null, error)))))), this.
|
|
216
|
+
return (index.h("div", { class: "code-editor-container" }, index.h("limel-code-editor", { value: this.codeValue, language: "json", lineNumbers: true, fold: true, lint: true, onChange: this.handleCodeChange }), !support.valid && support.validationErrors.length > 0 && (index.h("div", { class: "validation-errors" }, index.h("strong", null, "Invalid Response Format:"), index.h("ul", null, support.validationErrors.map((error) => (index.h("li", null, error)))))), this.visualModeEnabled &&
|
|
217
217
|
support.valid &&
|
|
218
|
-
!support.
|
|
219
|
-
support.
|
|
218
|
+
!support.visualModeSupported &&
|
|
219
|
+
support.visualModeLimitations.length > 0 && (index.h("div", { class: "visual-mode-limitations" }, index.h("strong", null, "Cannot switch to visual mode:"), index.h("ul", null, support.visualModeLimitations.map((limitation) => (index.h("li", null, limitation))))))));
|
|
220
220
|
}
|
|
221
|
-
|
|
222
|
-
return (index.h("limebb-lime-query-response-format-editor", { platform: this.platform, context: this.context, limetype: this.limetype, value: this.internalValue, onChange: this.
|
|
221
|
+
renderVisualMode() {
|
|
222
|
+
return (index.h("limebb-lime-query-response-format-editor", { platform: this.platform, context: this.context, limetype: this.limetype, value: this.internalValue, onChange: this.handleVisualModeChange }));
|
|
223
223
|
}
|
|
224
224
|
/**
|
|
225
|
-
* Check if current value can be rendered in
|
|
225
|
+
* Check if current value can be rendered in visual mode
|
|
226
226
|
*/
|
|
227
|
-
|
|
227
|
+
checkVisualModeSupport() {
|
|
228
228
|
if (!this.limetypes) {
|
|
229
229
|
return {
|
|
230
230
|
valid: false,
|
|
231
|
-
|
|
231
|
+
visualModeSupported: false,
|
|
232
232
|
validationErrors: ['Limetypes not loaded'],
|
|
233
|
-
|
|
233
|
+
visualModeLimitations: [],
|
|
234
234
|
};
|
|
235
235
|
}
|
|
236
236
|
// Try to parse code value if in code mode
|
|
@@ -242,16 +242,16 @@ const LimeQueryResponseFormatBuilder = class {
|
|
|
242
242
|
catch (error) {
|
|
243
243
|
return {
|
|
244
244
|
valid: false,
|
|
245
|
-
|
|
245
|
+
visualModeSupported: false,
|
|
246
246
|
validationErrors: [error.message],
|
|
247
|
-
|
|
247
|
+
visualModeLimitations: [],
|
|
248
248
|
};
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
251
|
else {
|
|
252
252
|
valueToCheck = this.internalValue;
|
|
253
253
|
}
|
|
254
|
-
return limeQueryValidation.validateResponseFormatOnly(valueToCheck, this.limetypes, this.limetype, this.
|
|
254
|
+
return limeQueryValidation.validateResponseFormatOnly(valueToCheck, this.limetypes, this.limetype, this.visualModeEnabled);
|
|
255
255
|
}
|
|
256
256
|
/**
|
|
257
257
|
* Update code value from internal state
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
--header-background-color: rgb(var(--contrast-400));
|
|
9
9
|
--limebb-lime-query-builder-background-color: rgb(var(--contrast-100));
|
|
10
10
|
--limebb-lime-query-builder-border-radius: 0.75rem;
|
|
11
|
-
--limebb-lime-query-builder-
|
|
11
|
+
--limebb-lime-query-builder-visual-mode-padding: 1rem;
|
|
12
12
|
--limebb-lime-query-builder-group-color: rgb(var(--color-sky-lighter));
|
|
13
13
|
box-sizing: border-box;
|
|
14
14
|
width: calc(100% - 1.5rem);
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
box-shadow: var(--shadow-inflated-16);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
.
|
|
23
|
+
.visual-mode {
|
|
24
24
|
display: flex;
|
|
25
25
|
flex-direction: column;
|
|
26
26
|
gap: 1rem;
|
|
27
|
-
padding: var(--limebb-lime-query-builder-
|
|
27
|
+
padding: var(--limebb-lime-query-builder-visual-mode-padding);
|
|
28
28
|
border: 1px solid var(--header-background-color);
|
|
29
29
|
border-radius: 0 0 var(--limebb-lime-query-builder-border-radius) var(--limebb-lime-query-builder-border-radius);
|
|
30
30
|
}
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
.code-mode .validation-errors li {
|
|
56
56
|
margin: 0.25rem 0;
|
|
57
57
|
}
|
|
58
|
-
.code-mode .
|
|
58
|
+
.code-mode .visual-mode-limitations {
|
|
59
59
|
padding: 0.75rem 1rem;
|
|
60
60
|
color: rgb(var(--color-blue-dark));
|
|
61
61
|
background-color: rgb(var(--color-blue-lighter));
|
|
@@ -63,16 +63,16 @@
|
|
|
63
63
|
border-radius: 0.25rem;
|
|
64
64
|
font-size: 0.875rem;
|
|
65
65
|
}
|
|
66
|
-
.code-mode .
|
|
66
|
+
.code-mode .visual-mode-limitations strong {
|
|
67
67
|
display: block;
|
|
68
68
|
margin-bottom: 0.5rem;
|
|
69
69
|
font-weight: 600;
|
|
70
70
|
}
|
|
71
|
-
.code-mode .
|
|
71
|
+
.code-mode .visual-mode-limitations ul {
|
|
72
72
|
margin: 0;
|
|
73
73
|
padding-left: 1.5rem;
|
|
74
74
|
}
|
|
75
|
-
.code-mode .
|
|
75
|
+
.code-mode .visual-mode-limitations li {
|
|
76
76
|
margin: 0.25rem 0;
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -92,8 +92,8 @@ section h4 {
|
|
|
92
92
|
|
|
93
93
|
limel-header.is-narrow {
|
|
94
94
|
--header-top-right-left-border-radius: 0;
|
|
95
|
-
width: calc(100% + var(--limebb-lime-query-builder-
|
|
96
|
-
margin-left: calc(var(--limebb-lime-query-builder-
|
|
95
|
+
width: calc(100% + var(--limebb-lime-query-builder-visual-mode-padding) * 2);
|
|
96
|
+
margin-left: calc(var(--limebb-lime-query-builder-visual-mode-padding) * -1);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
.query-options-controls {
|
|
@@ -42,7 +42,7 @@ import { isLimeQuerySupported, } from "./lime-query-validation";
|
|
|
42
42
|
*/
|
|
43
43
|
export class LimeQueryBuilder {
|
|
44
44
|
constructor() {
|
|
45
|
-
this.mode = '
|
|
45
|
+
this.mode = 'visual';
|
|
46
46
|
this.codeValue = '';
|
|
47
47
|
this.limetype = '';
|
|
48
48
|
this.handleLimetypeChange = (event) => {
|
|
@@ -81,11 +81,11 @@ export class LimeQueryBuilder {
|
|
|
81
81
|
this.handleChange = (event) => {
|
|
82
82
|
event.stopPropagation();
|
|
83
83
|
const mode = event.detail.id;
|
|
84
|
-
if (mode === '
|
|
84
|
+
if (mode === 'visual') {
|
|
85
85
|
try {
|
|
86
86
|
const parsed = JSON.parse(this.codeValue);
|
|
87
|
-
const support = this.
|
|
88
|
-
if (!support.
|
|
87
|
+
const support = this.checkVisualModeSupport();
|
|
88
|
+
if (!support.visualModeSupported) {
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
91
|
this.limetype = parsed.limetype || '';
|
|
@@ -93,7 +93,7 @@ export class LimeQueryBuilder {
|
|
|
93
93
|
this.internalResponseFormat = parsed.responseFormat;
|
|
94
94
|
this.limit = parsed.limit;
|
|
95
95
|
this.orderBy = parsed.orderBy;
|
|
96
|
-
this.mode = '
|
|
96
|
+
this.mode = 'visual';
|
|
97
97
|
this.change.emit(parsed);
|
|
98
98
|
}
|
|
99
99
|
catch (_a) {
|
|
@@ -122,19 +122,19 @@ export class LimeQueryBuilder {
|
|
|
122
122
|
getButtons() {
|
|
123
123
|
return [
|
|
124
124
|
{
|
|
125
|
-
id: '
|
|
125
|
+
id: 'visual',
|
|
126
126
|
title: 'Visual',
|
|
127
127
|
},
|
|
128
128
|
{ id: 'code', title: 'Code' },
|
|
129
129
|
];
|
|
130
130
|
}
|
|
131
|
-
get
|
|
131
|
+
get visualModeEnabled() {
|
|
132
132
|
var _a, _b, _c;
|
|
133
133
|
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);
|
|
134
134
|
}
|
|
135
135
|
componentWillLoad() {
|
|
136
|
-
// Force code mode if
|
|
137
|
-
if (!this.
|
|
136
|
+
// Force code mode if visual mode is disabled
|
|
137
|
+
if (!this.visualModeEnabled) {
|
|
138
138
|
this.mode = 'code';
|
|
139
139
|
// Initialize code value from prop
|
|
140
140
|
this.updateCodeValue();
|
|
@@ -149,24 +149,24 @@ export class LimeQueryBuilder {
|
|
|
149
149
|
}
|
|
150
150
|
// Initialize code value from prop
|
|
151
151
|
this.updateCodeValue();
|
|
152
|
-
// Check if
|
|
153
|
-
const support = this.
|
|
154
|
-
if (!support.
|
|
152
|
+
// Check if visual mode is supported
|
|
153
|
+
const support = this.checkVisualModeSupport();
|
|
154
|
+
if (!support.visualModeSupported) {
|
|
155
155
|
this.mode = 'code';
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
render() {
|
|
159
|
-
return (h(Host, { key: '
|
|
159
|
+
return (h(Host, { key: '4f1481f575b1afdd63a3115761a52a62699d7f84' }, this.renderHeader(), this.renderContent()));
|
|
160
160
|
}
|
|
161
161
|
renderContent() {
|
|
162
|
-
const
|
|
163
|
-
const showCodeMode = !this.
|
|
162
|
+
const visualModeSupported = this.checkVisualModeSupport();
|
|
163
|
+
const showCodeMode = !this.visualModeEnabled || this.mode === 'code';
|
|
164
164
|
return showCodeMode
|
|
165
|
-
? this.renderCodeMode(
|
|
166
|
-
: this.
|
|
165
|
+
? this.renderCodeMode(visualModeSupported)
|
|
166
|
+
: this.renderVisualMode();
|
|
167
167
|
}
|
|
168
168
|
emitChange() {
|
|
169
|
-
// Only emit in
|
|
169
|
+
// Only emit in visual mode
|
|
170
170
|
if (this.mode === 'code') {
|
|
171
171
|
return;
|
|
172
172
|
}
|
|
@@ -202,14 +202,14 @@ export class LimeQueryBuilder {
|
|
|
202
202
|
}
|
|
203
203
|
return limeQuery;
|
|
204
204
|
}
|
|
205
|
-
|
|
205
|
+
checkVisualModeSupport() {
|
|
206
206
|
if (!this.limetypes) {
|
|
207
207
|
// Can't validate yet, assume all is good
|
|
208
208
|
return {
|
|
209
209
|
valid: true,
|
|
210
|
-
|
|
210
|
+
visualModeSupported: true,
|
|
211
211
|
validationErrors: [],
|
|
212
|
-
|
|
212
|
+
visualModeLimitations: [],
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
215
|
// When in code mode, validate the parsed code value instead of current state
|
|
@@ -221,20 +221,20 @@ export class LimeQueryBuilder {
|
|
|
221
221
|
catch (_a) {
|
|
222
222
|
return {
|
|
223
223
|
valid: false,
|
|
224
|
-
|
|
224
|
+
visualModeSupported: false,
|
|
225
225
|
validationErrors: ['Invalid JSON'],
|
|
226
|
-
|
|
226
|
+
visualModeLimitations: [],
|
|
227
227
|
};
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
else {
|
|
231
|
-
// Build query from current
|
|
231
|
+
// Build query from current visual state
|
|
232
232
|
if (!this.limetype) {
|
|
233
233
|
return {
|
|
234
234
|
valid: true,
|
|
235
|
-
|
|
235
|
+
visualModeSupported: true,
|
|
236
236
|
validationErrors: [],
|
|
237
|
-
|
|
237
|
+
visualModeLimitations: [],
|
|
238
238
|
};
|
|
239
239
|
}
|
|
240
240
|
const responseFormat = this
|
|
@@ -252,23 +252,24 @@ export class LimeQueryBuilder {
|
|
|
252
252
|
queryToCheck.limit = this.limit;
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
|
-
return isLimeQuerySupported(queryToCheck, this.limetypes, this.activeLimetype, this.
|
|
255
|
+
return isLimeQuerySupported(queryToCheck, this.limetypes, this.activeLimetype, this.visualModeEnabled);
|
|
256
256
|
}
|
|
257
257
|
renderModeSwitch(support) {
|
|
258
|
-
const
|
|
258
|
+
const visualDisabled = !support.visualModeSupported;
|
|
259
259
|
const buttons = this.getButtons().map((button) => (Object.assign(Object.assign({}, button), { selected: button.id === this.mode })));
|
|
260
|
-
return (h("limel-button-group", { slot: "actions", onChange: this.handleChange, value: buttons, disabled:
|
|
260
|
+
return (h("limel-button-group", { slot: "actions", onChange: this.handleChange, value: buttons, disabled: visualDisabled }));
|
|
261
261
|
}
|
|
262
|
-
renderCodeEditor(
|
|
262
|
+
renderCodeEditor(visualModeSupported) {
|
|
263
263
|
return [
|
|
264
264
|
h("limel-code-editor", { value: this.codeValue, language: "json", lineNumbers: true, fold: true, lint: true, onChange: this.handleCodeChange }),
|
|
265
265
|
/* Show validation errors (invalid Lime Query) */
|
|
266
|
-
!
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
266
|
+
!visualModeSupported.valid &&
|
|
267
|
+
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)))))),
|
|
268
|
+
/* Show visual mode limitations (only when visual mode is enabled and Lime Query is valid) */
|
|
269
|
+
this.visualModeEnabled &&
|
|
270
|
+
visualModeSupported.valid &&
|
|
271
|
+
!visualModeSupported.visualModeSupported &&
|
|
272
|
+
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)))))),
|
|
272
273
|
];
|
|
273
274
|
}
|
|
274
275
|
renderLimetypeSection() {
|
|
@@ -293,15 +294,15 @@ export class LimeQueryBuilder {
|
|
|
293
294
|
}
|
|
294
295
|
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 }))));
|
|
295
296
|
}
|
|
296
|
-
|
|
297
|
-
return (h("div", { class: "
|
|
297
|
+
renderVisualMode() {
|
|
298
|
+
return (h("div", { class: "visual-mode" }, this.renderLimetypeSection(), this.renderResponseFormatSection(), this.renderFilterSection(), this.renderQueryOptionsSection()));
|
|
298
299
|
}
|
|
299
300
|
renderHeader() {
|
|
300
|
-
const
|
|
301
|
-
return (h("limel-header", { heading: this.label }, this.renderModeControls(
|
|
301
|
+
const visualModeSupported = this.checkVisualModeSupport();
|
|
302
|
+
return (h("limel-header", { heading: this.label }, this.renderModeControls(visualModeSupported)));
|
|
302
303
|
}
|
|
303
304
|
renderModeControls(support) {
|
|
304
|
-
if (!this.
|
|
305
|
+
if (!this.visualModeEnabled) {
|
|
305
306
|
return;
|
|
306
307
|
}
|
|
307
308
|
return this.renderModeSwitch(support);
|
package/dist/collection/components/lime-query-builder/lime-query-response-format-builder.css
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
padding: 0.5rem;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
.
|
|
33
|
+
.visual-mode,
|
|
34
34
|
.code-mode {
|
|
35
35
|
display: block;
|
|
36
36
|
}
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
.code-editor-container .validation-errors li {
|
|
62
62
|
margin: 0.25rem 0;
|
|
63
63
|
}
|
|
64
|
-
.code-editor-container .
|
|
64
|
+
.code-editor-container .visual-mode-limitations {
|
|
65
65
|
padding: 0.75rem 1rem;
|
|
66
66
|
color: rgb(var(--color-blue-dark));
|
|
67
67
|
background-color: rgb(var(--color-blue-lighter));
|
|
@@ -69,15 +69,15 @@
|
|
|
69
69
|
border-radius: 0.25rem;
|
|
70
70
|
font-size: 0.875rem;
|
|
71
71
|
}
|
|
72
|
-
.code-editor-container .
|
|
72
|
+
.code-editor-container .visual-mode-limitations strong {
|
|
73
73
|
display: block;
|
|
74
74
|
margin-bottom: 0.5rem;
|
|
75
75
|
font-weight: 600;
|
|
76
76
|
}
|
|
77
|
-
.code-editor-container .
|
|
77
|
+
.code-editor-container .visual-mode-limitations ul {
|
|
78
78
|
margin: 0;
|
|
79
79
|
padding-left: 1.5rem;
|
|
80
80
|
}
|
|
81
|
-
.code-editor-container .
|
|
81
|
+
.code-editor-container .visual-mode-limitations li {
|
|
82
82
|
margin: 0.25rem 0;
|
|
83
83
|
}
|