@jari-ace/element-plus-component 0.3.0 → 0.3.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.
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.3.0",
4
+ "version": "0.3.2",
5
5
  "main": "lib/index.umd.cjs",
6
6
  "module": "lib/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -0,0 +1,71 @@
1
+ <script setup lang="ts">
2
+ import type {ValidationInstance} from '../../hooks/useBackendValidations'
3
+ import {inject, ref, watch} from "vue";
4
+ import {getValue, setValue} from "../../utils/objectUtils";
5
+ import Uploader from "./uploader.vue";
6
+ const props = defineProps<{
7
+ /**
8
+ * 应用名
9
+ */
10
+ serviceName: string,
11
+ /**
12
+ * 附件配置key
13
+ */
14
+ configKey: string,
15
+ /**
16
+ * 附件令牌
17
+ */
18
+ attachToken?: string,
19
+ /**
20
+ * 数据密集
21
+ */
22
+ classificationLevel?: number,
23
+ /**
24
+ * 文件列表高度
25
+ */
26
+ height?: string | number,
27
+ /**
28
+ * 文件列表最大高度
29
+ */
30
+ maxHeight?: string | number
31
+ }>();
32
+ const input = ref<typeof Uploader>({} as typeof Uploader)
33
+ const model = inject('aceFormModel') as Record<string, any>
34
+ const prop = inject('aceFormItemProp') as string
35
+ const validator = inject('aceFormValidator') as ValidationInstance
36
+ const emit = defineEmits<{
37
+ change: [value: string]
38
+ }>()
39
+
40
+ function onChange(value: string) {
41
+ validator.removeFieldError(prop)
42
+ setValue(model.formData, prop, mv.value);
43
+ emit('change', value)
44
+ }
45
+
46
+ type modelType = string;
47
+
48
+ const mv = ref(getValue(model.formData, prop) as modelType);
49
+ watch(() => model.formData, () => {
50
+ mv.value = getValue(model.formData, prop) as modelType
51
+ }, {
52
+ deep: true
53
+ })
54
+
55
+ defineExpose({
56
+ focus: () => input.value.focus(),
57
+ blur: () => input.value.blur(),
58
+ elSelect: input
59
+ })
60
+ </script>
61
+
62
+ <template>
63
+ <uploader :service-name="serviceName" :max-height="maxHeight" :height="height" :config-key="configKey"
64
+ :attach-token="attachToken" :classification-level="classificationLevel"
65
+ v-model="mv"
66
+ @change="onChange"></uploader>
67
+ </template>
68
+
69
+ <style scoped lang="scss">
70
+
71
+ </style>
@@ -1,4 +1,5 @@
1
1
  import { withInstall } from '../../utils/install'
2
2
  import Upload from './uploader.vue'
3
- export const AceUpload = withInstall(Upload);
4
-
3
+ import _JaUploader from './JaUploader.vue'
4
+ export const JaUploader = withInstall(_JaUploader);
5
+ export const JaUploaderRaw = withInstall(Upload);
@@ -88,6 +88,7 @@ const pdfViewerVisible = ref(false);
88
88
  const pdfSrc = ref("");
89
89
  const previewableFileExts = [".doc", ".docx", ".xls", ".xlsx", ".wps", ".et",
90
90
  ".csv", ".txt", ".rtf", ".odt", "ods", ".mht", ".ppt", ".pptx", ".odp", ".pdf", "xps", "."];
91
+ const emits = defineEmits(['change']);
91
92
  let uppy: Uppy | undefined;
92
93
  curAttachToken.value = props.attachToken;
93
94
 
@@ -265,6 +266,7 @@ async function initNew() {
265
266
  attachId.value = uploadInitParams.value?.attachId;
266
267
  curAttachToken.value = uploadInitParams.value?.attachToken;
267
268
  isNewForm.value = true;
269
+ emits('change', attachId.value);
268
270
  await nextTick();
269
271
  createUppyInstance();
270
272
  }