@flowgram.ai/form-materials 0.4.17 → 0.4.19

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.
Files changed (77) hide show
  1. package/bin/run.sh +2 -1
  2. package/dist/cjs/components/code-editor/editor-all.js +52 -0
  3. package/dist/cjs/components/code-editor/editor-json.js +71 -0
  4. package/dist/cjs/components/code-editor/editor-python.js +63 -0
  5. package/dist/cjs/components/code-editor/editor-shell.js +63 -0
  6. package/dist/cjs/components/code-editor/editor-sql.js +71 -0
  7. package/dist/cjs/components/code-editor/editor-ts.js +80 -0
  8. package/dist/cjs/components/code-editor/editor.js +41 -30
  9. package/dist/cjs/components/code-editor/factory.js +96 -0
  10. package/dist/cjs/components/code-editor/index.js +31 -36
  11. package/dist/cjs/components/code-editor/utils.js +1 -0
  12. package/dist/cjs/components/index.js +38 -3
  13. package/dist/cjs/components/json-editor-with-variables/editor.js +1 -2
  14. package/dist/cjs/components/sql-editor-with-variables/editor.js +53 -0
  15. package/dist/cjs/components/sql-editor-with-variables/index.js +57 -0
  16. package/dist/cjs/index.js +35 -2
  17. package/dist/cjs/plugins/json-schema-preset/type-definition/array.js +3 -3
  18. package/dist/cjs/plugins/json-schema-preset/type-definition/map.js +3 -3
  19. package/dist/cjs/plugins/json-schema-preset/type-definition/object.js +3 -3
  20. package/dist/esm/components/code-editor/editor-all.mjs +18 -0
  21. package/dist/esm/components/code-editor/editor-json.mjs +16 -0
  22. package/dist/esm/components/code-editor/editor-python.mjs +8 -0
  23. package/dist/esm/components/code-editor/editor-shell.mjs +8 -0
  24. package/dist/esm/components/code-editor/editor-sql.mjs +16 -0
  25. package/dist/esm/components/code-editor/editor-ts.mjs +22 -0
  26. package/dist/esm/components/code-editor/editor.mjs +38 -28
  27. package/dist/esm/components/code-editor/factory.mjs +36 -0
  28. package/dist/esm/components/code-editor/index.mjs +8 -8
  29. package/dist/esm/components/code-editor/utils.mjs +1 -0
  30. package/dist/esm/components/index.mjs +4 -2
  31. package/dist/esm/components/json-editor-with-variables/editor.mjs +2 -3
  32. package/dist/esm/components/sql-editor-with-variables/editor.mjs +19 -0
  33. package/dist/esm/components/sql-editor-with-variables/index.mjs +5 -0
  34. package/dist/esm/index.mjs +2 -2
  35. package/dist/esm/plugins/json-schema-preset/type-definition/array.mjs +3 -3
  36. package/dist/esm/plugins/json-schema-preset/type-definition/map.mjs +3 -3
  37. package/dist/esm/plugins/json-schema-preset/type-definition/object.mjs +3 -3
  38. package/dist/tsconfig.tsbuildinfo +1 -1
  39. package/dist/types/components/code-editor/editor-all.d.ts +8 -0
  40. package/dist/types/components/code-editor/editor-json.d.ts +6 -0
  41. package/dist/types/components/code-editor/editor-python.d.ts +6 -0
  42. package/dist/types/components/code-editor/editor-shell.d.ts +6 -0
  43. package/dist/types/components/code-editor/editor-sql.d.ts +6 -0
  44. package/dist/types/components/code-editor/editor-ts.d.ts +6 -0
  45. package/dist/types/components/code-editor/editor.d.ts +3 -2
  46. package/dist/types/components/code-editor/factory.d.ts +13 -0
  47. package/dist/types/components/code-editor/index.d.ts +7 -2
  48. package/dist/types/components/code-editor/utils.d.ts +1 -1
  49. package/dist/types/components/code-editor-mini/index.d.ts +3 -0
  50. package/dist/types/components/index.d.ts +4 -2
  51. package/dist/types/components/sql-editor-with-variables/editor.d.ts +9 -0
  52. package/dist/types/components/sql-editor-with-variables/index.d.ts +6 -0
  53. package/dist/types/index.d.ts +1 -1
  54. package/package.json +7 -8
  55. package/src/components/code-editor/editor-all.tsx +30 -0
  56. package/src/components/code-editor/editor-json.tsx +25 -0
  57. package/src/components/code-editor/editor-python.tsx +18 -0
  58. package/src/components/code-editor/editor-shell.tsx +18 -0
  59. package/src/components/code-editor/editor-sql.tsx +24 -0
  60. package/src/components/code-editor/editor-ts.tsx +31 -0
  61. package/src/components/code-editor/editor.tsx +45 -33
  62. package/src/components/code-editor/factory.tsx +61 -0
  63. package/src/components/code-editor/index.tsx +7 -9
  64. package/src/components/code-editor/utils.ts +4 -0
  65. package/src/components/code-editor-mini/index.tsx +3 -0
  66. package/src/components/index.ts +25 -2
  67. package/src/components/json-editor-with-variables/editor.tsx +3 -4
  68. package/src/components/sql-editor-with-variables/editor.tsx +28 -0
  69. package/src/components/sql-editor-with-variables/index.tsx +12 -0
  70. package/src/index.ts +19 -3
  71. package/src/plugins/json-schema-preset/type-definition/array.tsx +3 -3
  72. package/src/plugins/json-schema-preset/type-definition/map.tsx +3 -3
  73. package/src/plugins/json-schema-preset/type-definition/object.tsx +3 -3
  74. package/dist/cjs/components/code-editor/language-features.js +0 -124
  75. package/dist/esm/components/code-editor/language-features.mjs +0 -51
  76. package/dist/types/components/code-editor/language-features.d.ts +0 -8
  77. package/src/components/code-editor/language-features.ts +0 -61
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { languages } from '@flowgram.ai/coze-editor/preset-code';
7
+ import { mixLanguages } from '@flowgram.ai/coze-editor';
8
+
9
+ import { CodeEditorFactory } from './factory';
10
+
11
+ export const loadJsonLanguage = () =>
12
+ import('@flowgram.ai/coze-editor/language-json').then((module) => {
13
+ languages.register('json', {
14
+ // mixLanguages is used to solve the problem that interpolation also uses parentheses, which causes incorrect highlighting
15
+ language: mixLanguages({
16
+ outerLanguage: module.json.language,
17
+ }),
18
+ languageService: module.json.languageService,
19
+ });
20
+ });
21
+
22
+ export const JsonCodeEditor = CodeEditorFactory<true>(loadJsonLanguage, {
23
+ displayName: 'JsonCodeEditor',
24
+ fixLanguageId: 'json',
25
+ });
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { languages } from '@flowgram.ai/coze-editor/preset-code';
7
+
8
+ import { CodeEditorFactory } from './factory';
9
+
10
+ export const loadPythonLanguage = () =>
11
+ import('@flowgram.ai/coze-editor/language-python').then((module) =>
12
+ languages.register('python', module.python)
13
+ );
14
+
15
+ export const PythonCodeEditor = CodeEditorFactory<true>(loadPythonLanguage, {
16
+ displayName: 'PythonCodeEditor',
17
+ fixLanguageId: 'python',
18
+ });
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { languages } from '@flowgram.ai/coze-editor/preset-code';
7
+
8
+ import { CodeEditorFactory } from './factory';
9
+
10
+ export const loadShellLanguage = () =>
11
+ import('@flowgram.ai/coze-editor/language-shell').then((module) =>
12
+ languages.register('shell', module.shell)
13
+ );
14
+
15
+ export const ShellCodeEditor = CodeEditorFactory<true>(loadShellLanguage, {
16
+ displayName: 'ShellCodeEditor',
17
+ fixLanguageId: 'shell',
18
+ });
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { languages } from '@flowgram.ai/coze-editor/preset-code';
7
+ import { mixLanguages } from '@flowgram.ai/coze-editor';
8
+
9
+ import { CodeEditorFactory } from './factory';
10
+
11
+ export const loadSqlLanguage = () =>
12
+ import('@flowgram.ai/coze-editor/language-sql').then((module) => {
13
+ languages.register('sql', {
14
+ ...module.sql,
15
+ language: mixLanguages({
16
+ outerLanguage: module.sql.language,
17
+ }),
18
+ });
19
+ });
20
+
21
+ export const SQLCodeEditor = CodeEditorFactory<true>(loadSqlLanguage, {
22
+ displayName: 'SQLCodeEditor',
23
+ fixLanguageId: 'sql',
24
+ });
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { languages } from '@flowgram.ai/coze-editor/preset-code';
7
+
8
+ import { CodeEditorFactory } from './factory';
9
+
10
+ export const loadTypescriptLanguage = () =>
11
+ import('@flowgram.ai/coze-editor/language-typescript').then((module) => {
12
+ languages.register('typescript', module.typescript);
13
+
14
+ // Init TypeScript language service
15
+ const tsWorker = new Worker(
16
+ new URL(`@flowgram.ai/coze-editor/language-typescript/worker`, import.meta.url),
17
+ { type: 'module' }
18
+ );
19
+ module.typescript.languageService.initialize(tsWorker, {
20
+ compilerOptions: {
21
+ // eliminate Promise error
22
+ lib: ['es2015', 'dom'],
23
+ noImplicitAny: false,
24
+ },
25
+ });
26
+ });
27
+
28
+ export const TypeScriptCodeEditor = CodeEditorFactory<true>(loadTypescriptLanguage, {
29
+ displayName: 'TypeScriptCodeEditor',
30
+ fixLanguageId: 'typescript',
31
+ });
@@ -5,6 +5,7 @@
5
5
 
6
6
  import React, { useEffect, useRef } from 'react';
7
7
 
8
+ import styled, { css } from 'styled-components';
8
9
  import {
9
10
  ActiveLinePlaceholder,
10
11
  createRenderer,
@@ -12,11 +13,9 @@ import {
12
13
  InferValues,
13
14
  } from '@flowgram.ai/coze-editor/react';
14
15
  import preset, { type EditorAPI } from '@flowgram.ai/coze-editor/preset-code';
15
- import { Skeleton } from '@douyinfe/semi-ui';
16
16
  import { EditorView } from '@codemirror/view';
17
17
 
18
18
  import { getSuffixByLanguageId } from './utils';
19
- import { useDynamicLoadLanguage } from './language-features';
20
19
 
21
20
  const OriginCodeEditor = createRenderer(preset, [
22
21
  EditorView.theme({
@@ -26,21 +25,30 @@ const OriginCodeEditor = createRenderer(preset, [
26
25
  }),
27
26
  ]);
28
27
 
28
+ const UIContainer = styled.div<{ $mini?: boolean }>`
29
+ ${({ $mini }) =>
30
+ $mini &&
31
+ css`
32
+ height: 24px;
33
+ `}
34
+ `;
35
+
29
36
  type Preset = typeof preset;
30
37
  type Options = Partial<InferValues<Preset[number]>>;
31
38
 
32
39
  export interface CodeEditorPropsType extends React.PropsWithChildren<{}> {
33
40
  value?: string;
34
41
  onChange?: (value: string) => void;
35
- languageId: 'python' | 'typescript' | 'shell' | 'json';
42
+ languageId: 'python' | 'typescript' | 'shell' | 'json' | 'sql';
36
43
  theme?: 'dark' | 'light';
37
44
  placeholder?: string;
38
45
  activeLinePlaceholder?: string;
39
46
  readonly?: boolean;
40
47
  options?: Options;
48
+ mini?: boolean;
41
49
  }
42
50
 
43
- export function CodeEditor({
51
+ export function BaseCodeEditor({
44
52
  value,
45
53
  onChange,
46
54
  languageId = 'python',
@@ -50,9 +58,8 @@ export function CodeEditor({
50
58
  activeLinePlaceholder,
51
59
  options,
52
60
  readonly,
61
+ mini,
53
62
  }: CodeEditorPropsType) {
54
- const { loaded } = useDynamicLoadLanguage(languageId);
55
-
56
63
  const editorRef = useRef<EditorAPI | null>(null);
57
64
 
58
65
  useEffect(() => {
@@ -62,33 +69,38 @@ export function CodeEditor({
62
69
  }
63
70
  }, [value]);
64
71
 
65
- if (!loaded) {
66
- return <Skeleton />;
67
- }
68
-
69
72
  return (
70
- <EditorProvider>
71
- <OriginCodeEditor
72
- defaultValue={String(value || '')}
73
- options={{
74
- uri: `file:///untitled${getSuffixByLanguageId(languageId)}`,
75
- languageId,
76
- theme,
77
- placeholder,
78
- readOnly: readonly,
79
- editable: !readonly,
80
- ...(options || {}),
81
- }}
82
- didMount={(editor: EditorAPI) => {
83
- editorRef.current = editor;
84
- }}
85
- onChange={(e) => onChange?.(e.value)}
86
- >
87
- {activeLinePlaceholder && (
88
- <ActiveLinePlaceholder>{activeLinePlaceholder}</ActiveLinePlaceholder>
89
- )}
90
- {children}
91
- </OriginCodeEditor>
92
- </EditorProvider>
73
+ <UIContainer $mini={mini}>
74
+ <EditorProvider>
75
+ <OriginCodeEditor
76
+ defaultValue={String(value || '')}
77
+ options={{
78
+ uri: `file:///untitled${getSuffixByLanguageId(languageId)}`,
79
+ languageId,
80
+ theme,
81
+ placeholder,
82
+ readOnly: readonly,
83
+ editable: !readonly,
84
+ ...(mini
85
+ ? {
86
+ lineNumbersGutter: false,
87
+ foldGutter: false,
88
+ minHeight: 24,
89
+ }
90
+ : {}),
91
+ ...(options || {}),
92
+ }}
93
+ didMount={(editor: EditorAPI) => {
94
+ editorRef.current = editor;
95
+ }}
96
+ onChange={(e) => onChange?.(e.value)}
97
+ >
98
+ {activeLinePlaceholder && (
99
+ <ActiveLinePlaceholder>{activeLinePlaceholder}</ActiveLinePlaceholder>
100
+ )}
101
+ {children}
102
+ </OriginCodeEditor>
103
+ </EditorProvider>
104
+ </UIContainer>
93
105
  );
94
106
  }
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { useEffect, useMemo, useState } from 'react';
7
+ import React from 'react';
8
+
9
+ import { languages } from '@flowgram.ai/coze-editor/preset-code';
10
+ import { Skeleton } from '@douyinfe/semi-ui';
11
+
12
+ import { lazySuspense } from '@/shared';
13
+
14
+ import type { CodeEditorPropsType } from './editor';
15
+
16
+ export const BaseCodeEditor = lazySuspense(() =>
17
+ Promise.all([import('./editor'), import('./theme')]).then(([editorModule]) => ({
18
+ default: editorModule.BaseCodeEditor,
19
+ }))
20
+ );
21
+
22
+ interface FactoryParams<FixLanguageId extends boolean> {
23
+ displayName: string;
24
+ fixLanguageId: FixLanguageId extends true ? CodeEditorPropsType['languageId'] : undefined;
25
+ }
26
+
27
+ export const CodeEditorFactory = <FixLanguageId extends boolean>(
28
+ loadLanguage: (languageId: string) => Promise<any>,
29
+ { displayName, fixLanguageId }: FactoryParams<FixLanguageId>
30
+ ): FixLanguageId extends true
31
+ ? React.FC<Omit<CodeEditorPropsType, 'languageId'>>
32
+ : React.FC<CodeEditorPropsType> => {
33
+ const EditorWithLoad = (props: CodeEditorPropsType) => {
34
+ const { languageId = fixLanguageId } = props;
35
+
36
+ if (!languageId) {
37
+ throw new Error('CodeEditorFactory: languageId is required');
38
+ }
39
+
40
+ const [loaded, setLoaded] = useState(useMemo(() => !!languages.get(languageId), [languageId]));
41
+
42
+ useEffect(() => {
43
+ if (!loaded && loadLanguage) {
44
+ loadLanguage(languageId).then(() => {
45
+ setLoaded(true);
46
+ });
47
+ }
48
+ }, [languageId, loaded]);
49
+
50
+ if (!loaded) {
51
+ return <Skeleton />;
52
+ }
53
+
54
+ return <BaseCodeEditor {...props} languageId={fixLanguageId || languageId} />;
55
+ };
56
+ EditorWithLoad.displayName = displayName;
57
+
58
+ return EditorWithLoad as FixLanguageId extends true
59
+ ? React.FC<Omit<CodeEditorPropsType, 'languageId'>>
60
+ : React.FC<CodeEditorPropsType>;
61
+ };
@@ -3,12 +3,10 @@
3
3
  * SPDX-License-Identifier: MIT
4
4
  */
5
5
 
6
- import { lazySuspense } from '@/shared';
7
-
8
- export const CodeEditor = lazySuspense(() =>
9
- Promise.all([import('./editor'), import('./theme')]).then(([editorModule]) => ({
10
- default: editorModule.CodeEditor,
11
- }))
12
- );
13
-
14
- export type { CodeEditorPropsType } from './editor';
6
+ export { CodeEditor } from './editor-all';
7
+ export { TypeScriptCodeEditor } from './editor-ts';
8
+ export { ShellCodeEditor } from './editor-shell';
9
+ export { JsonCodeEditor } from './editor-json';
10
+ export { SQLCodeEditor } from './editor-sql';
11
+ export { PythonCodeEditor } from './editor-python';
12
+ export { BaseCodeEditor, type CodeEditorPropsType } from './editor';
@@ -16,5 +16,9 @@ export function getSuffixByLanguageId(languageId: string) {
16
16
  if (languageId === 'json') {
17
17
  return '.json';
18
18
  }
19
+ if (languageId === 'sql') {
20
+ return '.sql';
21
+ }
22
+
19
23
  return '';
20
24
  }
@@ -14,6 +14,9 @@ const UIMini = styled.div`
14
14
  }
15
15
  `;
16
16
 
17
+ /**
18
+ * @deprecated use mini in CodeEditorPropsType instead
19
+ */
17
20
  export function CodeEditorMini(props: CodeEditorPropsType) {
18
21
  return (
19
22
  <UIMini>
@@ -8,14 +8,33 @@ export { AssignRows } from './assign-rows';
8
8
  export { BatchOutputs } from './batch-outputs';
9
9
  export { BatchVariableSelector } from './batch-variable-selector';
10
10
  export { BlurInput } from './blur-input';
11
- export { CodeEditor, type CodeEditorPropsType } from './code-editor';
11
+ export {
12
+ BaseCodeEditor,
13
+ CodeEditor,
14
+ JsonCodeEditor,
15
+ PythonCodeEditor,
16
+ SQLCodeEditor,
17
+ ShellCodeEditor,
18
+ TypeScriptCodeEditor,
19
+ type CodeEditorPropsType,
20
+ } from './code-editor';
12
21
  export { CodeEditorMini } from './code-editor-mini';
22
+ export {
23
+ ConditionPresetOp,
24
+ ConditionProvider,
25
+ type ConditionOpConfig,
26
+ type ConditionOpConfigs,
27
+ type IConditionRule,
28
+ type IConditionRuleFactory,
29
+ useCondition,
30
+ useConditionContext,
31
+ } from './condition-context';
13
32
  export { ConditionRow, type ConditionRowValueType } from './condition-row';
14
33
  export { ConstantInput, type ConstantInputStrategy } from './constant-input';
15
34
  export {
35
+ EditorInputsTree,
16
36
  EditorVariableTagInject,
17
37
  EditorVariableTree,
18
- EditorInputsTree,
19
38
  } from './coze-editor-extensions';
20
39
  export {
21
40
  DBConditionRow,
@@ -44,6 +63,10 @@ export {
44
63
  PromptEditorWithVariables,
45
64
  type PromptEditorWithVariablesProps,
46
65
  } from './prompt-editor-with-variables';
66
+ export {
67
+ SQLEditorWithVariables,
68
+ type SQLEditorWithVariablesProps,
69
+ } from './sql-editor-with-variables';
47
70
  export {
48
71
  InjectTypeSelector,
49
72
  TypeSelector,
@@ -10,7 +10,7 @@ import { transformerCreator } from '@flowgram.ai/coze-editor/preset-code';
10
10
  import { Text } from '@flowgram.ai/coze-editor/language-json';
11
11
 
12
12
  import { EditorVariableTree, EditorVariableTagInject } from '@/components/coze-editor-extensions';
13
- import { CodeEditor, type CodeEditorPropsType } from '@/components/code-editor';
13
+ import { JsonCodeEditor, type CodeEditorPropsType } from '@/components/code-editor';
14
14
 
15
15
  const TRIGGER_CHARACTERS = ['@'];
16
16
 
@@ -53,8 +53,7 @@ export interface JsonEditorWithVariablesProps extends Omit<CodeEditorPropsType,
53
53
 
54
54
  export function JsonEditorWithVariables(props: JsonEditorWithVariablesProps) {
55
55
  return (
56
- <CodeEditor
57
- languageId="json"
56
+ <JsonCodeEditor
58
57
  activeLinePlaceholder={I18n.t("Press '@' to Select variable")}
59
58
  {...props}
60
59
  options={{
@@ -64,6 +63,6 @@ export function JsonEditorWithVariables(props: JsonEditorWithVariablesProps) {
64
63
  >
65
64
  <EditorVariableTree triggerCharacters={TRIGGER_CHARACTERS} />
66
65
  <EditorVariableTagInject />
67
- </CodeEditor>
66
+ </JsonCodeEditor>
68
67
  );
69
68
  }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import React from 'react';
7
+
8
+ import { I18n } from '@flowgram.ai/editor';
9
+
10
+ import { EditorVariableTree, EditorVariableTagInject } from '@/components/coze-editor-extensions';
11
+ import { SQLCodeEditor, type CodeEditorPropsType } from '@/components/code-editor';
12
+
13
+ export interface SQLEditorWithVariablesProps extends Omit<CodeEditorPropsType, 'languageId'> {}
14
+
15
+ export function SQLEditorWithVariables(props: SQLEditorWithVariablesProps) {
16
+ return (
17
+ <SQLCodeEditor
18
+ activeLinePlaceholder={I18n.t("Press '@' to Select variable")}
19
+ {...props}
20
+ options={{
21
+ ...(props.options || {}),
22
+ }}
23
+ >
24
+ <EditorVariableTree />
25
+ <EditorVariableTagInject />
26
+ </SQLCodeEditor>
27
+ );
28
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { lazySuspense } from '@/shared';
7
+
8
+ export const SQLEditorWithVariables = lazySuspense(() =>
9
+ import('./editor').then((module) => ({ default: module.SQLEditorWithVariables }))
10
+ );
11
+
12
+ export type { SQLEditorWithVariablesProps } from './editor';
package/src/index.ts CHANGED
@@ -6,11 +6,14 @@
6
6
  export {
7
7
  AssignRow,
8
8
  AssignRows,
9
+ BaseCodeEditor,
9
10
  BatchOutputs,
10
11
  BatchVariableSelector,
11
12
  BlurInput,
12
13
  CodeEditor,
13
14
  CodeEditorMini,
15
+ ConditionPresetOp,
16
+ ConditionProvider,
14
17
  ConditionRow,
15
18
  ConstantInput,
16
19
  DBConditionRow,
@@ -21,36 +24,49 @@ export {
21
24
  DisplaySchemaTag,
22
25
  DisplaySchemaTree,
23
26
  DynamicValueInput,
27
+ EditorInputsTree,
28
+ EditorVariableTagInject,
29
+ EditorVariableTree,
24
30
  InjectDynamicValueInput,
25
31
  InjectTypeSelector,
26
32
  InjectVariableSelector,
27
33
  InputsValues,
28
34
  InputsValuesTree,
35
+ JsonCodeEditor,
29
36
  JsonEditorWithVariables,
30
37
  JsonSchemaEditor,
31
38
  PromptEditor,
32
39
  PromptEditorWithInputs,
33
40
  PromptEditorWithVariables,
41
+ PythonCodeEditor,
42
+ SQLCodeEditor,
43
+ SQLEditorWithVariables,
44
+ ShellCodeEditor,
45
+ TypeScriptCodeEditor,
34
46
  TypeSelector,
35
47
  VariableSelector,
36
48
  VariableSelectorProvider,
37
- EditorVariableTagInject,
38
- EditorVariableTree,
39
- EditorInputsTree,
40
49
  getTypeSelectValue,
41
50
  parseTypeSelectValue,
42
51
  type AssignValueType,
43
52
  type CodeEditorPropsType,
53
+ type ConditionOpConfig,
54
+ type ConditionOpConfigs,
44
55
  type ConditionRowValueType,
45
56
  type ConstantInputStrategy,
46
57
  type DBConditionOptionType,
47
58
  type DBConditionRowValueType,
59
+ type IConditionRule,
60
+ type IConditionRuleFactory,
48
61
  type JsonEditorWithVariablesProps,
49
62
  type PromptEditorPropsType,
50
63
  type PromptEditorWithInputsProps,
51
64
  type PromptEditorWithVariablesProps,
65
+ type SQLEditorWithVariablesProps,
52
66
  type TypeSelectorProps,
53
67
  type VariableSelectorProps,
68
+ useCondition,
69
+ useConditionContext,
54
70
  useVariableTree,
55
71
  } from './components';
56
72
  export {
@@ -9,16 +9,16 @@ import React from 'react';
9
9
  import { I18n } from '@flowgram.ai/editor';
10
10
 
11
11
  import { ConditionPresetOp } from '@/components/condition-context/op';
12
- import { CodeEditorMini } from '@/components/code-editor-mini';
12
+ import { JsonCodeEditor } from '@/components/code-editor';
13
13
 
14
14
  import { type JsonSchemaTypeRegistry } from '../types';
15
15
 
16
16
  export const arrayRegistry: Partial<JsonSchemaTypeRegistry> = {
17
17
  type: 'array',
18
18
  ConstantRenderer: (props) => (
19
- <CodeEditorMini
19
+ <JsonCodeEditor
20
+ mini
20
21
  value={props.value}
21
- languageId="json"
22
22
  onChange={(v) => props.onChange?.(v)}
23
23
  placeholder={I18n.t('Please Input Array')}
24
24
  readonly={props.readonly}
@@ -9,17 +9,17 @@ import React from 'react';
9
9
  import { I18n } from '@flowgram.ai/editor';
10
10
 
11
11
  import { ConditionPresetOp } from '@/components/condition-context/op';
12
- import { CodeEditorMini } from '@/components/code-editor-mini';
12
+ import { JsonCodeEditor } from '@/components/code-editor';
13
13
 
14
14
  import { type JsonSchemaTypeRegistry } from '../types';
15
15
 
16
16
  export const mapRegistry: Partial<JsonSchemaTypeRegistry> = {
17
17
  type: 'map',
18
18
  ConstantRenderer: (props) => (
19
- <CodeEditorMini
19
+ <JsonCodeEditor
20
+ mini
20
21
  value={props.value}
21
22
  onChange={(v) => props.onChange?.(v)}
22
- languageId="json"
23
23
  placeholder={I18n.t('Please Input Map')}
24
24
  readonly={props.readonly}
25
25
  />
@@ -9,17 +9,17 @@ import React from 'react';
9
9
  import { I18n } from '@flowgram.ai/editor';
10
10
 
11
11
  import { ConditionPresetOp } from '@/components/condition-context/op';
12
- import { CodeEditorMini } from '@/components/code-editor-mini';
12
+ import { JsonCodeEditor } from '@/components/code-editor';
13
13
 
14
14
  import { type JsonSchemaTypeRegistry } from '../types';
15
15
 
16
16
  export const objectRegistry: Partial<JsonSchemaTypeRegistry> = {
17
17
  type: 'object',
18
18
  ConstantRenderer: (props) => (
19
- <CodeEditorMini
19
+ <JsonCodeEditor
20
+ mini
20
21
  value={props.value}
21
22
  onChange={(v) => props.onChange?.(v)}
22
- languageId="json"
23
23
  placeholder={I18n.t('Please Input Object')}
24
24
  readonly={props.readonly}
25
25
  />