@agentscope-ai/flow 0.0.22 → 0.0.23

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.
@@ -134,7 +134,15 @@ export var VariableSelector = /*#__PURE__*/memo(function (props) {
134
134
  nodeType: targetNode.nodeType
135
135
  };
136
136
  }, [props.value, markedVariableList]);
137
- return /*#__PURE__*/React.createElement(VariableTreeSelect, {
137
+ return /*#__PURE__*/React.createElement("div", {
138
+ className: "spark-flow-variable-select-wrapper",
139
+ onClickCapture: function onClickCapture(e) {
140
+ var _e$target;
141
+ if ((_e$target = e.target) !== null && _e$target !== void 0 && _e$target.closest('[class*="-select-clear"]')) {
142
+ e.stopPropagation();
143
+ }
144
+ }
145
+ }, /*#__PURE__*/React.createElement(VariableTreeSelect, {
138
146
  onChange: function onChange(val) {
139
147
  props.onChange({
140
148
  value: val.value,
@@ -159,11 +167,20 @@ export var VariableSelector = /*#__PURE__*/memo(function (props) {
159
167
  className: classNames('w-full', 'spark-flow-variable-select'),
160
168
  open: false,
161
169
  value: !props.value.value ? undefined : props.value.value,
170
+ onChange: function onChange(next) {
171
+ if (next === undefined || next === null || next === '') {
172
+ props.onChange({
173
+ value: '',
174
+ type: props.value.type
175
+ });
176
+ }
177
+ },
162
178
  prefix: props.prefix ? /*#__PURE__*/React.createElement(VarTypePrefix, {
163
179
  prefix: props.prefix
164
180
  }) : undefined,
165
- variant: props.variant
166
- }));
181
+ variant: props.variant,
182
+ allowClear: true
183
+ })));
167
184
  });
168
185
  export var VariableFormComp = /*#__PURE__*/memo(function (props) {
169
186
  if (props.data.valueFrom === 'clear') return /*#__PURE__*/React.createElement(Input, {
@@ -1,5 +1,10 @@
1
1
  @import '../../index.less';
2
2
 
3
+ .spark-flow-variable-select-wrapper {
4
+ flex: 1;
5
+ min-width: 0;
6
+ }
7
+
3
8
  .spark-flow-variable-select {
4
9
  .@{ant-prefix}-popover-content {
5
10
  max-height: 300px;
@@ -29,5 +29,5 @@ export declare const VariableTreeNodeItem: React.MemoExoticComponent<(props: IVa
29
29
  value?: string | undefined;
30
30
  onChange?: ((value: Pick<IVarItem, 'type' | 'value'>) => void) | undefined;
31
31
  }) => React.JSX.Element>;
32
- declare const VariableTreeSelect: React.MemoExoticComponent<(props: IVariableTreeSelectProps) => string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined>;
32
+ declare const VariableTreeSelect: React.MemoExoticComponent<(props: IVariableTreeSelectProps) => string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined>;
33
33
  export default VariableTreeSelect;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentscope-ai/flow",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "description": "A powerful and flexible flow canvas rendering engine designed for AI applications. Provides comprehensive workflow visualization and interaction capabilities for platforms like Bailian and AgentScope, enabling seamless creation and management of complex AI agent workflows with an intuitive drag-and-drop interface.",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,4 +0,0 @@
1
- import { ConnectionLineComponentProps } from '@xyflow/react';
2
- import React from 'react';
3
- declare const _default: React.NamedExoticComponent<ConnectionLineComponentProps>;
4
- export default _default;
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- interface IProps {
3
- handleId: string;
4
- }
5
- export default function TargetHandle(props: IProps): React.JSX.Element;
6
- export {};
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import './index.less';
3
- interface DragPanelProps {
4
- maxWidth: number;
5
- minWidth: number;
6
- children?: React.ReactNode;
7
- defaultWidth?: number;
8
- }
9
- declare const DragPanel: React.FC<DragPanelProps>;
10
- export default DragPanel;
@@ -1,13 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import './index.less';
3
- interface DraggableWithHandleProps<T> {
4
- items: T[];
5
- onChange: (items: T[]) => void;
6
- renderItem: (item: T, dragHandleProps: ReactNode) => ReactNode;
7
- getItemId: (item: T) => string;
8
- dragIcon?: ReactNode;
9
- className?: string;
10
- disabled?: boolean;
11
- }
12
- export declare function DraggableWithHandle<T>({ items, onChange, renderItem, getItemId, dragIcon, className, disabled, }: DraggableWithHandleProps<T>): React.JSX.Element;
13
- export default DraggableWithHandle;
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
- import './index.less';
3
- export type ILinearGradientSvgProps = {
4
- id: string;
5
- startColor: string;
6
- stopColor: string;
7
- position: {
8
- sourceX: number;
9
- sourceY: number;
10
- targetX: number;
11
- targetY: number;
12
- };
13
- colorList: Array<{
14
- color: string;
15
- opacity?: number;
16
- offset: number;
17
- }>;
18
- animated?: boolean;
19
- };
20
- declare const _default: React.MemoExoticComponent<({ id, position, colorList, animated, }: ILinearGradientSvgProps) => React.JSX.Element>;
21
- export default _default;
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import './index.less';
3
- interface IFlowPanel {
4
- children?: React.ReactNode[] | React.ReactNode;
5
- className?: string;
6
- style?: React.CSSProperties;
7
- }
8
- declare const _default: React.NamedExoticComponent<IFlowPanel>;
9
- export default _default;
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- interface IPanelContainerProps {
3
- title?: React.ReactNode;
4
- right?: React.ReactNode;
5
- children: React.ReactNode;
6
- onClose?: () => void;
7
- noPadding?: boolean;
8
- hiddenRight?: boolean;
9
- headerBottom?: React.ReactNode;
10
- }
11
- declare const _default: React.NamedExoticComponent<IPanelContainerProps>;
12
- export default _default;
@@ -1,5 +0,0 @@
1
- import { SelectProps } from '@agentscope-ai/design';
2
- import React from 'react';
3
- import './index.less';
4
- declare const _default: React.NamedExoticComponent<SelectProps<any, import("antd/es/select").DefaultOptionType>>;
5
- export default _default;
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- export declare const typeAbbr: {
3
- 'Array<Object>': string;
4
- 'Array<File>': string;
5
- 'Array<String>': string;
6
- 'Array<Number>': string;
7
- 'Array<Boolean>': string;
8
- Object: string;
9
- File: string;
10
- String: string;
11
- Number: string;
12
- Boolean: string;
13
- };
14
- declare const _default: React.NamedExoticComponent<{
15
- prefix?: string | undefined;
16
- }>;
17
- export default _default;
@@ -1,62 +0,0 @@
1
- interface I18nVariables {
2
- [key: string]: any;
3
- }
4
- interface IMultiLangMap {
5
- [key: string]: {
6
- [key: string]: string;
7
- };
8
- }
9
- type TLanguage = 'en' | 'zh' | 'ja' | string;
10
- /**
11
- * Internationalization (i18n) utility class
12
- * Handles language management and string translations
13
- */
14
- export default class I18N {
15
- multiLangMap: IMultiLangMap;
16
- language: TLanguage;
17
- /**
18
- * Initialize I18N instance with multi-language map
19
- * @param config Configuration object containing multiLangMap
20
- */
21
- constructor({ multiLangMap }: {
22
- multiLangMap: IMultiLangMap;
23
- });
24
- /**
25
- * Convert value to string with fallback
26
- * @param value Input value to convert
27
- * @param defaultValue Fallback value if conversion fails
28
- * @returns String representation of the value
29
- */
30
- toString: (value: any, defaultValue: string) => any;
31
- /**
32
- * Set current application language
33
- * @param language Language code to set ('en' or 'zh')
34
- */
35
- setCurrentLanguage(language: TLanguage): void;
36
- /**
37
- * Get current application language
38
- * @returns Current language code
39
- */
40
- getCurrentLanguage(): string;
41
- /**
42
- * Format translation string with variables
43
- * @param idObj Translation ID or object containing ID and default message
44
- * @param variables Variables to interpolate into the translation
45
- * @returns Formatted translation string
46
- */
47
- format: (idObj: string | {
48
- id: string;
49
- dm: string;
50
- }, variables: I18nVariables) => string;
51
- /**
52
- * Get translation for given ID
53
- * @param id Translation ID or object containing ID and default message
54
- * @param variables Optional variables to interpolate
55
- * @returns Translated string
56
- */
57
- get(id: string | {
58
- id: string;
59
- dm: string;
60
- }, variable?: I18nVariables): string;
61
- }
62
- export {};
@@ -1,3 +0,0 @@
1
- import I18N from './i18n';
2
- declare const _default: I18N;
3
- export default _default;
@@ -1,2 +0,0 @@
1
- export declare function setUniqueIdStrategy(strategy: 'incremental' | 'random'): void;
2
- export default function uniqueId(length: number): string;