widget.qw 1.0.71 → 1.0.72
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/build/style.css +2 -2
- package/build/widget.qw.es.js +41 -15
- package/build/widget.qw.umd.js +41 -15
- package/package.json +1 -1
- package/src/components/FilePicker.vue +43 -14
- package/src/views/filepicker/index.vue +3 -3
package/build/style.css
CHANGED
|
@@ -412,10 +412,10 @@
|
|
|
412
412
|
text-align: center;
|
|
413
413
|
display: inline-block;
|
|
414
414
|
border-radius: 2px;
|
|
415
|
-
}[data-v-
|
|
415
|
+
}[data-v-0c20dca4] .label {
|
|
416
416
|
color: #000 !important;
|
|
417
417
|
}
|
|
418
|
-
[data-v-
|
|
418
|
+
[data-v-0c20dca4] .van-field__control:disabled {
|
|
419
419
|
color: #000 !important;
|
|
420
420
|
cursor: not-allowed;
|
|
421
421
|
opacity: 1;
|
package/build/widget.qw.es.js
CHANGED
|
@@ -18730,21 +18730,25 @@ const _sfc_main$i = {
|
|
|
18730
18730
|
}
|
|
18731
18731
|
};
|
|
18732
18732
|
var ImagesPicker = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-8fca1c96"]]);
|
|
18733
|
-
var FilePicker_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => "[data-v-
|
|
18733
|
+
var FilePicker_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => "[data-v-0c20dca4] .label {\n color: #000 !important;\n}\n[data-v-0c20dca4] .van-field__control:disabled {\n color: #000 !important;\n cursor: not-allowed;\n opacity: 1;\n -webkit-text-fill-color: #000;\n}")();
|
|
18734
18734
|
const _hoisted_1$b = {
|
|
18735
|
-
class: "
|
|
18735
|
+
class: "file-box"
|
|
18736
18736
|
};
|
|
18737
18737
|
const _sfc_main$h = {
|
|
18738
18738
|
__name: "FilePicker",
|
|
18739
18739
|
props: {
|
|
18740
18740
|
modelValue: {
|
|
18741
|
-
type: String,
|
|
18742
|
-
default:
|
|
18741
|
+
type: [String, Array],
|
|
18742
|
+
default: null
|
|
18743
18743
|
},
|
|
18744
18744
|
label: {
|
|
18745
18745
|
type: String,
|
|
18746
18746
|
default: ""
|
|
18747
18747
|
},
|
|
18748
|
+
multiple: {
|
|
18749
|
+
type: Boolean,
|
|
18750
|
+
default: false
|
|
18751
|
+
},
|
|
18748
18752
|
required: {
|
|
18749
18753
|
type: Boolean,
|
|
18750
18754
|
default: false
|
|
@@ -18791,22 +18795,44 @@ const _sfc_main$h = {
|
|
|
18791
18795
|
file: file.file
|
|
18792
18796
|
};
|
|
18793
18797
|
return util.file_upload(params).then((res) => {
|
|
18794
|
-
|
|
18798
|
+
if (props.multiple)
|
|
18799
|
+
modelValue.value = [...modelValue.value || [], res.data];
|
|
18800
|
+
else
|
|
18801
|
+
modelValue.value = res.data;
|
|
18795
18802
|
return Promise.resolve(file);
|
|
18796
18803
|
});
|
|
18797
18804
|
});
|
|
18798
18805
|
const onBeforeDelete = (e) => {
|
|
18799
|
-
|
|
18806
|
+
if (props.multiple) {
|
|
18807
|
+
let newUrls = props.modelValue.filter((item) => {
|
|
18808
|
+
return item != e.url;
|
|
18809
|
+
});
|
|
18810
|
+
emit("update:modelValue", newUrls);
|
|
18811
|
+
} else {
|
|
18812
|
+
modelValue.value = "";
|
|
18813
|
+
}
|
|
18800
18814
|
return Promise.resolve(e);
|
|
18801
18815
|
};
|
|
18802
18816
|
watch(() => props.modelValue, (newVal, oldVal) => {
|
|
18803
|
-
if (
|
|
18804
|
-
|
|
18805
|
-
|
|
18817
|
+
if (props.multiple) {
|
|
18818
|
+
if (!props.modelValue || props.modelValue.length < 1) {
|
|
18819
|
+
files.value = [];
|
|
18820
|
+
return;
|
|
18821
|
+
}
|
|
18822
|
+
files.value = props.modelValue.map((item) => {
|
|
18823
|
+
return {
|
|
18824
|
+
url: item
|
|
18825
|
+
};
|
|
18826
|
+
});
|
|
18827
|
+
} else {
|
|
18828
|
+
if (!props.modelValue) {
|
|
18829
|
+
files.value = [];
|
|
18830
|
+
return;
|
|
18831
|
+
}
|
|
18832
|
+
files.value = [{
|
|
18833
|
+
url: props.modelValue
|
|
18834
|
+
}];
|
|
18806
18835
|
}
|
|
18807
|
-
files.value = [{
|
|
18808
|
-
url: props.modelValue
|
|
18809
|
-
}];
|
|
18810
18836
|
}, {
|
|
18811
18837
|
immediate: true
|
|
18812
18838
|
});
|
|
@@ -18825,20 +18851,20 @@ const _sfc_main$h = {
|
|
|
18825
18851
|
input: withCtx(() => [createElementVNode("div", _hoisted_1$b, [createVNode(_component_van_uploader, {
|
|
18826
18852
|
modelValue: files.value,
|
|
18827
18853
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => files.value = $event),
|
|
18828
|
-
"max-count":
|
|
18854
|
+
"max-count": props.max,
|
|
18829
18855
|
afterRead: onAfterRead,
|
|
18830
18856
|
disabled: unref(isDisabled),
|
|
18831
18857
|
accept: props.accept,
|
|
18832
18858
|
"upload-icon": "plus",
|
|
18833
18859
|
deletable: !unref(isDisabled),
|
|
18834
18860
|
"before-delete": onBeforeDelete
|
|
18835
|
-
}, null, 8, ["modelValue", "disabled", "accept", "deletable"])])]),
|
|
18861
|
+
}, null, 8, ["modelValue", "max-count", "disabled", "accept", "deletable"])])]),
|
|
18836
18862
|
_: 1
|
|
18837
18863
|
}, 8, ["label", "required", "rules", "placeholder"])) : createCommentVNode("", true);
|
|
18838
18864
|
};
|
|
18839
18865
|
}
|
|
18840
18866
|
};
|
|
18841
|
-
var FilePicker = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-
|
|
18867
|
+
var FilePicker = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-0c20dca4"]]);
|
|
18842
18868
|
var SingleUserSelector_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => "\n.user-popup[data-v-a489ca4c] {\r\n width: 100%;\r\n overflow: hidden;\n}\n.department-selector[data-v-a489ca4c] {\r\n padding: 10px;\n}\n.search-buttons[data-v-a489ca4c] {\r\n display: flex;\r\n gap: 10px;\n}\n.clear-btn[data-v-a489ca4c] {\r\n background-color: #f2f3f5;\r\n border: none;\r\n border-radius: 4px;\r\n padding: 4px 8px;\r\n font-size: 14px;\n}\n.confirm-btn[data-v-a489ca4c] {\r\n background-color: #1989fa;\r\n color: white;\r\n border: none;\r\n border-radius: 4px;\r\n padding: 4px 8px;\r\n font-size: 14px;\n}\n.no-results[data-v-a489ca4c] {\r\n text-align: center;\r\n padding: 20px;\r\n color: #969799;\n}\n.picker-header[data-v-a489ca4c] {\r\n padding: 10px;\r\n border-bottom: 1px solid #ebedf0;\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\n}\n.current-path[data-v-a489ca4c] {\r\n flex: 1;\r\n font-size: 14px;\r\n color: #323233;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\n}\n.header-right[data-v-a489ca4c] {\r\n display: flex;\r\n gap: 8px;\r\n margin-left: auto;\n}\n.cancel-btn[data-v-a489ca4c] {\r\n color: #969799;\r\n margin-right: 5px;\n}\n.scroll-container[data-v-a489ca4c] {\r\n height: calc(80vh - 150px);\r\n overflow-y: auto;\n}\r\n")();
|
|
18843
18869
|
const _hoisted_1$a = {
|
|
18844
18870
|
class: "department-selector"
|
package/build/widget.qw.umd.js
CHANGED
|
@@ -18733,21 +18733,25 @@ var __async = (__this, __arguments, generator) => {
|
|
|
18733
18733
|
}
|
|
18734
18734
|
};
|
|
18735
18735
|
var ImagesPicker = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-8fca1c96"]]);
|
|
18736
|
-
var FilePicker_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => "[data-v-
|
|
18736
|
+
var FilePicker_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => "[data-v-0c20dca4] .label {\n color: #000 !important;\n}\n[data-v-0c20dca4] .van-field__control:disabled {\n color: #000 !important;\n cursor: not-allowed;\n opacity: 1;\n -webkit-text-fill-color: #000;\n}")();
|
|
18737
18737
|
const _hoisted_1$b = {
|
|
18738
|
-
class: "
|
|
18738
|
+
class: "file-box"
|
|
18739
18739
|
};
|
|
18740
18740
|
const _sfc_main$h = {
|
|
18741
18741
|
__name: "FilePicker",
|
|
18742
18742
|
props: {
|
|
18743
18743
|
modelValue: {
|
|
18744
|
-
type: String,
|
|
18745
|
-
default:
|
|
18744
|
+
type: [String, Array],
|
|
18745
|
+
default: null
|
|
18746
18746
|
},
|
|
18747
18747
|
label: {
|
|
18748
18748
|
type: String,
|
|
18749
18749
|
default: ""
|
|
18750
18750
|
},
|
|
18751
|
+
multiple: {
|
|
18752
|
+
type: Boolean,
|
|
18753
|
+
default: false
|
|
18754
|
+
},
|
|
18751
18755
|
required: {
|
|
18752
18756
|
type: Boolean,
|
|
18753
18757
|
default: false
|
|
@@ -18794,22 +18798,44 @@ var __async = (__this, __arguments, generator) => {
|
|
|
18794
18798
|
file: file.file
|
|
18795
18799
|
};
|
|
18796
18800
|
return util.file_upload(params).then((res) => {
|
|
18797
|
-
|
|
18801
|
+
if (props.multiple)
|
|
18802
|
+
modelValue.value = [...modelValue.value || [], res.data];
|
|
18803
|
+
else
|
|
18804
|
+
modelValue.value = res.data;
|
|
18798
18805
|
return Promise.resolve(file);
|
|
18799
18806
|
});
|
|
18800
18807
|
});
|
|
18801
18808
|
const onBeforeDelete = (e) => {
|
|
18802
|
-
|
|
18809
|
+
if (props.multiple) {
|
|
18810
|
+
let newUrls = props.modelValue.filter((item) => {
|
|
18811
|
+
return item != e.url;
|
|
18812
|
+
});
|
|
18813
|
+
emit("update:modelValue", newUrls);
|
|
18814
|
+
} else {
|
|
18815
|
+
modelValue.value = "";
|
|
18816
|
+
}
|
|
18803
18817
|
return Promise.resolve(e);
|
|
18804
18818
|
};
|
|
18805
18819
|
vue.watch(() => props.modelValue, (newVal, oldVal) => {
|
|
18806
|
-
if (
|
|
18807
|
-
|
|
18808
|
-
|
|
18820
|
+
if (props.multiple) {
|
|
18821
|
+
if (!props.modelValue || props.modelValue.length < 1) {
|
|
18822
|
+
files.value = [];
|
|
18823
|
+
return;
|
|
18824
|
+
}
|
|
18825
|
+
files.value = props.modelValue.map((item) => {
|
|
18826
|
+
return {
|
|
18827
|
+
url: item
|
|
18828
|
+
};
|
|
18829
|
+
});
|
|
18830
|
+
} else {
|
|
18831
|
+
if (!props.modelValue) {
|
|
18832
|
+
files.value = [];
|
|
18833
|
+
return;
|
|
18834
|
+
}
|
|
18835
|
+
files.value = [{
|
|
18836
|
+
url: props.modelValue
|
|
18837
|
+
}];
|
|
18809
18838
|
}
|
|
18810
|
-
files.value = [{
|
|
18811
|
-
url: props.modelValue
|
|
18812
|
-
}];
|
|
18813
18839
|
}, {
|
|
18814
18840
|
immediate: true
|
|
18815
18841
|
});
|
|
@@ -18828,20 +18854,20 @@ var __async = (__this, __arguments, generator) => {
|
|
|
18828
18854
|
input: vue.withCtx(() => [vue.createElementVNode("div", _hoisted_1$b, [vue.createVNode(_component_van_uploader, {
|
|
18829
18855
|
modelValue: files.value,
|
|
18830
18856
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => files.value = $event),
|
|
18831
|
-
"max-count":
|
|
18857
|
+
"max-count": props.max,
|
|
18832
18858
|
afterRead: onAfterRead,
|
|
18833
18859
|
disabled: vue.unref(isDisabled),
|
|
18834
18860
|
accept: props.accept,
|
|
18835
18861
|
"upload-icon": "plus",
|
|
18836
18862
|
deletable: !vue.unref(isDisabled),
|
|
18837
18863
|
"before-delete": onBeforeDelete
|
|
18838
|
-
}, null, 8, ["modelValue", "disabled", "accept", "deletable"])])]),
|
|
18864
|
+
}, null, 8, ["modelValue", "max-count", "disabled", "accept", "deletable"])])]),
|
|
18839
18865
|
_: 1
|
|
18840
18866
|
}, 8, ["label", "required", "rules", "placeholder"])) : vue.createCommentVNode("", true);
|
|
18841
18867
|
};
|
|
18842
18868
|
}
|
|
18843
18869
|
};
|
|
18844
|
-
var FilePicker = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-
|
|
18870
|
+
var FilePicker = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-0c20dca4"]]);
|
|
18845
18871
|
var SingleUserSelector_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => "\n.user-popup[data-v-a489ca4c] {\r\n width: 100%;\r\n overflow: hidden;\n}\n.department-selector[data-v-a489ca4c] {\r\n padding: 10px;\n}\n.search-buttons[data-v-a489ca4c] {\r\n display: flex;\r\n gap: 10px;\n}\n.clear-btn[data-v-a489ca4c] {\r\n background-color: #f2f3f5;\r\n border: none;\r\n border-radius: 4px;\r\n padding: 4px 8px;\r\n font-size: 14px;\n}\n.confirm-btn[data-v-a489ca4c] {\r\n background-color: #1989fa;\r\n color: white;\r\n border: none;\r\n border-radius: 4px;\r\n padding: 4px 8px;\r\n font-size: 14px;\n}\n.no-results[data-v-a489ca4c] {\r\n text-align: center;\r\n padding: 20px;\r\n color: #969799;\n}\n.picker-header[data-v-a489ca4c] {\r\n padding: 10px;\r\n border-bottom: 1px solid #ebedf0;\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\n}\n.current-path[data-v-a489ca4c] {\r\n flex: 1;\r\n font-size: 14px;\r\n color: #323233;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\n}\n.header-right[data-v-a489ca4c] {\r\n display: flex;\r\n gap: 8px;\r\n margin-left: auto;\n}\n.cancel-btn[data-v-a489ca4c] {\r\n color: #969799;\r\n margin-right: 5px;\n}\n.scroll-container[data-v-a489ca4c] {\r\n height: calc(80vh - 150px);\r\n overflow-y: auto;\n}\r\n")();
|
|
18846
18872
|
const _hoisted_1$a = {
|
|
18847
18873
|
class: "department-selector"
|
package/package.json
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
<van-field v-if="!isGone" name="image" :label="props.label" :required="isRequired" :rules="props.rules"
|
|
3
3
|
label-class="label" :placeholder="props.placeholder">
|
|
4
4
|
<template #input>
|
|
5
|
-
<div class="
|
|
6
|
-
<van-uploader v-model="files" :max-count="
|
|
7
|
-
:accept="props.accept" upload-icon="plus" :deletable="!isDisabled"
|
|
5
|
+
<div class="file-box">
|
|
6
|
+
<van-uploader v-model="files" :max-count="props.max" :afterRead="onAfterRead" :disabled="isDisabled"
|
|
7
|
+
:accept="props.accept" upload-icon="plus" :deletable="!isDisabled"
|
|
8
|
+
:before-delete="onBeforeDelete" />
|
|
8
9
|
</div>
|
|
9
10
|
</template>
|
|
10
11
|
</van-field>
|
|
@@ -17,13 +18,17 @@ import { useVModel } from "@vueuse/core"
|
|
|
17
18
|
|
|
18
19
|
const props = defineProps({
|
|
19
20
|
modelValue: {
|
|
20
|
-
type: String,
|
|
21
|
-
default:
|
|
21
|
+
type: [String, Array],
|
|
22
|
+
default: null
|
|
22
23
|
},
|
|
23
24
|
label: {
|
|
24
25
|
type: String,
|
|
25
26
|
default: ''
|
|
26
27
|
},
|
|
28
|
+
multiple: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false
|
|
31
|
+
},
|
|
27
32
|
required: {
|
|
28
33
|
type: Boolean,
|
|
29
34
|
default: false
|
|
@@ -67,26 +72,50 @@ const onAfterRead = async (file) => {
|
|
|
67
72
|
}
|
|
68
73
|
|
|
69
74
|
return util.file_upload(params).then(res => {
|
|
70
|
-
|
|
75
|
+
if (props.multiple)
|
|
76
|
+
modelValue.value = [...(modelValue.value || []), res.data]
|
|
77
|
+
else
|
|
78
|
+
modelValue.value = res.data
|
|
71
79
|
return Promise.resolve(file)
|
|
72
80
|
})
|
|
73
81
|
}
|
|
74
82
|
|
|
75
83
|
const onBeforeDelete = (e) => {
|
|
76
|
-
|
|
84
|
+
if (props.multiple) {
|
|
85
|
+
let newUrls = props.modelValue.filter(item => {
|
|
86
|
+
return item != e.url
|
|
87
|
+
})
|
|
88
|
+
emit('update:modelValue', newUrls)
|
|
89
|
+
} else {
|
|
90
|
+
modelValue.value = ''
|
|
91
|
+
}
|
|
92
|
+
|
|
77
93
|
return Promise.resolve(e)
|
|
78
94
|
}
|
|
79
95
|
|
|
80
96
|
watch(() => props.modelValue,
|
|
81
97
|
(newVal, oldVal) => {
|
|
82
|
-
if (
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
98
|
+
if (props.multiple) {
|
|
99
|
+
if (!props.modelValue || props.modelValue.length < 1) {
|
|
100
|
+
files.value = []
|
|
101
|
+
return
|
|
102
|
+
}
|
|
86
103
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
104
|
+
files.value = props.modelValue.map(item => {
|
|
105
|
+
return {
|
|
106
|
+
url: item
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
} else {
|
|
110
|
+
if (!props.modelValue) {
|
|
111
|
+
files.value = []
|
|
112
|
+
return
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
files.value = [{
|
|
116
|
+
url: props.modelValue
|
|
117
|
+
}]
|
|
118
|
+
}
|
|
90
119
|
},
|
|
91
120
|
{
|
|
92
121
|
immediate: true
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="page">
|
|
3
|
-
<widget-qw-file-picker label="文件" v-model="data.
|
|
3
|
+
<widget-qw-file-picker label="文件" multiple v-model="data.urls" :auth="data.auth" accept=".jpg,.png" />
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
import { onMounted, reactive, watch } from "vue";
|
|
9
9
|
|
|
10
10
|
const data = reactive({
|
|
11
|
-
auth:'
|
|
12
|
-
|
|
11
|
+
auth:'require',
|
|
12
|
+
urls: ['https://1.pdf']
|
|
13
13
|
})
|
|
14
14
|
|
|
15
15
|
watch(()=>data.url,(newVal,oldVal)=>{
|