@zjlab-fe/data-hub-ui 0.32.5 → 0.33.0

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 (77) hide show
  1. package/COMPONENTS_SKILL.md +1847 -63
  2. package/dist/types/components/FileUploader/UploadStoreProvider/UploadStoreProvider.d.ts +4 -1
  3. package/dist/types/components/SDK-modal/document-link.d.ts +1 -3
  4. package/dist/types/components/SDK-modal/index.d.ts +4 -0
  5. package/dist/types/components/SDK-modal/inner-modal.d.ts +9 -0
  6. package/dist/types/components/SDK-modal/types.d.ts +4 -3
  7. package/dist/types/components/apply-perm-modal/index.d.ts +14 -5
  8. package/dist/types/components/confirm-again/index.d.ts +8 -1
  9. package/dist/types/components/copy/index.d.ts +9 -4
  10. package/dist/types/components/limit-credit-modal/index.d.ts +9 -3
  11. package/dist/types/components/status-tag/index.d.ts +4 -4
  12. package/dist/types/components/tag-group-filter/dataSizeFilter.d.ts +0 -1
  13. package/dist/types/components/tag-group-filter/index.d.ts +4 -1
  14. package/dist/types/index.d.ts +7 -5
  15. package/dist/types/locale/index.d.ts +18 -0
  16. package/dist/types/locale/modalHolder.d.ts +11 -0
  17. package/dist/types/locale/resolveLocale.d.ts +9 -0
  18. package/dist/types/locale/translations.d.ts +808 -0
  19. package/dist/types/locale/types.d.ts +32 -0
  20. package/es/components/FileUploader/Locale/useTranslate.js +34 -11
  21. package/es/components/FileUploader/UploadStoreProvider/UploadStoreProvider.js +5 -3
  22. package/es/components/FileUploader/hooks/useOnMountedResumeUnfinished.js +6 -3
  23. package/es/components/SDK-modal/document-link.js +5 -2
  24. package/es/components/SDK-modal/index.js +29 -2
  25. package/es/components/SDK-modal/inner-modal.js +23 -12
  26. package/es/components/apply-perm-modal/index.js +20 -8
  27. package/es/components/confirm-again/index.js +12 -2
  28. package/es/components/copy/index.js +21 -7
  29. package/es/components/data-table/index.js +15 -4
  30. package/es/components/dataset-batch-action/index.js +48 -25
  31. package/es/components/file-preview/data-table/index.js +4 -3
  32. package/es/components/file-preview/index.js +5 -4
  33. package/es/components/file-uploader/components/uploader-drop-zone.js +4 -2
  34. package/es/components/file-uploader/components/uploader-file-item.js +12 -9
  35. package/es/components/file-uploader/components/uploader-file-list.js +6 -3
  36. package/es/components/file-uploader/components/uploader.js +4 -2
  37. package/es/components/file-uploader/components/uploading-status.js +18 -12
  38. package/es/components/header/index.js +3 -1
  39. package/es/components/input-tag/index.js +5 -2
  40. package/es/components/limit-credit-modal/index.js +38 -19
  41. package/es/components/menu/index.js +5 -2
  42. package/es/components/notion-editor/code-block/languages.js +1 -1
  43. package/es/components/notion-editor/index.js +23 -13
  44. package/es/components/operator-chain/components/AddButton.js +3 -1
  45. package/es/components/operator-chain/components/IOCard.js +4 -1
  46. package/es/components/operator-chain/components/VirtualDropdown.js +6 -3
  47. package/es/components/permission-editor/index.js +1 -0
  48. package/es/components/permission-editor/permissionEditModal/index.js +7 -4
  49. package/es/components/permission-editor/permissionEditor/index.js +40 -75
  50. package/es/components/permission-editor/permissionViewPopover/index.js +5 -2
  51. package/es/components/status-tag/index.js +59 -9
  52. package/es/components/status-tag/index.module.scss.js +24 -8
  53. package/es/components/tag-group-filter/dataSizeFilter.js +6 -3
  54. package/es/components/tag-group-filter/index.js +2 -2
  55. package/es/components/tip-tap/bubble-menu.js +8 -3
  56. package/es/components/tip-tap/editor.js +5 -2
  57. package/es/components/tip-tap/extensions/index.js +1 -1
  58. package/es/components/tip-tap/toolbar/components/color-picker.js +3 -1
  59. package/es/components/tip-tap/toolbar/components/heading-dropdown.js +8 -5
  60. package/es/components/tip-tap/toolbar/components/link-button.js +4 -1
  61. package/es/components/tip-tap/toolbar/components/table-button.js +5 -2
  62. package/es/components/tip-tap/toolbar/index.js +4 -1
  63. package/es/components/uploadDrawer/fileUploadDrawer.js +6 -2
  64. package/es/components/uploadDrawer/fileUploadDrawerList.js +4 -1
  65. package/es/components/uploadDrawer/fileUploadDrawerListProgressButton.js +4 -2
  66. package/es/components/uploadDrawer/hooks/useCancelUpload.js +3 -1
  67. package/es/components/uploadDrawer/hooks/useFilterFiles.js +7 -4
  68. package/es/components/uploadDrawer/hooks/useFormatFiles.js +3 -1
  69. package/es/components/uploadDrawer/hooks/useResumeUnfinishedUploads.js +7 -6
  70. package/es/components/uploadDrawer/index.js +4 -2
  71. package/es/index.js +6 -5
  72. package/es/locale/index.js +64 -0
  73. package/es/locale/modalHolder.js +21 -0
  74. package/es/locale/resolveLocale.js +73 -0
  75. package/es/locale/translations.js +273 -0
  76. package/lib/index.js +1 -1
  77. package/package.json +7 -3
@@ -3,8 +3,11 @@ import { jsx } from 'react/jsx-runtime';
3
3
  import { useState, useEffect } from 'react';
4
4
  import { Modal, Button, message } from 'antd';
5
5
  import PermissionEditor from '../permissionEditor/index.js';
6
+ import { useLocale } from '../../../locale/index.js';
6
7
 
7
8
  const PermissionEditModal = ({ open, onCancel, onSave, initialPermissions = [], }) => {
9
+ const { locale } = useLocale();
10
+ const texts = locale.PermissionEditor;
8
11
  const [selectedPermissions, setSelectedPermissions] = useState(initialPermissions);
9
12
  const [loading, setLoading] = useState(false);
10
13
  // 当 modal 打开时重置权限状态
@@ -19,7 +22,7 @@ const PermissionEditModal = ({ open, onCancel, onSave, initialPermissions = [],
19
22
  onCancel();
20
23
  }
21
24
  catch (error) {
22
- message.error('权限更新失败');
25
+ message.error(texts.updateFailed);
23
26
  console.error('保存权限失败:', error);
24
27
  }
25
28
  });
@@ -28,9 +31,9 @@ const PermissionEditModal = ({ open, onCancel, onSave, initialPermissions = [],
28
31
  setSelectedPermissions(initialPermissions);
29
32
  onCancel();
30
33
  };
31
- return (jsx(Modal, { title: `编辑权限`, open: open, onCancel: handleCancel, width: 600, destroyOnClose: true, footer: [
32
- jsx(Button, { onClick: handleCancel, children: "\u53D6\u6D88" }, "cancel"),
33
- jsx(Button, { type: "primary", loading: loading, onClick: handleSave, children: "\u4FDD\u5B58" }, "save"),
34
+ return (jsx(Modal, { title: texts.title, open: open, onCancel: handleCancel, width: 600, destroyOnClose: true, footer: [
35
+ jsx(Button, { onClick: handleCancel, children: texts.cancel }, "cancel"),
36
+ jsx(Button, { type: "primary", loading: loading, onClick: handleSave, children: texts.save }, "save"),
34
37
  ], children: jsx("div", { style: { padding: '16px 0' }, children: jsx(PermissionEditor, { initialPermissions: selectedPermissions, onChange: setSelectedPermissions, editable: true }) }) }));
35
38
  };
36
39
 
@@ -3,103 +3,67 @@ import React from 'react';
3
3
  import { Tag, Flex } from 'antd';
4
4
  import { unEditable, tagReadonly } from './index.module.scss.js';
5
5
  import { CheckCircleOutlined } from '@ant-design/icons';
6
+ import { useLocale } from '../../../locale/index.js';
6
7
 
7
8
  const permissionTags = [
8
9
  {
9
- label: '数据权限',
10
10
  value: 'agentic',
11
11
  readOnly: false,
12
- children: [
13
- {
14
- label: '检索智能体',
15
- value: '13',
16
- readOnly: false,
17
- },
18
- ],
12
+ children: [{ value: '13', readOnly: false }],
19
13
  },
20
14
  {
21
- label: '工作台权限',
22
15
  value: 'workbench',
23
16
  readOnly: false,
24
17
  children: [
25
- {
26
- label: '语料生产服务',
27
- value: '20',
28
- readOnly: false,
29
- },
30
- {
31
- label: '语料质量评估',
32
- value: '18',
33
- readOnly: false,
34
- },
35
- {
36
- label: '可视化工作流',
37
- value: '1',
38
- readOnly: false,
39
- },
40
- {
41
- label: '文档标注',
42
- value: '8',
43
- readOnly: false,
44
- },
45
- {
46
- label: '模型训练',
47
- value: '19',
48
- readOnly: false,
49
- },
50
- {
51
- label: '计量中心',
52
- value: '23',
53
- readOnly: false,
54
- },
55
- {
56
- label: '模型部署',
57
- value: '21',
58
- readOnly: true,
59
- },
60
- {
61
- label: '模型管理',
62
- value: '22',
63
- readOnly: true,
64
- },
18
+ { value: '20', readOnly: false },
19
+ { value: '18', readOnly: false },
20
+ { value: '1', readOnly: false },
21
+ { value: '8', readOnly: false },
22
+ { value: '19', readOnly: false },
23
+ { value: '23', readOnly: false },
24
+ { value: '21', readOnly: true },
25
+ { value: '22', readOnly: true },
65
26
  ],
66
27
  },
67
28
  {
68
- label: '语料检索权限',
69
29
  value: 'corpus_index',
70
30
  readOnly: false,
71
31
  children: [
72
- {
73
- label: '文献语料检索',
74
- value: '14',
75
- readOnly: false,
76
- },
77
- {
78
- label: '网页语料筛选',
79
- value: '15',
80
- readOnly: false,
81
- },
32
+ { value: '14', readOnly: false },
33
+ { value: '15', readOnly: false },
82
34
  ],
83
35
  },
84
36
  {
85
- label: '语料生产权限',
86
37
  value: 'corpus_product',
87
38
  readOnly: false,
88
39
  children: [
89
- {
90
- label: '文档语料生产',
91
- value: '16',
92
- readOnly: false,
93
- },
94
- {
95
- label: '网页语料生产',
96
- value: '17',
97
- readOnly: false,
98
- },
40
+ { value: '16', readOnly: false },
41
+ { value: '17', readOnly: false },
99
42
  ],
100
43
  },
101
44
  ];
45
+ const PERMISSION_LABEL_KEY = {
46
+ agentic: 'agentic',
47
+ '13': 'agenticSearch',
48
+ workbench: 'workbench',
49
+ '20': 'corpusProductionService',
50
+ '18': 'corpusQuality',
51
+ '1': 'visualWorkflow',
52
+ '8': 'documentAnnotation',
53
+ '19': 'modelTraining',
54
+ '23': 'meteringCenter',
55
+ '21': 'modelDeploy',
56
+ '22': 'modelManage',
57
+ corpus_index: 'corpusIndex',
58
+ '14': 'literatureSearch',
59
+ '15': 'webFilter',
60
+ corpus_product: 'corpusProduct',
61
+ '16': 'documentProduction',
62
+ '17': 'webProduction',
63
+ };
102
64
  const PermissionEditor = ({ initialPermissions = [], onChange, editable = true, }) => {
65
+ const { locale } = useLocale();
66
+ const texts = locale.PermissionEditor;
103
67
  // 将新格式转换为内部使用的扁平化格式
104
68
  const convertToFlatFormat = (permissions) => {
105
69
  const flatTags = [];
@@ -225,9 +189,9 @@ const PermissionEditor = ({ initialPermissions = [], onChange, editable = true,
225
189
  onChange === null || onChange === void 0 ? void 0 : onChange(modulePermissions);
226
190
  };
227
191
  return (jsx(Fragment, { children: permissionTags.map((tag) => {
228
- var _a;
192
+ var _a, _b;
229
193
  const isSelected = selectedTags.includes(tag.value);
230
- return (jsxs("div", { style: { width: '100%', margin: '8px 0' }, className: !editable ? unEditable : '', children: [jsx("span", { style: { fontSize: '16px', fontWeight: 500, marginRight: 8 }, children: tag.label }), editable && (jsx(Tag.CheckableTag, { checked: isSelected, onChange: (checked) => handleChange(tag.value, checked, tag.readOnly), style: {
194
+ return (jsxs("div", { style: { width: '100%', margin: '8px 0' }, className: !editable ? unEditable : '', children: [jsx("span", { style: { fontSize: '16px', fontWeight: 500, marginRight: 8 }, children: (_a = texts[PERMISSION_LABEL_KEY[tag.value]]) !== null && _a !== void 0 ? _a : tag.value }), editable && (jsx(Tag.CheckableTag, { checked: isSelected, onChange: (checked) => handleChange(tag.value, checked, tag.readOnly), style: {
231
195
  cursor: tag.readOnly ? 'not-allowed' : 'pointer',
232
196
  opacity: tag.readOnly ? 0.7 : 1,
233
197
  margin: '5px 0',
@@ -238,14 +202,15 @@ const PermissionEditor = ({ initialPermissions = [], onChange, editable = true,
238
202
  width: 18,
239
203
  border: 0,
240
204
  borderRadius: '50%',
241
- }, className: tag.readOnly ? tagReadonly : '', children: jsx(CheckCircleOutlined, { style: { fontSize: '18px' }, title: isSelected ? '取消全选' : '全选' }) }, tag.value)), jsx(Flex, { gap: 5, wrap: true, align: "center", children: (_a = tag.children) === null || _a === void 0 ? void 0 : _a.map((child) => {
205
+ }, className: tag.readOnly ? tagReadonly : '', children: jsx(CheckCircleOutlined, { style: { fontSize: '18px' }, title: isSelected ? texts.unselectAll : texts.selectAll }) }, tag.value)), jsx(Flex, { gap: 5, wrap: true, align: "center", children: (_b = tag.children) === null || _b === void 0 ? void 0 : _b.map((child) => {
206
+ var _a;
242
207
  const isChildSelected = selectedTags.includes(child.value);
243
208
  return (jsx(Tag.CheckableTag, { checked: isChildSelected, onChange: (checked) => handleChange(child.value, checked, child.readOnly), style: {
244
209
  cursor: child.readOnly ? 'not-allowed' : 'pointer',
245
210
  opacity: child.readOnly ? 0.7 : 1,
246
211
  margin: '5px 0',
247
212
  border: '1px solid #979797',
248
- }, className: child.readOnly ? tagReadonly : '', children: child.label }, child.value));
213
+ }, className: child.readOnly ? tagReadonly : '', children: (_a = texts[PERMISSION_LABEL_KEY[child.value]]) !== null && _a !== void 0 ? _a : child.value }, child.value));
249
214
  }) })] }, tag.value));
250
215
  }) }));
251
216
  };
@@ -1,9 +1,12 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { Popover } from 'antd';
3
3
  import PermissionEditor from '../permissionEditor/index.js';
4
+ import { useLocale } from '../../../locale/index.js';
4
5
 
5
- const PermissionViewPopover = ({ initialPermissions = [], children, title = '用户权限', width = 400, }) => {
6
- return (jsx(Popover, { content: jsx(PermissionEditor, { initialPermissions: initialPermissions, editable: false }), title: title, overlayStyle: { width }, children: children }));
6
+ const PermissionViewPopover = ({ initialPermissions = [], children, title, width = 400, }) => {
7
+ const { locale } = useLocale();
8
+ const resolvedTitle = title !== null && title !== void 0 ? title : locale.PermissionEditor.viewTitle;
9
+ return (jsx(Popover, { content: jsx(PermissionEditor, { initialPermissions: initialPermissions, editable: false }), title: resolvedTitle, overlayStyle: { width }, children: children }));
7
10
  };
8
11
 
9
12
  export { PermissionViewPopover as default };
@@ -2,36 +2,86 @@ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { Tag } from 'antd';
3
3
  import classNames from 'classnames';
4
4
  import * as index_module from './index.module.scss.js';
5
- import { statusDot, statusTag, dot } from './index.module.scss.js';
5
+ import { statusDot, statusTag } from './index.module.scss.js';
6
6
 
7
+ const stoppedFilled = { color: '#545b64', backgroundColor: '#edf2fc' };
8
+ const stoppedDot = { color: 'rgba(0, 0, 0, 0.65)', dotColor: '#d9d9d9' };
9
+ const stoppedBordered = {
10
+ color: 'rgba(0, 0, 0, 0.25)',
11
+ backgroundColor: '#f5f5f5',
12
+ borderColor: '#d9d9d9',
13
+ };
14
+ const waitingDotFilled = {
15
+ color: '#545b64',
16
+ backgroundColor: 'rgba(217, 217, 217, 0.2)',
17
+ borderColor: 'rgba(217, 217, 217, 0.6)',
18
+ dotColor: '#d9d9d9',
19
+ };
7
20
  const statusStyles = {
8
21
  filled: {
9
22
  running: { color: '#1775fe', backgroundColor: 'rgba(23, 117, 254, 0.1)' },
10
23
  failed: { color: '#ff4d4f', backgroundColor: 'rgba(255, 77, 79, 0.1)' },
11
24
  success: { color: '#52c41a', backgroundColor: 'rgba(82, 196, 26, 0.1)' },
12
- stopped: { color: '#545b64', backgroundColor: '#edf2fc' },
13
- pending: { color: '#fa8c16', backgroundColor: 'rgba(250, 140, 22, 0.1)' },
25
+ stopped: stoppedFilled,
26
+ warning: { color: '#fa8c16', backgroundColor: '#fff7e6' },
27
+ waiting: stoppedFilled,
14
28
  },
15
29
  dot: {
16
30
  running: { color: '#1775fe', dotColor: '#1775fe' },
17
31
  failed: { color: '#ff4d4f', dotColor: '#ff4d4f' },
18
32
  success: { color: '#52c41a', dotColor: '#52c41a' },
19
- stopped: { color: 'rgba(0, 0, 0, 0.65)', dotColor: '#d9d9d9' },
20
- pending: { color: '#fa8c16', dotColor: '#fa8c16' },
33
+ stopped: stoppedDot,
34
+ warning: { color: '#fa8c16', dotColor: '#fa8c16' },
35
+ waiting: stoppedDot,
21
36
  },
22
37
  bordered: {
23
38
  running: { color: '#1775fe', backgroundColor: '#ecf4ff', borderColor: '#b3d2ff' },
24
39
  failed: { color: '#f5222d', backgroundColor: '#fff1f0', borderColor: '#ffa39e' },
25
40
  success: { color: '#52c41a', backgroundColor: '#f6ffed', borderColor: '#b7eb8f' },
26
- stopped: { color: 'rgba(0, 0, 0, 0.25)', backgroundColor: '#f5f5f5', borderColor: '#d9d9d9' },
27
- pending: { color: '#fa8c16', backgroundColor: '#fff7e6', borderColor: '#fa8c16' },
41
+ stopped: stoppedBordered,
42
+ warning: { color: '#fa8c16', backgroundColor: '#fff7e6', borderColor: '#fa8c16' },
43
+ waiting: stoppedBordered,
44
+ },
45
+ dotFilled: {
46
+ running: {
47
+ color: '#545b64',
48
+ backgroundColor: 'rgba(23, 117, 254, 0.1)',
49
+ borderColor: 'rgba(23, 117, 254, 0.1)',
50
+ dotColor: '#1775fe',
51
+ },
52
+ failed: {
53
+ color: '#545b64',
54
+ backgroundColor: 'rgba(255, 77, 79, 0.1)',
55
+ borderColor: 'rgba(255, 77, 79, 0.1)',
56
+ dotColor: '#ff4d4f',
57
+ },
58
+ success: {
59
+ color: '#545b64',
60
+ backgroundColor: 'rgba(82, 196, 26, 0.1)',
61
+ borderColor: 'rgba(82, 196, 26, 0.1)',
62
+ dotColor: '#52c41a',
63
+ },
64
+ stopped: waitingDotFilled,
65
+ warning: {
66
+ color: '#545b64',
67
+ backgroundColor: '#fff7e6',
68
+ borderColor: 'rgba(250, 140, 22, 0.1)',
69
+ dotColor: '#fa8c16',
70
+ },
71
+ waiting: waitingDotFilled,
28
72
  },
29
73
  };
30
74
  function StatusTag(props) {
31
75
  const { type = 'running', variant = 'filled', className, children } = props;
32
76
  const preset = statusStyles[variant][type];
33
- if (variant === 'dot') {
34
- return (jsxs("span", { className: classNames(statusTag, dot, className), children: [jsx("span", { className: statusDot, style: { backgroundColor: preset.dotColor } }), jsx("span", { style: { color: preset.color }, children: children })] }));
77
+ const hasStatusDot = variant === 'dot' || variant === 'dotFilled';
78
+ if (hasStatusDot) {
79
+ return (jsxs("span", { className: classNames(statusTag, index_module[variant], className), style: variant === 'dotFilled'
80
+ ? {
81
+ backgroundColor: preset.backgroundColor,
82
+ borderColor: preset.borderColor,
83
+ }
84
+ : undefined, children: [jsx("span", { className: statusDot, style: { backgroundColor: preset.dotColor } }), jsx("span", { style: { color: preset.color }, children: children })] }));
35
85
  }
36
86
  return (jsx(Tag, { bordered: variant === 'bordered', className: classNames(statusTag, index_module[variant], className), style: {
37
87
  color: preset.color,
@@ -1,19 +1,25 @@
1
1
  var style = document.createElement('style');
2
- style.textContent = `.index-module__statusTag___yRGEa {
2
+ style.textContent = `@font-face {
3
+ font-family: "AlibabaPuHuiTi-3-55-RegularL3";
4
+ src: url("https://haina-datahub.zero2x.org/ossRoute/frontend/resources/fonts/alibaba_puhuiti_3/AlibabaPuHuiTi-3-55-RegularL3.ttf") format("truetype");
5
+ }
6
+ @font-face {
7
+ font-family: "AlibabaPuHuiTi-3-65-Medium";
8
+ src: url("https://haina-datahub.zero2x.org/ossRoute/frontend/resources/fonts/alibaba_puhuiti_3/AlibabaPuHuiTi-3-65-Medium.ttf") format("truetype");
9
+ }
10
+ .index-module__statusTag___yRGEa {
3
11
  display: inline-flex;
4
12
  align-items: center;
5
13
  margin-inline-end: 0;
6
14
  font-family: "AlibabaPuHuiTi-3-55-RegularL3", "PingFang SC", sans-serif;
7
15
  white-space: nowrap;
8
16
  }
9
-
10
17
  .index-module__filled___SKjTo {
11
18
  border-radius: 4px;
12
19
  padding: 1px 8px;
13
20
  font-size: 12px;
14
21
  line-height: 16px;
15
22
  }
16
-
17
23
  .index-module__bordered___x7xGX {
18
24
  border-radius: 2px;
19
25
  padding: 0 8px;
@@ -22,7 +28,6 @@ style.textContent = `.index-module__statusTag___yRGEa {
22
28
  border-width: 1px;
23
29
  border-style: solid;
24
30
  }
25
-
26
31
  .index-module__dot___rbWrB {
27
32
  gap: 8px;
28
33
  font-size: 14px;
@@ -30,7 +35,18 @@ style.textContent = `.index-module__statusTag___yRGEa {
30
35
  padding: 0;
31
36
  background: transparent;
32
37
  }
33
-
38
+ .index-module__dotFilled___UU7nq {
39
+ box-sizing: border-box;
40
+ gap: 8px;
41
+ height: 30px;
42
+ padding: 4px 16px;
43
+ border: 1px solid;
44
+ border-radius: 4px;
45
+ font-family: "AlibabaPuHuiTi-3-65-Medium", "PingFang SC", sans-serif;
46
+ font-size: 16px;
47
+ font-weight: 500;
48
+ line-height: 22px;
49
+ }
34
50
  .index-module__statusDot___yMpG3 {
35
51
  flex-shrink: 0;
36
52
  width: 6px;
@@ -39,7 +55,7 @@ style.textContent = `.index-module__statusTag___yRGEa {
39
55
  }`;
40
56
  document.head.appendChild(style);
41
57
 
42
- var statusTag = "index-module__statusTag___yRGEa";var filled = "index-module__filled___SKjTo";var bordered = "index-module__bordered___x7xGX";var dot = "index-module__dot___rbWrB";var statusDot = "index-module__statusDot___yMpG3";
43
- var styles = {"statusTag":"index-module__statusTag___yRGEa","filled":"index-module__filled___SKjTo","bordered":"index-module__bordered___x7xGX","dot":"index-module__dot___rbWrB","statusDot":"index-module__statusDot___yMpG3"};
58
+ var statusTag = "index-module__statusTag___yRGEa";var filled = "index-module__filled___SKjTo";var bordered = "index-module__bordered___x7xGX";var dot = "index-module__dot___rbWrB";var dotFilled = "index-module__dotFilled___UU7nq";var statusDot = "index-module__statusDot___yMpG3";
59
+ var styles = {"statusTag":"index-module__statusTag___yRGEa","filled":"index-module__filled___SKjTo","bordered":"index-module__bordered___x7xGX","dot":"index-module__dot___rbWrB","dotFilled":"index-module__dotFilled___UU7nq","statusDot":"index-module__statusDot___yMpG3"};
44
60
 
45
- export { bordered, styles as default, dot, filled, statusDot, statusTag };
61
+ export { bordered, styles as default, dot, dotFilled, filled, statusDot, statusTag };
@@ -4,6 +4,7 @@ import { Select, Flex, InputNumber } from 'antd';
4
4
  import { dataSizeFilter, iconTagHeader, iconTagContent, header, iconClear } from './index.module.scss.js';
5
5
  import { MinusOutlined } from '@ant-design/icons';
6
6
  import iconTagHeader$1 from '../../assets/icon-tag-header.png.js';
7
+ import { useLocale } from '../../locale/index.js';
7
8
 
8
9
  const { Option } = Select;
9
10
  const DATA_SIZE_UNIT = [
@@ -25,6 +26,8 @@ const transToMB = (value, unit) => {
25
26
  }
26
27
  };
27
28
  function DataSizeFilter(p) {
29
+ const { locale } = useLocale();
30
+ const texts = locale.TagGroupFilter;
28
31
  const [startValue, setStartValue] = React.useState(null);
29
32
  const [startUnit, setStartUnit] = React.useState('kb');
30
33
  const [endValue, setEndValue] = React.useState(null);
@@ -36,10 +39,10 @@ function DataSizeFilter(p) {
36
39
  if (startValue !== null &&
37
40
  endValue !== null &&
38
41
  transToMB(startValue, startUnit) > transToMB(endValue, endUnit)) {
39
- res = p.isEn ? 'The left value can not greater than the right value' : '左侧数值不能大于右侧数值';
42
+ res = texts.rangeError;
40
43
  }
41
44
  return res;
42
- }, [startValue, startUnit, endValue, endUnit, p.isEn]);
45
+ }, [startValue, startUnit, endValue, endUnit, texts.rangeError]);
43
46
  const handleClear = (e) => {
44
47
  e.stopPropagation();
45
48
  p.onChange(['', '']);
@@ -94,7 +97,7 @@ function DataSizeFilter(p) {
94
97
  setEndValue(p.value[1] ? +p.value[1].slice(0, -2) : null);
95
98
  setEndUnit(p.value[1] ? p.value[1].slice(-2) : 'kb');
96
99
  }, [p.value]);
97
- return (jsxs("div", { className: dataSizeFilter, children: [jsx("span", { className: iconTagHeader, style: { backgroundImage: 'url(' + iconTagHeader$1 + ')' } }), jsx("span", { className: iconTagContent }), jsx(Flex, { justify: "space-between", align: "center", className: header, children: jsxs(Flex, { align: "center", children: [jsx("h3", { children: p.isEn ? 'DataVolume' : '数据体量' }), (startValue !== null || endValue !== null) && (jsx("span", { className: iconClear, onClick: handleClear, children: "\uE85E" }))] }) }), jsxs(Fragment, { children: [jsxs(Flex, { align: "center", children: [jsx(InputNumber, { ref: startInputRef, value: startValue, controls: false, placeholder: p.isEn ? 'Min' : '最小', size: "small", style: { fontSize: 12, width: 140 }, addonAfter: jsx(Select, { style: { width: 50 }, popupMatchSelectWidth: false, value: startUnit, onChange: handleStartUnitChange, children: DATA_SIZE_UNIT.map((item, i) => (jsx(Option, { value: item.value, children: item.name }, i))) }), onChange: handleStartValueChange, onPressEnter: handleStartPressEnter, onBlur: handleStartBlur }), jsx(MinusOutlined, { style: { margin: '0 4px' } }), jsx(InputNumber, { ref: endInputRef, value: endValue, controls: false, placeholder: p.isEn ? 'Max' : '最大', size: "small", style: { fontSize: 12, width: 140 }, addonAfter: jsx(Select, { style: { width: 50 }, popupMatchSelectWidth: false, value: endUnit, onChange: handleEndUnitChange, children: DATA_SIZE_UNIT.map((item, i) => (jsx(Option, { value: item.value, children: item.name }, i))) }), onChange: handleEndValueChange, onPressEnter: handleEndPressEnter, onBlur: handleEndBlur })] }), !!errMsg && jsx("div", { style: { color: 'red', marginTop: 4 }, children: errMsg })] })] }));
100
+ return (jsxs("div", { className: dataSizeFilter, children: [jsx("span", { className: iconTagHeader, style: { backgroundImage: 'url(' + iconTagHeader$1 + ')' } }), jsx("span", { className: iconTagContent }), jsx(Flex, { justify: "space-between", align: "center", className: header, children: jsxs(Flex, { align: "center", children: [jsx("h3", { children: texts.dataVolume }), (startValue !== null || endValue !== null) && (jsx("span", { className: iconClear, onClick: handleClear, children: "\uE85E" }))] }) }), jsxs(Fragment, { children: [jsxs(Flex, { align: "center", children: [jsx(InputNumber, { ref: startInputRef, value: startValue, controls: false, placeholder: texts.min, size: "small", style: { fontSize: 12, width: 140 }, addonAfter: jsx(Select, { style: { width: 50 }, popupMatchSelectWidth: false, value: startUnit, onChange: handleStartUnitChange, children: DATA_SIZE_UNIT.map((item, i) => (jsx(Option, { value: item.value, children: item.name }, i))) }), onChange: handleStartValueChange, onPressEnter: handleStartPressEnter, onBlur: handleStartBlur }), jsx(MinusOutlined, { style: { margin: '0 4px' } }), jsx(InputNumber, { ref: endInputRef, value: endValue, controls: false, placeholder: texts.max, size: "small", style: { fontSize: 12, width: 140 }, addonAfter: jsx(Select, { style: { width: 50 }, popupMatchSelectWidth: false, value: endUnit, onChange: handleEndUnitChange, children: DATA_SIZE_UNIT.map((item, i) => (jsx(Option, { value: item.value, children: item.name }, i))) }), onChange: handleEndValueChange, onPressEnter: handleEndPressEnter, onBlur: handleEndBlur })] }), !!errMsg && jsx("div", { style: { color: 'red', marginTop: 4 }, children: errMsg })] })] }));
98
101
  }
99
102
 
100
103
  export { DataSizeFilter as default };
@@ -10,7 +10,7 @@ import { tagGroupFilter } from './index.module.scss.js';
10
10
  * @param tagSelected 标签选中状态
11
11
  * @param needDataSizeFilter 是否需要数据量过滤(可选)
12
12
  * @param dataSizeValue 数据量过滤值(可选)
13
- * @param isEn 是否英文环境(可选)
13
+ * @param isEn 已废弃,语言由 DataHubProvider / antd ConfigProvider 决定
14
14
  * @param tagClassName 标签类名(可选)
15
15
  * @param onTagChange 标签选中状态变化回调
16
16
  * @param onDataSizeChange 数据量过滤值变化回调(可选)
@@ -47,7 +47,7 @@ function TagGroupFilter(p) {
47
47
  React.useEffect(() => {
48
48
  setMenuOpenKeys(p.tagGroupDatas.map((item) => item.key));
49
49
  }, [p.tagGroupDatas]);
50
- return (jsx("div", { className: tagGroupFilter, children: viewTagGroupDatas.map((item, index) => (jsx(React.Fragment, { children: item.key === 'dataSize' ? (jsx(DataSizeFilter, { isEn: p.isEn, value: p.dataSizeValue || [], onChange: handleDataSizeChange })) : (jsx(TagFilter, { title: item.title, list: item.children, selected: p.tagSelected[item.key] || [], isFold: !menuOpenKeys.includes(item.key), onChange: (selectd) => handleTagChange(item.key, selectd), onFoldChange: (isFold) => handleOpenKeysChange(item.key, isFold), tagClassName: p.tagClassName }, item.key)) }, index))) }));
50
+ return (jsx("div", { className: tagGroupFilter, children: viewTagGroupDatas.map((item, index) => (jsx(React.Fragment, { children: item.key === 'dataSize' ? (jsx(DataSizeFilter, { value: p.dataSizeValue || [], onChange: handleDataSizeChange })) : (jsx(TagFilter, { title: item.title, list: item.children, selected: p.tagSelected[item.key] || [], isFold: !menuOpenKeys.includes(item.key), onChange: (selectd) => handleTagChange(item.key, selectd), onFoldChange: (isFold) => handleOpenKeysChange(item.key, isFold), tagClassName: p.tagClassName }, item.key)) }, index))) }));
51
51
  }
52
52
 
53
53
  export { TagGroupFilter as default };
@@ -1,14 +1,19 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { useState, useRef } from 'react';
3
3
  import { IconBold, IconItalic, IconUnderline, IconStrikethrough, IconHighlight, IconCheck, IconTrash, IconLink } from './icons/index.js';
4
+ import { useLocale } from '../../locale/index.js';
4
5
 
5
6
  function TipTapBubbleMenu({ editor }) {
6
- return (jsxs("div", { className: "tip-tap-bubble-menu", children: [jsx(BubbleButton, { icon: jsx(IconBold, {}), onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive('bold'), tooltip: "\u7C97\u4F53" }), jsx(BubbleButton, { icon: jsx(IconItalic, {}), onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive('italic'), tooltip: "\u659C\u4F53" }), jsx(BubbleButton, { icon: jsx(IconUnderline, {}), onClick: () => editor.chain().focus().toggleUnderline().run(), active: editor.isActive('underline'), tooltip: "\u4E0B\u5212\u7EBF" }), jsx(BubbleButton, { icon: jsx(IconStrikethrough, {}), onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive('strike'), tooltip: "\u5220\u9664\u7EBF" }), jsx("div", { className: "tip-tap-toolbar__divider" }), jsx(BubbleButton, { icon: jsx(IconHighlight, {}), onClick: () => editor.chain().focus().toggleHighlight().run(), active: editor.isActive('highlight'), tooltip: "\u9AD8\u4EAE" }), jsx("div", { className: "tip-tap-toolbar__divider" }), jsx(BubbleLinkButton, { editor: editor })] }));
7
+ const { locale } = useLocale();
8
+ const texts = locale.TipTap;
9
+ return (jsxs("div", { className: "tip-tap-bubble-menu", children: [jsx(BubbleButton, { icon: jsx(IconBold, {}), onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive('bold'), tooltip: texts.bold }), jsx(BubbleButton, { icon: jsx(IconItalic, {}), onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive('italic'), tooltip: texts.italic }), jsx(BubbleButton, { icon: jsx(IconUnderline, {}), onClick: () => editor.chain().focus().toggleUnderline().run(), active: editor.isActive('underline'), tooltip: texts.underline }), jsx(BubbleButton, { icon: jsx(IconStrikethrough, {}), onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive('strike'), tooltip: texts.strike }), jsx("div", { className: "tip-tap-toolbar__divider" }), jsx(BubbleButton, { icon: jsx(IconHighlight, {}), onClick: () => editor.chain().focus().toggleHighlight().run(), active: editor.isActive('highlight'), tooltip: texts.highlightShort }), jsx("div", { className: "tip-tap-toolbar__divider" }), jsx(BubbleLinkButton, { editor: editor })] }));
7
10
  }
8
11
  function BubbleButton({ icon, onClick, active = false, tooltip, }) {
9
12
  return (jsx("button", { className: `tip-tap-btn ${active ? 'tip-tap-btn--active' : ''}`, onClick: onClick, type: "button", title: tooltip, children: icon }));
10
13
  }
11
14
  function BubbleLinkButton({ editor }) {
15
+ const { locale } = useLocale();
16
+ const texts = locale.TipTap;
12
17
  const [showInput, setShowInput] = useState(false);
13
18
  const [url, setUrl] = useState('');
14
19
  const inputRef = useRef(null);
@@ -34,14 +39,14 @@ function BubbleLinkButton({ editor }) {
34
39
  setUrl('');
35
40
  }
36
41
  if (showInput) {
37
- return (jsxs("div", { className: "tip-tap-link-popup", style: { boxShadow: 'none', border: 'none', padding: 0, margin: 0 }, children: [jsx("input", { ref: inputRef, type: "text", className: "tip-tap-link-popup__input", style: { width: '160px', padding: '4px 8px', fontSize: '13px' }, placeholder: "\u8F93\u5165\u94FE\u63A5...", value: url, onChange: (e) => setUrl(e.target.value), onKeyDown: (e) => {
42
+ return (jsxs("div", { className: "tip-tap-link-popup", style: { boxShadow: 'none', border: 'none', padding: 0, margin: 0 }, children: [jsx("input", { ref: inputRef, type: "text", className: "tip-tap-link-popup__input", style: { width: '160px', padding: '4px 8px', fontSize: '13px' }, placeholder: texts.linkPlaceholder, value: url, onChange: (e) => setUrl(e.target.value), onKeyDown: (e) => {
38
43
  if (e.key === 'Enter')
39
44
  handleSubmit();
40
45
  if (e.key === 'Escape')
41
46
  setShowInput(false);
42
47
  } }), jsx("button", { className: "tip-tap-btn", onClick: handleSubmit, type: "button", style: { width: '24px', height: '24px' }, children: jsx(IconCheck, {}) }), editor.isActive('link') && (jsx("button", { className: "tip-tap-btn", onClick: handleRemove, type: "button", style: { width: '24px', height: '24px', color: '#dc2626' }, children: jsx(IconTrash, {}) }))] }));
43
48
  }
44
- return (jsx(BubbleButton, { icon: jsx(IconLink, {}), onClick: handleOpenInput, active: editor.isActive('link'), tooltip: "\u94FE\u63A5" }));
49
+ return (jsx(BubbleButton, { icon: jsx(IconLink, {}), onClick: handleOpenInput, active: editor.isActive('link'), tooltip: texts.link }));
45
50
  }
46
51
 
47
52
  export { TipTapBubbleMenu as default };
@@ -6,11 +6,14 @@ import { forwardRef, useImperativeHandle } from 'react';
6
6
  import { editorExtensions } from './extensions/index.js';
7
7
  import Toolbar from './toolbar/index.js';
8
8
  import TipTapBubbleMenu from './bubble-menu.js';
9
+ import { useLocale } from '../../locale/index.js';
9
10
 
10
11
  useStyle();
11
- var editor = forwardRef(function TipTapEditor({ content = '', placeholder = '开始输入内容...', editable = true, autofocus = false, className = '', toolbarClassName = '', onChange, }, ref) {
12
+ var editor = forwardRef(function TipTapEditor({ content = '', placeholder, editable = true, autofocus = false, className = '', toolbarClassName = '', onChange, }, ref) {
13
+ const { locale } = useLocale();
14
+ const resolvedPlaceholder = placeholder !== null && placeholder !== void 0 ? placeholder : locale.TipTap.placeholder;
12
15
  const editor = useEditor({
13
- extensions: editorExtensions(placeholder),
16
+ extensions: editorExtensions(resolvedPlaceholder),
14
17
  content,
15
18
  editable,
16
19
  autofocus,
@@ -33,7 +33,7 @@ const editorExtensions = (placeholder) => [
33
33
  },
34
34
  }),
35
35
  Placeholder.configure({
36
- placeholder: placeholder || '开始输入内容...',
36
+ placeholder: placeholder || undefined,
37
37
  emptyEditorClass: 'is-editor-empty',
38
38
  }),
39
39
  TextStyle,
@@ -2,8 +2,10 @@ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { useEditorState } from '@tiptap/react';
3
3
  import { useState, useRef, useEffect } from 'react';
4
4
  import { IconBold, IconHighlight } from '../../icons/index.js';
5
+ import { useLocale } from '../../../../locale/index.js';
5
6
 
6
7
  function ColorPicker({ editor, type, tooltip }) {
8
+ const { locale } = useLocale();
7
9
  const [isOpen, setIsOpen] = useState(false);
8
10
  const dropdownRef = useRef(null);
9
11
  const colors = [
@@ -70,7 +72,7 @@ function ColorPicker({ editor, type, tooltip }) {
70
72
  }
71
73
  setIsOpen(false);
72
74
  }
73
- return (jsxs("div", { className: `tip-tap-dropdown ${isOpen ? 'tip-tap-dropdown--open' : ''}`, ref: dropdownRef, children: [jsxs("button", { className: `tip-tap-btn ${(editorState === null || editorState === void 0 ? void 0 : editorState.isActive) ? 'tip-tap-btn--active' : ''}`, onClick: () => setIsOpen(!isOpen), type: "button", style: type === 'textColor' && (editorState === null || editorState === void 0 ? void 0 : editorState.color) ? { color: editorState.color } : {}, children: [type === 'textColor' ? (jsx(IconBold, { style: { borderBottom: `3px solid ${(editorState === null || editorState === void 0 ? void 0 : editorState.color) || '#000'}` } })) : (jsx(IconHighlight, {})), jsx("span", { className: "tip-tap-tooltip", children: tooltip })] }), jsx("div", { className: "tip-tap-dropdown__menu", children: jsxs("div", { className: "tip-tap-color-picker", children: [jsx("button", { className: "tip-tap-color-picker__swatch tip-tap-color-picker__swatch--reset", onClick: () => handleColorSelect(null), title: "\u79FB\u9664\u989C\u8272", type: "button" }), colors.map((color) => (jsx("button", { className: "tip-tap-color-picker__swatch", style: { background: color }, onClick: () => handleColorSelect(color), type: "button" }, color)))] }) })] }));
75
+ return (jsxs("div", { className: `tip-tap-dropdown ${isOpen ? 'tip-tap-dropdown--open' : ''}`, ref: dropdownRef, children: [jsxs("button", { className: `tip-tap-btn ${(editorState === null || editorState === void 0 ? void 0 : editorState.isActive) ? 'tip-tap-btn--active' : ''}`, onClick: () => setIsOpen(!isOpen), type: "button", style: type === 'textColor' && (editorState === null || editorState === void 0 ? void 0 : editorState.color) ? { color: editorState.color } : {}, children: [type === 'textColor' ? (jsx(IconBold, { style: { borderBottom: `3px solid ${(editorState === null || editorState === void 0 ? void 0 : editorState.color) || '#000'}` } })) : (jsx(IconHighlight, {})), jsx("span", { className: "tip-tap-tooltip", children: tooltip })] }), jsx("div", { className: "tip-tap-dropdown__menu", children: jsxs("div", { className: "tip-tap-color-picker", children: [jsx("button", { className: "tip-tap-color-picker__swatch tip-tap-color-picker__swatch--reset", onClick: () => handleColorSelect(null), title: locale.TipTap.removeColor, type: "button" }), colors.map((color) => (jsx("button", { className: "tip-tap-color-picker__swatch", style: { background: color }, onClick: () => handleColorSelect(color), type: "button" }, color)))] }) })] }));
74
76
  }
75
77
 
76
78
  export { ColorPicker };
@@ -2,15 +2,18 @@ import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { useEditorState } from '@tiptap/react';
3
3
  import { useState, useRef, useEffect } from 'react';
4
4
  import { IconParagraph, IconH1, IconH2, IconH3, IconChevronDown } from '../../icons/index.js';
5
+ import { useLocale } from '../../../../locale/index.js';
5
6
 
6
7
  function HeadingDropdown({ editor }) {
8
+ const { locale } = useLocale();
9
+ const texts = locale.TipTap;
7
10
  const [isOpen, setIsOpen] = useState(false);
8
11
  const dropdownRef = useRef(null);
9
12
  const headings = [
10
- { level: 0, label: '正文', icon: jsx(IconParagraph, {}) },
11
- { level: 1, label: '标题 1', icon: jsx(IconH1, {}) },
12
- { level: 2, label: '标题 2', icon: jsx(IconH2, {}) },
13
- { level: 3, label: '标题 3', icon: jsx(IconH3, {}) },
13
+ { level: 0, label: texts.paragraph, icon: jsx(IconParagraph, {}) },
14
+ { level: 1, label: texts.heading1, icon: jsx(IconH1, {}) },
15
+ { level: 2, label: texts.heading2, icon: jsx(IconH2, {}) },
16
+ { level: 3, label: texts.heading3, icon: jsx(IconH3, {}) },
14
17
  ];
15
18
  // 使用 useEditorState 来同步编辑器状态
16
19
  const editorState = useEditorState({
@@ -38,7 +41,7 @@ function HeadingDropdown({ editor }) {
38
41
  }
39
42
  setIsOpen(false);
40
43
  }
41
- return (jsxs("div", { className: `tip-tap-dropdown ${isOpen ? 'tip-tap-dropdown--open' : ''}`, ref: dropdownRef, children: [jsxs("button", { className: `tip-tap-dropdown__trigger ${editorState && editorState.level !== 0 ? 'tip-tap-dropdown__trigger--active' : ''}`, onClick: () => setIsOpen(!isOpen), type: "button", children: [(editorState === null || editorState === void 0 ? void 0 : editorState.icon) || jsx(IconParagraph, {}), jsx("span", { children: (editorState === null || editorState === void 0 ? void 0 : editorState.label) || '正文' }), jsx(IconChevronDown, { className: "tip-tap-dropdown__arrow" })] }), jsx("div", { className: "tip-tap-dropdown__menu", children: headings.map(({ level, label, icon }) => (jsxs("button", { className: `tip-tap-dropdown__item ${(editorState === null || editorState === void 0 ? void 0 : editorState.level) === level ? 'tip-tap-dropdown__item--active' : ''}`, onClick: () => handleSelect(level), type: "button", children: [jsx("span", { className: "tip-tap-dropdown__item-icon", children: icon }), label] }, level))) })] }));
44
+ return (jsxs("div", { className: `tip-tap-dropdown ${isOpen ? 'tip-tap-dropdown--open' : ''}`, ref: dropdownRef, children: [jsxs("button", { className: `tip-tap-dropdown__trigger ${editorState && editorState.level !== 0 ? 'tip-tap-dropdown__trigger--active' : ''}`, onClick: () => setIsOpen(!isOpen), type: "button", children: [(editorState === null || editorState === void 0 ? void 0 : editorState.icon) || jsx(IconParagraph, {}), jsx("span", { children: (editorState === null || editorState === void 0 ? void 0 : editorState.label) || texts.paragraph }), jsx(IconChevronDown, { className: "tip-tap-dropdown__arrow" })] }), jsx("div", { className: "tip-tap-dropdown__menu", children: headings.map(({ level, label, icon }) => (jsxs("button", { className: `tip-tap-dropdown__item ${(editorState === null || editorState === void 0 ? void 0 : editorState.level) === level ? 'tip-tap-dropdown__item--active' : ''}`, onClick: () => handleSelect(level), type: "button", children: [jsx("span", { className: "tip-tap-dropdown__item-icon", children: icon }), label] }, level))) })] }));
42
45
  }
43
46
 
44
47
  export { HeadingDropdown };
@@ -3,8 +3,11 @@ import { useEditorState } from '@tiptap/react';
3
3
  import { getMarkRange } from '@tiptap/core';
4
4
  import { useState, useRef, useEffect } from 'react';
5
5
  import { IconLink, IconCheck, IconTrash } from '../../icons/index.js';
6
+ import { useLocale } from '../../../../locale/index.js';
6
7
 
7
8
  function LinkButton({ editor }) {
9
+ const { locale } = useLocale();
10
+ const texts = locale.TipTap;
8
11
  const [isOpen, setIsOpen] = useState(false);
9
12
  const [label, setLabel] = useState('');
10
13
  const [url, setUrl] = useState('');
@@ -101,7 +104,7 @@ function LinkButton({ editor }) {
101
104
  setLabel('');
102
105
  setUrl('');
103
106
  }
104
- return (jsxs("div", { className: `tip-tap-dropdown ${isOpen ? 'tip-tap-dropdown--open' : ''}`, ref: dropdownRef, children: [jsxs("button", { className: `tip-tap-btn ${(editorState === null || editorState === void 0 ? void 0 : editorState.isActive) ? 'tip-tap-btn--active' : ''}`, onClick: handleToggleOpen, type: "button", children: [jsx(IconLink, {}), jsx("span", { className: "tip-tap-tooltip", children: "\u94FE\u63A5" })] }), jsx("div", { className: "tip-tap-dropdown__menu", style: { width: 'auto', padding: 0 }, children: jsxs("div", { className: "tip-tap-link-popup", style: { flexDirection: 'column', alignItems: 'stretch' }, children: [jsx("input", { ref: labelInputRef, type: "text", className: "tip-tap-link-popup__input", placeholder: "\u8F93\u5165\u94FE\u63A5\u6587\u672C...", value: label, onChange: (e) => setLabel(e.target.value), onKeyDown: (e) => e.key === 'Enter' && handleSubmit(), style: { marginBottom: '8px' } }), jsx("input", { type: "text", className: "tip-tap-link-popup__input", placeholder: "\u8F93\u5165\u94FE\u63A5\u5730\u5740...", value: url, onChange: (e) => setUrl(e.target.value), onKeyDown: (e) => e.key === 'Enter' && handleSubmit() }), jsxs("div", { style: { display: 'flex', gap: '4px', marginTop: '8px' }, children: [jsx("button", { className: "tip-tap-link-popup__btn", onClick: handleSubmit, type: "button", children: jsx(IconCheck, {}) }), (editorState === null || editorState === void 0 ? void 0 : editorState.isActive) && (jsx("button", { className: "tip-tap-link-popup__btn tip-tap-link-popup__btn--danger", onClick: handleRemove, type: "button", children: jsx(IconTrash, {}) }))] })] }) })] }));
107
+ return (jsxs("div", { className: `tip-tap-dropdown ${isOpen ? 'tip-tap-dropdown--open' : ''}`, ref: dropdownRef, children: [jsxs("button", { className: `tip-tap-btn ${(editorState === null || editorState === void 0 ? void 0 : editorState.isActive) ? 'tip-tap-btn--active' : ''}`, onClick: handleToggleOpen, type: "button", children: [jsx(IconLink, {}), jsx("span", { className: "tip-tap-tooltip", children: texts.link })] }), jsx("div", { className: "tip-tap-dropdown__menu", style: { width: 'auto', padding: 0 }, children: jsxs("div", { className: "tip-tap-link-popup", style: { flexDirection: 'column', alignItems: 'stretch' }, children: [jsx("input", { ref: labelInputRef, type: "text", className: "tip-tap-link-popup__input", placeholder: texts.linkText, value: label, onChange: (e) => setLabel(e.target.value), onKeyDown: (e) => e.key === 'Enter' && handleSubmit(), style: { marginBottom: '8px' } }), jsx("input", { type: "text", className: "tip-tap-link-popup__input", placeholder: texts.linkUrl, value: url, onChange: (e) => setUrl(e.target.value), onKeyDown: (e) => e.key === 'Enter' && handleSubmit() }), jsxs("div", { style: { display: 'flex', gap: '4px', marginTop: '8px' }, children: [jsx("button", { className: "tip-tap-link-popup__btn", onClick: handleSubmit, type: "button", children: jsx(IconCheck, {}) }), (editorState === null || editorState === void 0 ? void 0 : editorState.isActive) && (jsx("button", { className: "tip-tap-link-popup__btn tip-tap-link-popup__btn--danger", onClick: handleRemove, type: "button", children: jsx(IconTrash, {}) }))] })] }) })] }));
105
108
  }
106
109
 
107
110
  export { LinkButton };