@jari-ace/element-plus-component 0.1.9 → 0.2.0
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 +18 -18
- 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/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 +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/index.js +740 -723
- 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 -186
- package/packages/components/form/index.ts +5 -5
- package/packages/components/form/types.ts +4 -4
- package/packages/components/formItem/JaFormItem.vue +68 -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 +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/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 +21 -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
|
@@ -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;
|
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
createAxiosWithoutCache,
|
|
4
|
-
type CreateAppMessageBundleCommand, useAppMessageApi, type AppInstance
|
|
5
|
-
} from "@jari-ace/app-bolts";
|
|
6
|
-
import {ref, watch} from 'vue'
|
|
7
|
-
import {useAppInstances} from "../../hooks/useAppInstances";
|
|
8
|
-
import {ElDrawer, ElForm, ElFormItem, ElInput, ElButton} from "element-plus";
|
|
9
|
-
import {JaButton} from "../button";
|
|
10
|
-
|
|
11
|
-
const visible = defineModel<boolean>({
|
|
12
|
-
default: false,
|
|
13
|
-
required: true
|
|
14
|
-
});
|
|
15
|
-
const props = defineProps<{
|
|
16
|
-
appId: string,
|
|
17
|
-
preKey?: string
|
|
18
|
-
}>();
|
|
19
|
-
const axios = createAxiosWithoutCache();
|
|
20
|
-
const api = useAppMessageApi(axios);
|
|
21
|
-
const app = ref<AppInstance>();
|
|
22
|
-
const key = ref("");
|
|
23
|
-
const messages = ref<Record<string, string>>({})
|
|
24
|
-
const emits = defineEmits(["success"])
|
|
25
|
-
const appInstances = await useAppInstances();
|
|
26
|
-
|
|
27
|
-
function onOpen() {
|
|
28
|
-
loadApp();
|
|
29
|
-
key.value = props.preKey ?? "";
|
|
30
|
-
messages.value = {};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
async function onSubmit() {
|
|
34
|
-
const cmd = {
|
|
35
|
-
key: key.value,
|
|
36
|
-
messages: messages.value,
|
|
37
|
-
appInstance: {
|
|
38
|
-
id: props.appId
|
|
39
|
-
}
|
|
40
|
-
} as CreateAppMessageBundleCommand;
|
|
41
|
-
await api.createBundle(cmd);
|
|
42
|
-
visible.value = false;
|
|
43
|
-
emits('success', key.value);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
async function loadApp() {
|
|
47
|
-
app.value = await appInstances.getById(props.appId)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
watch(() => props.appId, async () => {
|
|
51
|
-
await loadApp();
|
|
52
|
-
})
|
|
53
|
-
</script>
|
|
54
|
-
|
|
55
|
-
<template>
|
|
56
|
-
<el-drawer destroy-on-close append-to-body v-model="visible"
|
|
57
|
-
title="创建国际化文本" @open="onOpen">
|
|
58
|
-
<el-form label-position="top" size="default">
|
|
59
|
-
<el-form-item label="文本键" required>
|
|
60
|
-
<el-input v-model="key" v-focus></el-input>
|
|
61
|
-
</el-form-item>
|
|
62
|
-
<el-form-item v-for="l in app?.supportedLocales" :key="l" :label="l">
|
|
63
|
-
<el-input type="textarea" :rows="4" v-model="messages[l]"></el-input>
|
|
64
|
-
</el-form-item>
|
|
65
|
-
</el-form>
|
|
66
|
-
<template #footer>
|
|
67
|
-
<ja-button size="default" shortcut="Alt+Enter" type="primary" @click="onSubmit">确定
|
|
68
|
-
</ja-button>
|
|
69
|
-
<el-button size="default" plain @click="visible = false">取消</el-button>
|
|
70
|
-
</template>
|
|
71
|
-
</el-drawer>
|
|
72
|
-
</template>
|
|
73
|
-
|
|
74
|
-
<style scoped lang="scss">
|
|
75
|
-
|
|
76
|
-
</style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
createAxiosWithoutCache,
|
|
4
|
+
type CreateAppMessageBundleCommand, useAppMessageApi, type AppInstance
|
|
5
|
+
} from "@jari-ace/app-bolts";
|
|
6
|
+
import {ref, watch} from 'vue'
|
|
7
|
+
import {useAppInstances} from "../../hooks/useAppInstances";
|
|
8
|
+
import {ElDrawer, ElForm, ElFormItem, ElInput, ElButton} from "element-plus";
|
|
9
|
+
import {JaButton} from "../button";
|
|
10
|
+
|
|
11
|
+
const visible = defineModel<boolean>({
|
|
12
|
+
default: false,
|
|
13
|
+
required: true
|
|
14
|
+
});
|
|
15
|
+
const props = defineProps<{
|
|
16
|
+
appId: string,
|
|
17
|
+
preKey?: string
|
|
18
|
+
}>();
|
|
19
|
+
const axios = createAxiosWithoutCache();
|
|
20
|
+
const api = useAppMessageApi(axios);
|
|
21
|
+
const app = ref<AppInstance>();
|
|
22
|
+
const key = ref("");
|
|
23
|
+
const messages = ref<Record<string, string>>({})
|
|
24
|
+
const emits = defineEmits(["success"])
|
|
25
|
+
const appInstances = await useAppInstances();
|
|
26
|
+
|
|
27
|
+
function onOpen() {
|
|
28
|
+
loadApp();
|
|
29
|
+
key.value = props.preKey ?? "";
|
|
30
|
+
messages.value = {};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async function onSubmit() {
|
|
34
|
+
const cmd = {
|
|
35
|
+
key: key.value,
|
|
36
|
+
messages: messages.value,
|
|
37
|
+
appInstance: {
|
|
38
|
+
id: props.appId
|
|
39
|
+
}
|
|
40
|
+
} as CreateAppMessageBundleCommand;
|
|
41
|
+
await api.createBundle(cmd);
|
|
42
|
+
visible.value = false;
|
|
43
|
+
emits('success', key.value);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async function loadApp() {
|
|
47
|
+
app.value = await appInstances.getById(props.appId)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
watch(() => props.appId, async () => {
|
|
51
|
+
await loadApp();
|
|
52
|
+
})
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<template>
|
|
56
|
+
<el-drawer destroy-on-close append-to-body v-model="visible"
|
|
57
|
+
title="创建国际化文本" @open="onOpen">
|
|
58
|
+
<el-form label-position="top" size="default">
|
|
59
|
+
<el-form-item label="文本键" required>
|
|
60
|
+
<el-input v-model="key" v-focus></el-input>
|
|
61
|
+
</el-form-item>
|
|
62
|
+
<el-form-item v-for="l in app?.supportedLocales" :key="l" :label="l">
|
|
63
|
+
<el-input type="textarea" :rows="4" v-model="messages[l]"></el-input>
|
|
64
|
+
</el-form-item>
|
|
65
|
+
</el-form>
|
|
66
|
+
<template #footer>
|
|
67
|
+
<ja-button size="default" shortcut="Alt+Enter" type="primary" @click="onSubmit">确定
|
|
68
|
+
</ja-button>
|
|
69
|
+
<el-button size="default" plain @click="visible = false">取消</el-button>
|
|
70
|
+
</template>
|
|
71
|
+
</el-drawer>
|
|
72
|
+
</template>
|
|
73
|
+
|
|
74
|
+
<style scoped lang="scss">
|
|
75
|
+
|
|
76
|
+
</style>
|