@netang/quasar 0.0.47 → 0.0.49

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 (57) hide show
  1. package/components/dialog/index.vue +10 -10
  2. package/components/dialog-table/index.vue +1 -1
  3. package/components/dragger/index.vue +2 -2
  4. package/components/drawer/index.vue +7 -7
  5. package/components/field-date/index.vue +35 -35
  6. package/components/field-table/index.vue +39 -41
  7. package/components/field-text/index.vue +2 -2
  8. package/components/field-tree/index.vue +19 -19
  9. package/components/input-number/index.vue +2 -2
  10. package/components/list-menu/index.vue +2 -2
  11. package/components/private/components/move-to-tree/index.vue +2 -2
  12. package/components/private/edit-power-data/index.vue +50 -50
  13. package/components/private/table-visible-columns-button/index.vue +2 -2
  14. package/components/render/index.vue +6 -6
  15. package/components/search/index.vue +2 -2
  16. package/components/search-item/index.vue +5 -5
  17. package/components/select/index.vue +2 -2
  18. package/components/splitter/index.vue +7 -7
  19. package/components/table/index.vue +5 -5
  20. package/components/table-splitter/index.vue +22 -11
  21. package/components/table-summary/index.vue +3 -3
  22. package/components/thumbnail/index.vue +6 -6
  23. package/components/uploader/index.vue +1 -1
  24. package/components/uploader-query/index.vue +25 -25
  25. package/components/value-format/index.vue +65 -38
  26. package/package.json +1 -1
  27. package/utils/$area.js +13 -13
  28. package/utils/$auth.js +6 -6
  29. package/utils/$dialog.js +3 -3
  30. package/utils/$form.js +2 -2
  31. package/utils/$power.js +124 -117
  32. package/utils/$rule.js +4 -4
  33. package/utils/$search.js +50 -50
  34. package/utils/$table.js +76 -76
  35. package/utils/$tree.js +43 -43
  36. package/utils/$uploader.js +47 -47
  37. package/utils/alert.js +1 -1
  38. package/utils/arr.js +2 -2
  39. package/utils/bus.js +1 -1
  40. package/utils/config.js +4 -4
  41. package/utils/confrim.js +1 -1
  42. package/utils/dict.js +5 -5
  43. package/utils/getData.js +9 -9
  44. package/utils/getFile.js +5 -5
  45. package/utils/getImage.js +12 -12
  46. package/utils/getTime.js +4 -4
  47. package/utils/http.js +20 -20
  48. package/utils/loading.js +1 -1
  49. package/utils/notify.js +1 -1
  50. package/utils/previewImage.js +2 -2
  51. package/utils/price.js +3 -3
  52. package/utils/timestamp.js +1 -1
  53. package/utils/toast.js +1 -1
  54. package/utils/uploader/qiniu.js +11 -11
  55. package/utils/useAuth.js +2 -2
  56. package/utils/useRouter.js +4 -4
  57. package/components/input-format/index.vue +0 -268
package/utils/$table.js CHANGED
@@ -26,7 +26,7 @@ function create(params) {
26
26
  // const rowsPerPageOptions = [3, 40, 50, 100, 200, 500, 1000]
27
27
 
28
28
  // 获取参数
29
- const o = _.merge({
29
+ const o = $n.merge({
30
30
  // 路由路径
31
31
  path: '',
32
32
  // 路由参数
@@ -98,32 +98,32 @@ function create(params) {
98
98
  // 如果有渲染注入
99
99
  if (!! $render) {
100
100
  // 如果有表格传参, 则合并参数
101
- const tableProps = _.get($render, 'props.tableProps')
102
- if (utils.isValidObject(tableProps)) {
103
- _.merge(o, tableProps)
101
+ const tableProps = $n.get($render, 'props.tableProps')
102
+ if ($n.isValidObject(tableProps)) {
103
+ $n.merge(o, tableProps)
104
104
  }
105
105
  }
106
106
 
107
107
  // 获取权限注入
108
- const $power = _.has(params, '$power') ? params.$power : inject(NPowerKey)
108
+ const $power = $n.has(params, '$power') ? params.$power : inject(NPowerKey)
109
109
  const hasPowr = !! $power
110
110
 
111
111
  // 获取权限路由
112
- const $route = utils.isValidString(o.path) ?
112
+ const $route = $n.isValidString(o.path) ?
113
113
  // 如果为自定义路由
114
- utils.router.resolve({
114
+ $n.router.resolve({
115
115
  path: o.path,
116
- query: utils.isValidObject(o.query) ? o.query : {},
116
+ query: $n.isValidObject(o.query) ? o.query : {},
117
117
  })
118
118
  // 否则获取当前路由
119
- : (hasPowr ? $power.getRoute() : utils.router.getRoute())
119
+ : (hasPowr ? $power.getRoute() : $n.router.getRoute())
120
120
 
121
121
  // 是否有权限按钮
122
122
  const hasPowerBtns = hasPowr ? $power.powerBtns.value.length : false
123
123
 
124
124
  // 表格已选数据
125
125
  const tableSelected = hasPowr ? $power.tableSelected : ref([])
126
- if (utils.isValidArray(o.selected)) {
126
+ if ($n.isValidArray(o.selected)) {
127
127
  tableSelected.value = o.selected
128
128
  }
129
129
 
@@ -131,7 +131,7 @@ function create(params) {
131
131
  const isCache = !! o.cache
132
132
 
133
133
  // 缓存名
134
- const cacheName = $route.fullPath ? $route.fullPath : (utils.isValidString(o.cache) ? o.cache : '')
134
+ const cacheName = $route.fullPath ? $route.fullPath : ($n.isValidString(o.cache) ? o.cache : '')
135
135
 
136
136
  // 表格列
137
137
  const tableColumns = []
@@ -149,48 +149,48 @@ function create(params) {
149
149
  const tableImgNames = ref([])
150
150
 
151
151
  // 设置列参数
152
- utils.forEach(o.columns, function(item) {
152
+ $n.forEach(o.columns, function(item) {
153
153
 
154
154
  if (
155
- ! _.has(item, 'field')
156
- && _.has(item, 'name')
155
+ ! $n.has(item, 'field')
156
+ && $n.has(item, 'name')
157
157
  ) {
158
158
  item.field = item.name
159
159
  }
160
160
 
161
- if (! _.has(item, 'align')) {
161
+ if (! $n.has(item, 'align')) {
162
162
  item.align = 'left'
163
163
  }
164
164
 
165
165
  // 是否隐藏
166
- item.hide = _.get(item, 'hide') === true
166
+ item.hide = $n.get(item, 'hide') === true
167
167
 
168
168
  // 如果有显示项
169
- if (_.get(item, 'visible') !== false) {
169
+ if ($n.get(item, 'visible') !== false) {
170
170
  o.visibleColumns.push(item.field)
171
171
  }
172
172
 
173
173
  // 如果有时间戳
174
- if (_.has(item, 'time')) {
175
- item.format = val => date.formatDate(utils.toDate(val), item.time === true ? `YYYY-MM-DD HH:mm` : item.time)
174
+ if ($n.has(item, 'time')) {
175
+ item.format = val => date.formatDate($n.toDate(val), item.time === true ? `YYYY-MM-DD HH:mm` : item.time)
176
176
 
177
177
  // 如果有数据字典
178
- } else if (_.has(item, 'dict')) {
179
- item.format = val => utils.dict(item.dict, val)
178
+ } else if ($n.has(item, 'dict')) {
179
+ item.format = val => $n.dict(item.dict, val)
180
180
 
181
181
  // 如果有图片
182
- } else if (_.has(item, 'img') && item.img === true) {
182
+ } else if ($n.has(item, 'img') && item.img === true) {
183
183
  tableImgNames.value.push(item.name)
184
184
 
185
185
  // 如果有价格
186
- } else if (_.has(item, 'price')) {
187
- item.format = val => utils.price(val)
186
+ } else if ($n.has(item, 'price')) {
187
+ item.format = val => $n.price(val)
188
188
  }
189
189
 
190
190
  // 如果有路由
191
- if (_.get(item, 'route')) {
191
+ if ($n.get(item, 'route')) {
192
192
  // 如果该值在当前路由路径中, 则显示
193
- if (utils.indexOf($route.fullPath, item.route) > -1) {
193
+ if ($n.indexOf($route.fullPath, item.route) > -1) {
194
194
  tableColumns.push(item)
195
195
  }
196
196
 
@@ -200,10 +200,10 @@ function create(params) {
200
200
  })
201
201
 
202
202
  // 获取可见列缓存
203
- const visibleColumnsCache = o.showVisibleColumns && isCache ? utils.storage.get('table:visible_columns:' + cacheName) : []
203
+ const visibleColumnsCache = o.showVisibleColumns && isCache ? $n.storage.get('table:visible_columns:' + cacheName) : []
204
204
 
205
205
  // 表格可见列
206
- const tableVisibleColumns = ref(Array.isArray(visibleColumnsCache) ? visibleColumnsCache : _.uniq([...o.visibleColumns]))
206
+ const tableVisibleColumns = ref(Array.isArray(visibleColumnsCache) ? visibleColumnsCache : $n.uniq([...o.visibleColumns]))
207
207
 
208
208
  // 表格加载状态
209
209
  const tableLoading = ref(o.loading)
@@ -215,7 +215,7 @@ function create(params) {
215
215
  const tablePagination = ref($route.fullPath ? o.pagination : {})
216
216
 
217
217
  // 表格宫格
218
- const tableGrid = ref(o.showGrid && isCache ? utils.storage.get('table:grid:' + cacheName) === true : false)
218
+ const tableGrid = ref(o.showGrid && isCache ? $n.storage.get('table:grid:' + cacheName) === true : false)
219
219
 
220
220
  // 表格请求参数(将表格传参中的搜索参数剥离掉, 剩下的直接当做参数传递给服务器)
221
221
  let tableRequestQuery = {}
@@ -242,7 +242,7 @@ function create(params) {
242
242
  // 首次表格搜索值(如果表格搜索参数中带了初始值, 则设置初始值)
243
243
  firstTableSearchValue,
244
244
  // 表格搜索值(如果表格搜索参数中带了初始值, 则设置初始值)
245
- } = utils.$search.getRawData(tableColumns, Object.assign({}, $route.query), o.searchFromQuery)
245
+ } = $n.$search.getRawData(tableColumns, Object.assign({}, $route.query), o.searchFromQuery)
246
246
 
247
247
  // 表格搜索数据值
248
248
  const tableSearchValue = ref($route.fullPath ? firstTableSearchValue : [])
@@ -263,7 +263,7 @@ function create(params) {
263
263
  const lists = []
264
264
 
265
265
  // 先格式化权限按钮列表
266
- utils.forEach(utils.$power.formatBtns($power.powerBtns.value), function(item) {
266
+ $n.forEach($n.$power.formatBtns($power.powerBtns.value), function(item) {
267
267
 
268
268
  // 如果是固定按钮
269
269
  if (item.fixed) {
@@ -282,10 +282,10 @@ function create(params) {
282
282
  // 非手机模式
283
283
  ! $q.platform.is.mobile
284
284
  // 有权限列表
285
- && utils.isValidArray($power.powerBtns.value)
285
+ && $n.isValidArray($power.powerBtns.value)
286
286
  ) {
287
287
  for (const item of $power.powerBtns.value) {
288
- if (_.has(item, 'data.dbclick') === true) {
288
+ if ($n.has(item, 'data.dbclick') === true) {
289
289
  return item
290
290
  }
291
291
  }
@@ -296,7 +296,7 @@ function create(params) {
296
296
  * 是否显示固定在右边的权限按钮列表
297
297
  */
298
298
  const showTableFixed = computed(function () {
299
- return utils.indexOf(tableVisibleColumns.value, 'settings') > -1
299
+ return $n.indexOf(tableVisibleColumns.value, 'settings') > -1
300
300
  })
301
301
 
302
302
  // ==========【监听数据】=============================================================================================
@@ -309,7 +309,7 @@ function create(params) {
309
309
 
310
310
  // 设置宫格模式缓存(永久缓存)
311
311
  // #if ! IS_DEV
312
- utils.storage.set('table:grid:' + cacheName, val, 0)
312
+ $n.storage.set('table:grid:' + cacheName, val, 0)
313
313
  // #endif
314
314
  })
315
315
  }
@@ -322,7 +322,7 @@ function create(params) {
322
322
 
323
323
  // 设置可见列缓存(永久缓存)
324
324
  // #if ! IS_DEV
325
- utils.storage.set('table:visible_columns:' + cacheName, val, 0)
325
+ $n.storage.set('table:visible_columns:' + cacheName, val, 0)
326
326
  // #endif
327
327
  })
328
328
  }
@@ -333,10 +333,10 @@ function create(params) {
333
333
  if (hasPowerBtns) {
334
334
  watch(tableFixedPowerBtns, function (lists) {
335
335
 
336
- const index = utils.indexOf(tableVisibleColumns.value, 'settings')
336
+ const index = $n.indexOf(tableVisibleColumns.value, 'settings')
337
337
 
338
338
  // 如果有固定在右边的权限按钮列表
339
- if (utils.isValidArray(lists)) {
339
+ if ($n.isValidArray(lists)) {
340
340
 
341
341
  // 如果设置不在可见列中
342
342
  if (index === -1) {
@@ -375,9 +375,9 @@ function create(params) {
375
375
  */
376
376
  function setQuery(query) {
377
377
 
378
- if (utils.isValidObject(query)) {
378
+ if ($n.isValidObject(query)) {
379
379
 
380
- query = _.cloneDeep(query)
380
+ query = $n.cloneDeep(query)
381
381
 
382
382
  // 搜索参数键值数组
383
383
  const searchQueryKey = []
@@ -388,11 +388,11 @@ function create(params) {
388
388
  const NSearchValues = []
389
389
 
390
390
  // 参数中是否有自定义搜索参数
391
- const hasNSearch = _.has(query, 'n_search')
391
+ const hasNSearch = $n.has(query, 'n_search')
392
392
  if (hasNSearch) {
393
393
  // 删除在搜索中存在的参数键值
394
- utils.forIn(query.n_search, function (item, key) {
395
- if (_.has(query, key)) {
394
+ $n.forIn(query.n_search, function (item, key) {
395
+ if ($n.has(query, key)) {
396
396
  delete query[key]
397
397
  }
398
398
  })
@@ -401,14 +401,14 @@ function create(params) {
401
401
  // 如果允许从参数中获取搜索值
402
402
  if (o.searchFromQuery) {
403
403
 
404
- utils.forEach(rawSearchOptions, function (item, index) {
404
+ $n.forEach(rawSearchOptions, function (item, index) {
405
405
 
406
406
  const valueItem = tableSearchValue.value[index]
407
407
 
408
408
  // 如果传参在搜素 n_search 参数中
409
- if (hasNSearch && _.has(query.n_search, item.name)) {
409
+ if (hasNSearch && $n.has(query.n_search, item.name)) {
410
410
  const newSearchItem = query.n_search[item.name]
411
- if (utils.isValidArray(newSearchItem)) {
411
+ if ($n.isValidArray(newSearchItem)) {
412
412
  valueItem[0].compare = newSearchItem[0].compare
413
413
  valueItem[0].value = newSearchItem[0].value
414
414
 
@@ -421,23 +421,23 @@ function create(params) {
421
421
  NSearchKeys.push(item.name)
422
422
 
423
423
  // 如果传参在搜索参数中
424
- } else if (_.has(query, item.name)) {
424
+ } else if ($n.has(query, item.name)) {
425
425
  // 设置单个搜索值
426
- setItemValue(valueItem, utils.isRequired(query[item.name]) ? query[item.name] : '')
426
+ setItemValue(valueItem, $n.isRequired(query[item.name]) ? query[item.name] : '')
427
427
  // 设置参数中搜索的 key
428
428
  searchQueryKey.push(item.name)
429
429
  }
430
430
  })
431
431
 
432
- utils.forEach(searchQueryKey, function (key) {
432
+ $n.forEach(searchQueryKey, function (key) {
433
433
  delete query[key]
434
434
  })
435
435
 
436
436
  if (hasNSearch) {
437
- utils.forIn(query.n_search, function(item, key) {
437
+ $n.forIn(query.n_search, function(item, key) {
438
438
  if (
439
439
  NSearchKeys.indexOf(key) === -1
440
- && utils.isValidArray(item)
440
+ && $n.isValidArray(item)
441
441
  ) {
442
442
  item[0].field = key
443
443
  NSearchValues.push(item[0])
@@ -451,8 +451,8 @@ function create(params) {
451
451
  }
452
452
 
453
453
  } else {
454
- utils.forIn(query.n_search, function(item, key) {
455
- if (utils.isValidArray(item)) {
454
+ $n.forIn(query.n_search, function(item, key) {
455
+ if ($n.isValidArray(item)) {
456
456
  item[0].field = key
457
457
  NSearchValues.push(item[0])
458
458
  if (item.length > 1) {
@@ -563,7 +563,7 @@ function create(params) {
563
563
 
564
564
  const newValue = []
565
565
 
566
- utils.forEach(rawSearchOptions, function (item, index) {
566
+ $n.forEach(rawSearchOptions, function (item, index) {
567
567
  // 如果该搜索条件是隐藏的
568
568
  if (item.hide) {
569
569
  newValue.push(tableSearchValue.value[index])
@@ -574,7 +574,7 @@ function create(params) {
574
574
  })
575
575
 
576
576
  // 还原表格搜索数据
577
- tableSearchValue.value = _.cloneDeep(newValue)
577
+ tableSearchValue.value = $n.cloneDeep(newValue)
578
578
 
579
579
  // 表格重新加载
580
580
  if (reload) {
@@ -611,7 +611,7 @@ function create(params) {
611
611
  }
612
612
 
613
613
  // 如果排序字段是有效值
614
- if (utils.isValidValue(sortBy)) {
614
+ if ($n.isValidValue(sortBy)) {
615
615
  Object.assign(data, {
616
616
  // 排序字段
617
617
  order_by: sortBy,
@@ -621,20 +621,20 @@ function create(params) {
621
621
  }
622
622
 
623
623
  // 合并参数
624
- utils.forIn(Object.assign({}, rawQuery, tableRequestQuery, o.data), function(value, key) {
624
+ $n.forIn(Object.assign({}, rawQuery, tableRequestQuery, o.data), function(value, key) {
625
625
  // 如果有值
626
- if (utils.isRequired(value)) {
626
+ if ($n.isRequired(value)) {
627
627
  data[key] = value
628
628
  }
629
629
  })
630
630
 
631
631
  // 获取搜索值
632
- const search = utils.$search.formatValue(rawSearchOptions, tableSearchValue.value)
633
- if (utils.isValidArray(search)) {
634
- data.n_search = _.has(data, 'n_search') ? _.concat(data.n_search, search) : search
632
+ const search = $n.$search.formatValue(rawSearchOptions, tableSearchValue.value)
633
+ if ($n.isValidArray(search)) {
634
+ data.n_search = $n.has(data, 'n_search') ? $n.concat(data.n_search, search) : search
635
635
  }
636
636
 
637
- if (_.isNil(isSummary)) {
637
+ if ($n.isNil(isSummary)) {
638
638
  isSummary = isRequestSummary
639
639
  }
640
640
 
@@ -672,8 +672,8 @@ function create(params) {
672
672
  let result
673
673
 
674
674
  // 如果有自定义请求方法
675
- if (_.isFunction(o.request)) {
676
- result = await utils.runAsync(o.request)({
675
+ if ($n.isFunction(o.request)) {
676
+ result = await $n.runAsync(o.request)({
677
677
  data,
678
678
  props,
679
679
  rows: tableRows,
@@ -692,7 +692,7 @@ function create(params) {
692
692
  // debounce: false,
693
693
  }, o.httpSettings)
694
694
 
695
- result = await utils.http(opts)
695
+ result = await $n.http(opts)
696
696
  }
697
697
 
698
698
  const { status, data: res } = result
@@ -709,8 +709,8 @@ function create(params) {
709
709
 
710
710
  // 如果请求表格合计
711
711
  if (isRequestSummary) {
712
- const summary = _.get(res, 'summary')
713
- tableSummary.value = utils.isValidObject(summary) ? summary : null
712
+ const summary = $n.get(res, 'summary')
713
+ tableSummary.value = $n.isValidObject(summary) ? summary : null
714
714
  }
715
715
 
716
716
  // 更新页码
@@ -725,8 +725,8 @@ function create(params) {
725
725
  tablePagination.value.descending = descending
726
726
 
727
727
  // 格式化单条数据
728
- if (_.isFunction(o.formatRow)) {
729
- utils.forEach(rows, function(row) {
728
+ if ($n.isFunction(o.formatRow)) {
729
+ $n.forEach(rows, function(row) {
730
730
  o.formatRow({
731
731
  row,
732
732
  rows: tableRows,
@@ -761,7 +761,7 @@ function create(params) {
761
761
  opt[o.rowKey] = row[o.rowKey]
762
762
 
763
763
  // 获取当前数据索引
764
- const itemIndex = _.findIndex(tableSelected.value, opt)
764
+ const itemIndex = $n.findIndex(tableSelected.value, opt)
765
765
 
766
766
  // 如果不存在, 则添加
767
767
  if (itemIndex === -1) {
@@ -786,7 +786,7 @@ function create(params) {
786
786
  _tableRowClick(...e)
787
787
 
788
788
  // 如果有自定义单击事件
789
- if (_.isFunction(o.rowClick)) {
789
+ if ($n.isFunction(o.rowClick)) {
790
790
  o.rowClick(...e)
791
791
  }
792
792
  }
@@ -817,7 +817,7 @@ function create(params) {
817
817
  _tableRowDblclick(...e)
818
818
 
819
819
  // 如果有自定义双击表格行事件
820
- if (_.isFunction(o.tableRowDblclick)) {
820
+ if ($n.isFunction(o.tableRowDblclick)) {
821
821
  o.tableRowDblclick(...e)
822
822
  }
823
823
  }
@@ -826,14 +826,14 @@ function create(params) {
826
826
  * 设置表格搜索参数
827
827
  */
828
828
  async function setTableSearchOptions(format) {
829
- tableSearchOptions.value = await utils.$search.getOptions(rawSearchOptions, format)
829
+ tableSearchOptions.value = await $n.$search.getOptions(rawSearchOptions, format)
830
830
  }
831
831
 
832
832
  /**
833
833
  * 是否有表格搜索值
834
834
  */
835
835
  function hasTableSearchValue() {
836
- return !! utils.$search.formatValue(rawSearchOptions, tableSearchValue.value).length
836
+ return !! $n.$search.formatValue(rawSearchOptions, tableSearchValue.value).length
837
837
  }
838
838
 
839
839
  // 如果开启搜索
@@ -936,13 +936,13 @@ function create(params) {
936
936
  * 获取表格配置
937
937
  */
938
938
  function config(routePath, path, defaultValue) {
939
- return _.cloneDeep(_.get(tablesConfig, utils.slash(routePath, 'start', false) + (path ? '.' + path : ''), defaultValue))
939
+ return $n.cloneDeep($n.get(tablesConfig, $n.slash(routePath, 'start', false) + (path ? '.' + path : ''), defaultValue))
940
940
  }
941
941
 
942
942
  /**
943
943
  * 业务表格
944
944
  */
945
- utils.$table = {
945
+ $n.$table = {
946
946
  // 创建表格
947
947
  create,
948
948
  // 获取表格配置