el-plus 0.0.102 → 0.0.103
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.css +1 -1
- package/dist/index.full.js +23 -17
- package/dist/index.full.min.js +4 -4
- 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 +24 -18
- package/es/components/custom-column/index.d.ts +12 -12
- package/es/components/custom-column/src/custom-column.d.ts +2 -2
- package/es/components/custom-column/src/custom-column.vue.d.ts +6 -6
- package/es/components/form/src/form.vue2.mjs +1 -1
- package/es/components/input/src/input.vue2.mjs +4 -4
- package/es/components/input/src/input.vue2.mjs.map +1 -1
- package/es/components/search-list-page/index.d.ts +84 -84
- package/es/components/search-list-page/src/search-list-page.d.ts +5 -5
- package/es/components/search-list-page/src/search-list-page.vue.d.ts +33 -33
- package/es/components/search-list-page/src/search-list-page.vue2.mjs +7 -4
- package/es/components/search-list-page/src/search-list-page.vue2.mjs.map +1 -1
- package/es/components/search-list-page/src/use-search-list-page.d.ts +26 -26
- package/es/components/search-list-page/src/use-search-list-page.mjs +11 -7
- package/es/components/search-list-page/src/use-search-list-page.mjs.map +1 -1
- package/es/components/select/index.d.ts +9 -9
- package/es/components/select/src/select.d.ts +3 -3
- package/es/components/select/src/select.vue.d.ts +6 -6
- package/es/components/table/index.d.ts +21 -21
- package/es/components/table/src/table.d.ts +5 -5
- package/es/components/table/src/table.vue.d.ts +12 -12
- package/es/components/table/src/table.vue2.mjs +1 -1
- package/es/hooks/dialog/use-dialog.mjs +0 -1
- package/es/hooks/dialog/use-dialog.mjs.map +1 -1
- package/es/hooks/use-request.d.ts +1 -1
- package/es/hooks/use-request.mjs.map +1 -1
- package/es/package.json.mjs +1 -1
- package/es/types/index.d.ts +0 -1
- package/es/utils/http/core/types.d.ts +6 -1
- package/es/utils/props.d.ts +1 -1
- package/es/utils/props.mjs.map +1 -1
- package/lib/components/custom-column/index.d.ts +12 -12
- package/lib/components/custom-column/src/custom-column.d.ts +2 -2
- package/lib/components/custom-column/src/custom-column.vue.d.ts +6 -6
- package/lib/components/input/src/input.vue2.js +3 -3
- package/lib/components/input/src/input.vue2.js.map +1 -1
- package/lib/components/search-list-page/index.d.ts +84 -84
- package/lib/components/search-list-page/src/search-list-page.d.ts +5 -5
- package/lib/components/search-list-page/src/search-list-page.vue.d.ts +33 -33
- package/lib/components/search-list-page/src/search-list-page.vue2.js +7 -4
- package/lib/components/search-list-page/src/search-list-page.vue2.js.map +1 -1
- package/lib/components/search-list-page/src/use-search-list-page.d.ts +26 -26
- package/lib/components/search-list-page/src/use-search-list-page.js +11 -7
- package/lib/components/search-list-page/src/use-search-list-page.js.map +1 -1
- package/lib/components/select/index.d.ts +9 -9
- package/lib/components/select/src/select.d.ts +3 -3
- package/lib/components/select/src/select.vue.d.ts +6 -6
- package/lib/components/table/index.d.ts +21 -21
- package/lib/components/table/src/table.d.ts +5 -5
- package/lib/components/table/src/table.vue.d.ts +12 -12
- package/lib/hooks/dialog/use-dialog.js +0 -1
- package/lib/hooks/dialog/use-dialog.js.map +1 -1
- package/lib/hooks/use-request.d.ts +1 -1
- package/lib/hooks/use-request.js.map +1 -1
- package/lib/package.json.js +1 -1
- package/lib/types/index.d.ts +0 -1
- package/lib/utils/http/core/types.d.ts +6 -1
- package/lib/utils/props.d.ts +1 -1
- package/lib/utils/props.js.map +1 -1
- package/package.json +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/search-list-page.css +1 -1
- package/theme-chalk/src/index.scss +1 -0
- package/theme-chalk/src/search-list-page.scss +1 -1
- package/theme-chalk/src/tabs.scss +56 -0
- package/theme-chalk/tabs.css +1 -0
- package/es/types/axios.d.ts +0 -13
- package/lib/types/axios.d.ts +0 -13
package/dist/index.full.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! ElPlus v0.0.
|
|
1
|
+
/*! ElPlus v0.0.103 */
|
|
2
2
|
|
|
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,
|
|
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';
|
|
5
5
|
import { isFunction } from '@vue/shared';
|
|
6
6
|
import axios from 'axios';
|
|
@@ -1195,7 +1195,7 @@ var _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
1195
1195
|
val = "";
|
|
1196
1196
|
}
|
|
1197
1197
|
value.value = val ? +val : val;
|
|
1198
|
-
e.target.value = toThousand(value.value);
|
|
1198
|
+
e.target.value = value.value ? toThousand(value.value) : "";
|
|
1199
1199
|
}
|
|
1200
1200
|
isBluring = true;
|
|
1201
1201
|
isFocusing = false;
|
|
@@ -1215,8 +1215,8 @@ var _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
1215
1215
|
() => value.value,
|
|
1216
1216
|
(val) => {
|
|
1217
1217
|
if (props.type === "number") {
|
|
1218
|
-
|
|
1219
|
-
inputRef.value.input.value = toThousand(val);
|
|
1218
|
+
nextTick(() => {
|
|
1219
|
+
inputRef.value.input.value = val ? toThousand(val) : "";
|
|
1220
1220
|
});
|
|
1221
1221
|
}
|
|
1222
1222
|
if (isBluring) {
|
|
@@ -1426,7 +1426,6 @@ const useDialog = (options = {}) => {
|
|
|
1426
1426
|
}), scopedSlots.footerInner?.(promiseOptions), createVNode(ElButton, {
|
|
1427
1427
|
"type": "primary",
|
|
1428
1428
|
"onClick": async () => {
|
|
1429
|
-
console.log(111);
|
|
1430
1429
|
if (onBeforeConfirm) {
|
|
1431
1430
|
await onBeforeConfirm(resolve);
|
|
1432
1431
|
}
|
|
@@ -2662,7 +2661,9 @@ const getAvailableHeight = (el) => {
|
|
|
2662
2661
|
};
|
|
2663
2662
|
const useSearchListPage = (props, config = {}) => {
|
|
2664
2663
|
const rootRef = useTemplateRef("rootRef");
|
|
2665
|
-
const
|
|
2664
|
+
const topRef = useTemplateRef("topRef");
|
|
2665
|
+
const middleRef = useTemplateRef("middleRef");
|
|
2666
|
+
const { calcTableHeight, tableProps, tableRef } = useTable(props, config, rootRef, topRef, middleRef);
|
|
2666
2667
|
const { formProps, validate, resetFields, formRef } = useForm(props, {
|
|
2667
2668
|
calcTableHeight
|
|
2668
2669
|
});
|
|
@@ -2688,7 +2689,7 @@ const useSearchListPage = (props, config = {}) => {
|
|
|
2688
2689
|
}
|
|
2689
2690
|
};
|
|
2690
2691
|
};
|
|
2691
|
-
const useTable = (props, config, rootRef) => {
|
|
2692
|
+
const useTable = (props, config, rootRef, topRef, middleRef) => {
|
|
2692
2693
|
const instanceName = "tableRef";
|
|
2693
2694
|
const tableRef = useTemplateRef(instanceName);
|
|
2694
2695
|
const tableHeight = ref(0);
|
|
@@ -2717,14 +2718,15 @@ const useTable = (props, config, rootRef) => {
|
|
|
2717
2718
|
});
|
|
2718
2719
|
const calcTableHeight = () => {
|
|
2719
2720
|
setTimeout(() => {
|
|
2720
|
-
const topHeight =
|
|
2721
|
-
const middleHeight =
|
|
2721
|
+
const topHeight = topRef.value?.offsetHeight ?? 0;
|
|
2722
|
+
const middleHeight = middleRef.value?.offsetHeight ?? 0;
|
|
2722
2723
|
let paginationHeight = 0;
|
|
2723
2724
|
if (tableProps.value.showPagination) {
|
|
2724
|
-
|
|
2725
|
+
const paginationEl = rootRef.value?.querySelector(".el-pagination");
|
|
2726
|
+
paginationHeight = paginationEl ? paginationEl.offsetHeight + 12 : 0;
|
|
2725
2727
|
}
|
|
2726
2728
|
const containerHeight = rootRef.value ? getAvailableHeight(rootRef.value) : window.innerHeight;
|
|
2727
|
-
tableHeight.value = containerHeight - topHeight - middleHeight - paginationHeight -
|
|
2729
|
+
tableHeight.value = containerHeight - topHeight - middleHeight - paginationHeight - props.offsetTop;
|
|
2728
2730
|
}, 0);
|
|
2729
2731
|
};
|
|
2730
2732
|
onMounted(calcTableHeight);
|
|
@@ -2774,8 +2776,9 @@ const useButtons$1 = (props, { validate, resetFields, tableRef }) => {
|
|
|
2774
2776
|
prop: "add",
|
|
2775
2777
|
permission: props.name ? `${props.name}:ADD` : "",
|
|
2776
2778
|
show: () => {
|
|
2777
|
-
return !!props.add;
|
|
2779
|
+
return !!props.add || !!props.leftButtons?.some((item) => item.prop === "add");
|
|
2778
2780
|
},
|
|
2781
|
+
type: "primary",
|
|
2779
2782
|
onClick: () => {
|
|
2780
2783
|
props.add?.();
|
|
2781
2784
|
}
|
|
@@ -2893,10 +2896,13 @@ var _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
2893
2896
|
...unref(prepareStyles)()
|
|
2894
2897
|
})
|
|
2895
2898
|
}, [
|
|
2896
|
-
createElementVNode("div", {
|
|
2899
|
+
createElementVNode("div", { ref: "topRef" }, [
|
|
2897
2900
|
createVNode(unref(EpForm), normalizeProps(guardReactiveProps(unref(formProps))), null, 16)
|
|
2898
|
-
]),
|
|
2899
|
-
createElementVNode("div", {
|
|
2901
|
+
], 512),
|
|
2902
|
+
createElementVNode("div", {
|
|
2903
|
+
ref: "middleRef",
|
|
2904
|
+
class: normalizeClass(unref(bem).e("middle"))
|
|
2905
|
+
}, [
|
|
2900
2906
|
createElementVNode("div", {
|
|
2901
2907
|
class: normalizeClass(unref(bem).e("middle-left"))
|
|
2902
2908
|
}, [
|
|
@@ -2907,7 +2913,7 @@ var _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
2907
2913
|
}, [
|
|
2908
2914
|
createVNode(unref(EpButtons), { list: unref(searchButtons) }, null, 8, ["list"])
|
|
2909
2915
|
], 2)
|
|
2910
|
-
]),
|
|
2916
|
+
], 2),
|
|
2911
2917
|
renderSlot(_ctx.$slots, "tableBefore"),
|
|
2912
2918
|
createVNode(unref(EpTable), mergeProps(unref(tableProps), { "before-search": unref(beforeSearch) }), null, 16, ["before-search"])
|
|
2913
2919
|
], 6);
|
|
@@ -4509,7 +4515,7 @@ var components = [
|
|
|
4509
4515
|
EpFooterInfo
|
|
4510
4516
|
];
|
|
4511
4517
|
|
|
4512
|
-
var version = "0.0.
|
|
4518
|
+
var version = "0.0.103";
|
|
4513
4519
|
|
|
4514
4520
|
var globalProperties = {
|
|
4515
4521
|
install(app) {
|
|
@@ -5,11 +5,11 @@ export declare const EpCustomColumn: {
|
|
|
5
5
|
};
|
|
6
6
|
readonly api: {
|
|
7
7
|
readonly default: "/api-item/api/customizedColumns/find";
|
|
8
|
-
readonly type: import("vue").PropType<import("el-plus/es/
|
|
8
|
+
readonly type: import("vue").PropType<import("el-plus/es/utils/index").Api>;
|
|
9
9
|
};
|
|
10
10
|
readonly saveApi: {
|
|
11
11
|
readonly default: "/api-item/api/customizedColumns/save";
|
|
12
|
-
readonly type: import("vue").PropType<import("el-plus/es/
|
|
12
|
+
readonly type: import("vue").PropType<import("el-plus/es/utils/index").Api>;
|
|
13
13
|
};
|
|
14
14
|
readonly showHandler: {
|
|
15
15
|
readonly type: BooleanConstructor;
|
|
@@ -24,8 +24,8 @@ export declare const EpCustomColumn: {
|
|
|
24
24
|
confirm: (data: import("element-plus").TransferDataItem[]) => void;
|
|
25
25
|
loaded: (data: import("element-plus").TransferDataItem[]) => void;
|
|
26
26
|
}, import("vue").PublicProps, {
|
|
27
|
-
readonly api: import("el-plus/es/
|
|
28
|
-
readonly saveApi: import("el-plus/es/
|
|
27
|
+
readonly api: import("el-plus/es/utils/index").Api;
|
|
28
|
+
readonly saveApi: import("el-plus/es/utils/index").Api;
|
|
29
29
|
readonly showHandler: boolean;
|
|
30
30
|
}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
31
31
|
P: {};
|
|
@@ -40,11 +40,11 @@ export declare const EpCustomColumn: {
|
|
|
40
40
|
};
|
|
41
41
|
readonly api: {
|
|
42
42
|
readonly default: "/api-item/api/customizedColumns/find";
|
|
43
|
-
readonly type: import("vue").PropType<import("el-plus/es/
|
|
43
|
+
readonly type: import("vue").PropType<import("el-plus/es/utils/index").Api>;
|
|
44
44
|
};
|
|
45
45
|
readonly saveApi: {
|
|
46
46
|
readonly default: "/api-item/api/customizedColumns/save";
|
|
47
|
-
readonly type: import("vue").PropType<import("el-plus/es/
|
|
47
|
+
readonly type: import("vue").PropType<import("el-plus/es/utils/index").Api>;
|
|
48
48
|
};
|
|
49
49
|
readonly showHandler: {
|
|
50
50
|
readonly type: BooleanConstructor;
|
|
@@ -56,8 +56,8 @@ export declare const EpCustomColumn: {
|
|
|
56
56
|
}>, {
|
|
57
57
|
open: () => Promise<void>;
|
|
58
58
|
}, {}, {}, {}, {
|
|
59
|
-
readonly api: import("el-plus/es/
|
|
60
|
-
readonly saveApi: import("el-plus/es/
|
|
59
|
+
readonly api: import("el-plus/es/utils/index").Api;
|
|
60
|
+
readonly saveApi: import("el-plus/es/utils/index").Api;
|
|
61
61
|
readonly showHandler: boolean;
|
|
62
62
|
}>;
|
|
63
63
|
__isFragment?: never;
|
|
@@ -69,11 +69,11 @@ export declare const EpCustomColumn: {
|
|
|
69
69
|
};
|
|
70
70
|
readonly api: {
|
|
71
71
|
readonly default: "/api-item/api/customizedColumns/find";
|
|
72
|
-
readonly type: import("vue").PropType<import("el-plus/es/
|
|
72
|
+
readonly type: import("vue").PropType<import("el-plus/es/utils/index").Api>;
|
|
73
73
|
};
|
|
74
74
|
readonly saveApi: {
|
|
75
75
|
readonly default: "/api-item/api/customizedColumns/save";
|
|
76
|
-
readonly type: import("vue").PropType<import("el-plus/es/
|
|
76
|
+
readonly type: import("vue").PropType<import("el-plus/es/utils/index").Api>;
|
|
77
77
|
};
|
|
78
78
|
readonly showHandler: {
|
|
79
79
|
readonly type: BooleanConstructor;
|
|
@@ -88,8 +88,8 @@ export declare const EpCustomColumn: {
|
|
|
88
88
|
confirm: (data: import("element-plus").TransferDataItem[]) => void;
|
|
89
89
|
loaded: (data: import("element-plus").TransferDataItem[]) => void;
|
|
90
90
|
}, string, {
|
|
91
|
-
readonly api: import("el-plus/es/
|
|
92
|
-
readonly saveApi: import("el-plus/es/
|
|
91
|
+
readonly api: import("el-plus/es/utils/index").Api;
|
|
92
|
+
readonly saveApi: import("el-plus/es/utils/index").Api;
|
|
93
93
|
readonly showHandler: boolean;
|
|
94
94
|
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & import("vue").Plugin;
|
|
95
95
|
export default EpCustomColumn;
|
|
@@ -6,11 +6,11 @@ export declare const customColumnProps: {
|
|
|
6
6
|
};
|
|
7
7
|
readonly api: {
|
|
8
8
|
readonly default: "/api-item/api/customizedColumns/find";
|
|
9
|
-
readonly type: PropType<import("el-plus/es/
|
|
9
|
+
readonly type: PropType<import("el-plus/es/utils").Api>;
|
|
10
10
|
};
|
|
11
11
|
readonly saveApi: {
|
|
12
12
|
readonly default: "/api-item/api/customizedColumns/save";
|
|
13
|
-
readonly type: PropType<import("el-plus/es/
|
|
13
|
+
readonly type: PropType<import("el-plus/es/utils").Api>;
|
|
14
14
|
};
|
|
15
15
|
readonly showHandler: {
|
|
16
16
|
readonly type: BooleanConstructor;
|
|
@@ -5,11 +5,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
5
5
|
};
|
|
6
6
|
readonly api: {
|
|
7
7
|
readonly default: "/api-item/api/customizedColumns/find";
|
|
8
|
-
readonly type: import("vue").PropType<import("el-plus/es/
|
|
8
|
+
readonly type: import("vue").PropType<import("el-plus/es/utils").Api>;
|
|
9
9
|
};
|
|
10
10
|
readonly saveApi: {
|
|
11
11
|
readonly default: "/api-item/api/customizedColumns/save";
|
|
12
|
-
readonly type: import("vue").PropType<import("el-plus/es/
|
|
12
|
+
readonly type: import("vue").PropType<import("el-plus/es/utils").Api>;
|
|
13
13
|
};
|
|
14
14
|
readonly showHandler: {
|
|
15
15
|
readonly type: BooleanConstructor;
|
|
@@ -26,11 +26,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
26
26
|
};
|
|
27
27
|
readonly api: {
|
|
28
28
|
readonly default: "/api-item/api/customizedColumns/find";
|
|
29
|
-
readonly type: import("vue").PropType<import("el-plus/es/
|
|
29
|
+
readonly type: import("vue").PropType<import("el-plus/es/utils").Api>;
|
|
30
30
|
};
|
|
31
31
|
readonly saveApi: {
|
|
32
32
|
readonly default: "/api-item/api/customizedColumns/save";
|
|
33
|
-
readonly type: import("vue").PropType<import("el-plus/es/
|
|
33
|
+
readonly type: import("vue").PropType<import("el-plus/es/utils").Api>;
|
|
34
34
|
};
|
|
35
35
|
readonly showHandler: {
|
|
36
36
|
readonly type: BooleanConstructor;
|
|
@@ -40,8 +40,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
40
40
|
onConfirm?: ((data: TransferDataItem[]) => any) | undefined;
|
|
41
41
|
onLoaded?: ((data: TransferDataItem[]) => any) | undefined;
|
|
42
42
|
}>, {
|
|
43
|
-
readonly api: import("el-plus/es/
|
|
44
|
-
readonly saveApi: import("el-plus/es/
|
|
43
|
+
readonly api: import("el-plus/es/utils").Api;
|
|
44
|
+
readonly saveApi: import("el-plus/es/utils").Api;
|
|
45
45
|
readonly showHandler: boolean;
|
|
46
46
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
47
47
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, mergeModels, computed, useModel, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, createVNode, createCommentVNode, mergeProps, withCtx, renderSlot, Fragment, renderList, withDirectives, createBlock, vShow, toDisplayString, reactive } from 'vue';
|
|
2
2
|
import { createNameSpace } from '../../../utils/bem.mjs';
|
|
3
|
-
import {
|
|
3
|
+
import { expandFormPropsKeys, formEmits, formProps, formEmitsKeys } from './form.mjs';
|
|
4
4
|
import { prepareEvents, prepareProps, prepareStyles, prepareClassNames } from '../../../utils/props.mjs';
|
|
5
5
|
import { ElForm, ElRow, ElCol } from 'element-plus';
|
|
6
6
|
import { useForm, useCollapse } from './hooks/use-form.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, mergeModels, computed, useSlots, useModel, ref, watch,
|
|
1
|
+
import { defineComponent, mergeModels, computed, useSlots, useModel, ref, watch, nextTick, 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';
|
|
@@ -48,7 +48,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
48
48
|
val = "";
|
|
49
49
|
}
|
|
50
50
|
value.value = val ? +val : val;
|
|
51
|
-
e.target.value = toThousand(value.value);
|
|
51
|
+
e.target.value = value.value ? toThousand(value.value) : "";
|
|
52
52
|
}
|
|
53
53
|
isBluring = true;
|
|
54
54
|
isFocusing = false;
|
|
@@ -68,8 +68,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
68
68
|
() => value.value,
|
|
69
69
|
(val) => {
|
|
70
70
|
if (props.type === "number") {
|
|
71
|
-
|
|
72
|
-
inputRef.value.input.value = toThousand(val);
|
|
71
|
+
nextTick(() => {
|
|
72
|
+
inputRef.value.input.value = val ? toThousand(val) : "";
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
if (isBluring) {
|
|
@@ -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,
|
|
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') {\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,OAAA,EA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