@jari-ace/element-plus-component 0.3.3 → 0.4.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/dist/components/upload/FilePreviewer.vue.d.ts +59 -0
- package/dist/components/upload/FilePreviewer.vue.d.ts.map +1 -0
- package/dist/components/upload/FilePreviewer.vue.js +169 -0
- package/dist/components/upload/FilePreviewer.vue.js.map +1 -0
- package/dist/components/upload/JaUploader.vue.d.ts +8 -0
- package/dist/components/upload/JaUploader.vue.d.ts.map +1 -1
- package/dist/components/upload/index.d.ts +35 -0
- package/dist/components/upload/index.d.ts.map +1 -1
- package/dist/components/upload/index.js +2 -0
- package/dist/components/upload/index.js.map +1 -1
- package/dist/components/upload/uploader.vue.d.ts +5 -0
- package/dist/components/upload/uploader.vue.d.ts.map +1 -1
- package/dist/components/upload/uploader.vue.js +14 -4
- package/dist/components/upload/uploader.vue.js.map +1 -1
- package/dist/components/userPicker/src/JaUserList.vue.d.ts +4 -0
- package/dist/components/userPicker/src/JaUserList.vue.d.ts.map +1 -1
- package/dist/components/userPicker/src/JaUserList.vue.js +9 -1
- package/dist/components/userPicker/src/JaUserList.vue.js.map +1 -1
- package/dist/components/userPicker/src/UserPicker.vue.d.ts +10 -0
- package/dist/components/userPicker/src/UserPicker.vue.d.ts.map +1 -1
- package/dist/components/userPicker/src/UserPicker.vue.js +46 -5
- package/dist/components/userPicker/src/UserPicker.vue.js.map +1 -1
- package/dist/components/userSelectDialog/src/userSelectDialog.vue.d.ts +19 -2
- package/dist/components/userSelectDialog/src/userSelectDialog.vue.d.ts.map +1 -1
- package/dist/components/userSelectDialog/src/userSelectDialog.vue.js +58 -12
- package/dist/components/userSelectDialog/src/userSelectDialog.vue.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/index.js +6654 -6476
- package/lib/index.umd.cjs +31 -26
- package/package.json +1 -1
- package/packages/components/upload/FilePreviewer.vue +245 -0
- package/packages/components/upload/index.ts +2 -0
- package/packages/components/upload/uploader.vue +68 -55
- package/packages/components/userPicker/src/JaUserList.vue +14 -2
- package/packages/components/userPicker/src/UserPicker.vue +47 -4
- package/packages/components/userSelectDialog/src/userSelectDialog.vue +44 -7
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
ElButton,
|
|
4
4
|
ElIcon,
|
|
5
5
|
ElInput,
|
|
6
|
+
ElMessage,
|
|
6
7
|
ElPopover,
|
|
7
8
|
ElText,
|
|
8
9
|
ElSpace,
|
|
@@ -79,7 +80,15 @@ const props = withDefaults( defineProps<{
|
|
|
79
80
|
/**
|
|
80
81
|
* 是否显示已选用户标签
|
|
81
82
|
*/
|
|
82
|
-
showUserTag?:boolean
|
|
83
|
+
showUserTag?:boolean,
|
|
84
|
+
/**
|
|
85
|
+
* 最多选择数量,为0则不限制
|
|
86
|
+
*/
|
|
87
|
+
maxSelect?:number,
|
|
88
|
+
/**
|
|
89
|
+
* 是否禁用
|
|
90
|
+
*/
|
|
91
|
+
disabled?:boolean
|
|
83
92
|
|
|
84
93
|
}>(),{
|
|
85
94
|
trigger:'hover',
|
|
@@ -89,6 +98,8 @@ const props = withDefaults( defineProps<{
|
|
|
89
98
|
maxShowCount: 20,
|
|
90
99
|
maxHeight: '100%',
|
|
91
100
|
showUserTag: true,
|
|
101
|
+
maxSelect: 0,
|
|
102
|
+
disabled: false,
|
|
92
103
|
})
|
|
93
104
|
|
|
94
105
|
// const props = defineProps({
|
|
@@ -183,6 +194,14 @@ function switchUserSelect(u: UserReference) {
|
|
|
183
194
|
}
|
|
184
195
|
const index = selectedUsers.value.findIndex(su => su.id == u.id);
|
|
185
196
|
if (index < 0) {
|
|
197
|
+
if (props.maxSelect > 0 && selectedUsers.value.length >= props.maxSelect) {
|
|
198
|
+
ElMessage({
|
|
199
|
+
message: `已超过最大选择数量 ${props.maxSelect}`,
|
|
200
|
+
plain: true,
|
|
201
|
+
type: 'warning',
|
|
202
|
+
})
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
186
205
|
selectedUsers.value.push(u);
|
|
187
206
|
} else {
|
|
188
207
|
selectedUsers.value.splice(index, 1);
|
|
@@ -230,6 +249,9 @@ function onSaveToCustomGroupClick() {
|
|
|
230
249
|
}
|
|
231
250
|
|
|
232
251
|
function onDeselected(uid?: string) {
|
|
252
|
+
if (props.disabled) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
233
255
|
if (Array.isArray(selectedUsers.value)) {
|
|
234
256
|
const index = selectedUsers.value.findIndex(su => su.id == uid);
|
|
235
257
|
if (index >= 0) {
|
|
@@ -255,6 +277,9 @@ function onInputKeyEnter() {
|
|
|
255
277
|
}
|
|
256
278
|
|
|
257
279
|
function popup() {
|
|
280
|
+
if (props.disabled) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
258
283
|
popoverVisible.value = true;
|
|
259
284
|
}
|
|
260
285
|
|
|
@@ -262,7 +287,15 @@ function selectAll() {
|
|
|
262
287
|
const arr = (
|
|
263
288
|
selectedUsers.value as UserReference[]
|
|
264
289
|
);
|
|
265
|
-
|
|
290
|
+
const availableUsers = users.value.filter(u => !arr.some(su => su.id === u.id));
|
|
291
|
+
if (props.maxSelect > 0) {
|
|
292
|
+
const remaining = props.maxSelect - arr.length;
|
|
293
|
+
if (remaining > 0) {
|
|
294
|
+
arr.push(...availableUsers.slice(0, remaining));
|
|
295
|
+
}
|
|
296
|
+
} else {
|
|
297
|
+
arr.push(...availableUsers);
|
|
298
|
+
}
|
|
266
299
|
}
|
|
267
300
|
|
|
268
301
|
function clearSelection() {
|
|
@@ -292,11 +325,17 @@ const selectedForBinding = computed(() => {
|
|
|
292
325
|
})
|
|
293
326
|
|
|
294
327
|
function showUserSelectDialog() {
|
|
328
|
+
if (props.disabled) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
295
331
|
dialogUserSelector.value?.show();
|
|
296
332
|
popoverVisible.value = false;
|
|
297
333
|
}
|
|
298
334
|
|
|
299
335
|
function handleMouseOver() {
|
|
336
|
+
if (props.disabled) {
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
300
339
|
popoverVisible.value = true
|
|
301
340
|
}
|
|
302
341
|
|
|
@@ -314,12 +353,13 @@ watch(()=>props.classificationLevel, ()=>{
|
|
|
314
353
|
<template>
|
|
315
354
|
<ja-scrollbar :max-height="props.maxHeight" :height="props.height" v-bind="$attrs"
|
|
316
355
|
style="overflow-x: hidden;">
|
|
317
|
-
<div class="ja-user-picker__root" v-shortcut:[props.shortcut]="popup">
|
|
356
|
+
<div class="ja-user-picker__root" v-shortcut:[props.shortcut]="!props.disabled ? popup : undefined">
|
|
318
357
|
|
|
319
358
|
<el-popover ref="bookmarkDropdown" @show="onPopoverShow" @hide="onPopoverHide"
|
|
320
359
|
v-model:visible="popoverVisible"
|
|
321
360
|
width="auto" teleported
|
|
322
361
|
:trigger="props.trigger"
|
|
362
|
+
:disabled="props.disabled"
|
|
323
363
|
>
|
|
324
364
|
<template #reference>
|
|
325
365
|
<div style="display: flex;align-items: center;">
|
|
@@ -327,6 +367,7 @@ watch(()=>props.classificationLevel, ()=>{
|
|
|
327
367
|
v-if="$slots.default"
|
|
328
368
|
name="default"></slot>
|
|
329
369
|
<el-button v-else circle :icon="Plus" :size="'small'" ref="btn"
|
|
370
|
+
:disabled="props.disabled"
|
|
330
371
|
@mouseover="handleMouseOver">
|
|
331
372
|
</el-button>
|
|
332
373
|
</div>
|
|
@@ -394,6 +435,7 @@ watch(()=>props.classificationLevel, ()=>{
|
|
|
394
435
|
v-model="selectedUsers"
|
|
395
436
|
v-model:page="pageParams.currentPage"
|
|
396
437
|
:multiple="props.multiple"
|
|
438
|
+
:maxSelect="props.maxSelect"
|
|
397
439
|
@item-clicked="onArrowKeyDown"
|
|
398
440
|
@arrow-key-down="onArrowKeyDown"></ja-user-list>
|
|
399
441
|
</div>
|
|
@@ -401,7 +443,7 @@ watch(()=>props.classificationLevel, ()=>{
|
|
|
401
443
|
</el-popover>
|
|
402
444
|
<div v-if="props.showUserTag" class="ja-user-picker__tag-container">
|
|
403
445
|
<ja-user-info-tag v-for="u in selectedUsersForRender" :key="u.id" :user-id="u.id"
|
|
404
|
-
:full-name="u.fullName" closable :has-avatar="u.hasAvatar"
|
|
446
|
+
:full-name="u.fullName" :closable="!props.disabled" :has-avatar="u.hasAvatar"
|
|
405
447
|
@closed="onDeselected">
|
|
406
448
|
</ja-user-info-tag>
|
|
407
449
|
<div class="more-tag" v-if="selectedForBinding.length > props.maxShowCount">
|
|
@@ -417,6 +459,7 @@ watch(()=>props.classificationLevel, ()=>{
|
|
|
417
459
|
:realm-id="localRealmId"
|
|
418
460
|
:classificationLevel="props.classificationLevel"
|
|
419
461
|
:customFilter="props.customFilter"
|
|
462
|
+
:maxSelect="props.maxSelect"
|
|
420
463
|
v-model="selectedUsers"></ja-user-select-dialog>
|
|
421
464
|
</div>
|
|
422
465
|
</ja-scrollbar>
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
ElDialog,
|
|
4
4
|
ElIcon,
|
|
5
|
+
ElMessage,
|
|
5
6
|
ElTableV2,
|
|
6
7
|
ElText,
|
|
7
8
|
ElTabs,
|
|
@@ -51,14 +52,18 @@ const props = defineProps({
|
|
|
51
52
|
/**
|
|
52
53
|
* 密级过滤
|
|
53
54
|
*/
|
|
54
|
-
classificationLevel: {type: Number, required: false, default:
|
|
55
|
+
classificationLevel: {type: Number, required: false, default: 0},
|
|
55
56
|
/**
|
|
56
57
|
* 自定义筛选过滤条件,可以在此回调方法内使用qUser参数构造自定义的查询条件。例如 qUser => qUser.fullName.startWith('王')
|
|
57
58
|
*/
|
|
58
59
|
customFilter: {
|
|
59
60
|
type: Function as PropType<(qUser: InstanceType<typeof QUser>) => BooleanResultExpression>,
|
|
60
61
|
required: false
|
|
61
|
-
}
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* 最多选择数量,为0则不限制
|
|
65
|
+
*/
|
|
66
|
+
maxSelect: {type: Number, required: false, default: 0}
|
|
62
67
|
})
|
|
63
68
|
const selectedUsers = defineModel<UserReference[] | UserReference | null>({
|
|
64
69
|
required: true
|
|
@@ -212,6 +217,14 @@ function switchUserSelect(user: UserReference) {
|
|
|
212
217
|
map.delete(user.id);
|
|
213
218
|
tempSel.value.splice(index, 1);
|
|
214
219
|
} else {
|
|
220
|
+
if (props.maxSelect > 0 && tempSel.value.length >= props.maxSelect) {
|
|
221
|
+
ElMessage({
|
|
222
|
+
message: `已超过最大选择数量 ${props.maxSelect}`,
|
|
223
|
+
type: 'warning',
|
|
224
|
+
plain: true,
|
|
225
|
+
})
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
215
228
|
map.set(user.id, user)
|
|
216
229
|
tempSel.value.push(user);
|
|
217
230
|
}
|
|
@@ -231,8 +244,17 @@ onUnmounted(() => {
|
|
|
231
244
|
function selectAll() {
|
|
232
245
|
if (Array.isArray(tempSel.value)) {
|
|
233
246
|
const users = userQuery.queryResult.value.users.filter(u => !userSelected(u));
|
|
234
|
-
|
|
235
|
-
|
|
247
|
+
if (props.maxSelect > 0) {
|
|
248
|
+
const remaining = props.maxSelect - tempSel.value.length;
|
|
249
|
+
if (remaining > 0) {
|
|
250
|
+
const usersToAdd = users.slice(0, remaining);
|
|
251
|
+
usersToAdd.forEach(u => map.set(u.id, u))
|
|
252
|
+
tempSel.value.push(...usersToAdd);
|
|
253
|
+
}
|
|
254
|
+
} else {
|
|
255
|
+
users.forEach(u => map.set(u.id, u))
|
|
256
|
+
tempSel.value.push(...users);
|
|
257
|
+
}
|
|
236
258
|
}
|
|
237
259
|
}
|
|
238
260
|
|
|
@@ -247,13 +269,28 @@ function inverseSelection() {
|
|
|
247
269
|
if (Array.isArray(tempSel.value)) {
|
|
248
270
|
const users = userQuery.queryResult.value.users.filter(u => !userSelected(u))
|
|
249
271
|
map.clear();
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
272
|
+
if (props.maxSelect > 0) {
|
|
273
|
+
const usersToAdd = users.slice(0, props.maxSelect);
|
|
274
|
+
usersToAdd.forEach(u => map.set(u.id, u))
|
|
275
|
+
tempSel.value.splice(0);
|
|
276
|
+
tempSel.value.push(...usersToAdd);
|
|
277
|
+
} else {
|
|
278
|
+
users.forEach(u => map.set(u.id, u))
|
|
279
|
+
tempSel.value.splice(0);
|
|
280
|
+
tempSel.value.push(...users);
|
|
281
|
+
}
|
|
253
282
|
}
|
|
254
283
|
}
|
|
255
284
|
|
|
256
285
|
function onConfirm() {
|
|
286
|
+
if (props.multiple && Array.isArray(tempSel.value) && props.maxSelect > 0 && tempSel.value.length > props.maxSelect) {
|
|
287
|
+
ElMessage({
|
|
288
|
+
message: `已超过最大选择数量 ${props.maxSelect}`,
|
|
289
|
+
type: 'warning',
|
|
290
|
+
plain: true,
|
|
291
|
+
})
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
257
294
|
selectedUsers.value = tempSel.value;
|
|
258
295
|
visible.value = false;
|
|
259
296
|
}
|