@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
@@ -1,268 +0,0 @@
1
- <template>
2
- <q-input
3
- v-model="currentValue"
4
- @blur="onBlur"
5
- v-bind="$attrs"
6
- >
7
- <!-- 插槽 -->
8
- <template
9
- v-for="slotName in slotNames"
10
- v-slot:[slotName]
11
- >
12
- <slot :name="slotName" />
13
- </template>
14
- </q-input>
15
- </template>
16
-
17
- <script>
18
- import { computed, ref, watch } from 'vue'
19
-
20
- export default {
21
-
22
- /**
23
- * 标识
24
- */
25
- name: 'NInputFormat',
26
-
27
- /**
28
- * 声明属性
29
- */
30
- props: {
31
- // 值 v-model
32
- modelValue: {
33
- required: true,
34
- },
35
- // 值是否为数组
36
- valueArray: Boolean,
37
- // 修改前值
38
- formatBefore: [ Function, Object, Boolean ],
39
- // 修改后值
40
- formatAfter: [ Function, Object, Boolean ],
41
- },
42
-
43
- /**
44
- * 声明事件
45
- */
46
- emits: [
47
- 'update:modelValue',
48
- ],
49
-
50
- /**
51
- * 组合式
52
- */
53
- setup(props, { emit, slots }) {
54
-
55
- // ==========【计算属性】=========================================================================================
56
-
57
- /**
58
- * 插槽标识
59
- */
60
- const slotNames = computed(function() {
61
- return utils.isValidObject(slots) ? Object.keys(slots) : []
62
- })
63
-
64
- // ==========【数据】============================================================================================
65
-
66
- // 当前值
67
- const currentValue = ref(formatModelValue(props.modelValue))
68
-
69
- // ==========【监听数据】=========================================================================================
70
-
71
- /**
72
- * 监听声明值
73
- */
74
- watch(() => props.modelValue, function (val) {
75
-
76
- // 格式化声明值
77
- currentValue.value = formatModelValue(val)
78
-
79
- }, {
80
- // 深度监听
81
- deep: true,
82
- })
83
-
84
- // ==========【方法】=============================================================================================
85
-
86
- /**
87
- * 触发更新值
88
- */
89
- function emitModelValue(val) {
90
- // 触发更新值
91
- emit('update:modelValue', val)
92
- }
93
-
94
- /**
95
- * 格式化声明值
96
- */
97
- function formatModelValue(val) {
98
-
99
- if (props.formatBefore) {
100
-
101
- // 如果是方法
102
- if (_.isFunction(props.formatBefore)) {
103
- return props.formatBefore(val)
104
- }
105
-
106
- // 如果是参数
107
- if (props.formatBefore === true || utils.isValidObject(props.formatBefore)) {
108
-
109
- // 如果值是数组
110
- if (Array.isArray(val)) {
111
-
112
- // 格式化数组值
113
- return formatArrayValue(val, props.formatBefore === true ? {} : props.formatBefore)
114
- }
115
-
116
- // 如果是有效值
117
- if (utils.isValidValue(val)) {
118
-
119
- // 格式化字符串值
120
- return formatStringValue(val, props.formatBefore === true ? {} : props.formatBefore, false)
121
- }
122
-
123
- return ''
124
- }
125
- }
126
-
127
- return Array.isArray(val) ? val.join(',') : val
128
- }
129
-
130
- /**
131
- * 格式化数组值
132
- */
133
- function formatArrayValue(val, params) {
134
-
135
- // 如果数组有值
136
- if (val.length) {
137
-
138
- const o = Object.assign({
139
- // 是否去重
140
- unique: true,
141
- // 分隔符
142
- separator: ',',
143
- // 是否给每个值去除首位空格
144
- trim: true,
145
- // 验证每个值是否为有效字符串/数字
146
- isValidValue: true,
147
- }, params)
148
-
149
- // 是否给每个值去除首位空格
150
- if (o.trim) {
151
- val = val.map(e => utils.trimString(e))
152
- }
153
-
154
- // 是否验证每个值是否为有效字符串/数字
155
- if (o.isValidValue) {
156
- val = val.filter(val => utils.isValidValue(val))
157
- }
158
-
159
- // 去重
160
- if (o.unique) {
161
- val = _.uniq(val)
162
- }
163
-
164
- // 合并为字符串
165
- return val.join(o.separator)
166
- }
167
-
168
- return ''
169
- }
170
-
171
- /**
172
- * 格式化字符串值
173
- */
174
- function formatStringValue(val, params, valueArray) {
175
-
176
- const o = Object.assign({
177
- // 替换内容
178
- replace: /\n|\,|\s+/g,
179
- // 是否去重
180
- unique: true,
181
- // 分隔符
182
- separator: ',',
183
- // 验证每个值是否为有效字符串/数字
184
- isValidValue: true,
185
- }, params)
186
-
187
- // 去除首位空格
188
- val = utils.trimString(val)
189
-
190
- // 如果有分割符
191
- if (utils.isValidValue(o.separator, true)) {
192
-
193
- o.separator = String(o.separator)
194
-
195
- // 是否替换
196
- if (o.replace) {
197
- val = val.replace(o.replace, o.separator)
198
- }
199
-
200
- // 分隔成数组
201
- val = utils.split(val, o.separator)
202
-
203
- // 去重
204
- if (o.unique) {
205
- val = _.uniq(val)
206
- }
207
-
208
- // 如果验证每个值是否为有效字符串/数字
209
- if (o.isValidValue) {
210
- val = val.filter(val => utils.isValidValue(val))
211
- }
212
-
213
- // 如果值不是数组
214
- if (! valueArray) {
215
- val = val.join(o.separator)
216
- }
217
-
218
- return val
219
- }
220
-
221
- return valueArray ? [ val ] : ''
222
- }
223
-
224
- /**
225
- * 失去焦点触发
226
- */
227
- function onBlur() {
228
-
229
- const val = currentValue.value
230
-
231
- // 如果修改值
232
- if (props.formatAfter) {
233
-
234
- // 如果是方法
235
- if (_.isFunction(props.formatAfter)) {
236
-
237
- // 触发更新值
238
- emitModelValue(props.formatAfter(val))
239
- return
240
- }
241
-
242
- // 如果是参数
243
- if (props.formatAfter === true || utils.isValidObject(props.formatAfter)) {
244
-
245
- // 触发更新值
246
- emitModelValue(formatStringValue(val, props.formatAfter === true ? {} : props.formatAfter, props.valueArray))
247
- return
248
- }
249
- }
250
-
251
- // 触发更新值
252
- emitModelValue(props.valueArray ? utils.split(val, ',') : val)
253
- }
254
-
255
- // ==========【返回】=============================================================================================
256
-
257
- return {
258
- // 插槽标识
259
- slotNames,
260
- // 当前值
261
- currentValue,
262
-
263
- // 失去焦点触发
264
- onBlur,
265
- }
266
- }
267
- }
268
- </script>