disable-declaration-plugin.tsx 979 B

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
  3. * SPDX-License-Identifier: MIT
  4. */
  5. import React from 'react';
  6. import { Field } from '@flowgram.ai/free-layout-editor';
  7. import { createDisableDeclarationPlugin } from '@flowgram.ai/form-materials';
  8. import { FreeFormMetaStoryBuilder, FormHeader } from '../../free-form-meta-story-builder';
  9. const VariableSelector = React.lazy(() =>
  10. import('@flowgram.ai/form-materials').then((module) => ({
  11. default: module.VariableSelector,
  12. }))
  13. );
  14. export const BasicStory = () => (
  15. <FreeFormMetaStoryBuilder
  16. filterEndNode
  17. plugins={() => [createDisableDeclarationPlugin()]}
  18. formMeta={{
  19. render: () => (
  20. <>
  21. <FormHeader />
  22. <Field<string[] | undefined> name="variable_selector">
  23. {({ field }) => (
  24. <VariableSelector value={field.value} onChange={(value) => field.onChange(value)} />
  25. )}
  26. </Field>
  27. </>
  28. ),
  29. }}
  30. />
  31. );