x-next 1.1.0 → 1.3.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 (206) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/_hooks/use-form-item.d.ts +5 -0
  3. package/dist/_hooks/use-picker-focus.d.ts +17 -0
  4. package/dist/components/_components/feedback-icon/index.vue.d.ts +4 -4
  5. package/dist/components/_components/picker/input-range.vue.d.ts +10 -6
  6. package/dist/components/_components/picker/input.vue.d.ts +9 -5
  7. package/dist/components/alert/Alert.vue.d.ts +5 -5
  8. package/dist/components/alert/index.d.ts +10 -10
  9. package/dist/components/date-picker/DatePanel.vue.d.ts +5 -0
  10. package/dist/components/date-picker/DatePicker.vue.d.ts +36 -16
  11. package/dist/components/date-picker/index.d.ts +77 -33
  12. package/dist/components/dialog/Dialog.d.ts +1 -1
  13. package/dist/components/dialog/index.d.ts +3 -3
  14. package/dist/components/drawer/index.d.ts +3 -3
  15. package/dist/components/drawer/src/Drawer.vue.d.ts +1 -1
  16. package/dist/components/dropdown/Dropdown.vue.d.ts +30 -4
  17. package/dist/components/dropdown/DropdownButton.vue.d.ts +31 -5
  18. package/dist/components/dropdown/DropdownOption.vue.d.ts +2 -0
  19. package/dist/components/dropdown/DropdownSubmenu.vue.d.ts +162 -5
  20. package/dist/components/dropdown/context.d.ts +14 -1
  21. package/dist/components/dropdown/dropdown-panel.vue.d.ts +7 -1
  22. package/dist/components/dropdown/index.d.ts +610 -28
  23. package/dist/components/dropdown/use-keyboard.d.ts +10 -0
  24. package/dist/components/form/FormItem.vue.d.ts +12 -4
  25. package/dist/components/form/context.d.ts +6 -0
  26. package/dist/components/form/form-item-label.vue.d.ts +4 -4
  27. package/dist/components/form/form-item-message.vue.d.ts +2 -0
  28. package/dist/components/form/index.d.ts +30 -8
  29. package/dist/components/form/interface.d.ts +2 -2
  30. package/dist/components/form-input/InputPassword.vue.d.ts +20 -2
  31. package/dist/components/form-input/index.d.ts +22 -4
  32. package/dist/components/form-select/Select.d.ts +3 -3
  33. package/dist/components/form-select/hooks/use-select.d.ts +2 -1
  34. package/dist/components/form-select/index.d.ts +6 -6
  35. package/dist/components/form-slider/Slider.vue.d.ts +10 -3
  36. package/dist/components/form-slider/index.d.ts +26 -6
  37. package/dist/components/form-slider/slider-button.vue.d.ts +4 -3
  38. package/dist/components/form-switch/Switch.vue.d.ts +2 -1
  39. package/dist/components/form-switch/index.d.ts +5 -2
  40. package/dist/components/form-textarea/Textarea.vue.d.ts +2 -2
  41. package/dist/components/form-textarea/index.d.ts +5 -5
  42. package/dist/components/image/Image.vue.d.ts +10 -9
  43. package/dist/components/image/ImagePreview.vue.d.ts +8 -7
  44. package/dist/components/image/ImagePreviewAction.d.ts +3 -3
  45. package/dist/components/image/ImagePreviewGroup.vue.d.ts +8 -7
  46. package/dist/components/image/index.d.ts +59 -52
  47. package/dist/components/image/preview-arrow.vue.d.ts +2 -2
  48. package/dist/components/image/preview-toolbar.vue.d.ts +3 -3
  49. package/dist/components/layout/LayoutSidebar.vue.d.ts +2 -2
  50. package/dist/components/layout/index.d.ts +4 -4
  51. package/dist/components/link/Link.vue.d.ts +2 -2
  52. package/dist/components/link/index.d.ts +4 -4
  53. package/dist/components/menu/Menu.d.ts +2 -2
  54. package/dist/components/menu/base-menu.vue.d.ts +2 -2
  55. package/dist/components/menu/index.d.ts +4 -4
  56. package/dist/components/menu/sub-menu-pop.vue.d.ts +5 -5
  57. package/dist/components/message/index.d.ts +17 -17
  58. package/dist/components/message/message.vue.d.ts +8 -8
  59. package/dist/components/notification/Notification.d.ts +1 -1
  60. package/dist/components/notification/index.d.ts +3 -3
  61. package/dist/components/pagination/page-item-ellipsis.vue.d.ts +1 -1
  62. package/dist/components/pagination/page-item-step.vue.d.ts +2 -2
  63. package/dist/components/pagination/page-options.vue.d.ts +6 -6
  64. package/dist/components/popconfirm/src/popup.vue.d.ts +1 -1
  65. package/dist/components/popover/Popover.d.ts +1 -1
  66. package/dist/components/popover/index.d.ts +3 -3
  67. package/dist/components/popup/Popup.d.ts +1 -1
  68. package/dist/components/popup/index.d.ts +3 -3
  69. package/dist/components/progress/Progress.vue.d.ts +4 -4
  70. package/dist/components/progress/circle.vue.d.ts +2 -2
  71. package/dist/components/progress/index.d.ts +8 -8
  72. package/dist/components/progress/line.vue.d.ts +1 -1
  73. package/dist/components/progress/steps.vue.d.ts +1 -1
  74. package/dist/components/steps/Step.vue.d.ts +2 -2
  75. package/dist/components/steps/index.d.ts +4 -4
  76. package/dist/components/tabs/Tabs.d.ts +1 -1
  77. package/dist/components/tabs/index.d.ts +3 -3
  78. package/dist/components/tabs/tabs-tab.vue.d.ts +1 -1
  79. package/dist/components/tag/Tag.vue.d.ts +2 -2
  80. package/dist/components/tag/index.d.ts +4 -4
  81. package/dist/components/time-picker/TimeColumn.vue.d.ts +3 -0
  82. package/dist/components/time-picker/TimePanel.vue.d.ts +3 -0
  83. package/dist/components/time-picker/TimePicker.vue.d.ts +33 -17
  84. package/dist/components/time-picker/index.d.ts +73 -36
  85. package/dist/components/time-range-selector/TimeRangeSelector.vue.d.ts +8 -0
  86. package/dist/components/time-range-selector/index.d.ts +22 -0
  87. package/dist/components/tooltip/Tooltip.vue.d.ts +1 -1
  88. package/dist/components/tooltip/index.d.ts +3 -3
  89. package/dist/components/trigger/Trigger.d.ts +1 -1
  90. package/dist/components/trigger/index.d.ts +3 -3
  91. package/dist/es/_hooks/use-form-item.js +36 -10
  92. package/dist/es/_hooks/use-overflow.js +45 -40
  93. package/dist/es/_hooks/use-picker-focus.js +57 -0
  94. package/dist/es/_utils/constant.js +17 -5
  95. package/dist/es/components/_components/picker/input-range.vue.js +45 -55
  96. package/dist/es/components/_components/picker/input-range.vue2.js +105 -70
  97. package/dist/es/components/_components/picker/input.vue.js +22 -25
  98. package/dist/es/components/_components/picker/input.vue2.js +58 -43
  99. package/dist/es/components/_components/select-view/select-view.js +61 -66
  100. package/dist/es/components/date-picker/DatePanel.vue.js +102 -94
  101. package/dist/es/components/date-picker/DatePanel.vue2.js +97 -44
  102. package/dist/es/components/date-picker/DatePicker.vue.js +71 -58
  103. package/dist/es/components/date-picker/DatePicker.vue2.js +285 -231
  104. package/dist/es/components/dialog/Dialog.js +159 -128
  105. package/dist/es/components/dropdown/Dropdown.vue.js +18 -15
  106. package/dist/es/components/dropdown/Dropdown.vue2.js +52 -31
  107. package/dist/es/components/dropdown/DropdownOption.vue.js +22 -21
  108. package/dist/es/components/dropdown/DropdownOption.vue2.js +23 -19
  109. package/dist/es/components/dropdown/DropdownSubmenu.vue.js +49 -36
  110. package/dist/es/components/dropdown/DropdownSubmenu.vue2.js +45 -24
  111. package/dist/es/components/dropdown/context.js +3 -2
  112. package/dist/es/components/dropdown/dropdown-panel.vue.js +24 -21
  113. package/dist/es/components/dropdown/dropdown-panel.vue2.js +83 -31
  114. package/dist/es/components/dropdown/use-keyboard.js +45 -0
  115. package/dist/es/components/form/Form.vue2.js +113 -101
  116. package/dist/es/components/form/FormItem.vue.js +26 -22
  117. package/dist/es/components/form/FormItem.vue2.js +162 -125
  118. package/dist/es/components/form/form-item-message.vue.js +31 -24
  119. package/dist/es/components/form/form-item-message.vue2.js +4 -2
  120. package/dist/es/components/form-checkbox/Checkbox.js +80 -76
  121. package/dist/es/components/form-checkbox/CheckboxGroup.js +43 -38
  122. package/dist/es/components/form-input/Input.js +83 -79
  123. package/dist/es/components/form-input/InputPassword.vue.js +19 -16
  124. package/dist/es/components/form-input/InputPassword.vue2.js +39 -29
  125. package/dist/es/components/form-input/InputSearch.js +47 -37
  126. package/dist/es/components/form-input-number/InputNumber.js +134 -133
  127. package/dist/es/components/form-input-tag/InputTag.js +173 -162
  128. package/dist/es/components/form-radio/Radio.js +74 -71
  129. package/dist/es/components/form-radio/RadioGroup.js +55 -49
  130. package/dist/es/components/form-select/Select.js +116 -114
  131. package/dist/es/components/form-select/hooks/use-select.js +128 -128
  132. package/dist/es/components/form-slider/Slider.vue.js +28 -28
  133. package/dist/es/components/form-slider/Slider.vue2.js +139 -132
  134. package/dist/es/components/form-slider/slider-button.vue.js +6 -6
  135. package/dist/es/components/form-slider/slider-button.vue2.js +39 -34
  136. package/dist/es/components/form-switch/Switch.vue.js +9 -9
  137. package/dist/es/components/form-switch/Switch.vue2.js +81 -74
  138. package/dist/es/components/form-textarea/Textarea.vue2.js +123 -108
  139. package/dist/es/components/image/Image.vue2.js +77 -76
  140. package/dist/es/components/image/ImagePreview.vue.js +13 -12
  141. package/dist/es/components/image/ImagePreview.vue2.js +141 -136
  142. package/dist/es/components/image/ImagePreviewGroup.vue.js +1 -1
  143. package/dist/es/components/image/ImagePreviewGroup.vue2.js +82 -83
  144. package/dist/es/components/rate/Rate.js +106 -103
  145. package/dist/es/components/time-picker/TimeColumn.vue.js +34 -23
  146. package/dist/es/components/time-picker/TimeColumn.vue2.js +37 -28
  147. package/dist/es/components/time-picker/TimePicker.vue.js +83 -64
  148. package/dist/es/components/time-picker/TimePicker.vue2.js +192 -156
  149. package/dist/es/components/time-range-selector/TimeRangeSelector.vue.js +327 -193
  150. package/dist/es/locale/en-US.js +6 -0
  151. package/dist/es/locale/zh-CN.js +6 -0
  152. package/dist/es/style.css +1 -1
  153. package/dist/icons/_self/down.d.ts +1 -1
  154. package/dist/icons/_self/dropdown/more.d.ts +1 -1
  155. package/dist/icons/_self/empty-better.d.ts +1 -1
  156. package/dist/icons/_self/empty.d.ts +1 -1
  157. package/dist/icons/_self/eye-invisible.d.ts +1 -1
  158. package/dist/icons/_self/eye.d.ts +1 -1
  159. package/dist/icons/_self/full-screen.d.ts +1 -1
  160. package/dist/icons/_self/left.d.ts +1 -1
  161. package/dist/icons/_self/menu/down.d.ts +1 -1
  162. package/dist/icons/_self/minus.d.ts +1 -1
  163. package/dist/icons/_self/more-dot.d.ts +1 -1
  164. package/dist/icons/_self/next.d.ts +1 -1
  165. package/dist/icons/_self/original-size.d.ts +1 -1
  166. package/dist/icons/_self/plus.d.ts +1 -1
  167. package/dist/icons/_self/prev.d.ts +1 -1
  168. package/dist/icons/_self/question-message.d.ts +1 -1
  169. package/dist/icons/_self/right.d.ts +1 -1
  170. package/dist/icons/_self/rotate-left.d.ts +1 -1
  171. package/dist/icons/_self/rotate-right.d.ts +1 -1
  172. package/dist/icons/_self/search.d.ts +1 -1
  173. package/dist/icons/_self/up.d.ts +1 -1
  174. package/dist/icons/_self/zoom-in.d.ts +1 -1
  175. package/dist/icons/_self/zoom-out.d.ts +1 -1
  176. package/dist/icons/_ui/alone-left.d.ts +1 -1
  177. package/dist/icons/_ui/alone-margin-left.d.ts +1 -1
  178. package/dist/icons/_ui/alone-margin-right.d.ts +1 -1
  179. package/dist/icons/_ui/alone-right.d.ts +1 -1
  180. package/dist/icons/_ui/calendar.d.ts +1 -1
  181. package/dist/icons/_ui/time.d.ts +1 -1
  182. package/dist/icons/animation/animation-loading.d.ts +1 -1
  183. package/dist/icons/default/check-circle-fill.d.ts +1 -1
  184. package/dist/icons/default/check.d.ts +1 -1
  185. package/dist/icons/default/close-circle-fill.d.ts +1 -1
  186. package/dist/icons/default/close.d.ts +1 -1
  187. package/dist/icons/default/exclamation-circle-fill.d.ts +1 -1
  188. package/dist/icons/default/exclamation.d.ts +1 -1
  189. package/dist/icons/default/filter.d.ts +1 -1
  190. package/dist/icons/default/info-circle-fill.d.ts +1 -1
  191. package/dist/icons/default/link.d.ts +1 -1
  192. package/dist/icons/default/logo-simple.d.ts +1 -1
  193. package/dist/icons/default/minus-circle-fill.d.ts +1 -1
  194. package/dist/icons/icon.d.ts +2 -2
  195. package/dist/icons/index.d.ts +3 -3
  196. package/dist/index.cjs +4 -4
  197. package/dist/index.d.ts +1 -1
  198. package/dist/index.umd.js +4 -4
  199. package/dist/locale/interface.d.ts +6 -0
  200. package/dist/style/base.css +1 -1
  201. package/dist/style/date-picker.css +1 -1
  202. package/dist/style/form.css +1 -1
  203. package/dist/style/image.css +1 -1
  204. package/dist/style/time-range-selector.css +1 -1
  205. package/dist/style.css +1 -1
  206. package/package.json +2 -2
@@ -1,24 +1,25 @@
1
- import { defineComponent as ne, toRefs as le, toRef as ie, ref as M, watch as ue, computed as B } from "vue";
2
- import z from "../../node_modules/.pnpm/number-precision@1.6.0/node_modules/number-precision/build/index.es.js";
3
- import me from "./slider-button.vue.js";
4
- import oe from "./slider-dots.vue.js";
5
- import re from "./slider-marks.vue.js";
6
- import de from "./slider-ticks.vue.js";
7
- import ce from "./slider-input.vue.js";
8
- import { isUndefined as C, isArray as s } from "../../_utils/is.js";
9
- import { TRIGGER_POSITIONS as fe, SIZES as ve } from "../../_utils/constant.js";
10
- import { getLegalValue as se, getOffsetPercent as h, getPositionStyle as he } from "./utils.js";
11
- import { useFormItem as ge } from "../../_hooks/use-form-item.js";
12
- import { useSize as ye } from "../../_hooks/use-size.js";
13
- import { getClassNameMixin as Ve } from "../../_utils/config.js";
14
- const Ie = ne({
1
+ import { defineComponent as re, computed as c, toRefs as oe, toRef as me, ref as B, watch as ce } from "vue";
2
+ import C from "../../node_modules/.pnpm/number-precision@1.6.0/node_modules/number-precision/build/index.es.js";
3
+ import de from "./slider-button.vue.js";
4
+ import fe from "./slider-dots.vue.js";
5
+ import se from "./slider-marks.vue.js";
6
+ import ve from "./slider-ticks.vue.js";
7
+ import he from "./slider-input.vue.js";
8
+ import { isUndefined as z, isArray as h } from "../../_utils/is.js";
9
+ import { TRIGGER_POSITIONS as ge, SIZES as ye } from "../../_utils/constant.js";
10
+ import { getLegalValue as Ve, getOffsetPercent as g, getPositionStyle as Se } from "./utils.js";
11
+ import { useFormItem as be } from "../../_hooks/use-form-item.js";
12
+ import { useSize as ke } from "../../_hooks/use-size.js";
13
+ import { getClassNameMixin as xe } from "../../_utils/config.js";
14
+ const Te = re({
15
15
  name: "Slider",
16
+ inheritAttrs: !1,
16
17
  components: {
17
- SliderButton: me,
18
- SliderDots: oe,
19
- SliderMarks: re,
20
- SliderTicks: de,
21
- SliderInput: ce
18
+ SliderButton: de,
19
+ SliderDots: fe,
20
+ SliderMarks: se,
21
+ SliderTicks: ve,
22
+ SliderInput: he
22
23
  },
23
24
  props: {
24
25
  /**
@@ -92,7 +93,7 @@ const Ie = ne({
92
93
  */
93
94
  size: {
94
95
  type: String,
95
- validator: (e) => ve.includes(e)
96
+ validator: (e) => ye.includes(e)
96
97
  },
97
98
  /**
98
99
  * @zh 是否显示刻度线
@@ -136,7 +137,7 @@ const Ie = ne({
136
137
  */
137
138
  tooltipPosition: {
138
139
  type: String,
139
- validator: (e) => fe.includes(e)
140
+ validator: (e) => ge.includes(e)
140
141
  }
141
142
  },
142
143
  emits: {
@@ -163,154 +164,160 @@ const Ie = ne({
163
164
  */
164
165
  blur: (e) => !0
165
166
  },
166
- setup(e, { emit: d }) {
167
- const { modelValue: D, size: T } = le(e), o = Ve("slider"), {
168
- mergedDisabled: g,
169
- mergedSize: L,
170
- eventHandlers: w
171
- } = ge({
172
- disabled: ie(e, "disabled"),
173
- size: T
174
- }), { mergedSize: R } = ye(L), c = M(null), y = M(), O = C(e.modelValue) ? e.defaultValue : e.modelValue, i = (t) => se(t, e.min, e.max, e.step), V = (t) => {
175
- const a = s(t) ? i(t[0] ?? e.min) : e.min, n = s(t) ? i(t[1] ?? e.min) : i(t ?? e.min);
176
- return a <= n ? [a, n] : [n, a];
177
- }, [F, K] = V(O), u = M(F), l = M(K);
178
- ue(D, (t) => {
179
- s(t) ? [u.value, l.value] = V(t) : l.value = i(t ?? e.min);
167
+ setup(e, { emit: d, attrs: A }) {
168
+ const R = (t) => t === "id" || t.startsWith("aria-"), D = c(
169
+ () => Object.fromEntries(Object.entries(A).filter(([t]) => !R(t)))
170
+ ), T = c(
171
+ () => Object.fromEntries(Object.entries(A).filter(([t]) => R(t)))
172
+ ), { modelValue: L, size: F } = oe(e), o = xe("slider"), {
173
+ mergedDisabled: y,
174
+ mergedSize: K,
175
+ eventHandlers: E
176
+ } = be({
177
+ disabled: me(e, "disabled"),
178
+ size: F
179
+ }), { mergedSize: N } = ke(K), f = B(null), V = B(), P = z(e.modelValue) ? e.defaultValue : e.modelValue, i = (t) => Ve(t, e.min, e.max, e.step), S = (t) => {
180
+ const n = h(t) ? i(t[0] ?? e.min) : e.min, a = h(t) ? i(t[1] ?? e.min) : i(t ?? e.min);
181
+ return n <= a ? [n, a] : [a, n];
182
+ }, [_, H] = S(P), u = B(_), l = B(H);
183
+ ce(L, (t) => {
184
+ h(t) ? [u.value, l.value] = S(t) : l.value = i(t ?? e.min);
180
185
  });
181
- const N = () => e.range ? u.value <= l.value ? [u.value, l.value] : [l.value, u.value] : l.value, P = (t) => {
182
- var a, n;
183
- d("focus", t), (n = (a = w.value) == null ? void 0 : a.onFocus) == null || n.call(a, t);
184
- }, _ = (t) => {
185
- var a, n;
186
- d("blur", t), (n = (a = w.value) == null ? void 0 : a.onBlur) == null || n.call(a, t);
187
- }, r = () => {
188
- var a, n;
189
- const t = N();
190
- d("update:modelValue", t), d("change", t), (n = (a = w.value) == null ? void 0 : a.onChange) == null || n.call(a);
191
- }, f = () => {
192
- d("changeEnd", N());
193
- }, H = (t) => {
194
- u.value = Math.min(i(t ?? e.min), l.value), r(), f();
195
- }, $ = (t) => {
196
- l.value = Math.max(i(t ?? e.min), u.value), r(), f();
197
- }, S = B(() => e.range ? s(e.modelValue) ? V(e.modelValue) : V([u.value, e.modelValue ?? l.value]) : C(e.modelValue) ? [e.min, i(l.value)] : s(e.modelValue) ? [e.min, i(e.modelValue[1] ?? e.min)] : [e.min, i(e.modelValue)]), j = B(
186
+ const O = () => e.range ? u.value <= l.value ? [u.value, l.value] : [l.value, u.value] : l.value, $ = (t) => {
187
+ var n, a;
188
+ d("focus", t), (a = (n = E.value) == null ? void 0 : n.onFocus) == null || a.call(n, t);
189
+ }, G = (t) => {
190
+ var n, a;
191
+ d("blur", t), (a = (n = E.value) == null ? void 0 : n.onBlur) == null || a.call(n, t);
192
+ }, m = () => {
193
+ var n, a;
194
+ const t = O();
195
+ d("update:modelValue", t), d("change", t), (a = (n = E.value) == null ? void 0 : n.onChange) == null || a.call(n);
196
+ }, s = () => {
197
+ d("changeEnd", O());
198
+ }, U = (t) => {
199
+ u.value = Math.min(i(t ?? e.min), l.value), m(), s();
200
+ }, W = (t) => {
201
+ l.value = Math.max(i(t ?? e.min), u.value), m(), s();
202
+ }, b = c(() => e.range ? h(e.modelValue) ? S(e.modelValue) : S([u.value, e.modelValue ?? l.value]) : z(e.modelValue) ? [e.min, i(l.value)] : h(e.modelValue) ? [e.min, i(e.modelValue[1] ?? e.min)] : [e.min, i(e.modelValue)]), X = c(
198
203
  () => Object.keys(e.marks || {}).map((t) => {
199
- var n;
200
- const a = Number(t);
204
+ var a;
205
+ const n = Number(t);
201
206
  return {
202
- key: a,
203
- content: (n = e.marks) == null ? void 0 : n[a],
204
- isActive: a >= S.value[0] && a <= S.value[1]
207
+ key: n,
208
+ content: (a = e.marks) == null ? void 0 : a[n],
209
+ isActive: n >= b.value[0] && n <= b.value[1]
205
210
  };
206
211
  })
207
- ), G = (t) => he(h(t, [e.min, e.max]), e.direction), U = () => {
208
- c.value && (y.value = c.value.getBoundingClientRect());
212
+ ), Y = (t) => Se(g(t, [e.min, e.max]), e.direction), Z = () => {
213
+ f.value && (V.value = f.value.getBoundingClientRect());
209
214
  };
210
- function k(t, a) {
211
- if (!y.value)
215
+ function k(t, n) {
216
+ if (!V.value)
212
217
  return 0;
213
- const { left: n, top: m, width: E, height: b } = y.value, x = e.direction === "horizontal" ? E : b;
214
- if (x <= 0 || e.max <= e.min)
218
+ const { left: a, top: r, width: w, height: x } = V.value, M = e.direction === "horizontal" ? w : x;
219
+ if (M <= 0 || e.max <= e.min)
215
220
  return e.min;
216
- const I = x * e.step / (e.max - e.min);
217
- if (I <= 0)
221
+ const j = M * e.step / (e.max - e.min);
222
+ if (j <= 0)
218
223
  return e.min;
219
- let v = e.direction === "horizontal" ? t - n : m + b - a;
220
- v < 0 && (v = 0), v > x && (v = x);
221
- const ae = Math.round(v / I);
222
- return i(z.plus(e.min, z.times(ae, e.step)));
224
+ let v = e.direction === "horizontal" ? t - a : r + x - n;
225
+ v < 0 && (v = 0), v > M && (v = M);
226
+ const ue = Math.round(v / j);
227
+ return i(C.plus(e.min, C.times(ue, e.step)));
223
228
  }
224
- const X = (t, a) => {
225
- l.value = e.range ? Math.max(k(t, a), u.value) : k(t, a), r();
226
- }, Y = (t) => {
227
- if (g.value)
229
+ const q = (t, n) => {
230
+ l.value = e.range ? Math.max(k(t, n), u.value) : k(t, n), m();
231
+ }, J = (t) => {
232
+ if (y.value)
228
233
  return;
229
- const { clientX: a, clientY: n } = t;
230
- c.value && (y.value = c.value.getBoundingClientRect());
231
- const m = k(a, n);
234
+ const { clientX: n, clientY: a } = t;
235
+ f.value && (V.value = f.value.getBoundingClientRect());
236
+ const r = k(n, a);
232
237
  if (e.range) {
233
- const [E, b] = S.value;
234
- Math.abs(m - E) <= Math.abs(m - b) ? u.value = Math.min(m, l.value) : l.value = Math.max(m, u.value);
238
+ const [w, x] = b.value;
239
+ Math.abs(r - w) <= Math.abs(r - x) ? u.value = Math.min(r, l.value) : l.value = Math.max(r, u.value);
235
240
  } else
236
- l.value = m;
237
- r(), f();
241
+ l.value = r;
242
+ m(), s();
238
243
  };
239
- function Z([t, a]) {
240
- return t > a && ([t, a] = [a, t]), e.direction === "vertical" ? {
241
- bottom: h(t, [e.min, e.max]),
242
- top: h(e.max + e.min - a, [e.min, e.max])
244
+ function Q([t, n]) {
245
+ return t > n && ([t, n] = [n, t]), e.direction === "vertical" ? {
246
+ bottom: g(t, [e.min, e.max]),
247
+ top: g(e.max + e.min - n, [e.min, e.max])
243
248
  } : {
244
- left: h(t, [e.min, e.max]),
245
- right: h(e.max + e.min - a, [e.min, e.max])
249
+ left: g(t, [e.min, e.max]),
250
+ right: g(e.max + e.min - n, [e.min, e.max])
246
251
  };
247
252
  }
248
- const q = (t, a) => {
249
- u.value = Math.min(k(t, a), l.value), r();
250
- }, J = () => {
251
- f();
252
- }, Q = (t) => {
253
- const a = t.key;
254
- if (a === "Home")
253
+ const p = (t, n) => {
254
+ u.value = Math.min(k(t, n), l.value), m();
255
+ }, ee = () => {
256
+ s();
257
+ }, te = (t) => {
258
+ const n = t.key;
259
+ if (n === "Home")
255
260
  return e.min;
256
- if (a === "End")
261
+ if (n === "End")
257
262
  return e.max;
258
- if (a === "ArrowRight" || a === "ArrowUp")
263
+ if (n === "ArrowRight" || n === "ArrowUp")
259
264
  return e.step;
260
- if (a === "ArrowLeft" || a === "ArrowDown")
265
+ if (n === "ArrowLeft" || n === "ArrowDown")
261
266
  return -e.step;
262
- }, A = (t, a) => {
263
- if (g.value)
267
+ }, I = (t, n) => {
268
+ if (y.value)
264
269
  return;
265
- const n = Q(a);
266
- if (C(n))
270
+ const a = te(n);
271
+ if (z(a))
267
272
  return;
268
- a.preventDefault();
269
- const m = a.key === "Home" || a.key === "End" ? n : z.plus(t === "start" ? u.value : l.value, n);
270
- t === "start" ? u.value = e.range ? Math.min(i(m), l.value) : i(m) : l.value = e.range ? Math.max(i(m), u.value) : i(m), r(), f();
271
- }, W = (t) => {
272
- A("start", t);
273
- }, p = (t) => {
274
- A("end", t);
275
- }, ee = B(() => [
273
+ n.preventDefault();
274
+ const r = n.key === "Home" || n.key === "End" ? a : C.plus(t === "start" ? u.value : l.value, a);
275
+ t === "start" ? u.value = e.range ? Math.min(i(r), l.value) : i(r) : l.value = e.range ? Math.max(i(r), u.value) : i(r), m(), s();
276
+ }, ne = (t) => {
277
+ I("start", t);
278
+ }, ae = (t) => {
279
+ I("end", t);
280
+ }, le = c(() => [
276
281
  o.block,
277
- o.modifier(`size-${R.value}`),
282
+ o.modifier(`size-${N.value}`),
278
283
  {
279
284
  [o.modifier("vertical")]: e.direction === "vertical",
280
285
  [o.modifier("with-marks")]: !!e.marks
281
286
  }
282
- ]), te = B(() => [
287
+ ]), ie = c(() => [
283
288
  o.element("track"),
284
289
  {
285
- [`${o.element("track")}-disabled`]: g.value,
290
+ [`${o.element("track")}-disabled`]: y.value,
286
291
  [`${o.element("track")}-vertical`]: e.direction === "vertical"
287
292
  }
288
293
  ]);
289
294
  return {
295
+ wrapperAttrs: D,
296
+ controlAttrs: T,
290
297
  className: o,
291
- cls: ee,
292
- trackCls: te,
293
- trackRef: c,
294
- computedValue: S,
295
- mergedDisabled: g,
296
- mergedSize: R,
297
- markList: j,
298
- getBtnStyle: G,
299
- getBarStyle: Z,
300
- handleClick: Y,
301
- handleMoveStart: U,
302
- handleEndMoving: X,
303
- handleMoveEnd: J,
304
- handleStartMoving: q,
305
- handleStartChange: H,
306
- handleEndChange: $,
307
- handleStartKeyDown: W,
308
- handleEndKeyDown: p,
309
- handleFocus: P,
310
- handleBlur: _
298
+ cls: le,
299
+ trackCls: ie,
300
+ trackRef: f,
301
+ computedValue: b,
302
+ mergedDisabled: y,
303
+ mergedSize: N,
304
+ markList: X,
305
+ getBtnStyle: Y,
306
+ getBarStyle: Q,
307
+ handleClick: J,
308
+ handleMoveStart: Z,
309
+ handleEndMoving: q,
310
+ handleMoveEnd: ee,
311
+ handleStartMoving: p,
312
+ handleStartChange: U,
313
+ handleEndChange: W,
314
+ handleStartKeyDown: ne,
315
+ handleEndKeyDown: ae,
316
+ handleFocus: $,
317
+ handleBlur: G
311
318
  };
312
319
  }
313
320
  });
314
321
  export {
315
- Ie as default
322
+ Te as default
316
323
  };
@@ -1,17 +1,17 @@
1
1
  import a from "./slider-button.vue2.js";
2
- import { resolveComponent as r, openBlock as t, createBlock as s, withCtx as u, createElementVNode as d, mergeProps as p, withModifiers as i } from "vue";
2
+ import { resolveComponent as r, openBlock as t, createBlock as s, withCtx as d, createElementVNode as u, mergeProps as p, withModifiers as i } from "vue";
3
3
  import m from "../../_virtual/_plugin-vue_export-helper.js";
4
- const v = ["aria-disabled", "aria-valuemax", "aria-valuemin", "aria-valuenow", "aria-valuetext"];
5
- function w(o, n, f, b, B, C) {
4
+ const v = ["tabindex", "aria-disabled", "aria-valuemax", "aria-valuemin", "aria-valuenow", "aria-valuetext"];
5
+ function w(o, n, f, b, C, B) {
6
6
  const l = r("tooltip");
7
7
  return t(), s(l, {
8
8
  "popup-visible": o.popupVisible,
9
9
  position: o.mergedTooltipPosition,
10
10
  content: o.tooltipContent
11
11
  }, {
12
- default: u(() => [
13
- d("div", p(o.$attrs, {
14
- tabindex: "0",
12
+ default: d(() => [
13
+ u("div", p(o.formControlAttrs, {
14
+ tabindex: o.disabled ? -1 : 0,
15
15
  role: "slider",
16
16
  "aria-disabled": o.disabled,
17
17
  "aria-valuemax": o.max,
@@ -1,11 +1,12 @@
1
- import { defineComponent as x, ref as B, computed as s, onBeforeUnmount as M } from "vue";
2
- import { Tooltip as N } from "../tooltip/index.js";
1
+ import { defineComponent as M, ref as N, computed as s, onBeforeUnmount as D } from "vue";
2
+ import { Tooltip as F } from "../tooltip/index.js";
3
3
  import { off as i, on as l } from "../../_utils/dom.js";
4
- import { getClassNameMixin as D } from "../../_utils/config.js";
5
- const X = x({
4
+ import { getClassNameMixin as S } from "../../_utils/config.js";
5
+ import { useFormItem as k, useFormItemControl as q } from "../../_hooks/use-form-item.js";
6
+ const U = M({
6
7
  name: "SliderButton",
7
8
  components: {
8
- Tooltip: N
9
+ Tooltip: F
9
10
  },
10
11
  inheritAttrs: !1,
11
12
  props: {
@@ -38,50 +39,54 @@ const X = x({
38
39
  }
39
40
  },
40
41
  emits: ["movestart", "moving", "moveend", "keydown", "focus", "blur"],
41
- setup(e, { emit: n }) {
42
- const m = D("slider--btn"), c = B(!1), w = () => {
42
+ setup(e, { emit: n, attrs: w }) {
43
+ const d = S("slider--btn"), { formItemCtx: h } = k(), v = q(h, () => w, {
44
+ labelable: !1,
45
+ required: !1
46
+ }), r = N(!1), f = () => {
43
47
  i(window, "mousemove", u), i(window, "touchmove", u), i(window, "mouseup", t), i(window, "contextmenu", t), i(window, "touchend", t), i(window, "touchcancel", t);
44
- }, f = (o) => {
45
- e.disabled || (o.preventDefault(), c.value = !0, l(window, "mousemove", u), l(window, "touchmove", u), l(window, "mouseup", t), l(window, "contextmenu", t), l(window, "touchend", t), l(window, "touchcancel", t), n("movestart"));
48
+ }, p = (o) => {
49
+ e.disabled || (o.preventDefault(), r.value = !0, l(window, "mousemove", u), l(window, "touchmove", u), l(window, "mouseup", t), l(window, "contextmenu", t), l(window, "touchend", t), l(window, "touchcancel", t), n("movestart"));
46
50
  }, u = (o) => {
47
- let a, d;
51
+ let c, a;
48
52
  if (o.type.startsWith("touch")) {
49
- const r = o.touches[0];
50
- if (!r)
53
+ const m = o.touches[0];
54
+ if (!m)
51
55
  return;
52
- d = r.clientY, a = r.clientX;
56
+ a = m.clientY, c = m.clientX;
53
57
  } else
54
- d = o.clientY, a = o.clientX;
55
- n("moving", a, d);
58
+ a = o.clientY, c = o.clientX;
59
+ n("moving", c, a);
56
60
  }, t = () => {
57
- c.value = !1, w(), n("moveend");
58
- }, h = (o) => {
61
+ r.value = !1, f(), n("moveend");
62
+ }, b = (o) => {
59
63
  n("focus", o);
60
- }, v = (o) => {
64
+ }, g = (o) => {
61
65
  n("blur", o);
62
- }, p = (o) => {
66
+ }, y = (o) => {
63
67
  e.disabled || n("keydown", o);
64
- }, b = s(() => [m.block]), g = s(
68
+ }, x = s(() => [d.block]), C = s(
65
69
  () => e.tooltipPosition ?? (e.direction === "vertical" ? "right" : "top")
66
- ), y = s(() => {
70
+ ), T = s(() => {
67
71
  var o;
68
72
  return ((o = e.formatTooltip) == null ? void 0 : o.call(e, e.value)) ?? `${e.value}`;
69
- }), T = s(
70
- () => e.showTooltip ? c.value ? !0 : void 0 : !1
73
+ }), B = s(
74
+ () => e.showTooltip ? r.value ? !0 : void 0 : !1
71
75
  );
72
- return M(w), {
73
- className: m,
74
- cls: b,
75
- tooltipContent: y,
76
- mergedTooltipPosition: g,
77
- popupVisible: T,
78
- handleMouseDown: f,
79
- handleKeyDown: p,
80
- handleFocus: h,
81
- handleBlur: v
76
+ return D(f), {
77
+ formControlAttrs: v,
78
+ className: d,
79
+ cls: x,
80
+ tooltipContent: T,
81
+ mergedTooltipPosition: C,
82
+ popupVisible: B,
83
+ handleMouseDown: p,
84
+ handleKeyDown: y,
85
+ handleFocus: b,
86
+ handleBlur: g
82
87
  };
83
88
  }
84
89
  });
85
90
  export {
86
- X as default
91
+ U as default
87
92
  };
@@ -1,10 +1,10 @@
1
1
  import c from "./Switch.vue2.js";
2
- import { resolveComponent as h, openBlock as l, createElementBlock as k, mergeProps as p, createElementVNode as d, normalizeClass as a, createBlock as u, Fragment as m, renderSlot as s, createTextVNode as r, toDisplayString as t, createCommentVNode as y } from "vue";
3
- import $ from "../../_virtual/_plugin-vue_export-helper.js";
4
- const f = ["aria-checked", "disabled"];
5
- function C(e, o, g, w, N, b) {
2
+ import { resolveComponent as h, openBlock as l, createElementBlock as m, mergeProps as p, createElementVNode as d, normalizeClass as a, createBlock as u, Fragment as k, renderSlot as s, createTextVNode as r, toDisplayString as t, createCommentVNode as y } from "vue";
3
+ import f from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const C = ["aria-checked", "disabled"];
5
+ function $(e, o, g, w, N, b) {
6
6
  const i = h("icon-loading");
7
- return l(), k("button", p(e.$attrs, {
7
+ return l(), m("button", p(e.formControlAttrs, {
8
8
  type: "button",
9
9
  role: "switch",
10
10
  "aria-checked": e.computedCheck,
@@ -23,12 +23,12 @@ function C(e, o, g, w, N, b) {
23
23
  d("span", {
24
24
  class: a(e.className.element("handle-icon"))
25
25
  }, [
26
- e.computedLoading ? (l(), u(i, { key: 0 })) : (l(), k(m, { key: 1 }, [
26
+ e.computedLoading ? (l(), u(i, { key: 0 })) : (l(), m(k, { key: 1 }, [
27
27
  e.computedCheck ? s(e.$slots, "checked-icon", { key: 0 }) : s(e.$slots, "unchecked-icon", { key: 1 })
28
28
  ], 64))
29
29
  ], 2)
30
30
  ], 2),
31
- e.showText ? (l(), k(m, { key: 0 }, [
31
+ e.showText ? (l(), m(k, { key: 0 }, [
32
32
  d("span", {
33
33
  class: a(e.className.element("text-holder"))
34
34
  }, [
@@ -48,9 +48,9 @@ function C(e, o, g, w, N, b) {
48
48
  ])
49
49
  ], 2)
50
50
  ], 64)) : y("", !0)
51
- ], 16, f);
51
+ ], 16, C);
52
52
  }
53
- const S = /* @__PURE__ */ $(c, [["render", C]]);
53
+ const S = /* @__PURE__ */ f(c, [["render", $]]);
54
54
  export {
55
55
  S as default
56
56
  };