@netang/quasar 0.0.21 → 0.0.23
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 +1 -3
- package/components/drawer/index.vue +54 -21
- package/components/empty/index.vue +23 -0
- package/components/field-date/index.vue +2 -21
- package/components/field-table/index.vue +623 -214
- package/components/field-tree/index.vue +2 -30
- package/components/power-page/index.vue +47 -0
- package/components/private/table-visible-columns-button/index.vue +105 -0
- package/components/search/index.vue +95 -93
- package/components/table/index.vue +44 -100
- package/components/table-column-fixed/index.vue +20 -10
- package/components/table-pagination/index.vue +114 -4
- package/components/table-summary/index.vue +14 -2
- package/components/toolbar/index.vue +44 -304
- package/components/uploader/index.vue +6 -8
- package/components/uploader-query/index.vue +1 -3
- package/package.json +1 -1
- package/store/index.js +14 -0
- package/utils/$form.js +52 -0
- package/utils/{$role.js → $power.js} +323 -106
- package/utils/$table.js +353 -244
- package/utils/$tree.js +57 -33
- package/utils/http.js +5 -5
- package/utils/symbols.js +3 -0
- package/components/layout/index.vue +0 -126
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
class="n-dialog-proxy"
|
|
4
4
|
ref="dialogRef"
|
|
5
5
|
v-model="currentModelValue"
|
|
6
|
-
v-bind="
|
|
6
|
+
v-bind="$attrs"
|
|
7
7
|
@hide="onDialogHide"
|
|
8
8
|
>
|
|
9
9
|
<q-card class="flex column" :style="customStyle">
|
|
@@ -73,8 +73,6 @@ export default {
|
|
|
73
73
|
type: Boolean,
|
|
74
74
|
default: true,
|
|
75
75
|
},
|
|
76
|
-
// 对话框传参
|
|
77
|
-
dialogProps: Object,
|
|
78
76
|
// 组件标识
|
|
79
77
|
name: String,
|
|
80
78
|
// 路由组件路径
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<q-drawer
|
|
3
|
-
v-model="
|
|
3
|
+
v-model="currentModelValue"
|
|
4
4
|
:side="side"
|
|
5
5
|
:breakpoint="breakpoint"
|
|
6
6
|
:width="currentWidth"
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
</template>
|
|
21
21
|
|
|
22
22
|
<script>
|
|
23
|
-
import { ref, inject, nextTick } from 'vue'
|
|
23
|
+
import { ref, inject, nextTick, watch } from 'vue'
|
|
24
24
|
import { useQuasar } from 'quasar'
|
|
25
25
|
import { useRoute } from 'vue-router'
|
|
26
26
|
|
|
27
27
|
import { layoutKey, emptyRenderFn } from 'quasar/src/utils/private/symbols.js'
|
|
28
28
|
|
|
29
|
-
import {
|
|
29
|
+
import { NPowerKey } from '../../utils/symbols'
|
|
30
30
|
|
|
31
31
|
export default {
|
|
32
32
|
|
|
@@ -39,11 +39,15 @@ export default {
|
|
|
39
39
|
* 声明属性
|
|
40
40
|
*/
|
|
41
41
|
props: {
|
|
42
|
+
// 值
|
|
43
|
+
modelValue: Boolean,
|
|
44
|
+
// 位置
|
|
42
45
|
side: {
|
|
43
46
|
type: String,
|
|
44
47
|
default: 'left',
|
|
45
48
|
validator: v => [ 'left', 'right' ].includes(v)
|
|
46
49
|
},
|
|
50
|
+
// 宽度
|
|
47
51
|
width: {
|
|
48
52
|
type: Number,
|
|
49
53
|
default: 300
|
|
@@ -55,8 +59,6 @@ export default {
|
|
|
55
59
|
|
|
56
60
|
// 【自定义属性】
|
|
57
61
|
// --------------------------------------------------
|
|
58
|
-
// 是否显示
|
|
59
|
-
show: Boolean,
|
|
60
62
|
// 手机端宽度(px / %)
|
|
61
63
|
mobileWidth: {
|
|
62
64
|
type: [String, Number],
|
|
@@ -82,34 +84,49 @@ export default {
|
|
|
82
84
|
cache: [Boolean, String],
|
|
83
85
|
},
|
|
84
86
|
|
|
87
|
+
/**
|
|
88
|
+
* 声明事件
|
|
89
|
+
*/
|
|
90
|
+
emits: [
|
|
91
|
+
'update:modelValue',
|
|
92
|
+
],
|
|
93
|
+
|
|
85
94
|
/**
|
|
86
95
|
* 组合式
|
|
87
96
|
*/
|
|
88
|
-
setup(props) {
|
|
97
|
+
setup(props, { emit }) {
|
|
89
98
|
|
|
90
|
-
//
|
|
99
|
+
// ==========【数据】============================================================================================
|
|
91
100
|
|
|
92
101
|
// 获取 quasar 注入
|
|
93
|
-
const $
|
|
94
|
-
if ($
|
|
102
|
+
const $quasarLayout = inject(layoutKey, emptyRenderFn)
|
|
103
|
+
if ($quasarLayout === emptyRenderFn) {
|
|
95
104
|
console.error('NDrawer needs to be child of QLayout')
|
|
96
105
|
return emptyRenderFn
|
|
97
106
|
}
|
|
98
107
|
|
|
99
|
-
// 获取布局注入数据
|
|
100
|
-
const $nLayout = inject(NLayoutKey)
|
|
101
|
-
|
|
102
|
-
// ==========【数据】============================================================================================
|
|
103
|
-
|
|
104
108
|
// quasar 对象
|
|
105
109
|
const $q = useQuasar()
|
|
106
110
|
|
|
107
111
|
// 获取当前路由
|
|
108
112
|
const $route = useRoute()
|
|
109
113
|
|
|
114
|
+
// 获取权限注入数据
|
|
115
|
+
const $power = inject(NPowerKey)
|
|
116
|
+
|
|
110
117
|
// 是否显示
|
|
111
|
-
|
|
112
|
-
|
|
118
|
+
let currentModelValue
|
|
119
|
+
if ($power) {
|
|
120
|
+
currentModelValue = $power[`${props.side}Drawer`].modelValue
|
|
121
|
+
if ($q.screen.width < props.breakpoint) {
|
|
122
|
+
currentModelValue.value = false
|
|
123
|
+
emit('update:modelValue', false)
|
|
124
|
+
} else {
|
|
125
|
+
currentModelValue.value = props.modelValue
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
currentModelValue = ref(props.modelValue)
|
|
129
|
+
}
|
|
113
130
|
|
|
114
131
|
// 缓存名
|
|
115
132
|
let cacheName = ''
|
|
@@ -156,11 +173,27 @@ export default {
|
|
|
156
173
|
|
|
157
174
|
// 下次 DOM 更新
|
|
158
175
|
nextTick(function() {
|
|
159
|
-
if (
|
|
160
|
-
|
|
176
|
+
if (currentModelValue.value && $quasarLayout.totalWidth.value < props.breakpoint) {
|
|
177
|
+
currentModelValue.value = false
|
|
161
178
|
}
|
|
162
179
|
})
|
|
163
180
|
|
|
181
|
+
// ==========【监听数据】==========================================================================================
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* 监听声明值
|
|
185
|
+
*/
|
|
186
|
+
watch(()=>props.modelValue, function (val) {
|
|
187
|
+
currentModelValue.value = val
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* 监听当前值
|
|
192
|
+
*/
|
|
193
|
+
watch(currentModelValue, function (val) {
|
|
194
|
+
emit('update:modelValue', val)
|
|
195
|
+
})
|
|
196
|
+
|
|
164
197
|
// ==========【方法】=============================================================================================
|
|
165
198
|
|
|
166
199
|
/**
|
|
@@ -190,7 +223,7 @@ export default {
|
|
|
190
223
|
|
|
191
224
|
// if (
|
|
192
225
|
// // 如果显示
|
|
193
|
-
//
|
|
226
|
+
// currentModelValue.value
|
|
194
227
|
// // 如果开启折叠
|
|
195
228
|
// && props.dragCollapse
|
|
196
229
|
// // 如果有最小宽度
|
|
@@ -200,7 +233,7 @@ export default {
|
|
|
200
233
|
//
|
|
201
234
|
// // 如果 拖拽宽度 < 折叠宽度
|
|
202
235
|
// if (dragWidth < collapseWidth) {
|
|
203
|
-
//
|
|
236
|
+
// currentModelValue.value = false
|
|
204
237
|
// }
|
|
205
238
|
// }
|
|
206
239
|
|
|
@@ -218,7 +251,7 @@ export default {
|
|
|
218
251
|
|
|
219
252
|
return {
|
|
220
253
|
// 是否显示
|
|
221
|
-
|
|
254
|
+
currentModelValue,
|
|
222
255
|
// 当前宽度
|
|
223
256
|
currentWidth,
|
|
224
257
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="q-pa-lg flex flex-center absolute-full">
|
|
3
|
+
{{emptyDescription || '发生未知错误'}}
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
export default {
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 标识
|
|
12
|
+
*/
|
|
13
|
+
name: 'NEmpty',
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 声明属性
|
|
17
|
+
*/
|
|
18
|
+
props: {
|
|
19
|
+
// 空状态描述
|
|
20
|
+
emptyDescription: String,
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
</script>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<q-field
|
|
3
|
-
:class="fieldFocused ? 'q-field--float q-field--focused q-field--highlighted' : ''"
|
|
4
3
|
:model-value="modelValue"
|
|
5
4
|
:readonly="readonly"
|
|
6
5
|
@clear="onClear"
|
|
@@ -30,8 +29,9 @@
|
|
|
30
29
|
|
|
31
30
|
<q-popup-proxy
|
|
32
31
|
ref="popupRef"
|
|
32
|
+
no-refocus
|
|
33
|
+
no-focus
|
|
33
34
|
@before-show="onPopupBeforeShow"
|
|
34
|
-
@before-hide="onPopupBeforeHide"
|
|
35
35
|
@hide="onPopupHide"
|
|
36
36
|
v-if="! readonly"
|
|
37
37
|
>
|
|
@@ -273,9 +273,6 @@ export default {
|
|
|
273
273
|
|
|
274
274
|
// ==========【数据】============================================================================================
|
|
275
275
|
|
|
276
|
-
// 字段组件获取焦点
|
|
277
|
-
const fieldFocused = ref(false)
|
|
278
|
-
|
|
279
276
|
// 弹出层节点
|
|
280
277
|
const popupRef = ref(null)
|
|
281
278
|
|
|
@@ -705,9 +702,6 @@ export default {
|
|
|
705
702
|
*/
|
|
706
703
|
function onPopupBeforeShow() {
|
|
707
704
|
|
|
708
|
-
// 字段组件获取焦点
|
|
709
|
-
fieldFocused.value = true
|
|
710
|
-
|
|
711
705
|
// 如果为选择
|
|
712
706
|
if (isSelect.value) {
|
|
713
707
|
// 下次 DOM 更新
|
|
@@ -728,15 +722,6 @@ export default {
|
|
|
728
722
|
}
|
|
729
723
|
}
|
|
730
724
|
|
|
731
|
-
/**
|
|
732
|
-
* 弹出层隐藏前回调
|
|
733
|
-
*/
|
|
734
|
-
function onPopupBeforeHide() {
|
|
735
|
-
|
|
736
|
-
// 字段组件失去焦点
|
|
737
|
-
fieldFocused.value = false
|
|
738
|
-
}
|
|
739
|
-
|
|
740
725
|
/**
|
|
741
726
|
* 弹出层隐藏后回调
|
|
742
727
|
*/
|
|
@@ -772,8 +757,6 @@ export default {
|
|
|
772
757
|
// 选择数据列表
|
|
773
758
|
selectLists,
|
|
774
759
|
|
|
775
|
-
// 字段组件获取焦点
|
|
776
|
-
fieldFocused,
|
|
777
760
|
// 弹出层节点
|
|
778
761
|
popupRef,
|
|
779
762
|
// 滚动层节点
|
|
@@ -803,8 +786,6 @@ export default {
|
|
|
803
786
|
|
|
804
787
|
// 弹出层显示前回调
|
|
805
788
|
onPopupBeforeShow,
|
|
806
|
-
// 弹出层隐藏前回调
|
|
807
|
-
onPopupBeforeHide,
|
|
808
789
|
// 弹出层隐藏后回调
|
|
809
790
|
onPopupHide,
|
|
810
791
|
// 清空
|