@netang/quasar 0.0.81 → 0.0.82
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/dialog/index.vue +49 -47
- package/components/field-table/index.vue +1 -1
- package/components/field-tree/index.vue +5 -2
- package/components/img/index.vue +4 -9
- package/components/uploader-query/index.vue +13 -5
- package/package.json +1 -1
- package/sass/common.scss +1 -2
- package/utils/$power.js +22 -2
- package/utils/$table.js +4 -6
- package/utils/dialog.js +1 -1
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<q-card class="flex column" :style="customStyle">
|
|
10
10
|
|
|
11
11
|
<!-- 头部 -->
|
|
12
|
-
<q-toolbar>
|
|
12
|
+
<q-toolbar class="n-line--bottom">
|
|
13
13
|
<!-- 标题 -->
|
|
14
14
|
<q-toolbar-title>{{currentTitle}}</q-toolbar-title>
|
|
15
15
|
<!-- 关闭按钮 -->
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
</q-card-section>
|
|
39
39
|
|
|
40
40
|
<!-- 底部 -->
|
|
41
|
-
<q-card-actions align="right" v-if="bottom">
|
|
41
|
+
<q-card-actions class="n-line--top" align="right" v-if="bottom">
|
|
42
42
|
<!-- 取消按钮 -->
|
|
43
43
|
<q-btn label="取消" color="primary" @click="onDialogCancel" flat v-close-popup v-if="cancel" />
|
|
44
44
|
<!-- 确定按钮 -->
|
|
@@ -91,7 +91,9 @@ export default {
|
|
|
91
91
|
// 组件标识
|
|
92
92
|
name: String,
|
|
93
93
|
// 路由组件路径
|
|
94
|
-
|
|
94
|
+
path: String,
|
|
95
|
+
// 路由组件参数
|
|
96
|
+
query: Object,
|
|
95
97
|
// 组件传参
|
|
96
98
|
props: Object,
|
|
97
99
|
// 标题
|
|
@@ -197,44 +199,6 @@ export default {
|
|
|
197
199
|
|
|
198
200
|
// ==========【计算属性】=========================================================================================
|
|
199
201
|
|
|
200
|
-
function setWH(style, field, sign) {
|
|
201
|
-
if (props[field]) {
|
|
202
|
-
if ($n_indexOf(props[field], '%') > -1) {
|
|
203
|
-
style[field] = props[field].replace('%', sign)
|
|
204
|
-
} else {
|
|
205
|
-
style[field] = $n_px(props[field])
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* 自定义样式
|
|
212
|
-
*/
|
|
213
|
-
const customStyle = computed(function () {
|
|
214
|
-
|
|
215
|
-
const style = {}
|
|
216
|
-
|
|
217
|
-
if (
|
|
218
|
-
props.fullscreen
|
|
219
|
-
|| $q.platform.is.mobile
|
|
220
|
-
|| (props.width === '100%' && props.height === '100%')
|
|
221
|
-
) {
|
|
222
|
-
style.width = '100vw'
|
|
223
|
-
style.height = '100vh'
|
|
224
|
-
style.borderRadius = 0
|
|
225
|
-
|
|
226
|
-
} else {
|
|
227
|
-
// 宽度
|
|
228
|
-
setWH(style, 'width', 'vw')
|
|
229
|
-
// 高度
|
|
230
|
-
setWH(style, 'height', 'vh')
|
|
231
|
-
// 最小宽度
|
|
232
|
-
setWH(style, 'minWidth', 'vw')
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
return style
|
|
236
|
-
})
|
|
237
|
-
|
|
238
202
|
/**
|
|
239
203
|
* 获取当前组件
|
|
240
204
|
*/
|
|
@@ -244,9 +208,9 @@ export default {
|
|
|
244
208
|
let comp
|
|
245
209
|
|
|
246
210
|
// 如果是路由路径
|
|
247
|
-
if (props.
|
|
211
|
+
if (props.path) {
|
|
248
212
|
// 获取路由组件
|
|
249
|
-
comp = $n_get(routers, `${$n_slash(props.
|
|
213
|
+
comp = $n_get(routers, `${$n_slash(props.path, 'start', false)}.component`)
|
|
250
214
|
|
|
251
215
|
// 如果有组件标识
|
|
252
216
|
} else if (props.name && $n_has(components, props.name)) {
|
|
@@ -268,6 +232,34 @@ export default {
|
|
|
268
232
|
return comp
|
|
269
233
|
})
|
|
270
234
|
|
|
235
|
+
/**
|
|
236
|
+
* 自定义样式
|
|
237
|
+
*/
|
|
238
|
+
const customStyle = computed(function () {
|
|
239
|
+
|
|
240
|
+
const style = {}
|
|
241
|
+
|
|
242
|
+
if (
|
|
243
|
+
props.fullscreen
|
|
244
|
+
|| $q.platform.is.mobile
|
|
245
|
+
|| (props.width === '100%' && props.height === '100%')
|
|
246
|
+
) {
|
|
247
|
+
style.width = '100vw'
|
|
248
|
+
style.height = '100vh'
|
|
249
|
+
style.borderRadius = 0
|
|
250
|
+
|
|
251
|
+
} else {
|
|
252
|
+
// 宽度
|
|
253
|
+
setWH(style, 'width', 'vw')
|
|
254
|
+
// 高度
|
|
255
|
+
setWH(style, 'height', 'vh')
|
|
256
|
+
// 最小宽度
|
|
257
|
+
setWH(style, 'minWidth', 'vw')
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
return style
|
|
261
|
+
})
|
|
262
|
+
|
|
271
263
|
/**
|
|
272
264
|
* 当前标题
|
|
273
265
|
*/
|
|
@@ -278,14 +270,24 @@ export default {
|
|
|
278
270
|
return props.title
|
|
279
271
|
}
|
|
280
272
|
|
|
281
|
-
return
|
|
282
|
-
// 如果是路由路径, 则获取路由标题
|
|
283
|
-
$n_get(routers, `${$n_slash(props.route, 'start', false)}.meta.title`, '')
|
|
284
|
-
: ''
|
|
273
|
+
return ''
|
|
285
274
|
})
|
|
286
275
|
|
|
287
276
|
// ==========【方法】=============================================================================================
|
|
288
277
|
|
|
278
|
+
/**
|
|
279
|
+
* 设置宽高
|
|
280
|
+
*/
|
|
281
|
+
function setWH(style, field, sign) {
|
|
282
|
+
if (props[field]) {
|
|
283
|
+
if ($n_indexOf(props[field], '%') > -1) {
|
|
284
|
+
style[field] = props[field].replace('%', sign)
|
|
285
|
+
} else {
|
|
286
|
+
style[field] = $n_px(props[field])
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
289
291
|
/**
|
|
290
292
|
* 隐藏对话框
|
|
291
293
|
*/
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<q-field
|
|
3
3
|
class="n-field-tree"
|
|
4
4
|
:model-value="showValue"
|
|
5
|
+
:disable="disable"
|
|
5
6
|
:readonly="readonly"
|
|
6
7
|
:clearable="clearable"
|
|
7
8
|
@focus="onFieldFocus"
|
|
@@ -37,7 +38,7 @@
|
|
|
37
38
|
:key="`item-${index}`"
|
|
38
39
|
:label="item.label"
|
|
39
40
|
dense
|
|
40
|
-
removable
|
|
41
|
+
:removable="! readonly && ! disable"
|
|
41
42
|
@remove="onRemoveItem(index)"
|
|
42
43
|
/>
|
|
43
44
|
</template>
|
|
@@ -84,7 +85,7 @@
|
|
|
84
85
|
@focus="onFieldFocus"
|
|
85
86
|
@show="onPopupShow"
|
|
86
87
|
@before-hide="showPopup = false"
|
|
87
|
-
v-if="! readonly"
|
|
88
|
+
v-if="! readonly && ! disable"
|
|
88
89
|
>
|
|
89
90
|
<q-card>
|
|
90
91
|
<!-- 树 -->
|
|
@@ -178,6 +179,8 @@ export default {
|
|
|
178
179
|
placeholder: String,
|
|
179
180
|
// 是否可清除
|
|
180
181
|
clearable: Boolean,
|
|
182
|
+
// 是否禁用
|
|
183
|
+
disable: Boolean,
|
|
181
184
|
// 是否只读
|
|
182
185
|
readonly: Boolean,
|
|
183
186
|
},
|
package/components/img/index.vue
CHANGED
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
'rounded-borders': rounded,
|
|
44
44
|
'n-img--round': round,
|
|
45
45
|
}"
|
|
46
|
-
|
|
46
|
+
:style="imageProps"
|
|
47
|
+
v-bind="$attrs"
|
|
47
48
|
v-else
|
|
48
49
|
>
|
|
49
50
|
<div class="q-img__content absolute-full q-anchor--skip">
|
|
@@ -156,14 +157,8 @@ export default {
|
|
|
156
157
|
}
|
|
157
158
|
|
|
158
159
|
return {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
{
|
|
162
|
-
width,
|
|
163
|
-
height,
|
|
164
|
-
},
|
|
165
|
-
$n_get(attrs, 'style'),
|
|
166
|
-
],
|
|
160
|
+
width,
|
|
161
|
+
height,
|
|
167
162
|
}
|
|
168
163
|
})
|
|
169
164
|
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
<!-- 上传按钮 -->
|
|
5
5
|
<slot
|
|
6
6
|
name="button"
|
|
7
|
+
:disable="disable || readonly"
|
|
7
8
|
:size="currentSize"
|
|
8
9
|
v-if="$slots.button"
|
|
9
10
|
/>
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
@click="uploader.chooseUpload"
|
|
18
19
|
color="primary"
|
|
19
20
|
outline
|
|
21
|
+
:disable="disable || readonly"
|
|
20
22
|
unelevated
|
|
21
23
|
v-bind="buttonProps"
|
|
22
24
|
/>
|
|
@@ -34,7 +36,7 @@
|
|
|
34
36
|
<template v-if="type === 'image'">
|
|
35
37
|
|
|
36
38
|
<!-- 左边方块按钮 -->
|
|
37
|
-
<template v-if="! rightSquareButton">
|
|
39
|
+
<template v-if="! disable && ! readonly && ! rightSquareButton">
|
|
38
40
|
<slot
|
|
39
41
|
name="square-button"
|
|
40
42
|
:size="currentSize"
|
|
@@ -146,14 +148,14 @@
|
|
|
146
148
|
size="xs"
|
|
147
149
|
title="删除"
|
|
148
150
|
@click="uploader.deleteFileItem(fileItem)"
|
|
149
|
-
v-if="! noDelete"
|
|
151
|
+
v-if="! noDelete && ! disable && ! readonly"
|
|
150
152
|
/>
|
|
151
153
|
</div>
|
|
152
154
|
</q-img>
|
|
153
155
|
</div>
|
|
154
156
|
|
|
155
157
|
<!-- 右边方块按钮 -->
|
|
156
|
-
<template v-if="rightSquareButton">
|
|
158
|
+
<template v-if="! disable && ! readonly && rightSquareButton">
|
|
157
159
|
<slot
|
|
158
160
|
name="square-button"
|
|
159
161
|
:size="currentSize"
|
|
@@ -285,7 +287,7 @@
|
|
|
285
287
|
size="xs"
|
|
286
288
|
title="修改"
|
|
287
289
|
@click="uploader.previewImage(fileItem)"
|
|
288
|
-
v-if="! noEdit"
|
|
290
|
+
v-if="! noEdit && ! disable && ! readonly"
|
|
289
291
|
>
|
|
290
292
|
<q-popup-edit
|
|
291
293
|
:model-value="fileItem.title"
|
|
@@ -318,7 +320,7 @@
|
|
|
318
320
|
size="xs"
|
|
319
321
|
title="删除"
|
|
320
322
|
@click="uploader.deleteFileItem(fileItem)"
|
|
321
|
-
v-if="! noDelete"
|
|
323
|
+
v-if="! noDelete && ! disable && ! readonly"
|
|
322
324
|
/>
|
|
323
325
|
</div>
|
|
324
326
|
</div>
|
|
@@ -383,6 +385,10 @@ export default {
|
|
|
383
385
|
type: Boolean,
|
|
384
386
|
default: true,
|
|
385
387
|
},
|
|
388
|
+
// 是否禁用
|
|
389
|
+
disable: Boolean,
|
|
390
|
+
// 是否只读
|
|
391
|
+
readonly: Boolean,
|
|
386
392
|
// 是否隐藏按钮
|
|
387
393
|
noButton: Boolean,
|
|
388
394
|
// 是否隐藏预览按钮
|
|
@@ -433,6 +439,8 @@ export default {
|
|
|
433
439
|
return props.drag
|
|
434
440
|
&& $n_isValidArray(query.value)
|
|
435
441
|
&& query.value.length > 1
|
|
442
|
+
&& ! props.readonly
|
|
443
|
+
&& ! props.disable
|
|
436
444
|
})
|
|
437
445
|
|
|
438
446
|
/**
|
package/package.json
CHANGED
package/sass/common.scss
CHANGED
package/utils/$power.js
CHANGED
|
@@ -9,6 +9,7 @@ import $n_toLower from 'lodash/toLower'
|
|
|
9
9
|
import $n_isNumber from 'lodash/isNumber'
|
|
10
10
|
import $n_cloneDeep from 'lodash/cloneDeep'
|
|
11
11
|
import $n_isFunction from 'lodash/isFunction'
|
|
12
|
+
import $n_pick from 'lodash/pick'
|
|
12
13
|
|
|
13
14
|
import $n_router from '@netang/utils/vue/router'
|
|
14
15
|
|
|
@@ -33,7 +34,7 @@ import $n_run from '@netang/utils/run'
|
|
|
33
34
|
import $n_http from '@netang/utils/http'
|
|
34
35
|
|
|
35
36
|
import { statePower } from '../store'
|
|
36
|
-
import { NRenderKey, NPowerKey, NFormKey, NTableKey } from './symbols'
|
|
37
|
+
import { NRenderKey, NPowerKey, NDialogKey, NFormKey, NTableKey } from './symbols'
|
|
37
38
|
|
|
38
39
|
import $n_getData from './getData'
|
|
39
40
|
import $n_toast from './toast'
|
|
@@ -87,11 +88,30 @@ function create(params) {
|
|
|
87
88
|
requestAfter: null,
|
|
88
89
|
}, params)
|
|
89
90
|
|
|
91
|
+
// 获取对话框渲染注入
|
|
92
|
+
const $dialog = inject(NDialogKey)
|
|
93
|
+
const hasDialog = !! $dialog
|
|
94
|
+
|
|
90
95
|
// 获取渲染注入
|
|
91
96
|
const $render = inject(NRenderKey)
|
|
97
|
+
const hasRender = !! $render
|
|
98
|
+
|
|
99
|
+
// 如果有对话框注入
|
|
100
|
+
if (hasDialog) {
|
|
101
|
+
const {
|
|
102
|
+
dialogProps,
|
|
103
|
+
} = $dialog
|
|
104
|
+
|
|
105
|
+
// 合并权限参数
|
|
106
|
+
Object.assign(o, $n_pick(dialogProps, [ 'path', 'query' ]))
|
|
107
|
+
|
|
108
|
+
// 合并权限参数
|
|
109
|
+
if ($n_has($dialog, 'props.powerProps') && $n_isValidObject($dialog.props.powerProps)) {
|
|
110
|
+
$n_merge(o, $dialog.props.powerProps)
|
|
111
|
+
}
|
|
112
|
+
}
|
|
92
113
|
|
|
93
114
|
// 如果有渲染注入
|
|
94
|
-
const hasRender = !! $render
|
|
95
115
|
if (hasRender) {
|
|
96
116
|
// 如果有权限传参, 则合并参数
|
|
97
117
|
const powerProps = $n_get($render, 'props.powerProps')
|
package/utils/$table.js
CHANGED
|
@@ -122,10 +122,12 @@ function create(params) {
|
|
|
122
122
|
rowDblClick: null,
|
|
123
123
|
}, params)
|
|
124
124
|
|
|
125
|
+
// 获取权限注入
|
|
126
|
+
const $power = $n_has(params, '$power') ? params.$power : inject(NPowerKey)
|
|
127
|
+
const hasPowr = !! $power
|
|
128
|
+
|
|
125
129
|
// 获取渲染注入
|
|
126
130
|
const $render = inject(NRenderKey)
|
|
127
|
-
|
|
128
|
-
// 如果有渲染注入
|
|
129
131
|
if (!! $render) {
|
|
130
132
|
// 如果有表格传参, 则合并参数
|
|
131
133
|
const tableProps = $n_get($render, 'props.tableProps')
|
|
@@ -134,10 +136,6 @@ function create(params) {
|
|
|
134
136
|
}
|
|
135
137
|
}
|
|
136
138
|
|
|
137
|
-
// 获取权限注入
|
|
138
|
-
const $power = $n_has(params, '$power') ? params.$power : inject(NPowerKey)
|
|
139
|
-
const hasPowr = !! $power
|
|
140
|
-
|
|
141
139
|
// 获取选择类型(默认 single)
|
|
142
140
|
if (! $n_has(o, 'selection') || ! $n_isValidString(o.selection)) {
|
|
143
141
|
if (hasPowr) {
|