@jari-ace/element-plus-component 0.4.3 → 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.3",
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",
@@ -46,6 +46,7 @@ import {
46
46
  ElTooltip
47
47
  } from "element-plus";
48
48
  import type { AceFile } from "./types";
49
+ import { fa } from "element-plus/es/locales.mjs";
49
50
 
50
51
  const props = defineProps<{
51
52
  /**
@@ -419,69 +420,84 @@ async function downloadAll() {
419
420
  }
420
421
 
421
422
  function checkAllowUpload() {
422
- if (props.allowUpload == undefined) {
423
- const cfg = uploadInitParams.value?.fileConfig;
424
- if (cfg) {
425
- let hasRole = true;
426
- if (cfg.uploadAuthCode) {
427
- const login = useLoginUser();
428
- if (login) {
429
- hasRole = login.hasRole(cfg.uploadAuthCode);
430
- }
431
- 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);
432
434
  }
433
- return !cfg.disallowUpload;
435
+ console.log('hasRole = ', hasRole)
436
+ console.log('final upload auth: ', !cfg.disallowUpload && hasRole)
437
+ return !cfg.disallowUpload && hasRole;
434
438
  }
435
- console.log('file cfg is null')
439
+ return !cfg.disallowUpload;
436
440
  }
437
- return props.allowUpload;
441
+ console.log('file cfg ' + props.configKey + ' does not exists')
442
+ return !!props.allowUpload;
438
443
  }
439
444
 
440
445
  function checkAllowDownload() {
441
- if (props.allowDownload == undefined) {
442
- const cfg = uploadInitParams.value?.fileConfig;
443
- if (cfg) {
444
- let hasRole = true;
445
- if (cfg.downloadAuthCode) {
446
- const login = useLoginUser();
447
- if (login) {
448
- hasRole = login.hasRole(cfg.downloadAuthCode);
449
- }
450
- 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);
451
457
  }
452
- return !cfg.disallowDownload;
458
+ console.log('hasRole = ', hasRole)
459
+ console.log('final download auth: ', !cfg.disallowDownload && hasRole)
460
+ return !cfg.disallowDownload && hasRole;
453
461
  }
462
+ return !cfg.disallowDownload;
454
463
  }
455
- return props.allowDownload;
464
+ return !!props.allowDownload;
456
465
  }
457
466
 
458
467
  function checkAllowDelete() {
459
- if (props.allowDelete == undefined) {
460
- const cfg = uploadInitParams.value?.fileConfig;
461
- if (cfg) {
462
- let hasRole = true;
463
- if (cfg.deleteAuthCode) {
464
- const login = useLoginUser();
465
- if (login) {
466
- hasRole = login.hasRole(cfg.deleteAuthCode);
467
- }
468
- 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);
469
479
  }
470
- return !cfg.disallowDelete;
480
+ console.log('hasRole = ', hasRole)
481
+ console.log('final delete auth: ', !cfg.disallowDelete && hasRole)
482
+ return !cfg.disallowDelete && hasRole;
471
483
  }
484
+ return !cfg.disallowDelete;
472
485
  }
473
- return props.allowDelete;
486
+ return !!props.allowDelete;
474
487
  }
475
488
 
476
489
  function checkAllowPreview(file: FileInfo) {
477
- if (props.allowPreview == undefined) {
478
- const cfg = uploadInitParams.value?.fileConfig;
479
- if (cfg) {
480
- if (cfg.disablePreview) {
481
- return false;
482
- }
483
- 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;
484
497
  }
498
+ console.log("file name: ", file.fileName)
499
+ console.log("可预览类型:", previewableFileExts)
500
+ return previewableFileExts.some(ext => file.fileName.endsWith(ext));
485
501
  }
486
502
  return props.allowPreview;
487
503
  }