@flowgram.ai/form-materials 0.3.1 → 0.3.2

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 (32) hide show
  1. package/bin/materials.ts +1 -0
  2. package/dist/esm/index.js +271 -11
  3. package/dist/esm/index.js.map +1 -1
  4. package/dist/index.d.mts +81 -5
  5. package/dist/index.d.ts +81 -5
  6. package/dist/index.js +304 -49
  7. package/dist/index.js.map +1 -1
  8. package/package.json +5 -5
  9. package/src/components/assign-row/components/blur-input.tsx +27 -0
  10. package/src/components/assign-row/config.json +11 -0
  11. package/src/components/assign-row/index.tsx +84 -0
  12. package/src/components/assign-row/types.ts +25 -0
  13. package/src/components/assign-rows/config.json +11 -0
  14. package/src/components/assign-rows/index.tsx +59 -0
  15. package/src/components/constant-input/config.json +1 -1
  16. package/src/components/display-outputs/index.tsx +7 -1
  17. package/src/components/display-schema-tree/config.json +1 -1
  18. package/src/components/index.ts +2 -0
  19. package/src/components/variable-selector/index.tsx +1 -1
  20. package/src/effects/index.ts +1 -0
  21. package/src/effects/validate-when-variable-sync/config.json +5 -0
  22. package/src/effects/validate-when-variable-sync/index.ts +35 -0
  23. package/src/form-plugins/index.ts +1 -0
  24. package/src/form-plugins/infer-assign-plugin/config.json +7 -0
  25. package/src/form-plugins/infer-assign-plugin/index.ts +90 -0
  26. package/src/index.ts +1 -0
  27. package/src/plugins/json-schema-preset/create-type-preset-plugin.tsx +1 -1
  28. package/src/plugins/json-schema-preset/type-definition/array.tsx +2 -1
  29. package/src/plugins/json-schema-preset/type-definition/object.tsx +2 -1
  30. package/src/validate/index.tsx +6 -0
  31. package/src/validate/validate-flow-value/config.json +7 -0
  32. package/src/validate/validate-flow-value/index.tsx +73 -0
package/dist/index.d.mts CHANGED
@@ -4,7 +4,7 @@ export { IJsonSchema, 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 } from '@flowgram.ai/editor';
7
+ import { BaseVariableField, EffectOptions, 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';
@@ -120,7 +120,7 @@ interface JsonSchemaTypeRegistry<Value = any> extends JsonSchemaTypeRegistry$1 {
120
120
  }
121
121
 
122
122
  declare const createTypePresetPlugin: _flowgram_ai_core.PluginCreator<{
123
- types?: JsonSchemaTypeRegistry[];
123
+ types?: Partial<JsonSchemaTypeRegistry> & Pick<JsonSchemaTypeRegistry, "type">[];
124
124
  unregisterTypes?: string[];
125
125
  }>;
126
126
 
@@ -440,6 +440,45 @@ interface PropsType {
440
440
  }
441
441
  declare function DisplayInputsValues({ value, showIconInTree }: PropsType): React$1.JSX.Element;
442
442
 
443
+ /**
444
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
445
+ * SPDX-License-Identifier: MIT
446
+ */
447
+
448
+ interface AssignRowsProps {
449
+ name: string;
450
+ readonly?: boolean;
451
+ }
452
+ declare function AssignRows(props: AssignRowsProps): React$1.JSX.Element;
453
+
454
+ /**
455
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
456
+ * SPDX-License-Identifier: MIT
457
+ */
458
+
459
+ type AssignValueType = {
460
+ operator: 'assign';
461
+ left?: IFlowRefValue;
462
+ right?: IFlowValue;
463
+ } | {
464
+ operator: 'declare';
465
+ left?: string;
466
+ right?: IFlowValue;
467
+ };
468
+ interface AssignRowProps {
469
+ value?: AssignValueType;
470
+ onChange?: (value?: AssignValueType) => void;
471
+ onDelete?: () => void;
472
+ readonly?: boolean;
473
+ }
474
+
475
+ /**
476
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
477
+ * SPDX-License-Identifier: MIT
478
+ */
479
+
480
+ declare function AssignRow(props: AssignRowProps): React$1.JSX.Element;
481
+
443
482
  /**
444
483
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
445
484
  * SPDX-License-Identifier: MIT
@@ -479,6 +518,15 @@ declare const provideJsonSchemaOutputs: EffectOptions[];
479
518
 
480
519
  declare const syncVariableTitle: EffectOptions[];
481
520
 
521
+ /**
522
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
523
+ * SPDX-License-Identifier: MIT
524
+ */
525
+
526
+ declare const validateWhenVariableSync: ({ scope, }?: {
527
+ scope?: "private" | "public";
528
+ }) => EffectOptions[];
529
+
482
530
  /**
483
531
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
484
532
  * SPDX-License-Identifier: MIT
@@ -580,11 +628,39 @@ declare const createBatchOutputsFormPlugin: FormPluginCreator<{
580
628
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
581
629
  * SPDX-License-Identifier: MIT
582
630
  */
583
- interface InputConfig {
631
+ interface InputConfig$1 {
584
632
  sourceKey: string;
585
633
  targetKey: string;
586
634
  scope?: 'private' | 'public';
587
635
  }
588
- declare const createInferInputsPlugin: _flowgram_ai_node.FormPluginCreator<InputConfig>;
636
+ declare const createInferInputsPlugin: _flowgram_ai_node.FormPluginCreator<InputConfig$1>;
637
+
638
+ /**
639
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
640
+ * SPDX-License-Identifier: MIT
641
+ */
642
+ interface InputConfig {
643
+ assignKey: string;
644
+ outputKey: string;
645
+ }
646
+ declare const createInferAssignPlugin: _flowgram_ai_node.FormPluginCreator<InputConfig>;
647
+
648
+ /**
649
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
650
+ * SPDX-License-Identifier: MIT
651
+ */
652
+
653
+ interface Context {
654
+ node: FlowNodeEntity;
655
+ required?: boolean;
656
+ errorMessages?: {
657
+ required?: string;
658
+ unknownVariable?: string;
659
+ };
660
+ }
661
+ declare function validateFlowValue(value: IFlowValue | undefined, ctx: Context): {
662
+ level: FeedbackLevel;
663
+ message: string;
664
+ } | undefined;
589
665
 
590
- export { 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, createInferInputsPlugin, createTypePresetPlugin, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, getTypeSelectValue, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, parseTypeSelectValue, provideBatchInputEffect, provideBatchOutputsEffect, provideJsonSchemaOutputs, syncVariableTitle, useTypeManager, useVariableTree };
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 };
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export { IJsonSchema, 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 } from '@flowgram.ai/editor';
7
+ import { BaseVariableField, EffectOptions, 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';
@@ -120,7 +120,7 @@ interface JsonSchemaTypeRegistry<Value = any> extends JsonSchemaTypeRegistry$1 {
120
120
  }
121
121
 
122
122
  declare const createTypePresetPlugin: _flowgram_ai_core.PluginCreator<{
123
- types?: JsonSchemaTypeRegistry[];
123
+ types?: Partial<JsonSchemaTypeRegistry> & Pick<JsonSchemaTypeRegistry, "type">[];
124
124
  unregisterTypes?: string[];
125
125
  }>;
126
126
 
@@ -440,6 +440,45 @@ interface PropsType {
440
440
  }
441
441
  declare function DisplayInputsValues({ value, showIconInTree }: PropsType): React$1.JSX.Element;
442
442
 
443
+ /**
444
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
445
+ * SPDX-License-Identifier: MIT
446
+ */
447
+
448
+ interface AssignRowsProps {
449
+ name: string;
450
+ readonly?: boolean;
451
+ }
452
+ declare function AssignRows(props: AssignRowsProps): React$1.JSX.Element;
453
+
454
+ /**
455
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
456
+ * SPDX-License-Identifier: MIT
457
+ */
458
+
459
+ type AssignValueType = {
460
+ operator: 'assign';
461
+ left?: IFlowRefValue;
462
+ right?: IFlowValue;
463
+ } | {
464
+ operator: 'declare';
465
+ left?: string;
466
+ right?: IFlowValue;
467
+ };
468
+ interface AssignRowProps {
469
+ value?: AssignValueType;
470
+ onChange?: (value?: AssignValueType) => void;
471
+ onDelete?: () => void;
472
+ readonly?: boolean;
473
+ }
474
+
475
+ /**
476
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
477
+ * SPDX-License-Identifier: MIT
478
+ */
479
+
480
+ declare function AssignRow(props: AssignRowProps): React$1.JSX.Element;
481
+
443
482
  /**
444
483
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
445
484
  * SPDX-License-Identifier: MIT
@@ -479,6 +518,15 @@ declare const provideJsonSchemaOutputs: EffectOptions[];
479
518
 
480
519
  declare const syncVariableTitle: EffectOptions[];
481
520
 
521
+ /**
522
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
523
+ * SPDX-License-Identifier: MIT
524
+ */
525
+
526
+ declare const validateWhenVariableSync: ({ scope, }?: {
527
+ scope?: "private" | "public";
528
+ }) => EffectOptions[];
529
+
482
530
  /**
483
531
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
484
532
  * SPDX-License-Identifier: MIT
@@ -580,11 +628,39 @@ declare const createBatchOutputsFormPlugin: FormPluginCreator<{
580
628
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
581
629
  * SPDX-License-Identifier: MIT
582
630
  */
583
- interface InputConfig {
631
+ interface InputConfig$1 {
584
632
  sourceKey: string;
585
633
  targetKey: string;
586
634
  scope?: 'private' | 'public';
587
635
  }
588
- declare const createInferInputsPlugin: _flowgram_ai_node.FormPluginCreator<InputConfig>;
636
+ declare const createInferInputsPlugin: _flowgram_ai_node.FormPluginCreator<InputConfig$1>;
637
+
638
+ /**
639
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
640
+ * SPDX-License-Identifier: MIT
641
+ */
642
+ interface InputConfig {
643
+ assignKey: string;
644
+ outputKey: string;
645
+ }
646
+ declare const createInferAssignPlugin: _flowgram_ai_node.FormPluginCreator<InputConfig>;
647
+
648
+ /**
649
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
650
+ * SPDX-License-Identifier: MIT
651
+ */
652
+
653
+ interface Context {
654
+ node: FlowNodeEntity;
655
+ required?: boolean;
656
+ errorMessages?: {
657
+ required?: string;
658
+ unknownVariable?: string;
659
+ };
660
+ }
661
+ declare function validateFlowValue(value: IFlowValue | undefined, ctx: Context): {
662
+ level: FeedbackLevel;
663
+ message: string;
664
+ } | undefined;
589
665
 
590
- export { 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, createInferInputsPlugin, createTypePresetPlugin, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, getTypeSelectValue, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, parseTypeSelectValue, provideBatchInputEffect, provideBatchOutputsEffect, provideJsonSchemaOutputs, syncVariableTitle, useTypeManager, useVariableTree };
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 };