@skyfox2000/webui 1.5.14 → 1.5.16
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/lib/assets/modules/{baseLayout-Cgz2GD9U.js → baseLayout-BTMzpIiV.js} +3 -3
- package/lib/assets/modules/{file-upload-BlYrF7tq.js → file-upload-d6wJYD_r.js} +1 -1
- package/lib/assets/modules/{index-iyoc8G6M.js → index-BhXS0TjD.js} +1 -1
- package/lib/assets/modules/{index-DWfUKv6h.js → index-BsaUh4V0.js} +2 -2
- package/lib/assets/modules/{index-DF1aIGJh.js → index-CxB0AuVY.js} +2 -2
- package/lib/assets/modules/{menuTabs-DoseEHrE.js → menuTabs-DZNVE3eg.js} +2 -2
- package/lib/assets/modules/{toolIcon-CNuVTW1z.js → toolIcon-B8bR-dPF.js} +1 -1
- package/lib/assets/modules/{upload-template-BepTTCSN.js → upload-template-CiWosjbL.js} +2 -2
- package/lib/assets/modules/{uploadList-DGdEHRgF.js → uploadList-DHmkR_yd.js} +4 -4
- package/lib/components/form/input/index.vue.d.ts +4 -0
- package/lib/es/AceEditor/index.js +3 -3
- package/lib/es/BasicLayout/index.js +2 -2
- package/lib/es/Error403/index.js +1 -1
- package/lib/es/Error404/index.js +1 -1
- package/lib/es/ExcelForm/index.js +4 -4
- package/lib/es/MenuLayout/index.js +2 -2
- package/lib/es/TemplateFile/index.js +4 -4
- package/lib/es/UploadForm/index.js +4 -4
- package/lib/webui.css +1 -1
- package/lib/webui.es.js +678 -675
- package/package.json +1 -1
- package/src/components/form/input/index.vue +22 -20
- package/src/utils/page.ts +2 -2
package/package.json
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { formValidate, useInputFactory } from '@/index';
|
|
3
3
|
import { Input } from 'ant-design-vue';
|
|
4
|
-
import { ref, watch } from 'vue';
|
|
4
|
+
import { ref, watch, computed, useAttrs } from 'vue';
|
|
5
5
|
import { useI18n } from 'vue-i18n';
|
|
6
6
|
const { t } = useI18n();
|
|
7
7
|
|
|
8
8
|
const { editorCtrl, labelText, errInfo } = useInputFactory();
|
|
9
|
-
const onBlur = () => {
|
|
10
|
-
if (errInfo?.value.errClass && editorCtrl) {
|
|
11
|
-
/// 重新开始验证
|
|
12
|
-
formValidate(editorCtrl);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
|
|
16
9
|
const props = withDefaults(defineProps<{
|
|
17
10
|
value?: any;
|
|
18
11
|
/**
|
|
@@ -29,7 +22,22 @@ const props = withDefaults(defineProps<{
|
|
|
29
22
|
|
|
30
23
|
// 如果初始value为undefined,自动设置undefValue为true
|
|
31
24
|
const undefValue = props.value === undefined ? true : props.undefValue;
|
|
32
|
-
const emit = defineEmits(['update:value']);
|
|
25
|
+
const emit = defineEmits(['update:value', 'blur', 'change']);
|
|
26
|
+
|
|
27
|
+
// 过滤已配置的事件处理器
|
|
28
|
+
const filteredAttrs = computed(() => {
|
|
29
|
+
const { onBlur, onChange, ...rest } = useAttrs();
|
|
30
|
+
return rest;
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const onBlur = (e: any) => {
|
|
34
|
+
if (errInfo?.value.errClass && editorCtrl) {
|
|
35
|
+
/// 重新开始验证
|
|
36
|
+
formValidate(editorCtrl);
|
|
37
|
+
}
|
|
38
|
+
emit('blur', e)
|
|
39
|
+
};
|
|
40
|
+
|
|
33
41
|
// 内部值,拦截外部传入的 value
|
|
34
42
|
const innerValue = ref(props.value);
|
|
35
43
|
|
|
@@ -53,10 +61,12 @@ watch(
|
|
|
53
61
|
},
|
|
54
62
|
);
|
|
55
63
|
|
|
56
|
-
const onClear = () => {
|
|
64
|
+
const onClear = (e: any) => {
|
|
57
65
|
if (innerValue.value === '') {
|
|
58
66
|
innerValue.value = undefValue ? undefined : null;
|
|
59
67
|
}
|
|
68
|
+
|
|
69
|
+
emit('change', e)
|
|
60
70
|
};
|
|
61
71
|
</script>
|
|
62
72
|
<template>
|
|
@@ -65,16 +75,8 @@ const onClear = () => {
|
|
|
65
75
|
errInfo?.errClass,
|
|
66
76
|
errInfo?.errClass === 'error' && !$slots.addonBefore && !$slots.addonAfter
|
|
67
77
|
? '!border-red-300 shadow-[0_0_3px_0px_#ff4d4f]'
|
|
68
|
-
|
|
69
|
-
]"
|
|
70
|
-
v-model:value="innerValue"
|
|
71
|
-
autocomplete="new-password"
|
|
72
|
-
:allow-clear="true"
|
|
73
|
-
:placeholder="t('webui.common.placeholder', [labelText])"
|
|
74
|
-
@blur="onBlur"
|
|
75
|
-
@change="onClear"
|
|
76
|
-
v-bind="$attrs"
|
|
77
|
-
>
|
|
78
|
+
: '',]" v-model:value="innerValue" autocomplete="new-password" :allow-clear="true"
|
|
79
|
+
:placeholder="t('webui.common.placeholder', [labelText])" @blur="onBlur" @change="onClear" v-bind="filteredAttrs">
|
|
78
80
|
<template #addonBefore v-if="$slots.addonBefore">
|
|
79
81
|
<slot name="addonBefore"></slot>
|
|
80
82
|
</template>
|
package/src/utils/page.ts
CHANGED
|
@@ -246,10 +246,10 @@ export const useOptionFactory = (url?: IUrlInfo, props?: OptionProps) => {
|
|
|
246
246
|
url: url,
|
|
247
247
|
reload: ref(false),
|
|
248
248
|
optionQuery: {},
|
|
249
|
-
data: shallowRef([]),
|
|
249
|
+
data: shallowRef(props?.data ?? []),
|
|
250
250
|
selected: ref([]),
|
|
251
251
|
selectedOptions: ref([]),
|
|
252
|
-
options: ref([]),
|
|
252
|
+
options: ref(props?.data ?? []),
|
|
253
253
|
isOptionLoading: ref(false),
|
|
254
254
|
};
|
|
255
255
|
|