whistle.mock-plugins 1.2.1-beta.1 → 1.2.1-beta.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.
@@ -150,6 +150,8 @@
150
150
 
151
151
  /**![menu-unfold](data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAiIGhlaWdodD0iNTAiIGZpbGw9IiNjYWNhY2EiIHZpZXdCb3g9IjY0IDY0IDg5NiA4OTYiIGZvY3VzYWJsZT0iZmFsc2UiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTQwOCA0NDJoNDgwYzQuNCAwIDgtMy42IDgtOHYtNTZjMC00LjQtMy42LTgtOC04SDQwOGMtNC40IDAtOCAzLjYtOCA4djU2YzAgNC40IDMuNiA4IDggOHptLTggMjA0YzAgNC40IDMuNiA4IDggOGg0ODBjNC40IDAgOC0zLjYgOC04di01NmMwLTQuNC0zLjYtOC04LThINDA4Yy00LjQgMC04IDMuNi04IDh2NTZ6bTUwNC00ODZIMTIwYy00LjQgMC04IDMuNi04IDh2NTZjMCA0LjQgMy42IDggOCA4aDc4NGM0LjQgMCA4LTMuNiA4LTh2LTU2YzAtNC40LTMuNi04LTgtOHptMCA2MzJIMTIwYy00LjQgMC04IDMuNi04IDh2NTZjMCA0LjQgMy42IDggOCA4aDc4NGM0LjQgMCA4LTMuNiA4LTh2LTU2YzAtNC40LTMuNi04LTgtOHpNMTQyLjQgNjQyLjFMMjk4LjcgNTE5YTguODQgOC44NCAwIDAwMC0xMy45TDE0Mi40IDM4MS45Yy01LjgtNC42LTE0LjQtLjUtMTQuNCA2Ljl2MjQ2LjNhOC45IDguOSAwIDAwMTQuNCA3eiIgLz48L3N2Zz4=) */
152
152
 
153
+ /**![menu](data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAiIGhlaWdodD0iNTAiIGZpbGw9IiNjYWNhY2EiIHZpZXdCb3g9IjY0IDY0IDg5NiA4OTYiIGZvY3VzYWJsZT0iZmFsc2UiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTkwNCAxNjBIMTIwYy00LjQgMC04IDMuNi04IDh2NjRjMCA0LjQgMy42IDggOCA4aDc4NGM0LjQgMCA4LTMuNiA4LTh2LTY0YzAtNC40LTMuNi04LTgtOHptMCA2MjRIMTIwYy00LjQgMC04IDMuNi04IDh2NjRjMCA0LjQgMy42IDggOCA4aDc4NGM0LjQgMCA4LTMuNiA4LTh2LTY0YzAtNC40LTMuNi04LTgtOHptMC0zMTJIMTIwYy00LjQgMC04IDMuNi04IDh2NjRjMCA0LjQgMy42IDggOCA4aDc4NGM0LjQgMCA4LTMuNiA4LTh2LTY0YzAtNC40LTMuNi04LTgtOHoiIC8+PC9zdmc+) */
154
+
153
155
  /**![minus-square](data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAiIGhlaWdodD0iNTAiIGZpbGw9IiNjYWNhY2EiIHZpZXdCb3g9IjY0IDY0IDg5NiA4OTYiIGZvY3VzYWJsZT0iZmFsc2UiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTMyOCA1NDRoMzY4YzQuNCAwIDgtMy42IDgtOHYtNDhjMC00LjQtMy42LTgtOC04SDMyOGMtNC40IDAtOCAzLjYtOCA4djQ4YzAgNC40IDMuNiA4IDggOHoiIC8+PHBhdGggZD0iTTg4MCAxMTJIMTQ0Yy0xNy43IDAtMzIgMTQuMy0zMiAzMnY3MzZjMCAxNy43IDE0LjMgMzIgMzIgMzJoNzM2YzE3LjcgMCAzMi0xNC4zIDMyLTMyVjE0NGMwLTE3LjctMTQuMy0zMi0zMi0zMnptLTQwIDcyOEgxODRWMTg0aDY1NnY2NTZ6IiAvPjwvc3ZnPg==) */
154
156
 
155
157
  /**![plus-circle](data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAiIGhlaWdodD0iNTAiIGZpbGw9IiNjYWNhY2EiIHZpZXdCb3g9IjY0IDY0IDg5NiA4OTYiIGZvY3VzYWJsZT0iZmFsc2UiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTY5NiA0ODBINTQ0VjMyOGMwLTQuNC0zLjYtOC04LThoLTQ4Yy00LjQgMC04IDMuNi04IDh2MTUySDMyOGMtNC40IDAtOCAzLjYtOCA4djQ4YzAgNC40IDMuNiA4IDggOGgxNTJ2MTUyYzAgNC40IDMuNiA4IDggOGg0OGM0LjQgMCA4LTMuNiA4LThWNTQ0aDE1MmM0LjQgMCA4LTMuNiA4LTh2LTQ4YzAtNC40LTMuNi04LTgtOHoiIC8+PHBhdGggZD0iTTUxMiA2NEMyNjQuNiA2NCA2NCAyNjQuNiA2NCA1MTJzMjAwLjYgNDQ4IDQ0OCA0NDggNDQ4LTIwMC42IDQ0OC00NDhTNzU5LjQgNjQgNTEyIDY0em0wIDgyMGMtMjA1LjQgMC0zNzItMTY2LjYtMzcyLTM3MnMxNjYuNi0zNzIgMzcyLTM3MiAzNzIgMTY2LjYgMzcyIDM3Mi0xNjYuNiAzNzItMzcyIDM3MnoiIC8+PC9zdmc+) */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whistle.mock-plugins",
3
- "version": "1.2.1-beta.1",
3
+ "version": "1.2.1-beta.2",
4
4
  "description": "Whistle 插件,用于快速创建 API 模拟数据",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -65,11 +65,11 @@ const DataManagementModal = ({ visible, onCancel, interfaceItem, onSaved }) => {
65
65
  open={visible}
66
66
  onOk={handleOk}
67
67
  onCancel={onCancel}
68
- width={900}
68
+ width={1040}
69
69
  destroyOnClose
70
70
  okText="保存"
71
71
  cancelText="取消"
72
- bodyStyle={{ maxHeight: '70vh', overflow: 'auto', padding: '24px' }}
72
+ bodyStyle={{ maxHeight: '80vh', overflow: 'auto', padding: '24px' }}
73
73
  >
74
74
  <Form form={form} layout="vertical" initialValues={{ responses: [], activeResponseId: '' }}>
75
75
  <Form.Item name="responses" hidden>
@@ -12,7 +12,8 @@ import {
12
12
  CheckCircleOutlined,
13
13
  EditOutlined,
14
14
  FullscreenOutlined,
15
- FullscreenExitOutlined
15
+ FullscreenExitOutlined,
16
+ MenuOutlined
16
17
  } from '@ant-design/icons';
17
18
  import { generateResponseId } from './utils';
18
19
 
@@ -30,6 +31,7 @@ const ResponseContentEditor = ({
30
31
  const [isEditing, setIsEditing] = useState(false);
31
32
  const [editingName, setEditingName] = useState('');
32
33
  const [isTextareaFullscreen, setIsTextareaFullscreen] = useState(false);
34
+ const [showSorting, setShowSorting] = useState(false);
33
35
 
34
36
  // 查找激活的响应
35
37
  const activeResponseIndex = responses.findIndex(r => r.id === activeResponseId);
@@ -279,6 +281,17 @@ const ResponseContentEditor = ({
279
281
  }
280
282
  extra={
281
283
  <Space size="small">
284
+ {enableSorting && (
285
+ <Button
286
+ type="default"
287
+ icon={<MenuOutlined />}
288
+ onClick={() => setShowSorting(!showSorting)}
289
+ size="small"
290
+ style={{ display: 'flex', alignItems: 'center', gap: '4px' }}
291
+ >
292
+ 排序
293
+ </Button>
294
+ )}
282
295
  <Button
283
296
  type="default"
284
297
  icon={<PlusCircleOutlined />}
@@ -329,11 +342,8 @@ const ResponseContentEditor = ({
329
342
  style={{ marginBottom: 16 }}
330
343
  bodyStyle={{ padding: '16px' }}
331
344
  >
332
- {enableSorting && Array.isArray(sortableList) && sortableList.length > 1 && (
333
- <div style={{ marginBottom: '16px' }}>
334
- <div style={{ marginBottom: '8px' }}>
335
- <label style={{ fontSize: '12px', color: '#666', fontWeight: 'bold' }}>响应排序(拖拽调整顺序)</label>
336
- </div>
345
+ {enableSorting && showSorting && Array.isArray(sortableList) && sortableList.length > 1 && (
346
+ <div style={{ marginBottom: 12 }}>
337
347
  <ReactSortable
338
348
  list={sortableList}
339
349
  setList={(newState) => {
@@ -341,31 +351,17 @@ const ResponseContentEditor = ({
341
351
  handleAfterSort(newState);
342
352
  }}
343
353
  animation={150}
344
- handle={undefined}
345
354
  ghostClass="sortable-ghost"
355
+ style={{ display: 'flex', gap: 8, overflowX: 'auto', paddingBottom: 4 }}
346
356
  >
347
357
  {sortableList.map((item) => (
348
358
  <div
349
359
  key={item.id}
350
- style={{
351
- display: 'flex',
352
- alignItems: 'center',
353
- justifyContent: 'space-between',
354
- padding: '6px 10px',
355
- border: '1px solid #f0f0f0',
356
- borderRadius: '4px',
357
- marginBottom: '6px',
358
- background: item.id === activeResponseId ? '#e6f7ff' : '#fff',
359
- cursor: 'move'
360
- }}
360
+ className={`sortable-chip${item.id === activeResponseId ? ' sortable-chip-active' : ''}`}
361
361
  onClick={() => handleResponseSelect(item.id)}
362
- title="拖拽以排序,点击选择"
362
+ title={item.name || '未命名响应'}
363
363
  >
364
- <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
365
- <Badge status={item.id === activeResponseId ? 'processing' : 'default'} />
366
- <span style={{ fontWeight: 500 }}>{item.name || '未命名响应'}</span>
367
- </div>
368
- <div style={{ color: '#999', fontSize: 12 }}>拖拽</div>
364
+ {item.name || '未命名响应'}
369
365
  </div>
370
366
  ))}
371
367
  </ReactSortable>
@@ -503,7 +499,7 @@ const ResponseContentEditor = ({
503
499
 
504
500
  <div style={{ position: 'relative' }}>
505
501
  <TextArea
506
- rows={12}
502
+ rows={18}
507
503
  placeholder="请输入响应内容..."
508
504
  style={{
509
505
  fontFamily: 'Monaco, Menlo, "Ubuntu Mono", monospace',
@@ -1144,6 +1144,37 @@
1144
1144
  background: #e6f4ff;
1145
1145
  }
1146
1146
 
1147
+ /* 紧凑排序 Chips */
1148
+ .sortable-chip {
1149
+ display: inline-flex;
1150
+ align-items: center;
1151
+ padding: 2px 10px;
1152
+ height: 24px;
1153
+ border: 1px solid #e6e6e6;
1154
+ border-radius: 12px;
1155
+ background: #fff;
1156
+ font-size: 12px;
1157
+ color: #595959;
1158
+ cursor: move;
1159
+ user-select: none;
1160
+ white-space: nowrap;
1161
+ }
1162
+
1163
+ .sortable-chip:hover {
1164
+ border-color: #bfbfbf;
1165
+ box-shadow: 0 1px 2px rgba(0,0,0,0.06);
1166
+ }
1167
+
1168
+ .sortable-chip-active {
1169
+ background: #e6f7ff;
1170
+ border-color: #91d5ff;
1171
+ color: #1677ff;
1172
+ }
1173
+
1174
+ .sortable-ghost {
1175
+ opacity: 0.6;
1176
+ }
1177
+
1147
1178
  /* 接口弹窗样式 */
1148
1179
  .interface-modal .ant-modal-header {
1149
1180
  border-bottom: 1px solid #f0f0f0;