@jari-ace/element-plus-component 0.1.10 → 0.2.1
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 -18
- package/dist/components/form/JaForm.vue.d.ts +0 -3
- package/dist/components/form/JaForm.vue.d.ts.map +1 -1
- package/dist/components/form/JaForm.vue.js +68 -22
- package/dist/components/form/JaForm.vue.js.map +1 -1
- package/dist/components/formItem/JaFormItem.vue.d.ts +0 -4
- package/dist/components/formItem/JaFormItem.vue.d.ts.map +1 -1
- package/dist/components/formItem/JaFormItem.vue.js +8 -26
- package/dist/components/formItem/JaFormItem.vue.js.map +1 -1
- package/dist/components/userPicker/src/UserPicker.vue.d.ts +17 -0
- package/dist/components/userPicker/src/UserPicker.vue.d.ts.map +1 -1
- package/dist/components/userPicker/src/UserPicker.vue.js +15 -0
- package/dist/components/userPicker/src/UserPicker.vue.js.map +1 -1
- package/dist/components/userSelectDialog/src/userSelectDialog.vue.d.ts +17 -0
- package/dist/components/userSelectDialog/src/userSelectDialog.vue.d.ts.map +1 -1
- package/dist/components/userSelectDialog/src/userSelectDialog.vue.js +15 -0
- package/dist/components/userSelectDialog/src/userSelectDialog.vue.js.map +1 -1
- package/dist/hooks/useBackendValidations.js +0 -1
- package/dist/hooks/useBackendValidations.js.map +1 -1
- package/dist/hooks/useClassificationLevels.d.ts +21 -0
- package/dist/hooks/useClassificationLevels.d.ts.map +1 -0
- package/dist/hooks/useClassificationLevels.js +55 -0
- package/dist/hooks/useClassificationLevels.js.map +1 -0
- package/dist/hooks/useUserRefQuery.d.ts +6 -0
- package/dist/hooks/useUserRefQuery.d.ts.map +1 -1
- package/dist/hooks/useUserRefQuery.js +4 -0
- package/dist/hooks/useUserRefQuery.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/index.js +1808 -1774
- 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 +186 -146
- package/packages/components/form/index.ts +5 -5
- package/packages/components/form/types.ts +4 -4
- package/packages/components/formItem/JaFormItem.vue +68 -87
- 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 +283 -283
- package/packages/components/userPicker/src/JaUserPicker.vue +37 -37
- package/packages/components/userPicker/src/UserPicker.vue +376 -368
- package/packages/components/userSelectDialog/index.ts +6 -6
- package/packages/components/userSelectDialog/src/userSelectDialog.vue +462 -455
- 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 -0
- 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 -224
- package/packages/index.ts +24 -22
- 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/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
- package/dist/utils/formUtils.d.ts +0 -7
- package/dist/utils/formUtils.d.ts.map +0 -1
- package/dist/utils/formUtils.js +0 -54
- package/dist/utils/formUtils.js.map +0 -1
- package/packages/utils/formUtils.ts +0 -57
package/package.json
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@jari-ace/element-plus-component",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "0.2.1",
|
|
5
|
+
"main": "lib/index.umd.cjs",
|
|
6
|
+
"module": "lib/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"files": [
|
|
10
|
+
"lib",
|
|
11
|
+
"dist",
|
|
12
|
+
"theme-style",
|
|
13
|
+
"packages"
|
|
14
|
+
],
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@element-plus/icons-vue": "^2.3.1",
|
|
17
|
+
"animate.css": "^4.1.1"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@jari-ace/app-bolts": "0.3.6",
|
|
21
|
+
"@types/lodash-es": "^4.17.12",
|
|
22
|
+
"@vitejs/plugin-vue": "^5.2.1",
|
|
23
|
+
"@vitejs/plugin-vue-jsx": "^4.1.1",
|
|
24
|
+
"@vue/tsconfig": "^0.5.1",
|
|
25
|
+
"@vueuse/core": "^11.1.0",
|
|
26
|
+
"element-plus": "2.10.3",
|
|
27
|
+
"gulp": "^4.0.2",
|
|
28
|
+
"gulp-autoprefixer": "^8.0.0",
|
|
29
|
+
"gulp-clean-css": "^4.3.0",
|
|
30
|
+
"gulp-concat-css": "^3.1.0",
|
|
31
|
+
"gulp-dart-sass": "^1.0.2",
|
|
32
|
+
"gulp-rename": "^2.0.0",
|
|
33
|
+
"gulp-replace": "^1.1.4",
|
|
34
|
+
"lodash-es": "^4.17.21",
|
|
35
|
+
"npm-run-all2": "^6.2.0",
|
|
36
|
+
"sass": "^1.77.6",
|
|
37
|
+
"typescript": "~5.4.5",
|
|
38
|
+
"vite": "^6.3.5",
|
|
39
|
+
"vue": "^3.5.13",
|
|
40
|
+
"vue-i18n": "^9.13.1",
|
|
41
|
+
"vue-tsc": "^2.0.21"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"@vueuse/core": "^11.1.0",
|
|
48
|
+
"element-plus": "^2.8.4",
|
|
49
|
+
"lodash-es": "^4.17.21",
|
|
50
|
+
"vue": "^3.5.11",
|
|
51
|
+
"vue-i18n": "^9.13.1",
|
|
52
|
+
"@jari-ace/app-bolts": "0.4.0"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"dev": "vite --port 3400",
|
|
56
|
+
"build": "run-p type-check && vite build",
|
|
57
|
+
"preview": "vite preview",
|
|
58
|
+
"dts": "vue-tsc --declaration --emitDeclarationOnly ",
|
|
59
|
+
"type-check": "vue-tsc --build --force"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import {ElAutocomplete} from "element-plus";
|
|
3
|
-
import {inject, ref, watch} from "vue";
|
|
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 input = ref<typeof ElAutocomplete>()
|
|
9
|
-
const model = inject('aceFormModel') as Record<string, any>
|
|
10
|
-
const prop = inject('aceFormItemProp') as string
|
|
11
|
-
const validator = inject('aceFormValidator') as ValidationInstance
|
|
12
|
-
const emit = defineEmits<{
|
|
13
|
-
change: [value: string]
|
|
14
|
-
}>()
|
|
15
|
-
|
|
16
|
-
function onChange(value: string) {
|
|
17
|
-
validator.removeFieldError(prop)
|
|
18
|
-
setValue(model.formData, prop, mv.value);
|
|
19
|
-
emit('change', value)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
type modelType =
|
|
23
|
-
EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown> | undefined;
|
|
24
|
-
|
|
25
|
-
const mv = ref(getValue(model.formData, prop) as modelType);
|
|
26
|
-
watch(() => model.formData, () => {
|
|
27
|
-
mv.value = getValue(model.formData, prop) as modelType
|
|
28
|
-
}, {
|
|
29
|
-
deep: true
|
|
30
|
-
})
|
|
31
|
-
defineExpose({
|
|
32
|
-
elAutocomplete: input
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
</script>
|
|
36
|
-
|
|
37
|
-
<template>
|
|
38
|
-
<el-autocomplete
|
|
39
|
-
ref="input"
|
|
40
|
-
v-model="mv"
|
|
41
|
-
@change="onChange"
|
|
42
|
-
v-bind="$attrs">
|
|
43
|
-
<template v-for="(_, name) in $slots" v-slot:[name]>
|
|
44
|
-
<slot :name="name"></slot>
|
|
45
|
-
</template>
|
|
46
|
-
</el-autocomplete>
|
|
47
|
-
</template>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {ElAutocomplete} from "element-plus";
|
|
3
|
+
import {inject, ref, watch} from "vue";
|
|
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 input = ref<typeof ElAutocomplete>()
|
|
9
|
+
const model = inject('aceFormModel') as Record<string, any>
|
|
10
|
+
const prop = inject('aceFormItemProp') as string
|
|
11
|
+
const validator = inject('aceFormValidator') as ValidationInstance
|
|
12
|
+
const emit = defineEmits<{
|
|
13
|
+
change: [value: string]
|
|
14
|
+
}>()
|
|
15
|
+
|
|
16
|
+
function onChange(value: string) {
|
|
17
|
+
validator.removeFieldError(prop)
|
|
18
|
+
setValue(model.formData, prop, mv.value);
|
|
19
|
+
emit('change', value)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type modelType =
|
|
23
|
+
EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown> | undefined;
|
|
24
|
+
|
|
25
|
+
const mv = ref(getValue(model.formData, prop) as modelType);
|
|
26
|
+
watch(() => model.formData, () => {
|
|
27
|
+
mv.value = getValue(model.formData, prop) as modelType
|
|
28
|
+
}, {
|
|
29
|
+
deep: true
|
|
30
|
+
})
|
|
31
|
+
defineExpose({
|
|
32
|
+
elAutocomplete: input
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<template>
|
|
38
|
+
<el-autocomplete
|
|
39
|
+
ref="input"
|
|
40
|
+
v-model="mv"
|
|
41
|
+
@change="onChange"
|
|
42
|
+
v-bind="$attrs">
|
|
43
|
+
<template v-for="(_, name) in $slots" v-slot:[name]>
|
|
44
|
+
<slot :name="name"></slot>
|
|
45
|
+
</template>
|
|
46
|
+
</el-autocomplete>
|
|
47
|
+
</template>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {type SFCWithInstall, withInstall} from "../../utils/install";
|
|
2
|
-
import Autocomplete from "./JaAutoComplete.vue";
|
|
3
|
-
|
|
4
|
-
export const JaAutocomplete: SFCWithInstall<typeof Autocomplete> = withInstall(Autocomplete);
|
|
5
|
-
// export default JaButton;
|
|
1
|
+
import {type SFCWithInstall, withInstall} from "../../utils/install";
|
|
2
|
+
import Autocomplete from "./JaAutoComplete.vue";
|
|
3
|
+
|
|
4
|
+
export const JaAutocomplete: SFCWithInstall<typeof Autocomplete> = withInstall(Autocomplete);
|
|
5
|
+
// export default JaButton;
|
|
@@ -1,126 +1,126 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import {getAvatarToken} from "./avatarToken";
|
|
3
|
-
import {ElAvatar, ElImage} from "element-plus";
|
|
4
|
-
import {
|
|
5
|
-
computed,
|
|
6
|
-
defineProps,
|
|
7
|
-
nextTick,
|
|
8
|
-
onMounted, onUnmounted,
|
|
9
|
-
ref,
|
|
10
|
-
watch,
|
|
11
|
-
withDefaults
|
|
12
|
-
} from "vue";
|
|
13
|
-
import {defaultImg} from "./defaultImg";
|
|
14
|
-
|
|
15
|
-
const props = withDefaults(defineProps<{
|
|
16
|
-
/**
|
|
17
|
-
* 用户id
|
|
18
|
-
*/
|
|
19
|
-
userId?: string,
|
|
20
|
-
/**
|
|
21
|
-
* 用户名
|
|
22
|
-
*/
|
|
23
|
-
username?: string,
|
|
24
|
-
/**
|
|
25
|
-
* 用户域
|
|
26
|
-
*/
|
|
27
|
-
realm?: string,
|
|
28
|
-
/**
|
|
29
|
-
* 是否在tag上显示用户头像
|
|
30
|
-
*/
|
|
31
|
-
doNotLoadAvatar?: boolean,
|
|
32
|
-
/**
|
|
33
|
-
* 用户是否设置了头像
|
|
34
|
-
*/
|
|
35
|
-
hasAvatar?: boolean,
|
|
36
|
-
|
|
37
|
-
firstName?: string
|
|
38
|
-
}>(), {
|
|
39
|
-
doNotLoadAvatar: false
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
const token = getAvatarToken();
|
|
43
|
-
const inView = ref(false);
|
|
44
|
-
const avatar = ref<InstanceType<typeof ElAvatar>>()
|
|
45
|
-
const usernameSpan = ref<HTMLElement>();
|
|
46
|
-
const scrollbarWrappedItems = undefined; //inject(SCROLL_BAR_WRAPPED_INJECT_KEY) as Ref<ScrollbarWrapped[] | undefined>
|
|
47
|
-
if (!scrollbarWrappedItems) {
|
|
48
|
-
inView.value = true;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
onMounted(async () => {
|
|
52
|
-
await nextTick();
|
|
53
|
-
if (scrollbarWrappedItems) {
|
|
54
|
-
scrollbarWrappedItems.value?.push({
|
|
55
|
-
childElement: avatar.value?.$el,
|
|
56
|
-
onInView(isInView: boolean) {
|
|
57
|
-
if (isInView && !inView.value) inView.value = true;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
const lazyUrl = computed(() => {
|
|
64
|
-
if (!(
|
|
65
|
-
inView.value && props.hasAvatar && !props.doNotLoadAvatar
|
|
66
|
-
)) {
|
|
67
|
-
return props.firstName ? "" : defaultImg;
|
|
68
|
-
}
|
|
69
|
-
if (props.userId && props.userId.length > 0) {
|
|
70
|
-
const path = '/ace-app-service/avatar/' + props.userId
|
|
71
|
-
return window.appDescriptor.env.isDevMode()
|
|
72
|
-
? new URL("/ace" + path, location.origin).toString() + "?t=" + token.value.toString() //开发模式下使用vite代理,添加ace前缀,由vite代理修改路由
|
|
73
|
-
: new URL(path, location.origin).toString() + "?t=" + token.value.toString()
|
|
74
|
-
}
|
|
75
|
-
if (props.realm && props.realm.length > 0 && props.username && props.username.length > 0) {
|
|
76
|
-
const path = '/ace-app-service/avatar/' + props.realm + '/' + props.username
|
|
77
|
-
return window.appDescriptor.env.isDevMode()
|
|
78
|
-
? new URL("/ace" + path, location.origin).toString() + "?t=" + token.value.toString() //开发模式下使用vite代理,添加ace前缀,由vite代理修改路由
|
|
79
|
-
: new URL(path, location.origin).toString() + "?t=" + token.value.toString()
|
|
80
|
-
}
|
|
81
|
-
return props.firstName ? "" : defaultImg;
|
|
82
|
-
}
|
|
83
|
-
)
|
|
84
|
-
|
|
85
|
-
function adjustFontSize(element?: HTMLElement) {
|
|
86
|
-
if (!element) return;
|
|
87
|
-
let parentWidth = avatar.value?.$el.clientWidth;
|
|
88
|
-
let fontSize = parentWidth / 2.8;
|
|
89
|
-
element.style.fontSize = fontSize + 'px';
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
onUnmounted(() => {
|
|
93
|
-
if (scrollbarWrappedItems) {
|
|
94
|
-
scrollbarWrappedItems.value = undefined;
|
|
95
|
-
}
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
watch(usernameSpan, () => adjustFontSize(usernameSpan.value))
|
|
99
|
-
</script>
|
|
100
|
-
|
|
101
|
-
<template>
|
|
102
|
-
<el-avatar :src="lazyUrl" v-bind="$attrs" ref="avatar" class="ja-avatar">
|
|
103
|
-
<span v-if="props.firstName && props.firstName.length > 0" class="user-name-avatar"
|
|
104
|
-
ref="usernameSpan">
|
|
105
|
-
{{ firstName }}
|
|
106
|
-
</span>
|
|
107
|
-
<el-image style="height:100%" v-else
|
|
108
|
-
:src="defaultImg"
|
|
109
|
-
alt="用户头像"/>
|
|
110
|
-
</el-avatar>
|
|
111
|
-
</template>
|
|
112
|
-
|
|
113
|
-
<style scoped lang="scss">
|
|
114
|
-
.ja-avatar {
|
|
115
|
-
--el-avatar-bg-color: #C1CCD7 !important;
|
|
116
|
-
transition: background-color 0.3s ease;
|
|
117
|
-
|
|
118
|
-
&:hover {
|
|
119
|
-
--el-avatar-bg-color: #9BA4AF !important;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.user-name-avatar {
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
</style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {getAvatarToken} from "./avatarToken";
|
|
3
|
+
import {ElAvatar, ElImage} from "element-plus";
|
|
4
|
+
import {
|
|
5
|
+
computed,
|
|
6
|
+
defineProps,
|
|
7
|
+
nextTick,
|
|
8
|
+
onMounted, onUnmounted,
|
|
9
|
+
ref,
|
|
10
|
+
watch,
|
|
11
|
+
withDefaults
|
|
12
|
+
} from "vue";
|
|
13
|
+
import {defaultImg} from "./defaultImg";
|
|
14
|
+
|
|
15
|
+
const props = withDefaults(defineProps<{
|
|
16
|
+
/**
|
|
17
|
+
* 用户id
|
|
18
|
+
*/
|
|
19
|
+
userId?: string,
|
|
20
|
+
/**
|
|
21
|
+
* 用户名
|
|
22
|
+
*/
|
|
23
|
+
username?: string,
|
|
24
|
+
/**
|
|
25
|
+
* 用户域
|
|
26
|
+
*/
|
|
27
|
+
realm?: string,
|
|
28
|
+
/**
|
|
29
|
+
* 是否在tag上显示用户头像
|
|
30
|
+
*/
|
|
31
|
+
doNotLoadAvatar?: boolean,
|
|
32
|
+
/**
|
|
33
|
+
* 用户是否设置了头像
|
|
34
|
+
*/
|
|
35
|
+
hasAvatar?: boolean,
|
|
36
|
+
|
|
37
|
+
firstName?: string
|
|
38
|
+
}>(), {
|
|
39
|
+
doNotLoadAvatar: false
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
const token = getAvatarToken();
|
|
43
|
+
const inView = ref(false);
|
|
44
|
+
const avatar = ref<InstanceType<typeof ElAvatar>>()
|
|
45
|
+
const usernameSpan = ref<HTMLElement>();
|
|
46
|
+
const scrollbarWrappedItems = undefined; //inject(SCROLL_BAR_WRAPPED_INJECT_KEY) as Ref<ScrollbarWrapped[] | undefined>
|
|
47
|
+
if (!scrollbarWrappedItems) {
|
|
48
|
+
inView.value = true;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
onMounted(async () => {
|
|
52
|
+
await nextTick();
|
|
53
|
+
if (scrollbarWrappedItems) {
|
|
54
|
+
scrollbarWrappedItems.value?.push({
|
|
55
|
+
childElement: avatar.value?.$el,
|
|
56
|
+
onInView(isInView: boolean) {
|
|
57
|
+
if (isInView && !inView.value) inView.value = true;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
const lazyUrl = computed(() => {
|
|
64
|
+
if (!(
|
|
65
|
+
inView.value && props.hasAvatar && !props.doNotLoadAvatar
|
|
66
|
+
)) {
|
|
67
|
+
return props.firstName ? "" : defaultImg;
|
|
68
|
+
}
|
|
69
|
+
if (props.userId && props.userId.length > 0) {
|
|
70
|
+
const path = '/ace-app-service/avatar/' + props.userId
|
|
71
|
+
return window.appDescriptor.env.isDevMode()
|
|
72
|
+
? new URL("/ace" + path, location.origin).toString() + "?t=" + token.value.toString() //开发模式下使用vite代理,添加ace前缀,由vite代理修改路由
|
|
73
|
+
: new URL(path, location.origin).toString() + "?t=" + token.value.toString()
|
|
74
|
+
}
|
|
75
|
+
if (props.realm && props.realm.length > 0 && props.username && props.username.length > 0) {
|
|
76
|
+
const path = '/ace-app-service/avatar/' + props.realm + '/' + props.username
|
|
77
|
+
return window.appDescriptor.env.isDevMode()
|
|
78
|
+
? new URL("/ace" + path, location.origin).toString() + "?t=" + token.value.toString() //开发模式下使用vite代理,添加ace前缀,由vite代理修改路由
|
|
79
|
+
: new URL(path, location.origin).toString() + "?t=" + token.value.toString()
|
|
80
|
+
}
|
|
81
|
+
return props.firstName ? "" : defaultImg;
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
function adjustFontSize(element?: HTMLElement) {
|
|
86
|
+
if (!element) return;
|
|
87
|
+
let parentWidth = avatar.value?.$el.clientWidth;
|
|
88
|
+
let fontSize = parentWidth / 2.8;
|
|
89
|
+
element.style.fontSize = fontSize + 'px';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
onUnmounted(() => {
|
|
93
|
+
if (scrollbarWrappedItems) {
|
|
94
|
+
scrollbarWrappedItems.value = undefined;
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
watch(usernameSpan, () => adjustFontSize(usernameSpan.value))
|
|
99
|
+
</script>
|
|
100
|
+
|
|
101
|
+
<template>
|
|
102
|
+
<el-avatar :src="lazyUrl" v-bind="$attrs" ref="avatar" class="ja-avatar">
|
|
103
|
+
<span v-if="props.firstName && props.firstName.length > 0" class="user-name-avatar"
|
|
104
|
+
ref="usernameSpan">
|
|
105
|
+
{{ firstName }}
|
|
106
|
+
</span>
|
|
107
|
+
<el-image style="height:100%" v-else
|
|
108
|
+
:src="defaultImg"
|
|
109
|
+
alt="用户头像"/>
|
|
110
|
+
</el-avatar>
|
|
111
|
+
</template>
|
|
112
|
+
|
|
113
|
+
<style scoped lang="scss">
|
|
114
|
+
.ja-avatar {
|
|
115
|
+
--el-avatar-bg-color: #C1CCD7 !important;
|
|
116
|
+
transition: background-color 0.3s ease;
|
|
117
|
+
|
|
118
|
+
&:hover {
|
|
119
|
+
--el-avatar-bg-color: #9BA4AF !important;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.user-name-avatar {
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
</style>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {ref} from "vue"
|
|
2
|
-
|
|
3
|
-
const token = ref(Date.now());
|
|
4
|
-
|
|
5
|
-
export function updateAvatarToken() {
|
|
6
|
-
token.value = Date.now();
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function getAvatarToken() {
|
|
10
|
-
return token;
|
|
11
|
-
}
|
|
1
|
+
import {ref} from "vue"
|
|
2
|
+
|
|
3
|
+
const token = ref(Date.now());
|
|
4
|
+
|
|
5
|
+
export function updateAvatarToken() {
|
|
6
|
+
token.value = Date.now();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function getAvatarToken() {
|
|
10
|
+
return token;
|
|
11
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export const defaultImg = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1280.000000pt' height='1248.000000pt' viewBox='-384 -374 2048 2048' preserveAspectRatio='xMidYMid meet'%3E%3Cg transform='translate(0.000000,1248.000000) scale(0.100000,-0.100000)'\n" +
|
|
2
|
-
"fill='%23fff' stroke='none'%3E%3Cpath d='M6005 12474 c-22 -2 -89 -9 -149 -14 -542 -53 -1087 -253 -1556 -571\n" +
|
|
3
|
-
"-1089 -738 -1659 -2029 -1470 -3331 117 -802 507 -1518 1129 -2075 454 -406\n" +
|
|
4
|
-
"1057 -697 1666 -802 220 -39 317 -46 595 -46 278 0 375 7 595 46 1218 211\n" +
|
|
5
|
-
"2250 1096 2647 2269 353 1043 189 2180 -442 3075 -568 804 -1437 1318 -2425\n" +
|
|
6
|
-
"1435 -92 11 -518 21 -590 14z'/%3E%3Cpath d='M8585 5886 c-478 -363 -1085 -626 -1687 -730 -247 -43 -348 -51 -678\n" +
|
|
7
|
-
"-51 -319 0 -364 3 -612 41 -586 88 -1171 326 -1668 676 l-114 81 -106 -17\n" +
|
|
8
|
-
"c-58 -10 -181 -38 -275 -61 -807 -204 -1528 -616 -2120 -1210 -726 -728 -1170\n" +
|
|
9
|
-
"-1655 -1297 -2704 -29 -238 -32 -741 -5 -930 53 -378 142 -589 320 -758 171\n" +
|
|
10
|
-
"-163 421 -234 772 -220 269 11 533 55 1230 208 817 179 1195 244 1690 291 205\n" +
|
|
11
|
-
"19 4525 19 4730 0 495 -47 873 -112 1690 -291 697 -153 961 -197 1230 -208\n" +
|
|
12
|
-
"254 -10 438 21 605 103 172 84 315 254 390 463 74 203 108 420 117 736 34\n" +
|
|
13
|
-
"1230 -451 2439 -1332 3320 -707 707 -1608 1156 -2597 1294 -206 29 -201 30\n" +
|
|
14
|
-
"-283 -33z'/%3E%3C/g%3E%3C/svg%3E";
|
|
1
|
+
export const defaultImg = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1280.000000pt' height='1248.000000pt' viewBox='-384 -374 2048 2048' preserveAspectRatio='xMidYMid meet'%3E%3Cg transform='translate(0.000000,1248.000000) scale(0.100000,-0.100000)'\n" +
|
|
2
|
+
"fill='%23fff' stroke='none'%3E%3Cpath d='M6005 12474 c-22 -2 -89 -9 -149 -14 -542 -53 -1087 -253 -1556 -571\n" +
|
|
3
|
+
"-1089 -738 -1659 -2029 -1470 -3331 117 -802 507 -1518 1129 -2075 454 -406\n" +
|
|
4
|
+
"1057 -697 1666 -802 220 -39 317 -46 595 -46 278 0 375 7 595 46 1218 211\n" +
|
|
5
|
+
"2250 1096 2647 2269 353 1043 189 2180 -442 3075 -568 804 -1437 1318 -2425\n" +
|
|
6
|
+
"1435 -92 11 -518 21 -590 14z'/%3E%3Cpath d='M8585 5886 c-478 -363 -1085 -626 -1687 -730 -247 -43 -348 -51 -678\n" +
|
|
7
|
+
"-51 -319 0 -364 3 -612 41 -586 88 -1171 326 -1668 676 l-114 81 -106 -17\n" +
|
|
8
|
+
"c-58 -10 -181 -38 -275 -61 -807 -204 -1528 -616 -2120 -1210 -726 -728 -1170\n" +
|
|
9
|
+
"-1655 -1297 -2704 -29 -238 -32 -741 -5 -930 53 -378 142 -589 320 -758 171\n" +
|
|
10
|
+
"-163 421 -234 772 -220 269 11 533 55 1230 208 817 179 1195 244 1690 291 205\n" +
|
|
11
|
+
"19 4525 19 4730 0 495 -47 873 -112 1690 -291 697 -153 961 -197 1230 -208\n" +
|
|
12
|
+
"254 -10 438 21 605 103 172 84 315 254 390 463 74 203 108 420 117 736 34\n" +
|
|
13
|
+
"1230 -451 2439 -1332 3320 -707 707 -1608 1156 -2597 1294 -206 29 -201 30\n" +
|
|
14
|
+
"-283 -33z'/%3E%3C/g%3E%3C/svg%3E";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {type SFCWithInstall, withInstall} from "../../utils/install";
|
|
2
|
-
import Avatar from "./JaAvatar.vue";
|
|
3
|
-
|
|
4
|
-
export const JaAvatar: SFCWithInstall<typeof Avatar> = withInstall(Avatar);
|
|
5
|
-
|
|
6
|
-
export * from "./avatarToken";
|
|
7
|
-
|
|
1
|
+
import {type SFCWithInstall, withInstall} from "../../utils/install";
|
|
2
|
+
import Avatar from "./JaAvatar.vue";
|
|
3
|
+
|
|
4
|
+
export const JaAvatar: SFCWithInstall<typeof Avatar> = withInstall(Avatar);
|
|
5
|
+
|
|
6
|
+
export * from "./avatarToken";
|
|
7
|
+
|