@netang/quasar 0.0.48 → 0.0.50
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/components/data/index.vue +23 -23
- package/components/dialog/index.vue +10 -10
- package/components/dialog-table/index.vue +1 -1
- package/components/dragger/index.vue +2 -2
- package/components/drawer/index.vue +7 -7
- package/components/editor-code/index.vue +282 -0
- package/components/empty/index.vue +22 -3
- package/components/field-date/index.vue +35 -35
- package/components/field-table/index.vue +34 -34
- package/components/field-text/index.vue +2 -2
- package/components/field-tree/index.vue +18 -18
- package/components/input-number/index.vue +2 -2
- package/components/list-menu/index.vue +2 -2
- package/components/private/components/move-to-tree/index.vue +2 -2
- package/components/private/edit-power-data/index.vue +50 -50
- package/components/private/table-visible-columns-button/index.vue +2 -2
- package/components/render/index.vue +6 -6
- package/components/search/index.vue +2 -2
- package/components/search-item/index.vue +5 -5
- package/components/select/index.vue +2 -2
- package/components/splitter/index.vue +7 -7
- package/components/table/index.vue +5 -5
- package/components/table-splitter/index.vue +4 -4
- package/components/table-summary/index.vue +3 -3
- package/components/thumbnail/index.vue +6 -6
- package/components/uploader/index.vue +1 -1
- package/components/uploader-query/index.vue +25 -25
- package/components/value-format/index.vue +12 -12
- package/package.json +1 -1
- package/sass/quasar/field.scss +5 -0
- package/sass/quasar/table.scss +6 -0
- package/utils/$area.js +13 -13
- package/utils/$auth.js +6 -6
- package/utils/$dialog.js +3 -3
- package/utils/$form.js +2 -2
- package/utils/$power.js +118 -118
- package/utils/$rule.js +4 -4
- package/utils/$search.js +50 -50
- package/utils/$table.js +79 -76
- package/utils/$tree.js +43 -43
- package/utils/$uploader.js +47 -47
- package/utils/alert.js +1 -1
- package/utils/arr.js +2 -2
- package/utils/bus.js +1 -1
- package/utils/config.js +4 -4
- package/utils/confrim.js +1 -1
- package/utils/dict.js +5 -5
- package/utils/getData.js +9 -9
- package/utils/getFile.js +5 -5
- package/utils/getImage.js +12 -12
- package/utils/getTime.js +4 -4
- package/utils/http.js +20 -20
- package/utils/loading.js +1 -1
- package/utils/notify.js +1 -1
- package/utils/previewImage.js +2 -2
- package/utils/price.js +3 -3
- package/utils/timestamp.js +1 -1
- package/utils/toast.js +1 -1
- package/utils/uploader/qiniu.js +11 -11
- package/utils/useAuth.js +2 -2
- package/utils/useRouter.js +4 -4
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<slot :data="data" />
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script>
|
|
6
|
-
export default {
|
|
7
|
-
/**
|
|
8
|
-
* 标识
|
|
9
|
-
*/
|
|
10
|
-
name: 'NData',
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* 传参
|
|
14
|
-
*/
|
|
15
|
-
props: {
|
|
16
|
-
// 数据
|
|
17
|
-
data: {},
|
|
18
|
-
},
|
|
19
|
-
}
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<style>
|
|
23
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<slot :data="data" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
export default {
|
|
7
|
+
/**
|
|
8
|
+
* 标识
|
|
9
|
+
*/
|
|
10
|
+
name: 'NData',
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 传参
|
|
14
|
+
*/
|
|
15
|
+
props: {
|
|
16
|
+
// 数据
|
|
17
|
+
data: {},
|
|
18
|
+
},
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<style>
|
|
23
|
+
</style>
|
|
@@ -184,10 +184,10 @@ export default {
|
|
|
184
184
|
|
|
185
185
|
function setWH(style, field, sign) {
|
|
186
186
|
if (props[field]) {
|
|
187
|
-
if (
|
|
187
|
+
if ($n.indexOf(props[field], '%') > -1) {
|
|
188
188
|
style[field] = props[field].replace('%', sign)
|
|
189
189
|
} else {
|
|
190
|
-
style[field] =
|
|
190
|
+
style[field] = $n.px(props[field])
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
}
|
|
@@ -231,10 +231,10 @@ export default {
|
|
|
231
231
|
// 如果是路由路径
|
|
232
232
|
if (props.route) {
|
|
233
233
|
// 获取路由组件
|
|
234
|
-
comp =
|
|
234
|
+
comp = $n.get(routers, `${$n.slash(props.route, 'start', false)}.component`)
|
|
235
235
|
|
|
236
236
|
// 如果有组件标识
|
|
237
|
-
} else if (props.name &&
|
|
237
|
+
} else if (props.name && $n.has(components, props.name)) {
|
|
238
238
|
// 获取自定义组件
|
|
239
239
|
comp = components[props.name]
|
|
240
240
|
}
|
|
@@ -245,7 +245,7 @@ export default {
|
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
// 如果是方法, 则说明是异步组件
|
|
248
|
-
if (
|
|
248
|
+
if ($n.isFunction(comp)) {
|
|
249
249
|
return defineAsyncComponent(comp)
|
|
250
250
|
}
|
|
251
251
|
|
|
@@ -265,7 +265,7 @@ export default {
|
|
|
265
265
|
|
|
266
266
|
return props.route ?
|
|
267
267
|
// 如果是路由路径, 则获取路由标题
|
|
268
|
-
|
|
268
|
+
$n.get(routers, `${$n.slash(props.route, 'start', false)}.meta.title`, '')
|
|
269
269
|
: ''
|
|
270
270
|
})
|
|
271
271
|
|
|
@@ -285,17 +285,17 @@ export default {
|
|
|
285
285
|
async function onDialogConfirm() {
|
|
286
286
|
|
|
287
287
|
// 如果有确定按钮
|
|
288
|
-
if (
|
|
288
|
+
if ($n.isFunction(props.onConfirm)) {
|
|
289
289
|
|
|
290
|
-
if (!
|
|
290
|
+
if (! $n.isFunction(compSubmit)) {
|
|
291
291
|
// 轻提示
|
|
292
|
-
|
|
292
|
+
$n.toast({
|
|
293
293
|
message: '未调用 $dialog.submit 方法',
|
|
294
294
|
})
|
|
295
295
|
return
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
-
const res = await
|
|
298
|
+
const res = await $n.runAsync(props.onConfirm)(await $n.runAsync(compSubmit)(), hide)
|
|
299
299
|
if (res === false) {
|
|
300
300
|
return
|
|
301
301
|
}
|
|
@@ -68,7 +68,7 @@ export default {
|
|
|
68
68
|
*/
|
|
69
69
|
const isDrag = computed(function() {
|
|
70
70
|
return props.drag
|
|
71
|
-
&&
|
|
71
|
+
&& $n.isValidArray(props.modelValue)
|
|
72
72
|
&& props.modelValue.length > 1
|
|
73
73
|
})
|
|
74
74
|
|
|
@@ -101,7 +101,7 @@ export default {
|
|
|
101
101
|
if (isDrag.value) {
|
|
102
102
|
|
|
103
103
|
// 如果为火狐浏览器, 则必须要setData
|
|
104
|
-
// if (
|
|
104
|
+
// if ($n.ua.firefox) {
|
|
105
105
|
// e.dataTransfer.setData('info', e.target.id)
|
|
106
106
|
// }
|
|
107
107
|
|
|
@@ -126,7 +126,7 @@ export default {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
// 创建防抖睡眠方法
|
|
129
|
-
const sleep =
|
|
129
|
+
const sleep = $n.debounceSleep()
|
|
130
130
|
|
|
131
131
|
// 缓存名
|
|
132
132
|
let cacheName = ''
|
|
@@ -138,10 +138,10 @@ export default {
|
|
|
138
138
|
if ($q.platform.is.mobile) {
|
|
139
139
|
|
|
140
140
|
// 获取手机端百分比值
|
|
141
|
-
let res =
|
|
141
|
+
let res = $n.percentValue(props.mobileWidth, true)
|
|
142
142
|
|
|
143
143
|
// 如果是百分比值
|
|
144
|
-
if (!
|
|
144
|
+
if (! $n.isNil(res)) {
|
|
145
145
|
// 原始尺寸 = 屏幕宽度 * 百分比
|
|
146
146
|
if (res) {
|
|
147
147
|
originalWidth = $q.screen.width * res
|
|
@@ -149,7 +149,7 @@ export default {
|
|
|
149
149
|
|
|
150
150
|
} else {
|
|
151
151
|
// 原始尺寸 = 屏幕宽度像素
|
|
152
|
-
res =
|
|
152
|
+
res = $n.pxValue(props.mobileWidth)
|
|
153
153
|
if (res) {
|
|
154
154
|
originalWidth = res
|
|
155
155
|
}
|
|
@@ -159,10 +159,10 @@ export default {
|
|
|
159
159
|
} else if (props.drag && props.cache) {
|
|
160
160
|
|
|
161
161
|
// 设置缓存名
|
|
162
|
-
cacheName = `drawer:${props.side}:${props.cache === true ? ($power && $power.routePath ? $power.routePath :
|
|
162
|
+
cacheName = `drawer:${props.side}:${props.cache === true ? ($power && $power.routePath ? $power.routePath : $n.router.getRoute('path')) : props.cache}`
|
|
163
163
|
|
|
164
164
|
// 从缓存获取宽度
|
|
165
|
-
const cache =
|
|
165
|
+
const cache = $n.storage.get(cacheName)
|
|
166
166
|
if (cache) {
|
|
167
167
|
originalWidth = cache
|
|
168
168
|
}
|
|
@@ -247,7 +247,7 @@ export default {
|
|
|
247
247
|
sleep(500)
|
|
248
248
|
.then(function () {
|
|
249
249
|
// 设置缓存(永久缓存)
|
|
250
|
-
|
|
250
|
+
$n.storage.set(cacheName, newWidth, 0)
|
|
251
251
|
})
|
|
252
252
|
}
|
|
253
253
|
}
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- :style="currentStyle" -->
|
|
3
|
+
<div
|
|
4
|
+
ref="targetRef"
|
|
5
|
+
:style="currentStyle"
|
|
6
|
+
></div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
import { ref, watch, computed, onMounted } from 'vue'
|
|
11
|
+
|
|
12
|
+
import script from '@netang/utils/script'
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 标识
|
|
18
|
+
*/
|
|
19
|
+
name: 'NEditorCode',
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 声明属性
|
|
23
|
+
*/
|
|
24
|
+
props: {
|
|
25
|
+
// 值 v-model
|
|
26
|
+
modelValue: {
|
|
27
|
+
type: [ String, Number ],
|
|
28
|
+
default: '',
|
|
29
|
+
},
|
|
30
|
+
// 宽度
|
|
31
|
+
width: {
|
|
32
|
+
type: [ String, Number ],
|
|
33
|
+
default: '100%',
|
|
34
|
+
},
|
|
35
|
+
// 高度
|
|
36
|
+
height: [ String, Number ],
|
|
37
|
+
// 脚本语言
|
|
38
|
+
language: String,
|
|
39
|
+
// 是否只读
|
|
40
|
+
readonly: Boolean,
|
|
41
|
+
// 代码视图
|
|
42
|
+
minimap: Boolean,
|
|
43
|
+
// tab 长度
|
|
44
|
+
tabSize: {
|
|
45
|
+
type: Number,
|
|
46
|
+
default: 4,
|
|
47
|
+
},
|
|
48
|
+
// 主题
|
|
49
|
+
theme: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: 'vs',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 声明事件
|
|
57
|
+
*/
|
|
58
|
+
emits: [
|
|
59
|
+
'update:modelValue',
|
|
60
|
+
],
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 组合式
|
|
64
|
+
*/
|
|
65
|
+
setup(props, { emit }) {
|
|
66
|
+
|
|
67
|
+
// ==========【计算属性】=========================================================================================
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 当前样式
|
|
71
|
+
*/
|
|
72
|
+
const currentStyle = computed(function () {
|
|
73
|
+
return {
|
|
74
|
+
width: $n.isNumeric(props.width) ? $n.px(props.width) : props.width,
|
|
75
|
+
height: $n.isNumeric(props.height) ? $n.px(props.height) : props.height,
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
// ==========【数据】=============================================================================================
|
|
80
|
+
|
|
81
|
+
// 根节点
|
|
82
|
+
const targetRef = ref(null)
|
|
83
|
+
|
|
84
|
+
// 编辑器实例
|
|
85
|
+
let $editor = null
|
|
86
|
+
|
|
87
|
+
// 停止值观察
|
|
88
|
+
let stopValueWatcher = false
|
|
89
|
+
|
|
90
|
+
// 创建防抖睡眠方法
|
|
91
|
+
const sleep = $n.debounceSleep()
|
|
92
|
+
|
|
93
|
+
// ==========【监听数据】=========================================================================================
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 监听声明值
|
|
97
|
+
*/
|
|
98
|
+
watch(() => props.modelValue, function (val) {
|
|
99
|
+
|
|
100
|
+
// 如果停止值观察
|
|
101
|
+
if (stopValueWatcher) {
|
|
102
|
+
|
|
103
|
+
// 则无任何操作
|
|
104
|
+
return
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// 取消停止值观察
|
|
108
|
+
stopValueWatcher = false
|
|
109
|
+
|
|
110
|
+
// 设置值
|
|
111
|
+
setValue(val)
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
// ==========【方法】============================================================================================
|
|
115
|
+
|
|
116
|
+
function load() {
|
|
117
|
+
|
|
118
|
+
// 如果已加载
|
|
119
|
+
if (window.monaco) {
|
|
120
|
+
// 创建编辑器
|
|
121
|
+
create()
|
|
122
|
+
return
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// 版本
|
|
126
|
+
const version = '0.34.1'
|
|
127
|
+
|
|
128
|
+
// 加载 script
|
|
129
|
+
script([
|
|
130
|
+
[
|
|
131
|
+
`https://cdn.staticfile.org/monaco-editor/${version}/min/vs/loader.js`,
|
|
132
|
+
`https://fastly.jsdelivr.net/npm/monaco-editor@${version}/min/vs/loader.js`,
|
|
133
|
+
`https://unpkg.com/monaco-editor@${version}/min/vs/loader.js`,
|
|
134
|
+
]
|
|
135
|
+
])
|
|
136
|
+
.then(function ([ url ]) {
|
|
137
|
+
|
|
138
|
+
// 按需加载
|
|
139
|
+
const _require = window.require
|
|
140
|
+
|
|
141
|
+
// 配置
|
|
142
|
+
_require.config({
|
|
143
|
+
// 路径
|
|
144
|
+
paths: {
|
|
145
|
+
vs: url.replace('/loader.js', ''),
|
|
146
|
+
},
|
|
147
|
+
// 语言
|
|
148
|
+
'vs/nls' : {
|
|
149
|
+
availableLanguages: {
|
|
150
|
+
'*': 'zh-cn',
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
// 加载
|
|
156
|
+
_require(['vs/editor/editor.main'], function () {
|
|
157
|
+
// 创建编辑器
|
|
158
|
+
create()
|
|
159
|
+
})
|
|
160
|
+
})
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* 创建编辑器
|
|
165
|
+
*/
|
|
166
|
+
function create() {
|
|
167
|
+
|
|
168
|
+
// 创建编辑器
|
|
169
|
+
$editor = monaco.editor.create(targetRef.value, {
|
|
170
|
+
// 主题
|
|
171
|
+
theme: props.theme,
|
|
172
|
+
// 脚本语言
|
|
173
|
+
language: props.language,
|
|
174
|
+
// 自动布局
|
|
175
|
+
automaticLayout: true,
|
|
176
|
+
// 自动换行
|
|
177
|
+
wordWrap: 'on',
|
|
178
|
+
// tab 长度
|
|
179
|
+
tabSize: props.tabSize,
|
|
180
|
+
// 代码略缩图
|
|
181
|
+
minimap: {
|
|
182
|
+
enabled: props.minimap,
|
|
183
|
+
},
|
|
184
|
+
// 右键
|
|
185
|
+
contextmenu: true,
|
|
186
|
+
// 是否只读
|
|
187
|
+
readOnly: props.readonly,
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
// 监听失去焦点事件
|
|
191
|
+
$editor.onDidBlurEditorText(function () {
|
|
192
|
+
|
|
193
|
+
// 获取编辑器内容
|
|
194
|
+
const value = getValue()
|
|
195
|
+
if (value === void 0) {
|
|
196
|
+
return
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// 停止值观察
|
|
200
|
+
stopValueWatcher = true
|
|
201
|
+
|
|
202
|
+
// 触发更新值
|
|
203
|
+
emit('update:modelValue', value)
|
|
204
|
+
})
|
|
205
|
+
|
|
206
|
+
// 等编辑器全部加载完成后, 设置内容值
|
|
207
|
+
sleep(300)
|
|
208
|
+
.then(function () {
|
|
209
|
+
// 设置值
|
|
210
|
+
setValue(props.modelValue)
|
|
211
|
+
})
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* 设置值
|
|
216
|
+
*/
|
|
217
|
+
function setValue(value) {
|
|
218
|
+
if ($editor) {
|
|
219
|
+
|
|
220
|
+
// 编辑器设置内容
|
|
221
|
+
$editor.setValue(value)
|
|
222
|
+
|
|
223
|
+
// 代码格式化
|
|
224
|
+
$editor.getAction('editor.action.formatDocument').run()
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* 获取值
|
|
230
|
+
*/
|
|
231
|
+
function getValue() {
|
|
232
|
+
|
|
233
|
+
if ($editor) {
|
|
234
|
+
|
|
235
|
+
// 获取编辑器的值
|
|
236
|
+
let value = $editor.getValue()
|
|
237
|
+
|
|
238
|
+
// 如果语言为 json
|
|
239
|
+
if (
|
|
240
|
+
props.language === 'json'
|
|
241
|
+
&& $n.isValidValue(value)
|
|
242
|
+
) {
|
|
243
|
+
try {
|
|
244
|
+
value = JSON.stringify(JSON.parse(value))
|
|
245
|
+
|
|
246
|
+
} catch (e) {
|
|
247
|
+
// 轻提示
|
|
248
|
+
$n.toast({
|
|
249
|
+
message: 'JSON 语法错误'
|
|
250
|
+
})
|
|
251
|
+
return
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return value
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return ''
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// ==========【生命周期】=========================================================================================
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* 实例被挂载后调用
|
|
265
|
+
*/
|
|
266
|
+
onMounted(function() {
|
|
267
|
+
|
|
268
|
+
// 加载
|
|
269
|
+
load()
|
|
270
|
+
})
|
|
271
|
+
|
|
272
|
+
// ==========【返回】=========================================================================================
|
|
273
|
+
|
|
274
|
+
return {
|
|
275
|
+
// 根节点
|
|
276
|
+
targetRef,
|
|
277
|
+
// 当前样式
|
|
278
|
+
currentStyle,
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
</script>
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="q-pa-lg
|
|
3
|
-
|
|
2
|
+
<div class="q-pa-lg column flex-center absolute-full q-gutter-sm">
|
|
3
|
+
|
|
4
|
+
<!-- 图标 -->
|
|
5
|
+
<q-icon
|
|
6
|
+
:name="icon"
|
|
7
|
+
color="grey-5"
|
|
8
|
+
:size="$n.px(iconSize)"
|
|
9
|
+
/>
|
|
10
|
+
|
|
11
|
+
<!-- 描述文字 -->
|
|
12
|
+
<div class="text-subtitle1 text-grey-7" v-if="description">{{description}}</div>
|
|
4
13
|
</div>
|
|
5
14
|
</template>
|
|
6
15
|
|
|
@@ -16,7 +25,17 @@ export default {
|
|
|
16
25
|
* 声明属性
|
|
17
26
|
*/
|
|
18
27
|
props: {
|
|
19
|
-
//
|
|
28
|
+
// 图标
|
|
29
|
+
icon: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: 'info',
|
|
32
|
+
},
|
|
33
|
+
// 图标大小
|
|
34
|
+
iconSize: {
|
|
35
|
+
type: [ String, Number ],
|
|
36
|
+
default: 70,
|
|
37
|
+
},
|
|
38
|
+
// 描述文字
|
|
20
39
|
description: String,
|
|
21
40
|
},
|
|
22
41
|
}
|