quasar 2.9.1 → 2.10.0
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/dist/api/QBreadcrumbsEl.json +0 -14
- package/dist/api/QBtnDropdown.json +36 -0
- package/dist/api/QPagination.json +134 -102
- package/dist/api/QTabs.json +1 -1
- package/dist/api/QTree.json +6 -0
- package/dist/api/TouchPan.json +0 -4
- package/dist/icon-set/bootstrap-icons.umd.prod.js +1 -1
- package/dist/icon-set/eva-icons.umd.prod.js +1 -1
- package/dist/icon-set/fontawesome-v5-pro.umd.prod.js +1 -1
- package/dist/icon-set/fontawesome-v5.umd.prod.js +1 -1
- package/dist/icon-set/fontawesome-v6-pro.umd.prod.js +1 -1
- package/dist/icon-set/fontawesome-v6.umd.prod.js +1 -1
- package/dist/icon-set/ionicons-v4.umd.prod.js +1 -1
- package/dist/icon-set/line-awesome.umd.prod.js +1 -1
- package/dist/icon-set/material-icons-outlined.umd.prod.js +1 -1
- package/dist/icon-set/material-icons-round.umd.prod.js +1 -1
- package/dist/icon-set/material-icons-sharp.umd.prod.js +1 -1
- package/dist/icon-set/material-icons.umd.prod.js +1 -1
- package/dist/icon-set/material-symbols-outlined.umd.prod.js +1 -1
- package/dist/icon-set/material-symbols-rounded.umd.prod.js +1 -1
- package/dist/icon-set/material-symbols-sharp.umd.prod.js +1 -1
- package/dist/icon-set/mdi-v3.umd.prod.js +1 -1
- package/dist/icon-set/mdi-v4.umd.prod.js +1 -1
- package/dist/icon-set/mdi-v5.umd.prod.js +1 -1
- package/dist/icon-set/mdi-v6.umd.prod.js +1 -1
- package/dist/icon-set/svg-bootstrap-icons.umd.prod.js +1 -1
- package/dist/icon-set/svg-eva-icons.umd.prod.js +1 -1
- package/dist/icon-set/svg-fontawesome-v5.umd.prod.js +1 -1
- package/dist/icon-set/svg-fontawesome-v6.umd.prod.js +1 -1
- package/dist/icon-set/svg-ionicons-v4.umd.prod.js +1 -1
- package/dist/icon-set/svg-ionicons-v5.umd.prod.js +1 -1
- package/dist/icon-set/svg-ionicons-v6.umd.prod.js +1 -1
- package/dist/icon-set/svg-line-awesome.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-icons-outlined.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-icons-round.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-icons-sharp.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-icons.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-symbols-outlined.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-symbols-rounded.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-symbols-sharp.umd.prod.js +1 -1
- package/dist/icon-set/svg-mdi-v6.umd.prod.js +1 -1
- package/dist/icon-set/svg-themify.umd.prod.js +1 -1
- package/dist/icon-set/themify.umd.prod.js +1 -1
- package/dist/lang/ar-TN.umd.prod.js +1 -1
- package/dist/lang/ar.umd.prod.js +1 -1
- package/dist/lang/az-Latn.umd.prod.js +1 -1
- package/dist/lang/bg.umd.prod.js +1 -1
- package/dist/lang/bn.umd.prod.js +1 -1
- package/dist/lang/ca.umd.prod.js +1 -1
- package/dist/lang/cs.umd.prod.js +1 -1
- package/dist/lang/da.umd.prod.js +1 -1
- package/dist/lang/de.umd.prod.js +1 -1
- package/dist/lang/el.umd.prod.js +1 -1
- package/dist/lang/en-GB.umd.prod.js +1 -1
- package/dist/lang/en-US.umd.prod.js +1 -1
- package/dist/lang/eo.umd.prod.js +1 -1
- package/dist/lang/es.umd.prod.js +1 -1
- package/dist/lang/et.umd.prod.js +1 -1
- package/dist/lang/eu.umd.prod.js +1 -1
- package/dist/lang/fa-IR.umd.prod.js +1 -1
- package/dist/lang/fa.umd.prod.js +1 -1
- package/dist/lang/fi.umd.prod.js +1 -1
- package/dist/lang/fr.umd.prod.js +1 -1
- package/dist/lang/gn.umd.prod.js +1 -1
- package/dist/lang/he.umd.prod.js +1 -1
- package/dist/lang/hr.umd.prod.js +1 -1
- package/dist/lang/hu.umd.prod.js +1 -1
- package/dist/lang/id.umd.prod.js +1 -1
- package/dist/lang/is.umd.prod.js +1 -1
- package/dist/lang/it.umd.prod.js +1 -1
- package/dist/lang/ja.umd.prod.js +1 -1
- package/dist/lang/km.umd.prod.js +1 -1
- package/dist/lang/ko-KR.umd.prod.js +1 -1
- package/dist/lang/kur-CKB.umd.prod.js +1 -1
- package/dist/lang/kz.umd.prod.js +1 -1
- package/dist/lang/lt.umd.prod.js +1 -1
- package/dist/lang/lu.umd.prod.js +1 -1
- package/dist/lang/lv.umd.prod.js +1 -1
- package/dist/lang/ml.umd.prod.js +1 -1
- package/dist/lang/mm.umd.prod.js +1 -1
- package/dist/lang/ms.umd.prod.js +1 -1
- package/dist/lang/my.umd.prod.js +1 -1
- package/dist/lang/nb-NO.umd.prod.js +1 -1
- package/dist/lang/nl.umd.prod.js +1 -1
- package/dist/lang/pl.umd.prod.js +1 -1
- package/dist/lang/pt-BR.umd.prod.js +1 -1
- package/dist/lang/pt.umd.prod.js +1 -1
- package/dist/lang/ro.umd.prod.js +1 -1
- package/dist/lang/ru.umd.prod.js +1 -1
- package/dist/lang/sk.umd.prod.js +1 -1
- package/dist/lang/sl.umd.prod.js +1 -1
- package/dist/lang/sm.umd.prod.js +1 -1
- package/dist/lang/sr-CYR.umd.prod.js +1 -1
- package/dist/lang/sr.umd.prod.js +1 -1
- package/dist/lang/sv.umd.prod.js +1 -1
- package/dist/lang/ta.umd.prod.js +1 -1
- package/dist/lang/th.umd.prod.js +1 -1
- package/dist/lang/tr.umd.prod.js +1 -1
- package/dist/lang/ug.umd.prod.js +1 -1
- package/dist/lang/uk.umd.prod.js +1 -1
- package/dist/lang/uz-Cyrl.umd.prod.js +1 -1
- package/dist/lang/uz-Latn.umd.prod.js +1 -1
- package/dist/lang/vi.umd.prod.js +1 -1
- package/dist/lang/zh-CN.umd.prod.js +1 -1
- package/dist/lang/zh-TW.umd.prod.js +1 -1
- package/dist/quasar.cjs.prod.js +2 -2
- package/dist/quasar.css +10 -0
- package/dist/quasar.esm.js +554 -349
- package/dist/quasar.esm.prod.js +2 -2
- package/dist/quasar.prod.css +1 -1
- package/dist/quasar.rtl.css +26 -0
- package/dist/quasar.rtl.prod.css +1 -1
- package/dist/quasar.sass +11 -1
- package/dist/quasar.umd.js +554 -349
- package/dist/quasar.umd.prod.js +2 -2
- package/dist/transforms/auto-import.json +7 -3
- package/dist/transforms/import-map.json +2 -0
- package/dist/types/index.d.ts +70 -51
- package/dist/vetur/quasar-attributes.json +65 -49
- package/dist/vetur/quasar-tags.json +17 -13
- package/dist/web-types/web-types.json +131 -97
- package/package.json +1 -1
- package/src/components/badge/QBadge.js +1 -1
- package/src/components/badge/__tests__/QBadge.spec.js +98 -23
- package/src/components/breadcrumbs/QBreadcrumbsEl.json +0 -4
- package/src/components/breadcrumbs/__tests__/BasicBreadcrumbs.vue +7 -0
- package/src/components/breadcrumbs/__tests__/BreadcrumbWithSeparatorSlot.vue +11 -0
- package/src/components/breadcrumbs/__tests__/QBreadcrumbs.spec.js +112 -0
- package/src/components/breadcrumbs/__tests__/QBreadcrumbsEl.spec.js +87 -0
- package/src/components/btn/use-btn.js +24 -14
- package/src/components/btn-dropdown/QBtnDropdown.js +39 -16
- package/src/components/btn-dropdown/QBtnDropdown.json +1 -1
- package/src/components/btn-toggle/QBtnToggle.js +14 -14
- package/src/components/checkbox/use-checkbox.js +1 -1
- package/src/components/chip/QChip.js +14 -11
- package/src/components/dialog/QDialog.js +2 -1
- package/src/components/dialog-bottom-sheet/BottomSheet.js +6 -2
- package/src/components/drawer/QDrawer.js +5 -3
- package/src/components/footer/QFooter.js +5 -3
- package/src/components/header/QHeader.js +5 -3
- package/src/components/input/use-mask.js +1 -1
- package/src/components/item/QItem.js +1 -0
- package/src/components/item/QList.js +1 -1
- package/src/components/option-group/QOptionGroup.js +1 -1
- package/src/components/page/QPage.js +11 -4
- package/src/components/page/QPageContainer.js +5 -3
- package/src/components/page-sticky/use-page-sticky.js +5 -3
- package/src/components/pagination/QPagination.js +265 -188
- package/src/components/pagination/QPagination.json +82 -65
- package/src/components/pagination/QPagination.sass +14 -0
- package/src/components/pull-to-refresh/QPullToRefresh.js +1 -4
- package/src/components/resize-observer/QResizeObserver.js +14 -10
- package/src/components/stepper/QStep.js +7 -5
- package/src/components/tab-panels/QTabPanel.js +1 -1
- package/src/components/tabs/QTabs.js +2 -9
- package/src/components/tabs/QTabs.json +1 -1
- package/src/components/tabs/use-tab.js +5 -3
- package/src/components/timeline/QTimelineEntry.js +5 -3
- package/src/components/toolbar/QToolbar.js +1 -1
- package/src/components/tooltip/QTooltip.js +1 -1
- package/src/components/tree/QTree.js +33 -20
- package/src/components/tree/QTree.json +7 -0
- package/src/components/uploader/QUploaderAddTrigger.js +7 -3
- package/src/composables/private/use-file.js +10 -1
- package/src/directives/TouchHold.js +10 -3
- package/src/directives/TouchPan.js +21 -8
- package/src/directives/TouchPan.json +0 -5
- package/src/directives/TouchRepeat.js +20 -6
- package/src/directives/TouchSwipe.js +10 -3
- package/src/utils/morph.js +7 -3
- package/src/utils/private/symbols.js +2 -0
|
@@ -2,7 +2,7 @@ import { h, computed, inject, getCurrentInstance } from 'vue'
|
|
|
2
2
|
|
|
3
3
|
import { createComponent } from '../../utils/private/create.js'
|
|
4
4
|
import { hSlot } from '../../utils/private/render.js'
|
|
5
|
-
import { pageContainerKey, layoutKey } from '../../utils/private/symbols.js'
|
|
5
|
+
import { pageContainerKey, layoutKey, emptyRenderFn } from '../../utils/private/symbols.js'
|
|
6
6
|
|
|
7
7
|
export default createComponent({
|
|
8
8
|
name: 'QPage',
|
|
@@ -15,10 +15,17 @@ export default createComponent({
|
|
|
15
15
|
setup (props, { slots }) {
|
|
16
16
|
const { proxy: { $q } } = getCurrentInstance()
|
|
17
17
|
|
|
18
|
-
const $layout = inject(layoutKey)
|
|
19
|
-
|
|
18
|
+
const $layout = inject(layoutKey, emptyRenderFn)
|
|
19
|
+
if ($layout === emptyRenderFn) {
|
|
20
|
+
console.error('QPage needs to be a deep child of QLayout')
|
|
21
|
+
return emptyRenderFn
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const $pageContainer = inject(pageContainerKey, emptyRenderFn)
|
|
25
|
+
if ($pageContainer === emptyRenderFn) {
|
|
20
26
|
console.error('QPage needs to be child of QPageContainer')
|
|
21
|
-
|
|
27
|
+
return emptyRenderFn
|
|
28
|
+
}
|
|
22
29
|
|
|
23
30
|
const style = computed(() => {
|
|
24
31
|
const offset
|
|
@@ -2,7 +2,7 @@ import { h, computed, provide, inject, getCurrentInstance } from 'vue'
|
|
|
2
2
|
|
|
3
3
|
import { createComponent } from '../../utils/private/create.js'
|
|
4
4
|
import { hSlot } from '../../utils/private/render.js'
|
|
5
|
-
import { pageContainerKey, layoutKey } from '../../utils/private/symbols.js'
|
|
5
|
+
import { pageContainerKey, layoutKey, emptyRenderFn } from '../../utils/private/symbols.js'
|
|
6
6
|
|
|
7
7
|
export default createComponent({
|
|
8
8
|
name: 'QPageContainer',
|
|
@@ -10,9 +10,11 @@ export default createComponent({
|
|
|
10
10
|
setup (_, { slots }) {
|
|
11
11
|
const { proxy: { $q } } = getCurrentInstance()
|
|
12
12
|
|
|
13
|
-
const $layout = inject(layoutKey,
|
|
13
|
+
const $layout = inject(layoutKey, emptyRenderFn)
|
|
14
|
+
if ($layout === emptyRenderFn) {
|
|
14
15
|
console.error('QPageContainer needs to be child of QLayout')
|
|
15
|
-
|
|
16
|
+
return emptyRenderFn
|
|
17
|
+
}
|
|
16
18
|
|
|
17
19
|
provide(pageContainerKey, true)
|
|
18
20
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h, computed, inject, getCurrentInstance } from 'vue'
|
|
2
2
|
|
|
3
3
|
import { hSlot } from '../../utils/private/render.js'
|
|
4
|
-
import { layoutKey } from '../../utils/private/symbols.js'
|
|
4
|
+
import { layoutKey, emptyRenderFn } from '../../utils/private/symbols.js'
|
|
5
5
|
|
|
6
6
|
export const usePageStickyProps = {
|
|
7
7
|
position: {
|
|
@@ -23,9 +23,11 @@ export const usePageStickyProps = {
|
|
|
23
23
|
export default function () {
|
|
24
24
|
const { props, proxy: { $q } } = getCurrentInstance()
|
|
25
25
|
|
|
26
|
-
const $layout = inject(layoutKey,
|
|
26
|
+
const $layout = inject(layoutKey, emptyRenderFn)
|
|
27
|
+
if ($layout === emptyRenderFn) {
|
|
27
28
|
console.error('QPageSticky needs to be child of QLayout')
|
|
28
|
-
|
|
29
|
+
return emptyRenderFn
|
|
30
|
+
}
|
|
29
31
|
|
|
30
32
|
const attach = computed(() => {
|
|
31
33
|
const pos = props.position
|
|
@@ -4,11 +4,18 @@ import QBtn from '../btn/QBtn.js'
|
|
|
4
4
|
import QInput from '../input/QInput.js'
|
|
5
5
|
|
|
6
6
|
import useDark, { useDarkProps } from '../../composables/private/use-dark.js'
|
|
7
|
+
import { btnDesignOptions, btnPadding, getBtnDesign } from '../btn/use-btn.js'
|
|
7
8
|
|
|
8
9
|
import { createComponent } from '../../utils/private/create.js'
|
|
9
10
|
import { between } from '../../utils/format.js'
|
|
10
11
|
import { isKeyCode } from '../../utils/private/key-composition.js'
|
|
11
12
|
|
|
13
|
+
function getBool (val, otherwise) {
|
|
14
|
+
return [ true, false ].includes(val)
|
|
15
|
+
? val
|
|
16
|
+
: otherwise
|
|
17
|
+
}
|
|
18
|
+
|
|
12
19
|
export default createComponent({
|
|
13
20
|
name: 'QPagination',
|
|
14
21
|
|
|
@@ -20,22 +27,20 @@ export default createComponent({
|
|
|
20
27
|
required: true
|
|
21
28
|
},
|
|
22
29
|
min: {
|
|
23
|
-
type: Number,
|
|
30
|
+
type: [ Number, String ],
|
|
24
31
|
default: 1
|
|
25
32
|
},
|
|
26
33
|
max: {
|
|
27
|
-
type: Number,
|
|
34
|
+
type: [ Number, String ],
|
|
28
35
|
required: true
|
|
29
36
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
maxPages: {
|
|
38
|
+
type: [ Number, String ],
|
|
39
|
+
default: 0,
|
|
40
|
+
validator: v => (
|
|
41
|
+
(typeof v === 'string' ? parseInt(v, 10) : v) >= 0
|
|
42
|
+
)
|
|
34
43
|
},
|
|
35
|
-
textColor: String,
|
|
36
|
-
|
|
37
|
-
activeColor: String,
|
|
38
|
-
activeTextColor: String,
|
|
39
44
|
|
|
40
45
|
inputStyle: [ Array, String, Object ],
|
|
41
46
|
inputClass: [ Array, String, Object ],
|
|
@@ -69,11 +74,6 @@ export default createComponent({
|
|
|
69
74
|
type: Boolean,
|
|
70
75
|
default: null
|
|
71
76
|
},
|
|
72
|
-
maxPages: {
|
|
73
|
-
type: Number,
|
|
74
|
-
default: 0,
|
|
75
|
-
validator: v => v >= 0
|
|
76
|
-
},
|
|
77
77
|
|
|
78
78
|
ripple: {
|
|
79
79
|
type: [ Boolean, Object ],
|
|
@@ -89,7 +89,21 @@ export default createComponent({
|
|
|
89
89
|
push: Boolean,
|
|
90
90
|
glossy: Boolean,
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
color: {
|
|
93
|
+
type: String,
|
|
94
|
+
default: 'primary'
|
|
95
|
+
},
|
|
96
|
+
textColor: String,
|
|
97
|
+
|
|
98
|
+
activeDesign: {
|
|
99
|
+
type: String,
|
|
100
|
+
default: '',
|
|
101
|
+
values: v => v === '' || btnDesignOptions.includes(v)
|
|
102
|
+
},
|
|
103
|
+
activeColor: String,
|
|
104
|
+
activeTextColor: String,
|
|
105
|
+
|
|
106
|
+
gutter: String,
|
|
93
107
|
padding: {
|
|
94
108
|
type: String,
|
|
95
109
|
default: '3px 2px'
|
|
@@ -104,6 +118,16 @@ export default createComponent({
|
|
|
104
118
|
|
|
105
119
|
const isDark = useDark(props, $q)
|
|
106
120
|
|
|
121
|
+
const minProp = computed(() => parseInt(props.min, 10))
|
|
122
|
+
const maxProp = computed(() => parseInt(props.max, 10))
|
|
123
|
+
const maxPagesProp = computed(() => parseInt(props.maxPages, 10))
|
|
124
|
+
|
|
125
|
+
const inputPlaceholder = computed(() => model.value + ' / ' + maxProp.value)
|
|
126
|
+
const boundaryLinksProp = computed(() => getBool(props.boundaryLinks, props.input))
|
|
127
|
+
const boundaryNumbersProp = computed(() => getBool(props.boundaryNumbers, !props.input))
|
|
128
|
+
const directionLinksProp = computed(() => getBool(props.directionLinks, props.input))
|
|
129
|
+
const ellipsesProp = computed(() => getBool(props.ellipses, !props.input))
|
|
130
|
+
|
|
107
131
|
const newPage = ref(null)
|
|
108
132
|
const model = computed({
|
|
109
133
|
get: () => props.modelValue,
|
|
@@ -112,32 +136,33 @@ export default createComponent({
|
|
|
112
136
|
if (props.disable || isNaN(val)) {
|
|
113
137
|
return
|
|
114
138
|
}
|
|
115
|
-
const value = between(val,
|
|
139
|
+
const value = between(val, minProp.value, maxProp.value)
|
|
116
140
|
if (props.modelValue !== value) {
|
|
117
141
|
emit('update:modelValue', value)
|
|
118
142
|
}
|
|
119
143
|
}
|
|
120
144
|
})
|
|
121
145
|
|
|
122
|
-
watch(() =>
|
|
146
|
+
watch(() => `${ minProp.value }|${ maxProp.value }`, () => {
|
|
123
147
|
model.value = props.modelValue
|
|
124
148
|
})
|
|
125
149
|
|
|
126
|
-
function getBool (val, otherwise) {
|
|
127
|
-
return [ true, false ].includes(val)
|
|
128
|
-
? val
|
|
129
|
-
: otherwise
|
|
130
|
-
}
|
|
131
|
-
|
|
132
150
|
const classes = computed(() =>
|
|
133
151
|
'q-pagination row no-wrap items-center'
|
|
134
152
|
+ (props.disable === true ? ' disabled' : '')
|
|
135
153
|
)
|
|
136
|
-
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
154
|
+
|
|
155
|
+
const gutterProp = computed(() => (
|
|
156
|
+
props.gutter in btnPadding
|
|
157
|
+
? `${ btnPadding[ props.gutter ] }px`
|
|
158
|
+
: props.gutter || null
|
|
159
|
+
))
|
|
160
|
+
const gutterStyle = computed(() => (
|
|
161
|
+
gutterProp.value !== null
|
|
162
|
+
? `--q-pagination-gutter-parent:-${ gutterProp.value };--q-pagination-gutter-child:${ gutterProp.value }`
|
|
163
|
+
: null
|
|
164
|
+
))
|
|
165
|
+
|
|
141
166
|
const icons = computed(() => {
|
|
142
167
|
const ico = [
|
|
143
168
|
props.iconFirst || $q.iconSet.pagination.first,
|
|
@@ -148,38 +173,90 @@ export default createComponent({
|
|
|
148
173
|
return $q.lang.rtl === true ? ico.reverse() : ico
|
|
149
174
|
})
|
|
150
175
|
|
|
151
|
-
const attrs = computed(() => (
|
|
152
|
-
props.disable === true
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
))
|
|
176
|
+
const attrs = computed(() => ({
|
|
177
|
+
'aria-disabled': props.disable === true ? 'true' : 'false',
|
|
178
|
+
role: 'navigation'
|
|
179
|
+
}))
|
|
156
180
|
|
|
181
|
+
const btnDesignProp = computed(() => getBtnDesign(props, 'flat'))
|
|
157
182
|
const btnProps = computed(() => ({
|
|
183
|
+
[ btnDesignProp.value ]: true,
|
|
184
|
+
|
|
158
185
|
round: props.round,
|
|
159
186
|
rounded: props.rounded,
|
|
160
187
|
|
|
161
|
-
outline: props.outline,
|
|
162
|
-
unelevated: props.unelevated,
|
|
163
|
-
push: props.push,
|
|
164
|
-
glossy: props.glossy,
|
|
165
|
-
|
|
166
|
-
dense: props.dense,
|
|
167
188
|
padding: props.padding,
|
|
168
189
|
|
|
169
190
|
color: props.color,
|
|
170
|
-
|
|
191
|
+
textColor: props.textColor,
|
|
192
|
+
|
|
171
193
|
size: props.size,
|
|
172
194
|
ripple: props.ripple !== null
|
|
173
195
|
? props.ripple
|
|
174
196
|
: true
|
|
175
197
|
}))
|
|
176
198
|
|
|
199
|
+
const btnActiveDesignProp = computed(() => {
|
|
200
|
+
// we also reset non-active design
|
|
201
|
+
const acc = { [ btnDesignProp.value ]: false }
|
|
202
|
+
if (props.activeDesign !== '') {
|
|
203
|
+
acc[ props.activeDesign ] = true
|
|
204
|
+
}
|
|
205
|
+
return acc
|
|
206
|
+
})
|
|
177
207
|
const activeBtnProps = computed(() => ({
|
|
178
|
-
|
|
208
|
+
...btnActiveDesignProp.value,
|
|
179
209
|
color: props.activeColor || props.color,
|
|
180
210
|
textColor: props.activeTextColor || props.textColor
|
|
181
211
|
}))
|
|
182
212
|
|
|
213
|
+
const btnConfig = computed(() => {
|
|
214
|
+
let maxPages = Math.max(
|
|
215
|
+
maxPagesProp.value,
|
|
216
|
+
1 + (ellipsesProp.value ? 2 : 0) + (boundaryNumbersProp.value ? 2 : 0)
|
|
217
|
+
)
|
|
218
|
+
|
|
219
|
+
const acc = {
|
|
220
|
+
pgFrom: minProp.value,
|
|
221
|
+
pgTo: maxProp.value,
|
|
222
|
+
ellipsesStart: false,
|
|
223
|
+
ellipsesEnd: false,
|
|
224
|
+
boundaryStart: false,
|
|
225
|
+
boundaryEnd: false,
|
|
226
|
+
marginalStyle: {
|
|
227
|
+
minWidth: `${ Math.max(2, String(maxProp.value).length) }em`
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (maxPagesProp.value && maxPages < (maxProp.value - minProp.value + 1)) {
|
|
232
|
+
maxPages = 1 + Math.floor(maxPages / 2) * 2
|
|
233
|
+
acc.pgFrom = Math.max(minProp.value, Math.min(maxProp.value - maxPages + 1, props.modelValue - Math.floor(maxPages / 2)))
|
|
234
|
+
acc.pgTo = Math.min(maxProp.value, acc.pgFrom + maxPages - 1)
|
|
235
|
+
|
|
236
|
+
if (boundaryNumbersProp.value) {
|
|
237
|
+
acc.boundaryStart = true
|
|
238
|
+
acc.pgFrom++
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (ellipsesProp.value && acc.pgFrom > (minProp.value + (boundaryNumbersProp.value ? 1 : 0))) {
|
|
242
|
+
acc.ellipsesStart = true
|
|
243
|
+
acc.pgFrom++
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if (boundaryNumbersProp.value) {
|
|
247
|
+
acc.boundaryEnd = true
|
|
248
|
+
acc.pgTo--
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (ellipsesProp.value && acc.pgTo < (maxProp.value - (boundaryNumbersProp.value ? 1 : 0))) {
|
|
252
|
+
acc.ellipsesEnd = true
|
|
253
|
+
acc.pgTo--
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return acc
|
|
258
|
+
})
|
|
259
|
+
|
|
183
260
|
function set (value) {
|
|
184
261
|
model.value = value
|
|
185
262
|
}
|
|
@@ -188,20 +265,40 @@ export default createComponent({
|
|
|
188
265
|
model.value = model.value + offset
|
|
189
266
|
}
|
|
190
267
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
268
|
+
const inputEvents = computed(() => {
|
|
269
|
+
function updateModel () {
|
|
270
|
+
model.value = newPage.value
|
|
271
|
+
newPage.value = null
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return {
|
|
275
|
+
'onUpdate:modelValue': val => { newPage.value = val },
|
|
276
|
+
onKeyup: e => { isKeyCode(e, 13) === true && updateModel() },
|
|
277
|
+
onBlur: updateModel
|
|
278
|
+
}
|
|
279
|
+
})
|
|
280
|
+
|
|
281
|
+
function getBtn (cfg, page, active) {
|
|
282
|
+
const data = {
|
|
283
|
+
'aria-label': page,
|
|
284
|
+
'aria-current': 'false',
|
|
285
|
+
...btnProps.value,
|
|
286
|
+
...cfg
|
|
287
|
+
}
|
|
195
288
|
|
|
196
|
-
|
|
197
|
-
|
|
289
|
+
if (active === true) {
|
|
290
|
+
Object.assign(data, {
|
|
291
|
+
'aria-current': 'true',
|
|
292
|
+
...activeBtnProps.value
|
|
293
|
+
})
|
|
294
|
+
}
|
|
198
295
|
|
|
199
296
|
if (page !== void 0) {
|
|
200
297
|
if (props.toFn !== void 0) {
|
|
201
298
|
data.to = props.toFn(page)
|
|
202
299
|
}
|
|
203
300
|
else {
|
|
204
|
-
data.onClick = () => set(page)
|
|
301
|
+
data.onClick = () => { set(page) }
|
|
205
302
|
}
|
|
206
303
|
}
|
|
207
304
|
|
|
@@ -212,147 +309,107 @@ export default createComponent({
|
|
|
212
309
|
Object.assign(proxy, { set, setByOffset })
|
|
213
310
|
|
|
214
311
|
return () => {
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
312
|
+
const contentStart = []
|
|
313
|
+
const contentEnd = []
|
|
314
|
+
let contentMiddle
|
|
315
|
+
|
|
316
|
+
if (boundaryLinksProp.value === true) {
|
|
317
|
+
contentStart.push(
|
|
318
|
+
getBtn({
|
|
319
|
+
key: 'bls',
|
|
320
|
+
disable: props.disable || props.modelValue <= minProp.value,
|
|
321
|
+
icon: icons.value[ 0 ]
|
|
322
|
+
}, minProp.value)
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
contentEnd.unshift(
|
|
326
|
+
getBtn({
|
|
327
|
+
key: 'ble',
|
|
328
|
+
disable: props.disable || props.modelValue >= maxProp.value,
|
|
329
|
+
icon: icons.value[ 3 ]
|
|
330
|
+
}, maxProp.value)
|
|
331
|
+
)
|
|
231
332
|
}
|
|
232
333
|
|
|
233
|
-
if (
|
|
234
|
-
contentStart.push(
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
334
|
+
if (directionLinksProp.value === true) {
|
|
335
|
+
contentStart.push(
|
|
336
|
+
getBtn({
|
|
337
|
+
key: 'bdp',
|
|
338
|
+
disable: props.disable || props.modelValue <= minProp.value,
|
|
339
|
+
icon: icons.value[ 1 ]
|
|
340
|
+
}, props.modelValue - 1)
|
|
341
|
+
)
|
|
342
|
+
|
|
343
|
+
contentEnd.unshift(
|
|
344
|
+
getBtn({
|
|
345
|
+
key: 'bdn',
|
|
346
|
+
disable: props.disable || props.modelValue >= maxProp.value,
|
|
347
|
+
icon: icons.value[ 2 ]
|
|
348
|
+
}, props.modelValue + 1)
|
|
349
|
+
)
|
|
244
350
|
}
|
|
245
351
|
|
|
246
|
-
if (props.input
|
|
247
|
-
contentMiddle
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
placeholder: inputPlaceholder.value,
|
|
261
|
-
min: props.min,
|
|
262
|
-
max: props.max,
|
|
263
|
-
'onUpdate:modelValue' (value) { newPage.value = value },
|
|
264
|
-
onKeyup (e) { isKeyCode(e, 13) === true && updateModel() },
|
|
265
|
-
onBlur: updateModel
|
|
266
|
-
}))
|
|
267
|
-
}
|
|
268
|
-
else { // is type select
|
|
269
|
-
let
|
|
270
|
-
maxPages = Math.max(
|
|
271
|
-
props.maxPages,
|
|
272
|
-
1 + (__ellipses.value ? 2 : 0) + (__boundaryNumbers.value ? 2 : 0)
|
|
273
|
-
),
|
|
274
|
-
pgFrom = props.min,
|
|
275
|
-
pgTo = props.max,
|
|
276
|
-
ellipsesStart = false,
|
|
277
|
-
ellipsesEnd = false,
|
|
278
|
-
boundaryStart = false,
|
|
279
|
-
boundaryEnd = false
|
|
280
|
-
|
|
281
|
-
if (props.maxPages && maxPages < (props.max - props.min + 1)) {
|
|
282
|
-
maxPages = 1 + Math.floor(maxPages / 2) * 2
|
|
283
|
-
pgFrom = Math.max(props.min, Math.min(props.max - maxPages + 1, props.modelValue - Math.floor(maxPages / 2)))
|
|
284
|
-
pgTo = Math.min(props.max, pgFrom + maxPages - 1)
|
|
285
|
-
if (__boundaryNumbers.value) {
|
|
286
|
-
boundaryStart = true
|
|
287
|
-
pgFrom += 1
|
|
288
|
-
}
|
|
289
|
-
if (__ellipses.value && pgFrom > (props.min + (__boundaryNumbers.value ? 1 : 0))) {
|
|
290
|
-
ellipsesStart = true
|
|
291
|
-
pgFrom += 1
|
|
292
|
-
}
|
|
293
|
-
if (__boundaryNumbers.value) {
|
|
294
|
-
boundaryEnd = true
|
|
295
|
-
pgTo -= 1
|
|
296
|
-
}
|
|
297
|
-
if (__ellipses.value && pgTo < (props.max - (__boundaryNumbers.value ? 1 : 0))) {
|
|
298
|
-
ellipsesEnd = true
|
|
299
|
-
pgTo -= 1
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
const style = {
|
|
303
|
-
minWidth: `${ Math.max(2, String(props.max).length) }em`
|
|
304
|
-
}
|
|
305
|
-
if (boundaryStart) {
|
|
306
|
-
const active = props.min === props.modelValue
|
|
307
|
-
contentStart.push(getBtn({
|
|
308
|
-
key: 'bns',
|
|
309
|
-
style,
|
|
310
|
-
disable: props.disable,
|
|
311
|
-
flat: !active,
|
|
312
|
-
label: props.min,
|
|
313
|
-
...(active ? activeBtnProps.value : {})
|
|
314
|
-
}, props.min))
|
|
352
|
+
if (props.input !== true) { // has buttons instead of inputbox
|
|
353
|
+
contentMiddle = []
|
|
354
|
+
const { pgFrom, pgTo, marginalStyle: style } = btnConfig.value
|
|
355
|
+
|
|
356
|
+
if (btnConfig.value.boundaryStart === true) {
|
|
357
|
+
const active = minProp.value === props.modelValue
|
|
358
|
+
contentStart.push(
|
|
359
|
+
getBtn({
|
|
360
|
+
key: 'bns',
|
|
361
|
+
style,
|
|
362
|
+
disable: props.disable,
|
|
363
|
+
label: minProp.value
|
|
364
|
+
}, minProp.value, active)
|
|
365
|
+
)
|
|
315
366
|
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
367
|
+
|
|
368
|
+
if (btnConfig.value.boundaryEnd === true) {
|
|
369
|
+
const active = maxProp.value === props.modelValue
|
|
370
|
+
contentEnd.unshift(
|
|
371
|
+
getBtn({
|
|
372
|
+
key: 'bne',
|
|
373
|
+
style,
|
|
374
|
+
disable: props.disable,
|
|
375
|
+
label: maxProp.value
|
|
376
|
+
}, maxProp.value, active)
|
|
377
|
+
)
|
|
326
378
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
379
|
+
|
|
380
|
+
if (btnConfig.value.ellipsesStart === true) {
|
|
381
|
+
contentStart.push(
|
|
382
|
+
getBtn({
|
|
383
|
+
key: 'bes',
|
|
384
|
+
style,
|
|
385
|
+
disable: props.disable,
|
|
386
|
+
label: '…',
|
|
387
|
+
ripple: false
|
|
388
|
+
}, pgFrom - 1)
|
|
389
|
+
)
|
|
335
390
|
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
391
|
+
|
|
392
|
+
if (btnConfig.value.ellipsesEnd === true) {
|
|
393
|
+
contentEnd.unshift(
|
|
394
|
+
getBtn({
|
|
395
|
+
key: 'bee',
|
|
396
|
+
style,
|
|
397
|
+
disable: props.disable,
|
|
398
|
+
label: '…',
|
|
399
|
+
ripple: false
|
|
400
|
+
}, pgTo + 1)
|
|
401
|
+
)
|
|
344
402
|
}
|
|
403
|
+
|
|
345
404
|
for (let i = pgFrom; i <= pgTo; i++) {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
}
|
|
355
|
-
contentMiddle.push(getBtn(btn, i))
|
|
405
|
+
contentMiddle.push(
|
|
406
|
+
getBtn({
|
|
407
|
+
key: `bpg${ i }`,
|
|
408
|
+
style,
|
|
409
|
+
disable: props.disable,
|
|
410
|
+
label: i
|
|
411
|
+
}, i, i === props.modelValue)
|
|
412
|
+
)
|
|
356
413
|
}
|
|
357
414
|
}
|
|
358
415
|
|
|
@@ -360,15 +417,35 @@ export default createComponent({
|
|
|
360
417
|
class: classes.value,
|
|
361
418
|
...attrs.value
|
|
362
419
|
}, [
|
|
363
|
-
contentStart,
|
|
364
|
-
|
|
365
420
|
h('div', {
|
|
366
|
-
class: 'row
|
|
421
|
+
class: 'q-pagination__content row no-wrap items-center',
|
|
422
|
+
style: gutterStyle.value
|
|
367
423
|
}, [
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
424
|
+
...contentStart,
|
|
425
|
+
|
|
426
|
+
props.input === true
|
|
427
|
+
? h(QInput, {
|
|
428
|
+
class: 'inline',
|
|
429
|
+
style: { width: `${ inputPlaceholder.value.length / 1.5 }em` },
|
|
430
|
+
type: 'number',
|
|
431
|
+
dense: true,
|
|
432
|
+
value: newPage.value,
|
|
433
|
+
disable: props.disable,
|
|
434
|
+
dark: isDark.value,
|
|
435
|
+
borderless: true,
|
|
436
|
+
inputClass: props.inputClass,
|
|
437
|
+
inputStyle: props.inputStyle,
|
|
438
|
+
placeholder: inputPlaceholder.value,
|
|
439
|
+
min: minProp.value,
|
|
440
|
+
max: maxProp.value,
|
|
441
|
+
...inputEvents.value
|
|
442
|
+
})
|
|
443
|
+
: h('div', {
|
|
444
|
+
class: 'q-pagination__middle row justify-center'
|
|
445
|
+
}, contentMiddle),
|
|
446
|
+
|
|
447
|
+
...contentEnd
|
|
448
|
+
])
|
|
372
449
|
])
|
|
373
450
|
}
|
|
374
451
|
}
|