@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.
Files changed (115) hide show
  1. package/_docs/docs/.vuepress/client.js +39 -0
  2. package/_docs/docs/.vuepress/components/test.vue +23 -0
  3. package/_docs/docs/.vuepress/config.js +40 -0
  4. package/_docs/docs/.vuepress/configs/index.js +2 -0
  5. package/_docs/docs/.vuepress/configs/navbar/index.js +1 -0
  6. package/_docs/docs/.vuepress/configs/navbar/zh.js +16 -0
  7. package/_docs/docs/.vuepress/configs/sidebar/index.js +1 -0
  8. package/_docs/docs/.vuepress/configs/sidebar/zh.js +20 -0
  9. package/_docs/docs/.vuepress/public/css/index.css +3 -0
  10. package/_docs/docs/.vuepress/styles/index.scss +3 -0
  11. package/_docs/docs/components/field-table.md +63 -0
  12. package/_docs/docs/components/field-tree.md +1 -0
  13. package/{docs → _docs}/docs/index.md +0 -0
  14. package/{docs → _docs}/docs/utils/alert.md +0 -0
  15. package/{docs → _docs}/docs/utils/confirm.md +0 -0
  16. package/_docs/docs/utils/index.md +1 -0
  17. package/_docs/package.json +17 -0
  18. package/components/column-title/index.vue +2 -2
  19. package/components/data/index.vue +20 -23
  20. package/components/dialog/index.vue +26 -12
  21. package/components/dialog-table/index.vue +4 -2
  22. package/components/dragger/index.vue +3 -2
  23. package/components/drawer/index.vue +16 -9
  24. package/components/editor-code/index.vue +12 -5
  25. package/components/empty/index.vue +16 -1
  26. package/components/field-date/index.vue +48 -36
  27. package/components/field-table/index.vue +69 -43
  28. package/components/field-text/index.vue +6 -2
  29. package/components/field-tree/index.vue +40 -22
  30. package/components/input-number/index.vue +5 -4
  31. package/components/list-menu/index.vue +14 -2
  32. package/components/power-page/index.vue +10 -0
  33. package/components/private/components/index.js +7 -2
  34. package/components/private/components/move-to-tree/index.vue +7 -3
  35. package/components/private/edit-power-data/index.vue +92 -52
  36. package/components/private/table-visible-columns-button/index.vue +6 -2
  37. package/components/render/index.vue +21 -7
  38. package/components/search/index.vue +30 -2
  39. package/components/search-item/index.vue +24 -8
  40. package/components/select/index.vue +5 -2
  41. package/components/splitter/index.vue +13 -9
  42. package/components/table/index.vue +32 -5
  43. package/components/table-pagination/index.vue +0 -1
  44. package/components/table-splitter/index.vue +22 -3
  45. package/components/table-summary/index.vue +10 -3
  46. package/components/thumbnail/index.vue +16 -6
  47. package/components/toolbar/index.vue +0 -2
  48. package/components/uploader/index.vue +5 -2
  49. package/components/uploader-query/index.vue +48 -27
  50. package/components/value-format/index.vue +19 -12
  51. package/configs/area3.js +1 -0
  52. package/docs/404.html +33 -0
  53. package/docs/assets/404.html-60b35caa.js +1 -0
  54. package/docs/assets/404.html-d1e63d77.js +1 -0
  55. package/docs/assets/alert.html-568d4e94.js +1 -0
  56. package/docs/assets/alert.html-f5dbc3e9.js +1 -0
  57. package/docs/assets/app-8c3ae4de.js +6 -0
  58. package/docs/assets/back-to-top-8efcbe56.svg +1 -0
  59. package/docs/assets/confirm.html-7a1566f6.js +1 -0
  60. package/docs/assets/confirm.html-96f1b004.js +1 -0
  61. package/docs/assets/field-table.html-68d610b0.js +1 -0
  62. package/docs/assets/field-table.html-86cc3511.js +1 -0
  63. package/docs/assets/field-tree.html-45410c3c.js +1 -0
  64. package/docs/assets/field-tree.html-c98ac993.js +1 -0
  65. package/docs/assets/framework-204010b2.js +5 -0
  66. package/docs/assets/index.html-1695dd7c.js +1 -0
  67. package/docs/assets/index.html-65a4aa67.js +1 -0
  68. package/docs/assets/style-ac5a9aa6.css +1 -0
  69. package/docs/components/field-table.html +33 -0
  70. package/docs/components/field-tree.html +33 -0
  71. package/docs/index.html +33 -0
  72. package/docs/utils/alert.html +33 -0
  73. package/docs/utils/confirm.html +33 -0
  74. package/package.json +1 -1
  75. package/package2.json +30 -0
  76. package/store/index.js +3 -20
  77. package/utils/alert.js +3 -1
  78. package/utils/area.js +27 -14
  79. package/utils/arr.js +6 -2
  80. package/utils/auth.js +40 -35
  81. package/utils/bus.js +1 -1
  82. package/utils/config.js +42 -15
  83. package/utils/{confrim.js → confirm.js} +1 -1
  84. package/utils/copy.js +18 -0
  85. package/utils/dialog.js +7 -3
  86. package/utils/dict.js +5 -28
  87. package/utils/dictOptions.js +24 -0
  88. package/utils/form.js +6 -2
  89. package/utils/getData.js +21 -9
  90. package/utils/getFile.js +11 -5
  91. package/utils/getImage.js +23 -12
  92. package/utils/getTime.js +9 -4
  93. package/utils/index.js +61 -0
  94. package/utils/loading.js +3 -1
  95. package/utils/notify.js +1 -1
  96. package/utils/power.js +164 -118
  97. package/utils/previewImage.js +4 -2
  98. package/utils/price.js +12 -3
  99. package/utils/rule.js +5 -9
  100. package/utils/ruleValid.js +10 -0
  101. package/utils/search.js +81 -50
  102. package/utils/table.js +119 -87
  103. package/utils/timestamp.js +2 -2
  104. package/utils/toast.js +1 -1
  105. package/utils/tree.js +69 -46
  106. package/utils/uploader/qiniu.js +31 -15
  107. package/utils/uploader.js +87 -56
  108. package/utils/useAuth.js +12 -5
  109. package/utils/useRouter.js +16 -5
  110. package/utils/useUploader.js +0 -5
  111. package/docs/docs/.vuepress/config.js +0 -32
  112. package/docs/docs/components/field-table.md +0 -1
  113. package/docs/docs/components/field-tree.md +0 -1
  114. package/docs/package.json +0 -11
  115. 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 : $n.router.getRoute('path')) : props.cache}:`
113
+ cacheName = `splitter:${props.cache === true ? ($power && $power.routePath ? $power.routePath : $n_router.getRoute('path')) : props.cache}:`
108
114
 
109
115
  // 从缓存获取初始值
110
- let cache = $n.storage.get(cacheName + 'modelValue')
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 = $n.storage.get(cacheName + 'before')
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 = $n.storage.get(cacheName + 'after')
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 = $n.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 ($n.isValidObject(slots)) {
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
- $n.storage.set(cacheName + key, val, 0)
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 ($n.isValidObject(slots)) {
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 ($n.isFunction(props.treeNodeClick)) {
366
+ if ($n_isFunction(props.treeNodeClick)) {
340
367
 
341
368
  /**
342
369
  * 树节点 all
343
370
  */
344
371
  const treeNodesAll = computed(function () {
345
- return $n.collection(props.treeNodes)
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 (! $n.isValidValue(nodeKey)) {
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 ($n.isValidObject(res)) {
395
+ if ($n_isValidObject(res)) {
369
396
 
370
397
  // 设置表格传参
371
398
  $table.setQuery(res)
@@ -184,7 +184,6 @@ export default {
184
184
  </script>
185
185
 
186
186
  <style lang="scss" scoped>
187
- @import "@/assets/sass/var.scss";
188
187
 
189
188
  // 紧凑模式
190
189
  .dense {
@@ -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 $n.isValidObject(slots) ? Object.keys(slots).filter(e => e !== 'toolbar-right') : []
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
- && $n.isFunction(props.renderQuery)
207
+ && $n_isFunction(props.renderQuery)
189
208
  ) {
190
209
  const resQuery = props.renderQuery(currentSelectedItem.value)
191
- if ($n.isValidObject(resQuery)) {
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
- $n.forEach($n.get(props.props, 'cols'), function(item) {
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 ($n.has(props.data, name)) {
89
+ if ($n_has(props.data, name)) {
83
90
  // 判断是否是价格
84
- res.value = $n.has(item, 'price') ? $n.price(props.data[name]) : props.data[name]
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="$n.px(size / 2)"
5
- :width="$n.px(size)"
6
- :height="$n.px(size)"
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="$n.noop"
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 = $n.getImage(props.src, { w: $q.platform.is.mobile ? props.size * 2 : props.size })
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
- $n.previewImage(props.src)
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
  }
@@ -123,8 +123,6 @@ export default {
123
123
  </script>
124
124
 
125
125
  <style lang="scss">
126
- @import "@/assets/sass/var.scss";
127
-
128
126
  .n-toolbar {
129
127
  &__body {
130
128
  .q-btn {
@@ -21,7 +21,10 @@
21
21
 
22
22
  <script>
23
23
  import { onMounted, ref, provide, inject } from 'vue'
24
- import { NPowerKey, NUploaderKey, NLayoutKey } from '../../utils/symbols'
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 = $n.uploader.create({
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: $n.px(currentSize),
48
- height: $n.px(currentSize),
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="$n.px(currentSize / 2)"
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="$n.px(currentSize / 2)"
80
- :width="$n.px(currentSize)"
81
- :height="$n.px(currentSize)"
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="$n.px(currentSize / 1.5)"
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="$n.px(currentSize / 1.5)"
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="$n.px(currentSize / 3)"
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
- width: $n.px(currentSize),
167
- height: $n.px(currentSize),
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="$n.px(currentSize / 2)"
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: $n.px(currentSize),
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: $n.px(currentSize),
208
- height: $n.px(currentSize),
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="$n.px(currentSize / 1.8)"
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="$n.px(currentSize / 1.8)"
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="$n.px(currentSize / 3)"
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="$n.px(currentSize / 1.5)"
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="$n.px(currentSize / 1.5)"
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
- && $n.isValidArray(query.value)
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 $n.has(fileItem, '__img') ?
476
+ return $n_has(fileItem, '__img') ?
458
477
  fileItem.__img
459
478
  : (
460
- $n.isValidString(fileItem.hash) ?
461
- $n.getImage(fileItem.hash, { w: $q.platform.is.mobile ? currentSize.value * 2 : currentSize.value })
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 + ($n.get(fileItem, 'ext') ? '.' + fileItem.ext : '')
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 $n.isFunction(props.before)
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 = $n.isFunction(props.after) ?
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 = $n.isValidArray(val) ? 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 => $n.trimString(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 => $n.isValidValue(val))
182
+ val = val.filter(val => $n_isValidValue(val))
176
183
  }
177
184
 
178
185
  // 去重
179
186
  if (o.unique) {
180
- val = $n.uniq(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 = $n.trimString(val)
223
+ val = $n_trimString(val)
217
224
 
218
225
  // 否则转字符串
219
226
  } else {
220
- val = $n.isValidValue(val) ? String(val) : ''
227
+ val = $n_isValidValue(val) ? String(val) : ''
221
228
  }
222
229
 
223
230
  // 如果有分割符
224
- if ($n.isValidValue(o.separator, true)) {
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 = $n.split(val, o.separator)
239
+ val = $n_split(val, o.separator)
233
240
 
234
241
  // 如果去重
235
242
  if (o.unique) {
236
- val = $n.uniq(val)
243
+ val = $n_uniq(val)
237
244
  }
238
245
 
239
246
  // 如果验证每个值是否为有效字符串/数字
240
247
  if (o.isValidValue) {
241
- val = val.filter(val => $n.isValidValue(val))
248
+ val = val.filter(val => $n_isValidValue(val))
242
249
  }
243
250
 
244
251
  // 如果转数组