hys-ui 0.1.1 → 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 (225) hide show
  1. package/CHANGELOG.md +111 -0
  2. package/README.md +3 -1
  3. package/dist/components/HysAccordion/HysAccordion.vue.js +1 -1
  4. package/dist/components/HysAccordion/HysAccordion2.vue.js +181 -47
  5. package/dist/components/HysAutocomplete/HysAutocomplete.vue.js +7 -0
  6. package/dist/components/HysAutocomplete/HysAutocomplete2.vue.js +627 -0
  7. package/dist/components/HysAvatar/HysAvatar.vue.js +5 -35
  8. package/dist/components/HysAvatar/HysAvatar2.vue.js +221 -2
  9. package/dist/components/HysAvatarGroup/HysAvatarGroup.vue.js +7 -0
  10. package/dist/components/HysAvatarGroup/HysAvatarGroup2.vue.js +252 -0
  11. package/dist/components/HysBadge/HysBadge.vue.js +2 -2
  12. package/dist/components/HysBadge/HysBadge2.vue.js +154 -27
  13. package/dist/components/HysBreadcrumb/HysBreadcrumb.vue.js +5 -38
  14. package/dist/components/HysBreadcrumb/HysBreadcrumb2.vue.js +74 -2
  15. package/dist/components/HysButton/HysButton.vue.js +2 -2
  16. package/dist/components/HysButton/HysButton2.vue.js +29 -28
  17. package/dist/components/HysCalendar/HysCalendar.vue.js +5 -92
  18. package/dist/components/HysCalendar/HysCalendar2.vue.js +803 -2
  19. package/dist/components/HysCard/HysCard.vue.js +2 -2
  20. package/dist/components/HysCard/HysCard2.vue.js +175 -42
  21. package/dist/components/HysCascader/HysCascader.vue.js +5 -194
  22. package/dist/components/HysCascader/HysCascader2.vue.js +760 -2
  23. package/dist/components/HysCascader/HysCascaderColumn.vue.js +7 -0
  24. package/dist/components/HysCascader/HysCascaderColumn2.vue.js +232 -0
  25. package/dist/components/HysCheckbox/HysCheckbox.vue.js +3 -3
  26. package/dist/components/HysCheckbox/HysCheckbox2.vue.js +180 -65
  27. package/dist/components/HysCheckboxGroup/HysCheckboxGroup.vue.js +7 -0
  28. package/dist/components/HysCheckboxGroup/HysCheckboxGroup2.vue.js +237 -0
  29. package/dist/components/HysColorPicker/HysColorPicker.vue.js +2 -2
  30. package/dist/components/HysColorPicker/HysColorPicker2.vue.js +107 -106
  31. package/dist/components/HysDataGrid/HysDataGrid.vue.js +1 -1
  32. package/dist/components/HysDataGrid/HysDataGrid2.vue.js +399 -392
  33. package/dist/components/HysDatePicker/HysDatePicker.vue.js +268 -139
  34. package/dist/components/HysDatePicker/HysDatePickerControl.vue.js +7 -0
  35. package/dist/components/HysDatePicker/HysDatePickerControl2.vue.js +807 -0
  36. package/dist/components/HysDatePicker/HysDatePickerPanel.vue.js +7 -0
  37. package/dist/components/HysDatePicker/HysDatePickerPanel2.vue.js +357 -0
  38. package/dist/components/HysDateRangePicker/HysDateRangePicker.vue.js +268 -158
  39. package/dist/components/HysDivider/HysDivider.vue.js +2 -2
  40. package/dist/components/HysDivider/HysDivider2.vue.js +33 -13
  41. package/dist/components/HysFileManager/HysFileManager.vue.js +3 -3
  42. package/dist/components/HysFileManager/HysFileManager2.vue.js +43 -42
  43. package/dist/components/HysForm/HysForm.vue.js +3 -3
  44. package/dist/components/HysForm/HysForm2.vue.js +578 -92
  45. package/dist/components/HysFormItem/HysFormItem.vue.js +5 -85
  46. package/dist/components/HysFormItem/HysFormItem2.vue.js +521 -2
  47. package/dist/components/HysGantt/HysGantt.vue.js +1 -1
  48. package/dist/components/HysGantt/HysGantt2.vue.js +1369 -272
  49. package/dist/components/HysInput/HysInput.vue.js +2 -2
  50. package/dist/components/HysInput/HysInput2.vue.js +467 -120
  51. package/dist/components/HysMention/HysMention.vue.js +2 -2
  52. package/dist/components/HysMention/HysMention2.vue.js +89 -88
  53. package/dist/components/HysNumberInput/HysNumberInput.vue.js +2 -2
  54. package/dist/components/HysNumberInput/HysNumberInput2.vue.js +561 -79
  55. package/dist/components/HysOrgTree/HysOrgTree.vue.js +29 -26
  56. package/dist/components/HysPagination/HysPagination.vue.js +1 -1
  57. package/dist/components/HysPagination/HysPagination2.vue.js +2 -0
  58. package/dist/components/HysPermissionMatrix/HysPermissionMatrix.vue.js +2 -2
  59. package/dist/components/HysPermissionMatrix/HysPermissionMatrix2.vue.js +52 -51
  60. package/dist/components/HysRadio/HysRadio.vue.js +7 -0
  61. package/dist/components/HysRadio/HysRadio2.vue.js +180 -0
  62. package/dist/components/HysRadioGroup/HysRadioGroup.vue.js +2 -2
  63. package/dist/components/HysRadioGroup/HysRadioGroup2.vue.js +190 -65
  64. package/dist/components/HysRating/HysRating.vue.js +1 -1
  65. package/dist/components/HysRating/HysRating2.vue.js +288 -68
  66. package/dist/components/HysRichTextEditor/HysRichTextEditor.vue.js +1 -1
  67. package/dist/components/HysRichTextEditor/HysRichTextEditor2.vue.js +70 -69
  68. package/dist/components/HysSearch/HysSearch.vue.js +37 -36
  69. package/dist/components/HysSegmented/HysSegmented.vue.js +5 -63
  70. package/dist/components/HysSegmented/HysSegmented2.vue.js +273 -2
  71. package/dist/components/HysSelect/HysSelect.vue.js +3 -2
  72. package/dist/components/HysSelect/HysSelect2.vue.js +859 -185
  73. package/dist/components/HysSkeleton/HysSkeleton.vue.js +2 -2
  74. package/dist/components/HysSkeleton/HysSkeleton2.vue.js +126 -29
  75. package/dist/components/HysSlider/HysSlider.vue.js +2 -2
  76. package/dist/components/HysSlider/HysSlider2.vue.js +532 -59
  77. package/dist/components/HysSlider/SliderTooltip.vue.js +7 -0
  78. package/dist/components/HysSlider/SliderTooltip2.vue.js +156 -0
  79. package/dist/components/HysSteps/HysSteps.vue.js +1 -1
  80. package/dist/components/HysSteps/HysSteps2.vue.js +110 -36
  81. package/dist/components/HysSwitch/HysSwitch.vue.js +2 -2
  82. package/dist/components/HysSwitch/HysSwitch2.vue.js +232 -50
  83. package/dist/components/HysTable/HysTable.vue.js +2 -2
  84. package/dist/components/HysTable/HysTable2.vue.js +1473 -88
  85. package/dist/components/HysTable/HysTableFilterOptions.vue.js +7 -0
  86. package/dist/components/HysTable/HysTableFilterOptions2.vue.js +133 -0
  87. package/dist/components/HysTabs/HysTabs.vue.js +2 -2
  88. package/dist/components/HysTabs/HysTabs2.vue.js +262 -68
  89. package/dist/components/HysTagInput/HysTagInput.vue.js +43 -42
  90. package/dist/components/HysTextarea/HysTextarea.vue.js +138 -77
  91. package/dist/components/HysTransfer/HysTransfer.vue.js +5 -223
  92. package/dist/components/HysTransfer/HysTransfer2.vue.js +416 -2
  93. package/dist/components/HysTransfer/HysTransferPanel.vue.js +7 -0
  94. package/dist/components/HysTransfer/HysTransferPanel2.vue.js +454 -0
  95. package/dist/components/HysTree/HysTree.vue.js +2 -3
  96. package/dist/components/HysTree/HysTree2.vue.js +641 -302
  97. package/dist/components/HysTreeSelect/HysTreeSelect.vue.js +5 -136
  98. package/dist/components/HysTreeSelect/HysTreeSelect2.vue.js +558 -2
  99. package/dist/components/HysTreeSelect/HysTreeSelectPanel.vue.js +7 -0
  100. package/dist/components/HysTreeSelect/HysTreeSelectPanel2.vue.js +323 -0
  101. package/dist/components/HysUpload/HysUpload.vue.js +2 -2
  102. package/dist/components/HysUpload/HysUpload2.vue.js +77 -76
  103. package/dist/composables/autocomplete.js +50 -0
  104. package/dist/composables/avatar.js +57 -0
  105. package/dist/composables/calendar.js +96 -0
  106. package/dist/composables/cascader.js +79 -0
  107. package/dist/composables/choice.js +38 -0
  108. package/dist/composables/choiceModel.js +67 -0
  109. package/dist/composables/datePicker.js +227 -0
  110. package/dist/composables/formContext.js +92 -7
  111. package/dist/composables/formLayout.js +57 -0
  112. package/dist/composables/formValidation.js +240 -0
  113. package/dist/composables/ganttConflicts.js +143 -0
  114. package/dist/composables/numberInput.js +91 -0
  115. package/dist/composables/rating.js +16 -0
  116. package/dist/composables/selectOptions.js +54 -0
  117. package/dist/composables/table.js +150 -0
  118. package/dist/composables/textInput.js +34 -0
  119. package/dist/composables/transfer.js +63 -0
  120. package/dist/composables/tree.js +118 -0
  121. package/dist/composables/treeSelect.js +71 -0
  122. package/dist/composables/useCascader.js +438 -0
  123. package/dist/composables/useDatePicker.js +425 -0
  124. package/dist/composables/useFloating.js +97 -51
  125. package/dist/composables/useGanttDependencies.js +306 -0
  126. package/dist/composables/useGanttHistory.js +157 -0
  127. package/dist/composables/useGanttLabelResize.js +100 -0
  128. package/dist/composables/useTable.js +474 -0
  129. package/dist/composables/useTextareaSize.js +72 -0
  130. package/dist/composables/useTransfer.js +257 -0
  131. package/dist/composables/useTree.js +439 -0
  132. package/dist/composables/useTreeSelect.js +361 -0
  133. package/dist/index.js +149 -139
  134. package/dist/style.css +1 -1
  135. package/dist/types/components/HysAccordion/HysAccordion.vue.d.ts +61 -22
  136. package/dist/types/components/HysAutocomplete/HysAutocomplete.vue.d.ts +201 -0
  137. package/dist/types/components/HysAvatar/HysAvatar.vue.d.ts +28 -15
  138. package/dist/types/components/HysAvatarGroup/HysAvatarGroup.vue.d.ts +99 -0
  139. package/dist/types/components/HysBadge/HysBadge.vue.d.ts +41 -4
  140. package/dist/types/components/HysBreadcrumb/HysBreadcrumb.vue.d.ts +38 -10
  141. package/dist/types/components/HysButton/HysButton.vue.d.ts +0 -1
  142. package/dist/types/components/HysCalendar/HysCalendar.vue.d.ts +119 -31
  143. package/dist/types/components/HysCard/HysCard.vue.d.ts +55 -7
  144. package/dist/types/components/HysCascader/HysCascader.vue.d.ts +129 -41
  145. package/dist/types/components/HysCascader/HysCascaderColumn.vue.d.ts +55 -0
  146. package/dist/types/components/HysCheckbox/HysCheckbox.vue.d.ts +50 -39
  147. package/dist/types/components/HysCheckboxGroup/HysCheckboxGroup.vue.d.ts +73 -0
  148. package/dist/types/components/HysDataGrid/HysDataGrid.vue.d.ts +1 -1
  149. package/dist/types/components/HysDatePicker/HysDatePicker.vue.d.ts +66 -14
  150. package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +90 -0
  151. package/dist/types/components/HysDatePicker/HysDatePickerPanel.vue.d.ts +93 -0
  152. package/dist/types/components/HysDateRangePicker/HysDateRangePicker.vue.d.ts +66 -14
  153. package/dist/types/components/HysDivider/HysDivider.vue.d.ts +8 -3
  154. package/dist/types/components/HysFileManager/HysFileManager.vue.d.ts +2 -2
  155. package/dist/types/components/HysForm/HysForm.vue.d.ts +110 -18
  156. package/dist/types/components/HysFormItem/HysFormItem.vue.d.ts +108 -2
  157. package/dist/types/components/HysGantt/HysGantt.vue.d.ts +82 -4
  158. package/dist/types/components/HysInput/HysInput.vue.d.ts +52 -29
  159. package/dist/types/components/HysMention/HysMention.vue.d.ts +2 -2
  160. package/dist/types/components/HysNumberInput/HysNumberInput.vue.d.ts +93 -35
  161. package/dist/types/components/HysOrgTree/HysOrgTree.vue.d.ts +1 -0
  162. package/dist/types/components/HysPagination/HysPagination.vue.d.ts +1 -1
  163. package/dist/types/components/HysPermissionMatrix/HysPermissionMatrix.vue.d.ts +2 -2
  164. package/dist/types/components/HysPopover/HysPopover.vue.d.ts +3 -3
  165. package/dist/types/components/HysProgress/HysProgress.vue.d.ts +1 -1
  166. package/dist/types/components/HysRadio/HysRadio.vue.d.ts +56 -0
  167. package/dist/types/components/HysRadioGroup/HysRadioGroup.vue.d.ts +34 -12
  168. package/dist/types/components/HysRating/HysRating.vue.d.ts +85 -5
  169. package/dist/types/components/HysRichTextEditor/HysRichTextEditor.vue.d.ts +4 -4
  170. package/dist/types/components/HysSearch/HysSearch.vue.d.ts +2 -2
  171. package/dist/types/components/HysSegmented/HysSegmented.vue.d.ts +64 -32
  172. package/dist/types/components/HysSelect/HysSelect.vue.d.ts +120 -20
  173. package/dist/types/components/HysSkeleton/HysSkeleton.vue.d.ts +30 -2
  174. package/dist/types/components/HysSlider/HysSlider.vue.d.ts +66 -9
  175. package/dist/types/components/HysSlider/SliderTooltip.vue.d.ts +22 -0
  176. package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +1 -1
  177. package/dist/types/components/HysSteps/HysSteps.vue.d.ts +64 -9
  178. package/dist/types/components/HysSwitch/HysSwitch.vue.d.ts +76 -17
  179. package/dist/types/components/HysTable/HysTable.vue.d.ts +206 -32
  180. package/dist/types/components/HysTable/HysTableFilterOptions.vue.d.ts +18 -0
  181. package/dist/types/components/HysTabs/HysTabs.vue.d.ts +76 -23
  182. package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +5 -5
  183. package/dist/types/components/HysTextarea/HysTextarea.vue.d.ts +44 -27
  184. package/dist/types/components/HysToast/HysToast.vue.d.ts +3 -3
  185. package/dist/types/components/HysTour/HysTour.vue.d.ts +2 -2
  186. package/dist/types/components/HysTransfer/HysTransfer.vue.d.ts +55 -40
  187. package/dist/types/components/HysTransfer/HysTransferPanel.vue.d.ts +105 -0
  188. package/dist/types/components/HysTree/HysTree.vue.d.ts +140 -73
  189. package/dist/types/components/HysTreeSelect/HysTreeSelect.vue.d.ts +102 -23
  190. package/dist/types/components/HysTreeSelect/HysTreeSelectPanel.vue.d.ts +56 -0
  191. package/dist/types/composables/autocomplete.d.ts +106 -0
  192. package/dist/types/composables/avatar.d.ts +70 -0
  193. package/dist/types/composables/calendar.d.ts +66 -0
  194. package/dist/types/composables/cascader.d.ts +192 -0
  195. package/dist/types/composables/choice.d.ts +110 -0
  196. package/dist/types/composables/choiceModel.d.ts +11 -0
  197. package/dist/types/composables/datePicker.d.ts +247 -0
  198. package/dist/types/composables/formContext.d.ts +133 -8
  199. package/dist/types/composables/formLayout.d.ts +11 -0
  200. package/dist/types/composables/formValidation.d.ts +13 -0
  201. package/dist/types/composables/gantt.d.ts +68 -0
  202. package/dist/types/composables/ganttConflicts.d.ts +30 -0
  203. package/dist/types/composables/numberInput.d.ts +45 -0
  204. package/dist/types/composables/rating.d.ts +18 -0
  205. package/dist/types/composables/segmented.d.ts +15 -0
  206. package/dist/types/composables/selectOptions.d.ts +44 -0
  207. package/dist/types/composables/slider.d.ts +21 -0
  208. package/dist/types/composables/table.d.ts +309 -0
  209. package/dist/types/composables/textInput.d.ts +76 -0
  210. package/dist/types/composables/transfer.d.ts +180 -0
  211. package/dist/types/composables/tree.d.ts +237 -0
  212. package/dist/types/composables/treeSelect.d.ts +167 -0
  213. package/dist/types/composables/useCascader.d.ts +162 -0
  214. package/dist/types/composables/useDatePicker.d.ts +79 -0
  215. package/dist/types/composables/useFloating.d.ts +8 -5
  216. package/dist/types/composables/useGanttDependencies.d.ts +83 -0
  217. package/dist/types/composables/useGanttHistory.d.ts +42 -0
  218. package/dist/types/composables/useGanttLabelResize.d.ts +23 -0
  219. package/dist/types/composables/useTable.d.ts +60 -0
  220. package/dist/types/composables/useTextareaSize.d.ts +3 -0
  221. package/dist/types/composables/useTransfer.d.ts +58 -0
  222. package/dist/types/composables/useTree.d.ts +77 -0
  223. package/dist/types/composables/useTreeSelect.d.ts +117 -0
  224. package/dist/types/index.d.ts +33 -7
  225. package/package.json +2 -1
@@ -1,7 +1,8 @@
1
- import { defineComponent as C, ref as v, watch as p, onBeforeUnmount as x, onDeactivated as N, openBlock as s, createElementBlock as V, mergeProps as w, unref as m, createBlock as g, createElementVNode as z, withKeys as L, createVNode as A, createCommentVNode as E } from "vue";
2
- import { LoaderCircle as F, Search as H, X as K } from "lucide-vue-next";
3
- import { useHysRootAttrs as R } from "../../config.js";
4
- const S = ["value", "placeholder", "disabled", "readonly", "aria-label"], M = /* @__PURE__ */ C({
1
+ import { defineComponent as L, ref as v, watch as V, onBeforeUnmount as N, onDeactivated as w, openBlock as f, createElementBlock as g, mergeProps as z, unref as n, createBlock as k, createElementVNode as H, withKeys as S, createVNode as A, createCommentVNode as D } from "vue";
2
+ import { useHysControlState as E } from "../../composables/formContext.js";
3
+ import { LoaderCircle as F, Search as K, X as R } from "lucide-vue-next";
4
+ import { useHysRootAttrs as T } from "../../config.js";
5
+ const I = ["value", "placeholder", "disabled", "readonly", "aria-label"], $ = /* @__PURE__ */ L({
5
6
  __name: "HysSearch",
6
7
  props: {
7
8
  modelValue: {},
@@ -14,70 +15,70 @@ const S = ["value", "placeholder", "disabled", "readonly", "aria-label"], M = /*
14
15
  ariaLabel: {}
15
16
  },
16
17
  emits: ["update:modelValue", "search", "clear", "focus", "blur"],
17
- setup(a, { expose: k, emit: B }) {
18
- const t = a, i = B, h = R(), r = v(), d = v(!1);
19
- let y, u;
20
- function n() {
21
- clearTimeout(y), y = void 0, u = void 0;
18
+ setup(a, { expose: B, emit: C }) {
19
+ const r = a, { disabled: u, label: h } = E(r), i = C, x = T(), d = v(), s = v(!1);
20
+ let y, m;
21
+ function t() {
22
+ clearTimeout(y), y = void 0, m = void 0;
22
23
  }
23
- function c(e) {
24
- n(), t.disabled || i("search", e);
24
+ function b(e) {
25
+ t(), u.value || i("search", e);
25
26
  }
26
- function f(e) {
27
- t.disabled || t.readonly || d.value || (n(), u = e, i("update:modelValue", e), y = setTimeout(() => c(e), Number.isFinite(t.delay) ? Math.max(0, t.delay) : 300));
27
+ function c(e) {
28
+ u.value || r.readonly || s.value || (t(), m = e, i("update:modelValue", e), y = setTimeout(() => b(e), Number.isFinite(r.delay) ? Math.max(0, r.delay) : 300));
28
29
  }
29
- return p(() => [t.disabled, t.readonly], n, { flush: "sync" }), p(() => t.modelValue, (e) => {
30
- u !== void 0 && e !== u && n();
31
- }), x(n), N(n), k({ focus: () => {
30
+ return V(() => [u.value, r.readonly], t, { flush: "sync" }), V(() => r.modelValue, (e) => {
31
+ m !== void 0 && e !== m && t();
32
+ }), N(t), w(t), B({ focus: () => {
32
33
  var e;
33
- return (e = r.value) == null ? void 0 : e.focus();
34
+ return (e = d.value) == null ? void 0 : e.focus();
34
35
  }, blur: () => {
35
36
  var e;
36
- return (e = r.value) == null ? void 0 : e.blur();
37
- } }), (e, l) => (s(), V("div", w(m(h), { class: "hys-ui-ex-search" }), [
38
- a.loading ? (s(), g(m(F), {
37
+ return (e = d.value) == null ? void 0 : e.blur();
38
+ } }), (e, l) => (f(), g("div", z(n(x), { class: "hys-ui-ex-search" }), [
39
+ a.loading ? (f(), k(n(F), {
39
40
  key: 0,
40
41
  class: "hys-ui-icon-spin",
41
42
  size: 16
42
- })) : (s(), g(m(H), {
43
+ })) : (f(), k(n(K), {
43
44
  key: 1,
44
45
  size: 16,
45
46
  "aria-hidden": "true"
46
47
  })),
47
- z("input", {
48
+ H("input", {
48
49
  ref_key: "input",
49
- ref: r,
50
+ ref: d,
50
51
  type: "search",
51
52
  value: a.modelValue,
52
53
  placeholder: a.placeholder,
53
- disabled: a.disabled,
54
+ disabled: n(u),
54
55
  readonly: a.readonly,
55
- "aria-label": a.ariaLabel || "搜索",
56
- onInput: l[0] || (l[0] = (o) => f(o.target.value)),
56
+ "aria-label": a.ariaLabel || n(h) || "搜索",
57
+ onInput: l[0] || (l[0] = (o) => c(o.target.value)),
57
58
  onCompositionstart: l[1] || (l[1] = (o) => {
58
- d.value = !0, n();
59
+ s.value = !0, t();
59
60
  }),
60
61
  onCompositionend: l[2] || (l[2] = (o) => {
61
- d.value = !1, f(o.target.value);
62
+ s.value = !1, c(o.target.value);
62
63
  }),
63
- onKeydown: l[3] || (l[3] = L((o) => !o.isComposing && o.keyCode !== 229 && !d.value && c(a.modelValue), ["enter"])),
64
+ onKeydown: l[3] || (l[3] = S((o) => !o.isComposing && o.keyCode !== 229 && !s.value && b(a.modelValue), ["enter"])),
64
65
  onFocus: l[4] || (l[4] = (o) => i("focus", o)),
65
66
  onBlur: l[5] || (l[5] = (o) => i("blur", o))
66
- }, null, 40, S),
67
- a.clearable && a.modelValue && !a.disabled && !a.readonly ? (s(), V("button", {
67
+ }, null, 40, I),
68
+ a.clearable && a.modelValue && !n(u) && !a.readonly ? (f(), g("button", {
68
69
  key: 2,
69
70
  type: "button",
70
71
  "aria-label": "清空搜索",
71
72
  onClick: l[6] || (l[6] = (o) => {
72
- var b;
73
- f(""), i("clear"), (b = r.value) == null || b.focus();
73
+ var p;
74
+ c(""), i("clear"), (p = d.value) == null || p.focus();
74
75
  })
75
76
  }, [
76
- A(m(K), { size: 14 })
77
- ])) : E("", !0)
77
+ A(n(R), { size: 14 })
78
+ ])) : D("", !0)
78
79
  ], 16));
79
80
  }
80
81
  });
81
82
  export {
82
- M as default
83
+ $ as default
83
84
  };
@@ -1,65 +1,7 @@
1
- import { defineComponent as x, ref as V, computed as y, openBlock as n, createElementBlock as r, mergeProps as A, unref as p, Fragment as L, renderList as w, normalizeStyle as z, normalizeClass as S, renderSlot as B, createTextVNode as C, toDisplayString as H } from "vue";
2
- import { useHysRootAttrs as E } from "../../config.js";
3
- const R = ["aria-label"], D = ["data-value", "disabled", "aria-checked", "tabindex", "onClick"], F = /* @__PURE__ */ x({
4
- __name: "HysSegmented",
5
- props: {
6
- modelValue: {},
7
- options: {},
8
- disabled: { type: Boolean },
9
- block: { type: Boolean },
10
- size: {},
11
- ariaLabel: {}
12
- },
13
- emits: ["update:modelValue", "change"],
14
- setup(t, { emit: v }) {
15
- const g = E(), d = t, s = v, u = V(), c = y(() => d.options.filter((e) => !d.disabled && !e.disabled)), h = y(() => {
16
- var e, a;
17
- return ((e = c.value.find((l) => l.value === d.modelValue)) == null ? void 0 : e.value) ?? ((a = c.value[0]) == null ? void 0 : a.value);
18
- });
19
- function f(e) {
20
- var l;
21
- if (d.disabled || (l = d.options.find((o) => o.value === e)) != null && l.disabled) return;
22
- const a = e !== d.modelValue;
23
- s("update:modelValue", e), a && s("change", e);
24
- }
25
- function k(e) {
26
- var m, b;
27
- if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(e.key) || d.disabled) return;
28
- const a = d.options.filter((i) => !i.disabled);
29
- if (!a.length) return;
30
- e.preventDefault();
31
- const l = a.findIndex((i) => i.value === d.modelValue), o = a[e.key === "Home" ? 0 : e.key === "End" ? a.length - 1 : l < 0 ? e.key === "ArrowLeft" ? a.length - 1 : 0 : (l + (e.key === "ArrowLeft" ? -1 : 1) + a.length) % a.length];
32
- f(o.value), (b = Array.from(((m = u.value) == null ? void 0 : m.querySelectorAll("button")) || []).find((i) => i.dataset.value === o.value)) == null || b.focus();
33
- }
34
- return (e, a) => (n(), r("div", A({
35
- ref_key: "root",
36
- ref: u
37
- }, p(g), {
38
- class: "hys-ui-ex-segment",
39
- role: "radiogroup",
40
- "aria-label": t.ariaLabel || "分段选择",
41
- style: { display: t.block ? "flex" : void 0 },
42
- onKeydown: k
43
- }), [
44
- (n(!0), r(L, null, w(t.options, (l) => (n(), r("button", {
45
- key: l.value,
46
- "data-value": l.value,
47
- type: "button",
48
- role: "radio",
49
- disabled: t.disabled || l.disabled,
50
- "aria-checked": t.modelValue === l.value,
51
- tabindex: h.value === l.value ? 0 : -1,
52
- class: S({ "hys-ui-active": t.modelValue === l.value }),
53
- style: z({ flex: t.block ? 1 : void 0, padding: t.size === "sm" ? "5px 10px" : t.size === "lg" ? "12px 20px" : void 0 }),
54
- onClick: (o) => f(l.value)
55
- }, [
56
- B(e.$slots, "label", { option: l }, () => [
57
- C(H(l.label), 1)
58
- ])
59
- ], 14, D))), 128))
60
- ], 16, R));
61
- }
62
- });
1
+ import e from "./HysSegmented2.vue.js";
2
+ /* empty css */
3
+ import o from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const a = /* @__PURE__ */ o(e, [["__scopeId", "data-v-ce15ba8e"]]);
63
5
  export {
64
- F as default
6
+ a as default
65
7
  };
@@ -1,4 +1,275 @@
1
- import f from "./HysSegmented.vue.js";
1
+ import { defineComponent as le, ref as D, useAttrs as ie, useId as re, inject as oe, computed as k, watch as ne, nextTick as W, onMounted as ue, onActivated as se, onDeactivated as de, onBeforeUnmount as ce, openBlock as b, createElementBlock as w, mergeProps as ve, unref as l, createElementVNode as G, normalizeStyle as J, Fragment as me, renderList as fe, normalizeClass as ye, renderSlot as E, createBlock as be, resolveDynamicComponent as he, toRaw as ge, createCommentVNode as L, createTextVNode as Q, toDisplayString as M } from "vue";
2
+ import { useHysRootAttrs as ke } from "../../config.js";
3
+ import { fieldKey as we, useHysControlState as Ae } from "../../composables/formContext.js";
4
+ import { useChoiceModel as Be, useChoiceNativeReset as pe } from "../../composables/choiceModel.js";
5
+ import { choiceOptions as xe, choiceKey as A } from "../../composables/choice.js";
6
+ const Oe = ["id", "data-status", "aria-label", "aria-orientation", "aria-disabled", "aria-readonly", "aria-required", "aria-invalid", "aria-describedby"], je = ["data-key", "data-value", "disabled", "aria-disabled", "aria-checked", "tabindex", "title", "onClick"], Ce = { class: "hys-ui-segment-label" }, Ee = {
7
+ key: 0,
8
+ class: "hys-ui-segment-empty"
9
+ }, Le = ["name", "form", "value", "disabled"], Ve = ["id"], Te = /* @__PURE__ */ le({
10
+ inheritAttrs: !1,
11
+ __name: "HysSegmented",
12
+ props: {
13
+ modelValue: {},
14
+ defaultValue: {},
15
+ options: {},
16
+ fieldNames: {},
17
+ disabled: { type: Boolean },
18
+ readonly: { type: Boolean },
19
+ block: { type: Boolean },
20
+ vertical: { type: Boolean },
21
+ direction: {},
22
+ size: {},
23
+ round: { type: Boolean },
24
+ keyboard: { type: Boolean, default: !0 },
25
+ loopNavigation: { type: Boolean, default: !0 },
26
+ focusable: { type: Boolean, default: !0 },
27
+ autofocus: { type: Boolean },
28
+ ariaLabel: {},
29
+ name: {},
30
+ form: {},
31
+ status: {},
32
+ error: {},
33
+ emptyText: { default: "暂无选项" }
34
+ },
35
+ emits: ["update:modelValue", "change", "focus", "blur"],
36
+ setup(r, { expose: X, emit: Y }) {
37
+ const i = r, x = Y, o = D(), O = ie(), Z = ke(), I = re(), s = oe(we, void 0), { disabled: c, size: K, label: _ } = Ae(i), m = k(
38
+ () => xe(
39
+ i.options ?? [],
40
+ i.fieldNames
41
+ )
42
+ ), j = Be(
43
+ i,
44
+ () => {
45
+ var e;
46
+ return i.defaultValue === void 0 ? ((e = m.value.find((a) => !a.disabled)) == null ? void 0 : e.value) ?? null : i.defaultValue;
47
+ }
48
+ ), n = j.current, U = k(
49
+ () => m.value.find((e) => Object.is(e.value, n.value))
50
+ ), V = k(
51
+ () => i.direction ? i.direction === "vertical" : i.vertical
52
+ ), z = k(
53
+ () => m.value.filter((e) => !e.disabled)
54
+ ), $ = k(
55
+ () => {
56
+ var e, a;
57
+ return ((e = z.value.find((d) => Object.is(d.value, n.value))) == null ? void 0 : e.value) ?? ((a = z.value[0]) == null ? void 0 : a.value);
58
+ }
59
+ ), P = k(
60
+ () => {
61
+ var e, a;
62
+ return i.error || (e = s == null ? void 0 : s.invalid) != null && e.value ? "error" : i.status ?? ((a = s == null ? void 0 : s.status) == null ? void 0 : a.value);
63
+ }
64
+ ), N = D({ opacity: 0 }), B = D(!1);
65
+ let f = !0, y, h, g;
66
+ function F() {
67
+ var e;
68
+ return Array.from(
69
+ ((e = o.value) == null ? void 0 : e.querySelectorAll(
70
+ ":scope > .hys-ui-segment-option"
71
+ )) ?? []
72
+ );
73
+ }
74
+ function ee() {
75
+ if (h = void 0, !f || !o.value) return;
76
+ const e = F().find(
77
+ (a) => a.dataset.key === A(n.value)
78
+ );
79
+ if (!e || !o.value.getClientRects().length) {
80
+ N.value = { opacity: 0 };
81
+ return;
82
+ }
83
+ N.value = {
84
+ opacity: 1,
85
+ transform: "translate3d(" + e.offsetLeft + "px," + e.offsetTop + "px,0)",
86
+ width: e.offsetWidth + "px",
87
+ height: e.offsetHeight + "px"
88
+ }, !B.value && g === void 0 && (g = requestAnimationFrame(() => {
89
+ g = void 0, f && (B.value = !0);
90
+ }));
91
+ }
92
+ function C() {
93
+ f && h === void 0 && (h = requestAnimationFrame(ee));
94
+ }
95
+ function R() {
96
+ y == null || y.disconnect(), y = void 0, window.removeEventListener("resize", C), h !== void 0 && cancelAnimationFrame(h), g !== void 0 && cancelAnimationFrame(g), h = g = void 0;
97
+ }
98
+ function S() {
99
+ if (!(!f || !o.value)) {
100
+ if (R(), typeof ResizeObserver < "u") {
101
+ y = new ResizeObserver(C), y.observe(o.value);
102
+ const e = F().find(
103
+ (a) => a.dataset.key === A(n.value)
104
+ );
105
+ e && y.observe(e);
106
+ } else window.addEventListener("resize", C);
107
+ C();
108
+ }
109
+ }
110
+ async function T(e) {
111
+ return c.value || i.readonly || !j.isLive() || !m.value.some(
112
+ (a) => Object.is(a.value, e) && !a.disabled
113
+ ) ? !1 : j.commit(
114
+ e,
115
+ (a) => x("update:modelValue", a),
116
+ (a) => x("change", a),
117
+ !0
118
+ );
119
+ }
120
+ function H(e) {
121
+ var d;
122
+ if (c.value || !i.focusable) return;
123
+ const a = e ?? $.value;
124
+ (d = F().find(
125
+ (v) => v.dataset.key === A(a) && !v.disabled
126
+ )) == null || d.focus();
127
+ }
128
+ function ae() {
129
+ var e, a;
130
+ (e = o.value) != null && e.contains(document.activeElement) && ((a = document.activeElement) == null || a.blur());
131
+ }
132
+ function te(e) {
133
+ if (!i.keyboard || e.defaultPrevented || c.value || i.readonly || ![
134
+ "ArrowLeft",
135
+ "ArrowRight",
136
+ "ArrowUp",
137
+ "ArrowDown",
138
+ "Home",
139
+ "End"
140
+ ].includes(e.key) || e.target !== o.value && !(e.target instanceof HTMLButtonElement && e.target.parentElement === o.value))
141
+ return;
142
+ e.preventDefault();
143
+ const a = z.value;
144
+ if (!a.length) return;
145
+ const d = o.value && getComputedStyle(o.value).direction === "rtl", v = e.key === "ArrowUp" || e.key === (d ? "ArrowRight" : "ArrowLeft"), p = e.target.dataset.key, t = p ? a.findIndex((q) => A(q.value) === p) : a.findIndex((q) => Object.is(q.value, n.value));
146
+ let u = e.key === "Home" ? 0 : e.key === "End" ? a.length - 1 : t < 0 ? v ? a.length - 1 : 0 : t + (v ? -1 : 1);
147
+ u = i.loopNavigation ? (u + a.length) % a.length : Math.max(0, Math.min(a.length - 1, u)), H(a[u].value), T(a[u].value);
148
+ }
149
+ return ne(
150
+ [n, m, V, K, () => i.block],
151
+ () => void W(S),
152
+ { flush: "post" }
153
+ ), pe(o, j.reset, void 0, () => i.form), ue(() => {
154
+ S(), i.autofocus && H();
155
+ }), se(() => {
156
+ f = !0, B.value = !1, W(S);
157
+ }), de(() => {
158
+ f = !1, B.value = !1, R();
159
+ }), ce(() => {
160
+ f = !1, R();
161
+ }), X({ element: o, value: n, focus: H, blur: ae, select: T }), (e, a) => {
162
+ var d, v, p;
163
+ return b(), w("div", ve({
164
+ ref_key: "root",
165
+ ref: o
166
+ }, { ...l(Z), ...l(O) }, {
167
+ id: l(O).id || ((d = l(s)) == null ? void 0 : d.id.value),
168
+ "data-hys-ui-field-managed": "",
169
+ class: ["hys-ui-ex-segment", [
170
+ "hys-ui-segment-" + l(K),
171
+ {
172
+ "hys-ui-segment-block": r.block,
173
+ "hys-ui-segment-vertical": V.value,
174
+ "hys-ui-segment-round": r.round,
175
+ "hys-ui-segment-disabled": l(c),
176
+ "hys-ui-segment-readonly": r.readonly,
177
+ "hys-ui-segment-animated": B.value
178
+ }
179
+ ]],
180
+ "data-status": P.value,
181
+ role: "radiogroup",
182
+ "aria-label": r.ariaLabel || l(O)["aria-label"] || l(_) || "分段选择",
183
+ "aria-orientation": V.value ? "vertical" : "horizontal",
184
+ "aria-disabled": l(c) || void 0,
185
+ "aria-readonly": r.readonly || void 0,
186
+ "aria-required": ((v = l(s)) == null ? void 0 : v.required.value) || void 0,
187
+ "aria-invalid": P.value === "error" || void 0,
188
+ "aria-describedby": [
189
+ l(O)["aria-describedby"],
190
+ r.error ? l(I) + "-error" : (p = l(s)) == null ? void 0 : p.describedBy.value
191
+ ].filter(Boolean).join(" ") || void 0,
192
+ onKeydown: te,
193
+ onFocusin: a[0] || (a[0] = (t) => {
194
+ var u;
195
+ return !((u = o.value) != null && u.contains(t.relatedTarget)) && x("focus", t);
196
+ }),
197
+ onFocusout: a[1] || (a[1] = (t) => {
198
+ var u;
199
+ return !((u = o.value) != null && u.contains(t.relatedTarget)) && x("blur", t);
200
+ })
201
+ }), [
202
+ G("span", {
203
+ class: "hys-ui-segment-indicator",
204
+ style: J(N.value),
205
+ "aria-hidden": "true"
206
+ }, null, 4),
207
+ (b(!0), w(me, null, fe(m.value, (t) => (b(), w("button", {
208
+ key: l(A)(t.value),
209
+ "data-key": l(A)(t.value),
210
+ "data-value": t.value,
211
+ type: "button",
212
+ class: ye(["hys-ui-segment-option", [
213
+ t.className,
214
+ { "hys-ui-active": Object.is(l(n), t.value) }
215
+ ]]),
216
+ style: J(t.style),
217
+ role: "radio",
218
+ disabled: l(c) || t.disabled,
219
+ "aria-disabled": r.readonly || void 0,
220
+ "aria-checked": Object.is(l(n), t.value),
221
+ tabindex: !l(c) && r.focusable && Object.is($.value, t.value) ? 0 : -1,
222
+ title: t.title,
223
+ onClick: (u) => T(t.value)
224
+ }, [
225
+ E(e.$slots, "icon", {
226
+ option: t,
227
+ checked: Object.is(l(n), t.value)
228
+ }, () => [
229
+ t.icon ? (b(), be(he(ge(t.icon)), {
230
+ key: 0,
231
+ class: "hys-ui-segment-icon",
232
+ "aria-hidden": "true"
233
+ })) : L("", !0)
234
+ ], !0),
235
+ G("span", Ce, [
236
+ E(e.$slots, "label", {
237
+ option: t,
238
+ checked: Object.is(l(n), t.value)
239
+ }, () => [
240
+ E(e.$slots, "default", {
241
+ item: t,
242
+ option: t,
243
+ checked: Object.is(l(n), t.value)
244
+ }, () => [
245
+ Q(M(t.label), 1)
246
+ ], !0)
247
+ ], !0)
248
+ ])
249
+ ], 14, je))), 128)),
250
+ m.value.length ? L("", !0) : (b(), w("span", Ee, [
251
+ E(e.$slots, "empty", {}, () => [
252
+ Q(M(r.emptyText), 1)
253
+ ], !0)
254
+ ])),
255
+ r.name && U.value && !U.value.disabled ? (b(), w("input", {
256
+ key: 1,
257
+ type: "hidden",
258
+ name: r.name,
259
+ form: r.form,
260
+ value: String(l(n)),
261
+ disabled: l(c)
262
+ }, null, 8, Le)) : L("", !0),
263
+ r.error ? (b(), w("small", {
264
+ key: 2,
265
+ id: l(I) + "-error",
266
+ class: "hys-ui-segment-error",
267
+ role: "alert"
268
+ }, M(r.error), 9, Ve)) : L("", !0)
269
+ ], 16, Oe);
270
+ };
271
+ }
272
+ });
2
273
  export {
3
- f as default
274
+ Te as default
4
275
  };
@@ -1,7 +1,8 @@
1
1
  import o from "./HysSelect2.vue.js";
2
2
  /* empty css */
3
+ /* empty css */
3
4
  import t from "../../_virtual/_plugin-vue_export-helper.js";
4
- const c = /* @__PURE__ */ t(o, [["__scopeId", "data-v-eb19a68c"]]);
5
+ const s = /* @__PURE__ */ t(o, [["__scopeId", "data-v-6d43948d"]]);
5
6
  export {
6
- c as default
7
+ s as default
7
8
  };