@qoretechnologies/reqraft 0.10.45 → 0.10.46-pr.107.g08386aa
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 +111 -25
- package/dist/components/form/engine/CompactRow.js.map +1 -1
- package/dist/components/form/engine/CompactToolbar.d.ts.map +1 -1
- package/dist/components/form/engine/CompactToolbar.js +2 -4
- package/dist/components/form/engine/CompactToolbar.js.map +1 -1
- package/dist/components/form/engine/FormEngine.d.ts.map +1 -1
- package/dist/components/form/engine/FormEngine.js +96 -65
- package/dist/components/form/engine/FormEngine.js.map +1 -1
- package/dist/components/form/engine/compactRowStyles.d.ts.map +1 -1
- package/dist/components/form/engine/compactRowStyles.js +8 -2
- package/dist/components/form/engine/compactRowStyles.js.map +1 -1
- package/package.json +1 -1
- package/src/components/form/engine/CompactRow.tsx +276 -27
- package/src/components/form/engine/CompactToolbar.tsx +16 -14
- package/src/components/form/engine/FormEngine.stories.tsx +297 -54
- package/src/components/form/engine/FormEngine.tsx +161 -126
- package/src/components/form/engine/compactRowStyles.ts +28 -0
|
@@ -964,9 +964,7 @@ export const CompactRowCancelEdit: Story = {
|
|
|
964
964
|
const row = canvasElement.querySelector<HTMLElement>('[data-field="cookie_name"]');
|
|
965
965
|
expect(row).toBeTruthy();
|
|
966
966
|
fireEvent.click(row!);
|
|
967
|
-
await waitFor(() =>
|
|
968
|
-
expect(canvasElement.querySelector('.readfirst-row-editing')).toBeTruthy()
|
|
969
|
-
);
|
|
967
|
+
await waitFor(() => expect(canvasElement.querySelector('.readfirst-row-editing')).toBeTruthy());
|
|
970
968
|
|
|
971
969
|
// An untouched field offers no Cancel — it would do exactly what Done does.
|
|
972
970
|
expect(canvasElement.querySelector('.options-readfirst-cancel')).toBeNull();
|
|
@@ -1051,9 +1049,7 @@ export const CompactRowAbsorbsLanguage: Story = {
|
|
|
1051
1049
|
|
|
1052
1050
|
// Opening the host renders the language control inside its container.
|
|
1053
1051
|
fireEvent.click(sourceRow as HTMLElement);
|
|
1054
|
-
await waitFor(() =>
|
|
1055
|
-
expect(canvasElement.querySelector('.readfirst-row-editing')).toBeTruthy()
|
|
1056
|
-
);
|
|
1052
|
+
await waitFor(() => expect(canvasElement.querySelector('.readfirst-row-editing')).toBeTruthy());
|
|
1057
1053
|
await waitFor(() =>
|
|
1058
1054
|
expect(canvasElement.querySelector('.options-readfirst-absorbed')).toBeTruthy()
|
|
1059
1055
|
);
|
|
@@ -1078,9 +1074,7 @@ export const CompactRowCancelEditAffordance: Story = {
|
|
|
1078
1074
|
const row = canvasElement.querySelector<HTMLElement>('[data-field="cookie_name"]');
|
|
1079
1075
|
expect(row).toBeTruthy();
|
|
1080
1076
|
fireEvent.click(row!);
|
|
1081
|
-
await waitFor(() =>
|
|
1082
|
-
expect(canvasElement.querySelector('.readfirst-row-editing')).toBeTruthy()
|
|
1083
|
-
);
|
|
1077
|
+
await waitFor(() => expect(canvasElement.querySelector('.readfirst-row-editing')).toBeTruthy());
|
|
1084
1078
|
|
|
1085
1079
|
const input = canvasElement.querySelector<HTMLInputElement>(
|
|
1086
1080
|
'[data-field="cookie_name"] input, [data-field="cookie_name"] textarea'
|
|
@@ -1169,7 +1163,7 @@ export const CompactRowCodeEditorMessage: Story = {
|
|
|
1169
1163
|
docs: {
|
|
1170
1164
|
description: {
|
|
1171
1165
|
story:
|
|
1172
|
-
|
|
1166
|
+
'A schema `messages` entry on a code-editor field. Every other field surfaces its messages on the collapsed row; a code field draws a preview in the same cell, and the message has to survive beside it — a diagnostic the reader only finds by opening the field is not reported. Qorus puts source-validation results here, so an invalid service is called out on the row rather than at save time.',
|
|
1173
1167
|
},
|
|
1174
1168
|
},
|
|
1175
1169
|
},
|
|
@@ -1268,7 +1262,7 @@ export const CompactRowMessageWhileEditing: Story = {
|
|
|
1268
1262
|
docs: {
|
|
1269
1263
|
description: {
|
|
1270
1264
|
story:
|
|
1271
|
-
|
|
1265
|
+
'The same message, with the row OPEN. A schema message is guidance about the value, so the moment it matters most is while the value is being edited — and a validation diagnostic is useless anywhere else: it names a line the author can only fix with the editor in front of them. Qorus opens the Source Code row on arrival, so a message that only survives on the collapsed row was never seen at all.',
|
|
1272
1266
|
},
|
|
1273
1267
|
},
|
|
1274
1268
|
},
|
|
@@ -1474,7 +1468,7 @@ export const NestedOptionInheritsRenderPropFromAncestorCompact: Story = {
|
|
|
1474
1468
|
docs: {
|
|
1475
1469
|
description: {
|
|
1476
1470
|
story:
|
|
1477
|
-
|
|
1471
|
+
'Renders the NestedOptionInheritsRenderPropFromAncestor schema with compact=true — the compact renderer previews the list-of-hash rows through their arg_schema, naming each method, rather than printing [object Object].',
|
|
1478
1472
|
},
|
|
1479
1473
|
},
|
|
1480
1474
|
},
|
|
@@ -1774,7 +1768,7 @@ export const CompactWithholdsFieldsWithUnmetDependencies: Story = {
|
|
|
1774
1768
|
docs: {
|
|
1775
1769
|
description: {
|
|
1776
1770
|
story:
|
|
1777
|
-
|
|
1771
|
+
'A field whose `depends_on` is not fulfilled is not offered as an addable one. The scheme here is Permissive, so the two cookie-only fields are absent from the Optional box entirely — only the field that depends on nothing is offered. Setting the scheme to Cookie brings them back (and flashes them). Before this, they were listed, and clicking one opened a row that said it was disabled: an affordance leading nowhere.',
|
|
1778
1772
|
},
|
|
1779
1773
|
},
|
|
1780
1774
|
},
|
|
@@ -1821,10 +1815,9 @@ export const CompactWithholdsFieldsWithUnmetDependencies: Story = {
|
|
|
1821
1815
|
// The independent field IS offered — without this the two absences below
|
|
1822
1816
|
// would also be explained by an Optional box that never opened.
|
|
1823
1817
|
await _testsWaitForText('Note');
|
|
1824
|
-
await waitFor(
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
);
|
|
1818
|
+
await waitFor(() => expect(document.querySelector('[data-field="note"]')).toBeTruthy(), {
|
|
1819
|
+
timeout: 10000,
|
|
1820
|
+
});
|
|
1828
1821
|
|
|
1829
1822
|
await waitFor(
|
|
1830
1823
|
() => {
|
|
@@ -2457,7 +2450,7 @@ export const CompactReadOnly: Story = {
|
|
|
2457
2450
|
docs: {
|
|
2458
2451
|
description: {
|
|
2459
2452
|
story:
|
|
2460
|
-
'Renders the Compact fixture with readOnly enabled —
|
|
2453
|
+
'Renders the Compact fixture with readOnly enabled — no completion meter, no Needs attention / Set / Optional boxes and no required asterisks; every set field is one flat list, and opening a row shows its value in a read presentation with Close as the only control.',
|
|
2461
2454
|
},
|
|
2462
2455
|
},
|
|
2463
2456
|
chromatic: { disable: true },
|
|
@@ -2468,14 +2461,40 @@ export const CompactReadOnly: Story = {
|
|
|
2468
2461
|
},
|
|
2469
2462
|
play: async () => {
|
|
2470
2463
|
await _testsWaitForText('order-fulfilment');
|
|
2471
|
-
//
|
|
2464
|
+
// Nothing that reports progress: no meter, no Draft/Ready, no boxes.
|
|
2465
|
+
expect(document.querySelector('.options-readfirst-completion')).toBeNull();
|
|
2466
|
+
expect(document.querySelector('.options-readfirst-group')).toBeNull();
|
|
2472
2467
|
await _testsWaitForTextToNotExist('Draft');
|
|
2473
|
-
|
|
2474
|
-
|
|
2468
|
+
await _testsWaitForTextToNotExist('Needs attention');
|
|
2469
|
+
await _testsWaitForTextToNotExist('Optional');
|
|
2470
|
+
// A required field nobody set is listed, unset, with no amber dot.
|
|
2471
|
+
await _testsWaitForText('Description');
|
|
2472
|
+
expect(
|
|
2473
|
+
document.querySelector(
|
|
2474
|
+
'.readfirst-row[data-field="description"] .options-readfirst-statusdot-slot > *'
|
|
2475
|
+
)
|
|
2476
|
+
).toBeNull();
|
|
2477
|
+
// Opening a row shows the value — not an input holding it.
|
|
2475
2478
|
await _testsClickText('order-fulfilment');
|
|
2476
|
-
|
|
2479
|
+
let reading: Element | null = null;
|
|
2480
|
+
await waitFor(() => {
|
|
2481
|
+
reading = document.querySelector('.options-readfirst-reading[data-field="name"]');
|
|
2482
|
+
expect(reading).toBeTruthy();
|
|
2483
|
+
});
|
|
2484
|
+
expect(reading!.querySelector('input, textarea, select, [contenteditable]')).toBeNull();
|
|
2485
|
+
expect(reading!.textContent).toContain('order-fulfilment');
|
|
2486
|
+
// Close is the only way out, and it closes.
|
|
2487
|
+
expect(reading!.querySelector('.options-readfirst-more')).toBeNull();
|
|
2477
2488
|
await _testsClickButton({ selector: '.options-readfirst-done' });
|
|
2478
|
-
await waitFor(() => expect(document.querySelector('.options-readfirst-
|
|
2489
|
+
await waitFor(() => expect(document.querySelector('.options-readfirst-reading')).toBeNull());
|
|
2490
|
+
// A choice opens as the chosen option, not as a select that still works.
|
|
2491
|
+
await _testsClickText('Python');
|
|
2492
|
+
await waitFor(() => {
|
|
2493
|
+
reading = document.querySelector('.options-readfirst-reading[data-field="lang"]');
|
|
2494
|
+
expect(reading).toBeTruthy();
|
|
2495
|
+
});
|
|
2496
|
+
expect(reading!.querySelector('input, textarea, select, [contenteditable]')).toBeNull();
|
|
2497
|
+
expect(reading!.textContent).toContain('Python');
|
|
2479
2498
|
},
|
|
2480
2499
|
};
|
|
2481
2500
|
|
|
@@ -2658,18 +2677,19 @@ export const CompactBasic: Story = {
|
|
|
2658
2677
|
},
|
|
2659
2678
|
};
|
|
2660
2679
|
|
|
2661
|
-
// Read-only richtext + template
|
|
2662
|
-
//
|
|
2663
|
-
//
|
|
2664
|
-
//
|
|
2665
|
-
//
|
|
2666
|
-
//
|
|
2680
|
+
// Read-only richtext + template. Opening a field in a read-only form must not
|
|
2681
|
+
// yield an editing surface of any kind: a richtext value reads as its text with
|
|
2682
|
+
// its template chips (no Slate instance at all — the earlier fix had left one
|
|
2683
|
+
// mounted with contenteditable="false", which is still an editor wearing a
|
|
2684
|
+
// lock), and a field whose value is a template ($local:…) reads as the
|
|
2685
|
+
// resolved-name chip. Regression cover for the review note "this should show
|
|
2686
|
+
// as a readonly richtext or a readonly template picker".
|
|
2667
2687
|
export const CompactReadOnlyRichText: Story = {
|
|
2668
2688
|
parameters: {
|
|
2669
2689
|
docs: {
|
|
2670
2690
|
description: {
|
|
2671
2691
|
story:
|
|
2672
|
-
'Renders the CompactBasic fixture with readOnly enabled — opening the Rich Text row shows
|
|
2692
|
+
'Renders the CompactBasic fixture with readOnly enabled — opening the Rich Text row shows the text with its template chip and mounts no editor, and the Template row reads as a chip showing the resolved template name (never the raw $local reference).',
|
|
2673
2693
|
},
|
|
2674
2694
|
},
|
|
2675
2695
|
chromatic: { disable: true },
|
|
@@ -2681,44 +2701,258 @@ export const CompactReadOnlyRichText: Story = {
|
|
|
2681
2701
|
},
|
|
2682
2702
|
play: async () => {
|
|
2683
2703
|
await _testsWaitForText('Rich Text option');
|
|
2684
|
-
|
|
2685
|
-
//
|
|
2686
|
-
|
|
2687
|
-
|
|
2704
|
+
// Editor verdicts stay in the editor: the fixture's invalid value and its
|
|
2705
|
+
// dependency-locked field print no "fix this" hint in a read view.
|
|
2706
|
+
await _testsWaitForTextToNotExist('Text value is empty');
|
|
2707
|
+
await _testsWaitForTextToNotExist('dependencies are not fulfilled');
|
|
2708
|
+
|
|
2709
|
+
// Read-only rows open as a VIEW. The richtext field used to mount its
|
|
2710
|
+
// Slate surface with contenteditable="false" — a read view mounts no
|
|
2711
|
+
// editing surface at all, and the text with its chip is what shows.
|
|
2688
2712
|
await _testsClickText('Rich Text option');
|
|
2689
2713
|
await waitFor(
|
|
2690
2714
|
() => {
|
|
2691
|
-
const
|
|
2692
|
-
'.options-readfirst-
|
|
2715
|
+
const reading = document.querySelector(
|
|
2716
|
+
'.options-readfirst-reading[data-field="richTextOption"]'
|
|
2693
2717
|
);
|
|
2694
|
-
expect(
|
|
2695
|
-
expect(
|
|
2718
|
+
expect(reading).toBeTruthy();
|
|
2719
|
+
expect(reading?.querySelector('[contenteditable], input, textarea')).toBeNull();
|
|
2720
|
+
expect(reading?.textContent).toContain('This is a rich text option');
|
|
2721
|
+
expect(reading?.querySelector('.reqore-tag')?.textContent).toContain('Richtext Template');
|
|
2696
2722
|
},
|
|
2697
2723
|
{ timeout: 10000 }
|
|
2698
2724
|
);
|
|
2699
2725
|
|
|
2700
|
-
// A template-valued field
|
|
2701
|
-
//
|
|
2726
|
+
// A template-valued field reads as the resolved-name chip — never an
|
|
2727
|
+
// editable input.
|
|
2702
2728
|
await _testsClickText('Template option');
|
|
2703
2729
|
await waitFor(
|
|
2704
2730
|
() => {
|
|
2705
|
-
const
|
|
2706
|
-
|
|
2707
|
-
|
|
2731
|
+
const reading = document.querySelector(
|
|
2732
|
+
'.options-readfirst-reading[data-field="templateOption"]'
|
|
2733
|
+
);
|
|
2734
|
+
expect(reading).toBeTruthy();
|
|
2735
|
+
const tag = reading?.querySelector('.reqore-tag');
|
|
2708
2736
|
expect(tag).toBeTruthy();
|
|
2709
2737
|
// The chip resolves the catalogue display name ('$local:test' →
|
|
2710
|
-
// 'Test (local)')
|
|
2711
|
-
//
|
|
2712
|
-
// label must be the resolved name, never the raw reference.
|
|
2738
|
+
// 'Test (local)'). The raw value is tooltip-only (portalled, not in
|
|
2739
|
+
// the tag), so the visible label must be the resolved name.
|
|
2713
2740
|
expect(tag?.textContent).toContain('Test (local)');
|
|
2714
2741
|
expect(tag?.textContent).not.toContain('$local:test');
|
|
2715
|
-
expect(
|
|
2742
|
+
expect(reading?.querySelector('input, textarea, [contenteditable]')).toBeNull();
|
|
2716
2743
|
},
|
|
2717
2744
|
{ timeout: 10000 }
|
|
2718
2745
|
);
|
|
2719
2746
|
},
|
|
2720
2747
|
};
|
|
2721
2748
|
|
|
2749
|
+
// Read mode as a fact sheet. Every kind of value the engine can hold, set,
|
|
2750
|
+
// plus one optional field nobody set (`notes`) and one required field nobody
|
|
2751
|
+
// set (`owner`): the first must not appear at all, the second appears unset
|
|
2752
|
+
// with no amber. Opening a row shows the WHOLE value in a read presentation —
|
|
2753
|
+
// there is no control anywhere on the page.
|
|
2754
|
+
const ReadModeSchema: Record<string, TCompactField> = {
|
|
2755
|
+
id: {
|
|
2756
|
+
type: 'string',
|
|
2757
|
+
ui_type: 'string',
|
|
2758
|
+
display_name: 'ID',
|
|
2759
|
+
short_desc: 'Assigned by Qorus when the schema is created',
|
|
2760
|
+
desc: 'The identifier is allocated by the server and is what every reference to this schema uses. It never changes, even when the schema is renamed.',
|
|
2761
|
+
required: true,
|
|
2762
|
+
preselected: true,
|
|
2763
|
+
readonly: true,
|
|
2764
|
+
group: 'identity',
|
|
2765
|
+
},
|
|
2766
|
+
audience: {
|
|
2767
|
+
type: 'string',
|
|
2768
|
+
ui_type: 'string',
|
|
2769
|
+
display_name: 'Who can call this',
|
|
2770
|
+
short_desc: 'Which callers the gateway admits',
|
|
2771
|
+
required: true,
|
|
2772
|
+
preselected: true,
|
|
2773
|
+
group: 'identity',
|
|
2774
|
+
allowed_values: [
|
|
2775
|
+
{
|
|
2776
|
+
value: { type: 'string', value: 'anyone' },
|
|
2777
|
+
display_name: 'Anyone',
|
|
2778
|
+
short_desc: 'No credentials are checked.',
|
|
2779
|
+
},
|
|
2780
|
+
{
|
|
2781
|
+
value: { type: 'string', value: 'authenticated' },
|
|
2782
|
+
display_name: 'Authenticated users',
|
|
2783
|
+
desc: 'Callers must present a valid token; the gateway rejects anonymous requests before they reach the handler.',
|
|
2784
|
+
},
|
|
2785
|
+
],
|
|
2786
|
+
},
|
|
2787
|
+
summary: {
|
|
2788
|
+
type: 'string',
|
|
2789
|
+
ui_type: 'long-string',
|
|
2790
|
+
display_name: 'Summary',
|
|
2791
|
+
short_desc: 'What this API is for',
|
|
2792
|
+
preselected: true,
|
|
2793
|
+
group: 'identity',
|
|
2794
|
+
},
|
|
2795
|
+
owner: {
|
|
2796
|
+
type: 'string',
|
|
2797
|
+
ui_type: 'string',
|
|
2798
|
+
display_name: 'Owner',
|
|
2799
|
+
short_desc: 'The team that answers for this API',
|
|
2800
|
+
required: true,
|
|
2801
|
+
preselected: true,
|
|
2802
|
+
group: 'identity',
|
|
2803
|
+
},
|
|
2804
|
+
handler: {
|
|
2805
|
+
type: 'string',
|
|
2806
|
+
ui_type: 'code-editor',
|
|
2807
|
+
display_name: 'Handler',
|
|
2808
|
+
short_desc: 'Runs on every call',
|
|
2809
|
+
preselected: true,
|
|
2810
|
+
group: 'behaviour',
|
|
2811
|
+
},
|
|
2812
|
+
retry: {
|
|
2813
|
+
type: 'hash',
|
|
2814
|
+
ui_type: 'hash',
|
|
2815
|
+
display_name: 'Retry policy',
|
|
2816
|
+
preselected: true,
|
|
2817
|
+
group: 'behaviour',
|
|
2818
|
+
arg_schema: {
|
|
2819
|
+
attempts: { type: 'number', ui_type: 'number', display_name: 'Attempts' },
|
|
2820
|
+
backoff: {
|
|
2821
|
+
type: 'string',
|
|
2822
|
+
ui_type: 'string',
|
|
2823
|
+
display_name: 'Backoff',
|
|
2824
|
+
allowed_values: [
|
|
2825
|
+
{ value: { type: 'string', value: 'exponential' }, display_name: 'Exponential' },
|
|
2826
|
+
{ value: { type: 'string', value: 'fixed' }, display_name: 'Fixed' },
|
|
2827
|
+
],
|
|
2828
|
+
},
|
|
2829
|
+
},
|
|
2830
|
+
},
|
|
2831
|
+
tags: {
|
|
2832
|
+
type: 'list',
|
|
2833
|
+
ui_type: 'list',
|
|
2834
|
+
display_name: 'Tags',
|
|
2835
|
+
preselected: true,
|
|
2836
|
+
group: 'behaviour',
|
|
2837
|
+
},
|
|
2838
|
+
enabled: {
|
|
2839
|
+
type: 'bool',
|
|
2840
|
+
ui_type: 'bool',
|
|
2841
|
+
display_name: 'Enabled',
|
|
2842
|
+
preselected: true,
|
|
2843
|
+
group: 'behaviour',
|
|
2844
|
+
},
|
|
2845
|
+
notes: {
|
|
2846
|
+
type: 'string',
|
|
2847
|
+
ui_type: 'string',
|
|
2848
|
+
display_name: 'Notes',
|
|
2849
|
+
short_desc: 'Free-form notes',
|
|
2850
|
+
group: 'behaviour',
|
|
2851
|
+
},
|
|
2852
|
+
};
|
|
2853
|
+
|
|
2854
|
+
const ReadModeValue: IOptions = {
|
|
2855
|
+
id: { type: 'string', value: 'api-schema-7f3c' },
|
|
2856
|
+
audience: { type: 'string', value: 'authenticated' },
|
|
2857
|
+
summary: {
|
|
2858
|
+
type: 'string',
|
|
2859
|
+
value:
|
|
2860
|
+
'Customer master data for the storefront.\n\nEvery operation is idempotent; clients retry freely. Responses are cached at the edge for sixty seconds, so a write is visible to readers within a minute — the "eventually" in eventually consistent is short here, but it is not zero.',
|
|
2861
|
+
},
|
|
2862
|
+
handler: {
|
|
2863
|
+
type: 'string',
|
|
2864
|
+
value:
|
|
2865
|
+
'# Reject calls without a tenant header before they reach the service.\nif (!ctx.headers["x-tenant"]) {\n return { status: 400, body: { error: "tenant required" } };\n}\n\nconst customer = await store.get(ctx.params.id);\nif (!customer) {\n return { status: 404 };\n}\n\nreturn { status: 200, body: customer };',
|
|
2866
|
+
},
|
|
2867
|
+
retry: { type: 'hash', value: { attempts: 3, backoff: 'exponential' } },
|
|
2868
|
+
tags: { type: 'list', value: ['customers', 'public'] },
|
|
2869
|
+
enabled: { type: 'bool', value: true },
|
|
2870
|
+
};
|
|
2871
|
+
|
|
2872
|
+
export const CompactReadOnlyExpanded: Story = {
|
|
2873
|
+
parameters: {
|
|
2874
|
+
docs: {
|
|
2875
|
+
description: {
|
|
2876
|
+
story:
|
|
2877
|
+
"Read-only as a view, not a disabled editor: no completion meter, no Needs attention / Set / Optional boxes, no required asterisks; an optional field nobody set is not listed, a required one nobody set reads as unset without the amber; and opening a row shows the whole value — wrapped text, the full code block, every field of the hash, the chosen option with its description, the field's long description — with Close as the only control.",
|
|
2878
|
+
},
|
|
2879
|
+
},
|
|
2880
|
+
chromatic: { disable: true },
|
|
2881
|
+
},
|
|
2882
|
+
args: {
|
|
2883
|
+
compact: true,
|
|
2884
|
+
minColumnWidth: '300px',
|
|
2885
|
+
options: ReadModeSchema,
|
|
2886
|
+
value: ReadModeValue,
|
|
2887
|
+
groups: {
|
|
2888
|
+
identity: { icon: 'IdCardLine', subtitle: 'What this is and who may use it', sort: 0 },
|
|
2889
|
+
behaviour: { icon: 'FlashlightLine', sort: 1 },
|
|
2890
|
+
},
|
|
2891
|
+
readOnly: true,
|
|
2892
|
+
expandMode: 'multi' as const,
|
|
2893
|
+
},
|
|
2894
|
+
play: async () => {
|
|
2895
|
+
await _testsWaitForText('api-schema-7f3c');
|
|
2896
|
+
// No progress, no boxes, no offers.
|
|
2897
|
+
expect(document.querySelector('.options-readfirst-completion')).toBeNull();
|
|
2898
|
+
expect(document.querySelector('.options-readfirst-group')).toBeNull();
|
|
2899
|
+
await _testsWaitForTextToNotExist('Needs attention');
|
|
2900
|
+
await _testsWaitForTextToNotExist('Optional');
|
|
2901
|
+
// An optional field nobody set is not listed at all…
|
|
2902
|
+
await _testsWaitForTextToNotExist('Notes');
|
|
2903
|
+
// …a required one nobody set is, as unset, with no amber dot.
|
|
2904
|
+
await _testsWaitForText('Owner');
|
|
2905
|
+
expect(
|
|
2906
|
+
document.querySelector(
|
|
2907
|
+
'.readfirst-row[data-field="owner"] .options-readfirst-statusdot-slot > *'
|
|
2908
|
+
)
|
|
2909
|
+
).toBeNull();
|
|
2910
|
+
|
|
2911
|
+
const reading = (name: string) =>
|
|
2912
|
+
document.querySelector(`.options-readfirst-reading[data-field="${name}"]`);
|
|
2913
|
+
const open = async (text: string, name: string) => {
|
|
2914
|
+
await _testsClickText(text);
|
|
2915
|
+
await waitFor(() => expect(reading(name)).toBeTruthy(), { timeout: 10000 });
|
|
2916
|
+
// The one invariant of read mode: nothing to type into.
|
|
2917
|
+
expect(reading(name)!.querySelector('input, textarea, select, [contenteditable]')).toBeNull();
|
|
2918
|
+
return reading(name)!;
|
|
2919
|
+
};
|
|
2920
|
+
|
|
2921
|
+
// A choice opens as the option and what it means — not a select.
|
|
2922
|
+
const audience = await open('Authenticated users', 'audience');
|
|
2923
|
+
expect(audience.textContent).toContain('Callers must present a valid token');
|
|
2924
|
+
// A server-set id opens as the value and its explanation — not a
|
|
2925
|
+
// disabled input.
|
|
2926
|
+
const id = await open('api-schema-7f3c', 'id');
|
|
2927
|
+
expect(id.textContent).toContain('api-schema-7f3c');
|
|
2928
|
+
expect(id.textContent).toContain('It never changes, even when the schema is renamed.');
|
|
2929
|
+
// Long text opens in full: the last sentence is on the page.
|
|
2930
|
+
const summary = await open('Summary', 'summary');
|
|
2931
|
+
expect(summary.textContent).toContain('but it is not zero.');
|
|
2932
|
+
// Code opens as the whole block.
|
|
2933
|
+
const handler = await open('Handler', 'handler');
|
|
2934
|
+
expect(handler.querySelector('.options-readfirst-code')?.textContent).toContain(
|
|
2935
|
+
'return { status: 200, body: customer };'
|
|
2936
|
+
);
|
|
2937
|
+
// A hash opens as every field, by name.
|
|
2938
|
+
const retry = await open('Retry policy', 'retry');
|
|
2939
|
+
expect(retry.textContent).toMatch(/Attempts/);
|
|
2940
|
+
expect(retry.textContent).toMatch(/Exponential|exponential/);
|
|
2941
|
+
|
|
2942
|
+
// Close is the only action on an open row — no More menu, no Clear — and
|
|
2943
|
+
// it closes.
|
|
2944
|
+
expect(
|
|
2945
|
+
document.querySelectorAll('.options-readfirst-reading .options-readfirst-done')
|
|
2946
|
+
).toHaveLength(5);
|
|
2947
|
+
expect(document.querySelector('.options-readfirst-reading .options-readfirst-more')).toBeNull();
|
|
2948
|
+
expect(
|
|
2949
|
+
document.querySelector('.options-readfirst-reading .options-readfirst-clear')
|
|
2950
|
+
).toBeNull();
|
|
2951
|
+
await fireEvent.click(retry.querySelector('.options-readfirst-done') as HTMLElement);
|
|
2952
|
+
await waitFor(() => expect(reading('retry')).toBeNull());
|
|
2953
|
+
},
|
|
2954
|
+
};
|
|
2955
|
+
|
|
2722
2956
|
// A raw (NON-envelope) order-style payload, contrasting the fixture's
|
|
2723
2957
|
// envelope-encoded hashes: no LIST chips, JS-type colouring, opaque YAML string.
|
|
2724
2958
|
const ORDER_STATE_SAMPLE = {
|
|
@@ -6297,11 +6531,21 @@ const RichtextMultilineTemplateValue: IOptions = {
|
|
|
6297
6531
|
type: 'paragraph',
|
|
6298
6532
|
children: [
|
|
6299
6533
|
{ text: 'Alert: ' },
|
|
6300
|
-
{
|
|
6534
|
+
{
|
|
6535
|
+
type: 'tag',
|
|
6536
|
+
value: '$fsminput:alert_code',
|
|
6537
|
+
label: 'alert_code',
|
|
6538
|
+
children: [{ text: '' }],
|
|
6539
|
+
},
|
|
6301
6540
|
{ text: '\nSeverity: ' },
|
|
6302
6541
|
{ type: 'tag', value: '$fsminput:severity', label: 'severity', children: [{ text: '' }] },
|
|
6303
6542
|
{ text: '\nRule: ' },
|
|
6304
|
-
{
|
|
6543
|
+
{
|
|
6544
|
+
type: 'tag',
|
|
6545
|
+
value: '$fsminput:rule_name',
|
|
6546
|
+
label: 'rule_name',
|
|
6547
|
+
children: [{ text: '' }],
|
|
6548
|
+
},
|
|
6305
6549
|
],
|
|
6306
6550
|
},
|
|
6307
6551
|
],
|
|
@@ -6329,7 +6573,8 @@ export const CompactReadFirstRichtextMultilineTemplate: Story = {
|
|
|
6329
6573
|
const proseSpans = Array.from(canvasElement.querySelectorAll('span')).filter(
|
|
6330
6574
|
// the collapsed newline leaves the segment with a leading space
|
|
6331
6575
|
(element) =>
|
|
6332
|
-
element.children.length === 0 &&
|
|
6576
|
+
element.children.length === 0 &&
|
|
6577
|
+
/^\s*(Alert|Severity|Rule):/.test(element.textContent || '')
|
|
6333
6578
|
) as HTMLElement[];
|
|
6334
6579
|
await expect(proseSpans.length).toBe(3);
|
|
6335
6580
|
|
|
@@ -6701,9 +6946,7 @@ export const CompactListOfHashReadsInSchemaWordsMobile: Story = {
|
|
|
6701
6946
|
|
|
6702
6947
|
// The narrow branch is actually engaged — otherwise this is the desktop
|
|
6703
6948
|
// story with a border round it, and it would pass while proving nothing.
|
|
6704
|
-
await waitFor(() =>
|
|
6705
|
-
expect(canvasElement.querySelector('.readfirst-narrow')).toBeTruthy()
|
|
6706
|
-
);
|
|
6949
|
+
await waitFor(() => expect(canvasElement.querySelector('.readfirst-narrow')).toBeTruthy());
|
|
6707
6950
|
|
|
6708
6951
|
const preview = await waitFor(() => {
|
|
6709
6952
|
const element = canvasElement.querySelector('.schema-data-view');
|
|
@@ -6908,7 +7151,7 @@ export const CompactChosenCollapsedBoxes: Story = {
|
|
|
6908
7151
|
docs: {
|
|
6909
7152
|
description: {
|
|
6910
7153
|
story:
|
|
6911
|
-
|
|
7154
|
+
"Renders a compact form with `compactCollapsedGroups={['set', 'optional']}` — the Set and Optional boxes start collapsed while Needs attention stays open, and typing a search query forces every box open (a collapsed panel unmounts its content, so a match inside one would be unreachable); clearing the query collapses them again.",
|
|
6912
7155
|
},
|
|
6913
7156
|
},
|
|
6914
7157
|
},
|