@nocobase/client-v2 2.2.0-beta.5 → 2.2.0-beta.6
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/es/RouteRepository.d.ts +21 -6
- package/es/components/form/JsonTextArea.d.ts +2 -1
- package/es/components/form/VariableJsonTextArea.d.ts +19 -0
- package/es/components/form/index.d.ts +1 -0
- package/es/components/index.d.ts +1 -0
- package/es/flow/admin-shell/admin-layout/AdminLayoutEntryGuard.d.ts +2 -0
- package/es/flow/admin-shell/admin-layout/AdminLayoutMenuFlowUtils.d.ts +2 -1
- package/es/flow/admin-shell/admin-layout/AdminLayoutMenuModels.d.ts +2 -0
- package/es/flow/admin-shell/admin-layout/AdminLayoutMenuUtils.d.ts +3 -2
- package/es/flow/admin-shell/admin-layout/AdminLayoutSlotModels.d.ts +4 -0
- package/es/flow/admin-shell/admin-layout/resolveAdminRouteRuntimeTarget.d.ts +6 -0
- package/es/flow/components/FieldAssignRulesEditor.d.ts +3 -1
- package/es/flow/models/base/GridModel.d.ts +1 -1
- package/es/flow/models/blocks/filter-form/FilterFormBlockModel.d.ts +5 -0
- package/es/flow/models/blocks/form/FormBlockModel.d.ts +4 -0
- package/es/flow/models/blocks/form/value-runtime/rules.d.ts +21 -0
- package/es/flow/models/blocks/form/value-runtime/runtime.d.ts +21 -0
- package/es/flow/models/blocks/form/value-runtime/types.d.ts +2 -2
- package/es/flow-compat/FieldValidation.d.ts +2 -1
- package/es/index.d.ts +2 -1
- package/es/index.mjs +143 -117
- package/lib/index.js +148 -122
- package/package.json +7 -7
- package/src/RouteRepository.ts +126 -24
- package/src/__tests__/RouteRepository.test.ts +216 -0
- package/src/__tests__/exports.test.ts +16 -0
- package/src/__tests__/settings-center.test.tsx +33 -0
- package/src/components/form/JsonTextArea.tsx +21 -11
- package/src/components/form/VariableJsonTextArea.tsx +175 -0
- package/src/components/form/__tests__/JsonTextArea.test.tsx +43 -0
- package/src/components/form/__tests__/VariableJsonTextArea.test.tsx +86 -0
- package/src/components/form/index.tsx +1 -0
- package/src/components/index.ts +1 -0
- package/src/flow/__tests__/FlowRoute.test.tsx +443 -5
- package/src/flow/actions/__tests__/fieldLinkageRules.scopeDepth.test.ts +150 -1
- package/src/flow/actions/__tests__/linkageAssignField.legacy.test.ts +135 -0
- package/src/flow/actions/__tests__/linkageRules.hiddenSync.restore.test.ts +19 -5
- package/src/flow/actions/__tests__/linkageRules.subFormSetFieldProps.test.ts +92 -0
- package/src/flow/actions/customVariable.tsx +1 -2
- package/src/flow/actions/linkageRules.tsx +122 -34
- package/src/flow/actions/runjs.tsx +2 -14
- package/src/flow/actions/validation.tsx +62 -30
- package/src/flow/admin-shell/admin-layout/AdminLayoutComponent.tsx +33 -10
- package/src/flow/admin-shell/admin-layout/AdminLayoutEntryGuard.test.tsx +310 -0
- package/src/flow/admin-shell/admin-layout/AdminLayoutEntryGuard.tsx +44 -8
- package/src/flow/admin-shell/admin-layout/AdminLayoutMenuFlowUtils.ts +5 -3
- package/src/flow/admin-shell/admin-layout/AdminLayoutMenuModels.tsx +61 -9
- package/src/flow/admin-shell/admin-layout/AdminLayoutMenuUtils.tsx +71 -8
- package/src/flow/admin-shell/admin-layout/AdminLayoutModel.tsx +1 -1
- package/src/flow/admin-shell/admin-layout/AdminLayoutSlotModels.tsx +21 -8
- package/src/flow/admin-shell/admin-layout/__tests__/AdminLayoutComponent.test.tsx +188 -0
- package/src/flow/admin-shell/admin-layout/__tests__/AdminLayoutMenuModels.test.ts +99 -0
- package/src/flow/admin-shell/admin-layout/__tests__/TopbarActionsBar.test.tsx +166 -2
- package/src/flow/admin-shell/admin-layout/resolveAdminRouteRuntimeTarget.test.ts +20 -0
- package/src/flow/admin-shell/admin-layout/resolveAdminRouteRuntimeTarget.ts +33 -5
- package/src/flow/components/DefaultValue.tsx +1 -2
- package/src/flow/components/FieldAssignRulesEditor.tsx +62 -12
- package/src/flow/components/FlowRoute.tsx +56 -11
- package/src/flow/components/__tests__/FieldAssignRulesEditor.test.tsx +81 -4
- package/src/flow/components/code-editor/__tests__/useCodeRunner.test.tsx +2 -17
- package/src/flow/components/code-editor/hooks/useCodeRunner.ts +2 -14
- package/src/flow/components/code-editor/runjsDiagnostics.ts +8 -45
- package/src/flow/models/actions/JSActionModel.tsx +2 -7
- package/src/flow/models/actions/JSCollectionActionModel.tsx +2 -7
- package/src/flow/models/actions/JSItemActionModel.tsx +2 -7
- package/src/flow/models/actions/JSRecordActionModel.tsx +2 -7
- package/src/flow/models/base/ActionModel.tsx +12 -1
- package/src/flow/models/base/GridModel.tsx +38 -7
- package/src/flow/models/base/PageModel/PageModel.tsx +4 -1
- package/src/flow/models/base/PageModel/__tests__/PageModel.test.ts +28 -4
- package/src/flow/models/base/__tests__/ActionModel.test.ts +83 -0
- package/src/flow/models/base/__tests__/GridModel.dragSnapshotContainer.test.ts +239 -1
- package/src/flow/models/base/__tests__/transformRowsToSingleColumn.test.ts +48 -0
- package/src/flow/models/blocks/filter-form/FilterFormBlockModel.tsx +31 -3
- package/src/flow/models/blocks/filter-form/FilterFormJSActionModel.tsx +2 -7
- package/src/flow/models/blocks/filter-form/__tests__/defaultValues.wiring.test.ts +77 -0
- package/src/flow/models/blocks/form/EditFormModel.tsx +1 -0
- package/src/flow/models/blocks/form/FormBlockModel.tsx +7 -0
- package/src/flow/models/blocks/form/JSFormActionModel.tsx +2 -7
- package/src/flow/models/blocks/form/__tests__/FormBlockModel.test.tsx +17 -0
- package/src/flow/models/blocks/form/value-runtime/__tests__/runtime.test.ts +880 -102
- package/src/flow/models/blocks/form/value-runtime/rules.ts +445 -13
- package/src/flow/models/blocks/form/value-runtime/runtime.ts +257 -13
- package/src/flow/models/blocks/form/value-runtime/types.ts +2 -2
- package/src/flow/models/blocks/js-block/JSBlock.tsx +2 -7
- package/src/flow/models/blocks/table/JSColumnModel.tsx +1 -9
- package/src/flow/models/blocks/table/TableActionsColumnModel.tsx +1 -1
- package/src/flow/models/blocks/table/TableBlockModel.tsx +13 -3
- package/src/flow/models/blocks/table/__tests__/TableActionsColumnModel.test.tsx +54 -0
- package/src/flow/models/blocks/table/__tests__/TableBlockModel.mobileSettingsButtons.test.tsx +78 -0
- package/src/flow/models/fields/AssociationFieldModel/AssociationFieldModel.tsx +1 -1
- package/src/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/PopupSubTableFieldModel.tsx +29 -6
- package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/SubTableField.tsx +13 -1
- package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/__tests__/SubTableFieldModel.reset.test.ts +180 -0
- package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/index.tsx +6 -4
- package/src/flow/models/fields/AssociationFieldModel/__tests__/AssociationFieldModel.updateAssociation.test.ts +72 -0
- package/src/flow/models/fields/InputFieldModel.tsx +14 -22
- package/src/flow/models/fields/JSEditableFieldModel.tsx +2 -11
- package/src/flow/models/fields/JSFieldModel.tsx +2 -7
- package/src/flow/models/fields/JSItemModel.tsx +2 -14
- package/src/flow/models/fields/__tests__/InputFieldModel.test.tsx +17 -0
- package/src/flow/models/topbar/TopbarActionModel.tsx +93 -10
- package/src/flow-compat/FieldValidation.tsx +122 -60
- package/src/flow-compat/Popover.tsx +43 -4
- package/src/flow-compat/__tests__/Popover.test.tsx +34 -0
- package/src/index.ts +8 -1
- package/src/layout-manager/__tests__/LayoutRoute.test.tsx +41 -1
- package/src/settings-center/AdminSettingsLayout.tsx +3 -0
- package/src/settings-center/plugin-manager/index.tsx +3 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { css, cx } from '@emotion/css';
|
|
11
|
+
import {
|
|
12
|
+
FlowContextSelector,
|
|
13
|
+
formatPathToValue as formatFlowPathToValue,
|
|
14
|
+
useFlowContext,
|
|
15
|
+
type MetaTreeNode,
|
|
16
|
+
} from '@nocobase/flow-engine';
|
|
17
|
+
import { Button, theme } from 'antd';
|
|
18
|
+
import type { TextAreaRef } from 'antd/es/input/TextArea';
|
|
19
|
+
import React, { useCallback, useMemo, useRef } from 'react';
|
|
20
|
+
import { JsonTextArea, type JsonTextAreaProps } from './JsonTextArea';
|
|
21
|
+
import { useFilteredMetaTree } from './VariableInput';
|
|
22
|
+
|
|
23
|
+
export interface VariableJsonTextAreaProps extends JsonTextAreaProps {
|
|
24
|
+
namespaces?: string[];
|
|
25
|
+
extraNodes?: MetaTreeNode[];
|
|
26
|
+
metaTree?: MetaTreeNode[] | (() => MetaTreeNode[] | Promise<MetaTreeNode[]>);
|
|
27
|
+
formatPathToValue?: (meta: MetaTreeNode) => string | undefined;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const VariableJsonTextArea = React.memo((props: VariableJsonTextAreaProps) => {
|
|
31
|
+
const {
|
|
32
|
+
value,
|
|
33
|
+
onChange,
|
|
34
|
+
space = 2,
|
|
35
|
+
json5 = false,
|
|
36
|
+
showError = true,
|
|
37
|
+
className,
|
|
38
|
+
status,
|
|
39
|
+
onBlur,
|
|
40
|
+
namespaces,
|
|
41
|
+
extraNodes,
|
|
42
|
+
metaTree,
|
|
43
|
+
formatPathToValue: customFormatPathToValue,
|
|
44
|
+
...textAreaProps
|
|
45
|
+
} = props;
|
|
46
|
+
const { token } = theme.useToken();
|
|
47
|
+
const flowCtx = useFlowContext();
|
|
48
|
+
const filteredMetaTree = useFilteredMetaTree({ namespaces, extraNodes });
|
|
49
|
+
const ref = useRef<TextAreaRef>(null);
|
|
50
|
+
|
|
51
|
+
const insertAtCaret = useCallback((valueToInsert: string) => {
|
|
52
|
+
const textArea = ref.current?.resizableTextArea?.textArea;
|
|
53
|
+
if (!textArea) return;
|
|
54
|
+
|
|
55
|
+
const start = textArea.selectionStart ?? textArea.value.length;
|
|
56
|
+
const end = textArea?.selectionEnd ?? start;
|
|
57
|
+
const nextText = textArea.value.slice(0, start) + valueToInsert + textArea.value.slice(end);
|
|
58
|
+
const nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype, 'value')?.set;
|
|
59
|
+
|
|
60
|
+
nativeInputValueSetter?.call(textArea, nextText);
|
|
61
|
+
textArea.dispatchEvent(new Event('input', { bubbles: true }));
|
|
62
|
+
|
|
63
|
+
requestAnimationFrame(() => {
|
|
64
|
+
const nextPosition = start + valueToInsert.length;
|
|
65
|
+
textArea.setSelectionRange(start, nextPosition);
|
|
66
|
+
textArea.focus();
|
|
67
|
+
});
|
|
68
|
+
}, []);
|
|
69
|
+
|
|
70
|
+
const handleVariableSelected = useCallback(
|
|
71
|
+
(nextValue: string) => {
|
|
72
|
+
if (nextValue) {
|
|
73
|
+
insertAtCaret(nextValue);
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
[insertAtCaret],
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
const selectorMetaTree = useMemo(
|
|
80
|
+
() => metaTree ?? filteredMetaTree ?? (() => flowCtx.getPropertyMetaTree?.() ?? []),
|
|
81
|
+
[filteredMetaTree, flowCtx, metaTree],
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const formatPathToValue = useMemo(() => {
|
|
85
|
+
if (!customFormatPathToValue) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
return (meta: MetaTreeNode) => customFormatPathToValue(meta) ?? formatFlowPathToValue(meta);
|
|
89
|
+
}, [customFormatPathToValue]);
|
|
90
|
+
|
|
91
|
+
const wrapperClassName = useMemo(
|
|
92
|
+
() => css`
|
|
93
|
+
position: relative;
|
|
94
|
+
width: 100%;
|
|
95
|
+
|
|
96
|
+
.ant-input {
|
|
97
|
+
width: 100%;
|
|
98
|
+
}
|
|
99
|
+
`,
|
|
100
|
+
[],
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
const textAreaClassName = useMemo(
|
|
104
|
+
() => css`
|
|
105
|
+
font-size: ${token.fontSizeSM}px;
|
|
106
|
+
font-family: ${token.fontFamilyCode};
|
|
107
|
+
`,
|
|
108
|
+
[token.fontFamilyCode, token.fontSizeSM],
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
const selectorClassName = useMemo(
|
|
112
|
+
() => css`
|
|
113
|
+
position: absolute;
|
|
114
|
+
inset-block-start: 0;
|
|
115
|
+
inset-inline-end: 0;
|
|
116
|
+
z-index: 1;
|
|
117
|
+
line-height: 0;
|
|
118
|
+
|
|
119
|
+
.ant-btn {
|
|
120
|
+
font-size: ${token.fontSizeSM}px;
|
|
121
|
+
}
|
|
122
|
+
`,
|
|
123
|
+
[token.fontSizeSM],
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
const buttonClassName = useMemo(
|
|
127
|
+
() => css`
|
|
128
|
+
&:not(:hover) {
|
|
129
|
+
border-inline-end-color: transparent;
|
|
130
|
+
border-block-start-color: transparent;
|
|
131
|
+
background-color: transparent;
|
|
132
|
+
}
|
|
133
|
+
`,
|
|
134
|
+
[],
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
return (
|
|
138
|
+
<div className={wrapperClassName}>
|
|
139
|
+
<JsonTextArea
|
|
140
|
+
{...textAreaProps}
|
|
141
|
+
ref={ref}
|
|
142
|
+
value={value}
|
|
143
|
+
onChange={onChange}
|
|
144
|
+
space={space}
|
|
145
|
+
json5={json5}
|
|
146
|
+
showError={showError}
|
|
147
|
+
className={cx(textAreaClassName, className)}
|
|
148
|
+
status={status}
|
|
149
|
+
onBlur={onBlur}
|
|
150
|
+
disabled={textAreaProps.disabled}
|
|
151
|
+
/>
|
|
152
|
+
<div className={selectorClassName}>
|
|
153
|
+
<FlowContextSelector
|
|
154
|
+
metaTree={selectorMetaTree}
|
|
155
|
+
disabled={textAreaProps.disabled}
|
|
156
|
+
formatPathToValue={formatPathToValue}
|
|
157
|
+
onChange={handleVariableSelected}
|
|
158
|
+
>
|
|
159
|
+
<Button
|
|
160
|
+
aria-label="variable-json-switcher"
|
|
161
|
+
disabled={textAreaProps.disabled}
|
|
162
|
+
className={buttonClassName}
|
|
163
|
+
style={{ fontStyle: 'italic', fontFamily: token.fontFamilyCode }}
|
|
164
|
+
>
|
|
165
|
+
x
|
|
166
|
+
</Button>
|
|
167
|
+
</FlowContextSelector>
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
170
|
+
);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
VariableJsonTextArea.displayName = 'VariableJsonTextArea';
|
|
174
|
+
|
|
175
|
+
export const VariableJSON = VariableJsonTextArea;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
13
|
+
import { JsonTextArea } from '../JsonTextArea';
|
|
14
|
+
|
|
15
|
+
describe('JsonTextArea', () => {
|
|
16
|
+
it('formats object values and emits parsed JSON on blur', async () => {
|
|
17
|
+
const handleChange = vi.fn();
|
|
18
|
+
|
|
19
|
+
render(<JsonTextArea value={{ foo: 'bar' }} onChange={handleChange} />);
|
|
20
|
+
|
|
21
|
+
const textArea = await screen.findByRole('textbox');
|
|
22
|
+
expect(textArea).toHaveValue('{\n "foo": "bar"\n}');
|
|
23
|
+
|
|
24
|
+
fireEvent.change(textArea, { target: { value: '{"foo":"baz"}' } });
|
|
25
|
+
fireEvent.blur(textArea);
|
|
26
|
+
|
|
27
|
+
expect(handleChange).toHaveBeenCalledWith({ foo: 'baz' });
|
|
28
|
+
expect(textArea).toHaveValue('{\n "foo": "baz"\n}');
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('shows JSON parse errors and does not emit invalid values', async () => {
|
|
32
|
+
const handleChange = vi.fn();
|
|
33
|
+
|
|
34
|
+
render(<JsonTextArea value={{}} onChange={handleChange} />);
|
|
35
|
+
|
|
36
|
+
const textArea = await screen.findByRole('textbox');
|
|
37
|
+
fireEvent.change(textArea, { target: { value: '{' } });
|
|
38
|
+
fireEvent.blur(textArea);
|
|
39
|
+
|
|
40
|
+
expect(handleChange).not.toHaveBeenCalled();
|
|
41
|
+
expect(await screen.findByText(/JSON/)).toBeInTheDocument();
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { FlowContext, FlowContextProvider } from '@nocobase/flow-engine';
|
|
11
|
+
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
14
|
+
import { VariableJsonTextArea } from '../VariableJsonTextArea';
|
|
15
|
+
|
|
16
|
+
function createContextWithEnv() {
|
|
17
|
+
const ctx = new FlowContext();
|
|
18
|
+
(ctx as unknown as { t: (key: string) => string }).t = (key: string) => key;
|
|
19
|
+
|
|
20
|
+
ctx.defineProperty('$env', {
|
|
21
|
+
value: { API_KEY: 'secret' },
|
|
22
|
+
meta: {
|
|
23
|
+
title: 'Env',
|
|
24
|
+
type: 'object',
|
|
25
|
+
properties: {
|
|
26
|
+
API_KEY: { title: 'API Key', type: 'string' },
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
return ctx;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function renderWithCtx(ctx: FlowContext, node: React.ReactNode) {
|
|
35
|
+
return render(<FlowContextProvider context={ctx}>{node}</FlowContextProvider>);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
describe('VariableJsonTextArea', () => {
|
|
39
|
+
it('formats object values and emits parsed JSON on blur', async () => {
|
|
40
|
+
const ctx = createContextWithEnv();
|
|
41
|
+
const handleChange = vi.fn();
|
|
42
|
+
|
|
43
|
+
renderWithCtx(ctx, <VariableJsonTextArea value={{ foo: 'bar' }} onChange={handleChange} />);
|
|
44
|
+
|
|
45
|
+
const textArea = await screen.findByRole('textbox');
|
|
46
|
+
expect(textArea).toHaveValue('{\n "foo": "bar"\n}');
|
|
47
|
+
|
|
48
|
+
fireEvent.change(textArea, { target: { value: '{"foo":"baz"}' } });
|
|
49
|
+
fireEvent.blur(textArea);
|
|
50
|
+
|
|
51
|
+
expect(handleChange).toHaveBeenCalledWith({ foo: 'baz' });
|
|
52
|
+
expect(textArea).toHaveValue('{\n "foo": "baz"\n}');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('shows JSON parse errors and does not emit invalid values', async () => {
|
|
56
|
+
const ctx = createContextWithEnv();
|
|
57
|
+
const handleChange = vi.fn();
|
|
58
|
+
|
|
59
|
+
renderWithCtx(ctx, <VariableJsonTextArea value={{}} onChange={handleChange} />);
|
|
60
|
+
|
|
61
|
+
const textArea = await screen.findByRole('textbox');
|
|
62
|
+
fireEvent.change(textArea, { target: { value: '{' } });
|
|
63
|
+
fireEvent.blur(textArea);
|
|
64
|
+
|
|
65
|
+
expect(handleChange).not.toHaveBeenCalled();
|
|
66
|
+
expect(await screen.findByText(/JSON/)).toBeInTheDocument();
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('inserts selected variables with the client-v2 template format', async () => {
|
|
70
|
+
const ctx = createContextWithEnv();
|
|
71
|
+
|
|
72
|
+
renderWithCtx(ctx, <VariableJsonTextArea value={null} namespaces={['$env']} onChange={() => undefined} />);
|
|
73
|
+
|
|
74
|
+
fireEvent.click(await screen.findByRole('button', { name: 'variable-json-switcher' }));
|
|
75
|
+
|
|
76
|
+
await waitFor(() => {
|
|
77
|
+
fireEvent.click(screen.getByText('Env'));
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
await waitFor(() => {
|
|
81
|
+
fireEvent.click(screen.getByText('API Key'));
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
expect(await screen.findByRole('textbox')).toHaveValue('{{ ctx.$env.API_KEY }}');
|
|
85
|
+
});
|
|
86
|
+
});
|
package/src/components/index.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from './BlankComponent';
|
|
|
12
12
|
export * from './form/table/dnd';
|
|
13
13
|
export * from './form';
|
|
14
14
|
export * from './Icon';
|
|
15
|
+
export * from './KeepAlive';
|
|
15
16
|
export * from './PoweredBy';
|
|
16
17
|
export * from './RouterContextCleaner';
|
|
17
18
|
export * from './SwitchLanguage';
|