@flowgram.ai/form-materials 0.3.2 → 0.3.4

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/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
1
  import React$1 from 'react';
2
2
  import { IJsonSchema, JsonSchemaTypeRegistry as JsonSchemaTypeRegistry$1, JsonSchemaTypeManager } from '@flowgram.ai/json-schema';
3
- export { IJsonSchema, JsonSchemaUtils } from '@flowgram.ai/json-schema';
3
+ export { IJsonSchema, JsonSchemaBasicType, JsonSchemaUtils } from '@flowgram.ai/json-schema';
4
4
  import { TriggerRenderProps } from '@douyinfe/semi-ui/lib/es/treeSelect';
5
5
  import { InferValues } from '@coze-editor/editor/react';
6
6
  import preset from '@coze-editor/editor/preset-code';
7
- import { BaseVariableField, EffectOptions, FormPluginCreator, FeedbackLevel, FlowNodeEntity } from '@flowgram.ai/editor';
7
+ import { BaseVariableField, EffectOptions, EffectFuncProps, FormPluginCreator, FeedbackLevel, FlowNodeEntity } from '@flowgram.ai/editor';
8
8
  import * as _flowgram_ai_node from '@flowgram.ai/node';
9
9
  import * as _flowgram_ai_core from '@flowgram.ai/core';
10
10
  import { TreeNodeData } from '@douyinfe/semi-ui/lib/es/tree';
@@ -220,25 +220,17 @@ declare function DynamicValueInput({ value, onChange, readonly, style, schema: s
220
220
  * SPDX-License-Identifier: MIT
221
221
  */
222
222
 
223
- declare enum Op {
224
- EQ = "eq",
225
- NEQ = "neq",
226
- GT = "gt",
227
- GTE = "gte",
228
- LT = "lt",
229
- LTE = "lte",
230
- IN = "in",
231
- NIN = "nin",
232
- CONTAINS = "contains",
233
- NOT_CONTAINS = "not_contains",
234
- IS_EMPTY = "is_empty",
235
- IS_NOT_EMPTY = "is_not_empty",
236
- IS_TRUE = "is_true",
237
- IS_FALSE = "is_false"
223
+ interface OpConfig {
224
+ label: string;
225
+ abbreviation: string;
226
+ rightDisplay?: string;
238
227
  }
228
+ type OpConfigs = Record<string, OpConfig>;
229
+ type IRule = Partial<Record<string, string | null>>;
230
+ type IRules = Record<string, IRule>;
239
231
  interface ConditionRowValueType {
240
232
  left?: IFlowRefValue;
241
- operator?: Op;
233
+ operator?: string;
242
234
  right?: IFlowConstantRefValue;
243
235
  }
244
236
 
@@ -252,8 +244,12 @@ interface PropTypes {
252
244
  onChange: (value?: ConditionRowValueType) => void;
253
245
  style?: React$1.CSSProperties;
254
246
  readonly?: boolean;
247
+ ruleConfig?: {
248
+ ops?: OpConfigs;
249
+ rules?: IRules;
250
+ };
255
251
  }
256
- declare function ConditionRow({ style, value, onChange, readonly }: PropTypes): React$1.JSX.Element;
252
+ declare function ConditionRow({ style, value, onChange, readonly, ruleConfig, }: PropTypes): React$1.JSX.Element;
257
253
 
258
254
  /**
259
255
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
@@ -527,6 +523,49 @@ declare const validateWhenVariableSync: ({ scope, }?: {
527
523
  scope?: "private" | "public";
528
524
  }) => EffectOptions[];
529
525
 
526
+ /**
527
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
528
+ * SPDX-License-Identifier: MIT
529
+ */
530
+
531
+ /**
532
+ * Example:
533
+ * const formMeta = {
534
+ * effect: {
535
+ * 'inputsValues.*': listenRefValueChange(({ name, variable, form }) => {
536
+ * const schema = JsonSchemaUtils.astToSchema(variable?.type);
537
+ * form.setValueIn(`${name}.schema`, schema);
538
+ * })
539
+ * }
540
+ * }
541
+ * @param cb
542
+ * @returns
543
+ */
544
+ declare const listenRefValueChange: (cb: (props: EffectFuncProps<IFlowRefValue> & {
545
+ variable?: BaseVariableField;
546
+ }) => void) => EffectOptions[];
547
+
548
+ /**
549
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
550
+ * SPDX-License-Identifier: MIT
551
+ */
552
+
553
+ /**
554
+ * Example:
555
+ * const formMeta = {
556
+ * effect: {
557
+ * 'inputsValues.*': listenRefSchemaChange(({ name, schema, form }) => {
558
+ * form.setValueIn(`${name}.schema`, schema);
559
+ * })
560
+ * }
561
+ * }
562
+ * @param cb
563
+ * @returns
564
+ */
565
+ declare const listenRefSchemaChange: (cb: (props: EffectFuncProps<IFlowRefValue> & {
566
+ schema?: IJsonSchema;
567
+ }) => void) => EffectOptions[];
568
+
530
569
  /**
531
570
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
532
571
  * SPDX-License-Identifier: MIT
@@ -663,4 +702,4 @@ declare function validateFlowValue(value: IFlowValue | undefined, ctx: Context):
663
702
  message: string;
664
703
  } | undefined;
665
704
 
666
- export { AssignRow, AssignRows, type AssignValueType, BatchOutputs, BatchVariableSelector, CodeEditor, CodeEditorMini, type CodeEditorPropsType, ConditionRow, type ConditionRowValueType, ConstantInput, type ConstantRendererProps, DisplayFlowValue, DisplayInputsValues, DisplayOutputs, DisplaySchemaTag, DisplaySchemaTree, DynamicValueInput, type IFlowConstantRefValue, type IFlowConstantValue, type IFlowExpressionValue, type IFlowRefValue, type IFlowTemplateValue, type IFlowValue, type IFlowValueExtra, InputsValues, JsonEditorWithVariables, JsonSchemaEditor, JsonSchemaTypePresetProvider, type JsonSchemaTypeRegistry, PromptEditor, type PromptEditorPropsType, PromptEditorWithInputs, PromptEditorWithVariables, TypeSelector, VariableSelector, type VariableSelectorProps, autoRenameRefEffect, createBatchOutputsFormPlugin, createDisableDeclarationPlugin, createInferAssignPlugin, createInferInputsPlugin, createTypePresetPlugin, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, getTypeSelectValue, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, parseTypeSelectValue, provideBatchInputEffect, provideBatchOutputsEffect, provideJsonSchemaOutputs, syncVariableTitle, useTypeManager, useVariableTree, validateFlowValue, validateWhenVariableSync };
705
+ export { AssignRow, AssignRows, type AssignValueType, BatchOutputs, BatchVariableSelector, CodeEditor, CodeEditorMini, type CodeEditorPropsType, ConditionRow, type ConditionRowValueType, ConstantInput, type ConstantRendererProps, DisplayFlowValue, DisplayInputsValues, DisplayOutputs, DisplaySchemaTag, DisplaySchemaTree, DynamicValueInput, type IFlowConstantRefValue, type IFlowConstantValue, type IFlowExpressionValue, type IFlowRefValue, type IFlowTemplateValue, type IFlowValue, type IFlowValueExtra, InputsValues, JsonEditorWithVariables, JsonSchemaEditor, JsonSchemaTypePresetProvider, type JsonSchemaTypeRegistry, PromptEditor, type PromptEditorPropsType, PromptEditorWithInputs, PromptEditorWithVariables, TypeSelector, VariableSelector, type VariableSelectorProps, autoRenameRefEffect, createBatchOutputsFormPlugin, createDisableDeclarationPlugin, createInferAssignPlugin, createInferInputsPlugin, createTypePresetPlugin, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, getTypeSelectValue, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, listenRefSchemaChange, listenRefValueChange, parseTypeSelectValue, provideBatchInputEffect, provideBatchOutputsEffect, provideJsonSchemaOutputs, syncVariableTitle, useTypeManager, useVariableTree, validateFlowValue, validateWhenVariableSync };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import React$1 from 'react';
2
2
  import { IJsonSchema, JsonSchemaTypeRegistry as JsonSchemaTypeRegistry$1, JsonSchemaTypeManager } from '@flowgram.ai/json-schema';
3
- export { IJsonSchema, JsonSchemaUtils } from '@flowgram.ai/json-schema';
3
+ export { IJsonSchema, JsonSchemaBasicType, JsonSchemaUtils } from '@flowgram.ai/json-schema';
4
4
  import { TriggerRenderProps } from '@douyinfe/semi-ui/lib/es/treeSelect';
5
5
  import { InferValues } from '@coze-editor/editor/react';
6
6
  import preset from '@coze-editor/editor/preset-code';
7
- import { BaseVariableField, EffectOptions, FormPluginCreator, FeedbackLevel, FlowNodeEntity } from '@flowgram.ai/editor';
7
+ import { BaseVariableField, EffectOptions, EffectFuncProps, FormPluginCreator, FeedbackLevel, FlowNodeEntity } from '@flowgram.ai/editor';
8
8
  import * as _flowgram_ai_node from '@flowgram.ai/node';
9
9
  import * as _flowgram_ai_core from '@flowgram.ai/core';
10
10
  import { TreeNodeData } from '@douyinfe/semi-ui/lib/es/tree';
@@ -220,25 +220,17 @@ declare function DynamicValueInput({ value, onChange, readonly, style, schema: s
220
220
  * SPDX-License-Identifier: MIT
221
221
  */
222
222
 
223
- declare enum Op {
224
- EQ = "eq",
225
- NEQ = "neq",
226
- GT = "gt",
227
- GTE = "gte",
228
- LT = "lt",
229
- LTE = "lte",
230
- IN = "in",
231
- NIN = "nin",
232
- CONTAINS = "contains",
233
- NOT_CONTAINS = "not_contains",
234
- IS_EMPTY = "is_empty",
235
- IS_NOT_EMPTY = "is_not_empty",
236
- IS_TRUE = "is_true",
237
- IS_FALSE = "is_false"
223
+ interface OpConfig {
224
+ label: string;
225
+ abbreviation: string;
226
+ rightDisplay?: string;
238
227
  }
228
+ type OpConfigs = Record<string, OpConfig>;
229
+ type IRule = Partial<Record<string, string | null>>;
230
+ type IRules = Record<string, IRule>;
239
231
  interface ConditionRowValueType {
240
232
  left?: IFlowRefValue;
241
- operator?: Op;
233
+ operator?: string;
242
234
  right?: IFlowConstantRefValue;
243
235
  }
244
236
 
@@ -252,8 +244,12 @@ interface PropTypes {
252
244
  onChange: (value?: ConditionRowValueType) => void;
253
245
  style?: React$1.CSSProperties;
254
246
  readonly?: boolean;
247
+ ruleConfig?: {
248
+ ops?: OpConfigs;
249
+ rules?: IRules;
250
+ };
255
251
  }
256
- declare function ConditionRow({ style, value, onChange, readonly }: PropTypes): React$1.JSX.Element;
252
+ declare function ConditionRow({ style, value, onChange, readonly, ruleConfig, }: PropTypes): React$1.JSX.Element;
257
253
 
258
254
  /**
259
255
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
@@ -527,6 +523,49 @@ declare const validateWhenVariableSync: ({ scope, }?: {
527
523
  scope?: "private" | "public";
528
524
  }) => EffectOptions[];
529
525
 
526
+ /**
527
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
528
+ * SPDX-License-Identifier: MIT
529
+ */
530
+
531
+ /**
532
+ * Example:
533
+ * const formMeta = {
534
+ * effect: {
535
+ * 'inputsValues.*': listenRefValueChange(({ name, variable, form }) => {
536
+ * const schema = JsonSchemaUtils.astToSchema(variable?.type);
537
+ * form.setValueIn(`${name}.schema`, schema);
538
+ * })
539
+ * }
540
+ * }
541
+ * @param cb
542
+ * @returns
543
+ */
544
+ declare const listenRefValueChange: (cb: (props: EffectFuncProps<IFlowRefValue> & {
545
+ variable?: BaseVariableField;
546
+ }) => void) => EffectOptions[];
547
+
548
+ /**
549
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
550
+ * SPDX-License-Identifier: MIT
551
+ */
552
+
553
+ /**
554
+ * Example:
555
+ * const formMeta = {
556
+ * effect: {
557
+ * 'inputsValues.*': listenRefSchemaChange(({ name, schema, form }) => {
558
+ * form.setValueIn(`${name}.schema`, schema);
559
+ * })
560
+ * }
561
+ * }
562
+ * @param cb
563
+ * @returns
564
+ */
565
+ declare const listenRefSchemaChange: (cb: (props: EffectFuncProps<IFlowRefValue> & {
566
+ schema?: IJsonSchema;
567
+ }) => void) => EffectOptions[];
568
+
530
569
  /**
531
570
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
532
571
  * SPDX-License-Identifier: MIT
@@ -663,4 +702,4 @@ declare function validateFlowValue(value: IFlowValue | undefined, ctx: Context):
663
702
  message: string;
664
703
  } | undefined;
665
704
 
666
- export { AssignRow, AssignRows, type AssignValueType, BatchOutputs, BatchVariableSelector, CodeEditor, CodeEditorMini, type CodeEditorPropsType, ConditionRow, type ConditionRowValueType, ConstantInput, type ConstantRendererProps, DisplayFlowValue, DisplayInputsValues, DisplayOutputs, DisplaySchemaTag, DisplaySchemaTree, DynamicValueInput, type IFlowConstantRefValue, type IFlowConstantValue, type IFlowExpressionValue, type IFlowRefValue, type IFlowTemplateValue, type IFlowValue, type IFlowValueExtra, InputsValues, JsonEditorWithVariables, JsonSchemaEditor, JsonSchemaTypePresetProvider, type JsonSchemaTypeRegistry, PromptEditor, type PromptEditorPropsType, PromptEditorWithInputs, PromptEditorWithVariables, TypeSelector, VariableSelector, type VariableSelectorProps, autoRenameRefEffect, createBatchOutputsFormPlugin, createDisableDeclarationPlugin, createInferAssignPlugin, createInferInputsPlugin, createTypePresetPlugin, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, getTypeSelectValue, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, parseTypeSelectValue, provideBatchInputEffect, provideBatchOutputsEffect, provideJsonSchemaOutputs, syncVariableTitle, useTypeManager, useVariableTree, validateFlowValue, validateWhenVariableSync };
705
+ export { AssignRow, AssignRows, type AssignValueType, BatchOutputs, BatchVariableSelector, CodeEditor, CodeEditorMini, type CodeEditorPropsType, ConditionRow, type ConditionRowValueType, ConstantInput, type ConstantRendererProps, DisplayFlowValue, DisplayInputsValues, DisplayOutputs, DisplaySchemaTag, DisplaySchemaTree, DynamicValueInput, type IFlowConstantRefValue, type IFlowConstantValue, type IFlowExpressionValue, type IFlowRefValue, type IFlowTemplateValue, type IFlowValue, type IFlowValueExtra, InputsValues, JsonEditorWithVariables, JsonSchemaEditor, JsonSchemaTypePresetProvider, type JsonSchemaTypeRegistry, PromptEditor, type PromptEditorPropsType, PromptEditorWithInputs, PromptEditorWithVariables, TypeSelector, VariableSelector, type VariableSelectorProps, autoRenameRefEffect, createBatchOutputsFormPlugin, createDisableDeclarationPlugin, createInferAssignPlugin, createInferInputsPlugin, createTypePresetPlugin, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, getTypeSelectValue, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, listenRefSchemaChange, listenRefValueChange, parseTypeSelectValue, provideBatchInputEffect, provideBatchOutputsEffect, provideJsonSchemaOutputs, syncVariableTitle, useTypeManager, useVariableTree, validateFlowValue, validateWhenVariableSync };