el-plus 0.0.110 → 0.0.111
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 +6 -0
- package/dist/index.full.js +14 -2
- package/dist/index.full.min.js +3 -3
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +4 -4
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +14 -2
- package/es/components/input/index.d.ts +15 -0
- package/es/components/input/src/input.d.ts +4 -0
- package/es/components/input/src/input.mjs +4 -0
- package/es/components/input/src/input.mjs.map +1 -1
- package/es/components/input/src/input.vue.d.ts +9 -0
- package/es/components/input/src/input.vue2.mjs +9 -1
- package/es/components/input/src/input.vue2.mjs.map +1 -1
- package/es/package.json.mjs +1 -1
- package/lib/components/input/index.d.ts +15 -0
- package/lib/components/input/src/input.d.ts +4 -0
- package/lib/components/input/src/input.js +4 -0
- package/lib/components/input/src/input.js.map +1 -1
- package/lib/components/input/src/input.vue.d.ts +9 -0
- package/lib/components/input/src/input.vue2.js +8 -0
- package/lib/components/input/src/input.vue2.js.map +1 -1
- package/lib/package.json.js +1 -1
- package/package.json +1 -1
package/dist/index.full.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! ElPlus v0.0.
|
|
1
|
+
/*! ElPlus v0.0.111 */
|
|
2
2
|
|
|
3
3
|
import { useAttrs, getCurrentInstance, inject, provide, ref, nextTick, defineComponent, computed, createVNode, Fragment, withDirectives, resolveComponent, mergeProps, resolveDirective, useTemplateRef, reactive, onBeforeUpdate, createTextVNode, h, mergeModels, useModel, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, createCommentVNode, withCtx, renderSlot, renderList, createBlock, vShow, toDisplayString, useSlots, watch, createSlots, normalizeProps, guardReactiveProps, markRaw, Transition, shallowReactive, isVNode, render, createElementVNode, toRaw, onMounted } from 'vue';
|
|
4
4
|
import { buttonProps, useLocale as useLocale$1, ElLoading, ElMessage, ElMessageBox, formProps as formProps$1, formEmits as formEmits$1, ElTooltip, formItemProps as formItemProps$1, ElFormItem, ElForm, ElRow, ElCol, inputProps as inputProps$1, inputEmits as inputEmits$1, configProviderContextKey, ElConfigProvider, ElDialog, ElButton, ElTable, ElIcon, selectProps as selectProps$1, selectEmits as selectEmits$1, ElPageHeader, datePickerProps, linkProps as linkProps$1, ElSkeleton } from 'element-plus';
|
|
@@ -1143,6 +1143,10 @@ const inputProps = {
|
|
|
1143
1143
|
clearable: {
|
|
1144
1144
|
...inputProps$1.clearable,
|
|
1145
1145
|
default: true
|
|
1146
|
+
},
|
|
1147
|
+
clearableFocus: {
|
|
1148
|
+
type: Boolean,
|
|
1149
|
+
default: true
|
|
1146
1150
|
}
|
|
1147
1151
|
};
|
|
1148
1152
|
const inputEmits = {
|
|
@@ -1176,6 +1180,14 @@ var _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
1176
1180
|
...prepareProps(props, ["modelValue"]),
|
|
1177
1181
|
...prepareEvents(emit, inputEmitsKeys),
|
|
1178
1182
|
placeholder: props.disabled ? "" : props.placeholder,
|
|
1183
|
+
onClear: () => {
|
|
1184
|
+
emit("clear");
|
|
1185
|
+
if (!props.clearableFocus) {
|
|
1186
|
+
nextTick(() => {
|
|
1187
|
+
inputRef.value?.blur?.();
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
},
|
|
1179
1191
|
onFocus: (e) => {
|
|
1180
1192
|
isFocusing = true;
|
|
1181
1193
|
if (props.thousand) {
|
|
@@ -4528,7 +4540,7 @@ var components = [
|
|
|
4528
4540
|
EpFooterInfo
|
|
4529
4541
|
];
|
|
4530
4542
|
|
|
4531
|
-
var version = "0.0.
|
|
4543
|
+
var version = "0.0.111";
|
|
4532
4544
|
|
|
4533
4545
|
var globalProperties = {
|
|
4534
4546
|
install(app) {
|
|
@@ -16,6 +16,10 @@ export declare const EpInput: {
|
|
|
16
16
|
readonly default: true;
|
|
17
17
|
readonly prototype: Boolean;
|
|
18
18
|
};
|
|
19
|
+
clearableFocus: {
|
|
20
|
+
readonly type: BooleanConstructor;
|
|
21
|
+
readonly default: true;
|
|
22
|
+
};
|
|
19
23
|
inputmode: import("element-plus/es/utils/index.js").EpPropFinalized<(new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined) | ((new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined))[], unknown, unknown, undefined, boolean>;
|
|
20
24
|
name: StringConstructor;
|
|
21
25
|
ariaLabel: StringConstructor;
|
|
@@ -140,6 +144,7 @@ export declare const EpInput: {
|
|
|
140
144
|
nonzero: boolean;
|
|
141
145
|
placeholder: string;
|
|
142
146
|
thousand: boolean;
|
|
147
|
+
clearableFocus: boolean;
|
|
143
148
|
inputmode: import("element-plus/es/utils/index.js").EpPropMergeType<(new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined) | ((new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined))[], unknown, unknown>;
|
|
144
149
|
modelModifiers: import("element-plus").InputModelModifiers;
|
|
145
150
|
autosize: import("element-plus").InputAutoSize;
|
|
@@ -177,6 +182,10 @@ export declare const EpInput: {
|
|
|
177
182
|
readonly default: true;
|
|
178
183
|
readonly prototype: Boolean;
|
|
179
184
|
};
|
|
185
|
+
clearableFocus: {
|
|
186
|
+
readonly type: BooleanConstructor;
|
|
187
|
+
readonly default: true;
|
|
188
|
+
};
|
|
180
189
|
inputmode: import("element-plus/es/utils/index.js").EpPropFinalized<(new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined) | ((new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined))[], unknown, unknown, undefined, boolean>;
|
|
181
190
|
name: StringConstructor;
|
|
182
191
|
ariaLabel: StringConstructor;
|
|
@@ -287,6 +296,7 @@ export declare const EpInput: {
|
|
|
287
296
|
nonzero: boolean;
|
|
288
297
|
placeholder: string;
|
|
289
298
|
thousand: boolean;
|
|
299
|
+
clearableFocus: boolean;
|
|
290
300
|
inputmode: import("element-plus/es/utils/index.js").EpPropMergeType<(new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined) | ((new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined))[], unknown, unknown>;
|
|
291
301
|
modelModifiers: import("element-plus").InputModelModifiers;
|
|
292
302
|
autosize: import("element-plus").InputAutoSize;
|
|
@@ -321,6 +331,10 @@ export declare const EpInput: {
|
|
|
321
331
|
readonly default: true;
|
|
322
332
|
readonly prototype: Boolean;
|
|
323
333
|
};
|
|
334
|
+
clearableFocus: {
|
|
335
|
+
readonly type: BooleanConstructor;
|
|
336
|
+
readonly default: true;
|
|
337
|
+
};
|
|
324
338
|
inputmode: import("element-plus/es/utils/index.js").EpPropFinalized<(new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined) | ((new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined))[], unknown, unknown, undefined, boolean>;
|
|
325
339
|
name: StringConstructor;
|
|
326
340
|
ariaLabel: StringConstructor;
|
|
@@ -445,6 +459,7 @@ export declare const EpInput: {
|
|
|
445
459
|
nonzero: boolean;
|
|
446
460
|
placeholder: string;
|
|
447
461
|
thousand: boolean;
|
|
462
|
+
clearableFocus: boolean;
|
|
448
463
|
inputmode: import("element-plus/es/utils/index.js").EpPropMergeType<(new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined) | ((new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined))[], unknown, unknown>;
|
|
449
464
|
modelModifiers: import("element-plus").InputModelModifiers;
|
|
450
465
|
autosize: import("element-plus").InputAutoSize;
|
|
@@ -16,6 +16,10 @@ export declare const inputProps: {
|
|
|
16
16
|
readonly default: true;
|
|
17
17
|
readonly prototype: Boolean;
|
|
18
18
|
};
|
|
19
|
+
readonly clearableFocus: {
|
|
20
|
+
readonly type: BooleanConstructor;
|
|
21
|
+
readonly default: true;
|
|
22
|
+
};
|
|
19
23
|
readonly inputmode: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined) | ((new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined))[], unknown, unknown, undefined, boolean>;
|
|
20
24
|
readonly name: StringConstructor;
|
|
21
25
|
readonly ariaLabel: StringConstructor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.mjs","sources":["../../../../../../packages/components/input/src/input.ts"],"sourcesContent":["import type { ExtractPropTypes } from 'vue'\nimport {\n inputProps as elInputProps,\n inputEmits as elInputEmits,\n} from 'element-plus'\nimport { useLocale } from '@el-plus/hooks/use-locale'\nconst { t } = useLocale()\n\nexport const inputProps = {\n ...elInputProps,\n max: Number,\n min: Number,\n radix: Number,\n nonzero: Boolean,\n placeholder: {\n type: String,\n default: () => {\n return t('ep.input.placeholder')\n },\n },\n thousand: {\n type: Boolean,\n default: true,\n },\n clearable: {\n ...elInputProps.clearable,\n default: true,\n },\n} as const\nexport type InputProps = ExtractPropTypes<typeof inputProps>\nexport const inputEmits = {\n ...elInputEmits,\n click: (evt: MouseEvent) => evt instanceof MouseEvent,\n}\nexport type InputEmits = typeof inputEmits\nexport const inputEmitsKeys = Object.keys(inputEmits)\n\n// max: Number,\n// min: Number,\n// nonzero: Boolean,\n// format: Function,\n// radix: {\n// type: [String, Number],\n// default: 5,\n// },\n// thousand: {\n// type: Boolean,\n// default: false,\n// },\n"],"names":["elInputProps","elInputEmits"],"mappings":";;;AAMA,MAAM,EAAE,CAAA,EAAE,GAAI,SAAA,EAAU;AAEjB,MAAM,UAAA,GAAa;AAAA,EACxB,GAAGA,YAAA;AAAA,EACH,GAAA,EAAK,MAAA;AAAA,EACL,GAAA,EAAK,MAAA;AAAA,EACL,KAAA,EAAO,MAAA;AAAA,EACP,OAAA,EAAS,OAAA;AAAA,EACT,WAAA,EAAa;AAAA,IACX,IAAA,EAAM,MAAA;AAAA,IACN,SAAS,MAAM;AACb,MAAA,OAAO,EAAE,sBAAsB,CAAA;AAAA,IACjC;AAAA,GACF;AAAA,EACA,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,OAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA,EACA,SAAA,EAAW;AAAA,IACT,GAAGA,YAAA,CAAa,SAAA;AAAA,IAChB,OAAA,EAAS;AAAA;AAEb;AAEO,MAAM,UAAA,GAAa;AAAA,EACxB,GAAGC,YAAA;AAAA,EACH,KAAA,EAAO,CAAC,GAAA,KAAoB,GAAA,YAAe;AAC7C;AAEO,MAAM,cAAA,GAAiB,MAAA,CAAO,IAAA,CAAK,UAAU;;;;"}
|
|
1
|
+
{"version":3,"file":"input.mjs","sources":["../../../../../../packages/components/input/src/input.ts"],"sourcesContent":["import type { ExtractPropTypes } from 'vue'\nimport {\n inputProps as elInputProps,\n inputEmits as elInputEmits,\n} from 'element-plus'\nimport { useLocale } from '@el-plus/hooks/use-locale'\nconst { t } = useLocale()\n\nexport const inputProps = {\n ...elInputProps,\n max: Number,\n min: Number,\n radix: Number,\n nonzero: Boolean,\n placeholder: {\n type: String,\n default: () => {\n return t('ep.input.placeholder')\n },\n },\n thousand: {\n type: Boolean,\n default: true,\n },\n clearable: {\n ...elInputProps.clearable,\n default: true,\n },\n clearableFocus: {\n type: Boolean,\n default: true,\n },\n} as const\nexport type InputProps = ExtractPropTypes<typeof inputProps>\nexport const inputEmits = {\n ...elInputEmits,\n click: (evt: MouseEvent) => evt instanceof MouseEvent,\n}\nexport type InputEmits = typeof inputEmits\nexport const inputEmitsKeys = Object.keys(inputEmits)\n\n// max: Number,\n// min: Number,\n// nonzero: Boolean,\n// format: Function,\n// radix: {\n// type: [String, Number],\n// default: 5,\n// },\n// thousand: {\n// type: Boolean,\n// default: false,\n// },\n"],"names":["elInputProps","elInputEmits"],"mappings":";;;AAMA,MAAM,EAAE,CAAA,EAAE,GAAI,SAAA,EAAU;AAEjB,MAAM,UAAA,GAAa;AAAA,EACxB,GAAGA,YAAA;AAAA,EACH,GAAA,EAAK,MAAA;AAAA,EACL,GAAA,EAAK,MAAA;AAAA,EACL,KAAA,EAAO,MAAA;AAAA,EACP,OAAA,EAAS,OAAA;AAAA,EACT,WAAA,EAAa;AAAA,IACX,IAAA,EAAM,MAAA;AAAA,IACN,SAAS,MAAM;AACb,MAAA,OAAO,EAAE,sBAAsB,CAAA;AAAA,IACjC;AAAA,GACF;AAAA,EACA,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,OAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA,EACA,SAAA,EAAW;AAAA,IACT,GAAGA,YAAA,CAAa,SAAA;AAAA,IAChB,OAAA,EAAS;AAAA,GACX;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,IAAA,EAAM,OAAA;AAAA,IACN,OAAA,EAAS;AAAA;AAEb;AAEO,MAAM,UAAA,GAAa;AAAA,EACxB,GAAGC,YAAA;AAAA,EACH,KAAA,EAAO,CAAC,GAAA,KAAoB,GAAA,YAAe;AAC7C;AAEO,MAAM,cAAA,GAAiB,MAAA,CAAO,IAAA,CAAK,UAAU;;;;"}
|
|
@@ -19,6 +19,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
19
19
|
readonly default: true;
|
|
20
20
|
readonly prototype: Boolean;
|
|
21
21
|
};
|
|
22
|
+
clearableFocus: {
|
|
23
|
+
readonly type: BooleanConstructor;
|
|
24
|
+
readonly default: true;
|
|
25
|
+
};
|
|
22
26
|
inputmode: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined) | ((new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined))[], unknown, unknown, undefined, boolean>;
|
|
23
27
|
name: StringConstructor;
|
|
24
28
|
ariaLabel: StringConstructor;
|
|
@@ -136,6 +140,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
136
140
|
readonly default: true;
|
|
137
141
|
readonly prototype: Boolean;
|
|
138
142
|
};
|
|
143
|
+
clearableFocus: {
|
|
144
|
+
readonly type: BooleanConstructor;
|
|
145
|
+
readonly default: true;
|
|
146
|
+
};
|
|
139
147
|
inputmode: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined) | ((new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined))[], unknown, unknown, undefined, boolean>;
|
|
140
148
|
name: StringConstructor;
|
|
141
149
|
ariaLabel: StringConstructor;
|
|
@@ -246,6 +254,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
246
254
|
nonzero: boolean;
|
|
247
255
|
placeholder: string;
|
|
248
256
|
thousand: boolean;
|
|
257
|
+
clearableFocus: boolean;
|
|
249
258
|
inputmode: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined) | ((new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined))[], unknown, unknown>;
|
|
250
259
|
modelModifiers: import("element-plus").InputModelModifiers;
|
|
251
260
|
autosize: import("element-plus").InputAutoSize;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, mergeModels, computed, useSlots, useModel, ref, watch,
|
|
1
|
+
import { defineComponent, mergeModels, computed, useSlots, useModel, nextTick, ref, watch, resolveComponent, createBlock, openBlock, mergeProps, unref, createSlots, renderList, withCtx, renderSlot, normalizeProps, guardReactiveProps } from 'vue';
|
|
2
2
|
import { createNameSpace } from '../../../utils/bem.mjs';
|
|
3
3
|
import { inputEmitsKeys, inputEmits, inputProps } from './input.mjs';
|
|
4
4
|
import { prepareEvents, prepareProps, prepareStyles, prepareClassNames } from '../../../utils/props.mjs';
|
|
@@ -28,6 +28,14 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
28
28
|
...prepareProps(props, ["modelValue"]),
|
|
29
29
|
...prepareEvents(emit, inputEmitsKeys),
|
|
30
30
|
placeholder: props.disabled ? "" : props.placeholder,
|
|
31
|
+
onClear: () => {
|
|
32
|
+
emit("clear");
|
|
33
|
+
if (!props.clearableFocus) {
|
|
34
|
+
nextTick(() => {
|
|
35
|
+
inputRef.value?.blur?.();
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
},
|
|
31
39
|
onFocus: (e) => {
|
|
32
40
|
isFocusing = true;
|
|
33
41
|
if (props.thousand) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.vue2.mjs","sources":["../../../../../../packages/components/input/src/input.vue"],"sourcesContent":["<template>\n <el-input\n ref=\"inputRef\"\n v-model=\"value\"\n :class=\"`${bem.b()} ${prepareClassNames()}`\"\n :style=\"{\n ...prepareStyles(),\n }\"\n v-bind=\"customAttrs\"\n :type=\"type === 'number' ? 'text' : type\"\n >\n <template v-for=\"name in slots\" #[name]=\"scope\">\n <slot :name=\"name\" v-bind=\"scope\" />\n </template>\n </el-input>\n</template>\n<script setup lang=\"ts\">\nimport { computed, useSlots, watch, ref, nextTick} from 'vue'\nimport { createNameSpace } from '@el-plus/utils/bem'\nimport { inputProps, inputEmits, inputEmitsKeys } from './input'\nimport type { InputProps, InputEmits } from './input'\nimport {\n prepareProps,\n prepareEvents,\n prepareClassNames,\n prepareStyles,\n} from '@el-plus/utils/props'\ndefineOptions({\n name: 'EpInput',\n inheritAttrs: false,\n})\nconst bem = createNameSpace('input')\nconst props = defineProps(inputProps)\nconst emit = defineEmits(inputEmits)\nconst slots = computed(() => {\n return Object.keys(useSlots())\n})\nlet isBluring = false\nlet isFocusing = false\nconst customAttrs = computed(() => {\n return {\n ...prepareProps(props, ['modelValue']),\n ...prepareEvents<InputEmits>(emit, inputEmitsKeys),\n placeholder: props.disabled ? '' : props.placeholder,\n onFocus: (e: FocusEvent) => {\n isFocusing = true\n if (props.thousand) {\n ;(e.target as HTMLInputElement).value = value.value\n ? String(value.value)\n : ''\n }\n emit('focus', e)\n },\n onBlur: (e: FocusEvent) => {\n if (props.type === 'number') {\n let val = value.value as string\n if (props.nonzero && +val === 0) {\n val = ''\n }\n if (val && val[val.length - 1] === '.') {\n val = String(val).slice(0, -1)\n }\n\n if (val && val === '-') {\n val = ''\n }\n value.value = val ? +val : val\n ;(e.target as HTMLInputElement).value =value.value? toThousand(value.value):''\n }\n isBluring = true\n isFocusing = false\n emit('blur', e)\n },\n }\n})\nconst value = defineModel<InputProps['modelValue']>()\nconst inputRef = ref()\nconst toThousand = (val: string | number) => {\n if (props.thousand) {\n return val ? window.hx.thousand(val) : val\n }\n return val\n}\nwatch(\n () => value.value,\n (val) => {\n if (props.type === 'number' && !isFocusing) {\n nextTick(() => {\n inputRef.value.input.value = val?toThousand(val as number):''\n })\n }\n if (isBluring) {\n isBluring = false\n return\n }\n if (!isFocusing) {\n return\n }\n if (props.type === 'number') {\n if (typeof val === 'number') {\n val = '' + val\n }\n if (typeof val === 'string') {\n // 校验一次是否0+数字开头,这种情况直接把0去除\n const zeroReg = new RegExp('^[-+]?0[0-9]\\\\d*')\n if (zeroReg.test(val)) {\n val = val.replace('0', '')\n }\n const reg = new RegExp('^([-+])?\\\\d*(\\\\.?\\\\d*)', 'g')\n val = val.match(reg) ? val.match(reg)![0] : ''\n\n // 限制小数位数\n if (props.radix || props.radix === 0) {\n const reg =\n props.radix === 0\n ? new RegExp('^([-+])?\\\\d*', 'g')\n : new RegExp(`^([-+])?\\\\d*(\\\\.?\\\\d{0,${props.radix}})`, 'g')\n val = val.match(reg) ? val.match(reg)![0] : ''\n }\n if ((props.max || props.max === 0) && +val > props.max) {\n val = props.max\n }\n // 最大最小值\n if (\n (props.min || props.min === 0) &&\n (val || val === 0) &&\n +val < props.min\n ) {\n val = props.min\n }\n }\n } else if (props.type === 'text') {\n val = (val as string).trim()\n }\n value.value = val\n },\n {\n immediate: true,\n },\n)\n</script>\n"],"names":["_useModel","reg","_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AQ,MAAM,CAAC,GAAA,GAAM,MAAM,GAAA,EAAK;AACtD,cAAA,GAAA,GAAM,KAAA,CAAM,GAAA;AAAA,YACd;AAEA,YAAA,IAAA,CACG,KAAA,CAAM,GAAA,IAAO,KAAA,CAAM,GAAA,KAAQ,CAAA,MAC3B,GAAA,IAAO,GAAA,KAAQ,CAAA,CAAA,IAChB,CAAC,GAAA,GAAM,KAAA,CAAM,GAAA,EACb;AACA,cAAA,GAAA,GAAM,KAAA,CAAM,GAAA;AAAA,YACd;AAAA,UACF;AAAA,QACF,CAAA,MAAA,IAAW,KAAA,CAAM,IAAA,KAAS,MAAA,EAAQ;AAChC,UAAA,GAAA,GAAO,IAAe,IAAA,EAAK;AAAA,QAC7B;AACA,QAAA,KAAA,CAAM,KAAA,GAAQ,GAAA;AAAA,MAChB,CAAA;AAAA,MACA;AAAA,QACE,SAAA,EAAW;AAAA;AACb,KACF;;;
|
|
1
|
+
{"version":3,"file":"input.vue2.mjs","sources":["../../../../../../packages/components/input/src/input.vue"],"sourcesContent":["<template>\n <el-input\n ref=\"inputRef\"\n v-model=\"value\"\n :class=\"`${bem.b()} ${prepareClassNames()}`\"\n :style=\"{\n ...prepareStyles(),\n }\"\n v-bind=\"customAttrs\"\n :type=\"type === 'number' ? 'text' : type\"\n >\n <template v-for=\"name in slots\" #[name]=\"scope\">\n <slot :name=\"name\" v-bind=\"scope\" />\n </template>\n </el-input>\n</template>\n<script setup lang=\"ts\">\nimport { computed, useSlots, watch, ref, nextTick} from 'vue'\nimport { createNameSpace } from '@el-plus/utils/bem'\nimport { inputProps, inputEmits, inputEmitsKeys } from './input'\nimport type { InputProps, InputEmits } from './input'\nimport {\n prepareProps,\n prepareEvents,\n prepareClassNames,\n prepareStyles,\n} from '@el-plus/utils/props'\ndefineOptions({\n name: 'EpInput',\n inheritAttrs: false,\n})\nconst bem = createNameSpace('input')\nconst props = defineProps(inputProps)\nconst emit = defineEmits(inputEmits)\nconst slots = computed(() => {\n return Object.keys(useSlots())\n})\nlet isBluring = false\nlet isFocusing = false\nconst customAttrs = computed(() => {\n return {\n ...prepareProps(props, ['modelValue']),\n ...prepareEvents<InputEmits>(emit, inputEmitsKeys),\n placeholder: props.disabled ? '' : props.placeholder,\n onClear: () => {\n emit('clear')\n if (!props.clearableFocus) {\n nextTick(() => {\n inputRef.value?.blur?.()\n })\n }\n },\n onFocus: (e: FocusEvent) => {\n isFocusing = true\n if (props.thousand) {\n ;(e.target as HTMLInputElement).value = value.value\n ? String(value.value)\n : ''\n }\n emit('focus', e)\n },\n onBlur: (e: FocusEvent) => {\n if (props.type === 'number') {\n let val = value.value as string\n if (props.nonzero && +val === 0) {\n val = ''\n }\n if (val && val[val.length - 1] === '.') {\n val = String(val).slice(0, -1)\n }\n\n if (val && val === '-') {\n val = ''\n }\n value.value = val ? +val : val\n ;(e.target as HTMLInputElement).value =value.value? toThousand(value.value):''\n }\n isBluring = true\n isFocusing = false\n emit('blur', e)\n },\n }\n})\nconst value = defineModel<InputProps['modelValue']>()\nconst inputRef = ref()\nconst toThousand = (val: string | number) => {\n if (props.thousand) {\n return val ? window.hx.thousand(val) : val\n }\n return val\n}\nwatch(\n () => value.value,\n (val) => {\n if (props.type === 'number' && !isFocusing) {\n nextTick(() => {\n inputRef.value.input.value = val?toThousand(val as number):''\n })\n }\n if (isBluring) {\n isBluring = false\n return\n }\n if (!isFocusing) {\n return\n }\n if (props.type === 'number') {\n if (typeof val === 'number') {\n val = '' + val\n }\n if (typeof val === 'string') {\n // 校验一次是否0+数字开头,这种情况直接把0去除\n const zeroReg = new RegExp('^[-+]?0[0-9]\\\\d*')\n if (zeroReg.test(val)) {\n val = val.replace('0', '')\n }\n const reg = new RegExp('^([-+])?\\\\d*(\\\\.?\\\\d*)', 'g')\n val = val.match(reg) ? val.match(reg)![0] : ''\n\n // 限制小数位数\n if (props.radix || props.radix === 0) {\n const reg =\n props.radix === 0\n ? new RegExp('^([-+])?\\\\d*', 'g')\n : new RegExp(`^([-+])?\\\\d*(\\\\.?\\\\d{0,${props.radix}})`, 'g')\n val = val.match(reg) ? val.match(reg)![0] : ''\n }\n if ((props.max || props.max === 0) && +val > props.max) {\n val = props.max\n }\n // 最大最小值\n if (\n (props.min || props.min === 0) &&\n (val || val === 0) &&\n +val < props.min\n ) {\n val = props.min\n }\n }\n } else if (props.type === 'text') {\n val = (val as string).trim()\n }\n value.value = val\n },\n {\n immediate: true,\n },\n)\n</script>\n"],"names":["_useModel","reg","_openBlock","_createBlock","_mergeProps","_unref","type","_renderList","_withCtx","_renderSlot","_normalizeProps","_guardReactiveProps"],"mappings":";;;;;;;;;;;;;;;;;AA+BA,IAAA,MAAM,GAAA,GAAM,gBAAgB,OAAO,CAAA;AACnC,IAAA,MAAM,KAAA,GAAQ,OAAA;AACd,IAAA,MAAM,IAAA,GAAO,MAAA;AACb,IAAA,MAAM,KAAA,GAAQ,SAAS,MAAM;AAC3B,MAAA,OAAO,MAAA,CAAO,IAAA,CAAK,QAAA,EAAU,CAAA;AAAA,IAC/B,CAAC,CAAA;AACD,IAAA,IAAI,SAAA,GAAY,KAAA;AAChB,IAAA,IAAI,UAAA,GAAa,KAAA;AACjB,IAAA,MAAM,WAAA,GAAc,SAAS,MAAM;AACjC,MAAA,OAAO;AAAA,QACL,GAAG,YAAA,CAAa,KAAA,EAAO,CAAC,YAAY,CAAC,CAAA;AAAA,QACrC,GAAG,aAAA,CAA0B,IAAA,EAAM,cAAc,CAAA;AAAA,QACjD,WAAA,EAAa,KAAA,CAAM,QAAA,GAAW,EAAA,GAAK,KAAA,CAAM,WAAA;AAAA,QACzC,SAAS,MAAM;AACb,UAAA,IAAA,CAAK,OAAO,CAAA;AACZ,UAAA,IAAI,CAAC,MAAM,cAAA,EAAgB;AACzB,YAAA,QAAA,CAAS,MAAM;AACb,cAAA,QAAA,CAAS,OAAO,IAAA,IAAO;AAAA,YACzB,CAAC,CAAA;AAAA,UACH;AAAA,QACF,CAAA;AAAA,QACA,OAAA,EAAS,CAAC,CAAA,KAAkB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AAAA,2CAAA,KAAA,CAAK,KAAA,GAAA,MAAA;AAAA,QACb,KAAA,EAAK,CAAA,EAAKC,KAAA,CAAA,GAAA,CAAA,CAAI,CAAA,MAAOA,KAAA,CAAA,iBAAA,CAAA,EAAiB,CAAA,CAAA;AAAA,QACtC,KAAA,EAAK;AAAA,aAAaA,KAAA,CAAA,aAAA,CAAA;AAAa;SAGxB,YAAA,KAAA,EAAW;AAAA,QAClB,IAAA,EAAMC,IAAAA,CAAAA,IAAAA,KAAI,QAAA,GAAA,SAAyBA,IAAAA,CAAAA;AAAAA;QAEXC,UAAA,CAAA,KAAA,CAAA,KAAA,GAAR,IAAA,KAAI;;;YACnB,EAAA,EAAAC,OAAA,CAAA,CADuC,KAAA,KAAK;AAAA,cAC5CC,UAAA,CAAoC,KAAA,MAAA,EAAvB,IAAA,EAAIC,eAAAC,kBAAA,CAAU,KAAK,CAAA,CAAA;AAAA;;;;;;;;;;"}
|
package/es/package.json.mjs
CHANGED
|
@@ -16,6 +16,10 @@ export declare const EpInput: {
|
|
|
16
16
|
readonly default: true;
|
|
17
17
|
readonly prototype: Boolean;
|
|
18
18
|
};
|
|
19
|
+
clearableFocus: {
|
|
20
|
+
readonly type: BooleanConstructor;
|
|
21
|
+
readonly default: true;
|
|
22
|
+
};
|
|
19
23
|
inputmode: import("element-plus/es/utils/index.js").EpPropFinalized<(new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined) | ((new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined))[], unknown, unknown, undefined, boolean>;
|
|
20
24
|
name: StringConstructor;
|
|
21
25
|
ariaLabel: StringConstructor;
|
|
@@ -140,6 +144,7 @@ export declare const EpInput: {
|
|
|
140
144
|
nonzero: boolean;
|
|
141
145
|
placeholder: string;
|
|
142
146
|
thousand: boolean;
|
|
147
|
+
clearableFocus: boolean;
|
|
143
148
|
inputmode: import("element-plus/es/utils/index.js").EpPropMergeType<(new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined) | ((new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined))[], unknown, unknown>;
|
|
144
149
|
modelModifiers: import("element-plus").InputModelModifiers;
|
|
145
150
|
autosize: import("element-plus").InputAutoSize;
|
|
@@ -177,6 +182,10 @@ export declare const EpInput: {
|
|
|
177
182
|
readonly default: true;
|
|
178
183
|
readonly prototype: Boolean;
|
|
179
184
|
};
|
|
185
|
+
clearableFocus: {
|
|
186
|
+
readonly type: BooleanConstructor;
|
|
187
|
+
readonly default: true;
|
|
188
|
+
};
|
|
180
189
|
inputmode: import("element-plus/es/utils/index.js").EpPropFinalized<(new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined) | ((new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined))[], unknown, unknown, undefined, boolean>;
|
|
181
190
|
name: StringConstructor;
|
|
182
191
|
ariaLabel: StringConstructor;
|
|
@@ -287,6 +296,7 @@ export declare const EpInput: {
|
|
|
287
296
|
nonzero: boolean;
|
|
288
297
|
placeholder: string;
|
|
289
298
|
thousand: boolean;
|
|
299
|
+
clearableFocus: boolean;
|
|
290
300
|
inputmode: import("element-plus/es/utils/index.js").EpPropMergeType<(new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined) | ((new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined))[], unknown, unknown>;
|
|
291
301
|
modelModifiers: import("element-plus").InputModelModifiers;
|
|
292
302
|
autosize: import("element-plus").InputAutoSize;
|
|
@@ -321,6 +331,10 @@ export declare const EpInput: {
|
|
|
321
331
|
readonly default: true;
|
|
322
332
|
readonly prototype: Boolean;
|
|
323
333
|
};
|
|
334
|
+
clearableFocus: {
|
|
335
|
+
readonly type: BooleanConstructor;
|
|
336
|
+
readonly default: true;
|
|
337
|
+
};
|
|
324
338
|
inputmode: import("element-plus/es/utils/index.js").EpPropFinalized<(new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined) | ((new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined))[], unknown, unknown, undefined, boolean>;
|
|
325
339
|
name: StringConstructor;
|
|
326
340
|
ariaLabel: StringConstructor;
|
|
@@ -445,6 +459,7 @@ export declare const EpInput: {
|
|
|
445
459
|
nonzero: boolean;
|
|
446
460
|
placeholder: string;
|
|
447
461
|
thousand: boolean;
|
|
462
|
+
clearableFocus: boolean;
|
|
448
463
|
inputmode: import("element-plus/es/utils/index.js").EpPropMergeType<(new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined) | ((new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined))[], unknown, unknown>;
|
|
449
464
|
modelModifiers: import("element-plus").InputModelModifiers;
|
|
450
465
|
autosize: import("element-plus").InputAutoSize;
|
|
@@ -16,6 +16,10 @@ export declare const inputProps: {
|
|
|
16
16
|
readonly default: true;
|
|
17
17
|
readonly prototype: Boolean;
|
|
18
18
|
};
|
|
19
|
+
readonly clearableFocus: {
|
|
20
|
+
readonly type: BooleanConstructor;
|
|
21
|
+
readonly default: true;
|
|
22
|
+
};
|
|
19
23
|
readonly inputmode: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined) | ((new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined))[], unknown, unknown, undefined, boolean>;
|
|
20
24
|
readonly name: StringConstructor;
|
|
21
25
|
readonly ariaLabel: StringConstructor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sources":["../../../../../../packages/components/input/src/input.ts"],"sourcesContent":["import type { ExtractPropTypes } from 'vue'\nimport {\n inputProps as elInputProps,\n inputEmits as elInputEmits,\n} from 'element-plus'\nimport { useLocale } from '@el-plus/hooks/use-locale'\nconst { t } = useLocale()\n\nexport const inputProps = {\n ...elInputProps,\n max: Number,\n min: Number,\n radix: Number,\n nonzero: Boolean,\n placeholder: {\n type: String,\n default: () => {\n return t('ep.input.placeholder')\n },\n },\n thousand: {\n type: Boolean,\n default: true,\n },\n clearable: {\n ...elInputProps.clearable,\n default: true,\n },\n} as const\nexport type InputProps = ExtractPropTypes<typeof inputProps>\nexport const inputEmits = {\n ...elInputEmits,\n click: (evt: MouseEvent) => evt instanceof MouseEvent,\n}\nexport type InputEmits = typeof inputEmits\nexport const inputEmitsKeys = Object.keys(inputEmits)\n\n// max: Number,\n// min: Number,\n// nonzero: Boolean,\n// format: Function,\n// radix: {\n// type: [String, Number],\n// default: 5,\n// },\n// thousand: {\n// type: Boolean,\n// default: false,\n// },\n"],"names":["useLocale","elInputProps","elInputEmits"],"mappings":";;;;;AAMA,MAAM,EAAE,CAAA,EAAE,GAAIA,mBAAA,EAAU;AAEjB,MAAM,UAAA,GAAa;AAAA,EACxB,GAAGC,sBAAA;AAAA,EACH,GAAA,EAAK,MAAA;AAAA,EACL,GAAA,EAAK,MAAA;AAAA,EACL,KAAA,EAAO,MAAA;AAAA,EACP,OAAA,EAAS,OAAA;AAAA,EACT,WAAA,EAAa;AAAA,IACX,IAAA,EAAM,MAAA;AAAA,IACN,SAAS,MAAM;AACb,MAAA,OAAO,EAAE,sBAAsB,CAAA;AAAA,IACjC;AAAA,GACF;AAAA,EACA,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,OAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA,EACA,SAAA,EAAW;AAAA,IACT,GAAGA,sBAAA,CAAa,SAAA;AAAA,IAChB,OAAA,EAAS;AAAA;AAEb;AAEO,MAAM,UAAA,GAAa;AAAA,EACxB,GAAGC,sBAAA;AAAA,EACH,KAAA,EAAO,CAAC,GAAA,KAAoB,GAAA,YAAe;AAC7C;AAEO,MAAM,cAAA,GAAiB,MAAA,CAAO,IAAA,CAAK,UAAU;;;;;;"}
|
|
1
|
+
{"version":3,"file":"input.js","sources":["../../../../../../packages/components/input/src/input.ts"],"sourcesContent":["import type { ExtractPropTypes } from 'vue'\nimport {\n inputProps as elInputProps,\n inputEmits as elInputEmits,\n} from 'element-plus'\nimport { useLocale } from '@el-plus/hooks/use-locale'\nconst { t } = useLocale()\n\nexport const inputProps = {\n ...elInputProps,\n max: Number,\n min: Number,\n radix: Number,\n nonzero: Boolean,\n placeholder: {\n type: String,\n default: () => {\n return t('ep.input.placeholder')\n },\n },\n thousand: {\n type: Boolean,\n default: true,\n },\n clearable: {\n ...elInputProps.clearable,\n default: true,\n },\n clearableFocus: {\n type: Boolean,\n default: true,\n },\n} as const\nexport type InputProps = ExtractPropTypes<typeof inputProps>\nexport const inputEmits = {\n ...elInputEmits,\n click: (evt: MouseEvent) => evt instanceof MouseEvent,\n}\nexport type InputEmits = typeof inputEmits\nexport const inputEmitsKeys = Object.keys(inputEmits)\n\n// max: Number,\n// min: Number,\n// nonzero: Boolean,\n// format: Function,\n// radix: {\n// type: [String, Number],\n// default: 5,\n// },\n// thousand: {\n// type: Boolean,\n// default: false,\n// },\n"],"names":["useLocale","elInputProps","elInputEmits"],"mappings":";;;;;AAMA,MAAM,EAAE,CAAA,EAAE,GAAIA,mBAAA,EAAU;AAEjB,MAAM,UAAA,GAAa;AAAA,EACxB,GAAGC,sBAAA;AAAA,EACH,GAAA,EAAK,MAAA;AAAA,EACL,GAAA,EAAK,MAAA;AAAA,EACL,KAAA,EAAO,MAAA;AAAA,EACP,OAAA,EAAS,OAAA;AAAA,EACT,WAAA,EAAa;AAAA,IACX,IAAA,EAAM,MAAA;AAAA,IACN,SAAS,MAAM;AACb,MAAA,OAAO,EAAE,sBAAsB,CAAA;AAAA,IACjC;AAAA,GACF;AAAA,EACA,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,OAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA,EACA,SAAA,EAAW;AAAA,IACT,GAAGA,sBAAA,CAAa,SAAA;AAAA,IAChB,OAAA,EAAS;AAAA,GACX;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,IAAA,EAAM,OAAA;AAAA,IACN,OAAA,EAAS;AAAA;AAEb;AAEO,MAAM,UAAA,GAAa;AAAA,EACxB,GAAGC,sBAAA;AAAA,EACH,KAAA,EAAO,CAAC,GAAA,KAAoB,GAAA,YAAe;AAC7C;AAEO,MAAM,cAAA,GAAiB,MAAA,CAAO,IAAA,CAAK,UAAU;;;;;;"}
|
|
@@ -19,6 +19,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
19
19
|
readonly default: true;
|
|
20
20
|
readonly prototype: Boolean;
|
|
21
21
|
};
|
|
22
|
+
clearableFocus: {
|
|
23
|
+
readonly type: BooleanConstructor;
|
|
24
|
+
readonly default: true;
|
|
25
|
+
};
|
|
22
26
|
inputmode: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined) | ((new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined))[], unknown, unknown, undefined, boolean>;
|
|
23
27
|
name: StringConstructor;
|
|
24
28
|
ariaLabel: StringConstructor;
|
|
@@ -136,6 +140,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
136
140
|
readonly default: true;
|
|
137
141
|
readonly prototype: Boolean;
|
|
138
142
|
};
|
|
143
|
+
clearableFocus: {
|
|
144
|
+
readonly type: BooleanConstructor;
|
|
145
|
+
readonly default: true;
|
|
146
|
+
};
|
|
139
147
|
inputmode: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined) | ((new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined))[], unknown, unknown, undefined, boolean>;
|
|
140
148
|
name: StringConstructor;
|
|
141
149
|
ariaLabel: StringConstructor;
|
|
@@ -246,6 +254,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
246
254
|
nonzero: boolean;
|
|
247
255
|
placeholder: string;
|
|
248
256
|
thousand: boolean;
|
|
257
|
+
clearableFocus: boolean;
|
|
249
258
|
inputmode: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined) | ((new (...args: any[]) => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal") | (() => "search" | "text" | "none" | "url" | "email" | "tel" | "numeric" | "decimal" | undefined))[], unknown, unknown>;
|
|
250
259
|
modelModifiers: import("element-plus").InputModelModifiers;
|
|
251
260
|
autosize: import("element-plus").InputAutoSize;
|
|
@@ -32,6 +32,14 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
32
32
|
...props.prepareProps(props$1, ["modelValue"]),
|
|
33
33
|
...props.prepareEvents(emit, input.inputEmitsKeys),
|
|
34
34
|
placeholder: props$1.disabled ? "" : props$1.placeholder,
|
|
35
|
+
onClear: () => {
|
|
36
|
+
emit("clear");
|
|
37
|
+
if (!props$1.clearableFocus) {
|
|
38
|
+
vue.nextTick(() => {
|
|
39
|
+
inputRef.value?.blur?.();
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
},
|
|
35
43
|
onFocus: (e) => {
|
|
36
44
|
isFocusing = true;
|
|
37
45
|
if (props$1.thousand) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.vue2.js","sources":["../../../../../../packages/components/input/src/input.vue"],"sourcesContent":["<template>\n <el-input\n ref=\"inputRef\"\n v-model=\"value\"\n :class=\"`${bem.b()} ${prepareClassNames()}`\"\n :style=\"{\n ...prepareStyles(),\n }\"\n v-bind=\"customAttrs\"\n :type=\"type === 'number' ? 'text' : type\"\n >\n <template v-for=\"name in slots\" #[name]=\"scope\">\n <slot :name=\"name\" v-bind=\"scope\" />\n </template>\n </el-input>\n</template>\n<script setup lang=\"ts\">\nimport { computed, useSlots, watch, ref, nextTick} from 'vue'\nimport { createNameSpace } from '@el-plus/utils/bem'\nimport { inputProps, inputEmits, inputEmitsKeys } from './input'\nimport type { InputProps, InputEmits } from './input'\nimport {\n prepareProps,\n prepareEvents,\n prepareClassNames,\n prepareStyles,\n} from '@el-plus/utils/props'\ndefineOptions({\n name: 'EpInput',\n inheritAttrs: false,\n})\nconst bem = createNameSpace('input')\nconst props = defineProps(inputProps)\nconst emit = defineEmits(inputEmits)\nconst slots = computed(() => {\n return Object.keys(useSlots())\n})\nlet isBluring = false\nlet isFocusing = false\nconst customAttrs = computed(() => {\n return {\n ...prepareProps(props, ['modelValue']),\n ...prepareEvents<InputEmits>(emit, inputEmitsKeys),\n placeholder: props.disabled ? '' : props.placeholder,\n onFocus: (e: FocusEvent) => {\n isFocusing = true\n if (props.thousand) {\n ;(e.target as HTMLInputElement).value = value.value\n ? String(value.value)\n : ''\n }\n emit('focus', e)\n },\n onBlur: (e: FocusEvent) => {\n if (props.type === 'number') {\n let val = value.value as string\n if (props.nonzero && +val === 0) {\n val = ''\n }\n if (val && val[val.length - 1] === '.') {\n val = String(val).slice(0, -1)\n }\n\n if (val && val === '-') {\n val = ''\n }\n value.value = val ? +val : val\n ;(e.target as HTMLInputElement).value =value.value? toThousand(value.value):''\n }\n isBluring = true\n isFocusing = false\n emit('blur', e)\n },\n }\n})\nconst value = defineModel<InputProps['modelValue']>()\nconst inputRef = ref()\nconst toThousand = (val: string | number) => {\n if (props.thousand) {\n return val ? window.hx.thousand(val) : val\n }\n return val\n}\nwatch(\n () => value.value,\n (val) => {\n if (props.type === 'number' && !isFocusing) {\n nextTick(() => {\n inputRef.value.input.value = val?toThousand(val as number):''\n })\n }\n if (isBluring) {\n isBluring = false\n return\n }\n if (!isFocusing) {\n return\n }\n if (props.type === 'number') {\n if (typeof val === 'number') {\n val = '' + val\n }\n if (typeof val === 'string') {\n // 校验一次是否0+数字开头,这种情况直接把0去除\n const zeroReg = new RegExp('^[-+]?0[0-9]\\\\d*')\n if (zeroReg.test(val)) {\n val = val.replace('0', '')\n }\n const reg = new RegExp('^([-+])?\\\\d*(\\\\.?\\\\d*)', 'g')\n val = val.match(reg) ? val.match(reg)![0] : ''\n\n // 限制小数位数\n if (props.radix || props.radix === 0) {\n const reg =\n props.radix === 0\n ? new RegExp('^([-+])?\\\\d*', 'g')\n : new RegExp(`^([-+])?\\\\d*(\\\\.?\\\\d{0,${props.radix}})`, 'g')\n val = val.match(reg) ? val.match(reg)![0] : ''\n }\n if ((props.max || props.max === 0) && +val > props.max) {\n val = props.max\n }\n // 最大最小值\n if (\n (props.min || props.min === 0) &&\n (val || val === 0) &&\n +val < props.min\n ) {\n val = props.min\n }\n }\n } else if (props.type === 'text') {\n val = (val as string).trim()\n }\n value.value = val\n },\n {\n immediate: true,\n },\n)\n</script>\n"],"names":["bem","createNameSpace","props","computed","useSlots","prepareProps","prepareEvents","inputEmitsKeys","_useModel","ref","watch","
|
|
1
|
+
{"version":3,"file":"input.vue2.js","sources":["../../../../../../packages/components/input/src/input.vue"],"sourcesContent":["<template>\n <el-input\n ref=\"inputRef\"\n v-model=\"value\"\n :class=\"`${bem.b()} ${prepareClassNames()}`\"\n :style=\"{\n ...prepareStyles(),\n }\"\n v-bind=\"customAttrs\"\n :type=\"type === 'number' ? 'text' : type\"\n >\n <template v-for=\"name in slots\" #[name]=\"scope\">\n <slot :name=\"name\" v-bind=\"scope\" />\n </template>\n </el-input>\n</template>\n<script setup lang=\"ts\">\nimport { computed, useSlots, watch, ref, nextTick} from 'vue'\nimport { createNameSpace } from '@el-plus/utils/bem'\nimport { inputProps, inputEmits, inputEmitsKeys } from './input'\nimport type { InputProps, InputEmits } from './input'\nimport {\n prepareProps,\n prepareEvents,\n prepareClassNames,\n prepareStyles,\n} from '@el-plus/utils/props'\ndefineOptions({\n name: 'EpInput',\n inheritAttrs: false,\n})\nconst bem = createNameSpace('input')\nconst props = defineProps(inputProps)\nconst emit = defineEmits(inputEmits)\nconst slots = computed(() => {\n return Object.keys(useSlots())\n})\nlet isBluring = false\nlet isFocusing = false\nconst customAttrs = computed(() => {\n return {\n ...prepareProps(props, ['modelValue']),\n ...prepareEvents<InputEmits>(emit, inputEmitsKeys),\n placeholder: props.disabled ? '' : props.placeholder,\n onClear: () => {\n emit('clear')\n if (!props.clearableFocus) {\n nextTick(() => {\n inputRef.value?.blur?.()\n })\n }\n },\n onFocus: (e: FocusEvent) => {\n isFocusing = true\n if (props.thousand) {\n ;(e.target as HTMLInputElement).value = value.value\n ? String(value.value)\n : ''\n }\n emit('focus', e)\n },\n onBlur: (e: FocusEvent) => {\n if (props.type === 'number') {\n let val = value.value as string\n if (props.nonzero && +val === 0) {\n val = ''\n }\n if (val && val[val.length - 1] === '.') {\n val = String(val).slice(0, -1)\n }\n\n if (val && val === '-') {\n val = ''\n }\n value.value = val ? +val : val\n ;(e.target as HTMLInputElement).value =value.value? toThousand(value.value):''\n }\n isBluring = true\n isFocusing = false\n emit('blur', e)\n },\n }\n})\nconst value = defineModel<InputProps['modelValue']>()\nconst inputRef = ref()\nconst toThousand = (val: string | number) => {\n if (props.thousand) {\n return val ? window.hx.thousand(val) : val\n }\n return val\n}\nwatch(\n () => value.value,\n (val) => {\n if (props.type === 'number' && !isFocusing) {\n nextTick(() => {\n inputRef.value.input.value = val?toThousand(val as number):''\n })\n }\n if (isBluring) {\n isBluring = false\n return\n }\n if (!isFocusing) {\n return\n }\n if (props.type === 'number') {\n if (typeof val === 'number') {\n val = '' + val\n }\n if (typeof val === 'string') {\n // 校验一次是否0+数字开头,这种情况直接把0去除\n const zeroReg = new RegExp('^[-+]?0[0-9]\\\\d*')\n if (zeroReg.test(val)) {\n val = val.replace('0', '')\n }\n const reg = new RegExp('^([-+])?\\\\d*(\\\\.?\\\\d*)', 'g')\n val = val.match(reg) ? val.match(reg)![0] : ''\n\n // 限制小数位数\n if (props.radix || props.radix === 0) {\n const reg =\n props.radix === 0\n ? new RegExp('^([-+])?\\\\d*', 'g')\n : new RegExp(`^([-+])?\\\\d*(\\\\.?\\\\d{0,${props.radix}})`, 'g')\n val = val.match(reg) ? val.match(reg)![0] : ''\n }\n if ((props.max || props.max === 0) && +val > props.max) {\n val = props.max\n }\n // 最大最小值\n if (\n (props.min || props.min === 0) &&\n (val || val === 0) &&\n +val < props.min\n ) {\n val = props.min\n }\n }\n } else if (props.type === 'text') {\n val = (val as string).trim()\n }\n value.value = val\n },\n {\n immediate: true,\n },\n)\n</script>\n"],"names":["bem","createNameSpace","props","computed","useSlots","prepareProps","prepareEvents","inputEmitsKeys","nextTick","_useModel","ref","watch","reg","_openBlock","_createBlock","_mergeProps","_unref","prepareClassNames","prepareStyles","type","_renderList","_withCtx","_renderSlot","_normalizeProps","_guardReactiveProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA+BA,IAAA,MAAMA,KAAA,GAAMC,oBAAgB,OAAO,CAAA;AACnC,IAAA,MAAMC,OAAA,GAAQ,OAAA;AACd,IAAA,MAAM,IAAA,GAAO,MAAA;AACb,IAAA,MAAM,KAAA,GAAQC,aAAS,MAAM;AAC3B,MAAA,OAAO,MAAA,CAAO,IAAA,CAAKC,YAAA,EAAU,CAAA;AAAA,IAC/B,CAAC,CAAA;AACD,IAAA,IAAI,SAAA,GAAY,KAAA;AAChB,IAAA,IAAI,UAAA,GAAa,KAAA;AACjB,IAAA,MAAM,WAAA,GAAcD,aAAS,MAAM;AACjC,MAAA,OAAO;AAAA,QACL,GAAGE,kBAAA,CAAaH,OAAA,EAAO,CAAC,YAAY,CAAC,CAAA;AAAA,QACrC,GAAGI,mBAAA,CAA0B,IAAA,EAAMC,oBAAc,CAAA;AAAA,QACjD,WAAA,EAAaL,OAAA,CAAM,QAAA,GAAW,EAAA,GAAKA,OAAA,CAAM,WAAA;AAAA,QACzC,SAAS,MAAM;AACb,UAAA,IAAA,CAAK,OAAO,CAAA;AACZ,UAAA,IAAI,CAACA,QAAM,cAAA,EAAgB;AACzB,YAAAM,YAAA,CAAS,MAAM;AACb,cAAA,QAAA,CAAS,OAAO,IAAA,IAAO;AAAA,YACzB,CAAC,CAAA;AAAA,UACH;AAAA,QACF,CAAA;AAAA,QACA,OAAA,EAAS,CAAC,CAAA,KAAkB;AAC1B,UAAA,UAAA,GAAa,IAAA;AACb,UAA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