@tmagic/editor 1.8.0-beta.15 → 1.8.0-beta.17

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.
@@ -333,11 +333,11 @@ export const initServiceEvents = (
333
333
  Promise.all(
334
334
  nodes.map((node) => {
335
335
  if (node.type === NodeType.ROOT) {
336
- return Promise.resolve();
336
+ return Promise.resolve(true);
337
337
  }
338
338
  return depService.collectIdle([node], { pageId: getPageIdByNode(node) }, deep, type);
339
339
  }),
340
- );
340
+ ).then((results) => results.every(Boolean));
341
341
 
342
342
  watch(
343
343
  () => editorService.get('stage'),
@@ -351,7 +351,7 @@ export const initServiceEvents = (
351
351
 
352
352
  if (!node) return;
353
353
 
354
- await collectIdle([node], true, DepTargetType.DATA_SOURCE);
354
+ if (!(await collectIdle([node], true, DepTargetType.DATA_SOURCE))) return;
355
355
  updateStageNode(node);
356
356
  });
357
357
  },
@@ -494,8 +494,10 @@ export const initServiceEvents = (
494
494
 
495
495
  // 新增节点,收集依赖
496
496
  const nodeAddHandler = (nodes: MComponent[]) => {
497
- collectIdle(nodes, true).then(() => {
498
- updateStageNodes(nodes);
497
+ collectIdle(nodes, true).then((completed) => {
498
+ if (completed) {
499
+ updateStageNodes(nodes);
500
+ }
499
501
  });
500
502
  };
501
503
 
@@ -549,8 +551,8 @@ export const initServiceEvents = (
549
551
  if (needRecollectNodes.length) {
550
552
  // 有数据源依赖,需要等依赖重新收集完才更新stage
551
553
  const handler = async () => {
552
- await collectIdle(needRecollectNodes, true, DepTargetType.DATA_SOURCE);
553
- await collectIdle(needRecollectNodes, true, DepTargetType.DATA_SOURCE_COND);
554
+ if (!(await collectIdle(needRecollectNodes, true, DepTargetType.DATA_SOURCE))) return;
555
+ if (!(await collectIdle(needRecollectNodes, true, DepTargetType.DATA_SOURCE_COND))) return;
554
556
  updateStageNodes(needRecollectNodes);
555
557
  };
556
558
  handler();
@@ -572,8 +574,10 @@ export const initServiceEvents = (
572
574
 
573
575
  // 历史记录变化时,需要重新收集依赖
574
576
  const historyChangeHandler = (page: MPage | MPageFragment) => {
575
- collectIdle([page], true).then(() => {
576
- updateStageNode(page);
577
+ collectIdle([page], true).then((completed) => {
578
+ if (completed) {
579
+ updateStageNode(page);
580
+ }
577
581
  });
578
582
  };
579
583
 
@@ -654,7 +658,7 @@ export const initServiceEvents = (
654
658
  if (Array.isArray(root?.items)) {
655
659
  depService.clearIdleTasks();
656
660
 
657
- let collectIdlePromises: Promise<void[]>[] = [];
661
+ let collectIdlePromises: Promise<boolean>[] = [];
658
662
  if (isModifyField) {
659
663
  depService.removeTarget(config.id, DepTargetType.DATA_SOURCE);
660
664
  depService.removeTarget(config.id, DepTargetType.DATA_SOURCE_COND);
@@ -679,10 +683,15 @@ export const initServiceEvents = (
679
683
 
680
684
  collectIdlePromises = [collectIdle(root.items, true, DepTargetType.DATA_SOURCE_METHOD)];
681
685
  }
682
- Promise.all(collectIdlePromises)
683
- .then(() => updateDataSourceSchema())
684
- .then(() => updateDsData())
685
- .then(() => updateStageNodes(root.items));
686
+ const handler = async () => {
687
+ const results = await Promise.all(collectIdlePromises);
688
+ if (!results.every(Boolean)) return;
689
+
690
+ updateDataSourceSchema();
691
+ await updateDsData();
692
+ updateStageNodes(root.items);
693
+ };
694
+ handler();
686
695
  }
687
696
  } else if (root?.dataSources) {
688
697
  updateDsData();
@@ -706,11 +715,12 @@ export const initServiceEvents = (
706
715
  const nodeIds = Object.keys(root.dataSourceDeps?.[id] || {});
707
716
  const nodes = getNodes(nodeIds, root.items);
708
717
 
709
- await Promise.all([
718
+ const results = await Promise.all([
710
719
  collectIdle(nodes, false, DepTargetType.DATA_SOURCE),
711
720
  collectIdle(nodes, false, DepTargetType.DATA_SOURCE_COND),
712
721
  collectIdle(nodes, false, DepTargetType.DATA_SOURCE_METHOD),
713
722
  ]);
723
+ if (!results.every(Boolean)) return;
714
724
 
715
725
  updateDataSourceSchema();
716
726
 
@@ -49,14 +49,13 @@ import { Document as DocumentIcon } from '@element-plus/icons-vue';
49
49
 
50
50
  import { TMagicButton, tMagicMessage, TMagicScrollbar } from '@tmagic/design';
51
51
  import type { ContainerChangeEventData, FormConfig, FormState, FormValue } from '@tmagic/form';
52
- import { MForm } from '@tmagic/form';
52
+ import { MForm, validateForm } from '@tmagic/form';
53
53
  import { filterXSS } from '@tmagic/utils';
54
54
 
55
55
  import MIcon from '@editor/components/Icon.vue';
56
56
  import { ENABLE_PROPS_FORM_VALIDATE } from '@editor/editorProps';
57
57
  import { useEditorContentHeight } from '@editor/hooks/use-editor-content-height';
58
58
  import { useServices } from '@editor/hooks/use-services';
59
- import { validatePropsForm } from '@editor/utils/props';
60
59
 
61
60
  import CodeEditor from '../CodeEditor.vue';
62
61
 
@@ -162,14 +161,19 @@ const saveCode = async (values: any) => {
162
161
  // 做一次静默校验(不复用、也不污染页面上正在展示的表单),并将校验结果(错误信息)随提交
163
162
  // 一并抛给上层记录,使源码保存的错误状态与表单编辑保持一致。
164
163
  try {
165
- const error = await validatePropsForm({
164
+ const error = await validateForm({
166
165
  config: props.config,
167
- values: newValues,
168
- appContext: internalInstance?.appContext ?? null,
169
- services,
170
- stage: stage.value,
171
166
  typeMatchValid: true,
172
- extendState: props.extendState,
167
+ initValues: newValues,
168
+ // 将当前组件实例的 provides(含 Editor 顶层的 services / codeOptions 等组件级 provide)
169
+ // 合入 appContext,使临时 MForm 中的编辑器字段组件(DataSourceInput 等)能正常 inject
170
+ appContext: internalInstance?.appContext ? { ...internalInstance?.appContext, provides: { services } } : null,
171
+ extendState: (state) => {
172
+ if (configFormRef.value?.formState) {
173
+ return { ...(configFormRef.value?.formState || {}) };
174
+ }
175
+ return props.extendState?.(state) || {};
176
+ },
173
177
  });
174
178
 
175
179
  if (error) {
@@ -145,6 +145,6 @@ const dragHandler = (e: DragEvent) => {
145
145
 
146
146
  if (timeout || !stage.value) return;
147
147
 
148
- timeout = stage.value.delayedMarkContainer(e);
148
+ timeout = stage.value.delayedMarkContainer(e, [], true);
149
149
  };
150
150
  </script>
@@ -42,6 +42,21 @@ interface State {
42
42
 
43
43
  type StateKey = keyof State;
44
44
 
45
+ /**
46
+ * 一次 collectIdle 调用对应一个批次。批次自行统计入队/完成的任务数,在自身任务全部完成或被中断时
47
+ * 结算对应的 Promise,避免多次快速触发时共用 idleTask 的 finish 事件造成的串扰、提前 resolve,
48
+ * 以及 clearTasks 后 Promise 永不 resolve(collecting 卡死、监听器泄漏)。
49
+ */
50
+ interface CollectBatch {
51
+ nodes: MNode[];
52
+ deep: boolean;
53
+ pending: number;
54
+ dsPending: number;
55
+ collectedEmitted: boolean;
56
+ dsSettled: boolean;
57
+ resolve: (completed: boolean) => void;
58
+ }
59
+
45
60
  class Dep extends BaseService {
46
61
  private state = shallowReactive<State>({
47
62
  collecting: false,
@@ -54,6 +69,12 @@ class Dep extends BaseService {
54
69
 
55
70
  private waitingWorker?: Promise<void>;
56
71
 
72
+ private resolveWaitingWorker?: () => void;
73
+
74
+ private workerGeneration = 0;
75
+
76
+ private activeBatches = new Set<CollectBatch>();
77
+
57
78
  constructor() {
58
79
  super();
59
80
 
@@ -137,38 +158,44 @@ class Dep extends BaseService {
137
158
  await this.waitingWorker;
138
159
  }
139
160
 
140
- this.set('collecting', true);
141
- let startTask = false;
142
- this.watcher.collectByCallback(nodes, type, ({ node, target }) => {
143
- startTask = true;
161
+ const batch: CollectBatch = {
162
+ nodes,
163
+ deep,
164
+ pending: 0,
165
+ dsPending: 0,
166
+ collectedEmitted: false,
167
+ dsSettled: false,
168
+ resolve: () => {},
169
+ };
144
170
 
145
- this.enqueueTask(node, target, depExtendedData, deep);
171
+ this.watcher.collectByCallback(nodes, type, ({ node, target }) => {
172
+ this.enqueueTask(node, target, depExtendedData, deep, batch);
146
173
  });
147
174
 
148
- return new Promise<void>((resolve) => {
149
- if (!startTask) {
150
- this.emit('collected', nodes, deep);
151
- this.set('collecting', false);
152
- resolve();
153
- return;
154
- }
155
- this.idleTask.once('finish', () => {
156
- this.emit('collected', nodes, deep);
157
- this.set('collecting', false);
158
- });
159
- this.idleTask.once('hight-level-finish', () => {
160
- this.emit('ds-collected', nodes, deep);
161
- resolve();
162
- });
175
+ // 没有命中任何 target,无需收集,直接完成
176
+ if (batch.pending === 0) {
177
+ this.emit('collected', nodes, deep);
178
+ this.updateCollectingState();
179
+ return true;
180
+ }
181
+
182
+ this.activeBatches.add(batch);
183
+ this.set('collecting', true);
184
+
185
+ return new Promise<boolean>((resolve) => {
186
+ batch.resolve = resolve;
163
187
  });
164
188
  }
165
189
 
166
190
  public collectByWorker(dsl: MApp) {
167
191
  this.set('collecting', true);
192
+ this.workerGeneration += 1;
193
+ const generation = this.workerGeneration;
168
194
 
169
195
  const { promise, resolve: waitingResolve } = Promise.withResolvers<void>();
170
196
 
171
197
  this.waitingWorker = promise;
198
+ this.resolveWaitingWorker = waitingResolve;
172
199
 
173
200
  return new Promise<Record<string, Record<string, DepData>>>((resolve) => {
174
201
  const worker = new Work();
@@ -182,6 +209,11 @@ class Dep extends BaseService {
182
209
  resolve({});
183
210
  };
184
211
  }).then((depsData) => {
212
+ if (generation !== this.workerGeneration) {
213
+ waitingResolve();
214
+ return depsData;
215
+ }
216
+
185
217
  traverseTarget(this.watcher.getTargetsList(), (target) => {
186
218
  if (depsData[target.type]?.[target.id]) {
187
219
  target.deps = reactive(depsData[target.type][target.id]);
@@ -200,6 +232,10 @@ class Dep extends BaseService {
200
232
  this.emit('collected', dsl.items, true);
201
233
  this.emit('ds-collected', dsl.items, true);
202
234
  waitingResolve();
235
+ if (this.waitingWorker === promise) {
236
+ this.waitingWorker = undefined;
237
+ this.resolveWaitingWorker = undefined;
238
+ }
203
239
 
204
240
  return depsData;
205
241
  });
@@ -233,6 +269,7 @@ class Dep extends BaseService {
233
269
  }
234
270
 
235
271
  public clearIdleTasks() {
272
+ this.abortActiveBatches();
236
273
  this.idleTask.clearTasks();
237
274
  }
238
275
 
@@ -251,6 +288,11 @@ class Dep extends BaseService {
251
288
  }
252
289
 
253
290
  public reset() {
291
+ this.abortActiveBatches();
292
+ this.workerGeneration += 1;
293
+ this.resolveWaitingWorker?.();
294
+ this.resolveWaitingWorker = undefined;
295
+ this.waitingWorker = undefined;
254
296
  this.idleTask.clearTasks();
255
297
 
256
298
  for (const type of Object.keys(this.watcher.getTargetsList())) {
@@ -286,25 +328,99 @@ class Dep extends BaseService {
286
328
  }
287
329
  }
288
330
 
289
- private enqueueTask(node: MNode, target: Target, depExtendedData: DepExtendedData, deep: boolean) {
331
+ private enqueueTask(
332
+ node: MNode,
333
+ target: Target,
334
+ depExtendedData: DepExtendedData,
335
+ deep: boolean,
336
+ batch: CollectBatch,
337
+ ) {
338
+ const isDataSource = target.type === DepTargetType.DATA_SOURCE;
339
+
340
+ batch.pending += 1;
341
+ if (isDataSource) {
342
+ batch.dsPending += 1;
343
+ }
344
+
290
345
  this.idleTask.enqueueTask(
291
346
  ({ node, deep, target }) => {
292
- this.collectNode(node, target, depExtendedData, deep);
347
+ try {
348
+ this.collectNode(node, target, depExtendedData, deep);
349
+ } finally {
350
+ this.onBatchTaskDone(batch, isDataSource);
351
+ }
293
352
  },
294
353
  {
295
354
  node,
296
355
  deep: false,
297
356
  target,
298
357
  },
299
- target.type === DepTargetType.DATA_SOURCE,
358
+ isDataSource,
300
359
  );
301
360
 
302
361
  if (deep && Array.isArray(node.items) && node.items.length) {
303
362
  node.items.forEach((item) => {
304
- this.enqueueTask(item, target, depExtendedData, deep);
363
+ this.enqueueTask(item, target, depExtendedData, deep, batch);
305
364
  });
306
365
  }
307
366
  }
367
+
368
+ private onBatchTaskDone(batch: CollectBatch, isDataSource: boolean) {
369
+ if (isDataSource) {
370
+ batch.dsPending -= 1;
371
+ // 数据源依赖收集完先 resolve,让 stage 尽快更新,其余依赖继续在后台收集
372
+ if (batch.dsPending === 0) {
373
+ this.settleBatchDs(batch);
374
+ }
375
+ }
376
+
377
+ batch.pending -= 1;
378
+ if (batch.pending === 0) {
379
+ this.finishBatch(batch);
380
+ }
381
+ }
382
+
383
+ private settleBatchDs(batch: CollectBatch) {
384
+ if (batch.dsSettled) return;
385
+ batch.dsSettled = true;
386
+ this.emit('ds-collected', batch.nodes, batch.deep);
387
+ batch.resolve(true);
388
+ }
389
+
390
+ private finishBatch(batch: CollectBatch) {
391
+ if (!batch.collectedEmitted) {
392
+ batch.collectedEmitted = true;
393
+ this.emit('collected', batch.nodes, batch.deep);
394
+ }
395
+ // 没有数据源任务的批次在此结算 Promise
396
+ this.settleBatchDs(batch);
397
+ this.activeBatches.delete(batch);
398
+ this.updateCollectingState();
399
+ }
400
+
401
+ /**
402
+ * idleTask 被清空时,在途批次的任务不会再执行,必须主动结算,
403
+ * 否则对应的 collectIdle Promise 永远不会 resolve(collecting 卡在 true、once 监听器泄漏)。
404
+ * 收集被中断(通常紧跟一次全量重新收集),因此不再 emit collected/ds-collected,仅结算 Promise。
405
+ */
406
+ private abortActiveBatches() {
407
+ if (!this.activeBatches.size) {
408
+ return;
409
+ }
410
+
411
+ const batches = [...this.activeBatches];
412
+ this.activeBatches.clear();
413
+
414
+ for (const batch of batches) {
415
+ batch.resolve(false);
416
+ }
417
+
418
+ this.updateCollectingState();
419
+ }
420
+
421
+ private updateCollectingState() {
422
+ this.set('collecting', this.activeBatches.size > 0);
423
+ }
308
424
  }
309
425
 
310
426
  export type DepService = Dep;
@@ -26,7 +26,7 @@
26
26
  > .m-fields-group-list {
27
27
  > .tmagic-design-card--flat {
28
28
  > .el-card__header {
29
- padding: 16px 0;
29
+ padding: 8px 0;
30
30
  }
31
31
  }
32
32
  }
@@ -34,7 +34,7 @@
34
34
  .create-button {
35
35
  &.fullWidth {
36
36
  width: 100%;
37
- margin: 0 0 16px 0;
37
+ margin: 0 0 8px 0;
38
38
  }
39
39
  }
40
40
  }
@@ -1,8 +1,11 @@
1
1
  .m-fields-event-select {
2
2
  width: 100%;
3
3
  .fullWidth {
4
- width: 100%;
4
+ width: calc(100% - 32px);
5
5
  box-sizing: border-box;
6
+ &.create-button {
7
+ width: 100%;
8
+ }
6
9
  }
7
10
  .event-select-container {
8
11
  padding: 0 16px;
@@ -11,7 +14,7 @@
11
14
  border-bottom: 1px solid #ebeef5;
12
15
  }
13
16
  > .el-card__body {
14
- padding-bottom: 16px;
17
+ padding-bottom: 8px;
15
18
  .m-fields-group-list-footer {
16
19
  div {
17
20
  justify-content: flex-start !important;
@@ -19,7 +22,7 @@
19
22
  }
20
23
  .el-card.tmagic-design-card--flat {
21
24
  > .el-card__header {
22
- padding: 16px 0;
25
+ padding: 8px 0;
23
26
  }
24
27
  }
25
28
  }
@@ -76,17 +79,18 @@
76
79
  .event-item-header {
77
80
  position: relative;
78
81
  width: 100%;
82
+ display: flex;
83
+ align-items: center;
84
+ justify-content: space-between;
79
85
  .event-item-title {
80
86
  color: #0f1113;
81
87
  font-size: 16px;
82
88
  font-weight: 500;
83
89
  line-height: 24px;
84
- margin-bottom: 16px;
90
+ margin-bottom: 8px;
85
91
  }
86
92
  .event-item-delete-button {
87
- position: absolute;
88
- right: 0;
89
- top: 0;
93
+ color: #0f1113;
90
94
  }
91
95
 
92
96
  .el-form-item {
package/src/type.ts CHANGED
@@ -178,6 +178,11 @@ export interface StageOptions {
178
178
  containerHighlightClassName?: string;
179
179
  containerHighlightDuration?: number;
180
180
  containerHighlightType?: ContainerHighlightType;
181
+ /**
182
+ * 是否仅在新增组件(从组件列表拖入新组件)时才启用识别容器,
183
+ * 开启后在画布中拖动已有组件不会识别容器,默认 false
184
+ */
185
+ containerHighlightAddOnly?: boolean;
181
186
  disabledDragStart?: boolean;
182
187
  render?: (stage: StageCore) => HTMLDivElement | void | Promise<HTMLDivElement | void>;
183
188
  moveableOptions?: CustomizeMoveableOptions;
@@ -25,6 +25,12 @@ globalThis.requestIdleCallback =
25
25
  }, 1);
26
26
  };
27
27
 
28
+ globalThis.cancelIdleCallback =
29
+ globalThis.cancelIdleCallback ||
30
+ function (handle) {
31
+ clearTimeout(handle as unknown as ReturnType<typeof setTimeout>);
32
+ };
33
+
28
34
  export class IdleTask<T = any> extends EventEmitter {
29
35
  private taskList: TaskList<T> = [];
30
36
 
@@ -16,9 +16,6 @@
16
16
  * See the License for the specific language governing permissions and
17
17
  * limitations under the License.
18
18
  */
19
-
20
- import type { AppContext } from 'vue';
21
-
22
19
  import {
23
20
  HookType,
24
21
  NODE_CONDS_KEY,
@@ -27,18 +24,7 @@ import {
27
24
  NODE_DISABLE_DATA_SOURCE_KEY,
28
25
  } from '@tmagic/core';
29
26
  import { tMagicMessage } from '@tmagic/design';
30
- import type {
31
- ChildConfig,
32
- DisplayCondsConfig,
33
- FormConfig,
34
- FormState,
35
- FormValue,
36
- TabConfig,
37
- TabPaneConfig,
38
- } from '@tmagic/form';
39
- import { validateForm } from '@tmagic/form';
40
-
41
- import type { Services } from '@editor/type';
27
+ import type { ChildConfig, DisplayCondsConfig, FormConfig, TabConfig, TabPaneConfig } from '@tmagic/form';
42
28
 
43
29
  export const arrayOptions = [
44
30
  { text: '包含', value: 'include' },
@@ -403,86 +389,3 @@ export const removeStyleDisplayConfig = (formConfig: FormConfig): FormConfig =>
403
389
  }),
404
390
  };
405
391
  });
406
-
407
- // #region ValidatePropsFormOptions
408
- /**
409
- * validatePropsForm 参数
410
- */
411
- export interface ValidatePropsFormOptions {
412
- /** 组件属性表单配置 */
413
- config: FormConfig;
414
- /** 待校验的表单值 */
415
- values: FormValue;
416
- /**
417
- * 当前组件实例的 appContext(通常为 `getCurrentInstance()?.appContext`)。
418
- * 会与 services 一并合入临时 MForm 的 appContext,使编辑器字段组件(DataSourceInput 等)能正常 inject。
419
- */
420
- appContext?: AppContext | null;
421
- /** 编辑器服务集合,注入到临时表单的 formState */
422
- services?: Services;
423
- /** stage 实例,注入到临时表单的 formState */
424
- stage?: any;
425
- /** 外部扩展的 formState */
426
- extendState?: (_state: FormState) => Record<string, any> | Promise<Record<string, any>>;
427
- /**
428
- * 调试模式,默认 `true`:以弹层形式可见地渲染表单,点击「确定」才触发校验。
429
- * 置为 `false` 时静默挂载后自动校验。
430
- */
431
- debug?: boolean;
432
- typeMatchValid?: boolean;
433
- }
434
- // #endregion ValidatePropsFormOptions
435
-
436
- /**
437
- * 对一份「组件属性表单配置 + 值」做一次独立的校验,**不复用也不污染页面上正在展示的表单**。
438
- *
439
- * 内部基于 `@tmagic/form` 的 `validateForm` 另建一个独立的 MForm 实例完成校验,并统一处理
440
- * 编辑器场景所需的上下文注入:将当前组件实例的 provides 合入 appContext,并向 formState 注入
441
- * stage / services 及外部扩展状态,保证校验规则依赖的上下文可用。
442
- *
443
- * 常用于源码编辑器保存后,对最新配置做一次校验,并将校验结果(错误信息)随提交一并抛给上层记录,
444
- * 使源码保存的错误状态与表单编辑保持一致。
445
- *
446
- * @returns 校验通过返回空字符串 `''`,否则返回以 `<br>` 拼接的错误文案。
447
- * 仅在初始化超时或挂载失败等异常情况下才会 reject。
448
- *
449
- * @example
450
- * ```ts
451
- * const error = await validatePropsForm({
452
- * config,
453
- * values,
454
- * appContext: getCurrentInstance()?.appContext,
455
- * services,
456
- * stage: editorService.get('stage'),
457
- * extendState,
458
- * });
459
- * if (error) {
460
- * // 配置不合法,error 为错误文案
461
- * }
462
- * ```
463
- */
464
- export const validatePropsForm = ({
465
- config,
466
- values,
467
- appContext = null,
468
- services,
469
- stage,
470
- extendState,
471
- debug,
472
- typeMatchValid,
473
- }: ValidatePropsFormOptions): Promise<string> =>
474
- validateForm({
475
- config,
476
- debug,
477
- typeMatchValid,
478
- initValues: values,
479
- // 将当前组件实例的 provides(含 Editor 顶层的 services / codeOptions 等组件级 provide)
480
- // 合入 appContext,使临时 MForm 中的编辑器字段组件(DataSourceInput 等)能正常 inject
481
- appContext: appContext ? { ...appContext, provides: { services } } : null,
482
- // 与页面表单保持一致:注入 stage/services 及外部扩展状态,保证校验规则依赖的上下文可用
483
- extendState: async (state) => ({
484
- ...((await extendState?.(state)) || {}),
485
- stage,
486
- services,
487
- }),
488
- });
@@ -58,7 +58,7 @@ const stringifyExampleValue = (value: any): string => {
58
58
  };
59
59
 
60
60
  // 参考建议中最多展示的可选值个数,超出以「等」省略。
61
- const MAX_SUGGESTION_OPTIONS = 5;
61
+ const MAX_SUGGESTION_OPTIONS = 20;
62
62
 
63
63
  /**
64
64
  * 生成「请使用以下某一个值:xxx;xxx」形式的参考建议;无可选值时返回空字符串(不追加建议)。