@netang/quasar 0.0.53 → 0.0.55
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/_docs/docs/.vuepress/client.js +39 -0
- package/_docs/docs/.vuepress/components/test.vue +23 -0
- package/_docs/docs/.vuepress/config.js +40 -0
- package/_docs/docs/.vuepress/configs/index.js +2 -0
- package/_docs/docs/.vuepress/configs/navbar/index.js +1 -0
- package/_docs/docs/.vuepress/configs/navbar/zh.js +16 -0
- package/_docs/docs/.vuepress/configs/sidebar/index.js +1 -0
- package/_docs/docs/.vuepress/configs/sidebar/zh.js +20 -0
- package/_docs/docs/.vuepress/public/css/index.css +3 -0
- package/_docs/docs/.vuepress/styles/index.scss +3 -0
- package/_docs/docs/components/field-table.md +63 -0
- package/_docs/docs/components/field-tree.md +1 -0
- package/{docs → _docs}/docs/index.md +0 -0
- package/{docs → _docs}/docs/utils/alert.md +0 -0
- package/{docs → _docs}/docs/utils/confirm.md +0 -0
- package/_docs/docs/utils/index.md +1 -0
- package/_docs/package.json +17 -0
- package/components/column-title/index.vue +2 -2
- package/components/data/index.vue +20 -23
- package/components/dialog/index.vue +26 -12
- package/components/dialog-table/index.vue +4 -2
- package/components/dragger/index.vue +3 -2
- package/components/drawer/index.vue +16 -9
- package/components/editor-code/index.vue +12 -5
- package/components/empty/index.vue +16 -1
- package/components/field-date/index.vue +48 -36
- package/components/field-table/index.vue +69 -43
- package/components/field-text/index.vue +6 -2
- package/components/field-tree/index.vue +40 -22
- package/components/input-number/index.vue +5 -4
- package/components/list-menu/index.vue +14 -2
- package/components/power-page/index.vue +10 -0
- package/components/private/components/index.js +7 -2
- package/components/private/components/move-to-tree/index.vue +7 -3
- package/components/private/edit-power-data/index.vue +92 -52
- package/components/private/table-visible-columns-button/index.vue +6 -2
- package/components/render/index.vue +21 -7
- package/components/search/index.vue +30 -2
- package/components/search-item/index.vue +24 -8
- package/components/select/index.vue +5 -2
- package/components/splitter/index.vue +13 -9
- package/components/table/index.vue +32 -5
- package/components/table-pagination/index.vue +0 -1
- package/components/table-splitter/index.vue +22 -3
- package/components/table-summary/index.vue +10 -3
- package/components/thumbnail/index.vue +16 -6
- package/components/toolbar/index.vue +0 -2
- package/components/uploader/index.vue +5 -2
- package/components/uploader-query/index.vue +48 -27
- package/components/value-format/index.vue +19 -12
- package/configs/area3.js +1 -0
- package/docs/404.html +33 -0
- package/docs/assets/404.html-60b35caa.js +1 -0
- package/docs/assets/404.html-d1e63d77.js +1 -0
- package/docs/assets/alert.html-568d4e94.js +1 -0
- package/docs/assets/alert.html-f5dbc3e9.js +1 -0
- package/docs/assets/app-8c3ae4de.js +6 -0
- package/docs/assets/back-to-top-8efcbe56.svg +1 -0
- package/docs/assets/confirm.html-7a1566f6.js +1 -0
- package/docs/assets/confirm.html-96f1b004.js +1 -0
- package/docs/assets/field-table.html-68d610b0.js +1 -0
- package/docs/assets/field-table.html-86cc3511.js +1 -0
- package/docs/assets/field-tree.html-45410c3c.js +1 -0
- package/docs/assets/field-tree.html-c98ac993.js +1 -0
- package/docs/assets/framework-204010b2.js +5 -0
- package/docs/assets/index.html-1695dd7c.js +1 -0
- package/docs/assets/index.html-65a4aa67.js +1 -0
- package/docs/assets/style-ac5a9aa6.css +1 -0
- package/docs/components/field-table.html +33 -0
- package/docs/components/field-tree.html +33 -0
- package/docs/index.html +33 -0
- package/docs/utils/alert.html +33 -0
- package/docs/utils/confirm.html +33 -0
- package/package.json +1 -1
- package/package2.json +30 -0
- package/store/index.js +3 -20
- package/utils/alert.js +3 -1
- package/utils/area.js +27 -14
- package/utils/arr.js +6 -2
- package/utils/auth.js +40 -35
- package/utils/bus.js +1 -1
- package/utils/config.js +42 -15
- package/utils/{confrim.js → confirm.js} +1 -1
- package/utils/copy.js +18 -0
- package/utils/dialog.js +7 -3
- package/utils/dict.js +5 -28
- package/utils/dictOptions.js +24 -0
- package/utils/form.js +6 -2
- package/utils/getData.js +21 -9
- package/utils/getFile.js +11 -5
- package/utils/getImage.js +23 -12
- package/utils/getTime.js +9 -4
- package/utils/index.js +61 -0
- package/utils/loading.js +3 -1
- package/utils/notify.js +1 -1
- package/utils/power.js +164 -118
- package/utils/previewImage.js +4 -2
- package/utils/price.js +12 -3
- package/utils/rule.js +5 -9
- package/utils/ruleValid.js +10 -0
- package/utils/search.js +81 -50
- package/utils/table.js +119 -87
- package/utils/timestamp.js +2 -2
- package/utils/toast.js +1 -1
- package/utils/tree.js +69 -46
- package/utils/uploader/qiniu.js +31 -15
- package/utils/uploader.js +87 -56
- package/utils/useAuth.js +12 -5
- package/utils/useRouter.js +16 -5
- package/utils/useUploader.js +0 -5
- package/docs/docs/.vuepress/config.js +0 -32
- package/docs/docs/components/field-table.md +0 -1
- package/docs/docs/components/field-tree.md +0 -1
- package/docs/package.json +0 -11
- package/utils/http.js +0 -251
|
@@ -26,6 +26,12 @@
|
|
|
26
26
|
import { computed, ref, watch, inject } from 'vue'
|
|
27
27
|
import { useQuasar } from 'quasar'
|
|
28
28
|
|
|
29
|
+
import $n_router from '@netang/vue-utils/router'
|
|
30
|
+
|
|
31
|
+
import $n_storage from '@netang/utils/storage'
|
|
32
|
+
import $n_sleep from '@netang/utils/sleep'
|
|
33
|
+
import $n_isValidObject from '@netang/utils/isValidObject'
|
|
34
|
+
|
|
29
35
|
import { NPowerKey } from '../../utils/symbols'
|
|
30
36
|
|
|
31
37
|
export default {
|
|
@@ -104,10 +110,10 @@ export default {
|
|
|
104
110
|
if (props.cache) {
|
|
105
111
|
|
|
106
112
|
// 设置缓存名
|
|
107
|
-
cacheName = `splitter:${props.cache === true ? ($power && $power.routePath ? $power.routePath : $
|
|
113
|
+
cacheName = `splitter:${props.cache === true ? ($power && $power.routePath ? $power.routePath : $n_router.getRoute('path')) : props.cache}:`
|
|
108
114
|
|
|
109
115
|
// 从缓存获取初始值
|
|
110
|
-
let cache = $
|
|
116
|
+
let cache = $n_storage.get(cacheName + 'modelValue')
|
|
111
117
|
if (cache !== null) {
|
|
112
118
|
rawValue = cache
|
|
113
119
|
}
|
|
@@ -119,7 +125,7 @@ export default {
|
|
|
119
125
|
|
|
120
126
|
} else {
|
|
121
127
|
// 从缓存获取初始值
|
|
122
|
-
cache = $
|
|
128
|
+
cache = $n_storage.get(cacheName + 'before')
|
|
123
129
|
if (cache !== null) {
|
|
124
130
|
rawBefore = cache
|
|
125
131
|
}
|
|
@@ -132,7 +138,7 @@ export default {
|
|
|
132
138
|
|
|
133
139
|
} else {
|
|
134
140
|
// 从缓存获取初始值
|
|
135
|
-
cache = $
|
|
141
|
+
cache = $n_storage.get(cacheName + 'after')
|
|
136
142
|
if (cache !== null) {
|
|
137
143
|
rawAfter = cache
|
|
138
144
|
}
|
|
@@ -155,7 +161,7 @@ export default {
|
|
|
155
161
|
}
|
|
156
162
|
|
|
157
163
|
// 创建睡眠实例
|
|
158
|
-
const sleep = $
|
|
164
|
+
const sleep = $n_sleep()
|
|
159
165
|
|
|
160
166
|
// 当前值
|
|
161
167
|
const currentValue = ref(rawValue)
|
|
@@ -184,7 +190,7 @@ export default {
|
|
|
184
190
|
|
|
185
191
|
const keys = []
|
|
186
192
|
|
|
187
|
-
if ($
|
|
193
|
+
if ($n_isValidObject(slots)) {
|
|
188
194
|
|
|
189
195
|
for (const key in slots) {
|
|
190
196
|
if (key === 'before') {
|
|
@@ -243,7 +249,7 @@ export default {
|
|
|
243
249
|
await sleep(500, key)
|
|
244
250
|
|
|
245
251
|
// 设置缓存(永久缓存)
|
|
246
|
-
$
|
|
252
|
+
$n_storage.set(cacheName + key, val, 0)
|
|
247
253
|
}
|
|
248
254
|
}
|
|
249
255
|
|
|
@@ -352,8 +358,6 @@ export default {
|
|
|
352
358
|
</script>
|
|
353
359
|
|
|
354
360
|
<style lang="scss">
|
|
355
|
-
@import "@/assets/sass/var.scss";
|
|
356
|
-
|
|
357
361
|
.n-splitter {
|
|
358
362
|
|
|
359
363
|
// 分离器激活背景色
|
|
@@ -179,8 +179,22 @@
|
|
|
179
179
|
<script>
|
|
180
180
|
import { ref, watch, computed, inject } from 'vue'
|
|
181
181
|
|
|
182
|
+
import $n_isFunction from 'lodash/isFunction'
|
|
183
|
+
|
|
184
|
+
import $n_isValidObject from '@netang/utils/isValidObject'
|
|
185
|
+
import $n_isValidValue from '@netang/utils/isValidValue'
|
|
186
|
+
import $n_collection from '@netang/utils/collection'
|
|
187
|
+
|
|
182
188
|
import { NDialogKey, NTableKey } from '../../utils/symbols'
|
|
183
189
|
|
|
190
|
+
import NToolbar from '../toolbar'
|
|
191
|
+
import NDrawer from '../drawer'
|
|
192
|
+
import NThumbnail from '../thumbnail'
|
|
193
|
+
import NTableColumnFixed from '../table-column-fixed'
|
|
194
|
+
import NTableSummary from '../table-summary'
|
|
195
|
+
import NTablePagination from '../table-pagination'
|
|
196
|
+
import NSearch from '../search'
|
|
197
|
+
|
|
184
198
|
export default {
|
|
185
199
|
|
|
186
200
|
/**
|
|
@@ -188,6 +202,19 @@ export default {
|
|
|
188
202
|
*/
|
|
189
203
|
name: 'NTable',
|
|
190
204
|
|
|
205
|
+
/**
|
|
206
|
+
* 组件
|
|
207
|
+
*/
|
|
208
|
+
components: {
|
|
209
|
+
NToolbar,
|
|
210
|
+
NDrawer,
|
|
211
|
+
NThumbnail,
|
|
212
|
+
NTableColumnFixed,
|
|
213
|
+
NTableSummary,
|
|
214
|
+
NTablePagination,
|
|
215
|
+
NSearch,
|
|
216
|
+
},
|
|
217
|
+
|
|
191
218
|
/**
|
|
192
219
|
* 声明属性
|
|
193
220
|
*/
|
|
@@ -308,7 +335,7 @@ export default {
|
|
|
308
335
|
let rightDrawer = false
|
|
309
336
|
|
|
310
337
|
// 如果有插槽
|
|
311
|
-
if ($
|
|
338
|
+
if ($n_isValidObject(slots)) {
|
|
312
339
|
for (const key in slots) {
|
|
313
340
|
if (key.startsWith('toolbar-')) {
|
|
314
341
|
toolbar.push(key.replace('toolbar-', ''))
|
|
@@ -336,13 +363,13 @@ export default {
|
|
|
336
363
|
// ==========【监听数据】=========================================================================================
|
|
337
364
|
|
|
338
365
|
// 如果有树节点点击方法
|
|
339
|
-
if ($
|
|
366
|
+
if ($n_isFunction(props.treeNodeClick)) {
|
|
340
367
|
|
|
341
368
|
/**
|
|
342
369
|
* 树节点 all
|
|
343
370
|
*/
|
|
344
371
|
const treeNodesAll = computed(function () {
|
|
345
|
-
return $
|
|
372
|
+
return $n_collection(props.treeNodes)
|
|
346
373
|
.keyBy(props.treeNodeKey)
|
|
347
374
|
.toObject()
|
|
348
375
|
})
|
|
@@ -356,7 +383,7 @@ export default {
|
|
|
356
383
|
watch(treeSelected, function(nodeKey) {
|
|
357
384
|
|
|
358
385
|
// 如果节点值不是有效值
|
|
359
|
-
if (! $
|
|
386
|
+
if (! $n_isValidValue(nodeKey)) {
|
|
360
387
|
|
|
361
388
|
// 则无任何操作
|
|
362
389
|
return
|
|
@@ -365,7 +392,7 @@ export default {
|
|
|
365
392
|
// 树节点点击
|
|
366
393
|
const res = props.treeNodeClick(nodeKey, treeNodesAll.value[nodeKey])
|
|
367
394
|
|
|
368
|
-
if ($
|
|
395
|
+
if ($n_isValidObject(res)) {
|
|
369
396
|
|
|
370
397
|
// 设置表格传参
|
|
371
398
|
$table.setQuery(res)
|
|
@@ -81,6 +81,15 @@
|
|
|
81
81
|
import { nextTick, ref, watch, computed, inject } from 'vue'
|
|
82
82
|
import { useQuasar } from 'quasar'
|
|
83
83
|
|
|
84
|
+
import $n_isFunction from 'lodash/isFunction'
|
|
85
|
+
|
|
86
|
+
import $n_isValidObject from '@netang/utils/isValidObject'
|
|
87
|
+
|
|
88
|
+
import NSplitter from '../splitter'
|
|
89
|
+
import NTable from '../table'
|
|
90
|
+
import NRender from '../render'
|
|
91
|
+
import NEmpty from '../empty'
|
|
92
|
+
|
|
84
93
|
import { NTableKey } from '../../utils/symbols'
|
|
85
94
|
|
|
86
95
|
export default {
|
|
@@ -95,6 +104,16 @@ export default {
|
|
|
95
104
|
*/
|
|
96
105
|
name: 'NTableSplitter',
|
|
97
106
|
|
|
107
|
+
/**
|
|
108
|
+
* 组件
|
|
109
|
+
*/
|
|
110
|
+
components: {
|
|
111
|
+
NSplitter,
|
|
112
|
+
NTable,
|
|
113
|
+
NRender,
|
|
114
|
+
NEmpty,
|
|
115
|
+
},
|
|
116
|
+
|
|
98
117
|
/**
|
|
99
118
|
* 声明属性
|
|
100
119
|
*/
|
|
@@ -167,7 +186,7 @@ export default {
|
|
|
167
186
|
* 插槽标识
|
|
168
187
|
*/
|
|
169
188
|
const slotNames = computed(function() {
|
|
170
|
-
return $
|
|
189
|
+
return $n_isValidObject(slots) ? Object.keys(slots).filter(e => e !== 'toolbar-right') : []
|
|
171
190
|
})
|
|
172
191
|
|
|
173
192
|
/**
|
|
@@ -185,10 +204,10 @@ export default {
|
|
|
185
204
|
// 如果有已选数据
|
|
186
205
|
if (
|
|
187
206
|
currentSelectedItem.value
|
|
188
|
-
&& $
|
|
207
|
+
&& $n_isFunction(props.renderQuery)
|
|
189
208
|
) {
|
|
190
209
|
const resQuery = props.renderQuery(currentSelectedItem.value)
|
|
191
|
-
if ($
|
|
210
|
+
if ($n_isValidObject(resQuery)) {
|
|
192
211
|
|
|
193
212
|
// 如果需要加载渲染页面标识参数
|
|
194
213
|
if (! props.noRendPageName) {
|
|
@@ -16,6 +16,13 @@
|
|
|
16
16
|
<script>
|
|
17
17
|
import { computed, inject } from 'vue'
|
|
18
18
|
|
|
19
|
+
import $n_has from 'lodash/has'
|
|
20
|
+
import $n_get from 'lodash/get'
|
|
21
|
+
|
|
22
|
+
import $n_forEach from '@netang/utils/forEach'
|
|
23
|
+
|
|
24
|
+
import $n_price from '../../utils/price'
|
|
25
|
+
|
|
19
26
|
import { NTableKey } from '../../utils/symbols'
|
|
20
27
|
|
|
21
28
|
export default {
|
|
@@ -63,7 +70,7 @@ export default {
|
|
|
63
70
|
})
|
|
64
71
|
}
|
|
65
72
|
|
|
66
|
-
$
|
|
73
|
+
$n_forEach($n_get(props.props, 'cols'), function(item) {
|
|
67
74
|
|
|
68
75
|
const {
|
|
69
76
|
// 标识
|
|
@@ -79,9 +86,9 @@ export default {
|
|
|
79
86
|
}
|
|
80
87
|
|
|
81
88
|
// 如果有统计字段
|
|
82
|
-
if ($
|
|
89
|
+
if ($n_has(props.data, name)) {
|
|
83
90
|
// 判断是否是价格
|
|
84
|
-
res.value = $
|
|
91
|
+
res.value = $n_has(item, 'price') ? $n_price(props.data[name]) : props.data[name]
|
|
85
92
|
}
|
|
86
93
|
|
|
87
94
|
lists.push(res)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<q-img
|
|
3
3
|
:src="currentSrc"
|
|
4
|
-
:spinner-size="
|
|
5
|
-
:width="
|
|
6
|
-
:height="
|
|
4
|
+
:spinner-size="toPx(size / 2)"
|
|
5
|
+
:width="toPx(size)"
|
|
6
|
+
:height="toPx(size)"
|
|
7
7
|
fit="fill"
|
|
8
8
|
v-if="currentSrc"
|
|
9
9
|
>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<div
|
|
12
12
|
class="absolute-full transparent cursor-pointer"
|
|
13
13
|
@click.prevent.stop="onPreview"
|
|
14
|
-
@dblclick.prevent.stop="
|
|
14
|
+
@dblclick.prevent.stop="onNoop"
|
|
15
15
|
v-if="preview"
|
|
16
16
|
></div>
|
|
17
17
|
</q-img>
|
|
@@ -21,6 +21,11 @@
|
|
|
21
21
|
import { computed } from 'vue'
|
|
22
22
|
import { useQuasar } from 'quasar'
|
|
23
23
|
|
|
24
|
+
import $n_px from '@netang/utils/px'
|
|
25
|
+
import $n_noop from '@netang/utils/noop'
|
|
26
|
+
|
|
27
|
+
import $n_previewImage from '../../utils/previewImage'
|
|
28
|
+
import $n_getImage from '../../utils/getImage'
|
|
24
29
|
|
|
25
30
|
export default {
|
|
26
31
|
|
|
@@ -60,7 +65,7 @@ export default {
|
|
|
60
65
|
* 当前图片地址
|
|
61
66
|
*/
|
|
62
67
|
const currentSrc = computed(function () {
|
|
63
|
-
const res = $
|
|
68
|
+
const res = $n_getImage(props.src, { w: $q.platform.is.mobile ? props.size * 2 : props.size })
|
|
64
69
|
if (res) {
|
|
65
70
|
return res
|
|
66
71
|
}
|
|
@@ -73,7 +78,7 @@ export default {
|
|
|
73
78
|
*/
|
|
74
79
|
function onPreview() {
|
|
75
80
|
// 预览图片
|
|
76
|
-
$
|
|
81
|
+
$n_previewImage(props.src)
|
|
77
82
|
}
|
|
78
83
|
|
|
79
84
|
return {
|
|
@@ -81,6 +86,11 @@ export default {
|
|
|
81
86
|
currentSrc,
|
|
82
87
|
// 预览
|
|
83
88
|
onPreview,
|
|
89
|
+
|
|
90
|
+
// 转像素
|
|
91
|
+
toPx: $n_px,
|
|
92
|
+
// 点击空方法
|
|
93
|
+
onNoop: $n_noop,
|
|
84
94
|
}
|
|
85
95
|
}
|
|
86
96
|
}
|
|
@@ -21,7 +21,10 @@
|
|
|
21
21
|
|
|
22
22
|
<script>
|
|
23
23
|
import { onMounted, ref, provide, inject } from 'vue'
|
|
24
|
-
|
|
24
|
+
|
|
25
|
+
import $n_uploader from '../../utils/uploader'
|
|
26
|
+
|
|
27
|
+
import { NPowerKey, NUploaderKey } from '../../utils/symbols'
|
|
25
28
|
|
|
26
29
|
export default {
|
|
27
30
|
|
|
@@ -90,7 +93,7 @@ export default {
|
|
|
90
93
|
const uploadFileLists = ref([])
|
|
91
94
|
|
|
92
95
|
// 创建上传器
|
|
93
|
-
const uploader = $
|
|
96
|
+
const uploader = $n_uploader.create({
|
|
94
97
|
type: props.type,
|
|
95
98
|
// 声明属性
|
|
96
99
|
props,
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
<div
|
|
45
45
|
class="n-uploader-query__button--square cursor-pointer"
|
|
46
46
|
:style="{
|
|
47
|
-
width:
|
|
48
|
-
height:
|
|
47
|
+
width: toPx(currentSize),
|
|
48
|
+
height: toPx(currentSize),
|
|
49
49
|
}"
|
|
50
50
|
@click="uploader.chooseUpload"
|
|
51
51
|
v-show="showSquareButton"
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
>
|
|
54
54
|
<q-icon
|
|
55
55
|
name="add"
|
|
56
|
-
:size="
|
|
56
|
+
:size="toPx(currentSize / 2)"
|
|
57
57
|
/>
|
|
58
58
|
<div class="n-uploader-query__button--square__text" v-if="buttonText">{{buttonText}}</div>
|
|
59
59
|
</div>
|
|
@@ -76,9 +76,9 @@
|
|
|
76
76
|
>
|
|
77
77
|
<q-img
|
|
78
78
|
:src="getImage(fileItem)"
|
|
79
|
-
:spinner-size="
|
|
80
|
-
:width="
|
|
81
|
-
:height="
|
|
79
|
+
:spinner-size="toPx(currentSize / 2)"
|
|
80
|
+
:width="toPx(currentSize)"
|
|
81
|
+
:height="toPx(currentSize)"
|
|
82
82
|
fit="fill"
|
|
83
83
|
>
|
|
84
84
|
<!-- 内容 -->
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
<q-circular-progress
|
|
100
100
|
indeterminate
|
|
101
101
|
rounded
|
|
102
|
-
:size="
|
|
102
|
+
:size="toPx(currentSize / 1.5)"
|
|
103
103
|
:thickness="0.14"
|
|
104
104
|
color="white"
|
|
105
105
|
v-if="fileItem.status < UPLOAD_STATUS.uploading"
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
<!-- 上传中 -->
|
|
109
109
|
<q-circular-progress
|
|
110
110
|
:value="fileItem.progress"
|
|
111
|
-
:size="
|
|
111
|
+
:size="toPx(currentSize / 1.5)"
|
|
112
112
|
:thickness="0.14"
|
|
113
113
|
color="white"
|
|
114
114
|
track-color="grey-5"
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
<q-icon
|
|
119
119
|
class="cursor-pointer"
|
|
120
120
|
name="pause"
|
|
121
|
-
:size="
|
|
121
|
+
:size="toPx(currentSize / 3)"
|
|
122
122
|
@click="uploader.deleteFileItem(fileItem)"
|
|
123
123
|
/>
|
|
124
124
|
</q-circular-progress>
|
|
@@ -163,16 +163,16 @@
|
|
|
163
163
|
<div
|
|
164
164
|
class="n-uploader-query__button--square cursor-pointer"
|
|
165
165
|
:style="{
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
166
|
+
width: toPx(currentSize),
|
|
167
|
+
height: toPx(currentSize),
|
|
168
|
+
}"
|
|
169
169
|
@click="uploader.chooseUpload"
|
|
170
170
|
v-show="showSquareButton"
|
|
171
171
|
v-else-if="! noButton && currentButtonType === 'square'"
|
|
172
172
|
>
|
|
173
173
|
<q-icon
|
|
174
174
|
name="add"
|
|
175
|
-
:size="
|
|
175
|
+
:size="toPx(currentSize / 2)"
|
|
176
176
|
/>
|
|
177
177
|
<div class="n-uploader-query__button--square__text" v-if="buttonText">{{buttonText}}</div>
|
|
178
178
|
</div>
|
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
ghost: fileItemIndex === fromIndex,
|
|
192
192
|
}"
|
|
193
193
|
:style="{
|
|
194
|
-
height:
|
|
194
|
+
height: toPx(currentSize),
|
|
195
195
|
}"
|
|
196
196
|
:draggable="currentDrag"
|
|
197
197
|
@mousedown.self="mousedown($event, fileItemIndex)"
|
|
@@ -204,8 +204,8 @@
|
|
|
204
204
|
<div
|
|
205
205
|
class="n-uploader-query__item__icon"
|
|
206
206
|
:style="{
|
|
207
|
-
width:
|
|
208
|
-
height:
|
|
207
|
+
width: toPx(currentSize),
|
|
208
|
+
height: toPx(currentSize),
|
|
209
209
|
}"
|
|
210
210
|
>
|
|
211
211
|
<!-- 上传中前 -->
|
|
@@ -213,7 +213,7 @@
|
|
|
213
213
|
class="n-uploader-query__item__icon__icon"
|
|
214
214
|
indeterminate
|
|
215
215
|
rounded
|
|
216
|
-
:size="
|
|
216
|
+
:size="toPx(currentSize / 1.8)"
|
|
217
217
|
:thickness="0.18"
|
|
218
218
|
v-if="fileItem.status < UPLOAD_STATUS.uploading"
|
|
219
219
|
/>
|
|
@@ -222,7 +222,7 @@
|
|
|
222
222
|
<q-circular-progress
|
|
223
223
|
class="n-uploader-query__item__icon__icon"
|
|
224
224
|
:value="fileItem.progress"
|
|
225
|
-
:size="
|
|
225
|
+
:size="toPx(currentSize / 1.8)"
|
|
226
226
|
:thickness="0.18"
|
|
227
227
|
show-value
|
|
228
228
|
v-else-if="fileItem.status === UPLOAD_STATUS.uploading"
|
|
@@ -230,7 +230,7 @@
|
|
|
230
230
|
<q-icon
|
|
231
231
|
class="cursor-pointer"
|
|
232
232
|
name="pause"
|
|
233
|
-
:size="
|
|
233
|
+
:size="toPx(currentSize / 3)"
|
|
234
234
|
@click="uploader.deleteFileItem(fileItem)"
|
|
235
235
|
/>
|
|
236
236
|
</q-circular-progress>
|
|
@@ -239,7 +239,7 @@
|
|
|
239
239
|
<q-icon
|
|
240
240
|
class="n-uploader-query__item__icon__icon"
|
|
241
241
|
name="description"
|
|
242
|
-
:size="
|
|
242
|
+
:size="toPx(currentSize / 1.5)"
|
|
243
243
|
v-else-if="type === 'file'"
|
|
244
244
|
/>
|
|
245
245
|
|
|
@@ -248,7 +248,7 @@
|
|
|
248
248
|
class="n-uploader-query__item__icon__icon cursor-pointer"
|
|
249
249
|
name="play_circle"
|
|
250
250
|
title="播放"
|
|
251
|
-
:size="
|
|
251
|
+
:size="toPx(currentSize / 1.5)"
|
|
252
252
|
@click="uploader.play(fileItem)"
|
|
253
253
|
v-else
|
|
254
254
|
/>
|
|
@@ -331,11 +331,23 @@
|
|
|
331
331
|
import { onMounted, computed, inject } from 'vue'
|
|
332
332
|
import { useQuasar } from 'quasar'
|
|
333
333
|
|
|
334
|
+
import $n_has from 'lodash/has'
|
|
335
|
+
import $n_get from 'lodash/get'
|
|
336
|
+
|
|
337
|
+
import $n_px from '@netang/utils/px'
|
|
338
|
+
import $n_isValidArray from '@netang/utils/isValidArray'
|
|
339
|
+
import $n_isValidString from '@netang/utils/isValidString'
|
|
340
|
+
|
|
341
|
+
import $n_getImage from '../../utils/getImage'
|
|
342
|
+
|
|
343
|
+
import NDragger from '../dragger'
|
|
344
|
+
|
|
345
|
+
import { NUploaderKey } from '../../utils/symbols'
|
|
346
|
+
|
|
334
347
|
import {
|
|
335
348
|
// 上传状态
|
|
336
349
|
UPLOAD_STATUS,
|
|
337
350
|
} from '../../utils/useUploader'
|
|
338
|
-
import { NUploaderKey } from '../../utils/symbols'
|
|
339
351
|
|
|
340
352
|
export default {
|
|
341
353
|
|
|
@@ -344,6 +356,13 @@ export default {
|
|
|
344
356
|
*/
|
|
345
357
|
name: 'NUploaderQuery',
|
|
346
358
|
|
|
359
|
+
/**
|
|
360
|
+
* 组件
|
|
361
|
+
*/
|
|
362
|
+
components: {
|
|
363
|
+
NDragger,
|
|
364
|
+
},
|
|
365
|
+
|
|
347
366
|
/**
|
|
348
367
|
* 声明属性
|
|
349
368
|
*/
|
|
@@ -412,7 +431,7 @@ export default {
|
|
|
412
431
|
*/
|
|
413
432
|
const currentDrag = computed(function() {
|
|
414
433
|
return props.drag
|
|
415
|
-
&& $
|
|
434
|
+
&& $n_isValidArray(query.value)
|
|
416
435
|
&& query.value.length > 1
|
|
417
436
|
})
|
|
418
437
|
|
|
@@ -454,11 +473,11 @@ export default {
|
|
|
454
473
|
* 获取图片地址
|
|
455
474
|
*/
|
|
456
475
|
function getImage(fileItem) {
|
|
457
|
-
return $
|
|
476
|
+
return $n_has(fileItem, '__img') ?
|
|
458
477
|
fileItem.__img
|
|
459
478
|
: (
|
|
460
|
-
$
|
|
461
|
-
$
|
|
479
|
+
$n_isValidString(fileItem.hash) ?
|
|
480
|
+
$n_getImage(fileItem.hash, { w: $q.platform.is.mobile ? currentSize.value * 2 : currentSize.value })
|
|
462
481
|
: ''
|
|
463
482
|
)
|
|
464
483
|
}
|
|
@@ -467,7 +486,7 @@ export default {
|
|
|
467
486
|
* 获取文件名称
|
|
468
487
|
*/
|
|
469
488
|
function getFileName(fileItem) {
|
|
470
|
-
return fileItem.title + ($
|
|
489
|
+
return fileItem.title + ($n_get(fileItem, 'ext') ? '.' + fileItem.ext : '')
|
|
471
490
|
}
|
|
472
491
|
|
|
473
492
|
// ==========【生命周期】=========================================================================================
|
|
@@ -507,6 +526,8 @@ export default {
|
|
|
507
526
|
getImage,
|
|
508
527
|
// 获取文件名称
|
|
509
528
|
getFileName,
|
|
529
|
+
|
|
530
|
+
toPx: $n_px,
|
|
510
531
|
}
|
|
511
532
|
},
|
|
512
533
|
}
|
|
@@ -7,6 +7,13 @@
|
|
|
7
7
|
|
|
8
8
|
<script>
|
|
9
9
|
import { ref, watch } from 'vue'
|
|
10
|
+
import $n_isFunction from 'lodash/isFunction'
|
|
11
|
+
import $n_uniq from 'lodash/uniq'
|
|
12
|
+
|
|
13
|
+
import $n_isValidArray from '@netang/utils/isValidArray'
|
|
14
|
+
import $n_split from '@netang/utils/split'
|
|
15
|
+
import $n_isValidValue from '@netang/utils/isValidValue'
|
|
16
|
+
import $n_trimString from '@netang/utils/trimString'
|
|
10
17
|
|
|
11
18
|
export default {
|
|
12
19
|
|
|
@@ -100,7 +107,7 @@ export default {
|
|
|
100
107
|
* 格式化声明值
|
|
101
108
|
*/
|
|
102
109
|
function formatModelValue(value) {
|
|
103
|
-
return $
|
|
110
|
+
return $n_isFunction(props.before)
|
|
104
111
|
// 如果有修改前值方法
|
|
105
112
|
? props.before({ value, formatArray, formatString })
|
|
106
113
|
// 返回值
|
|
@@ -128,7 +135,7 @@ export default {
|
|
|
128
135
|
const value = current.value.value
|
|
129
136
|
|
|
130
137
|
// 获取新值
|
|
131
|
-
const newValue = $
|
|
138
|
+
const newValue = $n_isFunction(props.after) ?
|
|
132
139
|
// 如果有修改提交值方法
|
|
133
140
|
props.after({ value, formatArray, formatString })
|
|
134
141
|
// 否则返回当前值
|
|
@@ -160,24 +167,24 @@ export default {
|
|
|
160
167
|
toString: false,
|
|
161
168
|
}, params)
|
|
162
169
|
|
|
163
|
-
val = $
|
|
170
|
+
val = $n_isValidArray(val) ? val : []
|
|
164
171
|
|
|
165
172
|
// 如果数组有值
|
|
166
173
|
if (val.length) {
|
|
167
174
|
|
|
168
175
|
// 是否给每个值去除首位空格
|
|
169
176
|
if (o.trim) {
|
|
170
|
-
val = val.map(e => $
|
|
177
|
+
val = val.map(e => $n_trimString(e))
|
|
171
178
|
}
|
|
172
179
|
|
|
173
180
|
// 是否验证每个值是否为有效字符串/数字
|
|
174
181
|
if (o.isValidValue) {
|
|
175
|
-
val = val.filter(val => $
|
|
182
|
+
val = val.filter(val => $n_isValidValue(val))
|
|
176
183
|
}
|
|
177
184
|
|
|
178
185
|
// 去重
|
|
179
186
|
if (o.unique) {
|
|
180
|
-
val = $
|
|
187
|
+
val = $n_uniq(val)
|
|
181
188
|
}
|
|
182
189
|
}
|
|
183
190
|
|
|
@@ -213,15 +220,15 @@ export default {
|
|
|
213
220
|
// 是否去除首尾空格
|
|
214
221
|
if (o.trim) {
|
|
215
222
|
// 去除首尾空格
|
|
216
|
-
val = $
|
|
223
|
+
val = $n_trimString(val)
|
|
217
224
|
|
|
218
225
|
// 否则转字符串
|
|
219
226
|
} else {
|
|
220
|
-
val = $
|
|
227
|
+
val = $n_isValidValue(val) ? String(val) : ''
|
|
221
228
|
}
|
|
222
229
|
|
|
223
230
|
// 如果有分割符
|
|
224
|
-
if ($
|
|
231
|
+
if ($n_isValidValue(o.separator, true)) {
|
|
225
232
|
|
|
226
233
|
// 是否替换
|
|
227
234
|
if (o.replace) {
|
|
@@ -229,16 +236,16 @@ export default {
|
|
|
229
236
|
}
|
|
230
237
|
|
|
231
238
|
// 分隔成数组
|
|
232
|
-
val = $
|
|
239
|
+
val = $n_split(val, o.separator)
|
|
233
240
|
|
|
234
241
|
// 如果去重
|
|
235
242
|
if (o.unique) {
|
|
236
|
-
val = $
|
|
243
|
+
val = $n_uniq(val)
|
|
237
244
|
}
|
|
238
245
|
|
|
239
246
|
// 如果验证每个值是否为有效字符串/数字
|
|
240
247
|
if (o.isValidValue) {
|
|
241
|
-
val = val.filter(val => $
|
|
248
|
+
val = val.filter(val => $n_isValidValue(val))
|
|
242
249
|
}
|
|
243
250
|
|
|
244
251
|
// 如果转数组
|