DictEditInner.tsx 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. import { useIntl } from "react-intl";
  2. import {
  3. ProForm,
  4. ProFormText,
  5. ProFormTextArea,
  6. } from "@ant-design/pro-components";
  7. import LangSelect from "../general/LangSelect";
  8. import SelectCase from "./SelectCase";
  9. import Confidence from "./Confidence";
  10. type IWidgetDictCreate = {
  11. word?: string;
  12. };
  13. const DictEditInnerWidget = (prop: IWidgetDictCreate) => {
  14. const intl = useIntl();
  15. /*
  16. const onLangChange = (value: string) => {
  17. console.log(`selected ${value}`);
  18. };
  19. const onLangSearch = (value: string) => {
  20. console.log("search:", value);
  21. };
  22. */
  23. return (
  24. <>
  25. <ProForm.Group>
  26. <ProFormText
  27. width="md"
  28. name="word"
  29. initialValue={prop.word}
  30. required
  31. label={intl.formatMessage({ id: "dict.fields.word.label" })}
  32. rules={[
  33. {
  34. required: true,
  35. message: intl.formatMessage({
  36. id: "channel.create.message.noname",
  37. }),
  38. },
  39. ]}
  40. />
  41. </ProForm.Group>
  42. <ProForm.Group>
  43. <div>语法信息</div>
  44. <SelectCase />
  45. </ProForm.Group>
  46. <ProForm.Group>
  47. <ProFormText
  48. width="md"
  49. name="type"
  50. label={intl.formatMessage({
  51. id: "dict.fields.type.label",
  52. })}
  53. />
  54. <ProFormText
  55. width="md"
  56. name="grammar"
  57. label={intl.formatMessage({
  58. id: "dict.fields.grammar.label",
  59. })}
  60. />
  61. </ProForm.Group>
  62. <ProForm.Group>
  63. <ProFormText
  64. width="md"
  65. name="parent"
  66. label={intl.formatMessage({
  67. id: "dict.fields.parent.label",
  68. })}
  69. />
  70. </ProForm.Group>
  71. <ProForm.Group>
  72. <LangSelect />
  73. </ProForm.Group>
  74. <ProForm.Group>
  75. <ProFormText
  76. width="md"
  77. name="meaning"
  78. label={intl.formatMessage({
  79. id: "dict.fields.meaning.label",
  80. })}
  81. />
  82. </ProForm.Group>
  83. <ProForm.Group>
  84. <ProFormText
  85. width="md"
  86. name="factors"
  87. label={intl.formatMessage({
  88. id: "dict.fields.factors.label",
  89. })}
  90. />
  91. </ProForm.Group>
  92. <ProForm.Group>
  93. <ProFormText
  94. width="md"
  95. name="factormeaning"
  96. label={intl.formatMessage({
  97. id: "dict.fields.factormeaning.label",
  98. })}
  99. />
  100. </ProForm.Group>
  101. <ProForm.Group>
  102. <ProFormTextArea
  103. name="note"
  104. label={intl.formatMessage({
  105. id: "forms.fields.note.label",
  106. })}
  107. />
  108. </ProForm.Group>
  109. <ProForm.Group>
  110. <Confidence />
  111. </ProForm.Group>
  112. </>
  113. );
  114. };
  115. export default DictEditInnerWidget;