@netang/quasar 0.2.12 → 0.2.14

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 (40) hide show
  1. package/components/data/index.vue +20 -20
  2. package/components/dragger/index.vue +203 -203
  3. package/components/empty/index.vue +2 -0
  4. package/components/field-date/methods.js +100 -100
  5. package/components/field-text/index.vue +165 -165
  6. package/components/list-menu/index.vue +149 -149
  7. package/components/list-menu-item/index.vue +79 -79
  8. package/components/power-page/index.vue +3 -1
  9. package/components/price/index.vue +188 -188
  10. package/components/private/components/index.js +11 -11
  11. package/components/table-pagination/index.vue +192 -192
  12. package/components/thumbnail/index.vue +72 -72
  13. package/components/value-format/index.vue +274 -274
  14. package/configs/area3.js +1 -1
  15. package/docs/css/index.css +3 -3
  16. package/package.json +1 -1
  17. package/sass/line.scss +39 -39
  18. package/sass/quasar/btn.scss +46 -46
  19. package/sass/quasar/common.scss +3 -3
  20. package/sass/quasar/drawer.scss +6 -6
  21. package/sass/quasar/loading.scss +6 -6
  22. package/sass/quasar/toolbar.scss +22 -22
  23. package/store/index.js +29 -29
  24. package/utils/$auth.js +127 -127
  25. package/utils/$rule.js +13 -13
  26. package/utils/$ruleValid.js +10 -10
  27. package/utils/alert.js +12 -12
  28. package/utils/area.js +400 -400
  29. package/utils/arr.js +51 -51
  30. package/utils/bus.js +6 -6
  31. package/utils/confirm.js +11 -11
  32. package/utils/copy.js +30 -30
  33. package/utils/dictOptions.js +28 -28
  34. package/utils/loading.js +15 -15
  35. package/utils/notify.js +13 -13
  36. package/utils/price.js +18 -18
  37. package/utils/symbols.js +18 -18
  38. package/utils/toast.js +13 -13
  39. package/utils/useAuth.js +30 -30
  40. package/utils/useRouter.js +47 -47
@@ -1,274 +1,274 @@
1
- <template>
2
- <slot
3
- :scope="current"
4
- :emit="emitValue"
5
- />
6
- </template>
7
-
8
- <script>
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'
17
-
18
- export default {
19
-
20
- /**
21
- * 关闭组件 attribute 透传行为
22
- */
23
- inheritAttrs: false,
24
-
25
- /**
26
- * 标识
27
- */
28
- name: 'NValueFormat',
29
-
30
- /**
31
- * 声明属性
32
- */
33
- props: {
34
- // 值 v-model
35
- modelValue: {
36
- required: true,
37
- },
38
- // 修改前值
39
- before: Function,
40
- // 修改后值
41
- after: Function,
42
- // 不自动触发更新
43
- noEmit: Boolean,
44
- },
45
-
46
- /**
47
- * 声明事件
48
- */
49
- emits: [
50
- 'update:modelValue',
51
- ],
52
-
53
- /**
54
- * 组合式
55
- */
56
- setup(props, { emit }) {
57
-
58
- // ==========【数据】============================================================================================
59
-
60
- // 当前值
61
- const current = ref({
62
- value: formatModelValue(props.modelValue),
63
- })
64
-
65
- // 如果是自动触发更新
66
- if (! props.noEmit) {
67
- // 触发更新值
68
- // 此处用于判断声明值是否有改变
69
- emitValue()
70
- }
71
-
72
- // ==========【监听数据】=========================================================================================
73
-
74
- /**
75
- * 监听声明值
76
- */
77
- watch(() => props.modelValue, function (val) {
78
-
79
- // 格式化声明值
80
- current.value.value = formatModelValue(val)
81
-
82
- }, {
83
- // 深度监听
84
- deep: true,
85
- })
86
-
87
- /**
88
- * 监听当前值
89
- */
90
- watch(current, function (value) {
91
-
92
- // 如果是自动触发更新
93
- if (! props.noEmit) {
94
-
95
- // 立即执行触发更新值
96
- emitValue(value.value)
97
- }
98
-
99
- }, {
100
- // 深度监听
101
- deep: true,
102
- })
103
-
104
- // ==========【方法】=============================================================================================
105
-
106
- /**
107
- * 格式化声明值
108
- */
109
- function formatModelValue(value) {
110
- return $n_isFunction(props.before)
111
- // 如果有修改前值方法
112
- ? props.before({ value, formatArray, formatString })
113
- // 返回值
114
- : value
115
- }
116
-
117
- /**
118
- * 触发更新值
119
- */
120
- function emitValue() {
121
-
122
- // if (
123
- // value !== void 0
124
- // && typeof value === 'object'
125
- // && value instanceof Event
126
- // ) {
127
- // // 停止冒泡
128
- // value.stopPropagation()
129
- //
130
- // // 获取当前值
131
- // value = current.value.value
132
- // }
133
-
134
- // 获取当前值
135
- const value = current.value.value
136
-
137
- // 获取新值
138
- const newValue = $n_isFunction(props.after) ?
139
- // 如果有修改提交值方法
140
- props.after({ value, formatArray, formatString })
141
- // 否则返回当前值
142
- : value
143
-
144
- // 如果值有改变
145
- if (newValue !== props.modelValue) {
146
-
147
- // 触发更新值
148
- emit('update:modelValue', newValue)
149
- }
150
- }
151
-
152
- /**
153
- * 格式化数组
154
- */
155
- function formatArray(val, params) {
156
-
157
- const o = Object.assign({
158
- // 是否去重
159
- unique: true,
160
- // 分隔符
161
- separator: ',',
162
- // 是否给每个值去除首位空格
163
- trim: true,
164
- // 验证每个值是否为有效字符串/数字
165
- isValidValue: true,
166
- // 是否转字符串
167
- toString: false,
168
- }, params)
169
-
170
- val = $n_isValidArray(val) ? val : []
171
-
172
- // 如果数组有值
173
- if (val.length) {
174
-
175
- // 是否给每个值去除首位空格
176
- if (o.trim) {
177
- val = val.map(e => $n_trimString(e))
178
- }
179
-
180
- // 是否验证每个值是否为有效字符串/数字
181
- if (o.isValidValue) {
182
- val = val.filter(val => $n_isValidValue(val))
183
- }
184
-
185
- // 去重
186
- if (o.unique) {
187
- val = $n_uniq(val)
188
- }
189
- }
190
-
191
- // 如果转字符串
192
- if (o.toString) {
193
- // 合并为字符串
194
- return val.join(o.separator)
195
- }
196
-
197
- return []
198
- }
199
-
200
- /**
201
- * 格式化字符串
202
- */
203
- function formatString(val, params) {
204
-
205
- const o = Object.assign({
206
- // 是否给每个值去除首位空格
207
- trim: true,
208
- // 替换内容
209
- replace: /\n|,|,|\s+/g,
210
- // 是否去重
211
- unique: true,
212
- // 分隔符
213
- separator: ',',
214
- // 验证每个值是否为有效字符串/数字
215
- isValidValue: true,
216
- // 是否转数组
217
- toArray: false,
218
- }, params)
219
-
220
- // 是否去除首尾空格
221
- if (o.trim) {
222
- // 去除首尾空格
223
- val = $n_trimString(val)
224
-
225
- // 否则转字符串
226
- } else {
227
- val = $n_isValidValue(val) ? String(val) : ''
228
- }
229
-
230
- // 如果有分割符
231
- if ($n_isValidValue(o.separator, true)) {
232
-
233
- // 是否替换
234
- if (o.replace) {
235
- val = val.replace(o.replace, o.separator)
236
- }
237
-
238
- // 分隔成数组
239
- val = $n_split(val, o.separator)
240
-
241
- // 如果去重
242
- if (o.unique) {
243
- val = $n_uniq(val)
244
- }
245
-
246
- // 如果验证每个值是否为有效字符串/数字
247
- if (o.isValidValue) {
248
- val = val.filter(val => $n_isValidValue(val))
249
- }
250
-
251
- // 如果转数组
252
- if (o.toArray) {
253
- // 则直接返回
254
- return val
255
- }
256
-
257
- // 返回分隔符隔开的字符串
258
- return val.join(o.separator)
259
- }
260
-
261
- return o.toArray ? [ val ] : ''
262
- }
263
-
264
- // ==========【返回】=============================================================================================
265
-
266
- return {
267
- // 当前值
268
- current,
269
- // 触发更新值
270
- emitValue,
271
- }
272
- }
273
- }
274
- </script>
1
+ <template>
2
+ <slot
3
+ :scope="current"
4
+ :emit="emitValue"
5
+ />
6
+ </template>
7
+
8
+ <script>
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'
17
+
18
+ export default {
19
+
20
+ /**
21
+ * 关闭组件 attribute 透传行为
22
+ */
23
+ inheritAttrs: false,
24
+
25
+ /**
26
+ * 标识
27
+ */
28
+ name: 'NValueFormat',
29
+
30
+ /**
31
+ * 声明属性
32
+ */
33
+ props: {
34
+ // 值 v-model
35
+ modelValue: {
36
+ required: true,
37
+ },
38
+ // 修改前值
39
+ before: Function,
40
+ // 修改后值
41
+ after: Function,
42
+ // 不自动触发更新
43
+ noEmit: Boolean,
44
+ },
45
+
46
+ /**
47
+ * 声明事件
48
+ */
49
+ emits: [
50
+ 'update:modelValue',
51
+ ],
52
+
53
+ /**
54
+ * 组合式
55
+ */
56
+ setup(props, { emit }) {
57
+
58
+ // ==========【数据】============================================================================================
59
+
60
+ // 当前值
61
+ const current = ref({
62
+ value: formatModelValue(props.modelValue),
63
+ })
64
+
65
+ // 如果是自动触发更新
66
+ if (! props.noEmit) {
67
+ // 触发更新值
68
+ // 此处用于判断声明值是否有改变
69
+ emitValue()
70
+ }
71
+
72
+ // ==========【监听数据】=========================================================================================
73
+
74
+ /**
75
+ * 监听声明值
76
+ */
77
+ watch(() => props.modelValue, function (val) {
78
+
79
+ // 格式化声明值
80
+ current.value.value = formatModelValue(val)
81
+
82
+ }, {
83
+ // 深度监听
84
+ deep: true,
85
+ })
86
+
87
+ /**
88
+ * 监听当前值
89
+ */
90
+ watch(current, function (value) {
91
+
92
+ // 如果是自动触发更新
93
+ if (! props.noEmit) {
94
+
95
+ // 立即执行触发更新值
96
+ emitValue(value.value)
97
+ }
98
+
99
+ }, {
100
+ // 深度监听
101
+ deep: true,
102
+ })
103
+
104
+ // ==========【方法】=============================================================================================
105
+
106
+ /**
107
+ * 格式化声明值
108
+ */
109
+ function formatModelValue(value) {
110
+ return $n_isFunction(props.before)
111
+ // 如果有修改前值方法
112
+ ? props.before({ value, formatArray, formatString })
113
+ // 返回值
114
+ : value
115
+ }
116
+
117
+ /**
118
+ * 触发更新值
119
+ */
120
+ function emitValue() {
121
+
122
+ // if (
123
+ // value !== void 0
124
+ // && typeof value === 'object'
125
+ // && value instanceof Event
126
+ // ) {
127
+ // // 停止冒泡
128
+ // value.stopPropagation()
129
+ //
130
+ // // 获取当前值
131
+ // value = current.value.value
132
+ // }
133
+
134
+ // 获取当前值
135
+ const value = current.value.value
136
+
137
+ // 获取新值
138
+ const newValue = $n_isFunction(props.after) ?
139
+ // 如果有修改提交值方法
140
+ props.after({ value, formatArray, formatString })
141
+ // 否则返回当前值
142
+ : value
143
+
144
+ // 如果值有改变
145
+ if (newValue !== props.modelValue) {
146
+
147
+ // 触发更新值
148
+ emit('update:modelValue', newValue)
149
+ }
150
+ }
151
+
152
+ /**
153
+ * 格式化数组
154
+ */
155
+ function formatArray(val, params) {
156
+
157
+ const o = Object.assign({
158
+ // 是否去重
159
+ unique: true,
160
+ // 分隔符
161
+ separator: ',',
162
+ // 是否给每个值去除首位空格
163
+ trim: true,
164
+ // 验证每个值是否为有效字符串/数字
165
+ isValidValue: true,
166
+ // 是否转字符串
167
+ toString: false,
168
+ }, params)
169
+
170
+ val = $n_isValidArray(val) ? val : []
171
+
172
+ // 如果数组有值
173
+ if (val.length) {
174
+
175
+ // 是否给每个值去除首位空格
176
+ if (o.trim) {
177
+ val = val.map(e => $n_trimString(e))
178
+ }
179
+
180
+ // 是否验证每个值是否为有效字符串/数字
181
+ if (o.isValidValue) {
182
+ val = val.filter(val => $n_isValidValue(val))
183
+ }
184
+
185
+ // 去重
186
+ if (o.unique) {
187
+ val = $n_uniq(val)
188
+ }
189
+ }
190
+
191
+ // 如果转字符串
192
+ if (o.toString) {
193
+ // 合并为字符串
194
+ return val.join(o.separator)
195
+ }
196
+
197
+ return []
198
+ }
199
+
200
+ /**
201
+ * 格式化字符串
202
+ */
203
+ function formatString(val, params) {
204
+
205
+ const o = Object.assign({
206
+ // 是否给每个值去除首位空格
207
+ trim: true,
208
+ // 替换内容
209
+ replace: /\n|,|,|\s+/g,
210
+ // 是否去重
211
+ unique: true,
212
+ // 分隔符
213
+ separator: ',',
214
+ // 验证每个值是否为有效字符串/数字
215
+ isValidValue: true,
216
+ // 是否转数组
217
+ toArray: false,
218
+ }, params)
219
+
220
+ // 是否去除首尾空格
221
+ if (o.trim) {
222
+ // 去除首尾空格
223
+ val = $n_trimString(val)
224
+
225
+ // 否则转字符串
226
+ } else {
227
+ val = $n_isValidValue(val) ? String(val) : ''
228
+ }
229
+
230
+ // 如果有分割符
231
+ if ($n_isValidValue(o.separator, true)) {
232
+
233
+ // 是否替换
234
+ if (o.replace) {
235
+ val = val.replace(o.replace, o.separator)
236
+ }
237
+
238
+ // 分隔成数组
239
+ val = $n_split(val, o.separator)
240
+
241
+ // 如果去重
242
+ if (o.unique) {
243
+ val = $n_uniq(val)
244
+ }
245
+
246
+ // 如果验证每个值是否为有效字符串/数字
247
+ if (o.isValidValue) {
248
+ val = val.filter(val => $n_isValidValue(val))
249
+ }
250
+
251
+ // 如果转数组
252
+ if (o.toArray) {
253
+ // 则直接返回
254
+ return val
255
+ }
256
+
257
+ // 返回分隔符隔开的字符串
258
+ return val.join(o.separator)
259
+ }
260
+
261
+ return o.toArray ? [ val ] : ''
262
+ }
263
+
264
+ // ==========【返回】=============================================================================================
265
+
266
+ return {
267
+ // 当前值
268
+ current,
269
+ // 触发更新值
270
+ emitValue,
271
+ }
272
+ }
273
+ }
274
+ </script>