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

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.
Files changed (124) hide show
  1. package/dist/components/autoComplete/JaAutoComplete.vue.d.ts +543 -686
  2. package/dist/components/autoComplete/JaAutoComplete.vue.d.ts.map +1 -1
  3. package/dist/components/autoComplete/JaAutoComplete.vue.js +10 -2
  4. package/dist/components/autoComplete/JaAutoComplete.vue.js.map +1 -1
  5. package/dist/components/avatar/JaAvatar.vue.d.ts +4 -3
  6. package/dist/components/avatar/JaAvatar.vue.d.ts.map +1 -1
  7. package/dist/components/avatar/JaAvatar.vue.js +10 -2
  8. package/dist/components/avatar/JaAvatar.vue.js.map +1 -1
  9. package/dist/components/button/JaButton.vue.d.ts +184 -250
  10. package/dist/components/button/JaButton.vue.d.ts.map +1 -1
  11. package/dist/components/button/JaButton.vue.js +11 -3
  12. package/dist/components/button/JaButton.vue.js.map +1 -1
  13. package/dist/components/checkbox/JaCheckbox.vue.d.ts +164 -1068
  14. package/dist/components/checkbox/JaCheckbox.vue.d.ts.map +1 -1
  15. package/dist/components/checkbox/JaCheckbox.vue.js +9 -24
  16. package/dist/components/checkbox/JaCheckbox.vue.js.map +1 -1
  17. package/dist/components/checkboxGroup/JaCheckboxGroup.vue.d.ts +158 -163
  18. package/dist/components/checkboxGroup/JaCheckboxGroup.vue.d.ts.map +1 -1
  19. package/dist/components/checkboxGroup/JaCheckboxGroup.vue.js +14 -5
  20. package/dist/components/checkboxGroup/JaCheckboxGroup.vue.js.map +1 -1
  21. package/dist/components/datePicker/JaDatePicker.vue.d.ts +7 -4
  22. package/dist/components/datePicker/JaDatePicker.vue.d.ts.map +1 -1
  23. package/dist/components/datePicker/JaDatePicker.vue.js +18 -7
  24. package/dist/components/datePicker/JaDatePicker.vue.js.map +1 -1
  25. package/dist/components/dropdownButton/JaDropdownButton.vue.d.ts +324 -399
  26. package/dist/components/dropdownButton/JaDropdownButton.vue.d.ts.map +1 -1
  27. package/dist/components/dropdownButton/JaDropdownButton.vue.js +4 -2
  28. package/dist/components/dropdownButton/JaDropdownButton.vue.js.map +1 -1
  29. package/dist/components/form/JaForm.vue.d.ts +52 -3
  30. package/dist/components/form/JaForm.vue.d.ts.map +1 -1
  31. package/dist/components/form/JaForm.vue.js +4 -2
  32. package/dist/components/form/JaForm.vue.js.map +1 -1
  33. package/dist/components/formItem/JaFormItem.vue.d.ts +168 -133
  34. package/dist/components/formItem/JaFormItem.vue.d.ts.map +1 -1
  35. package/dist/components/formItem/JaFormItem.vue.js.map +1 -1
  36. package/dist/components/input/JaInput.vue.d.ts +274 -421
  37. package/dist/components/input/JaInput.vue.d.ts.map +1 -1
  38. package/dist/components/input/JaInput.vue.js +20 -60
  39. package/dist/components/input/JaInput.vue.js.map +1 -1
  40. package/dist/components/inputI18n/JaInputI18n.vue.d.ts +70 -70
  41. package/dist/components/inputNumber/JaInputNumber.vue.d.ts +203 -217
  42. package/dist/components/inputNumber/JaInputNumber.vue.d.ts.map +1 -1
  43. package/dist/components/inputNumber/JaInputNumber.vue.js +16 -37
  44. package/dist/components/inputNumber/JaInputNumber.vue.js.map +1 -1
  45. package/dist/components/radioGroup/JaRadioGroup.vue.d.ts +148 -121
  46. package/dist/components/radioGroup/JaRadioGroup.vue.d.ts.map +1 -1
  47. package/dist/components/radioGroup/JaRadioGroup.vue.js +14 -5
  48. package/dist/components/radioGroup/JaRadioGroup.vue.js.map +1 -1
  49. package/dist/components/scrollbar/Scrollbar.vue.d.ts +5 -2
  50. package/dist/components/scrollbar/Scrollbar.vue.d.ts.map +1 -1
  51. package/dist/components/scrollbar/Scrollbar.vue.js +11 -3
  52. package/dist/components/scrollbar/Scrollbar.vue.js.map +1 -1
  53. package/dist/components/select/JaSelect.vue.d.ts +70 -70
  54. package/dist/components/select/JaSelect.vue.js +14 -5
  55. package/dist/components/select/JaSelect.vue.js.map +1 -1
  56. package/dist/components/switch/JaSwitch.vue.d.ts +174 -205
  57. package/dist/components/switch/JaSwitch.vue.d.ts.map +1 -1
  58. package/dist/components/switch/JaSwitch.vue.js +13 -4
  59. package/dist/components/switch/JaSwitch.vue.js.map +1 -1
  60. package/dist/components/timePicker/JaTimePicker.vue.d.ts +5 -2
  61. package/dist/components/timePicker/JaTimePicker.vue.d.ts.map +1 -1
  62. package/dist/components/timePicker/JaTimePicker.vue.js +18 -7
  63. package/dist/components/timePicker/JaTimePicker.vue.js.map +1 -1
  64. package/dist/components/tip/index.d.ts +3 -12
  65. package/dist/components/tip/index.d.ts.map +1 -1
  66. package/dist/components/tip/src/AceTip.vue.d.ts +9 -3
  67. package/dist/components/tip/src/AceTip.vue.d.ts.map +1 -1
  68. package/dist/components/tip/src/AceTip.vue.js.map +1 -1
  69. package/dist/components/upload/JaUploader.vue.d.ts +74 -14
  70. package/dist/components/upload/JaUploader.vue.d.ts.map +1 -1
  71. package/dist/components/upload/JaUploader.vue.js +3 -5
  72. package/dist/components/upload/JaUploader.vue.js.map +1 -1
  73. package/dist/components/upload/index.d.ts +79 -25
  74. package/dist/components/upload/index.d.ts.map +1 -1
  75. package/dist/components/upload/uploader.vue.d.ts +16 -0
  76. package/dist/components/upload/uploader.vue.d.ts.map +1 -1
  77. package/dist/components/upload/uploader.vue.js +137 -95
  78. package/dist/components/upload/uploader.vue.js.map +1 -1
  79. package/dist/components/userGroupTree/src/userGroupTree.vue.d.ts +50 -36
  80. package/dist/components/userGroupTree/src/userGroupTree.vue.d.ts.map +1 -1
  81. package/dist/components/userGroupTree/src/userGroupTree.vue.js +26 -1
  82. package/dist/components/userGroupTree/src/userGroupTree.vue.js.map +1 -1
  83. package/lib/index.css +2 -2
  84. package/lib/index.js +8291 -7887
  85. package/lib/index.umd.cjs +36 -36
  86. package/package.json +2 -2
  87. package/packages/components/autoComplete/JaAutoComplete.vue +19 -9
  88. package/packages/components/autoComplete/README.md +35 -0
  89. package/packages/components/avatar/JaAvatar.vue +16 -7
  90. package/packages/components/avatar/README.md +45 -0
  91. package/packages/components/button/JaButton.vue +32 -7
  92. package/packages/components/button/README.md +57 -0
  93. package/packages/components/checkbox/JaCheckbox.vue +15 -25
  94. package/packages/components/checkbox/README.md +21 -0
  95. package/packages/components/checkboxGroup/JaCheckboxGroup.vue +16 -5
  96. package/packages/components/checkboxGroup/README.md +24 -0
  97. package/packages/components/datePicker/JaDatePicker.vue +23 -10
  98. package/packages/components/datePicker/README.md +21 -0
  99. package/packages/components/dropdownButton/JaDropdownButton.vue +25 -7
  100. package/packages/components/dropdownButton/README.md +30 -0
  101. package/packages/components/form/JaForm.vue +60 -20
  102. package/packages/components/form/README.md +30 -0
  103. package/packages/components/formItem/JaFormItem.vue +43 -7
  104. package/packages/components/formItem/README.md +28 -0
  105. package/packages/components/input/JaInput.vue +30 -66
  106. package/packages/components/input/README.md +23 -0
  107. package/packages/components/inputNumber/JaInputNumber.vue +25 -45
  108. package/packages/components/inputNumber/README.md +21 -0
  109. package/packages/components/radioGroup/JaRadioGroup.vue +16 -5
  110. package/packages/components/radioGroup/README.md +24 -0
  111. package/packages/components/scrollbar/README.md +23 -0
  112. package/packages/components/scrollbar/Scrollbar.vue +14 -3
  113. package/packages/components/select/JaSelect.vue +22 -10
  114. package/packages/components/select/README.md +24 -0
  115. package/packages/components/switch/JaSwitch.vue +16 -5
  116. package/packages/components/switch/README.md +21 -0
  117. package/packages/components/timePicker/JaTimePicker.vue +21 -8
  118. package/packages/components/timePicker/README.md +21 -0
  119. package/packages/components/tip/README.md +20 -0
  120. package/packages/components/tip/src/AceTip.vue +10 -2
  121. package/packages/components/upload/JaUploader.vue +9 -8
  122. package/packages/components/upload/README.md +24 -0
  123. package/packages/components/upload/uploader.vue +95 -58
  124. package/packages/components/userGroupTree/src/userGroupTree.vue +9 -2
@@ -1,13 +1,16 @@
1
1
  <script setup lang="ts">
2
2
  import {
3
+ type ClassificationLevel,
3
4
  createAxiosWithoutCache,
4
- type FileInfo, Jari,
5
+ type FileInfo,
6
+ Jari,
7
+ type UploadInitParams,
5
8
  useFilesApi,
6
- useLoginUser,
7
- type ClassificationLevel, type UploadInitParams, useLoading
9
+ useLoading,
10
+ useLoginUser
8
11
  } from "@jari-ace/app-bolts";
9
12
  import { nextTick, onMounted, onUnmounted, ref, watch } from "vue";
10
- import { ArrowDown, Download, Upload } from "@element-plus/icons-vue";
13
+ import { ArrowDown, Download, Upload, WarningFilled } from "@element-plus/icons-vue";
11
14
  import {
12
15
  useSystemClassificationLevelMap,
13
16
  useSystemClassificationLevels
@@ -67,7 +70,23 @@ const props = defineProps<{
67
70
  /**
68
71
  * 文件列表最大高度
69
72
  */
70
- maxHeight?: string | number
73
+ maxHeight?: string | number,
74
+ /**
75
+ * 是否允许上传, 为空表示采用应用里的附件设置
76
+ */
77
+ allowUpload?: boolean,
78
+ /**
79
+ * 是否允许下载,为空表示采用应用里的附件设置
80
+ */
81
+ allowDownload?: boolean,
82
+ /**
83
+ * 是否允许删除,为空表示采用应用里的附件设置
84
+ */
85
+ allowDelete?: boolean,
86
+ /**
87
+ * 是否允许预览,为空表示采用应用里的附件设置
88
+ */
89
+ allowPreview?: boolean,
71
90
  }>();
72
91
  const attachId = defineModel<string>({
73
92
  required: false
@@ -79,6 +98,7 @@ const files = ref<FileInfo[]>([]);
79
98
  const classificationLevels = ref<ClassificationLevel[]>([]);
80
99
  const allowedClassificationLevels = ref<ClassificationLevel[]>([]);
81
100
  const classificationLevelMap = ref<Map<number, string>>();
101
+ const highestClassificationLevel = ref<number>();
82
102
  const user = ref<Ace.User>();
83
103
  const selectedFileClassificationLevel = ref(50);
84
104
  const curAttachToken = ref<string>();
@@ -151,18 +171,7 @@ let uppy: Uppy | undefined;
151
171
  curAttachToken.value = props.attachToken;
152
172
 
153
173
  onMounted(async () => {
154
- user.value = useLoginUser();
155
- const cl = Math.max(props.classificationLevel ?? 50, user.value?.classifiedLevel ?? 50);
156
- classificationLevels.value = await useSystemClassificationLevels();
157
- classificationLevelMap.value = await useSystemClassificationLevelMap();
158
- allowedClassificationLevels.value = classificationLevels.value.filter(l => l.value >= cl);
159
- console.log(`附件控件密级调试:
160
- 表单密级:`, props.classificationLevel, `
161
- 用户密级:`, user.value?.classifiedLevel, `
162
- 表单/用户密级比较后取最低密级:`, cl, `
163
- 系统密级:`, classificationLevels.value, `
164
- 最终可选密级:`, allowedClassificationLevels.value
165
- )
174
+ await updateAllowedClassificationLevels();
166
175
  if (props.attachToken) {
167
176
  await initLoad();
168
177
  } else {
@@ -175,6 +184,22 @@ onUnmounted(() => {
175
184
  uppy = undefined;
176
185
  });
177
186
 
187
+ async function updateAllowedClassificationLevels() {
188
+ user.value = useLoginUser();
189
+ const cl = Math.max(props.classificationLevel ?? 50, user.value?.classifiedLevel ?? 50);
190
+ classificationLevels.value = await useSystemClassificationLevels();
191
+ classificationLevelMap.value = await useSystemClassificationLevelMap();
192
+ allowedClassificationLevels.value = classificationLevels.value.filter(l => l.value >= cl);
193
+ highestClassificationLevel.value = Math.min(...allowedClassificationLevels.value.map(l=>l.value))
194
+ console.log(`附件控件密级调试:
195
+ 表单密级:`, props.classificationLevel, `
196
+ 用户密级:`, user.value?.classifiedLevel, `
197
+ 表单/用户密级比较后取最低密级:`, cl, `
198
+ 系统密级:`, classificationLevels.value, `
199
+ 最终可选密级:`, allowedClassificationLevels.value
200
+ );
201
+ }
202
+
178
203
  async function loadFileInfos() {
179
204
  if (!curAttachToken.value) {
180
205
  files.value = [];
@@ -393,66 +418,71 @@ async function downloadAll() {
393
418
  }
394
419
 
395
420
  function checkAllowUpload() {
396
- const cfg = uploadInitParams.value?.fileConfig;
397
- if (cfg) {
398
- let hasRole = true;
399
- if (cfg.uploadAuthCode) {
400
- const login = useLoginUser();
401
- if (login) {
402
- hasRole = login.hasRole(cfg.uploadAuthCode);
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;
403
431
  }
404
- return !cfg.disallowUpload && hasRole;
432
+ return !cfg.disallowUpload;
405
433
  }
406
- return !cfg.disallowUpload;
434
+ console.log('file cfg is null')
407
435
  }
408
- console.log('file cfg is null')
409
- return false;
436
+ return props.allowUpload;
410
437
  }
411
438
 
412
439
  function checkAllowDownload() {
413
- const cfg = uploadInitParams.value?.fileConfig;
414
- if (cfg) {
415
- let hasRole = true;
416
- if (cfg.downloadAuthCode) {
417
- const login = useLoginUser();
418
- if (login) {
419
- hasRole = login.hasRole(cfg.downloadAuthCode);
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;
420
450
  }
421
- return !cfg.disallowDownload && hasRole;
451
+ return !cfg.disallowDownload;
422
452
  }
423
- return !cfg.disallowDownload;
424
453
  }
425
- return false;
454
+ return props.allowDownload;
426
455
  }
427
456
 
428
457
  function checkAllowDelete() {
429
- const cfg = uploadInitParams.value?.fileConfig;
430
- if (cfg) {
431
- let hasRole = true;
432
- if (cfg.deleteAuthCode) {
433
- const login = useLoginUser();
434
- if (login) {
435
- hasRole = login.hasRole(cfg.deleteAuthCode);
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;
436
468
  }
437
- return !cfg.disallowDelete && hasRole;
469
+ return !cfg.disallowDelete;
438
470
  }
439
- return !cfg.disallowDelete;
440
471
  }
441
- return false;
472
+ return props.allowDelete;
442
473
  }
443
474
 
444
475
  function checkAllowPreview(file: FileInfo) {
445
- const cfg = uploadInitParams.value?.fileConfig;
446
- if (cfg) {
447
- if (cfg.disablePreview) {
448
- return false;
449
- }
450
- if (!previewableFileExts.some(ext => file.fileName.endsWith(ext))) {
451
- return false;
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));
452
483
  }
453
- return true;
454
484
  }
455
- return false;
485
+ return props.allowPreview;
456
486
  }
457
487
 
458
488
  watch(() => props.attachToken, () => {
@@ -463,6 +493,8 @@ watch(() => props.attachToken, () => {
463
493
  }
464
494
  });
465
495
 
496
+ watch(()=> props.classificationLevel, updateAllowedClassificationLevels)
497
+
466
498
  </script>
467
499
 
468
500
  <template>
@@ -506,12 +538,17 @@ watch(() => props.attachToken, () => {
506
538
  {{ prettyBytes(scope.row.fileSize) }}
507
539
  </template>
508
540
  </el-table-column>
509
- <el-table-column prop="classifiedLevel" width="60">
541
+ <el-table-column prop="classifiedLevel" width="80">
510
542
  <template #default="scope">
511
543
  <el-tag
512
544
  :type="scope.row.classifiedLevel < 50 ? (scope.row.classifiedLevel < 30 ? 'danger' : 'warning') : 'info'">
513
545
  {{ classificationLevelMap?.get(scope.row.classifiedLevel) }}
514
546
  </el-tag>
547
+ <el-tooltip v-if="scope.row.classifiedLevel < highestClassificationLevel" content="文件密级已高于当前许可范围,请立即删除">
548
+ <el-icon color="#F56C6C">
549
+ <warning-filled/>
550
+ </el-icon>
551
+ </el-tooltip>
515
552
  </template>
516
553
  </el-table-column>
517
554
  <el-table-column align="right" width="150" fixed="right">
@@ -10,7 +10,14 @@
10
10
  :expand-on-click-node="false"
11
11
  v-bind="$attrs" @current-change="currentChange" :props="{
12
12
  class: (node: TreeNodeData) => selected?.id === node.id ? 'selected-group' : 'group',
13
- }"></el-tree>
13
+ }">
14
+
15
+ <template #default="{ data }">
16
+ <div>
17
+ <div class="name">{{ data.label }} <el-tag v-if="data.resourceScoped" type="info">资源域</el-tag></div>
18
+ </div>
19
+ </template>
20
+ </el-tree>
14
21
  </div>
15
22
  </template>
16
23
 
@@ -24,7 +31,7 @@ import {
24
31
  useUserGroupApi,
25
32
  } from "@jari-ace/app-bolts";
26
33
  import {type TreeNodeType, useTreeData} from "../../../hooks/useTreeData";
27
- import {ElOption, ElSelect, ElTree, vLoading} from "element-plus";
34
+ import {ElOption, ElSelect, ElTree, vLoading, ElTag} from "element-plus";
28
35
  import type {TreeNodeData} from "element-plus/es/components/tree/src/tree.type";
29
36
  import {useAppInstances} from "../../../hooks/useAppInstances";
30
37
  import {useGroups} from "../../../hooks/useGroups";