@qoretechnologies/reqraft 0.10.6 → 0.10.8
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/dist/components/form/engine/CompactRow.d.ts.map +1 -1
- package/dist/components/form/engine/CompactRow.js +38 -2
- package/dist/components/form/engine/CompactRow.js.map +1 -1
- package/dist/components/form/engine/FormEngine.d.ts +11 -1
- package/dist/components/form/engine/FormEngine.d.ts.map +1 -1
- package/dist/components/form/engine/FormEngine.js +36 -15
- package/dist/components/form/engine/FormEngine.js.map +1 -1
- package/dist/components/form/engine/compactRowStyles.d.ts +1 -0
- package/dist/components/form/engine/compactRowStyles.d.ts.map +1 -1
- package/dist/components/form/engine/compactRowStyles.js +19 -4
- package/dist/components/form/engine/compactRowStyles.js.map +1 -1
- package/dist/components/form/engine/readFirst.d.ts.map +1 -1
- package/dist/components/form/engine/readFirst.js +30 -2
- package/dist/components/form/engine/readFirst.js.map +1 -1
- package/dist/components/form/fields/auto/AutoFormField.d.ts.map +1 -1
- package/dist/components/form/fields/auto/AutoFormField.js +29 -3
- package/dist/components/form/fields/auto/AutoFormField.js.map +1 -1
- package/package.json +1 -1
- package/src/components/form/engine/CompactRow.tsx +75 -2
- package/src/components/form/engine/FormEngine.stories.tsx +279 -0
- package/src/components/form/engine/FormEngine.tsx +66 -18
- package/src/components/form/engine/compactRowStyles.ts +21 -0
- package/src/components/form/engine/readFirst.ts +25 -4
- package/src/components/form/fields/auto/AutoFormField.tsx +26 -0
- package/src/components/qonsoleSmartInput/QonsoleSmartInput.stories.tsx +69 -37
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { expect, fn, userEvent, waitFor, within } from 'storybook/test';
|
|
3
2
|
import { useState } from 'react';
|
|
3
|
+
import { expect, fn, userEvent, waitFor, within } from 'storybook/test';
|
|
4
4
|
import { sleep } from '../../../__tests__/utils';
|
|
5
5
|
import { StoryMeta } from '../../types';
|
|
6
6
|
import {
|
|
@@ -83,14 +83,16 @@ function mockTokenizeQonsole(text: string): number[] {
|
|
|
83
83
|
for (let lineIdx = 0; lineIdx < lines.length; lineIdx++) {
|
|
84
84
|
const line = lines[lineIdx];
|
|
85
85
|
// Strings first so they swallow any `--`/digits inside their quotes.
|
|
86
|
-
const TOKEN_RE =
|
|
87
|
-
/("(?:\\.|[^"\\])*")|(\d+(?:\.\d+)?)|(--[A-Za-z][\w-]*)|(\/[A-Za-z][\w-]*)/g;
|
|
86
|
+
const TOKEN_RE = /("(?:\\.|[^"\\])*")|(\d+(?:\.\d+)?)|(--[A-Za-z][\w-]*)|(\/[A-Za-z][\w-]*)/g;
|
|
88
87
|
let match: RegExpExecArray | null;
|
|
89
88
|
while ((match = TOKEN_RE.exec(line)) !== null) {
|
|
90
89
|
let type = -1;
|
|
91
|
-
if (match[1])
|
|
92
|
-
|
|
93
|
-
else if (match[
|
|
90
|
+
if (match[1])
|
|
91
|
+
type = 11; // string
|
|
92
|
+
else if (match[2])
|
|
93
|
+
type = 12; // number
|
|
94
|
+
else if (match[3])
|
|
95
|
+
type = 9; // modifier — `--flag`
|
|
94
96
|
else if (match[4]) type = 8; // keyword — `/verb`
|
|
95
97
|
if (type >= 0) {
|
|
96
98
|
tokens.push({
|
|
@@ -102,7 +104,7 @@ function mockTokenizeQonsole(text: string): number[] {
|
|
|
102
104
|
}
|
|
103
105
|
}
|
|
104
106
|
}
|
|
105
|
-
tokens.sort((a, b) =>
|
|
107
|
+
tokens.sort((a, b) => a.line - b.line || a.char - b.char);
|
|
106
108
|
// Delta-encode per LSP spec.
|
|
107
109
|
const data: number[] = [];
|
|
108
110
|
let prevLine = 0;
|
|
@@ -127,11 +129,7 @@ function setupBasicQonsoleMockServer(): IMockLspServer {
|
|
|
127
129
|
experimental: {
|
|
128
130
|
qonsole: {
|
|
129
131
|
version: '1.0',
|
|
130
|
-
methods: [
|
|
131
|
-
'qonsole/assist',
|
|
132
|
-
'qonsole/validate',
|
|
133
|
-
'qonsole/setContext',
|
|
134
|
-
],
|
|
132
|
+
methods: ['qonsole/assist', 'qonsole/validate', 'qonsole/setContext'],
|
|
135
133
|
},
|
|
136
134
|
},
|
|
137
135
|
},
|
|
@@ -213,8 +211,7 @@ function setupBasicQonsoleMockServer(): IMockLspServer {
|
|
|
213
211
|
short_desc: 'Guided setup for a new connection',
|
|
214
212
|
verb: 'create',
|
|
215
213
|
resource: 'connections',
|
|
216
|
-
start_path:
|
|
217
|
-
'/api/latest/qonsole/wizards/create-connection/start',
|
|
214
|
+
start_path: '/api/latest/qonsole/wizards/create-connection/start',
|
|
218
215
|
},
|
|
219
216
|
command: {
|
|
220
217
|
title: 'Start Create connection wizard',
|
|
@@ -227,8 +224,7 @@ function setupBasicQonsoleMockServer(): IMockLspServer {
|
|
|
227
224
|
short_desc: 'Guided setup for a new connection',
|
|
228
225
|
verb: 'create',
|
|
229
226
|
resource: 'connections',
|
|
230
|
-
start_path:
|
|
231
|
-
'/api/latest/qonsole/wizards/create-connection/start',
|
|
227
|
+
start_path: '/api/latest/qonsole/wizards/create-connection/start',
|
|
232
228
|
},
|
|
233
229
|
],
|
|
234
230
|
},
|
|
@@ -237,10 +233,34 @@ function setupBasicQonsoleMockServer(): IMockLspServer {
|
|
|
237
233
|
];
|
|
238
234
|
} else if (ctx.type === 'resource') {
|
|
239
235
|
items = [
|
|
240
|
-
withTextEdit({
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
236
|
+
withTextEdit({
|
|
237
|
+
label: 'services',
|
|
238
|
+
insertText: 'services',
|
|
239
|
+
kind: 7,
|
|
240
|
+
detail: 'Service interfaces',
|
|
241
|
+
commitCharacters: [' '],
|
|
242
|
+
}),
|
|
243
|
+
withTextEdit({
|
|
244
|
+
label: 'workflows',
|
|
245
|
+
insertText: 'workflows',
|
|
246
|
+
kind: 7,
|
|
247
|
+
detail: 'Workflow interfaces',
|
|
248
|
+
commitCharacters: [' '],
|
|
249
|
+
}),
|
|
250
|
+
withTextEdit({
|
|
251
|
+
label: 'jobs',
|
|
252
|
+
insertText: 'jobs',
|
|
253
|
+
kind: 7,
|
|
254
|
+
detail: 'Job interfaces',
|
|
255
|
+
commitCharacters: [' '],
|
|
256
|
+
}),
|
|
257
|
+
withTextEdit({
|
|
258
|
+
label: 'users',
|
|
259
|
+
insertText: 'users',
|
|
260
|
+
kind: 7,
|
|
261
|
+
detail: 'IDP users',
|
|
262
|
+
commitCharacters: [' '],
|
|
263
|
+
}),
|
|
244
264
|
];
|
|
245
265
|
} else if (ctx.type === 'flag') {
|
|
246
266
|
items = [
|
|
@@ -275,9 +295,24 @@ function setupBasicQonsoleMockServer(): IMockLspServer {
|
|
|
275
295
|
];
|
|
276
296
|
} else if (ctx.type === 'flag-value') {
|
|
277
297
|
items = [
|
|
278
|
-
withTextEdit({
|
|
279
|
-
|
|
280
|
-
|
|
298
|
+
withTextEdit({
|
|
299
|
+
label: 'qorus',
|
|
300
|
+
insertText: 'qorus',
|
|
301
|
+
kind: 12,
|
|
302
|
+
detail: 'Qorus core app',
|
|
303
|
+
}),
|
|
304
|
+
withTextEdit({
|
|
305
|
+
label: 'qorus-ide',
|
|
306
|
+
insertText: 'qorus-ide',
|
|
307
|
+
kind: 12,
|
|
308
|
+
detail: 'Qorus IDE',
|
|
309
|
+
}),
|
|
310
|
+
withTextEdit({
|
|
311
|
+
label: 'qorus-creator',
|
|
312
|
+
insertText: 'qorus-creator',
|
|
313
|
+
kind: 12,
|
|
314
|
+
detail: 'Qorus Creator',
|
|
315
|
+
}),
|
|
281
316
|
];
|
|
282
317
|
}
|
|
283
318
|
}
|
|
@@ -520,8 +555,7 @@ export const WithDiagnostics: Story = {
|
|
|
520
555
|
start: { line: 0, character: 6 },
|
|
521
556
|
end: { line: 0, character: 14 },
|
|
522
557
|
},
|
|
523
|
-
message:
|
|
524
|
-
'Unknown resource "services" — did you mean "service"?',
|
|
558
|
+
message: 'Unknown resource "services" — did you mean "service"?',
|
|
525
559
|
severity: 1,
|
|
526
560
|
},
|
|
527
561
|
{
|
|
@@ -676,9 +710,9 @@ export const WithWizardItems: Story = {
|
|
|
676
710
|
() => {
|
|
677
711
|
const dropdown = document.querySelector('.reqore-menu');
|
|
678
712
|
expect(dropdown).not.toBeNull();
|
|
679
|
-
const item = Array.from(
|
|
680
|
-
|
|
681
|
-
)
|
|
713
|
+
const item = Array.from(document.querySelectorAll('.reqore-menu-item')).find((el) =>
|
|
714
|
+
el.textContent?.includes('Create connection')
|
|
715
|
+
);
|
|
682
716
|
expect(item).toBeDefined();
|
|
683
717
|
},
|
|
684
718
|
{ timeout: 30000 }
|
|
@@ -701,7 +735,6 @@ export const WithWizardItems: Story = {
|
|
|
701
735
|
*/
|
|
702
736
|
export const SelectingWizardItemFiresCallback: Story = {
|
|
703
737
|
args: {
|
|
704
|
-
initialValue: '/',
|
|
705
738
|
onWizardStart: fn(),
|
|
706
739
|
},
|
|
707
740
|
parameters: {
|
|
@@ -727,23 +760,22 @@ export const SelectingWizardItemFiresCallback: Story = {
|
|
|
727
760
|
await userEvent.type(editable, '/');
|
|
728
761
|
await waitFor(
|
|
729
762
|
() => {
|
|
730
|
-
const item = Array.from(
|
|
731
|
-
|
|
732
|
-
)
|
|
763
|
+
const item = Array.from(document.querySelectorAll('.reqore-menu-item')).find((el) =>
|
|
764
|
+
el.textContent?.includes('Create connection')
|
|
765
|
+
);
|
|
733
766
|
expect(item).toBeDefined();
|
|
734
767
|
},
|
|
735
768
|
{ timeout: 30000 }
|
|
736
769
|
);
|
|
737
|
-
const wizardItem = Array.from(
|
|
738
|
-
|
|
739
|
-
)
|
|
770
|
+
const wizardItem = Array.from(document.querySelectorAll('.reqore-menu-item')).find((el) =>
|
|
771
|
+
el.textContent?.includes('Create connection')
|
|
772
|
+
);
|
|
740
773
|
await userEvent.click(wizardItem as HTMLElement);
|
|
741
774
|
// The callback fired with the wizard descriptor...
|
|
742
775
|
await waitFor(() => expect(args.onWizardStart).toHaveBeenCalled(), {
|
|
743
776
|
timeout: 30000,
|
|
744
777
|
});
|
|
745
|
-
const callArg = (args.onWizardStart as ReturnType<typeof fn>).mock
|
|
746
|
-
.calls[0][0];
|
|
778
|
+
const callArg = (args.onWizardStart as ReturnType<typeof fn>).mock.calls[0][0];
|
|
747
779
|
expect(callArg).toMatchObject({ action: 'start-wizard' });
|
|
748
780
|
// ...and NO text was inserted (wizard launch ≠ completion insert).
|
|
749
781
|
expect(editable.textContent).toBe('/');
|