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.
- package/CHANGELOG.md +38 -0
- package/dist/_hooks/use-form-item.d.ts +5 -0
- package/dist/_hooks/use-picker-focus.d.ts +17 -0
- package/dist/components/_components/feedback-icon/index.vue.d.ts +4 -4
- package/dist/components/_components/picker/input-range.vue.d.ts +10 -6
- package/dist/components/_components/picker/input.vue.d.ts +9 -5
- package/dist/components/alert/Alert.vue.d.ts +5 -5
- package/dist/components/alert/index.d.ts +10 -10
- package/dist/components/date-picker/DatePanel.vue.d.ts +5 -0
- package/dist/components/date-picker/DatePicker.vue.d.ts +36 -16
- package/dist/components/date-picker/index.d.ts +77 -33
- package/dist/components/dialog/Dialog.d.ts +1 -1
- package/dist/components/dialog/index.d.ts +3 -3
- package/dist/components/drawer/index.d.ts +3 -3
- package/dist/components/drawer/src/Drawer.vue.d.ts +1 -1
- package/dist/components/dropdown/Dropdown.vue.d.ts +30 -4
- package/dist/components/dropdown/DropdownButton.vue.d.ts +31 -5
- package/dist/components/dropdown/DropdownOption.vue.d.ts +2 -0
- package/dist/components/dropdown/DropdownSubmenu.vue.d.ts +162 -5
- package/dist/components/dropdown/context.d.ts +14 -1
- package/dist/components/dropdown/dropdown-panel.vue.d.ts +7 -1
- package/dist/components/dropdown/index.d.ts +610 -28
- package/dist/components/dropdown/use-keyboard.d.ts +10 -0
- package/dist/components/form/FormItem.vue.d.ts +12 -4
- package/dist/components/form/context.d.ts +6 -0
- package/dist/components/form/form-item-label.vue.d.ts +4 -4
- package/dist/components/form/form-item-message.vue.d.ts +2 -0
- package/dist/components/form/index.d.ts +30 -8
- package/dist/components/form/interface.d.ts +2 -2
- package/dist/components/form-input/InputPassword.vue.d.ts +20 -2
- package/dist/components/form-input/index.d.ts +22 -4
- package/dist/components/form-select/Select.d.ts +3 -3
- package/dist/components/form-select/hooks/use-select.d.ts +2 -1
- package/dist/components/form-select/index.d.ts +6 -6
- package/dist/components/form-slider/Slider.vue.d.ts +10 -3
- package/dist/components/form-slider/index.d.ts +26 -6
- package/dist/components/form-slider/slider-button.vue.d.ts +4 -3
- package/dist/components/form-switch/Switch.vue.d.ts +2 -1
- package/dist/components/form-switch/index.d.ts +5 -2
- package/dist/components/form-textarea/Textarea.vue.d.ts +2 -2
- package/dist/components/form-textarea/index.d.ts +5 -5
- package/dist/components/image/Image.vue.d.ts +10 -9
- package/dist/components/image/ImagePreview.vue.d.ts +8 -7
- package/dist/components/image/ImagePreviewAction.d.ts +3 -3
- package/dist/components/image/ImagePreviewGroup.vue.d.ts +8 -7
- package/dist/components/image/index.d.ts +59 -52
- package/dist/components/image/preview-arrow.vue.d.ts +2 -2
- package/dist/components/image/preview-toolbar.vue.d.ts +3 -3
- package/dist/components/layout/LayoutSidebar.vue.d.ts +2 -2
- package/dist/components/layout/index.d.ts +4 -4
- package/dist/components/link/Link.vue.d.ts +2 -2
- package/dist/components/link/index.d.ts +4 -4
- package/dist/components/menu/Menu.d.ts +2 -2
- package/dist/components/menu/base-menu.vue.d.ts +2 -2
- package/dist/components/menu/index.d.ts +4 -4
- package/dist/components/menu/sub-menu-pop.vue.d.ts +5 -5
- package/dist/components/message/index.d.ts +17 -17
- package/dist/components/message/message.vue.d.ts +8 -8
- package/dist/components/notification/Notification.d.ts +1 -1
- package/dist/components/notification/index.d.ts +3 -3
- package/dist/components/pagination/page-item-ellipsis.vue.d.ts +1 -1
- package/dist/components/pagination/page-item-step.vue.d.ts +2 -2
- package/dist/components/pagination/page-options.vue.d.ts +6 -6
- package/dist/components/popconfirm/src/popup.vue.d.ts +1 -1
- package/dist/components/popover/Popover.d.ts +1 -1
- package/dist/components/popover/index.d.ts +3 -3
- package/dist/components/popup/Popup.d.ts +1 -1
- package/dist/components/popup/index.d.ts +3 -3
- package/dist/components/progress/Progress.vue.d.ts +4 -4
- package/dist/components/progress/circle.vue.d.ts +2 -2
- package/dist/components/progress/index.d.ts +8 -8
- package/dist/components/progress/line.vue.d.ts +1 -1
- package/dist/components/progress/steps.vue.d.ts +1 -1
- package/dist/components/steps/Step.vue.d.ts +2 -2
- package/dist/components/steps/index.d.ts +4 -4
- package/dist/components/tabs/Tabs.d.ts +1 -1
- package/dist/components/tabs/index.d.ts +3 -3
- package/dist/components/tabs/tabs-tab.vue.d.ts +1 -1
- package/dist/components/tag/Tag.vue.d.ts +2 -2
- package/dist/components/tag/index.d.ts +4 -4
- package/dist/components/time-picker/TimeColumn.vue.d.ts +3 -0
- package/dist/components/time-picker/TimePanel.vue.d.ts +3 -0
- package/dist/components/time-picker/TimePicker.vue.d.ts +33 -17
- package/dist/components/time-picker/index.d.ts +73 -36
- package/dist/components/time-range-selector/TimeRangeSelector.vue.d.ts +8 -0
- package/dist/components/time-range-selector/index.d.ts +22 -0
- package/dist/components/tooltip/Tooltip.vue.d.ts +1 -1
- package/dist/components/tooltip/index.d.ts +3 -3
- package/dist/components/trigger/Trigger.d.ts +1 -1
- package/dist/components/trigger/index.d.ts +3 -3
- package/dist/es/_hooks/use-form-item.js +36 -10
- package/dist/es/_hooks/use-overflow.js +45 -40
- package/dist/es/_hooks/use-picker-focus.js +57 -0
- package/dist/es/_utils/constant.js +17 -5
- package/dist/es/components/_components/picker/input-range.vue.js +45 -55
- package/dist/es/components/_components/picker/input-range.vue2.js +105 -70
- package/dist/es/components/_components/picker/input.vue.js +22 -25
- package/dist/es/components/_components/picker/input.vue2.js +58 -43
- package/dist/es/components/_components/select-view/select-view.js +61 -66
- package/dist/es/components/date-picker/DatePanel.vue.js +102 -94
- package/dist/es/components/date-picker/DatePanel.vue2.js +97 -44
- package/dist/es/components/date-picker/DatePicker.vue.js +71 -58
- package/dist/es/components/date-picker/DatePicker.vue2.js +285 -231
- package/dist/es/components/dialog/Dialog.js +159 -128
- package/dist/es/components/dropdown/Dropdown.vue.js +18 -15
- package/dist/es/components/dropdown/Dropdown.vue2.js +52 -31
- package/dist/es/components/dropdown/DropdownOption.vue.js +22 -21
- package/dist/es/components/dropdown/DropdownOption.vue2.js +23 -19
- package/dist/es/components/dropdown/DropdownSubmenu.vue.js +49 -36
- package/dist/es/components/dropdown/DropdownSubmenu.vue2.js +45 -24
- package/dist/es/components/dropdown/context.js +3 -2
- package/dist/es/components/dropdown/dropdown-panel.vue.js +24 -21
- package/dist/es/components/dropdown/dropdown-panel.vue2.js +83 -31
- package/dist/es/components/dropdown/use-keyboard.js +45 -0
- package/dist/es/components/form/Form.vue2.js +113 -101
- package/dist/es/components/form/FormItem.vue.js +26 -22
- package/dist/es/components/form/FormItem.vue2.js +162 -125
- package/dist/es/components/form/form-item-message.vue.js +31 -24
- package/dist/es/components/form/form-item-message.vue2.js +4 -2
- package/dist/es/components/form-checkbox/Checkbox.js +80 -76
- package/dist/es/components/form-checkbox/CheckboxGroup.js +43 -38
- package/dist/es/components/form-input/Input.js +83 -79
- package/dist/es/components/form-input/InputPassword.vue.js +19 -16
- package/dist/es/components/form-input/InputPassword.vue2.js +39 -29
- package/dist/es/components/form-input/InputSearch.js +47 -37
- package/dist/es/components/form-input-number/InputNumber.js +134 -133
- package/dist/es/components/form-input-tag/InputTag.js +173 -162
- package/dist/es/components/form-radio/Radio.js +74 -71
- package/dist/es/components/form-radio/RadioGroup.js +55 -49
- package/dist/es/components/form-select/Select.js +116 -114
- package/dist/es/components/form-select/hooks/use-select.js +128 -128
- package/dist/es/components/form-slider/Slider.vue.js +28 -28
- package/dist/es/components/form-slider/Slider.vue2.js +139 -132
- package/dist/es/components/form-slider/slider-button.vue.js +6 -6
- package/dist/es/components/form-slider/slider-button.vue2.js +39 -34
- package/dist/es/components/form-switch/Switch.vue.js +9 -9
- package/dist/es/components/form-switch/Switch.vue2.js +81 -74
- package/dist/es/components/form-textarea/Textarea.vue2.js +123 -108
- package/dist/es/components/image/Image.vue2.js +77 -76
- package/dist/es/components/image/ImagePreview.vue.js +13 -12
- package/dist/es/components/image/ImagePreview.vue2.js +141 -136
- package/dist/es/components/image/ImagePreviewGroup.vue.js +1 -1
- package/dist/es/components/image/ImagePreviewGroup.vue2.js +82 -83
- package/dist/es/components/rate/Rate.js +106 -103
- package/dist/es/components/time-picker/TimeColumn.vue.js +34 -23
- package/dist/es/components/time-picker/TimeColumn.vue2.js +37 -28
- package/dist/es/components/time-picker/TimePicker.vue.js +83 -64
- package/dist/es/components/time-picker/TimePicker.vue2.js +192 -156
- package/dist/es/components/time-range-selector/TimeRangeSelector.vue.js +327 -193
- package/dist/es/locale/en-US.js +6 -0
- package/dist/es/locale/zh-CN.js +6 -0
- package/dist/es/style.css +1 -1
- package/dist/icons/_self/down.d.ts +1 -1
- package/dist/icons/_self/dropdown/more.d.ts +1 -1
- package/dist/icons/_self/empty-better.d.ts +1 -1
- package/dist/icons/_self/empty.d.ts +1 -1
- package/dist/icons/_self/eye-invisible.d.ts +1 -1
- package/dist/icons/_self/eye.d.ts +1 -1
- package/dist/icons/_self/full-screen.d.ts +1 -1
- package/dist/icons/_self/left.d.ts +1 -1
- package/dist/icons/_self/menu/down.d.ts +1 -1
- package/dist/icons/_self/minus.d.ts +1 -1
- package/dist/icons/_self/more-dot.d.ts +1 -1
- package/dist/icons/_self/next.d.ts +1 -1
- package/dist/icons/_self/original-size.d.ts +1 -1
- package/dist/icons/_self/plus.d.ts +1 -1
- package/dist/icons/_self/prev.d.ts +1 -1
- package/dist/icons/_self/question-message.d.ts +1 -1
- package/dist/icons/_self/right.d.ts +1 -1
- package/dist/icons/_self/rotate-left.d.ts +1 -1
- package/dist/icons/_self/rotate-right.d.ts +1 -1
- package/dist/icons/_self/search.d.ts +1 -1
- package/dist/icons/_self/up.d.ts +1 -1
- package/dist/icons/_self/zoom-in.d.ts +1 -1
- package/dist/icons/_self/zoom-out.d.ts +1 -1
- package/dist/icons/_ui/alone-left.d.ts +1 -1
- package/dist/icons/_ui/alone-margin-left.d.ts +1 -1
- package/dist/icons/_ui/alone-margin-right.d.ts +1 -1
- package/dist/icons/_ui/alone-right.d.ts +1 -1
- package/dist/icons/_ui/calendar.d.ts +1 -1
- package/dist/icons/_ui/time.d.ts +1 -1
- package/dist/icons/animation/animation-loading.d.ts +1 -1
- package/dist/icons/default/check-circle-fill.d.ts +1 -1
- package/dist/icons/default/check.d.ts +1 -1
- package/dist/icons/default/close-circle-fill.d.ts +1 -1
- package/dist/icons/default/close.d.ts +1 -1
- package/dist/icons/default/exclamation-circle-fill.d.ts +1 -1
- package/dist/icons/default/exclamation.d.ts +1 -1
- package/dist/icons/default/filter.d.ts +1 -1
- package/dist/icons/default/info-circle-fill.d.ts +1 -1
- package/dist/icons/default/link.d.ts +1 -1
- package/dist/icons/default/logo-simple.d.ts +1 -1
- package/dist/icons/default/minus-circle-fill.d.ts +1 -1
- package/dist/icons/icon.d.ts +2 -2
- package/dist/icons/index.d.ts +3 -3
- package/dist/index.cjs +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.umd.js +4 -4
- package/dist/locale/interface.d.ts +6 -0
- package/dist/style/base.css +1 -1
- package/dist/style/date-picker.css +1 -1
- package/dist/style/form.css +1 -1
- package/dist/style/image.css +1 -1
- package/dist/style/time-range-selector.css +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
|
@@ -1,19 +1,28 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { useLocale as
|
|
7
|
-
import
|
|
8
|
-
|
|
1
|
+
import { defineComponent as d, toRefs as c, ref as v, reactive as b } from "vue";
|
|
2
|
+
import y from "../_components/icon-hover/index.vue.js";
|
|
3
|
+
import I from "../../icons/_self/eye.js";
|
|
4
|
+
import h from "../../icons/_self/eye-invisible.js";
|
|
5
|
+
import g from "../../_hooks/use-merge-state.js";
|
|
6
|
+
import { useLocale as B } from "../../locale/index.js";
|
|
7
|
+
import R from "./Input.js";
|
|
8
|
+
import { useFormItem as _ } from "../../_hooks/use-form-item.js";
|
|
9
|
+
const M = d({
|
|
9
10
|
name: "InputPassword",
|
|
10
11
|
components: {
|
|
11
|
-
IconEye:
|
|
12
|
-
IconEyeInvisible:
|
|
13
|
-
IconHover:
|
|
14
|
-
XInput:
|
|
12
|
+
IconEye: I,
|
|
13
|
+
IconEyeInvisible: h,
|
|
14
|
+
IconHover: y,
|
|
15
|
+
XInput: R
|
|
15
16
|
},
|
|
16
17
|
props: {
|
|
18
|
+
/**
|
|
19
|
+
* @zh 是否禁用输入和显隐按钮
|
|
20
|
+
* @en Whether to disable the input and visibility button
|
|
21
|
+
*/
|
|
22
|
+
disabled: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: !1
|
|
25
|
+
},
|
|
17
26
|
/**
|
|
18
27
|
* @zh 是否可见,受控属性
|
|
19
28
|
* @en Whether is visible
|
|
@@ -49,35 +58,36 @@ const C = f({
|
|
|
49
58
|
"visibility-change",
|
|
50
59
|
"update:visibility"
|
|
51
60
|
],
|
|
52
|
-
setup(
|
|
53
|
-
const { visibility:
|
|
54
|
-
|
|
55
|
-
}, [
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
value:
|
|
61
|
+
setup(e, { emit: o }) {
|
|
62
|
+
const { visibility: l, defaultVisibility: a, disabled: n } = c(e), r = v(), { t: u } = B(), { mergedDisabled: s } = _({ disabled: n }), f = () => {
|
|
63
|
+
s.value || m(!i.value);
|
|
64
|
+
}, [i, p] = g(
|
|
65
|
+
a.value,
|
|
66
|
+
b({
|
|
67
|
+
value: l
|
|
59
68
|
})
|
|
60
|
-
),
|
|
61
|
-
|
|
69
|
+
), m = (t) => {
|
|
70
|
+
t !== i.value && (o("visibility-change", t), o("update:visibility", t), p(t));
|
|
62
71
|
};
|
|
63
72
|
return {
|
|
64
|
-
inputRef:
|
|
65
|
-
mergedVisible:
|
|
66
|
-
|
|
73
|
+
inputRef: r,
|
|
74
|
+
mergedVisible: i,
|
|
75
|
+
mergedDisabled: s,
|
|
76
|
+
handleInvisible: f,
|
|
67
77
|
t: u
|
|
68
78
|
};
|
|
69
79
|
},
|
|
70
80
|
methods: {
|
|
71
81
|
focus() {
|
|
72
|
-
var
|
|
73
|
-
(
|
|
82
|
+
var e;
|
|
83
|
+
(e = this.inputRef) == null || e.focus();
|
|
74
84
|
},
|
|
75
85
|
blur() {
|
|
76
|
-
var
|
|
77
|
-
(
|
|
86
|
+
var e;
|
|
87
|
+
(e = this.inputRef) == null || e.blur();
|
|
78
88
|
}
|
|
79
89
|
}
|
|
80
90
|
});
|
|
81
91
|
export {
|
|
82
|
-
|
|
92
|
+
M as default
|
|
83
93
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useLocale as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { Button as
|
|
7
|
-
import
|
|
8
|
-
import { useSize as
|
|
9
|
-
import {
|
|
10
|
-
|
|
1
|
+
import { defineComponent as x, toRefs as S, ref as y, createVNode as r, mergeProps as z, Fragment as B } from "vue";
|
|
2
|
+
import { useLocale as I } from "../../locale/index.js";
|
|
3
|
+
import R from "../_components/icon-hover/index.vue.js";
|
|
4
|
+
import m from "../../icons/_self/search.js";
|
|
5
|
+
import C from "../../icons/animation/animation-loading.js";
|
|
6
|
+
import { Button as P } from "../button/index.js";
|
|
7
|
+
import k from "./Input.js";
|
|
8
|
+
import { useSize as T } from "../../_hooks/use-size.js";
|
|
9
|
+
import { useFormItem as N } from "../../_hooks/use-form-item.js";
|
|
10
|
+
import { getClassNameMixin as _ } from "../../_utils/config.js";
|
|
11
|
+
const E = /* @__PURE__ */ x({
|
|
11
12
|
name: "InputSearch",
|
|
12
13
|
props: {
|
|
13
14
|
/**
|
|
@@ -73,51 +74,60 @@ const H = /* @__PURE__ */ p({
|
|
|
73
74
|
slots: t
|
|
74
75
|
}) {
|
|
75
76
|
const {
|
|
76
|
-
size:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
77
|
+
size: s,
|
|
78
|
+
disabled: b
|
|
79
|
+
} = S(e), i = _("input-search"), {
|
|
80
|
+
t: p
|
|
81
|
+
} = I(), {
|
|
82
|
+
mergedSize: g,
|
|
83
|
+
mergedDisabled: u
|
|
84
|
+
} = N({
|
|
85
|
+
size: s,
|
|
86
|
+
disabled: b
|
|
87
|
+
}), {
|
|
88
|
+
mergedSize: l
|
|
89
|
+
} = T(g), o = y(), d = (n) => {
|
|
90
|
+
u.value || e.loading || o.value.inputRef && a("search", o.value.inputRef.value, n);
|
|
91
|
+
}, h = () => {
|
|
84
92
|
var n;
|
|
85
|
-
return
|
|
93
|
+
return r(B, null, [e.loading ? r(C, null, null) : r(R, {
|
|
86
94
|
as: "button",
|
|
87
|
-
"aria-label":
|
|
88
|
-
|
|
95
|
+
"aria-label": p("common.search"),
|
|
96
|
+
disabled: u.value,
|
|
97
|
+
onClick: d
|
|
89
98
|
}, {
|
|
90
|
-
default: () => [
|
|
99
|
+
default: () => [r(m, null, null)]
|
|
91
100
|
}), (n = t.suffix) == null ? void 0 : n.call(t)]);
|
|
92
|
-
},
|
|
101
|
+
}, v = () => {
|
|
102
|
+
var f, c;
|
|
93
103
|
let n = {};
|
|
94
104
|
return e.buttonText || t["button-default"] || t["button-icon"] ? n = {
|
|
95
105
|
default: t["button-default"] ?? (e.buttonText ? () => e.buttonText : void 0),
|
|
96
106
|
icon: t["button-icon"]
|
|
97
107
|
} : n = {
|
|
98
|
-
icon: () =>
|
|
99
|
-
},
|
|
108
|
+
icon: () => r(m, null, null)
|
|
109
|
+
}, r(P, z({
|
|
100
110
|
type: "primary",
|
|
101
111
|
class: i.element("btn"),
|
|
102
|
-
|
|
103
|
-
size: o.value,
|
|
104
|
-
loading: e.loading
|
|
112
|
+
size: l.value
|
|
105
113
|
}, e.buttonProps, {
|
|
106
|
-
|
|
114
|
+
disabled: u.value || ((f = e.buttonProps) == null ? void 0 : f.disabled),
|
|
115
|
+
loading: e.loading || ((c = e.buttonProps) == null ? void 0 : c.loading),
|
|
116
|
+
onClick: d
|
|
107
117
|
}), n);
|
|
108
118
|
};
|
|
109
119
|
return {
|
|
110
|
-
inputRef:
|
|
111
|
-
render: () =>
|
|
112
|
-
ref:
|
|
120
|
+
inputRef: o,
|
|
121
|
+
render: () => r(k, {
|
|
122
|
+
ref: o,
|
|
113
123
|
class: i.block,
|
|
114
|
-
size:
|
|
115
|
-
disabled:
|
|
124
|
+
size: l.value,
|
|
125
|
+
disabled: u.value
|
|
116
126
|
}, {
|
|
117
127
|
prepend: t.prepend,
|
|
118
128
|
prefix: t.prefix,
|
|
119
|
-
suffix: e.searchButton ? t.suffix :
|
|
120
|
-
append: e.searchButton ?
|
|
129
|
+
suffix: e.searchButton ? t.suffix : h,
|
|
130
|
+
append: e.searchButton ? v : t.append
|
|
121
131
|
})
|
|
122
132
|
};
|
|
123
133
|
},
|
|
@@ -136,5 +146,5 @@ const H = /* @__PURE__ */ p({
|
|
|
136
146
|
}
|
|
137
147
|
});
|
|
138
148
|
export {
|
|
139
|
-
|
|
149
|
+
E as default
|
|
140
150
|
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { isNumber as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { Input as
|
|
10
|
-
import { useFormItem as
|
|
11
|
-
import { useSize as
|
|
12
|
-
import { getKeyDownHandler as
|
|
13
|
-
import { getClassNameMixin as
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
const
|
|
1
|
+
import { defineComponent as G, toRefs as J, ref as V, computed as D, watch as p, onUnmounted as Q, createVNode as o, Fragment as Z } from "vue";
|
|
2
|
+
import O from "../../node_modules/.pnpm/number-precision@1.6.0/node_modules/number-precision/build/index.es.js";
|
|
3
|
+
import { isNumber as s, isUndefined as ee } from "../../_utils/is.js";
|
|
4
|
+
import ne from "../../icons/_self/up.js";
|
|
5
|
+
import ue from "../../icons/_self/down.js";
|
|
6
|
+
import te from "../../icons/_self/plus.js";
|
|
7
|
+
import ae from "../../icons/_self/minus.js";
|
|
8
|
+
import E from "../button/Button.js";
|
|
9
|
+
import { Input as le } from "../form-input/index.js";
|
|
10
|
+
import { useFormItem as ie } from "../../_hooks/use-form-item.js";
|
|
11
|
+
import { useSize as re } from "../../_hooks/use-size.js";
|
|
12
|
+
import { getKeyDownHandler as de, KEYBOARD_KEY as A } from "../../_utils/keyboard.js";
|
|
13
|
+
import { getClassNameMixin as oe } from "../../_utils/config.js";
|
|
14
|
+
const fe = 800, me = 150;
|
|
15
|
+
O.enableBoundaryChecking(!1);
|
|
16
|
+
const Ie = /* @__PURE__ */ G({
|
|
17
17
|
name: "InputNumber",
|
|
18
18
|
props: {
|
|
19
19
|
/**
|
|
@@ -230,169 +230,170 @@ const Be = /* @__PURE__ */ X({
|
|
|
230
230
|
slots: a
|
|
231
231
|
}) {
|
|
232
232
|
const {
|
|
233
|
-
size:
|
|
234
|
-
disabled:
|
|
235
|
-
} =
|
|
236
|
-
mergedSize:
|
|
237
|
-
mergedDisabled:
|
|
238
|
-
eventHandlers:
|
|
239
|
-
} =
|
|
240
|
-
size:
|
|
241
|
-
disabled:
|
|
233
|
+
size: F,
|
|
234
|
+
disabled: P
|
|
235
|
+
} = J(n), d = oe("input-number"), B = V(), {
|
|
236
|
+
mergedSize: $,
|
|
237
|
+
mergedDisabled: v,
|
|
238
|
+
eventHandlers: I
|
|
239
|
+
} = ie({
|
|
240
|
+
size: F,
|
|
241
|
+
disabled: P
|
|
242
242
|
}), {
|
|
243
|
-
mergedSize:
|
|
244
|
-
} =
|
|
245
|
-
if (
|
|
243
|
+
mergedSize: g
|
|
244
|
+
} = re($), h = D(() => {
|
|
245
|
+
if (s(n.precision)) {
|
|
246
246
|
const e = `${n.step}`.split(".")[1], u = e && e.length || 0;
|
|
247
247
|
return Math.max(u, n.precision);
|
|
248
248
|
}
|
|
249
|
-
}),
|
|
249
|
+
}), w = (e) => {
|
|
250
250
|
var t;
|
|
251
|
-
if (!
|
|
251
|
+
if (!s(e))
|
|
252
252
|
return "";
|
|
253
|
-
const u =
|
|
253
|
+
const u = h.value ? e.toFixed(h.value) : String(e);
|
|
254
254
|
return ((t = n.formatter) == null ? void 0 : t.call(n, u)) ?? u;
|
|
255
|
-
},
|
|
255
|
+
}, f = V(w(n.modelValue ?? n.defaultValue)), l = D(() => {
|
|
256
256
|
var u;
|
|
257
|
-
if (!
|
|
257
|
+
if (!f.value)
|
|
258
258
|
return;
|
|
259
|
-
const e = Number(((u = n.parser) == null ? void 0 : u.call(n,
|
|
259
|
+
const e = Number(((u = n.parser) == null ? void 0 : u.call(n, f.value)) ?? f.value);
|
|
260
260
|
return Number.isNaN(e) ? void 0 : e;
|
|
261
|
-
}),
|
|
262
|
-
let
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
},
|
|
266
|
-
if (!
|
|
267
|
-
return
|
|
268
|
-
},
|
|
261
|
+
}), b = V(s(l.value) && l.value <= n.min), y = V(s(l.value) && l.value >= n.max);
|
|
262
|
+
let x = 0;
|
|
263
|
+
const m = () => {
|
|
264
|
+
x && (window.clearTimeout(x), x = 0);
|
|
265
|
+
}, R = (e) => {
|
|
266
|
+
if (!ee(e))
|
|
267
|
+
return s(n.min) && e < n.min && (e = n.min), s(n.max) && e > n.max && (e = n.max), s(h.value) ? O.round(e, h.value) : e;
|
|
268
|
+
}, M = (e) => {
|
|
269
269
|
let u = !1, t = !1;
|
|
270
|
-
|
|
271
|
-
},
|
|
272
|
-
const e =
|
|
273
|
-
(e !== l.value ||
|
|
270
|
+
s(e) && (e <= n.min && (u = !0), e >= n.max && (t = !0)), y.value !== t && (y.value = t), b.value !== u && (b.value = u);
|
|
271
|
+
}, C = (e) => !v.value && !n.readOnly && !(e === "plus" && y.value) && !(e === "minus" && b.value), z = () => {
|
|
272
|
+
const e = R(l.value), u = w(e);
|
|
273
|
+
(e !== l.value || f.value !== u) && (f.value = u), i("update:modelValue", e);
|
|
274
274
|
};
|
|
275
|
-
|
|
276
|
-
|
|
275
|
+
p(() => [n.max, n.min], () => {
|
|
276
|
+
z(), M(l.value);
|
|
277
277
|
});
|
|
278
|
-
const
|
|
279
|
-
|
|
278
|
+
const N = (e, u) => {
|
|
279
|
+
var r, c;
|
|
280
|
+
if (!C(e))
|
|
280
281
|
return;
|
|
281
282
|
let t;
|
|
282
|
-
|
|
283
|
-
},
|
|
284
|
-
var
|
|
285
|
-
if (e.preventDefault(), !!
|
|
286
|
-
|
|
287
|
-
const
|
|
288
|
-
if (!
|
|
289
|
-
|
|
283
|
+
s(l.value) ? t = R(O[e](l.value, n.step)) : t = n.min === -1 / 0 ? 0 : n.min, f.value = w(t), M(t), i("update:modelValue", t), i("change", t, u), (c = (r = I.value) == null ? void 0 : r.onChange) == null || c.call(r, u);
|
|
284
|
+
}, S = (e, u, t = !1) => {
|
|
285
|
+
var r;
|
|
286
|
+
if (e.preventDefault(), !!C(u) && ((r = B.value) == null || r.focus(), N(u, e), t)) {
|
|
287
|
+
m();
|
|
288
|
+
const c = () => {
|
|
289
|
+
if (!C(u)) {
|
|
290
|
+
m();
|
|
290
291
|
return;
|
|
291
292
|
}
|
|
292
|
-
|
|
293
|
+
N(u, e), x = window.setTimeout(c, me);
|
|
293
294
|
};
|
|
294
|
-
|
|
295
|
+
x = window.setTimeout(c, fe);
|
|
295
296
|
}
|
|
296
|
-
},
|
|
297
|
-
var t, c;
|
|
298
|
-
e = e.trim().replace(/。/g, "."), e = ((t = n.parser) == null ? void 0 : t.call(n, e)) ?? e, (
|
|
299
|
-
},
|
|
297
|
+
}, k = (e, u) => {
|
|
298
|
+
var t, r, c, _;
|
|
299
|
+
e = e.trim().replace(/。/g, "."), e = ((t = n.parser) == null ? void 0 : t.call(n, e)) ?? e, (s(Number(e)) || /^(\.|-)$/.test(e)) && (f.value = ((r = n.formatter) == null ? void 0 : r.call(n, e)) ?? e, M(l.value), i("input", l.value, f.value, u), n.modelEvent === "input" && (i("update:modelValue", l.value), i("change", l.value, u), (_ = (c = I.value) == null ? void 0 : c.onChange) == null || _.call(c, u)));
|
|
300
|
+
}, T = (e) => {
|
|
300
301
|
i("focus", e);
|
|
301
|
-
},
|
|
302
|
-
u instanceof MouseEvent && !e || (
|
|
303
|
-
}, K = (e) => {
|
|
304
|
-
i("blur", e);
|
|
302
|
+
}, K = (e, u) => {
|
|
303
|
+
u instanceof MouseEvent && !e || (z(), i("change", l.value, u));
|
|
305
304
|
}, U = (e) => {
|
|
305
|
+
i("blur", e);
|
|
306
|
+
}, H = (e) => {
|
|
306
307
|
var u, t;
|
|
307
|
-
|
|
308
|
-
},
|
|
309
|
-
e.preventDefault(), !n.readOnly &&
|
|
310
|
-
}], [
|
|
311
|
-
e.preventDefault(), !n.readOnly &&
|
|
312
|
-
}]])),
|
|
313
|
-
i("keydown", e), e.defaultPrevented ||
|
|
308
|
+
f.value = "", i("update:modelValue", void 0), i("change", void 0, e), (t = (u = I.value) == null ? void 0 : u.onChange) == null || t.call(u, e), i("clear", e);
|
|
309
|
+
}, W = de(/* @__PURE__ */ new Map([[A.ARROW_UP, (e) => {
|
|
310
|
+
e.preventDefault(), !n.readOnly && N("plus", e);
|
|
311
|
+
}], [A.ARROW_DOWN, (e) => {
|
|
312
|
+
e.preventDefault(), !n.readOnly && N("minus", e);
|
|
313
|
+
}]])), Y = (e) => {
|
|
314
|
+
i("keydown", e), e.defaultPrevented || W(e);
|
|
314
315
|
};
|
|
315
|
-
|
|
316
|
-
e !== l.value && (
|
|
316
|
+
p(() => n.modelValue, (e) => {
|
|
317
|
+
e !== l.value && (f.value = w(e), M(e));
|
|
317
318
|
});
|
|
318
|
-
const
|
|
319
|
+
const q = () => {
|
|
319
320
|
var e, u, t;
|
|
320
|
-
return n.readOnly ? null :
|
|
321
|
-
class:
|
|
322
|
-
}, [(e = a.suffix) == null ? void 0 : e.call(a)]),
|
|
323
|
-
class:
|
|
324
|
-
}, [
|
|
325
|
-
class: [
|
|
326
|
-
[`${
|
|
321
|
+
return n.readOnly ? null : o(Z, null, [a.suffix && o("div", {
|
|
322
|
+
class: d.element("suffix")
|
|
323
|
+
}, [(e = a.suffix) == null ? void 0 : e.call(a)]), o("div", {
|
|
324
|
+
class: d.element("step")
|
|
325
|
+
}, [o("button", {
|
|
326
|
+
class: [d.element("step--button"), {
|
|
327
|
+
[`${d.element("step--button")}-disabled`]: v.value || y.value
|
|
327
328
|
}],
|
|
328
329
|
type: "button",
|
|
329
330
|
tabindex: "-1",
|
|
330
|
-
disabled:
|
|
331
|
-
onMousedown: (
|
|
332
|
-
onMouseup:
|
|
333
|
-
onMouseleave:
|
|
334
|
-
}, [a.plus ? (u = a.plus) == null ? void 0 : u.call(a) :
|
|
335
|
-
class: [
|
|
336
|
-
[`${
|
|
331
|
+
disabled: v.value || y.value,
|
|
332
|
+
onMousedown: (r) => S(r, "plus", !0),
|
|
333
|
+
onMouseup: m,
|
|
334
|
+
onMouseleave: m
|
|
335
|
+
}, [a.plus ? (u = a.plus) == null ? void 0 : u.call(a) : o(ne, null, null)]), o("button", {
|
|
336
|
+
class: [d.element("step--button"), {
|
|
337
|
+
[`${d.element("step--button")}-disabled`]: v.value || b.value
|
|
337
338
|
}],
|
|
338
339
|
type: "button",
|
|
339
340
|
tabindex: "-1",
|
|
340
|
-
disabled:
|
|
341
|
-
onMousedown: (
|
|
342
|
-
onMouseup:
|
|
343
|
-
onMouseleave:
|
|
344
|
-
}, [a.minus ? (t = a.minus) == null ? void 0 : t.call(a) :
|
|
345
|
-
},
|
|
346
|
-
[
|
|
347
|
-
}]),
|
|
348
|
-
size:
|
|
341
|
+
disabled: v.value || b.value,
|
|
342
|
+
onMousedown: (r) => S(r, "minus", !0),
|
|
343
|
+
onMouseup: m,
|
|
344
|
+
onMouseleave: m
|
|
345
|
+
}, [a.minus ? (t = a.minus) == null ? void 0 : t.call(a) : o(ue, null, null)])])]);
|
|
346
|
+
}, L = D(() => [d.block, d.modifier(`mode-${n.mode}`), d.modifier(`size-${g.value}`), {
|
|
347
|
+
[d.modifier("readonly")]: n.readOnly
|
|
348
|
+
}]), j = () => o(E, {
|
|
349
|
+
size: g.value,
|
|
349
350
|
shape: "square",
|
|
350
351
|
narrow: !0,
|
|
351
352
|
tabindex: "-1",
|
|
352
|
-
class:
|
|
353
|
-
disabled:
|
|
354
|
-
onMousedown: (e) =>
|
|
355
|
-
onMouseup:
|
|
356
|
-
onMouseleave:
|
|
353
|
+
class: d.element("step--button"),
|
|
354
|
+
disabled: v.value || b.value,
|
|
355
|
+
onMousedown: (e) => S(e, "minus", !0),
|
|
356
|
+
onMouseup: m,
|
|
357
|
+
onMouseleave: m
|
|
357
358
|
}, {
|
|
358
|
-
icon: () =>
|
|
359
|
-
}),
|
|
360
|
-
size:
|
|
359
|
+
icon: () => o(ae, null, null)
|
|
360
|
+
}), X = () => o(E, {
|
|
361
|
+
size: g.value,
|
|
361
362
|
shape: "square",
|
|
362
363
|
narrow: !0,
|
|
363
364
|
tabindex: "-1",
|
|
364
|
-
class:
|
|
365
|
-
disabled:
|
|
366
|
-
onMousedown: (e) =>
|
|
367
|
-
onMouseup:
|
|
368
|
-
onMouseleave:
|
|
365
|
+
class: d.element("step--button"),
|
|
366
|
+
disabled: v.value || y.value,
|
|
367
|
+
onMousedown: (e) => S(e, "plus", !0),
|
|
368
|
+
onMouseup: m,
|
|
369
|
+
onMouseleave: m
|
|
369
370
|
}, {
|
|
370
|
-
icon: () =>
|
|
371
|
+
icon: () => o(te, null, null)
|
|
371
372
|
});
|
|
372
|
-
return
|
|
373
|
-
inputRef:
|
|
373
|
+
return Q(m), {
|
|
374
|
+
inputRef: B,
|
|
374
375
|
render: () => {
|
|
375
376
|
const e = n.mode === "embed" ? {
|
|
376
377
|
prepend: a.prepend,
|
|
377
378
|
prefix: a.prefix,
|
|
378
|
-
suffix: n.hideButton ? a.suffix :
|
|
379
|
+
suffix: n.hideButton ? a.suffix : q,
|
|
379
380
|
append: a.append
|
|
380
381
|
} : {
|
|
381
|
-
prepend: n.hideButton ? a.prepend :
|
|
382
|
+
prepend: n.hideButton ? a.prepend : j,
|
|
382
383
|
prefix: a.prefix,
|
|
383
384
|
suffix: a.suffix,
|
|
384
|
-
append: n.hideButton ? a.append :
|
|
385
|
+
append: n.hideButton ? a.append : X
|
|
385
386
|
};
|
|
386
|
-
return
|
|
387
|
+
return o(le, {
|
|
387
388
|
key: `input-number-${n.mode}`,
|
|
388
|
-
ref:
|
|
389
|
-
class:
|
|
389
|
+
ref: B,
|
|
390
|
+
class: L.value,
|
|
390
391
|
type: "text",
|
|
391
392
|
allowClear: n.allowClear,
|
|
392
|
-
size:
|
|
393
|
-
modelValue:
|
|
393
|
+
size: g.value,
|
|
394
|
+
modelValue: f.value,
|
|
394
395
|
placeholder: n.placeholder,
|
|
395
|
-
disabled:
|
|
396
|
+
disabled: v.value,
|
|
396
397
|
readonly: n.readOnly,
|
|
397
398
|
error: n.error,
|
|
398
399
|
inputAttrs: {
|
|
@@ -402,12 +403,12 @@ const Be = /* @__PURE__ */ X({
|
|
|
402
403
|
"aria-valuenow": l.value,
|
|
403
404
|
...n.inputAttrs
|
|
404
405
|
},
|
|
405
|
-
onInput:
|
|
406
|
-
onFocus:
|
|
407
|
-
onBlur:
|
|
408
|
-
onClear:
|
|
409
|
-
onChange:
|
|
410
|
-
onKeydown:
|
|
406
|
+
onInput: k,
|
|
407
|
+
onFocus: T,
|
|
408
|
+
onBlur: U,
|
|
409
|
+
onClear: H,
|
|
410
|
+
onChange: K,
|
|
411
|
+
onKeydown: Y
|
|
411
412
|
}, e);
|
|
412
413
|
}
|
|
413
414
|
};
|
|
@@ -437,5 +438,5 @@ const Be = /* @__PURE__ */ X({
|
|
|
437
438
|
}
|
|
438
439
|
});
|
|
439
440
|
export {
|
|
440
|
-
|
|
441
|
+
Ie as default
|
|
441
442
|
};
|