hys-ui 0.1.0 → 0.2.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 (247) hide show
  1. package/CHANGELOG.md +137 -1
  2. package/README.md +18 -6
  3. package/dist/components/HysAccordion/HysAccordion.vue.js +1 -1
  4. package/dist/components/HysAccordion/HysAccordion2.vue.js +181 -47
  5. package/dist/components/HysAlert/HysAlert.vue.js +14 -14
  6. package/dist/components/HysAnimatedNumber/HysAnimatedNumber.vue.js +23 -20
  7. package/dist/components/HysAutocomplete/HysAutocomplete.vue.js +7 -0
  8. package/dist/components/HysAutocomplete/HysAutocomplete2.vue.js +627 -0
  9. package/dist/components/HysAvatar/HysAvatar.vue.js +5 -35
  10. package/dist/components/HysAvatar/HysAvatar2.vue.js +221 -2
  11. package/dist/components/HysAvatarGroup/HysAvatarGroup.vue.js +7 -0
  12. package/dist/components/HysAvatarGroup/HysAvatarGroup2.vue.js +252 -0
  13. package/dist/components/HysBadge/HysBadge.vue.js +2 -2
  14. package/dist/components/HysBadge/HysBadge2.vue.js +154 -26
  15. package/dist/components/HysBreadcrumb/HysBreadcrumb.vue.js +5 -38
  16. package/dist/components/HysBreadcrumb/HysBreadcrumb2.vue.js +74 -2
  17. package/dist/components/HysButton/HysButton.vue.js +2 -2
  18. package/dist/components/HysButton/HysButton2.vue.js +29 -28
  19. package/dist/components/HysCalendar/HysCalendar.vue.js +5 -84
  20. package/dist/components/HysCalendar/HysCalendar2.vue.js +803 -2
  21. package/dist/components/HysCard/HysCard.vue.js +1 -1
  22. package/dist/components/HysCard/HysCard2.vue.js +177 -44
  23. package/dist/components/HysCascader/HysCascader.vue.js +5 -182
  24. package/dist/components/HysCascader/HysCascader2.vue.js +760 -2
  25. package/dist/components/HysCascader/HysCascaderColumn.vue.js +7 -0
  26. package/dist/components/HysCascader/HysCascaderColumn2.vue.js +232 -0
  27. package/dist/components/HysCheckbox/HysCheckbox.vue.js +5 -39
  28. package/dist/components/HysCheckbox/HysCheckbox2.vue.js +200 -2
  29. package/dist/components/HysCheckboxGroup/HysCheckboxGroup.vue.js +7 -0
  30. package/dist/components/HysCheckboxGroup/HysCheckboxGroup2.vue.js +237 -0
  31. package/dist/components/HysColorPicker/HysColorPicker.vue.js +2 -2
  32. package/dist/components/HysColorPicker/HysColorPicker2.vue.js +107 -106
  33. package/dist/components/HysCommandPalette/HysCommandPalette.vue.js +52 -51
  34. package/dist/components/HysCommentEditor/HysCommentEditor.vue.js +17 -17
  35. package/dist/components/HysDataGrid/HysDataGrid.vue.js +1 -1
  36. package/dist/components/HysDataGrid/HysDataGrid2.vue.js +397 -390
  37. package/dist/components/HysDatePicker/HysDatePicker.vue.js +268 -139
  38. package/dist/components/HysDatePicker/HysDatePickerControl.vue.js +7 -0
  39. package/dist/components/HysDatePicker/HysDatePickerControl2.vue.js +807 -0
  40. package/dist/components/HysDatePicker/HysDatePickerPanel.vue.js +7 -0
  41. package/dist/components/HysDatePicker/HysDatePickerPanel2.vue.js +357 -0
  42. package/dist/components/HysDateRangePicker/HysDateRangePicker.vue.js +268 -158
  43. package/dist/components/HysDivider/HysDivider.vue.js +2 -2
  44. package/dist/components/HysDivider/HysDivider2.vue.js +33 -13
  45. package/dist/components/HysDrawer/HysDrawer.vue.js +1 -1
  46. package/dist/components/HysDrawer/HysDrawer2.vue.js +55 -54
  47. package/dist/components/HysFileManager/HysFileManager.vue.js +5 -63
  48. package/dist/components/HysFileManager/HysFileManager2.vue.js +86 -2
  49. package/dist/components/HysForm/HysForm.vue.js +3 -3
  50. package/dist/components/HysForm/HysForm2.vue.js +580 -92
  51. package/dist/components/HysFormItem/HysFormItem.vue.js +5 -69
  52. package/dist/components/HysFormItem/HysFormItem2.vue.js +521 -2
  53. package/dist/components/HysGantt/HysGantt.vue.js +5 -264
  54. package/dist/components/HysGantt/HysGantt2.vue.js +1399 -2
  55. package/dist/components/HysInput/HysInput.vue.js +2 -2
  56. package/dist/components/HysInput/HysInput2.vue.js +468 -120
  57. package/dist/components/HysMention/HysMention.vue.js +2 -2
  58. package/dist/components/HysMention/HysMention2.vue.js +89 -88
  59. package/dist/components/HysModal/HysModal.vue.js +2 -2
  60. package/dist/components/HysModal/HysModal2.vue.js +35 -35
  61. package/dist/components/HysNotificationCenter/HysNotificationCenter.vue.js +37 -36
  62. package/dist/components/HysNumberInput/HysNumberInput.vue.js +2 -2
  63. package/dist/components/HysNumberInput/HysNumberInput2.vue.js +561 -70
  64. package/dist/components/HysOrgTree/HysOrgTree.vue.js +41 -36
  65. package/dist/components/HysPagination/HysPagination.vue.js +2 -2
  66. package/dist/components/HysPagination/HysPagination2.vue.js +93 -91
  67. package/dist/components/HysPermissionMatrix/HysPermissionMatrix.vue.js +5 -41
  68. package/dist/components/HysPermissionMatrix/HysPermissionMatrix2.vue.js +101 -2
  69. package/dist/components/HysRadio/HysRadio.vue.js +7 -0
  70. package/dist/components/HysRadio/HysRadio2.vue.js +180 -0
  71. package/dist/components/HysRadioGroup/HysRadioGroup.vue.js +5 -40
  72. package/dist/components/HysRadioGroup/HysRadioGroup2.vue.js +205 -2
  73. package/dist/components/HysRating/HysRating.vue.js +1 -1
  74. package/dist/components/HysRating/HysRating2.vue.js +288 -68
  75. package/dist/components/HysResizablePanel/HysResizablePanel.vue.js +46 -28
  76. package/dist/components/HysRichTextEditor/HysRichTextEditor.vue.js +2 -2
  77. package/dist/components/HysRichTextEditor/HysRichTextEditor2.vue.js +87 -67
  78. package/dist/components/HysSearch/HysSearch.vue.js +50 -38
  79. package/dist/components/HysSegmented/HysSegmented.vue.js +5 -58
  80. package/dist/components/HysSegmented/HysSegmented2.vue.js +273 -2
  81. package/dist/components/HysSelect/HysSelect.vue.js +3 -2
  82. package/dist/components/HysSelect/HysSelect2.vue.js +859 -164
  83. package/dist/components/HysSkeleton/HysSkeleton.vue.js +2 -2
  84. package/dist/components/HysSkeleton/HysSkeleton2.vue.js +126 -29
  85. package/dist/components/HysSlider/HysSlider.vue.js +2 -2
  86. package/dist/components/HysSlider/HysSlider2.vue.js +532 -59
  87. package/dist/components/HysSlider/SliderTooltip.vue.js +7 -0
  88. package/dist/components/HysSlider/SliderTooltip2.vue.js +156 -0
  89. package/dist/components/HysSplitPane/HysSplitPane.vue.js +48 -42
  90. package/dist/components/HysSteps/HysSteps.vue.js +2 -2
  91. package/dist/components/HysSteps/HysSteps2.vue.js +111 -36
  92. package/dist/components/HysSwitch/HysSwitch.vue.js +2 -2
  93. package/dist/components/HysSwitch/HysSwitch2.vue.js +235 -42
  94. package/dist/components/HysTable/HysTable.vue.js +1 -1
  95. package/dist/components/HysTable/HysTable2.vue.js +1471 -82
  96. package/dist/components/HysTable/HysTableFilterOptions.vue.js +7 -0
  97. package/dist/components/HysTable/HysTableFilterOptions2.vue.js +133 -0
  98. package/dist/components/HysTabs/HysTabs.vue.js +2 -2
  99. package/dist/components/HysTabs/HysTabs2.vue.js +262 -66
  100. package/dist/components/HysTagInput/HysTagInput.vue.js +43 -42
  101. package/dist/components/HysTextarea/HysTextarea.vue.js +137 -66
  102. package/dist/components/HysToast/HysToast.vue.js +2 -2
  103. package/dist/components/HysToast/HysToast2.vue.js +121 -38
  104. package/dist/components/HysTour/HysTour.vue.js +47 -42
  105. package/dist/components/HysTransfer/HysTransfer.vue.js +5 -207
  106. package/dist/components/HysTransfer/HysTransfer2.vue.js +416 -2
  107. package/dist/components/HysTransfer/HysTransferPanel.vue.js +7 -0
  108. package/dist/components/HysTransfer/HysTransferPanel2.vue.js +454 -0
  109. package/dist/components/HysTree/HysTree.vue.js +2 -3
  110. package/dist/components/HysTree/HysTree2.vue.js +641 -301
  111. package/dist/components/HysTreeSelect/HysTreeSelect.vue.js +5 -129
  112. package/dist/components/HysTreeSelect/HysTreeSelect2.vue.js +558 -2
  113. package/dist/components/HysTreeSelect/HysTreeSelectPanel.vue.js +7 -0
  114. package/dist/components/HysTreeSelect/HysTreeSelectPanel2.vue.js +323 -0
  115. package/dist/components/HysUpload/HysUpload.vue.js +2 -2
  116. package/dist/components/HysUpload/HysUpload2.vue.js +97 -78
  117. package/dist/composables/autocomplete.js +50 -0
  118. package/dist/composables/avatar.js +57 -0
  119. package/dist/composables/calendar.js +96 -0
  120. package/dist/composables/cascader.js +79 -0
  121. package/dist/composables/choice.js +38 -0
  122. package/dist/composables/choiceModel.js +67 -0
  123. package/dist/composables/datePicker.js +227 -0
  124. package/dist/composables/formContext.js +94 -3
  125. package/dist/composables/formLayout.js +57 -0
  126. package/dist/composables/formValidation.js +240 -0
  127. package/dist/composables/ganttConflicts.js +143 -0
  128. package/dist/composables/numberInput.js +91 -0
  129. package/dist/composables/rating.js +16 -0
  130. package/dist/composables/selectOptions.js +54 -0
  131. package/dist/composables/table.js +150 -0
  132. package/dist/composables/textInput.js +34 -0
  133. package/dist/composables/toastEscape.js +16 -0
  134. package/dist/composables/transfer.js +63 -0
  135. package/dist/composables/tree.js +118 -0
  136. package/dist/composables/treeSelect.js +71 -0
  137. package/dist/composables/useCascader.js +438 -0
  138. package/dist/composables/useDatePicker.js +425 -0
  139. package/dist/composables/useDialog.js +16 -16
  140. package/dist/composables/useFloating.js +98 -52
  141. package/dist/composables/useGanttDependencies.js +306 -0
  142. package/dist/composables/useGanttHistory.js +157 -0
  143. package/dist/composables/useGanttLabelResize.js +100 -0
  144. package/dist/composables/useHysToast.js +148 -0
  145. package/dist/composables/useTable.js +474 -0
  146. package/dist/composables/useTextareaSize.js +72 -0
  147. package/dist/composables/useTransfer.js +257 -0
  148. package/dist/composables/useTree.js +439 -0
  149. package/dist/composables/useTreeSelect.js +361 -0
  150. package/dist/config.js +18 -15
  151. package/dist/index.js +149 -136
  152. package/dist/style.css +1 -1
  153. package/dist/types/components/HysAccordion/HysAccordion.vue.d.ts +61 -22
  154. package/dist/types/components/HysAutocomplete/HysAutocomplete.vue.d.ts +201 -0
  155. package/dist/types/components/HysAvatar/HysAvatar.vue.d.ts +28 -15
  156. package/dist/types/components/HysAvatarGroup/HysAvatarGroup.vue.d.ts +99 -0
  157. package/dist/types/components/HysBadge/HysBadge.vue.d.ts +41 -4
  158. package/dist/types/components/HysBreadcrumb/HysBreadcrumb.vue.d.ts +38 -10
  159. package/dist/types/components/HysButton/HysButton.vue.d.ts +0 -1
  160. package/dist/types/components/HysCalendar/HysCalendar.vue.d.ts +119 -29
  161. package/dist/types/components/HysCard/HysCard.vue.d.ts +57 -5
  162. package/dist/types/components/HysCascader/HysCascader.vue.d.ts +129 -41
  163. package/dist/types/components/HysCascader/HysCascaderColumn.vue.d.ts +55 -0
  164. package/dist/types/components/HysCheckbox/HysCheckbox.vue.d.ts +55 -27
  165. package/dist/types/components/HysCheckboxGroup/HysCheckboxGroup.vue.d.ts +73 -0
  166. package/dist/types/components/HysDataGrid/HysDataGrid.vue.d.ts +1 -1
  167. package/dist/types/components/HysDatePicker/HysDatePicker.vue.d.ts +66 -14
  168. package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +90 -0
  169. package/dist/types/components/HysDatePicker/HysDatePickerPanel.vue.d.ts +93 -0
  170. package/dist/types/components/HysDateRangePicker/HysDateRangePicker.vue.d.ts +66 -14
  171. package/dist/types/components/HysDivider/HysDivider.vue.d.ts +8 -3
  172. package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +1 -0
  173. package/dist/types/components/HysFileManager/HysFileManager.vue.d.ts +8 -4
  174. package/dist/types/components/HysForm/HysForm.vue.d.ts +110 -18
  175. package/dist/types/components/HysFormItem/HysFormItem.vue.d.ts +108 -2
  176. package/dist/types/components/HysGantt/HysGantt.vue.d.ts +88 -4
  177. package/dist/types/components/HysInput/HysInput.vue.d.ts +52 -29
  178. package/dist/types/components/HysMention/HysMention.vue.d.ts +2 -2
  179. package/dist/types/components/HysNumberInput/HysNumberInput.vue.d.ts +93 -33
  180. package/dist/types/components/HysOrgTree/HysOrgTree.vue.d.ts +4 -1
  181. package/dist/types/components/HysPagination/HysPagination.vue.d.ts +1 -1
  182. package/dist/types/components/HysPermissionMatrix/HysPermissionMatrix.vue.d.ts +8 -1
  183. package/dist/types/components/HysPopover/HysPopover.vue.d.ts +3 -3
  184. package/dist/types/components/HysProgress/HysProgress.vue.d.ts +1 -1
  185. package/dist/types/components/HysRadio/HysRadio.vue.d.ts +56 -0
  186. package/dist/types/components/HysRadioGroup/HysRadioGroup.vue.d.ts +62 -17
  187. package/dist/types/components/HysRating/HysRating.vue.d.ts +85 -5
  188. package/dist/types/components/HysResizablePanel/HysResizablePanel.vue.d.ts +6 -0
  189. package/dist/types/components/HysRichTextEditor/HysRichTextEditor.vue.d.ts +4 -4
  190. package/dist/types/components/HysSearch/HysSearch.vue.d.ts +2 -2
  191. package/dist/types/components/HysSegmented/HysSegmented.vue.d.ts +64 -32
  192. package/dist/types/components/HysSelect/HysSelect.vue.d.ts +120 -14
  193. package/dist/types/components/HysSkeleton/HysSkeleton.vue.d.ts +30 -2
  194. package/dist/types/components/HysSlider/HysSlider.vue.d.ts +66 -9
  195. package/dist/types/components/HysSlider/SliderTooltip.vue.d.ts +22 -0
  196. package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +6 -0
  197. package/dist/types/components/HysSteps/HysSteps.vue.d.ts +65 -9
  198. package/dist/types/components/HysSwitch/HysSwitch.vue.d.ts +76 -17
  199. package/dist/types/components/HysTable/HysTable.vue.d.ts +206 -32
  200. package/dist/types/components/HysTable/HysTableFilterOptions.vue.d.ts +18 -0
  201. package/dist/types/components/HysTabs/HysTabs.vue.d.ts +76 -23
  202. package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +5 -5
  203. package/dist/types/components/HysTextarea/HysTextarea.vue.d.ts +44 -27
  204. package/dist/types/components/HysToast/HysToast.vue.d.ts +55 -7
  205. package/dist/types/components/HysTour/HysTour.vue.d.ts +5 -3
  206. package/dist/types/components/HysTransfer/HysTransfer.vue.d.ts +55 -30
  207. package/dist/types/components/HysTransfer/HysTransferPanel.vue.d.ts +105 -0
  208. package/dist/types/components/HysTree/HysTree.vue.d.ts +140 -73
  209. package/dist/types/components/HysTreeSelect/HysTreeSelect.vue.d.ts +102 -23
  210. package/dist/types/components/HysTreeSelect/HysTreeSelectPanel.vue.d.ts +56 -0
  211. package/dist/types/composables/autocomplete.d.ts +106 -0
  212. package/dist/types/composables/avatar.d.ts +70 -0
  213. package/dist/types/composables/calendar.d.ts +66 -0
  214. package/dist/types/composables/cascader.d.ts +192 -0
  215. package/dist/types/composables/choice.d.ts +110 -0
  216. package/dist/types/composables/choiceModel.d.ts +11 -0
  217. package/dist/types/composables/datePicker.d.ts +247 -0
  218. package/dist/types/composables/formContext.d.ts +138 -8
  219. package/dist/types/composables/formLayout.d.ts +11 -0
  220. package/dist/types/composables/formValidation.d.ts +13 -0
  221. package/dist/types/composables/gantt.d.ts +68 -0
  222. package/dist/types/composables/ganttConflicts.d.ts +30 -0
  223. package/dist/types/composables/numberInput.d.ts +45 -0
  224. package/dist/types/composables/rating.d.ts +18 -0
  225. package/dist/types/composables/segmented.d.ts +15 -0
  226. package/dist/types/composables/selectOptions.d.ts +44 -0
  227. package/dist/types/composables/slider.d.ts +21 -0
  228. package/dist/types/composables/table.d.ts +309 -0
  229. package/dist/types/composables/textInput.d.ts +76 -0
  230. package/dist/types/composables/toastEscape.d.ts +1 -0
  231. package/dist/types/composables/transfer.d.ts +180 -0
  232. package/dist/types/composables/tree.d.ts +237 -0
  233. package/dist/types/composables/treeSelect.d.ts +167 -0
  234. package/dist/types/composables/useCascader.d.ts +162 -0
  235. package/dist/types/composables/useDatePicker.d.ts +79 -0
  236. package/dist/types/composables/useFloating.d.ts +8 -5
  237. package/dist/types/composables/useGanttDependencies.d.ts +83 -0
  238. package/dist/types/composables/useGanttHistory.d.ts +42 -0
  239. package/dist/types/composables/useGanttLabelResize.d.ts +23 -0
  240. package/dist/types/composables/useHysToast.d.ts +50 -0
  241. package/dist/types/composables/useTable.d.ts +60 -0
  242. package/dist/types/composables/useTextareaSize.d.ts +3 -0
  243. package/dist/types/composables/useTransfer.d.ts +58 -0
  244. package/dist/types/composables/useTree.d.ts +77 -0
  245. package/dist/types/composables/useTreeSelect.d.ts +117 -0
  246. package/dist/types/index.d.ts +38 -7
  247. package/package.json +47 -11
@@ -0,0 +1,627 @@
1
+ import { defineComponent as vt, useAttrs as ft, inject as je, ref as x, useId as pt, shallowRef as Ge, computed as c, watch as M, nextTick as $, onUpdated as yt, onMounted as ht, onActivated as mt, onDeactivated as gt, onBeforeUnmount as bt, openBlock as f, createElementBlock as k, Fragment as be, createElementVNode as le, mergeProps as Me, unref as h, renderSlot as p, createVNode as Fe, createSlots as kt, withCtx as oe, createBlock as Ye, createCommentVNode as ie, Teleport as St, normalizeStyle as At, createTextVNode as ke, toDisplayString as ue, renderList as xt, withModifiers as Bt, normalizeClass as Ct } from "vue";
2
+ import { LoaderCircle as Je, RotateCw as Tt } from "lucide-vue-next";
3
+ import $t from "../HysInput/HysInput.vue.js";
4
+ import { useHysRootAttrs as Pt } from "../../config.js";
5
+ import { fieldKey as Kt, formKey as Ot, useHysControlState as Mt } from "../../composables/formContext.js";
6
+ import { useFloating as Ft } from "../../composables/useFloating.js";
7
+ import { normalizeAutocomplete as Lt, autocompleteValue as Xe } from "../../composables/autocomplete.js";
8
+ const Vt = ["id"], Et = {
9
+ key: 0,
10
+ class: "hys-ui-autocomplete-header"
11
+ }, Dt = ["id", "aria-label", "aria-busy"], qt = {
12
+ key: 0,
13
+ class: "hys-ui-autocomplete-state",
14
+ role: "status"
15
+ }, It = {
16
+ key: 1,
17
+ class: "hys-ui-autocomplete-state hys-ui-autocomplete-error",
18
+ role: "status"
19
+ }, wt = {
20
+ key: 0,
21
+ role: "presentation",
22
+ class: "hys-ui-autocomplete-group"
23
+ }, Ht = ["id", "aria-disabled", "aria-selected", "onMouseenter", "onClick"], Nt = ["title"], Rt = {
24
+ key: 0,
25
+ class: "hys-ui-autocomplete-state",
26
+ role: "status"
27
+ }, zt = {
28
+ key: 1,
29
+ class: "hys-ui-autocomplete-footer"
30
+ }, Ze = 'a[href],button:not(:disabled),input:not(:disabled),textarea:not(:disabled),select:not(:disabled),[tabindex]:not([tabindex="-1"])', Xt = /* @__PURE__ */ vt({
31
+ inheritAttrs: !1,
32
+ __name: "HysAutocomplete",
33
+ props: {
34
+ modelValue: {},
35
+ defaultValue: { default: "" },
36
+ options: { default: () => [] },
37
+ fetchSuggestions: {},
38
+ valueKey: { default: "value" },
39
+ labelKey: { default: "label" },
40
+ filterOption: { type: [Boolean, Function], default: void 0 },
41
+ caseSensitive: { type: Boolean, default: !1 },
42
+ debounce: { default: 300 },
43
+ minQueryLength: { default: 0 },
44
+ triggerOnFocus: { type: Boolean, default: !0 },
45
+ highlightFirst: { type: Boolean },
46
+ loopNavigation: { type: Boolean, default: !0 },
47
+ backfill: { type: Boolean },
48
+ selectWhenUnmatched: { type: Boolean },
49
+ selectOnTab: { type: Boolean },
50
+ append: { type: Boolean },
51
+ clearAfterSelect: { type: Boolean },
52
+ blurAfterSelect: { type: Boolean },
53
+ getShow: {},
54
+ disabled: { type: Boolean },
55
+ readonly: { type: Boolean },
56
+ loading: { type: Boolean },
57
+ hideLoading: { type: Boolean },
58
+ clearable: { type: Boolean },
59
+ clearIcon: {},
60
+ placeholder: {},
61
+ label: {},
62
+ ariaLabel: {},
63
+ name: {},
64
+ status: {},
65
+ error: {},
66
+ size: {},
67
+ bordered: { type: Boolean, default: !0 },
68
+ autofocus: { type: Boolean },
69
+ inputProps: {},
70
+ open: { type: Boolean, default: void 0 },
71
+ defaultOpen: { type: Boolean },
72
+ placement: { default: "bottom-start" },
73
+ popupMatchWidth: { type: Boolean, default: !0 },
74
+ popupWidth: {},
75
+ popupClass: {},
76
+ popupStyle: {},
77
+ appendTo: { type: [String, Boolean], default: "body" },
78
+ listHeight: { default: 256 },
79
+ emptyText: { default: "暂无建议" },
80
+ loadingText: { default: "正在加载建议…" },
81
+ errorText: { default: "建议加载失败,请重试" }
82
+ },
83
+ emits: ["update:modelValue", "update:open", "input", "change", "search", "select", "clear", "focus", "blur", "pressEnter", "visibleChange", "searchError"],
84
+ setup(S, { expose: _e, emit: et }) {
85
+ const t = S, m = et, R = ft(), Le = Pt(), Se = je(Kt, void 0), Ae = je(Ot, void 0), { disabled: ne, size: se, label: Ve } = Mt(t), z = x(), F = x(), L = x(), E = x(), W = pt(), Ee = x(t.defaultValue ?? ""), g = x(), B = x(), Q = x(!1), v = x(), j = x(!1), xe = Ge(), re = x(!1), de = Ge([]), i = c(
86
+ () => String(
87
+ t.modelValue === void 0 ? Ee.value : t.modelValue ?? ""
88
+ )
89
+ ), De = c(() => B.value ?? g.value ?? i.value), D = c(() => !ne.value && !t.readonly), ce = c(() => typeof t.fetchSuggestions == "function"), r = c(() => !!t.loading || j.value), tt = c(
90
+ () => ce.value ? de.value : Array.isArray(t.options) && t.options.length ? t.options : Array.isArray(t.fetchSuggestions) ? t.fetchSuggestions : []
91
+ ), ve = c(
92
+ () => Lt(tt.value, i.value, {
93
+ valueKey: t.valueKey,
94
+ labelKey: t.labelKey,
95
+ filter: t.filterOption ?? !ce.value,
96
+ caseSensitive: t.caseSensitive
97
+ })
98
+ ), G = c(() => ve.value.filter((e) => e.kind === "option")), Be = c(() => G.value.map((e) => e.item)), Y = c(() => G.value.filter((e) => !e.disabled)), q = c(
99
+ () => ve.value.find(
100
+ (e) => e.key === v.value && e.kind === "option" && !e.disabled
101
+ )
102
+ ), at = c(
103
+ () => G.value.findIndex((e) => e.key === v.value)
104
+ );
105
+ let C = !0, Ce = 0, V = 0, qe = -1, Te = !1, fe = 0, P, J = !1, I = !1, K, X, pe, A;
106
+ const w = Ft(z, F, {
107
+ closeOnTab: !1,
108
+ get placement() {
109
+ return t.placement;
110
+ },
111
+ matchWidth: () => t.popupMatchWidth ? !0 : "min",
112
+ width: () => t.popupWidth,
113
+ requestOpen: (e) => (m("update:open", e), t.open === void 0 ? void 0 : !1)
114
+ }), n = w.open, lt = c(() => ({
115
+ ...t.popupStyle,
116
+ ...w.style.value,
117
+ overflowY: "hidden"
118
+ })), ot = c(
119
+ () => Math.max(0, Math.floor(Number(t.minQueryLength) || 0))
120
+ ), $e = c(
121
+ () => Math.max(64, Math.min(1200, Number(t.listHeight) || 256))
122
+ );
123
+ function H(e = i.value) {
124
+ var a;
125
+ if (!C || !D.value || e.length < ot.value) return !1;
126
+ try {
127
+ return ((a = t.getShow) == null ? void 0 : a.call(t, e)) !== !1;
128
+ } catch {
129
+ return !1;
130
+ }
131
+ }
132
+ function Z() {
133
+ var a;
134
+ const e = (a = z.value) == null ? void 0 : a.querySelector('input:not([type="hidden"]),textarea');
135
+ E.value !== e && (E.value = e ?? void 0);
136
+ }
137
+ function O() {
138
+ Ce++, X == null || X.abort(), X = void 0, clearTimeout(pe), pe = void 0, j.value = !1;
139
+ }
140
+ function s(e = !1) {
141
+ g.value = void 0, K = void 0, w.close(!1, e);
142
+ }
143
+ function Pe(e) {
144
+ var a;
145
+ ne.value || (Z(), (a = E.value) == null || a.focus(e));
146
+ }
147
+ function Ie() {
148
+ var e;
149
+ Z(), (e = E.value) == null || e.blur(), s();
150
+ }
151
+ function U() {
152
+ n.value && w.update();
153
+ }
154
+ async function it() {
155
+ var u;
156
+ await $();
157
+ const e = (u = L.value) == null ? void 0 : u.querySelector(
158
+ '[id="' + W + "-option-" + v.value + '"]'
159
+ );
160
+ if (!e || !L.value) return;
161
+ const a = e.offsetTop, l = a + e.offsetHeight, o = L.value.clientHeight || $e.value;
162
+ a < L.value.scrollTop ? L.value.scrollTop = a : l > L.value.scrollTop + o && (L.value.scrollTop = l - o);
163
+ }
164
+ function _(e, a = !1) {
165
+ v.value = e == null ? void 0 : e.key, a && t.backfill && e ? g.value = (t.append ? i.value : "") + e.value : g.value = void 0, a && it();
166
+ }
167
+ function Ke() {
168
+ const e = K === "last" ? Y.value.at(-1) : K === "first" || t.highlightFirst ? Y.value[0] : void 0;
169
+ _(e, !!K), K = void 0;
170
+ }
171
+ function ee(e = i.value, a = !1) {
172
+ if (O(), xe.value = void 0, re.value = !1, !n.value || !H(e)) return;
173
+ if (!ce.value) {
174
+ Ke(), $(U);
175
+ return;
176
+ }
177
+ const l = Ce, o = new AbortController();
178
+ X = o, de.value = [], j.value = !0, v.value = void 0, g.value = void 0;
179
+ let u = !1;
180
+ const b = () => C && Ce === l && !o.signal.aborted && n.value && D.value, d = (y) => {
181
+ u || !b() || (u = !0, de.value = Array.isArray(y) ? y : [], j.value = !1, Ke(), $(U));
182
+ }, T = (y) => {
183
+ u || !b() || (u = !0, j.value = !1, xe.value = y, re.value = !0, m("searchError", y, e), $(U));
184
+ }, te = () => {
185
+ if (pe = void 0, !!b())
186
+ try {
187
+ const y = t.fetchSuggestions(e, d, { signal: o.signal });
188
+ y && typeof y.then == "function" ? Promise.resolve(y).then((Qe) => {
189
+ Array.isArray(Qe) && d(Qe);
190
+ }).catch(T) : Array.isArray(y) && d(y);
191
+ } catch (y) {
192
+ T(y);
193
+ }
194
+ }, ae = Math.max(0, Math.min(6e4, Number(t.debounce) || 0));
195
+ a || !ae ? te() : pe = setTimeout(te, ae);
196
+ }
197
+ async function N() {
198
+ H() && await w.show(t.open === !0);
199
+ }
200
+ async function ye() {
201
+ if (!H()) return;
202
+ const e = n.value;
203
+ Te = !e, await N(), Te = !1, e && n.value && ee(i.value, !0);
204
+ }
205
+ function he(e, a = !0) {
206
+ if (!C || !D.value || (B.value = void 0, g.value = void 0, e === P || e === i.value && P === void 0))
207
+ return;
208
+ const l = i.value, o = ++V;
209
+ P = e, t.modelValue === void 0 && (Ee.value = e), m("update:modelValue", e), m("input", e), $(async () => {
210
+ if (!(!C || o !== V) && (P = void 0, i.value === e && (l !== e && m("change", e), a && o !== qe))) {
211
+ if (m("search", e), K = void 0, !H(e)) {
212
+ O(), s();
213
+ return;
214
+ }
215
+ n.value ? ee(e) : await N();
216
+ }
217
+ });
218
+ }
219
+ function we(e) {
220
+ const a = String(e ?? "");
221
+ if (Q.value) {
222
+ B.value = a;
223
+ return;
224
+ }
225
+ he(a);
226
+ }
227
+ function me() {
228
+ D.value && (I = !0, O(), B.value = void 0, g.value = void 0, he("", !1), qe = V, s(), m("clear"), $(() => {
229
+ I = !1;
230
+ }));
231
+ }
232
+ async function ge(e, a = !0) {
233
+ if (!e || e.disabled || !D.value || r.value || !C) return;
234
+ const l = (t.append ? i.value : "") + e.value, o = t.clearAfterSelect ? "" : l;
235
+ he(o, !1);
236
+ const u = V;
237
+ await $(), !(!C || u !== V || i.value !== o || !D.value) && (m("select", e.item, l), s(), t.blurAfterSelect ? Ie() : a && (I = !0, Pe({ preventScroll: !0 }), I = !1));
238
+ }
239
+ async function He(e) {
240
+ await ge({
241
+ label: typeof e == "string" ? e : String(
242
+ e.label ?? Xe(e, t.valueKey, t.labelKey)
243
+ ),
244
+ value: Xe(e, t.valueKey, t.labelKey),
245
+ disabled: typeof e != "string" && !!e.disabled,
246
+ item: e
247
+ });
248
+ }
249
+ function ut(e) {
250
+ const a = G.value[Math.floor(e)];
251
+ _(a && !a.disabled ? a : void 0, !0);
252
+ }
253
+ async function nt(e) {
254
+ if (!D.value || e.isComposing || Q.value || e.keyCode === 229)
255
+ return;
256
+ const a = e.target;
257
+ if (a.matches("input,textarea")) {
258
+ if (["ArrowDown", "ArrowUp", "PageDown", "PageUp"].includes(e.key)) {
259
+ e.preventDefault(), e.stopPropagation();
260
+ const l = e.key === "ArrowDown" || e.key === "PageDown";
261
+ if (!n.value) {
262
+ K = l ? "first" : "last", await N();
263
+ return;
264
+ }
265
+ const o = Y.value;
266
+ if (!o.length) {
267
+ K = l ? "first" : "last";
268
+ return;
269
+ }
270
+ let u = o.findIndex((T) => T.key === v.value);
271
+ u < 0 && (u = l ? -1 : o.length);
272
+ const b = e.key.startsWith("Page") ? Math.max(
273
+ 1,
274
+ Math.floor(
275
+ $e.value / (se.value === "sm" ? 30 : se.value === "lg" ? 44 : 36)
276
+ )
277
+ ) : 1;
278
+ let d = u + (l ? b : -b);
279
+ d = t.loopNavigation ? (d % o.length + o.length) % o.length : Math.max(0, Math.min(o.length - 1, d)), _(o[d], !0);
280
+ } else if ((e.key === "Home" || e.key === "End") && n.value)
281
+ e.preventDefault(), _(
282
+ e.key === "Home" ? Y.value[0] : Y.value.at(-1),
283
+ !0
284
+ );
285
+ else if (e.key === "Enter") {
286
+ if (e.shiftKey && a.matches("textarea")) return;
287
+ m("pressEnter", e), n.value && q.value && !r.value ? (e.preventDefault(), e.stopPropagation(), await ge(q.value)) : t.selectWhenUnmatched ? (e.preventDefault(), e.stopPropagation(), await He({ [t.valueKey]: i.value })) : s();
288
+ } else if (e.key === "Escape")
289
+ g.value = void 0, s();
290
+ else if (e.key === "Tab")
291
+ if (!e.shiftKey && t.selectOnTab && q.value && !r.value)
292
+ await ge(q.value, !1);
293
+ else {
294
+ const l = !e.shiftKey && n.value ? Ne()[0] : void 0;
295
+ l ? (e.preventDefault(), l.focus()) : s();
296
+ }
297
+ }
298
+ }
299
+ function Ne() {
300
+ var e;
301
+ return Array.from(
302
+ ((e = F.value) == null ? void 0 : e.querySelectorAll(Ze)) ?? []
303
+ ).filter(
304
+ (a) => a.tabIndex >= 0 && a.getClientRects().length && !a.closest("[inert]")
305
+ );
306
+ }
307
+ function st(e) {
308
+ var b;
309
+ if (e.key !== "Tab") return;
310
+ const a = Ne();
311
+ if (document.activeElement !== (e.shiftKey ? a[0] : a.at(-1))) return;
312
+ e.preventDefault();
313
+ const o = Array.from(
314
+ document.querySelectorAll(Ze)
315
+ ).filter(
316
+ (d) => {
317
+ var T;
318
+ return !((T = F.value) != null && T.contains(d)) && d.tabIndex >= 0 && d.getClientRects().length && !d.closest("[inert]");
319
+ }
320
+ ), u = o.indexOf(E.value);
321
+ s(), I = !0, (b = e.shiftKey ? E.value : o[u + 1]) == null || b.focus(), I = !1;
322
+ }
323
+ function Re(e) {
324
+ fe++, J || (J = !0, m("focus", e)), e.target.matches("input,textarea") && t.triggerOnFocus && !I && !w.restoringFocus.value && N();
325
+ }
326
+ function rt(e) {
327
+ t.triggerOnFocus && e.target.matches("input,textarea") && !n.value && N();
328
+ }
329
+ function ze(e) {
330
+ const a = fe;
331
+ queueMicrotask(() => {
332
+ var o, u;
333
+ if (!C || a !== fe) return;
334
+ const l = document.activeElement;
335
+ (o = z.value) != null && o.contains(l) || (u = F.value) != null && u.contains(l) || (J && (J = !1, m("blur", e)), s());
336
+ });
337
+ }
338
+ function dt() {
339
+ Q.value = !0, B.value = void 0, O(), s();
340
+ }
341
+ function ct() {
342
+ Q.value = !1;
343
+ const e = B.value;
344
+ B.value = void 0, e !== void 0 && he(e);
345
+ }
346
+ const We = c(() => {
347
+ var e, a, l, o, u, b, d, T, te;
348
+ return {
349
+ ...t.inputProps,
350
+ ...Object.fromEntries(
351
+ Object.entries(R).filter(([ae]) => ae !== "class" && ae !== "style")
352
+ ),
353
+ disabled: ne.value,
354
+ readonly: t.readonly,
355
+ size: se.value,
356
+ clearable: t.clearable || ((e = t.inputProps) == null ? void 0 : e.clearable),
357
+ clearIcon: t.clearIcon ?? ((a = t.inputProps) == null ? void 0 : a.clearIcon),
358
+ placeholder: t.placeholder ?? ((l = t.inputProps) == null ? void 0 : l.placeholder),
359
+ label: t.label ?? ((o = t.inputProps) == null ? void 0 : o.label),
360
+ name: t.name ?? ((u = t.inputProps) == null ? void 0 : u.name),
361
+ status: t.status ?? ((b = t.inputProps) == null ? void 0 : b.status),
362
+ error: t.error ?? ((d = t.inputProps) == null ? void 0 : d.error),
363
+ bordered: t.bordered,
364
+ id: R.id || (Se == null ? void 0 : Se.id.value) || void 0,
365
+ role: "combobox",
366
+ autocomplete: ((T = t.inputProps) == null ? void 0 : T.autocomplete) ?? R.autocomplete ?? "off",
367
+ ariaLabel: t.ariaLabel || R["aria-label"] || ((te = t.inputProps) == null ? void 0 : te.ariaLabel) || t.label || Ve.value || "自动补全",
368
+ "aria-autocomplete": t.backfill ? "both" : "list",
369
+ "aria-expanded": n.value,
370
+ "aria-controls": n.value ? W : void 0,
371
+ "aria-activedescendant": n.value && q.value ? W + "-option-" + q.value.key : void 0,
372
+ "aria-busy": r.value || void 0
373
+ };
374
+ });
375
+ function Ue() {
376
+ C = !1, V++, fe++, P = void 0, B.value = void 0, g.value = void 0, J = !1, Q.value = !1, O(), s(!0), A == null || A.disconnect(), A = void 0;
377
+ }
378
+ M(n, (e) => {
379
+ e ? ee(i.value, Te) : (O(), g.value = void 0, v.value = void 0), m("visibleChange", e);
380
+ }), M(
381
+ () => t.open,
382
+ (e) => {
383
+ e !== void 0 && (e && H() ? w.show(!0) : s(!0));
384
+ }
385
+ ), M(
386
+ () => t.modelValue,
387
+ () => {
388
+ P !== void 0 && i.value === P || (V++, P = void 0, B.value = void 0, g.value = void 0, O(), n.value && H() ? ee() : s());
389
+ }
390
+ ), M(
391
+ () => [ne.value, t.readonly, t.getShow, t.minQueryLength],
392
+ () => {
393
+ H() || (O(), s(!0));
394
+ }
395
+ ), M(ce, () => {
396
+ de.value = [], n.value && ee();
397
+ }), M(ve, () => {
398
+ v.value && !q.value && (v.value = void 0), n.value && !r.value && !v.value && (t.highlightFirst || K) && Ke(), $(U);
399
+ }), M(
400
+ () => Ae == null ? void 0 : Ae.resetting.value,
401
+ (e) => {
402
+ e && (V++, P = void 0, B.value = void 0, g.value = void 0, O(), s(!0));
403
+ },
404
+ { flush: "sync" }
405
+ ), yt(Z);
406
+ function Oe() {
407
+ A == null || A.disconnect(), A = void 0, C && typeof ResizeObserver < "u" && z.value && (A = new ResizeObserver(U), A.observe(z.value), F.value && A.observe(F.value));
408
+ }
409
+ return M(F, Oe, { flush: "post" }), M([r, re], () => void $(U)), ht(() => {
410
+ Z(), Oe(), t.autofocus && Pe(), (t.open ?? t.defaultOpen) && N();
411
+ }), mt(() => {
412
+ C = !0, $(() => {
413
+ Z(), Oe();
414
+ });
415
+ }), gt(Ue), bt(Ue), _e({
416
+ input: E,
417
+ isOpen: n,
418
+ loading: r,
419
+ highlightedIndex: at,
420
+ suggestions: Be,
421
+ focus: Pe,
422
+ blur: Ie,
423
+ open: N,
424
+ close: () => s(),
425
+ clear: me,
426
+ getData: ye,
427
+ retry: ye,
428
+ highlight: ut,
429
+ select: He
430
+ }), (e, a) => (f(), k(be, null, [
431
+ le("div", Me({
432
+ ref_key: "root",
433
+ ref: z
434
+ }, h(Le), {
435
+ class: ["hys-ui-autocomplete", h(R).class],
436
+ style: h(R).style,
437
+ onKeydownCapture: nt,
438
+ onFocusin: Re,
439
+ onFocusout: ze,
440
+ onClick: rt,
441
+ onCompositionstart: dt,
442
+ onCompositionend: ct
443
+ }), [
444
+ p(e.$slots, "input", {
445
+ value: De.value,
446
+ setValue: we,
447
+ inputProps: We.value,
448
+ loading: r.value,
449
+ clear: me
450
+ }, () => [
451
+ Fe($t, Me(We.value, {
452
+ "model-value": De.value,
453
+ "onUpdate:modelValue": we,
454
+ onClear: me
455
+ }), kt({ _: 2 }, [
456
+ e.$slots.prefix ? {
457
+ name: "prefix",
458
+ fn: oe(() => [
459
+ p(e.$slots, "prefix", {}, void 0, !0)
460
+ ]),
461
+ key: "0"
462
+ } : void 0,
463
+ e.$slots.suffix || r.value && !S.hideLoading ? {
464
+ name: "suffix",
465
+ fn: oe(() => [
466
+ p(e.$slots, "suffix", { loading: r.value }, () => [
467
+ r.value && !S.hideLoading ? (f(), Ye(h(Je), {
468
+ key: 0,
469
+ size: 15,
470
+ class: "hys-ui-icon-spin"
471
+ })) : ie("", !0)
472
+ ], !0)
473
+ ]),
474
+ key: "1"
475
+ } : void 0,
476
+ e.$slots.prepend ? {
477
+ name: "prepend",
478
+ fn: oe(() => [
479
+ p(e.$slots, "prepend", {}, void 0, !0)
480
+ ]),
481
+ key: "2"
482
+ } : void 0,
483
+ e.$slots.append ? {
484
+ name: "append",
485
+ fn: oe(() => [
486
+ p(e.$slots, "append", {}, void 0, !0)
487
+ ]),
488
+ key: "3"
489
+ } : void 0,
490
+ e.$slots["clear-icon"] ? {
491
+ name: "clear-icon",
492
+ fn: oe(() => [
493
+ p(e.$slots, "clear-icon", {}, void 0, !0)
494
+ ]),
495
+ key: "4"
496
+ } : void 0
497
+ ]), 1040, ["model-value"])
498
+ ], !0)
499
+ ], 16),
500
+ (f(), Ye(St, {
501
+ to: S.appendTo || "body",
502
+ disabled: S.appendTo === !1
503
+ }, [
504
+ h(n) ? (f(), k("div", Me({
505
+ key: 0,
506
+ id: h(W) + "-panel",
507
+ ref_key: "panel",
508
+ ref: F
509
+ }, h(Le), {
510
+ class: ["hys-ui-autocomplete-popup", ["hys-ui-autocomplete-" + h(se), S.popupClass]],
511
+ style: lt.value,
512
+ onFocusin: Re,
513
+ onFocusout: ze,
514
+ onKeydown: st
515
+ }), [
516
+ e.$slots.header ? (f(), k("div", Et, [
517
+ p(e.$slots, "header", {
518
+ query: i.value,
519
+ loading: r.value,
520
+ options: Be.value,
521
+ close: () => s()
522
+ }, void 0, !0)
523
+ ])) : ie("", !0),
524
+ le("div", {
525
+ id: h(W),
526
+ ref_key: "list",
527
+ ref: L,
528
+ role: "listbox",
529
+ class: "hys-ui-autocomplete-list",
530
+ style: At({ maxHeight: $e.value + "px" }),
531
+ "aria-label": S.ariaLabel || h(Ve) || "输入建议",
532
+ "aria-busy": r.value || void 0
533
+ }, [
534
+ r.value && !S.hideLoading ? (f(), k("div", qt, [
535
+ p(e.$slots, "loading", { query: i.value }, () => [
536
+ Fe(h(Je), {
537
+ size: 17,
538
+ class: "hys-ui-icon-spin"
539
+ }),
540
+ ke(ue(S.loadingText), 1)
541
+ ], !0)
542
+ ])) : re.value ? (f(), k("div", It, [
543
+ p(e.$slots, "error", {
544
+ error: xe.value,
545
+ query: i.value,
546
+ retry: ye
547
+ }, () => [
548
+ le("span", null, ue(S.errorText), 1),
549
+ le("button", {
550
+ type: "button",
551
+ "aria-label": "重试加载建议",
552
+ onClick: ye
553
+ }, [
554
+ Fe(h(Tt), { size: 14 }),
555
+ a[1] || (a[1] = ke("重试 ", -1))
556
+ ])
557
+ ], !0)
558
+ ])) : (f(), k(be, { key: 2 }, [
559
+ (f(!0), k(be, null, xt(ve.value, (l) => (f(), k(be, {
560
+ key: l.key
561
+ }, [
562
+ l.kind === "group" ? (f(), k("div", wt, [
563
+ p(e.$slots, "group", {
564
+ label: l.label,
565
+ group: l.group
566
+ }, () => [
567
+ ke(ue(l.label), 1)
568
+ ], !0)
569
+ ])) : (f(), k("div", {
570
+ key: 1,
571
+ id: h(W) + "-option-" + l.key,
572
+ role: "option",
573
+ "aria-disabled": l.disabled || void 0,
574
+ "aria-selected": v.value === l.key,
575
+ class: Ct(["hys-ui-autocomplete-option", {
576
+ "hys-ui-autocomplete-active": v.value === l.key,
577
+ "hys-ui-autocomplete-disabled": l.disabled
578
+ }]),
579
+ onMousedown: a[0] || (a[0] = Bt(() => {
580
+ }, ["prevent"])),
581
+ onMouseenter: (o) => !l.disabled && _(l),
582
+ onClick: (o) => ge(l)
583
+ }, [
584
+ p(e.$slots, "option", {
585
+ item: l.item,
586
+ option: l,
587
+ query: i.value,
588
+ active: v.value === l.key
589
+ }, () => [
590
+ p(e.$slots, "default", {
591
+ item: l.item,
592
+ option: l,
593
+ query: i.value,
594
+ active: v.value === l.key
595
+ }, () => [
596
+ le("span", {
597
+ class: "hys-ui-autocomplete-label",
598
+ title: l.label
599
+ }, ue(l.label), 9, Nt)
600
+ ], !0)
601
+ ], !0)
602
+ ], 42, Ht))
603
+ ], 64))), 128)),
604
+ !G.value.length && !r.value ? (f(), k("div", Rt, [
605
+ p(e.$slots, "empty", { query: i.value }, () => [
606
+ ke(ue(S.emptyText), 1)
607
+ ], !0)
608
+ ])) : ie("", !0)
609
+ ], 64))
610
+ ], 12, Dt),
611
+ e.$slots.footer ? (f(), k("div", zt, [
612
+ p(e.$slots, "footer", {
613
+ query: i.value,
614
+ loading: r.value,
615
+ options: Be.value,
616
+ close: () => s(),
617
+ clear: me
618
+ }, void 0, !0)
619
+ ])) : ie("", !0)
620
+ ], 16, Vt)) : ie("", !0)
621
+ ], 8, ["to", "disabled"]))
622
+ ], 64));
623
+ }
624
+ });
625
+ export {
626
+ Xt as default
627
+ };
@@ -1,37 +1,7 @@
1
- import { defineComponent as f, ref as d, computed as h, watch as y, openBlock as l, createElementBlock as s, mergeProps as v, unref as x, normalizeStyle as z, renderSlot as b, createTextVNode as g, toDisplayString as S } from "vue";
2
- import { useHysRootAttrs as k } from "../../config.js";
3
- const A = ["aria-label"], R = ["src", "alt"], C = /* @__PURE__ */ f({
4
- __name: "HysAvatar",
5
- props: {
6
- name: { default: "" },
7
- src: {},
8
- size: { default: 36 },
9
- shape: { default: "circle" },
10
- fit: { default: "cover" },
11
- alt: {}
12
- },
13
- emits: ["error"],
14
- setup(e, { emit: i }) {
15
- const o = k(), a = e, n = i, t = d(!1), c = h(() => a.name.trim().slice(0, 2).toUpperCase() || "?");
16
- return y(() => a.src, () => t.value = !1), (m, r) => (l(), s("span", v(x(o), {
17
- class: "hys-ui-ex-avatar",
18
- style: { width: e.size + "px", height: e.size + "px", fontSize: Math.max(11, e.size * 0.34) + "px", borderRadius: e.shape === "square" ? "8px" : "50%" },
19
- "aria-label": e.alt || e.name
20
- }), [
21
- e.src && !t.value ? (l(), s("img", {
22
- key: 0,
23
- src: e.src,
24
- alt: e.alt || e.name,
25
- style: z({ objectFit: e.fit }),
26
- onError: r[0] || (r[0] = (u) => {
27
- t.value = !0, n("error", u);
28
- })
29
- }, null, 44, R)) : b(m.$slots, "default", {}, () => [
30
- g(S(c.value), 1)
31
- ], void 0, 1)
32
- ], 16, A));
33
- }
34
- });
1
+ import o from "./HysAvatar2.vue.js";
2
+ /* empty css */
3
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-50e32a16"]]);
35
5
  export {
36
- C as default
6
+ p as default
37
7
  };