constant.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /**
  2. * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
  3. * SPDX-License-Identifier: MIT
  4. */
  5. export const fieldWrapperTs = `import React from 'react';
  6. import './field-wrapper.css';
  7. interface FieldWrapperProps {
  8. required?: boolean;
  9. title?: string;
  10. children?: React.ReactNode;
  11. error?: string;
  12. note?: string;
  13. }
  14. export const FieldWrapper = ({ required, title, children, error, note }: FieldWrapperProps) => (
  15. <div className="field-wrapper">
  16. <div className="field-title">
  17. {title}
  18. {note ? <p className="field-note">{note}</p> : null}
  19. {required ? <span className="required">*</span> : null}
  20. </div>
  21. {children}
  22. <p className="error-message">{error}</p>
  23. {note ? <br /> : null}
  24. </div>
  25. );
  26. `;
  27. export const fieldWrapperCss = `.error-message {
  28. color: #f5222d !important;
  29. }
  30. .required {
  31. color: #f5222d !important;
  32. padding-left: 4px
  33. }
  34. .field-wrapper {
  35. width: 100%;
  36. margin-bottom: 12px;
  37. }
  38. .field-title {
  39. margin-bottom: 6px;
  40. }
  41. .field-note{
  42. color: #a3a0a0 !important;
  43. font-size: 12px;
  44. margin: 6px 0;
  45. }
  46. `;
  47. export const defaultInitialDataTs = `import { WorkflowJSON } from '@flowgram.ai/free-layout-editor';
  48. export const DEFAULT_INITIAL_DATA: WorkflowJSON = {
  49. nodes: [
  50. {
  51. id: 'node_0',
  52. type: 'custom',
  53. meta: {
  54. position: { x: 400, y: 0 },
  55. },
  56. },
  57. ],
  58. edges: [],
  59. };`;