@netang/quasar 0.1.52 → 0.1.54
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/field-date/index.vue +850 -850
- package/components/img/index.vue +0 -1
- package/components/mixed-table/index.vue +3 -0
- package/components/toolbar/index.vue +12 -5
- package/components/tree/index.vue +11 -15
- package/components/tree/virtual-scroll.vue +41 -0
- package/components/virtual-scroll/index.vue +136 -0
- package/package.json +1 -1
- package/components/toolbar/container.vue +0 -31
package/components/img/index.vue
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
<!-- 头部 -->
|
|
11
11
|
<n-toolbar
|
|
12
12
|
:dense="dense"
|
|
13
|
+
:show="showToolbar"
|
|
13
14
|
header
|
|
14
15
|
>
|
|
15
16
|
<!-- 插槽 -->
|
|
@@ -290,6 +291,8 @@ export default {
|
|
|
290
291
|
hideRightDrawer: Boolean,
|
|
291
292
|
// 右边侧滑菜单声明属性
|
|
292
293
|
rightDrawerProps: Object,
|
|
294
|
+
// 是否强制显示工具栏
|
|
295
|
+
showToolbar: Boolean,
|
|
293
296
|
},
|
|
294
297
|
|
|
295
298
|
/**
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
:
|
|
2
|
+
<component
|
|
3
|
+
:is="header ? QHeader : QFooter"
|
|
4
|
+
class="n-toolbar"
|
|
5
|
+
:dark="$q.dark.isActive"
|
|
6
|
+
bordered
|
|
4
7
|
v-if="show || toolbarPowerBtns.length"
|
|
5
8
|
>
|
|
6
9
|
<q-toolbar>
|
|
@@ -61,13 +64,15 @@
|
|
|
61
64
|
/>
|
|
62
65
|
|
|
63
66
|
</q-toolbar>
|
|
64
|
-
</
|
|
67
|
+
</component>
|
|
65
68
|
</template>
|
|
66
69
|
|
|
67
70
|
<script>
|
|
68
71
|
import { inject } from 'vue'
|
|
69
72
|
|
|
70
|
-
import
|
|
73
|
+
import QHeader from 'quasar/src/components/header/QHeader'
|
|
74
|
+
import QFooter from 'quasar/src/components/footer/QFooter'
|
|
75
|
+
|
|
71
76
|
import TableVisibleColumnsButton from '../private/table-visible-columns-button'
|
|
72
77
|
|
|
73
78
|
import { NPowerKey, NTableKey } from '../../utils/symbols'
|
|
@@ -83,7 +88,6 @@ export default {
|
|
|
83
88
|
* 容器
|
|
84
89
|
*/
|
|
85
90
|
components: {
|
|
86
|
-
Container,
|
|
87
91
|
TableVisibleColumnsButton,
|
|
88
92
|
},
|
|
89
93
|
|
|
@@ -117,6 +121,9 @@ export default {
|
|
|
117
121
|
...$power,
|
|
118
122
|
// 是否有表格
|
|
119
123
|
hasTable: !! $table,
|
|
124
|
+
|
|
125
|
+
QHeader,
|
|
126
|
+
QFooter,
|
|
120
127
|
}
|
|
121
128
|
},
|
|
122
129
|
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<component
|
|
3
|
+
:is="isNVirtualScroll ? NVirtualScroll : QVirtualScroll"
|
|
3
4
|
:class="classes"
|
|
4
5
|
:items="currentChildren"
|
|
5
|
-
:virtual-scroll-slice-ratio-before="virtualScrollSliceRatioBefore"
|
|
6
|
-
:virtual-scroll-slice-ratio-after="virtualScrollSliceRatioAfter"
|
|
7
6
|
:virtual-scroll-item-size="virtualScrollItemSize"
|
|
8
|
-
separator
|
|
9
7
|
v-bind="virtualScrollProps"
|
|
10
8
|
v-slot="{ item, index }"
|
|
11
9
|
>
|
|
@@ -104,7 +102,7 @@
|
|
|
104
102
|
/>
|
|
105
103
|
|
|
106
104
|
</div>
|
|
107
|
-
</
|
|
105
|
+
</component>
|
|
108
106
|
</template>
|
|
109
107
|
|
|
110
108
|
<script>
|
|
@@ -115,6 +113,9 @@ import {
|
|
|
115
113
|
|
|
116
114
|
import { stopAndPrevent } from 'quasar/src/utils/event'
|
|
117
115
|
|
|
116
|
+
import QVirtualScroll from 'quasar/src/components/virtual-scroll/QVirtualScroll'
|
|
117
|
+
import NVirtualScroll from '../virtual-scroll'
|
|
118
|
+
|
|
118
119
|
const tickStrategyOptions = [ 'none', 'strict', 'leaf', 'leaf-filtered' ]
|
|
119
120
|
|
|
120
121
|
import $n_has from 'lodash/has'
|
|
@@ -208,16 +209,6 @@ export default {
|
|
|
208
209
|
allowDrop: Function,
|
|
209
210
|
// 是否多选
|
|
210
211
|
multiple: Boolean,
|
|
211
|
-
// 可见区域中要在其之前渲染的行数的比率
|
|
212
|
-
virtualScrollSliceRatioBefore: {
|
|
213
|
-
type: [ Number, String ],
|
|
214
|
-
default: 1,
|
|
215
|
-
},
|
|
216
|
-
// 可见区域中要在其之后渲染的行数的比率
|
|
217
|
-
virtualScrollSliceRatioAfter: {
|
|
218
|
-
type: [ Number, String ],
|
|
219
|
-
default: 1,
|
|
220
|
-
},
|
|
221
212
|
// 以像素为单位的默认行大小
|
|
222
213
|
virtualScrollItemSize: {
|
|
223
214
|
type: [ Number, String ],
|
|
@@ -225,6 +216,8 @@ export default {
|
|
|
225
216
|
},
|
|
226
217
|
// 虚拟滚动声明
|
|
227
218
|
virtualScrollProps: Object,
|
|
219
|
+
// 是否为自定义虚拟滚动
|
|
220
|
+
isNVirtualScroll: Boolean,
|
|
228
221
|
|
|
229
222
|
// 箭头大小
|
|
230
223
|
arrowSize: {
|
|
@@ -1546,6 +1539,9 @@ export default {
|
|
|
1546
1539
|
onDragEnter,
|
|
1547
1540
|
onDragLeave,
|
|
1548
1541
|
onDragEnd,
|
|
1542
|
+
|
|
1543
|
+
NVirtualScroll,
|
|
1544
|
+
QVirtualScroll,
|
|
1549
1545
|
}
|
|
1550
1546
|
}
|
|
1551
1547
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- 如果为自定义虚拟滚动 -->
|
|
3
|
+
<virtual-scroll
|
|
4
|
+
v-bind="$attrs"
|
|
5
|
+
v-slot="props"
|
|
6
|
+
v-if="isNVirtualScroll"
|
|
7
|
+
>
|
|
8
|
+
<slot v-bind="props" />
|
|
9
|
+
</virtual-scroll>
|
|
10
|
+
|
|
11
|
+
<!-- 否则为 quasar 虚拟滚动 -->
|
|
12
|
+
<q-virtual-scroll
|
|
13
|
+
v-bind="$attrs"
|
|
14
|
+
v-slot="props"
|
|
15
|
+
v-else
|
|
16
|
+
>
|
|
17
|
+
<slot v-bind="props" />
|
|
18
|
+
</q-virtual-scroll>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
import VirtualScroll from '../virtual-scroll'
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 组件
|
|
28
|
+
*/
|
|
29
|
+
components: {
|
|
30
|
+
VirtualScroll,
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 声明属性
|
|
35
|
+
*/
|
|
36
|
+
props: {
|
|
37
|
+
// 是否为自定义虚拟滚动
|
|
38
|
+
isNVirtualScroll: Boolean,
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="n-virtual-scroll">
|
|
3
|
+
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import { ref, computed, watch, nextTick, getCurrentInstance, onBeforeUpdate, onMounted, onUnmounted } from 'vue'
|
|
9
|
+
|
|
10
|
+
import $n_has from 'lodash/has'
|
|
11
|
+
import $n_get from 'lodash/get'
|
|
12
|
+
import $n_isFunction from 'lodash/isFunction'
|
|
13
|
+
import $n_findIndex from 'lodash/findIndex'
|
|
14
|
+
|
|
15
|
+
import $n_isValidArray from '@netang/utils/isValidArray'
|
|
16
|
+
import $n_indexOf from '@netang/utils/indexOf'
|
|
17
|
+
import $n_on from '@netang/utils/on'
|
|
18
|
+
import $n_off from '@netang/utils/off'
|
|
19
|
+
|
|
20
|
+
export default {
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 标识
|
|
24
|
+
*/
|
|
25
|
+
name: 'NVirtualScroll',
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 声明属性
|
|
29
|
+
*/
|
|
30
|
+
props: {
|
|
31
|
+
virtualScrollSliceSize: {
|
|
32
|
+
type: [ Number, String ],
|
|
33
|
+
default: null
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
virtualScrollSliceRatioBefore: {
|
|
37
|
+
type: [ Number, String ],
|
|
38
|
+
default: 1
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
virtualScrollSliceRatioAfter: {
|
|
42
|
+
type: [ Number, String ],
|
|
43
|
+
default: 1
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
virtualScrollItemSize: {
|
|
47
|
+
type: [ Number, String ],
|
|
48
|
+
default: 24
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
virtualScrollStickySizeStart: {
|
|
52
|
+
type: [ Number, String ],
|
|
53
|
+
default: 0
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
virtualScrollStickySizeEnd: {
|
|
57
|
+
type: [ Number, String ],
|
|
58
|
+
default: 0
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
tableColspan: [ Number, String ],
|
|
62
|
+
virtualScrollHorizontal: Boolean,
|
|
63
|
+
onVirtualScroll: Function,
|
|
64
|
+
type: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: 'list',
|
|
67
|
+
validator: v => typeOptions.includes(v)
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
items: {
|
|
71
|
+
type: Array,
|
|
72
|
+
default: () => []
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
itemsFn: Function,
|
|
76
|
+
itemsSize: Number,
|
|
77
|
+
|
|
78
|
+
scrollTarget: {
|
|
79
|
+
default: void 0
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* 组合式
|
|
85
|
+
*/
|
|
86
|
+
setup (props, { slots, emit }) {
|
|
87
|
+
|
|
88
|
+
const { proxy } = getCurrentInstance()
|
|
89
|
+
const { $q } = proxy
|
|
90
|
+
|
|
91
|
+
// ==========【数据】============================================================================================
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
// ==========【方法】============================================================================================
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* 是否有默认插槽
|
|
98
|
+
*/
|
|
99
|
+
const hasSlots = computed(function () {
|
|
100
|
+
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
// ==========【生命周期】=========================================================================================
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* 更新 DOM 之前调用
|
|
107
|
+
*/
|
|
108
|
+
onBeforeUpdate(function () {
|
|
109
|
+
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* 实例被挂载后调用
|
|
114
|
+
*/
|
|
115
|
+
onMounted(function() {
|
|
116
|
+
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* 实例被卸载后调用
|
|
121
|
+
*/
|
|
122
|
+
onUnmounted(function () {
|
|
123
|
+
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
return {
|
|
127
|
+
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
</script>
|
|
132
|
+
|
|
133
|
+
<style lang="scss">
|
|
134
|
+
@import "@/assets/sass/variables.scss";
|
|
135
|
+
|
|
136
|
+
</style>
|
package/package.json
CHANGED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<q-header
|
|
3
|
-
class="n-toolbar"
|
|
4
|
-
:dark="$q.dark.isActive"
|
|
5
|
-
bordered
|
|
6
|
-
v-if="header"
|
|
7
|
-
>
|
|
8
|
-
<slot />
|
|
9
|
-
</q-header>
|
|
10
|
-
|
|
11
|
-
<q-footer
|
|
12
|
-
class="n-toolbar"
|
|
13
|
-
:dark="$q.dark.isActive"
|
|
14
|
-
bordered
|
|
15
|
-
v-else
|
|
16
|
-
>
|
|
17
|
-
<slot />
|
|
18
|
-
</q-footer>
|
|
19
|
-
</template>
|
|
20
|
-
|
|
21
|
-
<script>
|
|
22
|
-
export default {
|
|
23
|
-
/**
|
|
24
|
-
* 声明属性
|
|
25
|
-
*/
|
|
26
|
-
props: {
|
|
27
|
-
// 是否头部
|
|
28
|
-
header: Boolean,
|
|
29
|
-
},
|
|
30
|
-
}
|
|
31
|
-
</script>
|