@whitesev/pops 2.3.8 → 2.4.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.
package/dist/index.esm.js CHANGED
@@ -2524,6 +2524,36 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
2524
2524
  transformTop: transform_top,
2525
2525
  };
2526
2526
  }
2527
+ /**
2528
+ * 监input、textarea的输入框值改变的事件
2529
+ */
2530
+ onInput($el, callback, option) {
2531
+ let isComposite = false;
2532
+ let __callback = async (event) => {
2533
+ if (isComposite)
2534
+ return;
2535
+ await callback(event);
2536
+ };
2537
+ let __composition_start_callback = () => {
2538
+ isComposite = true;
2539
+ };
2540
+ let __composition_end_callback = () => {
2541
+ isComposite = false;
2542
+ this.trigger($el, "input", {
2543
+ isComposite,
2544
+ });
2545
+ };
2546
+ this.on($el, "input", __callback, option);
2547
+ this.on($el, "compositionstart", __composition_start_callback, option);
2548
+ this.on($el, "compositionend", __composition_end_callback, option);
2549
+ return {
2550
+ off: () => {
2551
+ this.off($el, "input", __callback, option);
2552
+ this.off($el, "compositionstart", __composition_start_callback, option);
2553
+ this.off($el, "compositionend", __composition_end_callback, option);
2554
+ },
2555
+ };
2556
+ }
2527
2557
  }
2528
2558
  const popsDOMUtils = new PopsDOMUtils();
2529
2559
 
@@ -10890,6 +10920,22 @@ const searchSuggestionConfig = () => {
10890
10920
  data.push({
10891
10921
  value: `测试${index}`,
10892
10922
  text: `测试${index}-html`,
10923
+ enableDeleteButton: true,
10924
+ deleteButtonClickCallback(event, $dataItem, dataItem, config) {
10925
+ console.log("删除当前项", [event, $dataItem, dataItem, config]);
10926
+ return true;
10927
+ },
10928
+ itemView(dateItem, $parent) {
10929
+ return dateItem.text;
10930
+ },
10931
+ clickCallback(event, $dataItem, dataItem, config) {
10932
+ console.log("item项的点击回调", [event, $dataItem, data, config]);
10933
+ // config.inputTarget!.value = dataItem.value;
10934
+ return index % 2 === 0 ? true : false;
10935
+ },
10936
+ selectCallback(event, $dataItem, dataItem, config) {
10937
+ console.log("item项的选中回调", [event, $dataItem, data, config]);
10938
+ },
10893
10939
  });
10894
10940
  }
10895
10941
  return {
@@ -10899,14 +10945,6 @@ const searchSuggestionConfig = () => {
10899
10945
  inputTarget: null,
10900
10946
  selfDocument: document,
10901
10947
  data: data,
10902
- deleteIcon: {
10903
- enable: true,
10904
- callback(event, liElement, dataItem) {
10905
- console.log("删除当前项", [event, liElement, dataItem]);
10906
- data.splice(data.indexOf(dataItem), 1);
10907
- liElement.remove();
10908
- },
10909
- },
10910
10948
  useShadowRoot: true,
10911
10949
  className: "",
10912
10950
  isAbsolute: true,
@@ -10924,20 +10962,10 @@ const searchSuggestionConfig = () => {
10924
10962
  toSearhNotResultHTML: '<li data-none="true">暂无其它数据</li>',
10925
10963
  toHideWithNotResult: false,
10926
10964
  followPosition: "target",
10927
- getItemHTML(item) {
10928
- return item.text ?? item;
10929
- },
10930
- async getData(value, data) {
10965
+ async inputTargetChangeRefreshShowDataCallback(value, data) {
10931
10966
  console.log("当前输入框的值是:", value);
10932
10967
  return data.filter((it) => it.value.includes(value));
10933
10968
  },
10934
- itemClickCallBack(event, liElement, data) {
10935
- console.log("item项的点击回调", [event, liElement, data]);
10936
- this.inputTarget.value = data.value;
10937
- },
10938
- selectCallBack(event, liElement, data) {
10939
- console.log("item项的选中回调", [event, liElement, data]);
10940
- },
10941
10969
  style: "",
10942
10970
  };
10943
10971
  };
@@ -10997,33 +11025,49 @@ const PopsSearchSuggestion = {
10997
11025
  /** 动态更新CSS */
10998
11026
  $dynamicCSS: null,
10999
11027
  },
11028
+ $evt: {
11029
+ offInputChangeEvtHandler: [],
11030
+ },
11000
11031
  $data: {
11001
11032
  /** 是否结果为空 */
11002
11033
  isEmpty: true,
11003
11034
  },
11004
- /** 初始化元素变量 */
11005
- initEl() {
11006
- this.$el.root = SearchSuggestion.createSearchSelectElement();
11007
- this.$el.$dynamicCSS = this.$el.root.querySelector("style[data-dynamic]");
11008
- this.$el.$hintULContainer = SearchSuggestion.$el.root.querySelector("ul");
11009
- },
11010
11035
  /**
11011
11036
  * 初始化
11037
+ * @param parentElement 父元素
11012
11038
  */
11013
11039
  init(parentElement = document.body || document.documentElement) {
11014
- this.initEl();
11015
- SearchSuggestion.update(this.getData());
11040
+ SearchSuggestion.initEl();
11041
+ SearchSuggestion.update(SearchSuggestion.getData());
11016
11042
  SearchSuggestion.updateStyleSheet();
11017
11043
  SearchSuggestion.hide();
11018
11044
  $shadowRoot.appendChild(SearchSuggestion.$el.root);
11019
11045
  parentElement.appendChild($shadowContainer);
11020
11046
  },
11047
+ /**
11048
+ * 初始化元素变量
11049
+ */
11050
+ initEl() {
11051
+ SearchSuggestion.$el.root = SearchSuggestion.createSearchSelectElement();
11052
+ Reflect.set(SearchSuggestion.$el.root, "data-SearchSuggestion", SearchSuggestion);
11053
+ SearchSuggestion.$el.$dynamicCSS =
11054
+ SearchSuggestion.$el.root.querySelector("style[data-dynamic]");
11055
+ SearchSuggestion.$el.$hintULContainer =
11056
+ SearchSuggestion.$el.root.querySelector("ul");
11057
+ },
11021
11058
  /**
11022
11059
  * 获取数据
11023
11060
  */
11024
11061
  getData() {
11025
11062
  return typeof config.data === "function" ? config.data() : config.data;
11026
11063
  },
11064
+ /**
11065
+ * 更新数据
11066
+ * @param data 数据
11067
+ */
11068
+ setData(data) {
11069
+ config.data = data;
11070
+ },
11027
11071
  /**
11028
11072
  * 获取显示出搜索建议框的html
11029
11073
  */
@@ -11106,7 +11150,7 @@ const PopsSearchSuggestion = {
11106
11150
  }
11107
11151
  </style>
11108
11152
  <style type="text/css" data-dynamic="true">
11109
- ${this.getDynamicCSS()}
11153
+ ${SearchSuggestion.getDynamicCSS()}
11110
11154
  </style>
11111
11155
  <style>
11112
11156
  .el-zoom-in-top-animation{
@@ -11148,7 +11192,9 @@ const PopsSearchSuggestion = {
11148
11192
  }
11149
11193
  return $el;
11150
11194
  },
11151
- /** 动态获取CSS */
11195
+ /**
11196
+ * 动态获取CSS
11197
+ */
11152
11198
  getDynamicCSS() {
11153
11199
  return /*css*/ `
11154
11200
  .pops-${popsType}-search-suggestion{
@@ -11213,53 +11259,82 @@ const PopsSearchSuggestion = {
11213
11259
  }
11214
11260
  `;
11215
11261
  },
11262
+ /**
11263
+ * 获取data-value值
11264
+ * @param data 数据项
11265
+ */
11266
+ getItemDataValue(data) {
11267
+ return data;
11268
+ },
11216
11269
  /**
11217
11270
  * 获取显示出搜索建议框的每一项的html
11218
- * @param data 当前项的值
11219
- * @param index 当前项的下标
11271
+ * @param dataItem 当前项的值
11272
+ * @param dateItemIndex 当前项的下标
11220
11273
  */
11221
- createSearchItemLiElement(data, index) {
11274
+ createSearchItemLiElement(dataItem, dateItemIndex) {
11275
+ const dataValue = SearchSuggestion.getItemDataValue(dataItem);
11222
11276
  let $li = popsDOMUtils.createElement("li", {
11223
11277
  className: `pops-${popsType}-search-suggestion-hint-item`,
11224
- "data-index": index,
11225
- "data-value": SearchSuggestion.getItemDataValue(data),
11226
- innerHTML: `${config.getItemHTML(data)}${config.deleteIcon.enable ? SearchSuggestion.getDeleteIconHTML() : ""}`,
11278
+ "data-index": dateItemIndex,
11279
+ "data-value": dataValue,
11227
11280
  });
11281
+ Reflect.set($li, "data-index", dateItemIndex);
11282
+ Reflect.set($li, "data-value", dataValue);
11283
+ // 项内容
11284
+ let $itemInner = dataItem.itemView(dataItem, $li, config);
11285
+ if (typeof $itemInner === "string") {
11286
+ PopsSafeUtils.setSafeHTML($li, $itemInner);
11287
+ }
11288
+ else {
11289
+ popsDOMUtils.append($li, $itemInner);
11290
+ }
11291
+ // 删除按钮
11292
+ const enableDeleteButton = dataItem.enableDeleteButton;
11293
+ if (typeof enableDeleteButton === "boolean" && enableDeleteButton) {
11294
+ let $deleteIcon = SearchSuggestion.createItemDeleteIcon();
11295
+ popsDOMUtils.append($li, $deleteIcon);
11296
+ }
11228
11297
  popsDOMUtils.addClassName($li, PopsCommonCSSClassName.flexCenter);
11229
11298
  popsDOMUtils.addClassName($li, PopsCommonCSSClassName.flexYCenter);
11230
11299
  return $li;
11231
11300
  },
11232
- /**
11233
- * 获取data-value值
11234
- * @param data
11235
- */
11236
- getItemDataValue(data) {
11237
- return data;
11238
- },
11239
11301
  /**
11240
11302
  * 设置搜索建议框每一项的点击事件
11241
- * @param $searchItem
11303
+ * @param $searchItem 当前项的元素
11242
11304
  */
11243
11305
  setSearchItemClickEvent($searchItem) {
11244
- popsDOMUtils.on($searchItem, "click", (event) => {
11306
+ popsDOMUtils.on($searchItem, "click", async (event) => {
11245
11307
  popsDOMUtils.preventEvent(event);
11246
11308
  let $click = event.target;
11247
- let dataValue = Reflect.get($searchItem, "data-value");
11309
+ const data = SearchSuggestion.getData();
11310
+ const dataItem = Reflect.get($searchItem, "data-value");
11248
11311
  let isDelete = Boolean($click.closest(`.pops-${popsType}-delete-icon`));
11249
11312
  if (isDelete) {
11250
11313
  // 删除
11251
- if (typeof config.deleteIcon.callback === "function") {
11252
- config.deleteIcon.callback(event, $searchItem, dataValue);
11314
+ if (typeof dataItem.deleteButtonClickCallback === "function") {
11315
+ let result = await dataItem.deleteButtonClickCallback(event, $searchItem, dataItem, config);
11316
+ if (typeof result === "boolean" && result) {
11317
+ data.splice(data.indexOf(dataItem), 1);
11318
+ $searchItem.remove();
11319
+ }
11253
11320
  }
11254
- if (!this.$el.$hintULContainer.children.length) {
11321
+ if (!SearchSuggestion.$el.$hintULContainer.children.length) {
11255
11322
  /* 全删完了 */
11256
- this.clear();
11323
+ SearchSuggestion.clear();
11257
11324
  }
11258
11325
  SearchSuggestion.updateStyleSheet();
11259
11326
  }
11260
11327
  else {
11261
11328
  // 点击选择项
11262
- config.itemClickCallBack(event, $searchItem, dataValue);
11329
+ if (typeof dataItem.clickCallback === "function") {
11330
+ let result = await dataItem.clickCallback(event, $searchItem, dataItem, config);
11331
+ if (typeof result === "boolean" && result) {
11332
+ if (config.inputTarget instanceof HTMLInputElement ||
11333
+ config.inputTarget instanceof HTMLTextAreaElement) {
11334
+ config.inputTarget.value = String(dataItem.value);
11335
+ }
11336
+ }
11337
+ }
11263
11338
  }
11264
11339
  }, {
11265
11340
  capture: true,
@@ -11298,11 +11373,13 @@ const PopsSearchSuggestion = {
11298
11373
  /* 禁用输入框自动提示 */
11299
11374
  config.inputTarget.setAttribute("autocomplete", "off");
11300
11375
  /* 内容改变事件 */
11301
- popsDOMUtils.on(config.inputTarget, "input", void 0, async (event) => {
11302
- let getListResult = await config.getData(config.inputTarget.value, this.getData());
11303
- SearchSuggestion.update(getListResult);
11376
+ const listenerHandler = popsDOMUtils.onInput(config.inputTarget, async (event) => {
11377
+ const data = SearchSuggestion.getData();
11378
+ let queryDataResult = await config.inputTargetChangeRefreshShowDataCallback(config.inputTarget.value, data, config);
11379
+ SearchSuggestion.update(queryDataResult);
11304
11380
  SearchSuggestion.updateStyleSheet();
11305
11381
  }, option);
11382
+ SearchSuggestion.$evt.offInputChangeEvtHandler.push(listenerHandler.off);
11306
11383
  },
11307
11384
  /**
11308
11385
  * 移除输入框内容改变的监听
@@ -11310,7 +11387,12 @@ const PopsSearchSuggestion = {
11310
11387
  removeInputChangeEvent(option = {
11311
11388
  capture: true,
11312
11389
  }) {
11313
- popsDOMUtils.off(config.inputTarget, "input", void 0, void 0, option);
11390
+ for (let index = 0; index < SearchSuggestion.$evt.offInputChangeEvtHandler.length; index++) {
11391
+ const handler = SearchSuggestion.$evt.offInputChangeEvtHandler[index];
11392
+ handler();
11393
+ SearchSuggestion.$evt.offInputChangeEvtHandler.splice(index, 1);
11394
+ index--;
11395
+ }
11314
11396
  },
11315
11397
  /**
11316
11398
  * 显示搜索建议框的事件
@@ -11436,23 +11518,24 @@ const PopsSearchSuggestion = {
11436
11518
  /**
11437
11519
  * 获取删除按钮的html
11438
11520
  */
11439
- getDeleteIconHTML(size = 16, fill = "#bababa") {
11440
- return /*html*/ `
11441
- <svg class="pops-${popsType}-delete-icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" fill="${fill}">
11442
- <path d="M512 883.2A371.2 371.2 0 1 0 140.8 512 371.2 371.2 0 0 0 512 883.2z m0 64a435.2 435.2 0 1 1 435.2-435.2 435.2 435.2 0 0 1-435.2 435.2z"></path>
11443
- <path d="M557.056 512l122.368 122.368a31.744 31.744 0 1 1-45.056 45.056L512 557.056l-122.368 122.368a31.744 31.744 0 1 1-45.056-45.056L466.944 512 344.576 389.632a31.744 31.744 0 1 1 45.056-45.056L512 466.944l122.368-122.368a31.744 31.744 0 1 1 45.056 45.056z"></path>
11444
- </svg>
11445
- `;
11521
+ createItemDeleteIcon(size = 16, fill = "#bababa") {
11522
+ let $svg = popsDOMUtils.parseTextToDOM(/*html*/ `
11523
+ <svg class="pops-${popsType}-delete-icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" fill="${fill}">
11524
+ <path d="M512 883.2A371.2 371.2 0 1 0 140.8 512 371.2 371.2 0 0 0 512 883.2z m0 64a435.2 435.2 0 1 1 435.2-435.2 435.2 435.2 0 0 1-435.2 435.2z"></path>
11525
+ <path d="M557.056 512l122.368 122.368a31.744 31.744 0 1 1-45.056 45.056L512 557.056l-122.368 122.368a31.744 31.744 0 1 1-45.056-45.056L466.944 512 344.576 389.632a31.744 31.744 0 1 1 45.056-45.056L512 466.944l122.368-122.368a31.744 31.744 0 1 1 45.056 45.056z"></path>
11526
+ </svg>
11527
+ `);
11528
+ return $svg;
11446
11529
  },
11447
11530
  /**
11448
11531
  * 设置当前正在搜索中的提示
11449
11532
  */
11450
11533
  setPromptsInSearch() {
11451
- let isSearchingElement = popsDOMUtils.createElement("li", {
11534
+ let $isSearching = popsDOMUtils.createElement("li", {
11452
11535
  className: `pops-${popsType}-search-suggestion-hint-searching-item`,
11453
11536
  innerHTML: config.searchingTip,
11454
11537
  });
11455
- SearchSuggestion.$el.$hintULContainer.appendChild(isSearchingElement);
11538
+ SearchSuggestion.addItem($isSearching);
11456
11539
  },
11457
11540
  /**
11458
11541
  * 移除正在搜索中的提示
@@ -11462,17 +11545,13 @@ const PopsSearchSuggestion = {
11462
11545
  .querySelector(`li.pops-${popsType}-search-suggestion-hint-searching-item`)
11463
11546
  ?.remove();
11464
11547
  },
11465
- /**
11466
- * 清空所有的搜索结果
11467
- */
11468
- clearAllSearchItemLi() {
11469
- PopsSafeUtils.setSafeHTML(SearchSuggestion.$el.$hintULContainer, "");
11470
- },
11471
11548
  /**
11472
11549
  * 更新搜索建议框的位置(top、left)
11473
11550
  * 因为目标元素可能是动态隐藏的
11551
+ * @param target 目标元素
11552
+ * @param checkPositonAgain 是否在更新位置信息后检测更新位置信息,默认true
11474
11553
  */
11475
- changeHintULElementPosition(target = config.target ?? config.inputTarget) {
11554
+ changeHintULElementPosition(target = config.target ?? config.inputTarget, checkPositonAgain = true) {
11476
11555
  let targetRect = null;
11477
11556
  if (config.followPosition === "inputCursor") {
11478
11557
  targetRect = popsDOMUtils.getTextBoundingRect(config.inputTarget, config.inputTarget.selectionStart || 0, config.inputTarget.selectionEnd || 0, false);
@@ -11496,6 +11575,7 @@ const PopsSearchSuggestion = {
11496
11575
  // 需目标高度+搜索建议框高度大于文档高度,则显示在上面
11497
11576
  let targetBottom = targetRect.bottom;
11498
11577
  let searchSuggestionContainerHeight = popsDOMUtils.height(SearchSuggestion.$el.$hintULContainer);
11578
+ console.log(targetBottom, searchSuggestionContainerHeight, targetBottom + searchSuggestionContainerHeight, documentHeight);
11499
11579
  if (targetBottom + searchSuggestionContainerHeight > documentHeight) {
11500
11580
  // 在上面
11501
11581
  position = "top";
@@ -11536,10 +11616,19 @@ const PopsSearchSuggestion = {
11536
11616
  left = left + documentWidth - hintUIWidth;
11537
11617
  }
11538
11618
  SearchSuggestion.$el.root.style.left = left + "px";
11619
+ // 如果更新前在下面的话且高度超出了屏幕
11620
+ // 这时候会有滚动条,会造成位置偏移
11621
+ // 更新后的位置却在上面,这时候的位置信息不对齐
11622
+ // 需重新更新位置
11623
+ // 此情况一般是config.position === "auto"
11624
+ if (checkPositonAgain) {
11625
+ SearchSuggestion.changeHintULElementPosition(target, !checkPositonAgain);
11626
+ }
11539
11627
  },
11540
11628
  /**
11541
11629
  * 更新搜索建议框的width
11542
11630
  * 因为目标元素可能是动态隐藏的
11631
+ * @param target 目标元素
11543
11632
  */
11544
11633
  changeHintULElementWidth(target = config.target ?? config.inputTarget) {
11545
11634
  let targetRect = target.getBoundingClientRect();
@@ -11554,11 +11643,15 @@ const PopsSearchSuggestion = {
11554
11643
  * 动态更新CSS
11555
11644
  */
11556
11645
  updateDynamicCSS() {
11557
- let cssText = this.getDynamicCSS();
11558
- PopsSafeUtils.setSafeHTML(this.$el.$dynamicCSS, cssText);
11646
+ let cssText = SearchSuggestion.getDynamicCSS();
11647
+ PopsSafeUtils.setSafeHTML(SearchSuggestion.$el.$dynamicCSS, cssText);
11559
11648
  },
11560
11649
  /**
11561
11650
  * 数据项的数量改变时调用
11651
+ *
11652
+ * - 更新css
11653
+ * - 更新建议框的宽度
11654
+ * - 更新建议框的位置
11562
11655
  */
11563
11656
  updateStyleSheet() {
11564
11657
  // 更新z-index
@@ -11568,29 +11661,38 @@ const PopsSearchSuggestion = {
11568
11661
  // 更新位置
11569
11662
  SearchSuggestion.changeHintULElementPosition();
11570
11663
  },
11664
+ /**
11665
+ * 添加搜索结果元素
11666
+ * @param $item 项元素
11667
+ */
11668
+ addItem($item) {
11669
+ SearchSuggestion.$el.$hintULContainer.appendChild($item);
11670
+ },
11571
11671
  /**
11572
11672
  * 更新页面显示的搜索结果
11573
- * @param data
11673
+ * @param updateData
11574
11674
  */
11575
- update(data = []) {
11576
- if (!Array.isArray(data)) {
11675
+ update(updateData = []) {
11676
+ if (!Array.isArray(updateData)) {
11577
11677
  throw new TypeError("传入的数据不是数组");
11578
11678
  }
11579
- config.data = data;
11679
+ const data = updateData;
11580
11680
  /* 清空已有的搜索结果 */
11581
- if (config.data.length) {
11681
+ if (data.length) {
11582
11682
  SearchSuggestion.$data.isEmpty = false;
11583
11683
  if (config.toHideWithNotResult) {
11584
11684
  SearchSuggestion.show();
11585
11685
  }
11586
- SearchSuggestion.clearAllSearchItemLi();
11686
+ SearchSuggestion.clear(true);
11587
11687
  /* 添加进ul中 */
11588
- config.data.forEach((item, index) => {
11589
- let itemElement = SearchSuggestion.createSearchItemLiElement(item, index);
11590
- SearchSuggestion.setSearchItemClickEvent(itemElement);
11591
- SearchSuggestion.setSearchItemSelectEvent(itemElement);
11592
- SearchSuggestion.$el.$hintULContainer.appendChild(itemElement);
11688
+ let fragment = document.createDocumentFragment();
11689
+ data.forEach((item, index) => {
11690
+ let $item = SearchSuggestion.createSearchItemLiElement(item, index);
11691
+ SearchSuggestion.setSearchItemClickEvent($item);
11692
+ SearchSuggestion.setSearchItemSelectEvent($item);
11693
+ fragment.appendChild($item);
11593
11694
  });
11695
+ SearchSuggestion.addItem(fragment);
11594
11696
  }
11595
11697
  else {
11596
11698
  /* 清空 */
@@ -11599,13 +11701,24 @@ const PopsSearchSuggestion = {
11599
11701
  },
11600
11702
  /**
11601
11703
  * 清空当前的搜索结果并显示无结果
11704
+ * @param [onlyClearView=false] 是否仅清空元素,默认false
11602
11705
  */
11603
- clear() {
11604
- this.$data.isEmpty = true;
11605
- this.clearAllSearchItemLi();
11606
- this.$el.$hintULContainer.appendChild(popsDOMUtils.parseTextToDOM(config.toSearhNotResultHTML));
11706
+ clear(onlyClearView = false) {
11707
+ PopsSafeUtils.setSafeHTML(SearchSuggestion.$el.$hintULContainer, "");
11708
+ if (onlyClearView) {
11709
+ return;
11710
+ }
11711
+ SearchSuggestion.$data.isEmpty = true;
11712
+ let $noResult;
11713
+ if (typeof config.toSearhNotResultHTML === "string") {
11714
+ $noResult = popsDOMUtils.parseTextToDOM(config.toSearhNotResultHTML);
11715
+ }
11716
+ else {
11717
+ $noResult = config.toSearhNotResultHTML();
11718
+ }
11719
+ SearchSuggestion.addItem($noResult);
11607
11720
  if (config.toHideWithNotResult) {
11608
- this.hide();
11721
+ SearchSuggestion.hide();
11609
11722
  }
11610
11723
  },
11611
11724
  /**
@@ -11616,25 +11729,25 @@ const PopsSearchSuggestion = {
11616
11729
  if (config.useFoldAnimation) {
11617
11730
  if (!useAnimationToHide) {
11618
11731
  // 去掉动画
11619
- popsDOMUtils.removeClassName(this.$el.root, "el-zoom-in-top-animation");
11732
+ popsDOMUtils.removeClassName(SearchSuggestion.$el.root, "el-zoom-in-top-animation");
11620
11733
  }
11621
- popsDOMUtils.addClassName(this.$el.root, "el-zoom-in-top-animation");
11622
- popsDOMUtils.addClassName(this.$el.root, "el-zoom-in-top-animation-hide");
11623
- popsDOMUtils.removeClassName(this.$el.root, "el-zoom-in-top-animation-show");
11734
+ popsDOMUtils.addClassName(SearchSuggestion.$el.root, "el-zoom-in-top-animation");
11735
+ popsDOMUtils.addClassName(SearchSuggestion.$el.root, "el-zoom-in-top-animation-hide");
11736
+ popsDOMUtils.removeClassName(SearchSuggestion.$el.root, "el-zoom-in-top-animation-show");
11624
11737
  }
11625
11738
  else {
11626
- this.$el.root.style.display = "none";
11739
+ SearchSuggestion.$el.root.style.display = "none";
11627
11740
  }
11628
11741
  },
11629
11742
  /**
11630
11743
  * 显示搜索建议框
11631
11744
  */
11632
11745
  show() {
11633
- this.$el.root.style.display = "";
11746
+ SearchSuggestion.$el.root.style.display = "";
11634
11747
  if (config.useFoldAnimation) {
11635
- popsDOMUtils.addClassName(this.$el.root, "el-zoom-in-top-animation");
11636
- popsDOMUtils.removeClassName(this.$el.root, "el-zoom-in-top-animation-hide");
11637
- popsDOMUtils.addClassName(this.$el.root, "el-zoom-in-top-animation-show");
11748
+ popsDOMUtils.addClassName(SearchSuggestion.$el.root, "el-zoom-in-top-animation");
11749
+ popsDOMUtils.removeClassName(SearchSuggestion.$el.root, "el-zoom-in-top-animation-hide");
11750
+ popsDOMUtils.addClassName(SearchSuggestion.$el.root, "el-zoom-in-top-animation-show");
11638
11751
  }
11639
11752
  },
11640
11753
  };
@@ -11646,7 +11759,7 @@ class Pops {
11646
11759
  /** 配置 */
11647
11760
  config = {
11648
11761
  /** 版本号 */
11649
- version: "2025.9.2",
11762
+ version: "2025.9.4",
11650
11763
  cssText: PopsCSS,
11651
11764
  /** icon图标的svg代码 */
11652
11765
  iconSVG: PopsIcon.$data,