ep-craft 0.1.24 → 0.1.25
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/dist/components/icon/index.js +6 -5
- package/dist/components/input/EpInput.vue.d.ts +87 -0
- package/dist/components/input/EpInput.vue.js +552 -0
- package/dist/components/input/EpInput2.vue.js +4 -0
- package/dist/components/input/index.d.ts +5 -2
- package/dist/components/input/index.js +7 -4
- package/dist/components/input/input.d.ts +287 -0
- package/dist/components/input/input.js +249 -0
- package/dist/components/input/instance.d.ts +2 -0
- package/dist/components/input/utils.d.ts +7 -0
- package/dist/components/input/utils.js +74 -0
- package/dist/components/option/index.d.ts +3 -2
- package/dist/components/option/index.js +7 -4
- package/dist/components/option-group/index.d.ts +2 -2
- package/dist/components/option-group/index.js +3 -3
- package/dist/components/scrollbar/index.d.ts +2 -0
- package/dist/components/scrollbar/index.js +9 -3
- package/dist/components/scrollbar/src/scrollbar.d.ts +25 -0
- package/dist/components/scrollbar/src/scrollbar.js +16 -0
- package/dist/components/select/index.d.ts +4 -2
- package/dist/components/select/index.js +7 -4
- package/dist/components/select/select.d.ts +132 -0
- package/dist/components/select/select.js +316 -0
- package/dist/components/select/select.vue.d.ts +979 -0
- package/dist/components/select/select.vue.js +401 -0
- package/dist/components/select/select2.vue.js +155 -0
- package/dist/components/select/src/option-group.vue.d.ts +43 -0
- package/dist/components/select/src/option-group.vue.js +26 -0
- package/dist/components/select/src/option-group2.vue.js +65 -0
- package/dist/components/select/src/option.d.ts +17 -0
- package/dist/components/select/src/option.js +30 -0
- package/dist/components/select/src/option.vue.d.ts +73 -0
- package/dist/components/select/src/option.vue.js +28 -0
- package/dist/components/select/src/option2.vue.js +81 -0
- package/dist/components/select/src/options.d.ts +5 -0
- package/dist/components/select/src/options.js +30 -0
- package/dist/components/select/src/select-dropdown.vue.d.ts +25 -0
- package/dist/components/select/src/select-dropdown.vue.js +27 -0
- package/dist/components/select/src/select-dropdown2.vue.js +39 -0
- package/dist/components/select/src/token.d.ts +4 -0
- package/dist/components/select/src/token.js +5 -0
- package/dist/components/select/src/type.d.ts +67 -0
- package/dist/components/select/src/useOption.d.ts +10 -0
- package/dist/components/select/src/useOption.js +64 -0
- package/dist/components/select/src/useSelect.d.ts +159 -0
- package/dist/components/select/src/useSelect.js +483 -0
- package/dist/components/select-v2/src/select.types.d.ts +25 -0
- package/dist/components/select-v2/src/useProps.d.ts +32 -0
- package/dist/components/select-v2/src/useProps.js +29 -0
- package/dist/components/tag/index.d.ts +1 -0
- package/dist/components/tag/index.js +4 -3
- package/dist/components/tooltip/index.js +8 -7
- package/dist/constants/event.js +3 -2
- package/dist/constants/form.js +5 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/use-attrs/index.d.ts +7 -0
- package/dist/hooks/use-attrs/index.js +25 -0
- package/dist/hooks/use-calc-input-width/index.d.ts +7 -0
- package/dist/hooks/use-calc-input-width/index.js +19 -0
- package/dist/hooks/use-composition/index.d.ts +12 -0
- package/dist/hooks/use-composition/index.js +25 -0
- package/dist/hooks/use-cursor/index.d.ts +2 -0
- package/dist/hooks/use-cursor/index.js +36 -0
- package/dist/hooks/use-empty-values/index.js +29 -8
- package/dist/hooks/use-float-label/index.d.ts +29 -0
- package/dist/hooks/use-float-label/index.js +19 -0
- package/dist/hooks/use-focus-controller/index.d.ts +26 -0
- package/dist/hooks/use-focus-controller/index.js +41 -0
- package/dist/index.css +1 -1
- package/dist/utils/dom/scroll.js +49 -35
- package/dist/utils/strings.js +7 -6
- package/dist/utils/types.js +19 -18
- package/dist/utils/vue/icon.js +15 -10
- package/dist/vendored-components.d.ts +1 -1
- package/dist/vendored-components.js +4 -0
- package/package.json +1 -1
- package/theme-chalk/src/float-label.scss +113 -0
- package/theme-chalk/src/index.scss +1 -0
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { withInstall as
|
|
1
|
+
import { withInstall as o } from "../../utils/with-install.js";
|
|
2
2
|
import "@vue/shared";
|
|
3
3
|
import "lodash-unified";
|
|
4
4
|
import "@vueuse/core";
|
|
5
5
|
import "@element-plus/icons-vue";
|
|
6
6
|
import "vue";
|
|
7
7
|
import { withInstall as i } from "../../utils/vue/install.js";
|
|
8
|
-
import
|
|
8
|
+
import t from "./src/icon.vue.js";
|
|
9
9
|
import "./src/icon.js";
|
|
10
|
-
const
|
|
10
|
+
const I = i(t), e = o(t, "ep-icon");
|
|
11
11
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
I as ElIcon,
|
|
13
|
+
e as EpIcon,
|
|
14
|
+
e as default
|
|
14
15
|
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { StyleValue } from 'vue';
|
|
2
|
+
import type { InputProps } from './input';
|
|
3
|
+
declare var __VLS_1: {}, __VLS_3: {}, __VLS_26: {}, __VLS_46: {
|
|
4
|
+
visible: boolean;
|
|
5
|
+
}, __VLS_60: {};
|
|
6
|
+
type __VLS_Slots = {} & {
|
|
7
|
+
prepend?: (props: typeof __VLS_1) => any;
|
|
8
|
+
} & {
|
|
9
|
+
prefix?: (props: typeof __VLS_3) => any;
|
|
10
|
+
} & {
|
|
11
|
+
suffix?: (props: typeof __VLS_26) => any;
|
|
12
|
+
} & {
|
|
13
|
+
'password-icon'?: (props: typeof __VLS_46) => any;
|
|
14
|
+
} & {
|
|
15
|
+
append?: (props: typeof __VLS_60) => any;
|
|
16
|
+
};
|
|
17
|
+
declare const __VLS_component: import("vue").DefineComponent<InputProps, {
|
|
18
|
+
/** @description HTML input element */
|
|
19
|
+
input: import("vue").ShallowRef<HTMLInputElement | undefined, HTMLInputElement | undefined>;
|
|
20
|
+
/** @description HTML textarea element */
|
|
21
|
+
textarea: import("vue").ShallowRef<HTMLTextAreaElement | undefined, HTMLTextAreaElement | undefined>;
|
|
22
|
+
/** @description HTML element, input or textarea */
|
|
23
|
+
ref: import("vue").ComputedRef<HTMLInputElement | HTMLTextAreaElement | undefined>;
|
|
24
|
+
/** @description style of textarea. */
|
|
25
|
+
textareaStyle: import("vue").ComputedRef<StyleValue>;
|
|
26
|
+
/** @description from props (used on unit test) */
|
|
27
|
+
autosize: import("vue").Ref<import("./input").InputAutoSize | undefined, import("./input").InputAutoSize | undefined>;
|
|
28
|
+
/** @description is input composing */
|
|
29
|
+
isComposing: import("vue").Ref<boolean, boolean>;
|
|
30
|
+
/** @description whether the password is visible */
|
|
31
|
+
passwordVisible: import("vue").Ref<boolean, boolean>;
|
|
32
|
+
/** @description HTML input element native method */
|
|
33
|
+
focus: () => void | undefined;
|
|
34
|
+
/** @description HTML input element native method */
|
|
35
|
+
blur: () => void | undefined;
|
|
36
|
+
/** @description HTML input element native method */
|
|
37
|
+
select: () => void;
|
|
38
|
+
/** @description clear input value */
|
|
39
|
+
clear: (evt?: MouseEvent) => void;
|
|
40
|
+
/** @description resize textarea. */
|
|
41
|
+
resizeTextarea: () => void;
|
|
42
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
43
|
+
clear: (evt: MouseEvent | undefined) => void;
|
|
44
|
+
"update:modelValue": (value: string) => void;
|
|
45
|
+
change: (value: string, evt?: Event | undefined) => void;
|
|
46
|
+
input: (value: string) => void;
|
|
47
|
+
focus: (evt: FocusEvent) => void;
|
|
48
|
+
blur: (evt: FocusEvent) => void;
|
|
49
|
+
compositionend: (evt: CompositionEvent) => void;
|
|
50
|
+
compositionstart: (evt: CompositionEvent) => void;
|
|
51
|
+
compositionupdate: (evt: CompositionEvent) => void;
|
|
52
|
+
keydown: (evt: Event | KeyboardEvent) => void;
|
|
53
|
+
mouseenter: (evt: MouseEvent) => void;
|
|
54
|
+
mouseleave: (evt: MouseEvent) => void;
|
|
55
|
+
}, string, import("vue").PublicProps, Readonly<InputProps> & Readonly<{
|
|
56
|
+
onClear?: ((evt: MouseEvent | undefined) => any) | undefined;
|
|
57
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
58
|
+
onChange?: ((value: string, evt?: Event | undefined) => any) | undefined;
|
|
59
|
+
onInput?: ((value: string) => any) | undefined;
|
|
60
|
+
onFocus?: ((evt: FocusEvent) => any) | undefined;
|
|
61
|
+
onBlur?: ((evt: FocusEvent) => any) | undefined;
|
|
62
|
+
onCompositionend?: ((evt: CompositionEvent) => any) | undefined;
|
|
63
|
+
onCompositionstart?: ((evt: CompositionEvent) => any) | undefined;
|
|
64
|
+
onCompositionupdate?: ((evt: CompositionEvent) => any) | undefined;
|
|
65
|
+
onKeydown?: ((evt: Event | KeyboardEvent) => any) | undefined;
|
|
66
|
+
onMouseenter?: ((evt: MouseEvent) => any) | undefined;
|
|
67
|
+
onMouseleave?: ((evt: MouseEvent) => any) | undefined;
|
|
68
|
+
}>, {
|
|
69
|
+
disabled: boolean;
|
|
70
|
+
tabindex: string | number;
|
|
71
|
+
type: import("./input").InputType;
|
|
72
|
+
modelValue: string | number | null;
|
|
73
|
+
modelModifiers: import("./input").InputModelModifiers;
|
|
74
|
+
autocomplete: string;
|
|
75
|
+
clearIcon: import("@element-plus/utils").IconPropType;
|
|
76
|
+
wordLimitPosition: "inside" | "outside";
|
|
77
|
+
validateEvent: boolean;
|
|
78
|
+
inputStyle: string | false | import("vue").CSSProperties | StyleValue[] | null;
|
|
79
|
+
rows: number;
|
|
80
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
81
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
82
|
+
export default _default;
|
|
83
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
84
|
+
new (): {
|
|
85
|
+
$slots: S;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
@@ -0,0 +1,552 @@
|
|
|
1
|
+
import { defineComponent as yt, useAttrs as ht, useSlots as bt, computed as r, shallowRef as he, ref as P, toRef as be, watch as ae, nextTick as B, onMounted as gt, onBeforeUnmount as xt, openBlock as i, createElementBlock as h, normalizeStyle as ne, normalizeClass as u, unref as o, Fragment as ge, renderSlot as j, createCommentVNode as m, createElementVNode as N, toDisplayString as R, createBlock as b, withCtx as G, resolveDynamicComponent as T, mergeProps as Ae, withModifiers as le, mergeDefaults as wt } from "vue";
|
|
2
|
+
import { useResizeObserver as Ct, isClient as It } from "@vueuse/core";
|
|
3
|
+
import { isNil as kt } from "lodash-unified";
|
|
4
|
+
import { ElIcon as $ } from "../icon/index.js";
|
|
5
|
+
import { View as St, Hide as Mt } from "@element-plus/icons-vue";
|
|
6
|
+
import "../form/index.js";
|
|
7
|
+
import { NOOP as A, isObject as Oe } from "@vue/shared";
|
|
8
|
+
import { debugWarn as Et } from "../../utils/error.js";
|
|
9
|
+
import { rAF as Vt, cAF as De } from "../../utils/raf.js";
|
|
10
|
+
import { INPUT_EVENT as xe, UPDATE_MODEL_EVENT as we, CHANGE_EVENT as He } from "../../constants/event.js";
|
|
11
|
+
import { ValidateComponentsMap as zt } from "../../utils/vue/icon.js";
|
|
12
|
+
import { useNamespace as Fe } from "../../hooks/use-namespace/index.js";
|
|
13
|
+
import "../../hooks/use-size/index.js";
|
|
14
|
+
import "@popperjs/core";
|
|
15
|
+
import "../../hooks/use-z-index/index.js";
|
|
16
|
+
import "../../hooks/use-delayed-toggle/index.js";
|
|
17
|
+
import "../../hooks/use-aria/index.js";
|
|
18
|
+
import "../../hooks/use-model-toggle/index.js";
|
|
19
|
+
import "../../hooks/use-empty-values/index.js";
|
|
20
|
+
import { useFocusController as Lt } from "../../hooks/use-focus-controller/index.js";
|
|
21
|
+
import { useAttrs as Pt } from "../../hooks/use-attrs/index.js";
|
|
22
|
+
import { useComposition as Bt } from "../../hooks/use-composition/index.js";
|
|
23
|
+
import { useCursor as Nt } from "../../hooks/use-cursor/index.js";
|
|
24
|
+
import { useFloatLabel as Rt } from "../../hooks/use-float-label/index.js";
|
|
25
|
+
import { looseToNumber as We, calcTextareaHeight as Ke } from "./utils.js";
|
|
26
|
+
import { inputEmits as Gt, inputPropsDefaults as Tt } from "./input.js";
|
|
27
|
+
import { useFormItem as $t, useFormItemInputId as At } from "../form/src/hooks/use-form-item.js";
|
|
28
|
+
import { useFormSize as Ot, useFormDisabled as Dt } from "../form/src/hooks/use-form-common-props.js";
|
|
29
|
+
const Ht = ["id", "name", "minlength", "maxlength", "type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form", "autofocus", "role", "inputmode"], Ft = ["id", "name", "minlength", "maxlength", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form", "autofocus", "rows", "role", "inputmode"], Ue = "EpInput", xo = /* @__PURE__ */ yt({
|
|
30
|
+
name: Ue,
|
|
31
|
+
inheritAttrs: !1,
|
|
32
|
+
__name: "EpInput",
|
|
33
|
+
props: /* @__PURE__ */ wt({
|
|
34
|
+
id: {},
|
|
35
|
+
size: {},
|
|
36
|
+
disabled: { type: Boolean },
|
|
37
|
+
modelValue: {},
|
|
38
|
+
modelModifiers: {},
|
|
39
|
+
maxlength: {},
|
|
40
|
+
minlength: {},
|
|
41
|
+
type: {},
|
|
42
|
+
resize: {},
|
|
43
|
+
autosize: { type: [Object, Boolean] },
|
|
44
|
+
autocomplete: {},
|
|
45
|
+
formatter: { type: Function },
|
|
46
|
+
parser: { type: Function },
|
|
47
|
+
placeholder: {},
|
|
48
|
+
form: {},
|
|
49
|
+
readonly: { type: Boolean },
|
|
50
|
+
clearable: { type: Boolean },
|
|
51
|
+
clearIcon: {},
|
|
52
|
+
showPassword: { type: Boolean },
|
|
53
|
+
showWordLimit: { type: Boolean },
|
|
54
|
+
wordLimitPosition: {},
|
|
55
|
+
suffixIcon: {},
|
|
56
|
+
prefixIcon: {},
|
|
57
|
+
containerRole: {},
|
|
58
|
+
tabindex: {},
|
|
59
|
+
validateEvent: { type: Boolean },
|
|
60
|
+
inputStyle: { type: [Boolean, null, String, Object, Array] },
|
|
61
|
+
autofocus: { type: Boolean },
|
|
62
|
+
rows: {},
|
|
63
|
+
ariaLabel: {},
|
|
64
|
+
inputmode: {},
|
|
65
|
+
name: {},
|
|
66
|
+
countGraphemes: { type: Function },
|
|
67
|
+
floatLabel: { type: Boolean }
|
|
68
|
+
}, Tt),
|
|
69
|
+
emits: Gt,
|
|
70
|
+
setup(a, { expose: je, emit: Ye }) {
|
|
71
|
+
const t = a, p = Ye, Ce = ht(), O = bt(), qe = r(() => [
|
|
72
|
+
t.type === "textarea" ? D.b() : s.b(),
|
|
73
|
+
s.m(Qe.value),
|
|
74
|
+
s.is("disabled", I.value),
|
|
75
|
+
s.is("exceed", et.value),
|
|
76
|
+
s.is("float-label", t.floatLabel),
|
|
77
|
+
{
|
|
78
|
+
[s.b("group")]: O.prepend || O.append,
|
|
79
|
+
[s.m("prefix")]: O.prefix || t.prefixIcon,
|
|
80
|
+
[s.m("suffix")]: O.suffix || t.suffixIcon || t.clearable || t.showPassword,
|
|
81
|
+
[s.bm("suffix", "password-clear")]: X.value && ue.value,
|
|
82
|
+
[s.b("hidden")]: t.type === "hidden"
|
|
83
|
+
},
|
|
84
|
+
Ce.class
|
|
85
|
+
]), Je = r(() => [
|
|
86
|
+
s.e("wrapper"),
|
|
87
|
+
s.is("focus", Q.value)
|
|
88
|
+
]), Ie = Pt(), C = r(() => {
|
|
89
|
+
var e;
|
|
90
|
+
return (e = t.maxlength) == null ? void 0 : e.toString();
|
|
91
|
+
}), { form: se, formItem: f } = $t(), { inputId: ke } = At(t, {
|
|
92
|
+
formItemContext: f
|
|
93
|
+
}), Qe = Ot(), I = Dt(), s = Fe("input"), D = Fe("textarea"), Y = he(), x = he(), ie = P(!1), M = P(!1), Se = P(), Me = P(), q = he(t.inputStyle), H = P(""), J = P(), y = r(() => Y.value || x.value), { wrapperRef: Xe, isFocused: Q, handleFocus: Ee, handleBlur: Ve } = Lt(
|
|
94
|
+
y,
|
|
95
|
+
{
|
|
96
|
+
disabled: I,
|
|
97
|
+
afterBlur() {
|
|
98
|
+
var e;
|
|
99
|
+
t.validateEvent && ((e = f == null ? void 0 : f.validate) == null || e.call(f, "blur").catch(A));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
), ze = r(() => (se == null ? void 0 : se.statusIcon) ?? !1), F = r(() => (f == null ? void 0 : f.validateState) || ""), Le = r(
|
|
103
|
+
() => F.value && zt[F.value]
|
|
104
|
+
), Ze = r(() => M.value ? St : Mt), _e = r(() => [
|
|
105
|
+
Ce.style
|
|
106
|
+
]), Pe = r(() => [
|
|
107
|
+
t.inputStyle,
|
|
108
|
+
q.value,
|
|
109
|
+
{ resize: t.resize },
|
|
110
|
+
J.value ? { height: J.value } : void 0
|
|
111
|
+
]), w = r(
|
|
112
|
+
() => kt(t.modelValue) ? "" : String(t.modelValue)
|
|
113
|
+
), { floatLabelClass: Be } = Rt({
|
|
114
|
+
floatLabel: be(t, "floatLabel"),
|
|
115
|
+
isFocused: Q,
|
|
116
|
+
hasValue: r(() => !!w.value),
|
|
117
|
+
isDisabled: I,
|
|
118
|
+
isReadonly: be(t, "readonly")
|
|
119
|
+
}), re = r(
|
|
120
|
+
() => t.clearable && !I.value && !t.readonly
|
|
121
|
+
), X = r(
|
|
122
|
+
() => re.value && !!w.value && (Q.value || ie.value)
|
|
123
|
+
), ue = r(
|
|
124
|
+
() => t.showPassword && !I.value && !!w.value
|
|
125
|
+
), E = r(
|
|
126
|
+
() => t.showWordLimit && !!C.value && (t.type === "text" || t.type === "textarea") && !I.value && !t.readonly && !t.showPassword
|
|
127
|
+
), ce = r(() => t.countGraphemes && t.showWordLimit ? t.countGraphemes(w.value) : w.value.length), et = r(
|
|
128
|
+
() => (
|
|
129
|
+
// show exceed style if length of initial value greater then maxlength
|
|
130
|
+
!!E.value && ce.value > Number(C.value)
|
|
131
|
+
)
|
|
132
|
+
), tt = r(
|
|
133
|
+
() => !!O.suffix || !!t.suffixIcon || t.clearable || t.showPassword || E.value || !!F.value && ze.value
|
|
134
|
+
), ot = r(
|
|
135
|
+
() => !!Object.keys(t.modelModifiers).length
|
|
136
|
+
), [at, nt] = Nt(Y);
|
|
137
|
+
let V;
|
|
138
|
+
Ct(x, (e) => {
|
|
139
|
+
if (lt(), !E.value && !re.value || t.resize !== "both" && t.resize !== "horizontal")
|
|
140
|
+
return;
|
|
141
|
+
const n = e[0], { width: l } = n.target.getBoundingClientRect(), d = () => {
|
|
142
|
+
V = void 0, Se.value = {
|
|
143
|
+
/** right: 100% - (width - right(10)) */
|
|
144
|
+
right: `calc(100% - ${l - 10}px)`
|
|
145
|
+
}, Me.value = {
|
|
146
|
+
/** right: 100% - (width - right(11)) */
|
|
147
|
+
right: `calc(100% - ${l - 11}px)`
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
V && De(V), V = Vt(d);
|
|
151
|
+
});
|
|
152
|
+
const W = () => {
|
|
153
|
+
const { type: e, autosize: n } = t;
|
|
154
|
+
if (!(!It || e !== "textarea" || !x.value))
|
|
155
|
+
if (n) {
|
|
156
|
+
const l = Oe(n) ? n.minRows : void 0, d = Oe(n) ? n.maxRows : void 0, c = Ke(x.value, l, d);
|
|
157
|
+
q.value = {
|
|
158
|
+
overflowY: "hidden",
|
|
159
|
+
...c
|
|
160
|
+
}, B(() => {
|
|
161
|
+
x.value.offsetHeight, q.value = c;
|
|
162
|
+
});
|
|
163
|
+
} else
|
|
164
|
+
q.value = {
|
|
165
|
+
minHeight: Ke(x.value).minHeight
|
|
166
|
+
};
|
|
167
|
+
}, lt = ((e) => {
|
|
168
|
+
let n = !1;
|
|
169
|
+
return () => {
|
|
170
|
+
var d;
|
|
171
|
+
if (n || !t.autosize) {
|
|
172
|
+
t.resize !== "none" && setTimeout(() => {
|
|
173
|
+
var c;
|
|
174
|
+
J.value = (c = x.value) == null ? void 0 : c.style.height;
|
|
175
|
+
});
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
((d = x.value) == null ? void 0 : d.offsetParent) === null || (setTimeout(e), n = !0);
|
|
179
|
+
};
|
|
180
|
+
})(W), z = () => {
|
|
181
|
+
const e = y.value, n = t.formatter ? t.formatter(w.value) : w.value;
|
|
182
|
+
!e || e.value === n || t.type === "file" || (e.value = n);
|
|
183
|
+
}, Ne = (e) => {
|
|
184
|
+
const { trim: n, number: l } = t.modelModifiers;
|
|
185
|
+
return n && (e = e.trim()), l && (e = `${We(e)}`), t.formatter && t.parser && (e = t.parser(e)), e;
|
|
186
|
+
}, de = async (e) => {
|
|
187
|
+
if (Ge.value) return;
|
|
188
|
+
const { lazy: n } = t.modelModifiers;
|
|
189
|
+
let { value: l } = e.target, d = !1;
|
|
190
|
+
if (n) {
|
|
191
|
+
p(xe, l);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
if (l = Ne(l), t.countGraphemes && C.value != null) {
|
|
195
|
+
const c = Number(C.value), te = t.countGraphemes(l), L = t.countGraphemes(H.value);
|
|
196
|
+
if (te > c && te > L)
|
|
197
|
+
if (L > c)
|
|
198
|
+
l = H.value, d = !0;
|
|
199
|
+
else {
|
|
200
|
+
const k = H.value, g = l;
|
|
201
|
+
let v = 0;
|
|
202
|
+
for (; v < k.length && v < g.length && k[v] === g[v]; )
|
|
203
|
+
v++;
|
|
204
|
+
let S = k.length, K = g.length;
|
|
205
|
+
for (; S > v && K > v && k[S - 1] === g[K - 1]; )
|
|
206
|
+
S--, K--;
|
|
207
|
+
const dt = g.slice(0, v), mt = k.slice(v, S), $e = g.slice(v, K), ft = g.slice(K), vt = t.countGraphemes(mt), pt = L - vt, ve = Math.max(0, c - pt);
|
|
208
|
+
let U = "";
|
|
209
|
+
if (ve > 0)
|
|
210
|
+
if (typeof Intl < "u" && "Segmenter" in Intl) {
|
|
211
|
+
const pe = new Intl.Segmenter(void 0, {
|
|
212
|
+
granularity: "grapheme"
|
|
213
|
+
});
|
|
214
|
+
for (const { segment: oe } of pe.segment($e)) {
|
|
215
|
+
const ye = U + oe;
|
|
216
|
+
if (t.countGraphemes(ye) > ve) break;
|
|
217
|
+
U = ye;
|
|
218
|
+
}
|
|
219
|
+
} else
|
|
220
|
+
for (const pe of Array.from($e)) {
|
|
221
|
+
const oe = U + pe;
|
|
222
|
+
if (t.countGraphemes(oe) > ve) break;
|
|
223
|
+
U = oe;
|
|
224
|
+
}
|
|
225
|
+
l = dt + U + ft, d = !0;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
if (String(l) === w.value) {
|
|
229
|
+
if (t.formatter || d) {
|
|
230
|
+
const c = e.target, te = c.value, L = c.selectionStart, k = c.selectionEnd;
|
|
231
|
+
if (z(), d && y.value && L != null && k != null) {
|
|
232
|
+
const g = y.value.value, v = te.slice(Math.max(0, k));
|
|
233
|
+
let S = Math.min(L, g.length);
|
|
234
|
+
v && g.endsWith(v) && (S = g.length - v.length), y.value.setSelectionRange(S, S);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
H.value = l, at(), p(we, l), p(xe, l), await B(), (t.formatter && t.parser || !ot.value) && z(), nt();
|
|
240
|
+
}, Re = async (e) => {
|
|
241
|
+
let { value: n } = e.target;
|
|
242
|
+
n = Ne(n), t.modelModifiers.lazy && p(we, n), p(He, n, e), await B(), z();
|
|
243
|
+
}, {
|
|
244
|
+
isComposing: Ge,
|
|
245
|
+
handleCompositionStart: Z,
|
|
246
|
+
handleCompositionUpdate: _,
|
|
247
|
+
handleCompositionEnd: ee
|
|
248
|
+
} = Bt({ emit: p, afterComposition: de }), st = () => {
|
|
249
|
+
M.value = !M.value;
|
|
250
|
+
}, me = () => {
|
|
251
|
+
var e;
|
|
252
|
+
return (e = y.value) == null ? void 0 : e.focus();
|
|
253
|
+
}, it = () => {
|
|
254
|
+
var e;
|
|
255
|
+
return (e = y.value) == null ? void 0 : e.blur();
|
|
256
|
+
}, rt = (e) => {
|
|
257
|
+
ie.value = !1, p("mouseleave", e);
|
|
258
|
+
}, ut = (e) => {
|
|
259
|
+
ie.value = !0, p("mouseenter", e);
|
|
260
|
+
}, Te = (e) => {
|
|
261
|
+
p("keydown", e);
|
|
262
|
+
}, ct = () => {
|
|
263
|
+
var e;
|
|
264
|
+
(e = y.value) == null || e.select();
|
|
265
|
+
}, fe = (e) => {
|
|
266
|
+
p(we, ""), p(He, ""), p("clear", e), p(xe, "");
|
|
267
|
+
};
|
|
268
|
+
return ae(
|
|
269
|
+
() => t.modelValue,
|
|
270
|
+
() => {
|
|
271
|
+
var e;
|
|
272
|
+
B(() => {
|
|
273
|
+
W(), t.autosize && (J.value = void 0);
|
|
274
|
+
}), t.validateEvent && ((e = f == null ? void 0 : f.validate) == null || e.call(f, "change").catch(A));
|
|
275
|
+
}
|
|
276
|
+
), ae(
|
|
277
|
+
() => w.value,
|
|
278
|
+
(e) => {
|
|
279
|
+
H.value = e;
|
|
280
|
+
},
|
|
281
|
+
{ immediate: !0 }
|
|
282
|
+
), ae(w, (e) => {
|
|
283
|
+
if (!y.value)
|
|
284
|
+
return;
|
|
285
|
+
const { trim: n, number: l } = t.modelModifiers, d = y.value.value, c = (l || t.type === "number") && !/^0\d/.test(d) ? `${We(d)}` : d;
|
|
286
|
+
c !== e && (document.activeElement === y.value && y.value.type !== "range" && n && c.trim() === e || z());
|
|
287
|
+
}), ae(
|
|
288
|
+
() => t.type,
|
|
289
|
+
async () => {
|
|
290
|
+
await B(), z(), W();
|
|
291
|
+
}
|
|
292
|
+
), gt(() => {
|
|
293
|
+
!t.formatter && t.parser && Et(
|
|
294
|
+
Ue,
|
|
295
|
+
"If you set the parser, you also need to set the formatter."
|
|
296
|
+
), z(), B(W);
|
|
297
|
+
}), xt(() => {
|
|
298
|
+
V && De(V);
|
|
299
|
+
}), je({
|
|
300
|
+
/** @description HTML input element */
|
|
301
|
+
input: Y,
|
|
302
|
+
/** @description HTML textarea element */
|
|
303
|
+
textarea: x,
|
|
304
|
+
/** @description HTML element, input or textarea */
|
|
305
|
+
ref: y,
|
|
306
|
+
/** @description style of textarea. */
|
|
307
|
+
textareaStyle: Pe,
|
|
308
|
+
/** @description from props (used on unit test) */
|
|
309
|
+
autosize: be(t, "autosize"),
|
|
310
|
+
/** @description is input composing */
|
|
311
|
+
isComposing: Ge,
|
|
312
|
+
/** @description whether the password is visible */
|
|
313
|
+
passwordVisible: M,
|
|
314
|
+
/** @description HTML input element native method */
|
|
315
|
+
focus: me,
|
|
316
|
+
/** @description HTML input element native method */
|
|
317
|
+
blur: it,
|
|
318
|
+
/** @description HTML input element native method */
|
|
319
|
+
select: ct,
|
|
320
|
+
/** @description clear input value */
|
|
321
|
+
clear: fe,
|
|
322
|
+
/** @description resize textarea. */
|
|
323
|
+
resizeTextarea: W
|
|
324
|
+
}), (e, n) => (i(), h("div", {
|
|
325
|
+
class: u([
|
|
326
|
+
qe.value,
|
|
327
|
+
{
|
|
328
|
+
[o(s).bm("group", "append")]: e.$slots.append,
|
|
329
|
+
[o(s).bm("group", "prepend")]: e.$slots.prepend
|
|
330
|
+
}
|
|
331
|
+
]),
|
|
332
|
+
style: ne(_e.value),
|
|
333
|
+
onMouseenter: ut,
|
|
334
|
+
onMouseleave: rt
|
|
335
|
+
}, [
|
|
336
|
+
a.type !== "textarea" ? (i(), h(ge, { key: 0 }, [
|
|
337
|
+
e.$slots.prepend ? (i(), h("div", {
|
|
338
|
+
key: 0,
|
|
339
|
+
class: u(o(s).be("group", "prepend"))
|
|
340
|
+
}, [
|
|
341
|
+
j(e.$slots, "prepend")
|
|
342
|
+
], 2)) : m("", !0),
|
|
343
|
+
N("div", {
|
|
344
|
+
ref_key: "wrapperRef",
|
|
345
|
+
ref: Xe,
|
|
346
|
+
class: u(Je.value)
|
|
347
|
+
}, [
|
|
348
|
+
a.floatLabel ? (i(), h("span", {
|
|
349
|
+
key: 0,
|
|
350
|
+
class: u(["el-float-label", o(Be)]),
|
|
351
|
+
onClick: me
|
|
352
|
+
}, R(a.placeholder), 3)) : m("", !0),
|
|
353
|
+
e.$slots.prefix || a.prefixIcon ? (i(), h("span", {
|
|
354
|
+
key: 1,
|
|
355
|
+
class: u(o(s).e("prefix"))
|
|
356
|
+
}, [
|
|
357
|
+
N("span", {
|
|
358
|
+
class: u(o(s).e("prefix-inner"))
|
|
359
|
+
}, [
|
|
360
|
+
j(e.$slots, "prefix"),
|
|
361
|
+
a.prefixIcon ? (i(), b(o($), {
|
|
362
|
+
key: 0,
|
|
363
|
+
class: u(o(s).e("icon"))
|
|
364
|
+
}, {
|
|
365
|
+
default: G(() => [
|
|
366
|
+
(i(), b(T(a.prefixIcon)))
|
|
367
|
+
]),
|
|
368
|
+
_: 1
|
|
369
|
+
}, 8, ["class"])) : m("", !0)
|
|
370
|
+
], 2)
|
|
371
|
+
], 2)) : m("", !0),
|
|
372
|
+
N("input", Ae({
|
|
373
|
+
id: o(ke),
|
|
374
|
+
ref_key: "input",
|
|
375
|
+
ref: Y,
|
|
376
|
+
class: o(s).e("inner")
|
|
377
|
+
}, o(Ie), {
|
|
378
|
+
name: a.name,
|
|
379
|
+
minlength: a.countGraphemes ? void 0 : a.minlength,
|
|
380
|
+
maxlength: a.countGraphemes ? void 0 : C.value,
|
|
381
|
+
type: a.showPassword ? M.value ? "text" : "password" : a.type,
|
|
382
|
+
disabled: o(I),
|
|
383
|
+
readonly: a.readonly,
|
|
384
|
+
autocomplete: a.autocomplete,
|
|
385
|
+
tabindex: a.tabindex,
|
|
386
|
+
"aria-label": a.ariaLabel,
|
|
387
|
+
placeholder: a.floatLabel ? void 0 : a.placeholder,
|
|
388
|
+
style: a.inputStyle,
|
|
389
|
+
form: a.form,
|
|
390
|
+
autofocus: a.autofocus,
|
|
391
|
+
role: a.containerRole,
|
|
392
|
+
inputmode: a.inputmode,
|
|
393
|
+
onCompositionstart: n[0] || (n[0] = //@ts-ignore
|
|
394
|
+
(...l) => o(Z) && o(Z)(...l)),
|
|
395
|
+
onCompositionupdate: n[1] || (n[1] = //@ts-ignore
|
|
396
|
+
(...l) => o(_) && o(_)(...l)),
|
|
397
|
+
onCompositionend: n[2] || (n[2] = //@ts-ignore
|
|
398
|
+
(...l) => o(ee) && o(ee)(...l)),
|
|
399
|
+
onInput: de,
|
|
400
|
+
onChange: Re,
|
|
401
|
+
onKeydown: Te
|
|
402
|
+
}), null, 16, Ht),
|
|
403
|
+
tt.value ? (i(), h("span", {
|
|
404
|
+
key: 2,
|
|
405
|
+
class: u(o(s).e("suffix"))
|
|
406
|
+
}, [
|
|
407
|
+
N("span", {
|
|
408
|
+
class: u(o(s).e("suffix-inner"))
|
|
409
|
+
}, [
|
|
410
|
+
re.value ? (i(), b(o($), {
|
|
411
|
+
key: 0,
|
|
412
|
+
class: u([o(s).e("icon"), o(s).e("clear")]),
|
|
413
|
+
style: ne({ visibility: X.value ? "visible" : "hidden" }),
|
|
414
|
+
onMousedown: le(o(A), ["prevent"]),
|
|
415
|
+
onClick: fe
|
|
416
|
+
}, {
|
|
417
|
+
default: G(() => [
|
|
418
|
+
(i(), b(T(a.clearIcon)))
|
|
419
|
+
]),
|
|
420
|
+
_: 1
|
|
421
|
+
}, 8, ["class", "style", "onMousedown"])) : m("", !0),
|
|
422
|
+
!X.value || !ue.value || !E.value ? (i(), h(ge, { key: 1 }, [
|
|
423
|
+
j(e.$slots, "suffix"),
|
|
424
|
+
a.suffixIcon ? (i(), b(o($), {
|
|
425
|
+
key: 0,
|
|
426
|
+
class: u(o(s).e("icon"))
|
|
427
|
+
}, {
|
|
428
|
+
default: G(() => [
|
|
429
|
+
(i(), b(T(a.suffixIcon)))
|
|
430
|
+
]),
|
|
431
|
+
_: 1
|
|
432
|
+
}, 8, ["class"])) : m("", !0)
|
|
433
|
+
], 64)) : m("", !0),
|
|
434
|
+
ue.value ? (i(), b(o($), {
|
|
435
|
+
key: 2,
|
|
436
|
+
class: u([o(s).e("icon"), o(s).e("password")]),
|
|
437
|
+
onClick: st,
|
|
438
|
+
onMousedown: le(o(A), ["prevent"]),
|
|
439
|
+
onMouseup: le(o(A), ["prevent"])
|
|
440
|
+
}, {
|
|
441
|
+
default: G(() => [
|
|
442
|
+
j(e.$slots, "password-icon", { visible: M.value }, () => [
|
|
443
|
+
(i(), b(T(Ze.value)))
|
|
444
|
+
])
|
|
445
|
+
]),
|
|
446
|
+
_: 3
|
|
447
|
+
}, 8, ["class", "onMousedown", "onMouseup"])) : m("", !0),
|
|
448
|
+
E.value ? (i(), h("span", {
|
|
449
|
+
key: 3,
|
|
450
|
+
class: u([
|
|
451
|
+
o(s).e("count"),
|
|
452
|
+
o(s).is("outside", a.wordLimitPosition === "outside")
|
|
453
|
+
])
|
|
454
|
+
}, [
|
|
455
|
+
N("span", {
|
|
456
|
+
class: u(o(s).e("count-inner"))
|
|
457
|
+
}, R(ce.value) + " / " + R(C.value), 3)
|
|
458
|
+
], 2)) : m("", !0),
|
|
459
|
+
F.value && Le.value && ze.value ? (i(), b(o($), {
|
|
460
|
+
key: 4,
|
|
461
|
+
class: u([
|
|
462
|
+
o(s).e("icon"),
|
|
463
|
+
o(s).e("validateIcon"),
|
|
464
|
+
o(s).is("loading", F.value === "validating")
|
|
465
|
+
])
|
|
466
|
+
}, {
|
|
467
|
+
default: G(() => [
|
|
468
|
+
(i(), b(T(Le.value)))
|
|
469
|
+
]),
|
|
470
|
+
_: 1
|
|
471
|
+
}, 8, ["class"])) : m("", !0)
|
|
472
|
+
], 2)
|
|
473
|
+
], 2)) : m("", !0)
|
|
474
|
+
], 2),
|
|
475
|
+
e.$slots.append ? (i(), h("div", {
|
|
476
|
+
key: 1,
|
|
477
|
+
class: u(o(s).be("group", "append"))
|
|
478
|
+
}, [
|
|
479
|
+
j(e.$slots, "append")
|
|
480
|
+
], 2)) : m("", !0)
|
|
481
|
+
], 64)) : (i(), h(ge, { key: 1 }, [
|
|
482
|
+
a.floatLabel ? (i(), h("span", {
|
|
483
|
+
key: 0,
|
|
484
|
+
class: u(["el-float-label", o(Be)]),
|
|
485
|
+
onClick: me
|
|
486
|
+
}, R(a.placeholder), 3)) : m("", !0),
|
|
487
|
+
N("textarea", Ae({
|
|
488
|
+
id: o(ke),
|
|
489
|
+
ref_key: "textarea",
|
|
490
|
+
ref: x,
|
|
491
|
+
class: [
|
|
492
|
+
o(D).e("inner"),
|
|
493
|
+
o(s).is("focus", o(Q)),
|
|
494
|
+
o(D).is("clearable", a.clearable)
|
|
495
|
+
]
|
|
496
|
+
}, o(Ie), {
|
|
497
|
+
name: a.name,
|
|
498
|
+
minlength: a.countGraphemes ? void 0 : a.minlength,
|
|
499
|
+
maxlength: a.countGraphemes ? void 0 : C.value,
|
|
500
|
+
tabindex: a.tabindex,
|
|
501
|
+
disabled: o(I),
|
|
502
|
+
readonly: a.readonly,
|
|
503
|
+
autocomplete: a.autocomplete,
|
|
504
|
+
style: Pe.value,
|
|
505
|
+
"aria-label": a.ariaLabel,
|
|
506
|
+
placeholder: a.floatLabel ? void 0 : a.placeholder,
|
|
507
|
+
form: a.form,
|
|
508
|
+
autofocus: a.autofocus,
|
|
509
|
+
rows: a.rows,
|
|
510
|
+
role: a.containerRole,
|
|
511
|
+
inputmode: a.inputmode,
|
|
512
|
+
onCompositionstart: n[3] || (n[3] = //@ts-ignore
|
|
513
|
+
(...l) => o(Z) && o(Z)(...l)),
|
|
514
|
+
onCompositionupdate: n[4] || (n[4] = //@ts-ignore
|
|
515
|
+
(...l) => o(_) && o(_)(...l)),
|
|
516
|
+
onCompositionend: n[5] || (n[5] = //@ts-ignore
|
|
517
|
+
(...l) => o(ee) && o(ee)(...l)),
|
|
518
|
+
onInput: de,
|
|
519
|
+
onFocus: n[6] || (n[6] = //@ts-ignore
|
|
520
|
+
(...l) => o(Ee) && o(Ee)(...l)),
|
|
521
|
+
onBlur: n[7] || (n[7] = //@ts-ignore
|
|
522
|
+
(...l) => o(Ve) && o(Ve)(...l)),
|
|
523
|
+
onChange: Re,
|
|
524
|
+
onKeydown: Te
|
|
525
|
+
}), null, 16, Ft),
|
|
526
|
+
X.value ? (i(), b(o($), {
|
|
527
|
+
key: 1,
|
|
528
|
+
class: u([o(D).e("icon"), o(D).e("clear")]),
|
|
529
|
+
style: ne(Me.value),
|
|
530
|
+
onMousedown: le(o(A), ["prevent"]),
|
|
531
|
+
onClick: fe
|
|
532
|
+
}, {
|
|
533
|
+
default: G(() => [
|
|
534
|
+
(i(), b(T(a.clearIcon)))
|
|
535
|
+
]),
|
|
536
|
+
_: 1
|
|
537
|
+
}, 8, ["class", "style", "onMousedown"])) : m("", !0),
|
|
538
|
+
E.value ? (i(), h("span", {
|
|
539
|
+
key: 2,
|
|
540
|
+
style: ne(Se.value),
|
|
541
|
+
class: u([
|
|
542
|
+
o(s).e("count"),
|
|
543
|
+
o(s).is("outside", a.wordLimitPosition === "outside")
|
|
544
|
+
])
|
|
545
|
+
}, R(ce.value) + " / " + R(C.value), 7)) : m("", !0)
|
|
546
|
+
], 64))
|
|
547
|
+
], 38));
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
export {
|
|
551
|
+
xo as default
|
|
552
|
+
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { Plugin } from 'vue';
|
|
2
|
-
import
|
|
3
|
-
export declare const EpInput: typeof
|
|
2
|
+
import _EpInput from './EpInput.vue';
|
|
3
|
+
export declare const EpInput: typeof _EpInput & Plugin;
|
|
4
4
|
export default EpInput;
|
|
5
|
+
export { inputEmits, inputProps, inputPropsDefaults, } from './input';
|
|
6
|
+
export type { InputAutoSize, InputEmits, InputModelModifiers, InputProps, InputPropsPublic, InputType, } from './input';
|
|
7
|
+
export type { InputInstance } from './instance';
|