st-comp 0.0.200 → 0.0.202

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 (154) hide show
  1. package/components.d.ts +3 -0
  2. package/es/ChartLayout.js +4 -4
  3. package/es/ConfigProvider.cjs +1 -1
  4. package/es/ConfigProvider.js +1 -1
  5. package/es/CustomFunction.cjs +1 -1
  6. package/es/CustomFunction.js +44 -40
  7. package/es/FactorWarning.cjs +1 -1
  8. package/es/FactorWarning.js +84 -78
  9. package/es/Kline.cjs +1 -1
  10. package/es/Kline.js +21 -19
  11. package/es/KlineBasic.cjs +1 -1
  12. package/es/KlineBasic.js +30 -28
  13. package/es/KlineConfig.cjs +1 -1
  14. package/es/KlineConfig.js +345 -331
  15. package/es/KlineNew.cjs +1 -1
  16. package/es/KlineNew.js +20 -18
  17. package/es/KlinePlus.cjs +4 -4
  18. package/es/KlinePlus.js +610 -588
  19. package/es/MonacoEditor.cjs +1 -1
  20. package/es/MonacoEditor.js +2 -2
  21. package/es/Pagination.cjs +1 -1
  22. package/es/Pagination.js +74 -72
  23. package/es/PasswordPrompt.cjs +1 -1
  24. package/es/PasswordPrompt.js +9 -157
  25. package/es/Pie.cjs +1 -1
  26. package/es/Pie.js +1 -1
  27. package/es/Table.cjs +1 -1
  28. package/es/Table.js +56 -52
  29. package/es/User.cjs +1 -1
  30. package/es/User.js +1313 -1
  31. package/es/VarSelectDialog.cjs +1 -1
  32. package/es/VarSelectDialog.js +28 -26
  33. package/es/VarietyAutoComplete.cjs +1 -1
  34. package/es/VarietyAutoComplete.js +19 -18
  35. package/es/VarietySearch.cjs +8 -8
  36. package/es/VarietySearch.js +704 -697
  37. package/es/VarietyTextCopy.cjs +1 -1
  38. package/es/VarietyTextCopy.js +12 -12
  39. package/es/VirtualTable.cjs +1 -1
  40. package/es/VirtualTable.js +80 -79
  41. package/es/{el-popover-5421d52a.cjs → _initCloneObject-52b6a510.cjs} +1 -1
  42. package/es/{el-popover-7a1c6412.js → _initCloneObject-eaef9418.js} +9 -9
  43. package/es/{base-8348063b.js → base-a5af3db3.js} +38 -38
  44. package/es/{castArray-3f45c3ec.js → castArray-7741a212.js} +1 -1
  45. package/es/{config-provider-eb0460f1.cjs → config-provider-a584d81e.cjs} +1 -1
  46. package/es/{config-provider-1a687690.js → config-provider-b16efd62.js} +6 -6
  47. package/es/debounce-62f5b6e8.cjs +1 -0
  48. package/es/debounce-8d53f4dd.js +83 -0
  49. package/es/dropdown-071c5d7e.cjs +1 -0
  50. package/es/dropdown-a59bba73.js +178 -0
  51. package/es/el-autocomplete-a07e9439.cjs +1 -0
  52. package/es/{el-autocomplete-d4cd96cd.js → el-autocomplete-ba808eb6.js} +16 -16
  53. package/es/{el-button-2e680390.js → el-button-c95adb85.js} +33 -33
  54. package/es/{el-button-4ccd7122.cjs → el-button-eec58cff.cjs} +1 -1
  55. package/es/el-checkbox-7421ccd3.js +459 -0
  56. package/es/el-checkbox-c25236a6.cjs +1 -0
  57. package/es/el-checkbox-group-0ea8fbf8.cjs +1 -0
  58. package/es/el-checkbox-group-4ed993c7.js +1 -0
  59. package/es/{el-dialog-bafc4b2b.js → el-dialog-41ab8417.js} +7 -6
  60. package/es/{el-dialog-6413b4af.cjs → el-dialog-ae86edb8.cjs} +1 -1
  61. package/es/{el-divider-93b0ee21.js → el-divider-4e059794.js} +1 -1
  62. package/es/{el-empty-56783dca.js → el-empty-33cb66f1.js} +3 -3
  63. package/es/el-form-item-c3fe189b.cjs +12 -0
  64. package/es/el-form-item-c53c374d.js +1269 -0
  65. package/es/{el-input-735575f4.js → el-input-2f75c4ba.js} +34 -34
  66. package/es/{el-input-6c5ac889.cjs → el-input-7fd293af.cjs} +1 -1
  67. package/es/{el-input-number-d5770776.cjs → el-input-number-22e21d16.cjs} +1 -1
  68. package/es/{el-input-number-6634a6ea.js → el-input-number-5193fe6d.js} +35 -35
  69. package/es/{el-loading-98dcebee.cjs → el-loading-cfd86c15.cjs} +1 -1
  70. package/es/{el-loading-049dacc5.js → el-loading-f6022062.js} +5 -5
  71. package/es/{el-menu-item-828bc6fa.cjs → el-menu-item-17dc717e.cjs} +1 -1
  72. package/es/{el-menu-item-8a210e21.js → el-menu-item-7e881203.js} +22 -22
  73. package/es/{el-message-a1ac37d4.cjs → el-message-5e6a6be9.cjs} +1 -1
  74. package/es/el-message-box-a93d2f6a.js +489 -0
  75. package/es/el-message-box-c10adb52.cjs +1 -0
  76. package/es/{el-message-def216ae.js → el-message-e544a8f5.js} +24 -24
  77. package/es/{el-overlay-4ea38eab.js → el-overlay-09ad71cd.js} +51 -51
  78. package/es/{el-overlay-69dfacb6.cjs → el-overlay-9e34965f.cjs} +1 -1
  79. package/es/{el-popconfirm-bdeceeb7.cjs → el-popconfirm-70a976bf.cjs} +1 -1
  80. package/es/{el-popconfirm-aace1104.js → el-popconfirm-81dcd202.js} +20 -20
  81. package/es/el-popover-0ea8fbf8.cjs +1 -0
  82. package/es/el-popover-4ed993c7.js +1 -0
  83. package/es/{el-popper-986a8371.js → el-popper-b4f97157.js} +115 -112
  84. package/es/{el-popper-b962125f.cjs → el-popper-b6c99b28.cjs} +1 -1
  85. package/es/el-scrollbar-323542e7.js +34 -0
  86. package/es/el-scrollbar-bc3f790d.cjs +1 -0
  87. package/es/{el-segmented-f892ec18.js → el-segmented-b868d074.js} +8 -8
  88. package/es/{el-segmented-6b057ed5.cjs → el-segmented-f8fce9ac.cjs} +1 -1
  89. package/es/{el-select-2189a8ac.js → el-select-95627997.js} +42 -41
  90. package/es/el-select-d8d91db1.cjs +1 -0
  91. package/es/el-table-column-376cd907.js +3432 -0
  92. package/es/el-table-column-c974cb96.cjs +14 -0
  93. package/es/{el-tag-75a7573a.js → el-tag-66cab138.js} +16 -16
  94. package/es/{el-tag-a15520b3.cjs → el-tag-a33c4b22.cjs} +1 -1
  95. package/es/{el-checkbox-group-e26a4533.js → el-text-ac60d0f2.js} +16 -16
  96. package/es/{el-checkbox-group-dfdad075.cjs → el-text-c20a9f48.cjs} +1 -1
  97. package/es/{index-1fb95601.cjs → index-098c2447.cjs} +1 -1
  98. package/es/{index-16802b35.cjs → index-11547a0c.cjs} +1 -1
  99. package/es/index-1f7d4f70.js +157 -0
  100. package/es/{index-680be212.cjs → index-298075cf.cjs} +1 -1
  101. package/es/index-57672682.js +113 -0
  102. package/es/{index-9cfb6ccf.js → index-7ed0999e.js} +2 -0
  103. package/es/{index-f3a86049.js → index-844bdd85.js} +29 -29
  104. package/es/index-88546436.js +163 -0
  105. package/es/{index-cc200b99.cjs → index-8901a38c.cjs} +1 -1
  106. package/es/{index-e00ee015.js → index-960806da.js} +36 -36
  107. package/es/index-9b9ef5dd.cjs +1 -0
  108. package/es/{index-847d58bc.js → index-a871c3eb.js} +92 -62
  109. package/es/{index-780e7fd2.js → index-bc8e277e.js} +2 -2
  110. package/es/{index-5e0314ac.cjs → index-c108567d.cjs} +1 -1
  111. package/es/{index-78381381.cjs → index-d725fef6.cjs} +2 -2
  112. package/es/{index-14c88a1a.js → index-d77a7336.js} +1 -1
  113. package/es/{index-f45c2897.js → index-d91dc23f.js} +20 -20
  114. package/es/{index-c94b9543.js → index-e5566b94.js} +43 -43
  115. package/es/index-f3562b52.cjs +1 -0
  116. package/es/index-f967d6c1.cjs +1 -0
  117. package/es/{python-2e916d28.cjs → python-c27ba105.cjs} +1 -1
  118. package/es/{python-7cf0b6ba.js → python-ecde9ff2.js} +2 -2
  119. package/es/{raf-8e5f0699.js → raf-80ef0c0a.js} +1 -1
  120. package/es/{scroll-c43468ab.js → scroll-679bd6bf.js} +1 -1
  121. package/es/style.css +1 -1
  122. package/es/{use-form-common-props-e6cba60f.js → use-form-common-props-815d48a6.js} +69 -69
  123. package/es/{use-form-common-props-d8866dc6.cjs → use-form-common-props-fd9b61a0.cjs} +1 -1
  124. package/es/{use-global-config-72d50e62.cjs → use-global-config-30d7d8ce.cjs} +1 -1
  125. package/es/{use-global-config-76ff2e3e.js → use-global-config-b5e9d3d5.js} +14 -14
  126. package/es/{validator-e759d43d.cjs → validator-1b8a6128.cjs} +1 -1
  127. package/es/{validator-220652c5.js → validator-764a9db0.js} +1 -1
  128. package/es/vnode-5ddb7ed1.js +14 -0
  129. package/es/vnode-b906ae6d.cjs +1 -0
  130. package/es/{zh-cn-33e7aee6.cjs → zh-cn-90317f62.cjs} +1 -1
  131. package/es/{zh-cn-c7fa42ea.js → zh-cn-e963c628.js} +2 -2
  132. package/lib/bundle.js +1 -1
  133. package/lib/bundle.umd.cjs +156 -156
  134. package/lib/{index-410c490f.js → index-a45d1494.js} +11238 -11207
  135. package/lib/{python-589861d2.js → python-82d17c8d.js} +1 -1
  136. package/lib/style.css +1 -1
  137. package/package.json +1 -1
  138. package/packages/KlineConfig/config.js +2 -0
  139. package/packages/KlineConfig/index.vue +9 -0
  140. package/packages/KlinePlus/index.vue +18 -8
  141. package/packages/KlinePlus/utils.js +41 -5
  142. package/src/pages/KlinePlus/index.vue +6 -5
  143. package/es/el-autocomplete-86c0d989.cjs +0 -1
  144. package/es/el-form-item-41becb31.js +0 -1749
  145. package/es/el-form-item-95476197.cjs +0 -12
  146. package/es/el-scrollbar-139aa96d.cjs +0 -1
  147. package/es/el-scrollbar-cdadd788.js +0 -115
  148. package/es/el-select-e1046cc6.cjs +0 -1
  149. package/es/el-table-column-91d69c86.js +0 -3882
  150. package/es/el-table-column-f1c4af89.cjs +0 -14
  151. package/es/index-56ea97a9.js +0 -122
  152. package/es/index-8583c047.cjs +0 -1
  153. package/es/index-ce63356a.cjs +0 -1
  154. package/es/index-db1e1861.js +0 -318
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "st-comp",
3
3
  "public": true,
4
- "version": "0.0.200",
4
+ "version": "0.0.202",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -13,6 +13,8 @@ export const getDefaultUserKlineConfig = () => {
13
13
  mainIndicator: "MA",
14
14
  // 成交点默认展示
15
15
  sellBuy: 1,
16
+ // 成交点默认按照实际价格标记
17
+ sellBuyByPrice: 1,
16
18
  // 单周期默认展示
17
19
  singelCycle: "6",
18
20
  // 多周期布局 2 4 6
@@ -113,6 +113,14 @@ defineExpose({
113
113
  />
114
114
  </el-select>
115
115
  </div>
116
+ <div class="setting-item">
117
+ <span class="label">开平点按价格标: </span>
118
+ <el-checkbox
119
+ v-model="form.sellBuyByPrice"
120
+ :true-value="1"
121
+ :false-value="0"
122
+ />
123
+ </div>
116
124
  <div class="setting-item">
117
125
  <span class="label">单周期: </span>
118
126
  <el-select
@@ -240,6 +248,7 @@ defineExpose({
240
248
  color: var(--el-text-color-primary);
241
249
  height: calc(100% - 80px);
242
250
  box-sizing: border-box;
251
+ padding-right: 10px;
243
252
  // 单行控制项
244
253
  .setting-item {
245
254
  width: 100%;
@@ -341,7 +341,7 @@ const draw = (params = { startValue: 0, endValue: 0 }) => {
341
341
  // 配置数据: 成交收益率曲线
342
342
  const { tradeIncomeRateLineData } = handleTradeIncomeRateLine(props.tradeIncomeRateData, props.cycle, props.incomeType, time);
343
343
  // 配置数据: 成交点位 + 连线
344
- const { tradePointData, tradeLineData } = handleMarkPointTradeLog(props.tradeLog, props.cycle, props.sellBuy, time, data);
344
+ const { tradePointData, tradeLineData } = handleMarkPointTradeLog(props.tradeLog, props.cycle, props.sellBuy, time, data, props.userKlineConfig);
345
345
 
346
346
  /**
347
347
  * @description: 渲染图表
@@ -643,22 +643,27 @@ const draw = (params = { startValue: 0, endValue: 0 }) => {
643
643
  // 图表: 绘制(当屏最高价)
644
644
  const drawScreenMaxPrice = () => {
645
645
  if (!props.userKlineConfig.enable_showScreenMaxPrice || !klineData.value.time.length) return;
646
+
646
647
  const { data } = klineData.value;
647
- const { startValue, endValue } = mainChartIns.getOption()?.dataZoom[0] ?? {};
648
+ const originOption = mainChartIns.getOption();
649
+ const { startValue, endValue } = originOption?.dataZoom[0] ?? {};
650
+
648
651
  let maxPrice = 0;
649
652
  let maxPriceIndex = startValue;
653
+
650
654
  for (let i = startValue; i <= endValue; i++) {
651
655
  if (Number(data[i][3]) >= maxPrice) {
652
656
  maxPrice = Number(data[i][3]);
653
657
  maxPriceIndex = i;
654
658
  }
655
659
  }
656
- const originOption = mainChartIns.getOption();
660
+
657
661
  const filterSeries = originOption.series?.filter((item) => item.name !== "maxPrice") || [];
658
662
  const dataLength = endValue - startValue;
659
663
  const positionInView = (maxPriceIndex - startValue) / dataLength;
660
664
  let position = "right";
661
665
  let formatter = `←${maxPrice}`;
666
+
662
667
  if (positionInView > 0.7) {
663
668
  position = "left";
664
669
  formatter = `${round(maxPrice)}→`;
@@ -666,24 +671,26 @@ const drawScreenMaxPrice = () => {
666
671
  position = "right";
667
672
  formatter = `←${round(maxPrice)}`;
668
673
  }
674
+
675
+ // 关键:只更新 series,不更新其他配置
669
676
  mainChartIns?.setOption(
670
677
  {
671
- ...originOption,
672
678
  series: [
673
679
  ...filterSeries,
674
680
  {
675
681
  type: "line",
676
682
  name: "maxPrice",
683
+ data: [],
684
+ lineStyle: { opacity: 0 },
677
685
  markPoint: {
678
- // 点位原本样式通过透明去进行隐藏, 从而仅展示文案
679
686
  symbol: "circle",
680
687
  symbolSize: 1,
681
688
  itemStyle: {
682
689
  color: "transparent",
683
690
  borderColor: "transparent",
684
691
  },
685
- z: 100, // 设置较高的 z 值,确保在最上层
686
- zlevel: 10, // 设置较高的 zlevel
692
+ z: 100,
693
+ zlevel: 10,
687
694
  label: {
688
695
  show: true,
689
696
  position,
@@ -702,7 +709,10 @@ const drawScreenMaxPrice = () => {
702
709
  },
703
710
  ],
704
711
  },
705
- true
712
+ {
713
+ notMerge: false, // 合并模式
714
+ replaceMerge: [], // 不替换任何配置
715
+ }
706
716
  );
707
717
  };
708
718
 
@@ -258,6 +258,30 @@ export const binarySearch = (arr, target, type = "strict") => {
258
258
  return type === "strict" ? -1 : result;
259
259
  };
260
260
 
261
+ /**
262
+ * @description: 统一兼容处理标记点Y轴偏移量问题
263
+ */
264
+ export const handleMarkPointOffset = (markPointData) => {
265
+ const data = [];
266
+ markPointData.reduce((result, item) => {
267
+ // 1. 找到当前标记的位置
268
+ const key = `${item.coord[0]}+${item.label.position}`;
269
+ const baseOffset = item.label.position === "top" ? -16 : 16;
270
+ // 2. 找到先前处于相同位置 [key] 标记的数量
271
+ const sameNum = result.get(key);
272
+ if (sameNum) {
273
+ result.set(key, sameNum + 1);
274
+ item.symbolOffset[1] = baseOffset * (sameNum + 1);
275
+ } else {
276
+ result.set(key, 1);
277
+ item.symbolOffset[1] = item.label.position === "top" ? -7 : 7;
278
+ }
279
+ data.push(item);
280
+ return result;
281
+ }, new Map());
282
+ return data;
283
+ };
284
+
261
285
  // K线数据合并
262
286
  export const mergeklineData = (leftData, rightData) => {
263
287
  return {
@@ -490,7 +514,7 @@ export const normalizeToKlineTimeByMatch = (klineTimeArray, timeRange, cycle) =>
490
514
  };
491
515
 
492
516
  // 生成图表配置所需数据: 成交点位, 成交点位连线
493
- export const handleMarkPointTradeLog = (tradeLog, cycle, sellBuy, klineTimeArray, klineDataArray) => {
517
+ export const handleMarkPointTradeLog = (tradeLog, cycle, sellBuy, klineTimeArray, klineDataArray, userKlineConfig) => {
494
518
  // 获取交易类型
495
519
  const handleTradeType = (data, type) => {
496
520
  const { direction = "", tradeAction = "", tradeType = "" } = data;
@@ -558,15 +582,22 @@ export const handleMarkPointTradeLog = (tradeLog, cycle, sellBuy, klineTimeArray
558
582
  return result;
559
583
  }, []);
560
584
  };
561
- // 交易点: 开平配置数据
585
+ // 交易点: 开平配置数据 (如果是价格, 则无需偏移, 如果是K线高低价, 则需要偏移)
562
586
  const handleOpenCloseConfig = (data, baseLineData, klineTimeAry, klineDataAry) => {
563
- return data.reduce((result, next, index) => {
587
+ const { sellBuyByPrice } = userKlineConfig;
588
+ const result = data.reduce((result, next, index) => {
564
589
  // 1.交易类型
565
590
  const tradeType = handleTradeType(next, 1);
566
591
  // 2.图标位置 [开在K线上方,平在K线下方]
567
592
  const position = ["开多", "开空"].includes(tradeType) ? "top" : "bottom";
568
- // 3.获取对应Y轴值
569
- const yAxisValue = position === "top" ? (next.openPriceAll / next.amount)?.toFixed(2) : (next.closePriceAll / next.amount)?.toFixed(2);
593
+ // 3.获取对应Y轴值 [根据自定义配置判断, 是按价格还是直接用K线的最高低价]
594
+ let yAxisValue = null;
595
+ if (sellBuyByPrice) {
596
+ yAxisValue = position === "top" ? (next.openPriceAll / next.amount)?.toFixed(2) : (next.closePriceAll / next.amount)?.toFixed(2);
597
+ } else {
598
+ const klineIndex = binarySearch(klineTimeAry, next.klineTime);
599
+ yAxisValue = position === "top" ? klineDataAry[klineIndex]?.[3] : klineDataAry[klineIndex]?.[2];
600
+ }
570
601
  // 4.将Y轴值存到连线的数据中, 提供给连线配置使用
571
602
  baseLineData.forEach((item) => {
572
603
  const rangeTime = position === "top" ? item.range[0] : item.range[1];
@@ -598,6 +629,11 @@ export const handleMarkPointTradeLog = (tradeLog, cycle, sellBuy, klineTimeArray
598
629
  });
599
630
  return result;
600
631
  }, []);
632
+ if (sellBuyByPrice) {
633
+ return result;
634
+ } else {
635
+ return handleMarkPointOffset(result);
636
+ }
601
637
  };
602
638
  // 交易点: 生成基础点位, 连线数据
603
639
  const handleTradePointLineData = (tradeLog, cycle, klineTimeArray) => {
@@ -79,6 +79,7 @@ const varietyCode = ref("Z000012");
79
79
  const varietyStock = ref(1); // 0: 期货, 1: 股票, 2: 期权
80
80
  const tradeLog = ref(tradeLogMock);
81
81
  const netPositionData = ref([]);
82
+ const pageType = ref(1);
82
83
  const cycle = ref("5");
83
84
  const sellBuy = ref(1);
84
85
  const rightType = ref(1);
@@ -172,7 +173,7 @@ const handleUserKlineConfig = async (action, formJson) => {
172
173
  // 更新配置数据
173
174
  Object.assign(userKlineConfig, JSON.parse(formJson));
174
175
  // 默认值 [自定义配置]
175
- // pageType.value = userKlineConfig.pageType;
176
+ pageType.value = userKlineConfig.pageType;
176
177
  cycle.value = userKlineConfig.singelCycle;
177
178
  sellBuy.value = userKlineConfig.sellBuy;
178
179
  mainIndicator.value = userKlineConfig.mainIndicator;
@@ -195,10 +196,10 @@ onMounted(async () => {
195
196
  initTimeRange.value = getTimeRange(params);
196
197
 
197
198
  // 默认值 [自定义配置]
198
- // pageType.value = userKlineConfig.pageType;
199
- // cycle.value = userKlineConfig.singelCycle;
200
- // sellBuy.value = userKlineConfig.sellBuy;
201
- // mainIndicator.value = userKlineConfig.mainIndicator;
199
+ pageType.value = userKlineConfig.pageType;
200
+ cycle.value = userKlineConfig.singelCycle;
201
+ sellBuy.value = userKlineConfig.sellBuy;
202
+ mainIndicator.value = userKlineConfig.mainIndicator;
202
203
 
203
204
  setTimeout(() => {
204
205
  loading.value = false;
@@ -1 +0,0 @@
1
- "use strict";const e=require("vue"),K=require("./use-form-common-props-d8866dc6.cjs"),M=require("./index-1fb95601.cjs"),S=require("./el-input-6c5ac889.cjs"),se=require("./index-680be212.cjs"),u=require("./el-popper-b962125f.cjs"),n=require("./base-ef747d02.cjs"),re=require("./index-9780a537.cjs"),ae=require("./el-scrollbar-139aa96d.cjs"),ue=n.buildProps({...S.inputProps,valueKey:{type:String,default:"value"},modelValue:{type:[String,Number],default:""},debounce:{type:Number,default:300},placement:{type:n.definePropType(String),values:["top","top-start","top-end","bottom","bottom-start","bottom-end"],default:"bottom-start"},fetchSuggestions:{type:n.definePropType([Function,Array]),default:n.NOOP},popperClass:{type:String,default:""},triggerOnFocus:{type:Boolean,default:!0},selectWhenUnmatched:Boolean,hideLoading:Boolean,teleported:u.useTooltipContentProps.teleported,appendTo:u.useTooltipContentProps.appendTo,highlightFirstItem:Boolean,fitInputWidth:Boolean}),ie={[u.UPDATE_MODEL_EVENT]:s=>n.isString(s)||n.isNumber(s),[u.INPUT_EVENT]:s=>n.isString(s)||n.isNumber(s),[u.CHANGE_EVENT]:s=>n.isString(s)||n.isNumber(s),focus:s=>s instanceof FocusEvent,blur:s=>s instanceof FocusEvent,clear:()=>!0,select:s=>n.isObject(s)},U="ElAutocomplete",ce=e.defineComponent({name:U,inheritAttrs:!1}),de=e.defineComponent({...ce,props:ue,emits:ie,setup(s,{expose:z,emit:d}){const a=s,L=e.computed(()=>u.pick(a,Object.keys(S.inputProps))),R=e.useAttrs(),T=K.useFormDisabled(),i=n.useNamespace("autocomplete"),f=e.ref(),$=e.ref(),b=e.ref(),A=e.ref();let P=!1,C=!1;const p=e.ref([]),r=e.ref(-1),V=e.ref(""),v=e.ref(!1),E=e.ref(!1),m=e.ref(!1),h=re.useId(),W=e.computed(()=>R.style),g=e.computed(()=>(p.value.length>0||m.value)&&v.value),I=e.computed(()=>!a.hideLoading&&m.value),H=e.computed(()=>f.value?Array.from(f.value.$el.querySelectorAll("input")):[]),x=()=>{g.value&&(V.value=`${f.value.$el.offsetWidth}px`)},G=()=>{r.value=-1},_=async t=>{if(E.value)return;const o=l=>{m.value=!1,!E.value&&(n.isArray(l)?(p.value=l,r.value=a.highlightFirstItem?0:-1):u.throwError(U,"autocomplete suggestions must be an array"))};if(m.value=!0,n.isArray(a.fetchSuggestions))o(a.fetchSuggestions);else{const l=await a.fetchSuggestions(t,o);n.isArray(l)&&o(l)}},B=ae.debounce(_,a.debounce),j=t=>{const o=!!t;if(d(u.INPUT_EVENT,t),d(u.UPDATE_MODEL_EVENT,t),E.value=!1,v.value||(v.value=o),!a.triggerOnFocus&&!t){E.value=!0,p.value=[];return}B(t)},J=t=>{var o;T.value||(((o=t.target)==null?void 0:o.tagName)!=="INPUT"||H.value.includes(document.activeElement))&&(v.value=!0)},Q=t=>{d(u.CHANGE_EVENT,t)},X=t=>{var o;if(C)C=!1;else{v.value=!0,d("focus",t);const l=(o=a.modelValue)!=null?o:"";a.triggerOnFocus&&!P&&B(String(l))}},Y=t=>{setTimeout(()=>{var o;if((o=b.value)!=null&&o.isFocusInsideContent()){C=!0;return}v.value&&y(),d("blur",t)})},Z=()=>{v.value=!1,d(u.UPDATE_MODEL_EVENT,""),d("clear")},D=async()=>{var t;(t=f.value)!=null&&t.isComposing||(g.value&&r.value>=0&&r.value<p.value.length?w(p.value[r.value]):a.selectWhenUnmatched&&(d("select",{value:a.modelValue}),p.value=[],r.value=-1))},ee=t=>{g.value&&(t.preventDefault(),t.stopPropagation(),y())},y=()=>{v.value=!1},te=()=>{var t;(t=f.value)==null||t.focus()},oe=()=>{var t;(t=f.value)==null||t.blur()},w=async t=>{d(u.INPUT_EVENT,t[a.valueKey]),d(u.UPDATE_MODEL_EVENT,t[a.valueKey]),d("select",t),p.value=[],r.value=-1},k=t=>{var o,l;if(!g.value||m.value)return;if(t<0){r.value=-1;return}t>=p.value.length&&(t=p.value.length-1);const c=$.value.querySelector(`.${i.be("suggestion","wrap")}`),ne=c.querySelectorAll(`.${i.be("suggestion","list")} li`)[t],O=c.scrollTop,{offsetTop:q,scrollHeight:N}=ne;q+N>O+c.clientHeight&&(c.scrollTop+=N),q<O&&(c.scrollTop-=N),r.value=t,(l=(o=f.value)==null?void 0:o.ref)==null||l.setAttribute("aria-activedescendant",`${h.value}-item-${r.value}`)},F=K.onClickOutside(A,()=>{var t;(t=b.value)!=null&&t.isFocusInsideContent()||g.value&&y()});return e.onBeforeUnmount(()=>{F==null||F()}),e.onMounted(()=>{var t;const o=(t=f.value)==null?void 0:t.ref;o&&([{key:"role",value:"textbox"},{key:"aria-autocomplete",value:"list"},{key:"aria-controls",value:"id"},{key:"aria-activedescendant",value:`${h.value}-item-${r.value}`}].forEach(({key:l,value:c})=>o.setAttribute(l,c)),P=o.hasAttribute("readonly"))}),z({highlightedIndex:r,activated:v,loading:m,inputRef:f,popperRef:b,suggestions:p,handleSelect:w,handleKeyEnter:D,focus:te,blur:oe,close:y,highlight:k,getData:_}),(t,o)=>(e.openBlock(),e.createBlock(e.unref(u.ElTooltip),{ref_key:"popperRef",ref:b,visible:e.unref(g),placement:t.placement,"fallback-placements":["bottom-start","top-start"],"popper-class":[e.unref(i).e("popper"),t.popperClass],teleported:t.teleported,"append-to":t.appendTo,"gpu-acceleration":!1,pure:"","manual-mode":"",effect:"light",trigger:"click",transition:`${e.unref(i).namespace.value}-zoom-in-top`,persistent:"",role:"listbox",onBeforeShow:x,onHide:G},{content:e.withCtx(()=>[e.createElementVNode("div",{ref_key:"regionRef",ref:$,class:e.normalizeClass([e.unref(i).b("suggestion"),e.unref(i).is("loading",e.unref(I))]),style:e.normalizeStyle({[t.fitInputWidth?"width":"minWidth"]:V.value,outline:"none"}),role:"region"},[t.$slots.header?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(i).be("suggestion","header")),onClick:e.withModifiers(()=>{},["stop"])},[e.renderSlot(t.$slots,"header")],10,["onClick"])):e.createCommentVNode("v-if",!0),e.createVNode(e.unref(se.ElScrollbar),{id:e.unref(h),tag:"ul","wrap-class":e.unref(i).be("suggestion","wrap"),"view-class":e.unref(i).be("suggestion","list"),role:"listbox"},{default:e.withCtx(()=>[e.unref(I)?(e.openBlock(),e.createElementBlock("li",{key:0},[e.renderSlot(t.$slots,"loading",{},()=>[e.createVNode(e.unref(M.ElIcon),{class:e.normalizeClass(e.unref(i).is("loading"))},{default:e.withCtx(()=>[e.createVNode(e.unref(M.loading_default))]),_:1},8,["class"])])])):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(p.value,(l,c)=>(e.openBlock(),e.createElementBlock("li",{id:`${e.unref(h)}-item-${c}`,key:c,class:e.normalizeClass({highlighted:r.value===c}),role:"option","aria-selected":r.value===c,onClick:le=>w(l)},[e.renderSlot(t.$slots,"default",{item:l},()=>[e.createTextVNode(e.toDisplayString(l[t.valueKey]),1)])],10,["id","aria-selected","onClick"]))),128))]),_:3},8,["id","wrap-class","view-class"]),t.$slots.footer?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(i).be("suggestion","footer")),onClick:e.withModifiers(()=>{},["stop"])},[e.renderSlot(t.$slots,"footer")],10,["onClick"])):e.createCommentVNode("v-if",!0)],6)]),default:e.withCtx(()=>[e.createElementVNode("div",{ref_key:"listboxRef",ref:A,class:e.normalizeClass([e.unref(i).b(),t.$attrs.class]),style:e.normalizeStyle(e.unref(W)),role:"combobox","aria-haspopup":"listbox","aria-expanded":e.unref(g),"aria-owns":e.unref(h)},[e.createVNode(e.unref(S.ElInput),e.mergeProps({ref_key:"inputRef",ref:f},e.mergeProps(e.unref(L),t.$attrs),{"model-value":t.modelValue,disabled:e.unref(T),onInput:j,onChange:Q,onFocus:X,onBlur:Y,onClear:Z,onKeydown:[e.withKeys(e.withModifiers(l=>k(r.value-1),["prevent"]),["up"]),e.withKeys(e.withModifiers(l=>k(r.value+1),["prevent"]),["down"]),e.withKeys(D,["enter"]),e.withKeys(y,["tab"]),e.withKeys(ee,["esc"])],onMousedown:J}),e.createSlots({_:2},[t.$slots.prepend?{name:"prepend",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"prepend")])}:void 0,t.$slots.append?{name:"append",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"append")])}:void 0,t.$slots.prefix?{name:"prefix",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"prefix")])}:void 0,t.$slots.suffix?{name:"suffix",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"suffix")])}:void 0]),1040,["model-value","disabled","onKeydown"])],14,["aria-expanded","aria-owns"])]),_:3},8,["visible","placement","popper-class","teleported","append-to","transition"]))}});var pe=n._export_sfc(de,[["__file","autocomplete.vue"]]);const fe=n.withInstall(pe);exports.ElAutocomplete=fe;