@jari-ace/element-plus-component 0.4.2 → 0.4.4

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jari-ace/element-plus-component",
3
3
  "private": false,
4
- "version": "0.4.2",
4
+ "version": "0.4.4",
5
5
  "main": "lib/index.umd.cjs",
6
6
  "module": "lib/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  "animate.css": "^4.1.1",
26
26
  "pretty-bytes": "^7.1.0",
27
27
  "vue-pdf-embed": "^2.1.3",
28
- "@jari-ace/app-bolts": "0.6.3"
28
+ "@jari-ace/app-bolts": "0.6.4"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/lodash-es": "^4.17.12",
@@ -42,9 +42,11 @@ import {
42
42
  ElDropdownItem,
43
43
  ElDropdownMenu,
44
44
  ElIcon,
45
- ElTag
45
+ ElTag,
46
+ ElTooltip
46
47
  } from "element-plus";
47
48
  import type { AceFile } from "./types";
49
+ import { fa } from "element-plus/es/locales.mjs";
48
50
 
49
51
  const props = defineProps<{
50
52
  /**
@@ -418,69 +420,84 @@ async function downloadAll() {
418
420
  }
419
421
 
420
422
  function checkAllowUpload() {
421
- if (props.allowUpload == undefined) {
422
- const cfg = uploadInitParams.value?.fileConfig;
423
- if (cfg) {
424
- let hasRole = true;
425
- if (cfg.uploadAuthCode) {
426
- const login = useLoginUser();
427
- if (login) {
428
- hasRole = login.hasRole(cfg.uploadAuthCode);
429
- }
430
- return !cfg.disallowUpload && hasRole;
423
+ console.log('ja-uploader 上传权限调试:')
424
+ console.log('props.allowUpload = ', props.allowUpload)
425
+ if (props.allowUpload === false) return false;
426
+ const cfg = uploadInitParams.value?.fileConfig;
427
+ if (cfg) {
428
+ let hasRole = true;
429
+ console.log('cfg.uploadAuthCode = ', cfg.uploadAuthCode)
430
+ if (cfg.uploadAuthCode) {
431
+ const login = useLoginUser();
432
+ if (login) {
433
+ hasRole = login.hasRole(cfg.uploadAuthCode);
431
434
  }
432
- return !cfg.disallowUpload;
435
+ console.log('hasRole = ', hasRole)
436
+ console.log('final upload auth: ', !cfg.disallowUpload && hasRole)
437
+ return !cfg.disallowUpload && hasRole;
433
438
  }
434
- console.log('file cfg is null')
439
+ return !cfg.disallowUpload;
435
440
  }
436
- return props.allowUpload;
441
+ console.log('file cfg ' + props.configKey + ' does not exists')
442
+ return !!props.allowUpload;
437
443
  }
438
444
 
439
445
  function checkAllowDownload() {
440
- if (props.allowDownload == undefined) {
441
- const cfg = uploadInitParams.value?.fileConfig;
442
- if (cfg) {
443
- let hasRole = true;
444
- if (cfg.downloadAuthCode) {
445
- const login = useLoginUser();
446
- if (login) {
447
- hasRole = login.hasRole(cfg.downloadAuthCode);
448
- }
449
- return !cfg.disallowDownload && hasRole;
446
+ console.log('ja-uploader 下载权限调试:')
447
+ console.log('props.allowDownload = ', props.allowDownload)
448
+ if (props.allowDownload === false) return false;
449
+ const cfg = uploadInitParams.value?.fileConfig;
450
+ if (cfg) {
451
+ let hasRole = true;
452
+ console.log('cfg.uploadAuthCode = ', cfg.uploadAuthCode)
453
+ if (cfg.downloadAuthCode) {
454
+ const login = useLoginUser();
455
+ if (login) {
456
+ hasRole = login.hasRole(cfg.downloadAuthCode);
450
457
  }
451
- return !cfg.disallowDownload;
458
+ console.log('hasRole = ', hasRole)
459
+ console.log('final download auth: ', !cfg.disallowDownload && hasRole)
460
+ return !cfg.disallowDownload && hasRole;
452
461
  }
462
+ return !cfg.disallowDownload;
453
463
  }
454
- return props.allowDownload;
464
+ return !!props.allowDownload;
455
465
  }
456
466
 
457
467
  function checkAllowDelete() {
458
- if (props.allowDelete == undefined) {
459
- const cfg = uploadInitParams.value?.fileConfig;
460
- if (cfg) {
461
- let hasRole = true;
462
- if (cfg.deleteAuthCode) {
463
- const login = useLoginUser();
464
- if (login) {
465
- hasRole = login.hasRole(cfg.deleteAuthCode);
466
- }
467
- return !cfg.disallowDelete && hasRole;
468
+ console.log('ja-uploader 删除权限调试:')
469
+ console.log('props.allowDelete = ', props.allowDelete)
470
+ if (props.allowDelete === false) return false;
471
+ const cfg = uploadInitParams.value?.fileConfig;
472
+ if (cfg) {
473
+ let hasRole = true;
474
+ console.log('cfg.deleteAuthCode = ', cfg.deleteAuthCode)
475
+ if (cfg.deleteAuthCode) {
476
+ const login = useLoginUser();
477
+ if (login) {
478
+ hasRole = login.hasRole(cfg.deleteAuthCode);
468
479
  }
469
- return !cfg.disallowDelete;
480
+ console.log('hasRole = ', hasRole)
481
+ console.log('final delete auth: ', !cfg.disallowDelete && hasRole)
482
+ return !cfg.disallowDelete && hasRole;
470
483
  }
484
+ return !cfg.disallowDelete;
471
485
  }
472
- return props.allowDelete;
486
+ return !!props.allowDelete;
473
487
  }
474
488
 
475
489
  function checkAllowPreview(file: FileInfo) {
476
- if (props.allowPreview == undefined) {
477
- const cfg = uploadInitParams.value?.fileConfig;
478
- if (cfg) {
479
- if (cfg.disablePreview) {
480
- return false;
481
- }
482
- return previewableFileExts.some(ext => file.fileName.endsWith(ext));
490
+ console.log('ja-uploader 预览权限调试:')
491
+ console.log('props.allowPreview = ', props.allowPreview)
492
+ if (props.allowPreview === false) return false;
493
+ const cfg = uploadInitParams.value?.fileConfig;
494
+ if (cfg) {
495
+ if (cfg.disablePreview) {
496
+ return false;
483
497
  }
498
+ console.log("file name: ", file.fileName)
499
+ console.log("可预览类型:", previewableFileExts)
500
+ return previewableFileExts.some(ext => file.fileName.endsWith(ext));
484
501
  }
485
502
  return props.allowPreview;
486
503
  }