@jari-ace/element-plus-component 0.2.1 → 0.2.2
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/README.md +1 -1
- package/dist/components/form/JaForm.vue.d.ts +3 -0
- package/dist/components/form/JaForm.vue.d.ts.map +1 -1
- package/dist/components/form/JaForm.vue.js +22 -68
- package/dist/components/form/JaForm.vue.js.map +1 -1
- package/dist/components/formItem/JaFormItem.vue.d.ts +4 -0
- package/dist/components/formItem/JaFormItem.vue.d.ts.map +1 -1
- package/dist/components/formItem/JaFormItem.vue.js +26 -8
- package/dist/components/formItem/JaFormItem.vue.js.map +1 -1
- package/dist/components/userPicker/src/JaUserList.vue.d.ts.map +1 -1
- package/dist/components/userPicker/src/JaUserList.vue.js +41 -7
- package/dist/components/userPicker/src/JaUserList.vue.js.map +1 -1
- package/dist/components/userPicker/src/JaUserPicker.vue.d.ts +9 -2
- package/dist/components/userPicker/src/JaUserPicker.vue.d.ts.map +1 -1
- package/dist/components/userPicker/src/JaUserPicker.vue.js +7 -2
- package/dist/components/userPicker/src/JaUserPicker.vue.js.map +1 -1
- package/dist/components/userPicker/src/UserPicker.vue.d.ts +33 -112
- package/dist/components/userPicker/src/UserPicker.vue.d.ts.map +1 -1
- package/dist/components/userPicker/src/UserPicker.vue.js +262 -288
- package/dist/components/userPicker/src/UserPicker.vue.js.map +1 -1
- package/dist/utils/formUtils.d.ts +7 -0
- package/dist/utils/formUtils.d.ts.map +1 -0
- package/dist/utils/formUtils.js +54 -0
- package/dist/utils/formUtils.js.map +1 -0
- package/lib/index.css +1 -1
- package/lib/index.js +2069 -2033
- package/lib/index.umd.cjs +2 -2
- package/package.json +61 -61
- package/packages/components/autoComplete/JaAutoComplete.vue +47 -47
- package/packages/components/autoComplete/index.ts +5 -5
- package/packages/components/avatar/JaAvatar.vue +126 -126
- package/packages/components/avatar/avatarToken.ts +11 -11
- package/packages/components/avatar/defaultImg.ts +14 -14
- package/packages/components/avatar/index.ts +7 -7
- package/packages/components/button/JaButton.vue +51 -51
- package/packages/components/button/index.ts +4 -4
- package/packages/components/channelPicker/index.ts +7 -7
- package/packages/components/channelPicker/src/ChannelPicker.vue +43 -43
- package/packages/components/channelPicker/src/JaChannelPicker.vue +42 -42
- package/packages/components/checkbox/JaCheckbox.vue +73 -73
- package/packages/components/checkbox/index.ts +4 -4
- package/packages/components/checkboxGroup/JaCheckboxGroup.vue +45 -45
- package/packages/components/checkboxGroup/index.ts +4 -4
- package/packages/components/customGroupTree/index.ts +10 -10
- package/packages/components/customGroupTree/src/customGroupTree.vue +91 -91
- package/packages/components/datePicker/JaDatePicker.vue +52 -52
- package/packages/components/datePicker/index.ts +4 -4
- package/packages/components/departmentPicker/index.ts +4 -4
- package/packages/components/departmentPicker/src/DepartmentPicker.vue +107 -107
- package/packages/components/departmentPicker/src/consts.ts +2 -2
- package/packages/components/departmentTree/index.ts +10 -10
- package/packages/components/departmentTree/src/departmentTree.vue +135 -135
- package/packages/components/dropdownButton/JaDropdownButton.vue +59 -59
- package/packages/components/dropdownButton/index.ts +4 -4
- package/packages/components/enumList/EnumListInput.vue +107 -107
- package/packages/components/enumList/JaEnumList.vue +39 -39
- package/packages/components/enumList/index.ts +7 -7
- package/packages/components/enumPicker/index.ts +5 -5
- package/packages/components/enumPicker/src/EnumPicker.vue +103 -103
- package/packages/components/form/JaForm.vue +146 -186
- package/packages/components/form/index.ts +5 -5
- package/packages/components/form/types.ts +4 -4
- package/packages/components/formItem/JaFormItem.vue +87 -68
- package/packages/components/formItem/index.ts +4 -4
- package/packages/components/index.ts +34 -34
- package/packages/components/input/JaInput.vue +143 -143
- package/packages/components/input/index.ts +4 -4
- package/packages/components/inputI18n/I18nBundleEditor.vue +76 -76
- package/packages/components/inputI18n/InputI18n.vue +146 -146
- package/packages/components/inputI18n/JaInputI18n.vue +50 -50
- package/packages/components/inputI18n/index.ts +8 -8
- package/packages/components/inputNumber/JaInputNumber.vue +98 -98
- package/packages/components/inputNumber/index.ts +4 -4
- package/packages/components/mapItemList/JaMapItemList.vue +35 -35
- package/packages/components/mapItemList/MapItemListInput.vue +191 -191
- package/packages/components/mapItemList/index.ts +7 -7
- package/packages/components/numberList/JaNumberList.vue +36 -36
- package/packages/components/numberList/NumberListInput.vue +111 -111
- package/packages/components/numberList/index.ts +7 -7
- package/packages/components/properyPicker/JaPropertyPicker.vue +38 -38
- package/packages/components/properyPicker/PropertyPicker.vue +314 -314
- package/packages/components/properyPicker/index.ts +7 -7
- package/packages/components/radioGroup/JaRadioGroup.vue +50 -50
- package/packages/components/radioGroup/index.ts +4 -4
- package/packages/components/rolePicker/RoleEditor.vue +129 -129
- package/packages/components/rolePicker/RolePicker.vue +44 -44
- package/packages/components/rolePicker/RolePickerRaw.vue +56 -56
- package/packages/components/rolePicker/baseRolePicker.vue +87 -87
- package/packages/components/rolePicker/index.ts +10 -10
- package/packages/components/scrollbar/Scrollbar.vue +89 -89
- package/packages/components/scrollbar/index.ts +5 -5
- package/packages/components/scrollbar/utils.ts +17 -17
- package/packages/components/select/JaSelect.vue +48 -48
- package/packages/components/select/index.ts +4 -4
- package/packages/components/stringList/JaStringList.vue +36 -36
- package/packages/components/stringList/StringListInput.vue +96 -96
- package/packages/components/stringList/index.ts +7 -7
- package/packages/components/switch/JaSwitch.vue +50 -50
- package/packages/components/switch/index.ts +4 -4
- package/packages/components/timePicker/JaTimePicker.vue +52 -52
- package/packages/components/timePicker/index.ts +5 -5
- package/packages/components/tip/index.ts +4 -4
- package/packages/components/tip/src/AceTip.vue +43 -43
- package/packages/components/upload/index.ts +6 -6
- package/packages/components/upload/src/Upload.vue +25 -25
- package/packages/components/upload/src/type.ts +3 -3
- package/packages/components/userGroupPicker/index.ts +4 -4
- package/packages/components/userGroupPicker/src/UserGroupPicker.vue +94 -94
- package/packages/components/userGroupTree/index.ts +10 -10
- package/packages/components/userGroupTree/src/userGroupTree.vue +149 -149
- package/packages/components/userPicker/index.ts +10 -10
- package/packages/components/userPicker/src/CustomGroupManager.vue +189 -189
- package/packages/components/userPicker/src/JaUserList.vue +317 -283
- package/packages/components/userPicker/src/JaUserPicker.vue +40 -37
- package/packages/components/userPicker/src/UserPicker.vue +472 -376
- package/packages/components/userSelectDialog/index.ts +6 -6
- package/packages/components/userSelectDialog/src/userSelectDialog.vue +462 -462
- package/packages/components/userTag/UserInfoTag.vue +397 -397
- package/packages/components/userTag/index.ts +6 -6
- package/packages/components/userTag/sharedAxios.ts +8 -8
- package/packages/directives/auth/index.ts +41 -41
- package/packages/directives/autofocus/index.ts +29 -29
- package/packages/directives/index.ts +10 -10
- package/packages/directives/shortcut/index.ts +192 -192
- package/packages/hooks/useAppInstances.ts +34 -34
- package/packages/hooks/useBackendValidations.ts +81 -81
- package/packages/hooks/useBridage.ts +157 -157
- package/packages/hooks/useClassificationLevels.ts +62 -62
- package/packages/hooks/useDateTimeShortCuts.ts +65 -65
- package/packages/hooks/useRealms.ts +28 -28
- package/packages/hooks/useTreeData.ts +45 -45
- package/packages/hooks/useUserRefQuery.ts +232 -232
- package/packages/index.ts +24 -24
- package/packages/list.json +7 -7
- package/packages/types/custom.d.ts +13 -13
- package/packages/types/window.d.ts +16 -16
- package/packages/utils/formUtils.ts +57 -0
- package/packages/utils/install.ts +43 -43
- package/packages/utils/objectUtils.ts +31 -31
- package/theme-style/fonts/iconfont.json +5196 -5196
- package/theme-style/index.scss +10 -10
- package/theme-style/styles/element-plus-var.scss +1419 -1419
- package/theme-style/styles/iconfont.css +2979 -2979
- package/theme-style/styles/theme-var.scss +72 -72
- package/theme-style/styles/transition.scss +122 -122
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface JaFormModel {
|
|
2
|
-
formData: Record<string, any>,
|
|
3
|
-
[key: string | number | symbol]: any
|
|
4
|
-
}
|
|
1
|
+
export interface JaFormModel {
|
|
2
|
+
formData: Record<string, any>,
|
|
3
|
+
[key: string | number | symbol]: any
|
|
4
|
+
}
|
|
@@ -1,68 +1,87 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import {provide, ref, withDefaults, defineProps, defineExpose} from
|
|
3
|
-
import {ElFormItem, ElIcon, ElText, type FormItemRule, ElTooltip} from 'element-plus'
|
|
4
|
-
import {QuestionFilled} from "@element-plus/icons-vue";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
showMessage
|
|
20
|
-
inlineMessage
|
|
21
|
-
size
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { provide, ref, withDefaults, defineProps, defineExpose, inject, computed } from "vue";
|
|
3
|
+
import {ElFormItem, ElIcon, ElText, type FormItemRule, ElTooltip} from 'element-plus'
|
|
4
|
+
import {QuestionFilled} from "@element-plus/icons-vue";
|
|
5
|
+
|
|
6
|
+
type RequiredPosition = 'left' | 'right'
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const aceFormRequiredPosition = inject('aceFormRequiredPosition')
|
|
11
|
+
const props = withDefaults(defineProps<{
|
|
12
|
+
prop?: string | string[]
|
|
13
|
+
rules?: FormItemRule | FormItemRule[]
|
|
14
|
+
label?: string
|
|
15
|
+
labelWidth?: string | number
|
|
16
|
+
labelRemark?: string
|
|
17
|
+
required?: boolean
|
|
18
|
+
error?: string
|
|
19
|
+
showMessage?: boolean
|
|
20
|
+
inlineMessage?: boolean
|
|
21
|
+
size?: 'small' | 'default' | 'large'
|
|
22
|
+
requiredPosition?: RequiredPosition
|
|
23
|
+
labelGap?:string
|
|
24
|
+
}>(), {
|
|
25
|
+
required: false,
|
|
26
|
+
showMessage: true,
|
|
27
|
+
inlineMessage: true,
|
|
28
|
+
size: 'small',
|
|
29
|
+
labelGap:'4px'
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
provide('aceFormItemProp', props.prop)
|
|
33
|
+
|
|
34
|
+
const requiredPosition = computed(()=>{
|
|
35
|
+
return props.requiredPosition || aceFormRequiredPosition
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
const formItem = ref<typeof ElFormItem | null>(null)
|
|
40
|
+
defineExpose({
|
|
41
|
+
resetField: () => {
|
|
42
|
+
formItem.value!.resetField()
|
|
43
|
+
},
|
|
44
|
+
clearValidate: () => {
|
|
45
|
+
formItem.value!.clearValidate()
|
|
46
|
+
},
|
|
47
|
+
elFormItem: formItem
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<template>
|
|
53
|
+
<el-form-item ref="formItem"
|
|
54
|
+
:prop="prop"
|
|
55
|
+
:rules="rules"
|
|
56
|
+
:label-width="labelWidth"
|
|
57
|
+
:error="error"
|
|
58
|
+
:show-message="showMessage"
|
|
59
|
+
:inline-message="inlineMessage"
|
|
60
|
+
:size="size">
|
|
61
|
+
<template #label>
|
|
62
|
+
<div style="display: flex;" :style="{
|
|
63
|
+
gap: labelGap
|
|
64
|
+
}">
|
|
65
|
+
<span style="color:red" v-if="props.required && requiredPosition==='left'">*</span>
|
|
66
|
+
<el-text class="el-form-item__label">
|
|
67
|
+
{{ props.label }}
|
|
68
|
+
<el-tooltip
|
|
69
|
+
v-if="labelRemark"
|
|
70
|
+
placement="top">
|
|
71
|
+
<el-icon>
|
|
72
|
+
<question-filled/>
|
|
73
|
+
</el-icon>
|
|
74
|
+
<template #content>
|
|
75
|
+
<div v-html="labelRemark"/>
|
|
76
|
+
</template>
|
|
77
|
+
</el-tooltip>
|
|
78
|
+
</el-text>
|
|
79
|
+
<span style="color:red" v-if="props.required && requiredPosition==='right'">*</span>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
</template>
|
|
83
|
+
<slot></slot>
|
|
84
|
+
<slot name="error"></slot>
|
|
85
|
+
</el-form-item>
|
|
86
|
+
</template>
|
|
87
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {type SFCWithInstall, withInstall} from "../../utils/install";
|
|
2
|
-
import FormItem from "./JaFormItem.vue";
|
|
3
|
-
export const JaFormItem: SFCWithInstall<typeof FormItem> = withInstall(FormItem);
|
|
4
|
-
export default FormItem;
|
|
1
|
+
import {type SFCWithInstall, withInstall} from "../../utils/install";
|
|
2
|
+
import FormItem from "./JaFormItem.vue";
|
|
3
|
+
export const JaFormItem: SFCWithInstall<typeof FormItem> = withInstall(FormItem);
|
|
4
|
+
export default FormItem;
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
export * from "./upload";
|
|
2
|
-
export * from "./tip";
|
|
3
|
-
export * from "./form"
|
|
4
|
-
export * from "./formItem"
|
|
5
|
-
export * from "./input"
|
|
6
|
-
export * from "./checkbox"
|
|
7
|
-
export * from "./inputNumber"
|
|
8
|
-
export * from "./select"
|
|
9
|
-
export * from "./datePicker"
|
|
10
|
-
export * from "./button"
|
|
11
|
-
export * from "./dropdownButton"
|
|
12
|
-
export * from "./switch"
|
|
13
|
-
export * from "./stringList"
|
|
14
|
-
export * from "./numberList"
|
|
15
|
-
export * from "./enumList"
|
|
16
|
-
export * from "./mapItemList"
|
|
17
|
-
export * from "./departmentPicker"
|
|
18
|
-
export * from "./avatar"
|
|
19
|
-
export * from "./userTag"
|
|
20
|
-
export * from "./userPicker"
|
|
21
|
-
export * from "./departmentTree"
|
|
22
|
-
export * from "./userSelectDialog"
|
|
23
|
-
export * from "./timePicker"
|
|
24
|
-
export * from "./scrollbar"
|
|
25
|
-
export * from "./userGroupTree"
|
|
26
|
-
export * from "./userGroupPicker"
|
|
27
|
-
export * from "./autoComplete"
|
|
28
|
-
export * from "./radioGroup"
|
|
29
|
-
export * from "./rolePicker"
|
|
30
|
-
export * from "./channelPicker"
|
|
31
|
-
export * from "./properyPicker"
|
|
32
|
-
export * from "./inputI18n"
|
|
33
|
-
export * from "./checkboxGroup"
|
|
34
|
-
export * from "./enumPicker"
|
|
1
|
+
export * from "./upload";
|
|
2
|
+
export * from "./tip";
|
|
3
|
+
export * from "./form"
|
|
4
|
+
export * from "./formItem"
|
|
5
|
+
export * from "./input"
|
|
6
|
+
export * from "./checkbox"
|
|
7
|
+
export * from "./inputNumber"
|
|
8
|
+
export * from "./select"
|
|
9
|
+
export * from "./datePicker"
|
|
10
|
+
export * from "./button"
|
|
11
|
+
export * from "./dropdownButton"
|
|
12
|
+
export * from "./switch"
|
|
13
|
+
export * from "./stringList"
|
|
14
|
+
export * from "./numberList"
|
|
15
|
+
export * from "./enumList"
|
|
16
|
+
export * from "./mapItemList"
|
|
17
|
+
export * from "./departmentPicker"
|
|
18
|
+
export * from "./avatar"
|
|
19
|
+
export * from "./userTag"
|
|
20
|
+
export * from "./userPicker"
|
|
21
|
+
export * from "./departmentTree"
|
|
22
|
+
export * from "./userSelectDialog"
|
|
23
|
+
export * from "./timePicker"
|
|
24
|
+
export * from "./scrollbar"
|
|
25
|
+
export * from "./userGroupTree"
|
|
26
|
+
export * from "./userGroupPicker"
|
|
27
|
+
export * from "./autoComplete"
|
|
28
|
+
export * from "./radioGroup"
|
|
29
|
+
export * from "./rolePicker"
|
|
30
|
+
export * from "./channelPicker"
|
|
31
|
+
export * from "./properyPicker"
|
|
32
|
+
export * from "./inputI18n"
|
|
33
|
+
export * from "./checkboxGroup"
|
|
34
|
+
export * from "./enumPicker"
|
|
@@ -1,143 +1,143 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import {type Component, inject, type StyleValue, ref, watch} from 'vue'
|
|
3
|
-
import {ElInput} from 'element-plus'
|
|
4
|
-
import type {ValidationInstance} from '../../hooks/useBackendValidations'
|
|
5
|
-
import type {EpPropMergeType} from "element-plus/es/utils";
|
|
6
|
-
import {getValue, setValue} from "../../utils/objectUtils";
|
|
7
|
-
|
|
8
|
-
const props = withDefaults(defineProps<{
|
|
9
|
-
type?: string
|
|
10
|
-
maxLength?: number
|
|
11
|
-
minLength?: number
|
|
12
|
-
showWordLimit?: boolean
|
|
13
|
-
placeholder?: string
|
|
14
|
-
clearable?: boolean
|
|
15
|
-
formatter?: (value: string | number) => string
|
|
16
|
-
parser?: (value: string) => string
|
|
17
|
-
showPassword?: boolean
|
|
18
|
-
disabled?: boolean
|
|
19
|
-
size?: 'large' | 'default' | 'small'
|
|
20
|
-
prefixIcon?: string | Component
|
|
21
|
-
suffixIcon?: string | Component
|
|
22
|
-
rows?: number
|
|
23
|
-
autosize?: boolean | object
|
|
24
|
-
autocomplete?: string
|
|
25
|
-
name?: string
|
|
26
|
-
readonly?: boolean,
|
|
27
|
-
max?: any
|
|
28
|
-
min?: any
|
|
29
|
-
step?: any
|
|
30
|
-
resize?: 'none' | 'both' | 'horizontal' | 'vertical'
|
|
31
|
-
autofocus?: boolean
|
|
32
|
-
form?: string
|
|
33
|
-
label?: string
|
|
34
|
-
tabindex?: string | number
|
|
35
|
-
validateEvent?: boolean
|
|
36
|
-
inputStyle?: StyleValue
|
|
37
|
-
}>(), {
|
|
38
|
-
type: 'text',
|
|
39
|
-
showWordLimit: false,
|
|
40
|
-
clearable: false,
|
|
41
|
-
showPassword: false,
|
|
42
|
-
disabled: false,
|
|
43
|
-
rows: 2,
|
|
44
|
-
autosize: false,
|
|
45
|
-
autocomplete: 'off',
|
|
46
|
-
readonly: false,
|
|
47
|
-
autofocus: false,
|
|
48
|
-
validateEvent: true
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
const model = inject('aceFormModel') as Record<string, any>
|
|
52
|
-
const prop = inject('aceFormItemProp') as string
|
|
53
|
-
const validator = inject('aceFormValidator') as ValidationInstance
|
|
54
|
-
const input = ref<typeof ElInput>({} as typeof ElInput)
|
|
55
|
-
const emit = defineEmits<{
|
|
56
|
-
blur: [evt: Event]
|
|
57
|
-
focus: [evt: Event]
|
|
58
|
-
change: [value: string]
|
|
59
|
-
input: [value: string]
|
|
60
|
-
clear: [void]
|
|
61
|
-
}>()
|
|
62
|
-
|
|
63
|
-
function onChange(value: string) {
|
|
64
|
-
validator.removeFieldError(prop);
|
|
65
|
-
setValue(model.formData, prop, mv.value);
|
|
66
|
-
emit('change', value);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
type ModelType = EpPropMergeType<(new (...args: any[]) => string | number)
|
|
70
|
-
| (() => string | number | null | undefined)
|
|
71
|
-
| ((new (...args: any[]) => string | number) | (() => string | number | null | undefined))[],
|
|
72
|
-
unknown, unknown>;
|
|
73
|
-
|
|
74
|
-
const mv = ref(getValue(model.formData, prop) as ModelType);
|
|
75
|
-
watch(() => model.formData, () => {
|
|
76
|
-
mv.value = getValue(model.formData, prop) as ModelType
|
|
77
|
-
}, {
|
|
78
|
-
deep: true
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
defineExpose({
|
|
82
|
-
focus() {
|
|
83
|
-
input.value.focus()
|
|
84
|
-
},
|
|
85
|
-
blur() {
|
|
86
|
-
input.value.blur()
|
|
87
|
-
},
|
|
88
|
-
select() {
|
|
89
|
-
input.value.select()
|
|
90
|
-
},
|
|
91
|
-
clear() {
|
|
92
|
-
input.value.clear()
|
|
93
|
-
},
|
|
94
|
-
elInput: input
|
|
95
|
-
})
|
|
96
|
-
</script>
|
|
97
|
-
|
|
98
|
-
<template>
|
|
99
|
-
<el-input
|
|
100
|
-
ref="input"
|
|
101
|
-
:type="type"
|
|
102
|
-
v-model="mv"
|
|
103
|
-
:maxlength="maxLength"
|
|
104
|
-
:minLength="minLength"
|
|
105
|
-
:show-word-limit="showWordLimit"
|
|
106
|
-
:placeholder="placeholder"
|
|
107
|
-
:clearable="clearable"
|
|
108
|
-
:formatter="formatter"
|
|
109
|
-
:parser="parser"
|
|
110
|
-
:show-password="showPassword"
|
|
111
|
-
:disabled="disabled"
|
|
112
|
-
:size="size"
|
|
113
|
-
:prefix-icon="prefixIcon"
|
|
114
|
-
:suffix-icon="suffixIcon"
|
|
115
|
-
:rows="rows"
|
|
116
|
-
:autosize="autosize"
|
|
117
|
-
:autocomplete="autocomplete"
|
|
118
|
-
:name="name"
|
|
119
|
-
:readonly="readonly"
|
|
120
|
-
:max="max"
|
|
121
|
-
:min="min"
|
|
122
|
-
:step="step"
|
|
123
|
-
:resize="resize"
|
|
124
|
-
:autofocus="autofocus"
|
|
125
|
-
:form="form"
|
|
126
|
-
:label="label"
|
|
127
|
-
:tabindex="tabindex"
|
|
128
|
-
:validate-event="validateEvent"
|
|
129
|
-
@blur="evt => $emit('blur', evt)"
|
|
130
|
-
@focus="evt => $emit('focus', evt)"
|
|
131
|
-
@change="onChange"
|
|
132
|
-
@input="value => $emit('input', value)"
|
|
133
|
-
@clear="() => $emit('clear')"
|
|
134
|
-
>
|
|
135
|
-
<template v-for="(_, name) in $slots" v-slot:[name]>
|
|
136
|
-
<slot :name="name"></slot>
|
|
137
|
-
</template>
|
|
138
|
-
</el-input>
|
|
139
|
-
</template>
|
|
140
|
-
|
|
141
|
-
<style scoped lang="scss">
|
|
142
|
-
|
|
143
|
-
</style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {type Component, inject, type StyleValue, ref, watch} from 'vue'
|
|
3
|
+
import {ElInput} from 'element-plus'
|
|
4
|
+
import type {ValidationInstance} from '../../hooks/useBackendValidations'
|
|
5
|
+
import type {EpPropMergeType} from "element-plus/es/utils";
|
|
6
|
+
import {getValue, setValue} from "../../utils/objectUtils";
|
|
7
|
+
|
|
8
|
+
const props = withDefaults(defineProps<{
|
|
9
|
+
type?: string
|
|
10
|
+
maxLength?: number
|
|
11
|
+
minLength?: number
|
|
12
|
+
showWordLimit?: boolean
|
|
13
|
+
placeholder?: string
|
|
14
|
+
clearable?: boolean
|
|
15
|
+
formatter?: (value: string | number) => string
|
|
16
|
+
parser?: (value: string) => string
|
|
17
|
+
showPassword?: boolean
|
|
18
|
+
disabled?: boolean
|
|
19
|
+
size?: 'large' | 'default' | 'small'
|
|
20
|
+
prefixIcon?: string | Component
|
|
21
|
+
suffixIcon?: string | Component
|
|
22
|
+
rows?: number
|
|
23
|
+
autosize?: boolean | object
|
|
24
|
+
autocomplete?: string
|
|
25
|
+
name?: string
|
|
26
|
+
readonly?: boolean,
|
|
27
|
+
max?: any
|
|
28
|
+
min?: any
|
|
29
|
+
step?: any
|
|
30
|
+
resize?: 'none' | 'both' | 'horizontal' | 'vertical'
|
|
31
|
+
autofocus?: boolean
|
|
32
|
+
form?: string
|
|
33
|
+
label?: string
|
|
34
|
+
tabindex?: string | number
|
|
35
|
+
validateEvent?: boolean
|
|
36
|
+
inputStyle?: StyleValue
|
|
37
|
+
}>(), {
|
|
38
|
+
type: 'text',
|
|
39
|
+
showWordLimit: false,
|
|
40
|
+
clearable: false,
|
|
41
|
+
showPassword: false,
|
|
42
|
+
disabled: false,
|
|
43
|
+
rows: 2,
|
|
44
|
+
autosize: false,
|
|
45
|
+
autocomplete: 'off',
|
|
46
|
+
readonly: false,
|
|
47
|
+
autofocus: false,
|
|
48
|
+
validateEvent: true
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const model = inject('aceFormModel') as Record<string, any>
|
|
52
|
+
const prop = inject('aceFormItemProp') as string
|
|
53
|
+
const validator = inject('aceFormValidator') as ValidationInstance
|
|
54
|
+
const input = ref<typeof ElInput>({} as typeof ElInput)
|
|
55
|
+
const emit = defineEmits<{
|
|
56
|
+
blur: [evt: Event]
|
|
57
|
+
focus: [evt: Event]
|
|
58
|
+
change: [value: string]
|
|
59
|
+
input: [value: string]
|
|
60
|
+
clear: [void]
|
|
61
|
+
}>()
|
|
62
|
+
|
|
63
|
+
function onChange(value: string) {
|
|
64
|
+
validator.removeFieldError(prop);
|
|
65
|
+
setValue(model.formData, prop, mv.value);
|
|
66
|
+
emit('change', value);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
type ModelType = EpPropMergeType<(new (...args: any[]) => string | number)
|
|
70
|
+
| (() => string | number | null | undefined)
|
|
71
|
+
| ((new (...args: any[]) => string | number) | (() => string | number | null | undefined))[],
|
|
72
|
+
unknown, unknown>;
|
|
73
|
+
|
|
74
|
+
const mv = ref(getValue(model.formData, prop) as ModelType);
|
|
75
|
+
watch(() => model.formData, () => {
|
|
76
|
+
mv.value = getValue(model.formData, prop) as ModelType
|
|
77
|
+
}, {
|
|
78
|
+
deep: true
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
defineExpose({
|
|
82
|
+
focus() {
|
|
83
|
+
input.value.focus()
|
|
84
|
+
},
|
|
85
|
+
blur() {
|
|
86
|
+
input.value.blur()
|
|
87
|
+
},
|
|
88
|
+
select() {
|
|
89
|
+
input.value.select()
|
|
90
|
+
},
|
|
91
|
+
clear() {
|
|
92
|
+
input.value.clear()
|
|
93
|
+
},
|
|
94
|
+
elInput: input
|
|
95
|
+
})
|
|
96
|
+
</script>
|
|
97
|
+
|
|
98
|
+
<template>
|
|
99
|
+
<el-input
|
|
100
|
+
ref="input"
|
|
101
|
+
:type="type"
|
|
102
|
+
v-model="mv"
|
|
103
|
+
:maxlength="maxLength"
|
|
104
|
+
:minLength="minLength"
|
|
105
|
+
:show-word-limit="showWordLimit"
|
|
106
|
+
:placeholder="placeholder"
|
|
107
|
+
:clearable="clearable"
|
|
108
|
+
:formatter="formatter"
|
|
109
|
+
:parser="parser"
|
|
110
|
+
:show-password="showPassword"
|
|
111
|
+
:disabled="disabled"
|
|
112
|
+
:size="size"
|
|
113
|
+
:prefix-icon="prefixIcon"
|
|
114
|
+
:suffix-icon="suffixIcon"
|
|
115
|
+
:rows="rows"
|
|
116
|
+
:autosize="autosize"
|
|
117
|
+
:autocomplete="autocomplete"
|
|
118
|
+
:name="name"
|
|
119
|
+
:readonly="readonly"
|
|
120
|
+
:max="max"
|
|
121
|
+
:min="min"
|
|
122
|
+
:step="step"
|
|
123
|
+
:resize="resize"
|
|
124
|
+
:autofocus="autofocus"
|
|
125
|
+
:form="form"
|
|
126
|
+
:label="label"
|
|
127
|
+
:tabindex="tabindex"
|
|
128
|
+
:validate-event="validateEvent"
|
|
129
|
+
@blur="evt => $emit('blur', evt)"
|
|
130
|
+
@focus="evt => $emit('focus', evt)"
|
|
131
|
+
@change="onChange"
|
|
132
|
+
@input="value => $emit('input', value)"
|
|
133
|
+
@clear="() => $emit('clear')"
|
|
134
|
+
>
|
|
135
|
+
<template v-for="(_, name) in $slots" v-slot:[name]>
|
|
136
|
+
<slot :name="name"></slot>
|
|
137
|
+
</template>
|
|
138
|
+
</el-input>
|
|
139
|
+
</template>
|
|
140
|
+
|
|
141
|
+
<style scoped lang="scss">
|
|
142
|
+
|
|
143
|
+
</style>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {type SFCWithInstall, withInstall} from "../../utils/install";
|
|
2
|
-
import Input from "./JaInput.vue";
|
|
3
|
-
export const JaInput:SFCWithInstall<typeof Input> = withInstall(Input);
|
|
4
|
-
export default Input;
|
|
1
|
+
import {type SFCWithInstall, withInstall} from "../../utils/install";
|
|
2
|
+
import Input from "./JaInput.vue";
|
|
3
|
+
export const JaInput:SFCWithInstall<typeof Input> = withInstall(Input);
|
|
4
|
+
export default Input;
|