@vunk/form 2.18.2 → 2.19.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/components/_plugin-vue_export-helper.cjs +1 -11
- package/components/api-tables-select/index.cjs +1 -467
- package/components/api-tables-select/index.mjs +56 -413
- package/components/api-tables-select/src/ctx.d.ts +152 -172
- package/components/api-tables-select/src/index.vue.d.ts +394 -983
- package/components/button/index.cjs +1 -112
- package/components/button/index.mjs +57 -85
- package/components/button/src/ctx.d.ts +28 -113
- package/components/button/src/index.vue.d.ts +317 -625
- package/components/card-input-collection/index.cjs +1 -370
- package/components/card-input-collection/index.mjs +175 -277
- package/components/card-input-collection/src/core.vue.d.ts +54 -951
- package/components/card-input-collection/src/ctx.d.ts +19 -49
- package/components/card-input-collection/src/index.vue.d.ts +46 -110
- package/components/cascader/index.cjs +1 -150
- package/components/cascader/index.mjs +88 -116
- package/components/cascader/src/ctx.d.ts +140 -207
- package/components/cascader/src/index.vue.d.ts +315 -522
- package/components/cascader/src/use.d.ts +1 -1
- package/components/checkbox/index.cjs +1 -152
- package/components/checkbox/index.mjs +75 -119
- package/components/checkbox/src/ctx.d.ts +46 -69
- package/components/checkbox/src/index.vue.d.ts +448 -1016
- package/components/cloneDeep.cjs +1 -2106
- package/components/color-picker/index.cjs +1 -80
- package/components/color-picker/index.mjs +46 -69
- package/components/color-picker/src/ctx.d.ts +130 -107
- package/components/color-picker/src/index.vue.d.ts +285 -255
- package/components/date-picker/index.cjs +1 -119
- package/components/date-picker/index.mjs +63 -97
- package/components/date-picker/src/ctx.d.ts +123 -206
- package/components/date-picker/src/index.vue.d.ts +269 -1358
- package/components/date-picker/src/types.d.ts +7 -7
- package/components/date-picker-range/index.cjs +1 -177
- package/components/date-picker-range/index.mjs +62 -113
- package/components/date-picker-range/src/ctx.d.ts +130 -206
- package/components/date-picker-range/src/index.vue.d.ts +861 -448
- package/components/debounce.cjs +1 -0
- package/components/dialog/index.cjs +1 -126
- package/components/dialog/index.mjs +65 -99
- package/components/dialog/src/ctx.d.ts +17 -108
- package/components/dialog/src/index.vue.d.ts +77 -1072
- package/components/dialog-input-collection/index.cjs +1 -624
- package/components/dialog-input-collection/index.mjs +276 -498
- package/components/dialog-input-collection/src/ctx.d.ts +21 -52
- package/components/dialog-input-collection/src/dialog-form.vue.d.ts +29 -6371
- package/components/dialog-input-collection/src/index.vue.d.ts +65 -7630
- package/components/dialog-input-collection/src/layout.vue.d.ts +13 -73
- package/components/download-plus/index.cjs +1 -456
- package/components/download-plus/index.mjs +215 -358
- package/components/download-plus/src/api.d.ts +1 -1
- package/components/download-plus/src/ctx.d.ts +21 -52
- package/components/download-plus/src/index.vue.d.ts +437 -1177
- package/components/editable-text/index.cjs +1 -295
- package/components/editable-text/index.mjs +113 -239
- package/components/editable-text/src/ctx.d.ts +24 -50
- package/components/editable-text/src/index.vue.d.ts +59 -3258
- package/components/el-slider/index.cjs +1 -0
- package/components/el-slider/index.d.ts +5 -0
- package/components/el-slider/index.mjs +475 -0
- package/components/el-slider/src/button.d.ts +36 -0
- package/components/el-slider/src/button.vue.d.ts +41 -0
- package/components/el-slider/src/composables/index.cjs +1 -0
- package/components/el-slider/src/composables/index.d.ts +6 -0
- package/components/el-slider/src/composables/index.mjs +9 -0
- package/components/el-slider/src/composables/use-lifecycle.d.ts +4 -0
- package/components/el-slider/src/composables/use-marks.d.ts +7 -0
- package/components/el-slider/src/composables/use-slide.d.ts +23 -0
- package/components/el-slider/src/composables/use-slider-button.d.ts +18 -0
- package/components/el-slider/src/composables/use-stops.d.ts +8 -0
- package/components/el-slider/src/composables/use-watch.d.ts +4 -0
- package/components/el-slider/src/constants.d.ts +14 -0
- package/components/el-slider/src/marker.d.ts +37 -0
- package/components/el-slider/src/slider-core.vue.d.ts +218 -0
- package/components/el-slider/src/slider.d.ts +174 -0
- package/components/esri-input-geojson/index.cjs +2 -1604
- package/components/esri-input-geojson/index.mjs +682 -1290
- package/components/esri-input-geojson/src/append.vue.d.ts +239 -1099
- package/components/esri-input-geojson/src/const.d.ts +1 -1
- package/components/esri-input-geojson/src/ctx.d.ts +66 -161
- package/components/esri-input-geojson/src/default-view.vue.d.ts +8 -132
- package/components/esri-input-geojson/src/index.vue.d.ts +982 -708
- package/components/esri-input-geojson/src/types.d.ts +1 -0
- package/components/esri-input-geojson/src/viewer.vue.d.ts +53 -282
- package/components/fieldset/index.cjs +1 -110
- package/components/fieldset/index.mjs +63 -76
- package/components/fieldset/src/ctx.d.ts +4 -4
- package/components/fieldset/src/index.vue.d.ts +7 -7
- package/components/form/index.cjs +1 -248
- package/components/form/index.mjs +107 -161
- package/components/form/src/ctx.d.ts +15 -64
- package/components/form/src/index.vue.d.ts +374 -2431
- package/components/form-item/index.cjs +1 -294
- package/components/form-item/index.mjs +140 -229
- package/components/form-item/src/core.vue.d.ts +32 -1854
- package/components/form-item/src/ctx.d.ts +19 -51
- package/components/form-item/src/index.vue.d.ts +38 -101
- package/components/form-item-renderer/index.cjs +1 -193
- package/components/form-item-renderer/index.mjs +103 -162
- package/components/form-item-renderer/src/core.vue.d.ts +9 -9
- package/components/form-item-renderer/src/ctx.d.ts +3 -3
- package/components/form-item-renderer/src/index.vue.d.ts +24 -74
- package/components/form-item-renderer-template/index.cjs +1 -47
- package/components/form-item-renderer-template/index.mjs +20 -33
- package/components/form-item-renderer-template/src/index.vue.d.ts +1 -1
- package/components/forms-provider/index.cjs +1 -99
- package/components/forms-provider/index.mjs +44 -73
- package/components/forms-provider/src/core.d.ts +3 -2
- package/components/forms-provider/src/segment.vue.d.ts +8 -8
- package/components/forms-provider/src/view.vue.d.ts +14 -4
- package/components/index.cjs +1 -399
- package/components/index2.cjs +1 -17
- package/components/information/index.cjs +1 -65
- package/components/information/index.mjs +28 -38
- package/components/information/src/ctx.d.ts +2 -2
- package/components/information/src/index.vue.d.ts +4 -4
- package/components/information-collection/index.cjs +1 -81
- package/components/information-collection/index.mjs +44 -48
- package/components/information-collection/src/ctx.d.ts +29 -65
- package/components/information-collection/src/index.vue.d.ts +64 -136
- package/components/information-renderer/index.cjs +1 -16
- package/components/information-renderer/index.d.ts +9 -9
- package/components/information-renderer/index.mjs +9 -10
- package/components/information-tag/index.cjs +1 -101
- package/components/information-tag/index.mjs +44 -54
- package/components/information-tag/src/ctx.d.ts +6 -21
- package/components/information-tag/src/index.vue.d.ts +23 -51
- package/components/information-templates-default/index.cjs +1 -101
- package/components/information-templates-default/index.mjs +63 -73
- package/components/information-templates-default/src/index.vue.d.ts +1 -1
- package/components/input/index.cjs +1 -115
- package/components/input/index.mjs +60 -83
- package/components/input/src/ctx.d.ts +51 -152
- package/components/input/src/index.vue.d.ts +392 -951
- package/components/input-array/index.cjs +1 -310
- package/components/input-array/index.mjs +114 -244
- package/components/input-array/src/ctx.d.ts +19 -49
- package/components/input-array/src/form-template.vue.d.ts +1 -901
- package/components/input-array/src/index.vue.d.ts +43 -730
- package/components/input-collection/index.cjs +1 -452
- package/components/input-collection/index.mjs +195 -355
- package/components/input-collection/src/core.vue.d.ts +64 -1026
- package/components/input-collection/src/ctx.d.ts +21 -51
- package/components/input-collection/src/index.vue.d.ts +50 -114
- package/components/input-file/index.cjs +1 -142
- package/components/input-file/index.mjs +68 -100
- package/components/input-file/src/ctx.d.ts +8 -29
- package/components/input-file/src/index.vue.d.ts +444 -74
- package/components/input-file/src/template.vue.d.ts +1 -124
- package/components/input-link/index.cjs +1 -167
- package/components/input-link/index.mjs +60 -83
- package/components/input-link/src/ctx.d.ts +52 -137
- package/components/input-link/src/index.vue.d.ts +833 -311
- package/components/input-number/index.cjs +1 -119
- package/components/input-number/index.mjs +73 -87
- package/components/input-number/src/ctx.d.ts +38 -131
- package/components/input-number/src/index.vue.d.ts +321 -683
- package/components/input-tag/index.cjs +1 -100
- package/components/input-tag/index.mjs +51 -78
- package/components/input-tag/src/ctx.d.ts +43 -145
- package/components/input-tag/src/index.vue.d.ts +324 -778
- package/components/isObject.cjs +1 -165
- package/components/monaco-editor/index.cjs +1 -83
- package/components/monaco-editor/index.mjs +40 -59
- package/components/monaco-editor/src/ctx.d.ts +19 -44
- package/components/monaco-editor/src/index.vue.d.ts +209 -109
- package/components/radio/index.cjs +1 -267
- package/components/radio/index.mjs +110 -209
- package/components/radio/src/ctx.d.ts +27 -91
- package/components/radio/src/index.vue.d.ts +298 -1279
- package/components/radio/src/option.vue.d.ts +29 -881
- package/components/radio/src/wraper.vue.d.ts +64 -196
- package/components/renderer-data/index.cjs +1 -41
- package/components/renderer-data/index.mjs +19 -26
- package/components/renderer-data/src/ctx.d.ts +1 -1
- package/components/renderer-data/src/index.vue.d.ts +2 -2
- package/components/select/index.cjs +1 -311
- package/components/select/index.mjs +156 -214
- package/components/select/src/core.vue.d.ts +638 -1080
- package/components/select/src/ctx.d.ts +140 -223
- package/components/select/src/index.vue.d.ts +334 -610
- package/components/select/src/options.vue.d.ts +1 -1
- package/components/slider/index.cjs +1 -88
- package/components/slider/index.mjs +41 -70
- package/components/slider/src/ctx.d.ts +63 -174
- package/components/slider/src/index.vue.d.ts +151 -420
- package/components/style.css +1 -0
- package/components/switch/index.cjs +1 -88
- package/components/switch/index.mjs +37 -69
- package/components/switch/src/ctx.d.ts +34 -113
- package/components/switch/src/index.vue.d.ts +88 -699
- package/components/switch/src/types.d.ts +2 -2
- package/components/tables-select/index.cjs +1 -263
- package/components/tables-select/index.mjs +102 -172
- package/components/tables-select/src/ctx.d.ts +76 -91
- package/components/tables-select/src/index.vue.d.ts +228 -4969
- package/components/template-instances-provider/index.cjs +1 -31
- package/components/template-instances-provider/index.mjs +18 -22
- package/components/template-instances-provider/src/index.vue.d.ts +2 -2
- package/components/templates-default/index.cjs +1 -235
- package/components/templates-default/index.mjs +152 -211
- package/components/templates-default/src/ctx.d.ts +5 -3
- package/components/templates-default/src/index.vue.d.ts +7298 -157
- package/components/templates-element-plus/index.cjs +1 -112
- package/components/templates-element-plus/index.mjs +49 -91
- package/components/templates-element-plus/src/ctx.d.ts +1 -1
- package/components/templates-element-plus/src/index.vue.d.ts +65 -258
- package/components/templates-esri/index.cjs +1 -65
- package/components/templates-esri/index.mjs +29 -39
- package/components/templates-esri/src/ctx.d.ts +1 -1
- package/components/templates-esri/src/index.vue.d.ts +1776 -24
- package/components/templates-layout/index.cjs +1 -137
- package/components/templates-layout/index.mjs +78 -116
- package/components/templates-layout/src/ctx.d.ts +1 -1
- package/components/templates-layout/src/index.vue.d.ts +79 -411
- package/components/templates-variant/index.cjs +1 -70
- package/components/templates-variant/index.mjs +33 -43
- package/components/templates-variant/src/ctx.d.ts +1 -1
- package/components/templates-variant/src/index.vue.d.ts +1238 -24
- package/components/time-picker/index.cjs +1 -104
- package/components/time-picker/index.mjs +57 -87
- package/components/time-picker/src/ctx.d.ts +121 -211
- package/components/time-picker/src/index.vue.d.ts +263 -1368
- package/components/upload/index.cjs +1 -663
- package/components/upload/index.mjs +343 -537
- package/components/upload/src/ctx.d.ts +108 -195
- package/components/upload/src/file.vue.d.ts +197 -776
- package/components/upload/src/index.vue.d.ts +689 -1931
- package/components/upload/src/types.d.ts +1 -1
- package/components/upload/src/wraper.vue.d.ts +232 -407
- package/components/upload-plus/index.cjs +21 -18673
- package/components/upload-plus/index.mjs +4598 -18372
- package/components/upload-plus/src/api.d.ts +2 -2
- package/components/upload-plus/src/ctx.d.ts +24 -51
- package/components/upload-plus/src/index.vue.d.ts +51 -1656
- package/components/use-watch.cjs +1 -0
- package/components/van-cascader/index.cjs +1 -125
- package/components/van-cascader/index.mjs +51 -96
- package/components/van-cascader/src/ctx.d.ts +135 -203
- package/components/van-cascader/src/index.vue.d.ts +312 -985
- package/components/var-datetime-picker/index.cjs +1 -333
- package/components/var-datetime-picker/index.mjs +175 -254
- package/components/var-datetime-picker/src/ctx.d.ts +19 -50
- package/components/var-datetime-picker/src/index.vue.d.ts +688 -1115
- package/components/vditor/index.cjs +1 -86
- package/components/vditor/index.mjs +40 -66
- package/components/vditor/src/ctx.d.ts +16 -45
- package/components/vditor/src/index.vue.d.ts +195 -120
- package/composables/element-plus/index.cjs +1 -23
- package/composables/element-plus/index.mjs +14 -18
- package/composables/index.cjs +1 -161
- package/composables/index.d.ts +1 -0
- package/composables/index.mjs +102 -135
- package/composables/useForm.d.ts +2 -2
- package/composables/useRtl.d.ts +18 -0
- package/composables/useSourceManager.d.ts +2 -2
- package/composables/useTemplateInstances.d.ts +3 -3
- package/index.css +1 -562
- package/index.d.ts +0 -3
- package/index.esm.js +23 -48
- package/locale/index.cjs +1 -102
- package/locale/index.mjs +34 -34
- package/locale/lang/index.cjs +1 -2
- package/locale/lang/index.d.ts +1 -0
- package/package.json +14 -85
- package/shared/const/index.cjs +1 -59
- package/shared/const/index.d.ts +1 -1
- package/shared/const/index.mjs +18 -20
- package/shared/element-plus/ctx.d.ts +40 -37
- package/shared/element-plus/index.cjs +1 -211
- package/shared/element-plus/index.mjs +93 -161
- package/shared/element-plus/instances.d.ts +207 -321
- package/shared/form/index.cjs +1 -33
- package/shared/form/index.mjs +23 -25
- package/shared/helper/index.cjs +1 -11
- package/shared/helper/index.mjs +7 -8
- package/shared/index.cjs +1 -8
- package/shared/index.mjs +5 -1
- package/shared/infer-prop/index.cjs +1 -36
- package/shared/infer-prop/index.mjs +22 -28
- package/shared/progress-it/index.cjs +1 -42
- package/shared/progress-it/index.mjs +15 -31
- package/shared/rules/index.cjs +1 -56
- package/shared/rules/index.mjs +19 -18
- package/shared/types/form/index.cjs +1 -2
- package/shared/types/index.cjs +1 -2
- package/shared/types/source/index.cjs +1 -2
- package/shared/types/source-manager/index.cjs +1 -2
- package/shared/upload/index.cjs +1 -774
- package/shared/upload/index.mjs +180 -764
- package/component.d.ts +0 -3
- package/components/_plugin-vue_export-helper.mjs +0 -9
- package/components/card-input-collection/index.css +0 -21
- package/components/cascader/index.css +0 -9
- package/components/checkbox/index.css +0 -30
- package/components/cloneDeep.mjs +0 -2104
- package/components/date-picker-range/index.css +0 -18
- package/components/dialog-input-collection/index.css +0 -21
- package/components/download-plus/index.css +0 -68
- package/components/editable-text/index.css +0 -9
- package/components/esri-input-geojson/index.css +0 -32
- package/components/fieldset/index.css +0 -5
- package/components/form-item/index.css +0 -35
- package/components/index.mjs +0 -378
- package/components/index2.mjs +0 -14
- package/components/information-tag/index.css +0 -6
- package/components/information-templates-default/index.css +0 -16
- package/components/input-array/index.css +0 -14
- package/components/input-collection/index.css +0 -20
- package/components/input-link/index.css +0 -4
- package/components/input-number/index.css +0 -13
- package/components/isObject.mjs +0 -158
- package/components/monaco-editor/index.css +0 -4
- package/components/radio/index.css +0 -40
- package/components/select/index.css +0 -15
- package/components/switch/index.css +0 -10
- package/components/tables-select/index.css +0 -3
- package/components/templates-layout/index.css +0 -3
- package/components/upload/index.css +0 -34
- package/components/upload-plus/index.css +0 -84
- package/components/van-cascader/index.css +0 -6
- package/components/var-datetime-picker/index.css +0 -17
- package/defaults.d.ts +0 -5
|
@@ -1,663 +1 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var vue = require('vue');
|
|
6
|
-
var formItem = require('@vunk/form/components/form-item');
|
|
7
|
-
var utilsVue = require('@vunk/core/shared/utils-vue');
|
|
8
|
-
var elementPlus = require('element-plus');
|
|
9
|
-
var utilsObject = require('@vunk/core/shared/utils-object');
|
|
10
|
-
var elementPlus$2 = require('@vunk/form/shared/element-plus');
|
|
11
|
-
var index = require('../index.cjs');
|
|
12
|
-
var utilsFetch = require('@vunk/core/shared/utils-fetch');
|
|
13
|
-
var utilsFunction = require('@vunk/core/shared/utils-function');
|
|
14
|
-
var _function = require('@vunk/shared/function');
|
|
15
|
-
var elementPlus$1 = require('@vunk/form/composables/element-plus');
|
|
16
|
-
var _pluginVue_exportHelper = require('../_plugin-vue_export-helper.cjs');
|
|
17
|
-
var composables = require('@vunk/form/composables');
|
|
18
|
-
var progress = require('@vunk/form/shared/progress-it');
|
|
19
|
-
|
|
20
|
-
const props = {
|
|
21
|
-
...formItem._VkfFormItemCtx.props,
|
|
22
|
-
...elementPlus.uploadProps,
|
|
23
|
-
tip: {
|
|
24
|
-
type: String,
|
|
25
|
-
default: ""
|
|
26
|
-
},
|
|
27
|
-
preview: null,
|
|
28
|
-
previewLabel: {
|
|
29
|
-
type: String,
|
|
30
|
-
default: void 0
|
|
31
|
-
},
|
|
32
|
-
beforeUpload: {
|
|
33
|
-
type: Function,
|
|
34
|
-
default: void 0
|
|
35
|
-
},
|
|
36
|
-
onDownload: {
|
|
37
|
-
type: Function,
|
|
38
|
-
default: void 0
|
|
39
|
-
},
|
|
40
|
-
onExceed: {
|
|
41
|
-
type: Function,
|
|
42
|
-
default: void 0
|
|
43
|
-
},
|
|
44
|
-
/**
|
|
45
|
-
* @description 达到limit后是否允许继续添加文件, 默认采用清空+添加的方式重新添加文件,你可以通过 onExceed 自定义行为
|
|
46
|
-
*/
|
|
47
|
-
exceedable: {
|
|
48
|
-
type: Boolean,
|
|
49
|
-
default: false
|
|
50
|
-
},
|
|
51
|
-
/**
|
|
52
|
-
* @description 是否开启超出覆盖文件的确认框
|
|
53
|
-
*/
|
|
54
|
-
confirmExceed: {
|
|
55
|
-
type: Boolean,
|
|
56
|
-
default: false
|
|
57
|
-
},
|
|
58
|
-
/**
|
|
59
|
-
* @description 同 el-upload 的 slots
|
|
60
|
-
*/
|
|
61
|
-
slots: null
|
|
62
|
-
};
|
|
63
|
-
const createBindProps = utilsVue.bindPropsFactory(props);
|
|
64
|
-
const emits = {
|
|
65
|
-
"update:fileList": null,
|
|
66
|
-
"remove": (e) => e
|
|
67
|
-
};
|
|
68
|
-
const createOnEmits = utilsVue.onEmitsFactory(emits);
|
|
69
|
-
|
|
70
|
-
var ctx = /*#__PURE__*/Object.freeze({
|
|
71
|
-
__proto__: null,
|
|
72
|
-
createBindProps: createBindProps,
|
|
73
|
-
createOnEmits: createOnEmits,
|
|
74
|
-
emits: emits,
|
|
75
|
-
props: props
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
const restFetch = new utilsFetch.RestFetch({
|
|
79
|
-
baseURL: ""
|
|
80
|
-
});
|
|
81
|
-
var _sfc_main$2 = vue.defineComponent({
|
|
82
|
-
components: {
|
|
83
|
-
ElProgress: elementPlus.ElProgress,
|
|
84
|
-
ElIcon: elementPlus.ElIcon,
|
|
85
|
-
Check: index.check_default,
|
|
86
|
-
ZoomIn: index.zoom_in_default,
|
|
87
|
-
Delete: index.delete_default,
|
|
88
|
-
Close: index.close_default,
|
|
89
|
-
CircleCheck: index.circle_check_default,
|
|
90
|
-
Document: index.document_default,
|
|
91
|
-
Download: index.download_default,
|
|
92
|
-
ElButton: elementPlus.ElButton
|
|
93
|
-
},
|
|
94
|
-
props: {
|
|
95
|
-
listType: {
|
|
96
|
-
type: String,
|
|
97
|
-
default: "text"
|
|
98
|
-
},
|
|
99
|
-
file: {
|
|
100
|
-
type: Object,
|
|
101
|
-
default: () => ({})
|
|
102
|
-
},
|
|
103
|
-
disabled: {
|
|
104
|
-
type: Boolean,
|
|
105
|
-
default: false
|
|
106
|
-
},
|
|
107
|
-
onPreview: {
|
|
108
|
-
type: Function,
|
|
109
|
-
default: () => utilsFunction.NOOP
|
|
110
|
-
},
|
|
111
|
-
onDownload: {
|
|
112
|
-
type: Function,
|
|
113
|
-
default: void 0
|
|
114
|
-
},
|
|
115
|
-
preview: {
|
|
116
|
-
type: [Boolean, Function],
|
|
117
|
-
default: false
|
|
118
|
-
},
|
|
119
|
-
previewLabel: {
|
|
120
|
-
type: String,
|
|
121
|
-
default: void 0
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
emits: {
|
|
125
|
-
remove: (e) => e
|
|
126
|
-
},
|
|
127
|
-
setup(props, { emit }) {
|
|
128
|
-
const nsUpload = elementPlus.useNamespace("upload");
|
|
129
|
-
const nsIcon = elementPlus.useNamespace("icon");
|
|
130
|
-
const { tr } = elementPlus$1.useLocale();
|
|
131
|
-
const handleRemove = (file = props.file) => {
|
|
132
|
-
emit("remove", file);
|
|
133
|
-
};
|
|
134
|
-
const handleDownload = (file = props.file) => {
|
|
135
|
-
if (props.onDownload) {
|
|
136
|
-
props.onDownload(file);
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
let url = "";
|
|
140
|
-
if (file.url) {
|
|
141
|
-
url = file.url;
|
|
142
|
-
} else if (file.raw) {
|
|
143
|
-
url = window.URL.createObjectURL(file.raw);
|
|
144
|
-
}
|
|
145
|
-
url && restFetch.download({
|
|
146
|
-
url,
|
|
147
|
-
fileName: file.name
|
|
148
|
-
}, {
|
|
149
|
-
method: "GET"
|
|
150
|
-
});
|
|
151
|
-
};
|
|
152
|
-
const previewable = vue.computed(() => {
|
|
153
|
-
if (_function.isCallable(props.preview)) {
|
|
154
|
-
return props.preview(props.file);
|
|
155
|
-
}
|
|
156
|
-
return props.preview;
|
|
157
|
-
});
|
|
158
|
-
const previewText = vue.computed(() => props.previewLabel || tr("el.upload.preview", "\u9884\u89C8"));
|
|
159
|
-
const handlePreview = (file = props.file) => {
|
|
160
|
-
previewable.value && props.onPreview(file);
|
|
161
|
-
};
|
|
162
|
-
return {
|
|
163
|
-
handleRemove,
|
|
164
|
-
nsIcon,
|
|
165
|
-
nsUpload,
|
|
166
|
-
handleDownload,
|
|
167
|
-
handlePreview,
|
|
168
|
-
previewText,
|
|
169
|
-
previewable,
|
|
170
|
-
tr
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
const _hoisted_1$1 = ["src"];
|
|
176
|
-
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
177
|
-
const _component_Document = vue.resolveComponent("Document");
|
|
178
|
-
const _component_ElIcon = vue.resolveComponent("ElIcon");
|
|
179
|
-
const _component_Download = vue.resolveComponent("Download");
|
|
180
|
-
const _component_ElButton = vue.resolveComponent("ElButton");
|
|
181
|
-
const _component_ElProgress = vue.resolveComponent("ElProgress");
|
|
182
|
-
const _component_CircleCheck = vue.resolveComponent("CircleCheck");
|
|
183
|
-
const _component_Check = vue.resolveComponent("Check");
|
|
184
|
-
const _component_Close = vue.resolveComponent("Close");
|
|
185
|
-
const _component_ZoomIn = vue.resolveComponent("ZoomIn");
|
|
186
|
-
const _component_Delete = vue.resolveComponent("Delete");
|
|
187
|
-
return vue.openBlock(), vue.createElementBlock(
|
|
188
|
-
vue.Fragment,
|
|
189
|
-
null,
|
|
190
|
-
[
|
|
191
|
-
vue.createCommentVNode(" picture "),
|
|
192
|
-
_ctx.listType === "picture" || _ctx.file.status !== "uploading" && _ctx.listType === "picture-card" ? (vue.openBlock(), vue.createElementBlock(
|
|
193
|
-
vue.Fragment,
|
|
194
|
-
{ key: 0 },
|
|
195
|
-
[
|
|
196
|
-
/\.(svg|png|jpg|jpeg)$/.test(_ctx.file.name) ? (vue.openBlock(), vue.createElementBlock("img", {
|
|
197
|
-
key: 0,
|
|
198
|
-
class: vue.normalizeClass(_ctx.nsUpload.be("list", "item-thumbnail")),
|
|
199
|
-
src: _ctx.file.url,
|
|
200
|
-
alt: ""
|
|
201
|
-
}, null, 10, _hoisted_1$1)) : (vue.openBlock(), vue.createBlock(_component_Document, {
|
|
202
|
-
key: 1,
|
|
203
|
-
class: vue.normalizeClass([
|
|
204
|
-
_ctx.nsUpload.be("list", "item-thumbnail"),
|
|
205
|
-
_ctx.nsIcon.m("document")
|
|
206
|
-
])
|
|
207
|
-
}, null, 8, ["class"]))
|
|
208
|
-
],
|
|
209
|
-
64
|
|
210
|
-
/* STABLE_FRAGMENT */
|
|
211
|
-
)) : vue.createCommentVNode("v-if", true),
|
|
212
|
-
vue.createCommentVNode(" text "),
|
|
213
|
-
_ctx.listType !== "picture-card" || _ctx.file.status === "uploading" ? (vue.openBlock(), vue.createElementBlock(
|
|
214
|
-
"div",
|
|
215
|
-
{
|
|
216
|
-
key: 1,
|
|
217
|
-
class: vue.normalizeClass(_ctx.nsUpload.be("list", "item-info"))
|
|
218
|
-
},
|
|
219
|
-
[
|
|
220
|
-
vue.createElementVNode(
|
|
221
|
-
"a",
|
|
222
|
-
{
|
|
223
|
-
class: vue.normalizeClass(_ctx.nsUpload.be("list", "item-name")),
|
|
224
|
-
onClick: _cache[1] || (_cache[1] = vue.withModifiers(($event) => _ctx.handlePreview(_ctx.file), ["prevent"]))
|
|
225
|
-
},
|
|
226
|
-
[
|
|
227
|
-
vue.createVNode(_component_ElIcon, {
|
|
228
|
-
class: vue.normalizeClass(_ctx.nsIcon.m("document"))
|
|
229
|
-
}, {
|
|
230
|
-
default: vue.withCtx(() => [
|
|
231
|
-
vue.createVNode(_component_Document)
|
|
232
|
-
]),
|
|
233
|
-
_: 1
|
|
234
|
-
/* STABLE */
|
|
235
|
-
}, 8, ["class"]),
|
|
236
|
-
vue.createVNode(_component_ElIcon, {
|
|
237
|
-
class: vue.normalizeClass([
|
|
238
|
-
_ctx.nsIcon.m("download"),
|
|
239
|
-
_ctx.nsIcon.m("download-primary")
|
|
240
|
-
]),
|
|
241
|
-
onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => _ctx.handleDownload(_ctx.file), ["stop"]))
|
|
242
|
-
}, {
|
|
243
|
-
default: vue.withCtx(() => [
|
|
244
|
-
vue.createVNode(_component_Download)
|
|
245
|
-
]),
|
|
246
|
-
_: 1
|
|
247
|
-
/* STABLE */
|
|
248
|
-
}, 8, ["class"]),
|
|
249
|
-
vue.createElementVNode(
|
|
250
|
-
"span",
|
|
251
|
-
{
|
|
252
|
-
class: vue.normalizeClass(_ctx.nsUpload.be("list", "item-file-name"))
|
|
253
|
-
},
|
|
254
|
-
vue.toDisplayString(_ctx.file.name),
|
|
255
|
-
3
|
|
256
|
-
/* TEXT, CLASS */
|
|
257
|
-
)
|
|
258
|
-
],
|
|
259
|
-
2
|
|
260
|
-
/* CLASS */
|
|
261
|
-
),
|
|
262
|
-
_ctx.listType === "picture" ? (vue.openBlock(), vue.createElementBlock(
|
|
263
|
-
"div",
|
|
264
|
-
{
|
|
265
|
-
key: 0,
|
|
266
|
-
class: vue.normalizeClass(_ctx.nsUpload.be("list", "item-file-actions"))
|
|
267
|
-
},
|
|
268
|
-
[
|
|
269
|
-
vue.createVNode(_component_ElButton, {
|
|
270
|
-
disabled: !_ctx.previewable,
|
|
271
|
-
class: vue.normalizeClass(_ctx.nsUpload.be("list", "item-file-action-preview")),
|
|
272
|
-
plain: "",
|
|
273
|
-
size: "small",
|
|
274
|
-
round: "",
|
|
275
|
-
onClick: _cache[2] || (_cache[2] = ($event) => _ctx.handlePreview(_ctx.file))
|
|
276
|
-
}, {
|
|
277
|
-
default: vue.withCtx(() => [
|
|
278
|
-
vue.createTextVNode(
|
|
279
|
-
vue.toDisplayString(_ctx.previewText),
|
|
280
|
-
1
|
|
281
|
-
/* TEXT */
|
|
282
|
-
)
|
|
283
|
-
]),
|
|
284
|
-
_: 1
|
|
285
|
-
/* STABLE */
|
|
286
|
-
}, 8, ["disabled", "class"]),
|
|
287
|
-
vue.createCommentVNode(" \u4E0B\u8F7D "),
|
|
288
|
-
vue.createVNode(_component_ElButton, {
|
|
289
|
-
plain: "",
|
|
290
|
-
size: "small",
|
|
291
|
-
round: "",
|
|
292
|
-
type: "primary",
|
|
293
|
-
onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleDownload(_ctx.file))
|
|
294
|
-
}, {
|
|
295
|
-
default: vue.withCtx(() => [
|
|
296
|
-
vue.createTextVNode(
|
|
297
|
-
vue.toDisplayString(_ctx.tr("vkf.common.download", "\u4E0B\u8F7D")),
|
|
298
|
-
1
|
|
299
|
-
/* TEXT */
|
|
300
|
-
)
|
|
301
|
-
]),
|
|
302
|
-
_: 1
|
|
303
|
-
/* STABLE */
|
|
304
|
-
})
|
|
305
|
-
],
|
|
306
|
-
2
|
|
307
|
-
/* CLASS */
|
|
308
|
-
)) : vue.createCommentVNode("v-if", true),
|
|
309
|
-
_ctx.file.status === "uploading" ? (vue.openBlock(), vue.createBlock(_component_ElProgress, {
|
|
310
|
-
key: 1,
|
|
311
|
-
type: _ctx.listType === "picture-card" ? "circle" : "line",
|
|
312
|
-
"stroke-width": _ctx.listType === "picture-card" ? 6 : 2,
|
|
313
|
-
percentage: Number(_ctx.file.percentage),
|
|
314
|
-
style: vue.normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem")
|
|
315
|
-
}, null, 8, ["type", "stroke-width", "percentage", "style"])) : vue.createCommentVNode("v-if", true)
|
|
316
|
-
],
|
|
317
|
-
2
|
|
318
|
-
/* CLASS */
|
|
319
|
-
)) : vue.createCommentVNode("v-if", true),
|
|
320
|
-
vue.createCommentVNode(" label "),
|
|
321
|
-
vue.createElementVNode(
|
|
322
|
-
"label",
|
|
323
|
-
{
|
|
324
|
-
class: vue.normalizeClass(_ctx.nsUpload.be("list", "item-status-label"))
|
|
325
|
-
},
|
|
326
|
-
[
|
|
327
|
-
_ctx.listType === "text" ? (vue.openBlock(), vue.createBlock(_component_ElIcon, {
|
|
328
|
-
key: 0,
|
|
329
|
-
class: vue.normalizeClass([
|
|
330
|
-
_ctx.nsIcon.m("upload-success"),
|
|
331
|
-
_ctx.nsIcon.m("circle-check")
|
|
332
|
-
])
|
|
333
|
-
}, {
|
|
334
|
-
default: vue.withCtx(() => [
|
|
335
|
-
vue.createVNode(_component_CircleCheck)
|
|
336
|
-
]),
|
|
337
|
-
_: 1
|
|
338
|
-
/* STABLE */
|
|
339
|
-
}, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (vue.openBlock(), vue.createBlock(_component_ElIcon, {
|
|
340
|
-
key: 1,
|
|
341
|
-
class: vue.normalizeClass([_ctx.nsIcon.m("upload-success"), _ctx.nsIcon.m("check")])
|
|
342
|
-
}, {
|
|
343
|
-
default: vue.withCtx(() => [
|
|
344
|
-
vue.createVNode(_component_Check)
|
|
345
|
-
]),
|
|
346
|
-
_: 1
|
|
347
|
-
/* STABLE */
|
|
348
|
-
}, 8, ["class"])) : vue.createCommentVNode("v-if", true)
|
|
349
|
-
],
|
|
350
|
-
2
|
|
351
|
-
/* CLASS */
|
|
352
|
-
),
|
|
353
|
-
!_ctx.disabled ? (vue.openBlock(), vue.createBlock(_component_ElIcon, {
|
|
354
|
-
key: 2,
|
|
355
|
-
class: vue.normalizeClass(_ctx.nsIcon.m("close")),
|
|
356
|
-
onClick: _cache[4] || (_cache[4] = ($event) => _ctx.handleRemove(_ctx.file))
|
|
357
|
-
}, {
|
|
358
|
-
default: vue.withCtx(() => [
|
|
359
|
-
vue.createVNode(_component_Close)
|
|
360
|
-
]),
|
|
361
|
-
_: 1
|
|
362
|
-
/* STABLE */
|
|
363
|
-
}, 8, ["class"])) : vue.createCommentVNode("v-if", true),
|
|
364
|
-
vue.createCommentVNode(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn "),
|
|
365
|
-
vue.createCommentVNode(" This is a bug which needs to be fixed "),
|
|
366
|
-
vue.createCommentVNode(" TODO: Fix the incorrect navigation interaction "),
|
|
367
|
-
vue.createCommentVNode(` <i v-if="!disabled" :class="nsIcon.m('close-tip')">{{
|
|
368
|
-
t('el.upload.deleteTip')
|
|
369
|
-
}}</i> `),
|
|
370
|
-
vue.createCommentVNode(" picture-card "),
|
|
371
|
-
_ctx.listType === "picture-card" ? (vue.openBlock(), vue.createElementBlock(
|
|
372
|
-
"span",
|
|
373
|
-
{
|
|
374
|
-
key: 3,
|
|
375
|
-
class: vue.normalizeClass(_ctx.nsUpload.be("list", "item-actions"))
|
|
376
|
-
},
|
|
377
|
-
[
|
|
378
|
-
vue.createCommentVNode(" \u9884\u89C8 "),
|
|
379
|
-
_ctx.previewable ? (vue.openBlock(), vue.createElementBlock(
|
|
380
|
-
"span",
|
|
381
|
-
{
|
|
382
|
-
key: 0,
|
|
383
|
-
class: vue.normalizeClass(_ctx.nsUpload.be("list", "item-preview")),
|
|
384
|
-
onClick: _cache[5] || (_cache[5] = ($event) => _ctx.handlePreview(_ctx.file))
|
|
385
|
-
},
|
|
386
|
-
[
|
|
387
|
-
vue.createVNode(_component_ElIcon, {
|
|
388
|
-
class: vue.normalizeClass(_ctx.nsIcon.m("zoom-in"))
|
|
389
|
-
}, {
|
|
390
|
-
default: vue.withCtx(() => [
|
|
391
|
-
vue.createVNode(_component_ZoomIn)
|
|
392
|
-
]),
|
|
393
|
-
_: 1
|
|
394
|
-
/* STABLE */
|
|
395
|
-
}, 8, ["class"])
|
|
396
|
-
],
|
|
397
|
-
2
|
|
398
|
-
/* CLASS */
|
|
399
|
-
)) : vue.createCommentVNode("v-if", true),
|
|
400
|
-
vue.createCommentVNode(" \u4E0B\u8F7D "),
|
|
401
|
-
vue.createElementVNode(
|
|
402
|
-
"span",
|
|
403
|
-
{
|
|
404
|
-
class: vue.normalizeClass(_ctx.nsUpload.be("list", "item-download")),
|
|
405
|
-
onClick: _cache[6] || (_cache[6] = ($event) => _ctx.handleDownload(_ctx.file))
|
|
406
|
-
},
|
|
407
|
-
[
|
|
408
|
-
vue.createVNode(_component_ElIcon, {
|
|
409
|
-
class: vue.normalizeClass(_ctx.nsIcon.m("download"))
|
|
410
|
-
}, {
|
|
411
|
-
default: vue.withCtx(() => [
|
|
412
|
-
vue.createVNode(_component_Download)
|
|
413
|
-
]),
|
|
414
|
-
_: 1
|
|
415
|
-
/* STABLE */
|
|
416
|
-
}, 8, ["class"])
|
|
417
|
-
],
|
|
418
|
-
2
|
|
419
|
-
/* CLASS */
|
|
420
|
-
),
|
|
421
|
-
!_ctx.disabled ? (vue.openBlock(), vue.createElementBlock(
|
|
422
|
-
"span",
|
|
423
|
-
{
|
|
424
|
-
key: 1,
|
|
425
|
-
class: vue.normalizeClass(_ctx.nsUpload.be("list", "item-delete")),
|
|
426
|
-
onClick: _cache[7] || (_cache[7] = ($event) => _ctx.handleRemove(_ctx.file))
|
|
427
|
-
},
|
|
428
|
-
[
|
|
429
|
-
vue.createVNode(_component_ElIcon, {
|
|
430
|
-
class: vue.normalizeClass(_ctx.nsIcon.m("delete"))
|
|
431
|
-
}, {
|
|
432
|
-
default: vue.withCtx(() => [
|
|
433
|
-
vue.createVNode(_component_Delete)
|
|
434
|
-
]),
|
|
435
|
-
_: 1
|
|
436
|
-
/* STABLE */
|
|
437
|
-
}, 8, ["class"])
|
|
438
|
-
],
|
|
439
|
-
2
|
|
440
|
-
/* CLASS */
|
|
441
|
-
)) : vue.createCommentVNode("v-if", true)
|
|
442
|
-
],
|
|
443
|
-
2
|
|
444
|
-
/* CLASS */
|
|
445
|
-
)) : vue.createCommentVNode("v-if", true)
|
|
446
|
-
],
|
|
447
|
-
64
|
|
448
|
-
/* STABLE_FRAGMENT */
|
|
449
|
-
);
|
|
450
|
-
}
|
|
451
|
-
var FileVue = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$2, [["render", _sfc_render$1], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/upload/src/file.vue"]]);
|
|
452
|
-
|
|
453
|
-
var _sfc_main$1 = vue.defineComponent({
|
|
454
|
-
components: {
|
|
455
|
-
VkfFormItem: formItem.VkfFormItem,
|
|
456
|
-
ElUpload: elementPlus.ElUpload,
|
|
457
|
-
FileVue,
|
|
458
|
-
ElLink: elementPlus.ElLink
|
|
459
|
-
},
|
|
460
|
-
props,
|
|
461
|
-
emits,
|
|
462
|
-
setup(props2, { emit }) {
|
|
463
|
-
const formItemBindProps = formItem._VkfFormItemCtx.createBindProps(props2);
|
|
464
|
-
const { tr } = elementPlus$1.useLocale();
|
|
465
|
-
const coreBindProps = elementPlus$2.createUploadBindProps(props2, ["disabled", "fileList", "beforeUpload", "onSuccess"]);
|
|
466
|
-
const uploadRef = vue.shallowRef();
|
|
467
|
-
const handleRemove = (file) => {
|
|
468
|
-
uploadRef.value?.handleRemove(file);
|
|
469
|
-
uploadRef.value?.abort(file);
|
|
470
|
-
emit("update:fileList", props2.fileList);
|
|
471
|
-
};
|
|
472
|
-
const handleExceed = (files, uploadFiles) => {
|
|
473
|
-
if (props2.onExceed) {
|
|
474
|
-
props2.onExceed(files, uploadFiles);
|
|
475
|
-
return;
|
|
476
|
-
}
|
|
477
|
-
if (props2.exceedable) {
|
|
478
|
-
const doUpload = () => {
|
|
479
|
-
uploadRef.value?.clearFiles();
|
|
480
|
-
files.forEach((file) => {
|
|
481
|
-
file.uid = elementPlus.genFileId();
|
|
482
|
-
uploadRef.value?.handleStart(file);
|
|
483
|
-
});
|
|
484
|
-
uploadRef.value?.submit();
|
|
485
|
-
};
|
|
486
|
-
if (props2.confirmExceed) {
|
|
487
|
-
elementPlus.ElMessageBox.confirm(
|
|
488
|
-
tr("vkf.upload.exceedConfirm", "\u5DF2\u8D85\u8FC7\u6700\u5927\u4E0A\u4F20\u6570\u91CF\u9650\u5236\uFF0C\u662F\u5426\u4F7F\u7528\u65B0\u6587\u4EF6\u91CD\u65B0\u4E0A\u4F20\uFF1F"),
|
|
489
|
-
tr("el.messagebox.title", "\u63D0\u793A"),
|
|
490
|
-
{
|
|
491
|
-
confirmButtonText: tr("el.upload.continue", "\u7EE7\u7EED"),
|
|
492
|
-
cancelButtonText: tr("el.messagebox.cancel", "\u53D6\u6D88"),
|
|
493
|
-
type: "warning"
|
|
494
|
-
}
|
|
495
|
-
).then(doUpload);
|
|
496
|
-
} else {
|
|
497
|
-
doUpload();
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
};
|
|
501
|
-
const readonly = composables.useComputedReadonly(props2);
|
|
502
|
-
const onSuccess = (response, uploadFile, uploadFiles) => {
|
|
503
|
-
const raw = uploadFile.raw;
|
|
504
|
-
raw.progress(true);
|
|
505
|
-
uploadFile.percentage = 100;
|
|
506
|
-
uploadFile.status = "success";
|
|
507
|
-
props2.onSuccess?.(response, uploadFile, uploadFiles);
|
|
508
|
-
};
|
|
509
|
-
const beforeUpload = async (rawFile) => {
|
|
510
|
-
const effect = (e, s) => {
|
|
511
|
-
const file = props2.fileList.find((item) => item.uid === rawFile.uid);
|
|
512
|
-
if (file) {
|
|
513
|
-
file.percentage = Number((e * 100).toFixed(2));
|
|
514
|
-
if (s === false) {
|
|
515
|
-
file.status = "uploading";
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
};
|
|
519
|
-
rawFile.progress = progress(effect)(false);
|
|
520
|
-
if (props2.beforeUpload) {
|
|
521
|
-
const res = await props2.beforeUpload?.(rawFile);
|
|
522
|
-
return res;
|
|
523
|
-
}
|
|
524
|
-
return true;
|
|
525
|
-
};
|
|
526
|
-
return {
|
|
527
|
-
formItemBindProps,
|
|
528
|
-
pickObject: utilsObject.pickObject,
|
|
529
|
-
coreBindProps,
|
|
530
|
-
uploadRef,
|
|
531
|
-
handleRemove,
|
|
532
|
-
readonly,
|
|
533
|
-
onSuccess,
|
|
534
|
-
// onProgress,
|
|
535
|
-
beforeUpload,
|
|
536
|
-
handleExceed,
|
|
537
|
-
tr
|
|
538
|
-
};
|
|
539
|
-
}
|
|
540
|
-
});
|
|
541
|
-
|
|
542
|
-
const _hoisted_1 = { class: "el-upload__tip" };
|
|
543
|
-
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
544
|
-
const _component_ElLink = vue.resolveComponent("ElLink");
|
|
545
|
-
const _component_FileVue = vue.resolveComponent("FileVue");
|
|
546
|
-
const _component_ElUpload = vue.resolveComponent("ElUpload");
|
|
547
|
-
const _component_VkfFormItem = vue.resolveComponent("VkfFormItem");
|
|
548
|
-
return vue.openBlock(), vue.createBlock(
|
|
549
|
-
_component_VkfFormItem,
|
|
550
|
-
vue.normalizeProps(vue.guardReactiveProps(_ctx.formItemBindProps)),
|
|
551
|
-
{
|
|
552
|
-
default: vue.withCtx(() => [
|
|
553
|
-
vue.createVNode(_component_ElUpload, vue.mergeProps(_ctx.coreBindProps, {
|
|
554
|
-
ref: "uploadRef",
|
|
555
|
-
class: ["vkf-upload", {
|
|
556
|
-
"is-readonly": _ctx.readonly,
|
|
557
|
-
"is-empty": _ctx.fileList?.length === 0,
|
|
558
|
-
"is-limit": _ctx.limit && _ctx.fileList?.length >= _ctx.limit,
|
|
559
|
-
"is-exceedable": _ctx.exceedable
|
|
560
|
-
}],
|
|
561
|
-
"file-list": _ctx.fileList ?? [],
|
|
562
|
-
"on-success": _ctx.onSuccess,
|
|
563
|
-
"before-upload": _ctx.beforeUpload,
|
|
564
|
-
disabled: _ctx.readonly || _ctx.disabled,
|
|
565
|
-
"on-exceed": _ctx.handleExceed,
|
|
566
|
-
"onUpdate:fileList": _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:fileList", $event))
|
|
567
|
-
}), vue.createSlots({
|
|
568
|
-
file: vue.withCtx(({ file }) => [
|
|
569
|
-
vue.createVNode(_component_FileVue, {
|
|
570
|
-
file,
|
|
571
|
-
"list-type": _ctx.listType,
|
|
572
|
-
disabled: _ctx.readonly || _ctx.disabled,
|
|
573
|
-
"on-preview": _ctx.onPreview,
|
|
574
|
-
preview: _ctx.preview,
|
|
575
|
-
"on-download": _ctx.onDownload,
|
|
576
|
-
"preview-label": _ctx.previewLabel,
|
|
577
|
-
onRemove: _ctx.handleRemove
|
|
578
|
-
}, null, 8, ["file", "list-type", "disabled", "on-preview", "preview", "on-download", "preview-label", "onRemove"])
|
|
579
|
-
]),
|
|
580
|
-
default: vue.withCtx(() => [
|
|
581
|
-
vue.renderSlot(_ctx.$slots, "default", {}, () => [
|
|
582
|
-
vue.createVNode(_component_ElLink, { type: "primary" }, {
|
|
583
|
-
default: vue.withCtx(() => [
|
|
584
|
-
vue.createTextVNode(
|
|
585
|
-
" + " + vue.toDisplayString(_ctx.tr("vkf.upload.selectFile", "\u9009\u62E9\u6587\u4EF6")),
|
|
586
|
-
1
|
|
587
|
-
/* TEXT */
|
|
588
|
-
)
|
|
589
|
-
]),
|
|
590
|
-
_: 1
|
|
591
|
-
/* STABLE */
|
|
592
|
-
})
|
|
593
|
-
])
|
|
594
|
-
]),
|
|
595
|
-
_: 2
|
|
596
|
-
/* DYNAMIC */
|
|
597
|
-
}, [
|
|
598
|
-
_ctx.tip ? {
|
|
599
|
-
name: "tip",
|
|
600
|
-
fn: vue.withCtx(() => [
|
|
601
|
-
vue.createElementVNode(
|
|
602
|
-
"div",
|
|
603
|
-
_hoisted_1,
|
|
604
|
-
vue.toDisplayString(_ctx.tip),
|
|
605
|
-
1
|
|
606
|
-
/* TEXT */
|
|
607
|
-
)
|
|
608
|
-
]),
|
|
609
|
-
key: "0"
|
|
610
|
-
} : void 0
|
|
611
|
-
]), 1040, ["class", "file-list", "on-success", "before-upload", "disabled", "on-exceed"]),
|
|
612
|
-
vue.createElementVNode(
|
|
613
|
-
"span",
|
|
614
|
-
{
|
|
615
|
-
class: vue.normalizeClass(["vkf-upload-empty-tip", {
|
|
616
|
-
"is-readonly": _ctx.readonly,
|
|
617
|
-
"is-empty": _ctx.fileList?.length === 0
|
|
618
|
-
}])
|
|
619
|
-
},
|
|
620
|
-
vue.toDisplayString(_ctx.tr("vkf.upload.empty", "\u6682\u65E0")),
|
|
621
|
-
3
|
|
622
|
-
/* TEXT, CLASS */
|
|
623
|
-
)
|
|
624
|
-
]),
|
|
625
|
-
_: 3
|
|
626
|
-
/* FORWARDED */
|
|
627
|
-
},
|
|
628
|
-
16
|
|
629
|
-
/* FULL_PROPS */
|
|
630
|
-
);
|
|
631
|
-
}
|
|
632
|
-
var Core = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/upload/src/index.vue"]]);
|
|
633
|
-
|
|
634
|
-
var _sfc_main = vue.defineComponent({
|
|
635
|
-
name: "VkfUpload",
|
|
636
|
-
props,
|
|
637
|
-
emits,
|
|
638
|
-
setup(props2, { emit, slots }) {
|
|
639
|
-
const coreEmits = createOnEmits(emit);
|
|
640
|
-
return () => vue.h(Core, {
|
|
641
|
-
...props2,
|
|
642
|
-
...utilsVue.vOn(coreEmits)
|
|
643
|
-
}, {
|
|
644
|
-
...props2.slots,
|
|
645
|
-
...slots
|
|
646
|
-
});
|
|
647
|
-
}
|
|
648
|
-
});
|
|
649
|
-
|
|
650
|
-
var VkfUpload = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/upload/src/wraper.vue"]]);
|
|
651
|
-
|
|
652
|
-
var types = /*#__PURE__*/Object.freeze({
|
|
653
|
-
__proto__: null
|
|
654
|
-
});
|
|
655
|
-
|
|
656
|
-
VkfUpload.install = (app) => {
|
|
657
|
-
app.component(VkfUpload.name || "VkfUpload", VkfUpload);
|
|
658
|
-
};
|
|
659
|
-
|
|
660
|
-
exports.VkfUpload = VkfUpload;
|
|
661
|
-
exports._VkfUploadCtx = ctx;
|
|
662
|
-
exports.__VkfUpload = types;
|
|
663
|
-
exports.default = VkfUpload;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),V=require("@vunk/form/components/form-item"),B=require("@vunk/core/shared/utils-vue"),m=require("element-plus"),I=require("@vunk/core/shared/utils-object"),z=require("@vunk/form/shared/element-plus"),y=require("../index.cjs"),D=require("@vunk/core/shared/utils-fetch"),$=require("@vunk/core/shared/utils-function"),F=require("@vunk/shared/function"),h=require("@vunk/form/composables/element-plus"),N=require("../_plugin-vue_export-helper.cjs"),L=require("@vunk/form/composables"),S=require("@vunk/form/shared/progress-it"),g={...V._VkfFormItemCtx.props,...m.uploadProps,tip:{type:String,default:""},preview:null,previewLabel:{type:String,default:void 0},beforeUpload:{type:Function,default:void 0},onDownload:{type:Function,default:void 0},onExceed:{type:Function,default:void 0},exceedable:{type:Boolean,default:!1},confirmExceed:{type:Boolean,default:!1},slots:null},T=B.bindPropsFactory(g),E={"update:fileList":null,remove:o=>o},U=B.onEmitsFactory(E),R=Object.freeze(Object.defineProperty({__proto__:null,createBindProps:T,createOnEmits:U,emits:E,props:g},Symbol.toStringTag,{value:"Module"})),q=new D.RestFetch({baseURL:""}),O=e.defineComponent({components:{ElProgress:m.ElProgress,ElIcon:m.ElIcon,Check:y.check_default,ZoomIn:y.zoom_in_default,Delete:y.delete_default,Close:y.close_default,CircleCheck:y.circle_check_default,Document:y.document_default,Download:y.download_default,ElButton:m.ElButton},props:{listType:{type:String,default:"text"},file:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1},onPreview:{type:Function,default:()=>$.NOOP},onDownload:{type:Function,default:void 0},preview:{type:[Boolean,Function],default:!1},previewLabel:{type:String,default:void 0}},emits:{remove:o=>o},setup(o,{emit:l}){const C=m.useNamespace("upload"),d=m.useNamespace("icon"),{tr:w}=h.useLocale(),u=(t=o.file)=>{l("remove",t)},f=(t=o.file)=>{if(o.onDownload){o.onDownload(t);return}let n="";t.url?n=t.url:t.raw&&(n=window.URL.createObjectURL(t.raw)),n&&q.download({url:n,fileName:t.name},{method:"GET"})},r=e.computed(()=>F.isCallable(o.preview)?o.preview(o.file):o.preview),v=e.computed(()=>o.previewLabel||w("el.upload.preview","预览"));return{handleRemove:u,nsIcon:d,nsUpload:C,handleDownload:f,handlePreview:(t=o.file)=>{r.value&&o.onPreview(t)},previewText:v,previewable:r,tr:w}}}),j=["src"];function M(o,l,C,d,w,u){const f=e.resolveComponent("Document"),r=e.resolveComponent("ElIcon"),v=e.resolveComponent("Download"),k=e.resolveComponent("ElButton"),t=e.resolveComponent("ElProgress"),n=e.resolveComponent("CircleCheck"),a=e.resolveComponent("Check"),i=e.resolveComponent("Close"),c=e.resolveComponent("ZoomIn"),p=e.resolveComponent("Delete");return e.openBlock(),e.createElementBlock(e.Fragment,null,[o.listType==="picture"||o.file.status!=="uploading"&&o.listType==="picture-card"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[/\.(svg|png|jpg|jpeg)$/.test(o.file.name)?(e.openBlock(),e.createElementBlock("img",{key:0,class:e.normalizeClass(o.nsUpload.be("list","item-thumbnail")),src:o.file.url,alt:""},null,10,j)):(e.openBlock(),e.createBlock(f,{key:1,class:e.normalizeClass([o.nsUpload.be("list","item-thumbnail"),o.nsIcon.m("document")])},null,8,["class"]))],64)):e.createCommentVNode("",!0),o.listType!=="picture-card"||o.file.status==="uploading"?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(o.nsUpload.be("list","item-info"))},[e.createElementVNode("a",{class:e.normalizeClass(o.nsUpload.be("list","item-name")),onClick:l[1]||(l[1]=e.withModifiers(s=>o.handlePreview(o.file),["prevent"]))},[e.createVNode(r,{class:e.normalizeClass(o.nsIcon.m("document"))},{default:e.withCtx(()=>[e.createVNode(f)]),_:1},8,["class"]),e.createVNode(r,{class:e.normalizeClass([o.nsIcon.m("download"),o.nsIcon.m("download-primary")]),onClick:l[0]||(l[0]=e.withModifiers(s=>o.handleDownload(o.file),["stop"]))},{default:e.withCtx(()=>[e.createVNode(v)]),_:1},8,["class"]),e.createElementVNode("span",{class:e.normalizeClass(o.nsUpload.be("list","item-file-name"))},e.toDisplayString(o.file.name),3)],2),o.listType==="picture"?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(o.nsUpload.be("list","item-file-actions"))},[e.createVNode(k,{disabled:!o.previewable,class:e.normalizeClass(o.nsUpload.be("list","item-file-action-preview")),plain:"",size:"small",round:"",onClick:l[2]||(l[2]=s=>o.handlePreview(o.file))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.previewText),1)]),_:1},8,["disabled","class"]),e.createVNode(k,{plain:"",size:"small",round:"",type:"primary",onClick:l[3]||(l[3]=s=>o.handleDownload(o.file))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.tr("vkf.common.download","下载")),1)]),_:1})],2)):e.createCommentVNode("",!0),o.file.status==="uploading"?(e.openBlock(),e.createBlock(t,{key:1,type:o.listType==="picture-card"?"circle":"line","stroke-width":o.listType==="picture-card"?6:2,percentage:Number(o.file.percentage),style:e.normalizeStyle(o.listType==="picture-card"?"":"margin-top: 0.5rem")},null,8,["type","stroke-width","percentage","style"])):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),e.createElementVNode("label",{class:e.normalizeClass(o.nsUpload.be("list","item-status-label"))},[o.listType==="text"?(e.openBlock(),e.createBlock(r,{key:0,class:e.normalizeClass([o.nsIcon.m("upload-success"),o.nsIcon.m("circle-check")])},{default:e.withCtx(()=>[e.createVNode(n)]),_:1},8,["class"])):["picture-card","picture"].includes(o.listType)?(e.openBlock(),e.createBlock(r,{key:1,class:e.normalizeClass([o.nsIcon.m("upload-success"),o.nsIcon.m("check")])},{default:e.withCtx(()=>[e.createVNode(a)]),_:1},8,["class"])):e.createCommentVNode("",!0)],2),o.disabled?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(r,{key:2,class:e.normalizeClass(o.nsIcon.m("close")),onClick:l[4]||(l[4]=s=>o.handleRemove(o.file))},{default:e.withCtx(()=>[e.createVNode(i)]),_:1},8,["class"])),o.listType==="picture-card"?(e.openBlock(),e.createElementBlock("span",{key:3,class:e.normalizeClass(o.nsUpload.be("list","item-actions"))},[o.previewable?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(o.nsUpload.be("list","item-preview")),onClick:l[5]||(l[5]=s=>o.handlePreview(o.file))},[e.createVNode(r,{class:e.normalizeClass(o.nsIcon.m("zoom-in"))},{default:e.withCtx(()=>[e.createVNode(c)]),_:1},8,["class"])],2)):e.createCommentVNode("",!0),e.createElementVNode("span",{class:e.normalizeClass(o.nsUpload.be("list","item-download")),onClick:l[6]||(l[6]=s=>o.handleDownload(o.file))},[e.createVNode(r,{class:e.normalizeClass(o.nsIcon.m("download"))},{default:e.withCtx(()=>[e.createVNode(v)]),_:1},8,["class"])],2),o.disabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(o.nsUpload.be("list","item-delete")),onClick:l[7]||(l[7]=s=>o.handleRemove(o.file))},[e.createVNode(r,{class:e.normalizeClass(o.nsIcon.m("delete"))},{default:e.withCtx(()=>[e.createVNode(p)]),_:1},8,["class"])],2))],2)):e.createCommentVNode("",!0)],64)}const Z=N._export_sfc(O,[["render",M]]),G=e.defineComponent({components:{VkfFormItem:V.VkfFormItem,ElUpload:m.ElUpload,FileVue:Z,ElLink:m.ElLink},props:g,emits:E,setup(o,{emit:l}){const C=V._VkfFormItemCtx.createBindProps(o),{tr:d}=h.useLocale(),w=z.createUploadBindProps(o,["disabled","fileList","beforeUpload","onSuccess"]),u=e.shallowRef(),f=n=>{var a,i;(a=u.value)==null||a.handleRemove(n),(i=u.value)==null||i.abort(n),l("update:fileList",o.fileList)},r=(n,a)=>{if(o.onExceed){o.onExceed(n,a);return}if(o.exceedable){const i=()=>{var c,p;(c=u.value)==null||c.clearFiles(),n.forEach(s=>{var b;s.uid=m.genFileId(),(b=u.value)==null||b.handleStart(s)}),(p=u.value)==null||p.submit()};o.confirmExceed?m.ElMessageBox.confirm(d("vkf.upload.exceedConfirm","已超过最大上传数量限制,是否使用新文件重新上传?"),d("el.messagebox.title","提示"),{confirmButtonText:d("el.upload.continue","继续"),cancelButtonText:d("el.messagebox.cancel","取消"),type:"warning"}).then(i):i()}},v=L.useComputedReadonly(o),k=(n,a,i)=>{var p,s;const c=a.raw;(p=c.progress)==null||p.call(c,!0),a.percentage=100,a.status="success",(s=o.onSuccess)==null||s.call(o,n,a,i)},t=async n=>{var i;const a=(c,p)=>{const s=o.fileList.find(b=>b.uid===n.uid);s&&(s.percentage=Number((c*100).toFixed(2)),p===!1&&(s.status="uploading"))};return n.progress=S(a)(!1),o.beforeUpload?await((i=o.beforeUpload)==null?void 0:i.call(o,n)):!0};return{formItemBindProps:C,pickObject:I.pickObject,coreBindProps:w,uploadRef:u,handleRemove:f,readonly:v,onSuccess:k,beforeUpload:t,handleExceed:r,tr:d}}}),H={class:"el-upload__tip"};function A(o,l,C,d,w,u){const f=e.resolveComponent("ElLink"),r=e.resolveComponent("FileVue"),v=e.resolveComponent("ElUpload"),k=e.resolveComponent("VkfFormItem");return e.openBlock(),e.createBlock(k,e.normalizeProps(e.guardReactiveProps(o.formItemBindProps)),{default:e.withCtx(()=>{var t,n,a;return[e.createVNode(v,e.mergeProps(o.coreBindProps,{ref:"uploadRef",class:["vkf-upload",{"is-readonly":o.readonly,"is-empty":((t=o.fileList)==null?void 0:t.length)===0,"is-limit":o.limit&&((n=o.fileList)==null?void 0:n.length)>=o.limit,"is-exceedable":o.exceedable}],"file-list":o.fileList??[],"on-success":o.onSuccess,"before-upload":o.beforeUpload,disabled:o.readonly||o.disabled,"on-exceed":o.handleExceed,"onUpdate:fileList":l[0]||(l[0]=i=>o.$emit("update:fileList",i))}),e.createSlots({file:e.withCtx(({file:i})=>[e.createVNode(r,{file:i,"list-type":o.listType,disabled:o.readonly||o.disabled,"on-preview":o.onPreview,preview:o.preview,"on-download":o.onDownload,"preview-label":o.previewLabel,onRemove:o.handleRemove},null,8,["file","list-type","disabled","on-preview","preview","on-download","preview-label","onRemove"])]),default:e.withCtx(()=>[e.renderSlot(o.$slots,"default",{},()=>[e.createVNode(f,{type:"primary"},{default:e.withCtx(()=>[e.createTextVNode(" + "+e.toDisplayString(o.tr("vkf.upload.selectFile","选择文件")),1)]),_:1})])]),_:2},[o.tip?{name:"tip",fn:e.withCtx(()=>[e.createElementVNode("div",H,e.toDisplayString(o.tip),1)]),key:"0"}:void 0]),1040,["class","file-list","on-success","before-upload","disabled","on-exceed"]),e.createElementVNode("span",{class:e.normalizeClass(["vkf-upload-empty-tip",{"is-readonly":o.readonly,"is-empty":((a=o.fileList)==null?void 0:a.length)===0}])},e.toDisplayString(o.tr("vkf.upload.empty","暂无")),3)]}),_:3},16)}const J=N._export_sfc(G,[["render",A]]),P=e.defineComponent({name:"VkfUpload",props:g,emits:E,setup(o,{emit:l,slots:C}){const d=U(l);return()=>e.h(J,{...o,...B.vOn(d)},{...o.slots,...C})}}),K=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));exports.VkfUpload=P;exports._VkfUploadCtx=R;exports.__VkfUpload=K;exports.default=P;
|