@xenknight/framework7 0.0.6 → 0.0.7
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/app/app.less +1 -1
- package/components/icon/icon-ios.less +9 -0
- package/components/icon/icon-md.less +9 -0
- package/components/icon/icon.less +2 -1
- package/components/list/list-vars.less +1 -1
- package/components/messagebar/messagebar-rtl.css +1 -1
- package/components/messagebar/messagebar-vars.less +1 -1
- package/components/messagebar/messagebar.css +1 -1
- package/components/messages/messages-rtl.css +1 -1
- package/components/messages/messages-vars.less +7 -7
- package/components/messages/messages.css +1 -1
- package/components/navbar-new/navbar-ios.less +135 -0
- package/components/navbar-new/navbar-md.less +105 -0
- package/components/navbar-new/navbar-vars.less +78 -0
- package/components/navbar-new/navbar.d.ts +77 -0
- package/components/navbar-new/navbar.js +568 -0
- package/components/navbar-new/navbar.less +268 -0
- package/components/searchbar-new/remove-diacritics.js +271 -0
- package/components/searchbar-new/searchbar-ios.less +131 -0
- package/components/searchbar-new/searchbar-md.less +153 -0
- package/components/searchbar-new/searchbar-new-class.js +592 -0
- package/components/searchbar-new/searchbar-vars.less +75 -0
- package/components/searchbar-new/searchbar.js +122 -0
- package/components/searchbar-new/searchbar.less +331 -0
- package/components/swipeout/swipeout.js +8 -9
- package/components/tabs/tabs.js +5 -0
- package/components/toolbar-new/tabbar-highlight.js +134 -0
- package/components/toolbar-new/toolbar-ios.less +193 -0
- package/components/toolbar-new/toolbar-md.less +152 -0
- package/components/toolbar-new/toolbar-vars.less +77 -0
- package/components/toolbar-new/toolbar.js +223 -0
- package/components/toolbar-new/toolbar.less +261 -0
- package/framework7-bundle-rtl.css +2198 -387
- package/framework7-bundle-rtl.min.css +12 -6
- package/framework7-bundle.css +2194 -383
- package/framework7-bundle.esm.js +11 -4
- package/framework7-bundle.js +2368 -467
- package/framework7-bundle.js.map +1 -1
- package/framework7-bundle.less +6 -3
- package/framework7-bundle.min.css +12 -6
- package/framework7-bundle.min.js +4 -4
- package/framework7-bundle.min.js.map +1 -1
- package/framework7-lite-bundle.esm.js +11 -4
- package/framework7-lite.esm.js +11 -4
- package/framework7-lite.js +8 -1
- package/framework7-rtl.css +2191 -380
- package/framework7-rtl.min.css +11 -5
- package/framework7.css +2189 -378
- package/framework7.esm.js +11 -4
- package/framework7.js +8 -1
- package/framework7.less +6 -3
- package/framework7.min.css +11 -5
- package/package.json +1 -1
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
.ios {
|
|
2
|
+
.toolbar-new-pane {
|
|
3
|
+
user-select: none;
|
|
4
|
+
}
|
|
5
|
+
.toolbar-new-pane,
|
|
6
|
+
.toolbar-new .left,
|
|
7
|
+
.toolbar-new .right {
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
height: 100%;
|
|
12
|
+
position: relative;
|
|
13
|
+
z-index: 1;
|
|
14
|
+
border-radius: 32px;
|
|
15
|
+
.ios-glass();
|
|
16
|
+
}
|
|
17
|
+
.toolbar-new {
|
|
18
|
+
.left {
|
|
19
|
+
margin-right: auto;
|
|
20
|
+
}
|
|
21
|
+
.right {
|
|
22
|
+
margin-left: auto;
|
|
23
|
+
}
|
|
24
|
+
.left:empty,
|
|
25
|
+
.right:empty {
|
|
26
|
+
display: none;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
a.icon-only {
|
|
30
|
+
display: flex;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
align-items: center;
|
|
33
|
+
margin: 0;
|
|
34
|
+
min-width: 48px;
|
|
35
|
+
min-height: 48px;
|
|
36
|
+
padding: 0;
|
|
37
|
+
}
|
|
38
|
+
.link {
|
|
39
|
+
padding: 0 12px;
|
|
40
|
+
height: 100%;
|
|
41
|
+
}
|
|
42
|
+
&:before,
|
|
43
|
+
&:after {
|
|
44
|
+
pointer-events: none;
|
|
45
|
+
content: '';
|
|
46
|
+
position: absolute;
|
|
47
|
+
inset: 0;
|
|
48
|
+
}
|
|
49
|
+
&:before {
|
|
50
|
+
backdrop-filter: blur(2px);
|
|
51
|
+
mask-image: linear-gradient(
|
|
52
|
+
to top,
|
|
53
|
+
black calc(50% + var(--f7-safe-area-bottom, 0px)),
|
|
54
|
+
transparent 100%
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
&:after {
|
|
58
|
+
background-image: linear-gradient(
|
|
59
|
+
to top,
|
|
60
|
+
var(--f7-toolbar-new-bars-bg-color) var(--f7-safe-area-bottom, 0px),
|
|
61
|
+
transparent 100%
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
&.toolbar-new-bottom,
|
|
65
|
+
&.messagebar {
|
|
66
|
+
&:before,
|
|
67
|
+
&:after {
|
|
68
|
+
top: -16px;
|
|
69
|
+
}
|
|
70
|
+
.toolbar-new-inner {
|
|
71
|
+
padding-bottom: 16px;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
&.toolbar-new-top,
|
|
75
|
+
&:not(.toolbar-new-bottom, .toolbar-new-top, .messagebar) {
|
|
76
|
+
&:before {
|
|
77
|
+
mask-image: linear-gradient(
|
|
78
|
+
to bottom,
|
|
79
|
+
black calc(50% + var(--f7-safe-area-top, 0px)),
|
|
80
|
+
transparent 100%
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
&:after {
|
|
84
|
+
background-image: linear-gradient(
|
|
85
|
+
to bottom,
|
|
86
|
+
var(--f7-toolbar-new-bars-bg-color) var(--f7-safe-area-top, 0px),
|
|
87
|
+
transparent 100%
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
&:before,
|
|
91
|
+
&:after {
|
|
92
|
+
bottom: -16px;
|
|
93
|
+
}
|
|
94
|
+
.toolbar-new-inner {
|
|
95
|
+
padding-top: 16px;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
.navbar-new ~ .toolbar-new-top {
|
|
100
|
+
&:before,
|
|
101
|
+
&:after {
|
|
102
|
+
display: none;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
.toolbar-new-inner {
|
|
106
|
+
justify-content: center;
|
|
107
|
+
overflow: visible;
|
|
108
|
+
gap: 16px;
|
|
109
|
+
}
|
|
110
|
+
.tabbar-new-scrollable .toolbar-new-pane {
|
|
111
|
+
.scrollable();
|
|
112
|
+
.no-scrollbar();
|
|
113
|
+
justify-content: flex-start;
|
|
114
|
+
}
|
|
115
|
+
.tabbar-new:not(.tabbar-new-scrollable) {
|
|
116
|
+
touch-action: none;
|
|
117
|
+
}
|
|
118
|
+
.tabbar-new-icons {
|
|
119
|
+
.tab-link,
|
|
120
|
+
.link {
|
|
121
|
+
padding-top: 4px;
|
|
122
|
+
padding-bottom: 4px;
|
|
123
|
+
i + span {
|
|
124
|
+
margin: 0;
|
|
125
|
+
margin-top: 4px;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
@media (max-width: 767px) {
|
|
130
|
+
.tabbar-new .toolbar-new-pane {
|
|
131
|
+
width: 100%;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
@media (min-width: 768px) {
|
|
135
|
+
.tabbar-new .tab-link {
|
|
136
|
+
padding-left: 16px;
|
|
137
|
+
padding-right: 16px;
|
|
138
|
+
min-width: 96px;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Scrollable
|
|
143
|
+
.tabbar-new-scrollable {
|
|
144
|
+
.toolbar-new-inner {
|
|
145
|
+
justify-content: flex-start;
|
|
146
|
+
}
|
|
147
|
+
.tab-link,
|
|
148
|
+
.link {
|
|
149
|
+
padding: 0 8px;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
.tab-link-highlight {
|
|
153
|
+
position: absolute;
|
|
154
|
+
height: 100%;
|
|
155
|
+
top: 0;
|
|
156
|
+
transition-duration: 300ms;
|
|
157
|
+
border-radius: inherit;
|
|
158
|
+
.ltr({
|
|
159
|
+
left: 0;
|
|
160
|
+
});
|
|
161
|
+
.rtl({
|
|
162
|
+
right: 0;
|
|
163
|
+
});
|
|
164
|
+
&:before,
|
|
165
|
+
&:after {
|
|
166
|
+
content: '';
|
|
167
|
+
position: absolute;
|
|
168
|
+
inset: 4px;
|
|
169
|
+
border-radius: inherit;
|
|
170
|
+
transition-duration: 300ms;
|
|
171
|
+
}
|
|
172
|
+
&:before {
|
|
173
|
+
background-color: var(--f7-tabbar-new-link-highlight-bg-color);
|
|
174
|
+
}
|
|
175
|
+
&:after {
|
|
176
|
+
opacity: 0;
|
|
177
|
+
box-shadow: var(--f7-glass-shadow-thumb);
|
|
178
|
+
background-color: var(--f7-tabbar-new-link-highlight-active-bg-color);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
.tab-link-highlight-pressed {
|
|
182
|
+
&:before {
|
|
183
|
+
opacity: 0;
|
|
184
|
+
}
|
|
185
|
+
&:after {
|
|
186
|
+
opacity: 1;
|
|
187
|
+
}
|
|
188
|
+
&:before,
|
|
189
|
+
&:after {
|
|
190
|
+
scale: 1.4;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
.md {
|
|
2
|
+
.toolbar-new-pane {
|
|
3
|
+
display: contents;
|
|
4
|
+
}
|
|
5
|
+
.toolbar-new {
|
|
6
|
+
background-color: var(--f7-toolbar-new-bg-color, var(--f7-bars-bg-color));
|
|
7
|
+
.link {
|
|
8
|
+
justify-content: center;
|
|
9
|
+
padding: 0 12px;
|
|
10
|
+
min-width: 48px;
|
|
11
|
+
min-height: 48px;
|
|
12
|
+
line-height: var(--f7-toolbar-new-link-line-height, var(--f7-toolbar-new-height));
|
|
13
|
+
height: var(--f7-toolbar-new-link-height, var(--f7-toolbar-new-height));
|
|
14
|
+
}
|
|
15
|
+
a.icon-only {
|
|
16
|
+
min-width: 48px;
|
|
17
|
+
flex-shrink: 0;
|
|
18
|
+
padding: 0;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
.toolbar-new-top,
|
|
22
|
+
.md .toolbar-new-top-md {
|
|
23
|
+
&.no-outline {
|
|
24
|
+
&:after {
|
|
25
|
+
display: none !important;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
&.toolbar-new-hidden {
|
|
29
|
+
&:before {
|
|
30
|
+
display: none !important;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
&:after,
|
|
34
|
+
&:before {
|
|
35
|
+
backface-visibility: hidden;
|
|
36
|
+
}
|
|
37
|
+
.hairline(bottom, var(--f7-toolbar-new-border-color, var(--f7-bars-border-color)));
|
|
38
|
+
}
|
|
39
|
+
.toolbar-new-bottom,
|
|
40
|
+
.md .toolbar-new-bottom-md {
|
|
41
|
+
&.no-outline {
|
|
42
|
+
&:before {
|
|
43
|
+
display: none !important;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
&.toolbar-new-hidden {
|
|
47
|
+
&:after {
|
|
48
|
+
display: none !important;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
.hairline(top, var(--f7-toolbar-new-border-color, var(--f7-bars-border-color)));
|
|
52
|
+
}
|
|
53
|
+
.toolbar-new-inner {
|
|
54
|
+
justify-content: space-between;
|
|
55
|
+
overflow: hidden;
|
|
56
|
+
}
|
|
57
|
+
.tabbar-new,
|
|
58
|
+
.tabbar-new-icons {
|
|
59
|
+
.tab-link,
|
|
60
|
+
.link {
|
|
61
|
+
padding-left: 0;
|
|
62
|
+
padding-right: 0;
|
|
63
|
+
}
|
|
64
|
+
a.icon-only {
|
|
65
|
+
flex-shrink: initial;
|
|
66
|
+
}
|
|
67
|
+
.tab-link {
|
|
68
|
+
transition-duration: 300ms;
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
position: relative;
|
|
71
|
+
}
|
|
72
|
+
i.icon {
|
|
73
|
+
position: relative;
|
|
74
|
+
&::before {
|
|
75
|
+
content: '';
|
|
76
|
+
width: 64px;
|
|
77
|
+
height: 32px;
|
|
78
|
+
border-radius: 32px;
|
|
79
|
+
position: absolute;
|
|
80
|
+
left: 50%;
|
|
81
|
+
top: 50%;
|
|
82
|
+
transform: translateX(-50%) translateY(-50%) scaleX(0.5);
|
|
83
|
+
background: var(--f7-tabbar-new-link-active-icon-bg-color);
|
|
84
|
+
opacity: 0;
|
|
85
|
+
transition-duration: 200ms;
|
|
86
|
+
z-index: -1;
|
|
87
|
+
}
|
|
88
|
+
+ .tabbar-new-label {
|
|
89
|
+
margin-top: 8px;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
.tab-link-active i.icon::before {
|
|
93
|
+
opacity: 1;
|
|
94
|
+
transform: translateX(-50%) translateY(-50%) scaleX(1);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.tabbar-new-icons {
|
|
99
|
+
.tab-link,
|
|
100
|
+
.link {
|
|
101
|
+
padding-top: 8px;
|
|
102
|
+
padding-bottom: 8px;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
.tabbar-new-label {
|
|
106
|
+
max-width: 100%;
|
|
107
|
+
overflow: hidden;
|
|
108
|
+
line-height: 1.2;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Scrollable
|
|
112
|
+
.tabbar-new-scrollable {
|
|
113
|
+
.toolbar-new-inner {
|
|
114
|
+
overflow: auto;
|
|
115
|
+
}
|
|
116
|
+
.tab-link,
|
|
117
|
+
.link {
|
|
118
|
+
padding: 0 12px;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
.toolbar-new-top-md,
|
|
122
|
+
.toolbar-new-top {
|
|
123
|
+
.tab-link-highlight {
|
|
124
|
+
bottom: 0;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
.toolbar-new-bottom,
|
|
128
|
+
.toolbar-new-bottom-md {
|
|
129
|
+
.tab-link-highlight {
|
|
130
|
+
top: 0;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
.tabbar-new,
|
|
134
|
+
.tabbar-new-icons {
|
|
135
|
+
&.tabbar-new-icons .tab-link-highlight {
|
|
136
|
+
display: none;
|
|
137
|
+
}
|
|
138
|
+
&:not(.tabbar-new-icons) .tab-link-highlight {
|
|
139
|
+
position: absolute;
|
|
140
|
+
height: 2px;
|
|
141
|
+
background: var(--f7-tabbar-new-link-active-border-color, var(--f7-theme-color));
|
|
142
|
+
transition-duration: 300ms;
|
|
143
|
+
.ltr({
|
|
144
|
+
left: 0;
|
|
145
|
+
});
|
|
146
|
+
.rtl({
|
|
147
|
+
right: 0;
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
/*
|
|
3
|
+
--f7-toolbar-new-bg-color: var(--f7-bars-bg-color);
|
|
4
|
+
--f7-toolbar-new-bg-color-rgb: var(--f7-bars-bg-color-rgb);
|
|
5
|
+
--f7-toolbar-new-border-color: var(--f7-bars-border-color);
|
|
6
|
+
--f7-toolbar-new-text-color: var(--f7-bars-text-color);
|
|
7
|
+
*/
|
|
8
|
+
--f7-tabbar-new-link-active-bg-color: transparent;
|
|
9
|
+
--f7-tabbar-new-label-text-transform: none;
|
|
10
|
+
--f7-toolbar-new-hide-show-transition-duration: 400ms;
|
|
11
|
+
}
|
|
12
|
+
.ios-vars({
|
|
13
|
+
--f7-toolbar-new-height: 64px;
|
|
14
|
+
--f7-toolbar-new-font-size: 17px;
|
|
15
|
+
--f7-toolbar-new-inner-padding-left: 16px;
|
|
16
|
+
--f7-toolbar-new-inner-padding-right: 16px;
|
|
17
|
+
--f7-toolbar-new-link-font-weight: 400;
|
|
18
|
+
--f7-toolbar-new-link-color: var(--f7-bars-text-color);
|
|
19
|
+
--f7-tabbar-new-link-inactive-color: var(--f7-bars-text-color);
|
|
20
|
+
/*
|
|
21
|
+
--f7-toolbar-new-link-height: var(--f7-toolbar-new-height);
|
|
22
|
+
--f7-toolbar-new-link-line-height: var(--f7-toolbar-new-height);
|
|
23
|
+
--f7-tabbar-new-link-active-color: var(--f7-theme-color);
|
|
24
|
+
*/
|
|
25
|
+
--f7-tabbar-new-icons-height: 80px;
|
|
26
|
+
--f7-tabbar-new-icons-tablet-height: 80px;
|
|
27
|
+
--f7-tabbar-new-icon-size: 28px;
|
|
28
|
+
--f7-tabbar-new-link-text-transform: none;
|
|
29
|
+
--f7-tabbar-new-link-font-weight: 400;
|
|
30
|
+
--f7-tabbar-new-link-letter-spacing: 0;
|
|
31
|
+
|
|
32
|
+
--f7-tabbar-new-label-font-size: 12px;
|
|
33
|
+
--f7-tabbar-new-label-tablet-font-size: 14px;
|
|
34
|
+
--f7-tabbar-new-label-font-weight: 500;
|
|
35
|
+
--f7-tabbar-new-label-letter-spacing: 0.01;
|
|
36
|
+
.dark-vars({
|
|
37
|
+
--f7-tabbar-new-link-highlight-bg-color: rgba(255,255,255,0.15);
|
|
38
|
+
--f7-tabbar-new-link-highlight-active-bg-color: rgba(255,255,255,0.1);
|
|
39
|
+
--f7-toolbar-new-bars-bg-color: rgba(0, 0, 0, 0.5);
|
|
40
|
+
});
|
|
41
|
+
.light-vars({
|
|
42
|
+
--f7-tabbar-new-link-highlight-bg-color: rgba(0,0,0,0.1);
|
|
43
|
+
--f7-tabbar-new-link-highlight-active-bg-color: rgba(0,0,0,0.05);
|
|
44
|
+
--f7-toolbar-new-bars-bg-color: #efeff4;
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
});
|
|
48
|
+
.md-vars({
|
|
49
|
+
--f7-toolbar-new-height: 56px;
|
|
50
|
+
--f7-toolbar-new-font-size: 14px;
|
|
51
|
+
--f7-toolbar-new-inner-padding-left: 0px;
|
|
52
|
+
--f7-toolbar-new-inner-padding-right: 0px;
|
|
53
|
+
/*
|
|
54
|
+
--f7-toolbar-new-link-color: var(--f7-bars-link-color);
|
|
55
|
+
--f7-toolbar-new-link-height: var(--f7-toolbar-new-height);
|
|
56
|
+
--f7-toolbar-new-link-line-height: var(--f7-toolbar-new-height);
|
|
57
|
+
*/
|
|
58
|
+
--f7-tabbar-new-icons-height: 80px;
|
|
59
|
+
--f7-tabbar-new-icons-tablet-height: 80px;
|
|
60
|
+
--f7-tabbar-new-icon-size: 24px;
|
|
61
|
+
--f7-tabbar-new-link-text-transform: none;
|
|
62
|
+
--f7-tabbar-new-link-font-weight: 500;
|
|
63
|
+
--f7-tabbar-new-link-letter-spacing: 0;
|
|
64
|
+
--f7-toolbar-new-link-font-weight: 500;
|
|
65
|
+
|
|
66
|
+
--f7-tabbar-new-label-font-size: 12px;
|
|
67
|
+
--f7-tabbar-new-label-tablet-font-size: 12px;
|
|
68
|
+
--f7-tabbar-new-label-font-weight: 500;
|
|
69
|
+
--f7-tabbar-new-label-letter-spacing: 0;
|
|
70
|
+
|
|
71
|
+
});
|
|
72
|
+
.md-color-vars({
|
|
73
|
+
--f7-tabbar-new-link-active-color: var(--f7-md-on-secondary-container);
|
|
74
|
+
--f7-tabbar-new-link-active-border-color: var(--f7-md-primary);
|
|
75
|
+
--f7-tabbar-new-link-inactive-color: var(--f7-md-on-surface-variant);
|
|
76
|
+
--f7-tabbar-new-link-active-icon-bg-color: var(--f7-md-secondary-container);
|
|
77
|
+
});
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import $ from '../../shared/dom7.js';
|
|
2
|
+
import { nextFrame, bindMethods } from '../../shared/utils.js';
|
|
3
|
+
import { destroyTabbarNewHighlight, initTabbarNewHighlight } from './tabbar-highlight.js';
|
|
4
|
+
const ToolbarNew = {
|
|
5
|
+
setHighlight(tabbarEl) {
|
|
6
|
+
const app = this;
|
|
7
|
+
const $tabbarEl = $(tabbarEl);
|
|
8
|
+
if ($tabbarEl.length === 0 || !($tabbarEl.hasClass('tabbar-new') || $tabbarEl.hasClass('tabbar-new-icons'))) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
let $highlightEl = $tabbarEl.find('.tab-link-highlight');
|
|
12
|
+
const tabLinksCount = $tabbarEl.find('.tab-link').length;
|
|
13
|
+
if (tabLinksCount === 0) {
|
|
14
|
+
$highlightEl.remove();
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if ($highlightEl.length === 0) {
|
|
18
|
+
if (app.theme === 'ios') {
|
|
19
|
+
$tabbarEl.children('.toolbar-new-inner').children('.toolbar-new-pane').append('<span class="tab-link-highlight"></span>');
|
|
20
|
+
} else {
|
|
21
|
+
$tabbarEl.children('.toolbar-new-inner').append('<span class="tab-link-highlight"></span>');
|
|
22
|
+
}
|
|
23
|
+
$highlightEl = $tabbarEl.find('.tab-link-highlight');
|
|
24
|
+
} else if ($highlightEl.next('a,button,.tab-link').length) {
|
|
25
|
+
if (app.theme === 'ios') {
|
|
26
|
+
$tabbarEl.children('.toolbar-new-inner').children('.toolbar-new-pane').append($highlightEl);
|
|
27
|
+
} else {
|
|
28
|
+
$tabbarEl.children('.toolbar-new-inner').append($highlightEl);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const $activeLink = $tabbarEl.find('.tab-link-active');
|
|
32
|
+
let highlightWidth;
|
|
33
|
+
let highlightTranslate;
|
|
34
|
+
if ($tabbarEl.hasClass('tabbar-new-scrollable') && $activeLink && $activeLink[0]) {
|
|
35
|
+
highlightWidth = `${$activeLink[0].offsetWidth}px`;
|
|
36
|
+
highlightTranslate = `${$activeLink[0].offsetLeft}px`;
|
|
37
|
+
} else {
|
|
38
|
+
const activeIndex = $activeLink.index();
|
|
39
|
+
highlightWidth = `${100 / tabLinksCount}%`;
|
|
40
|
+
highlightTranslate = `${(app.rtl ? -activeIndex : activeIndex) * 100}%`;
|
|
41
|
+
}
|
|
42
|
+
nextFrame(() => {
|
|
43
|
+
$highlightEl.css('width', highlightWidth).transform(`translate3d(${highlightTranslate},0,0)`);
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
init(tabbarEl) {
|
|
47
|
+
const app = this;
|
|
48
|
+
app.toolbarNew.setHighlight(tabbarEl);
|
|
49
|
+
if (app.theme !== 'ios') return;
|
|
50
|
+
initTabbarNewHighlight(tabbarEl);
|
|
51
|
+
},
|
|
52
|
+
destroy(tabbarEl) {
|
|
53
|
+
const app = this;
|
|
54
|
+
if (app.theme !== 'ios') return;
|
|
55
|
+
destroyTabbarNewHighlight(tabbarEl);
|
|
56
|
+
},
|
|
57
|
+
hide(el, animate) {
|
|
58
|
+
if (animate === void 0) {
|
|
59
|
+
animate = true;
|
|
60
|
+
}
|
|
61
|
+
const app = this;
|
|
62
|
+
const $el = $(el);
|
|
63
|
+
if ($el.hasClass('toolbar-new-hidden')) return;
|
|
64
|
+
const className = `toolbar-new-hidden${animate ? ' toolbar-new-transitioning' : ''}`;
|
|
65
|
+
$el.transitionEnd(() => {
|
|
66
|
+
$el.removeClass('toolbar-new-transitioning');
|
|
67
|
+
});
|
|
68
|
+
$el.addClass(className);
|
|
69
|
+
$el.trigger('toolbar-new:hide');
|
|
70
|
+
app.emit('toolbarNewHide', $el[0]);
|
|
71
|
+
},
|
|
72
|
+
show(el, animate) {
|
|
73
|
+
if (animate === void 0) {
|
|
74
|
+
animate = true;
|
|
75
|
+
}
|
|
76
|
+
const app = this;
|
|
77
|
+
const $el = $(el);
|
|
78
|
+
if (!$el.hasClass('toolbar-new-hidden')) return;
|
|
79
|
+
if (animate) {
|
|
80
|
+
$el.addClass('toolbar-new-transitioning');
|
|
81
|
+
$el.transitionEnd(() => {
|
|
82
|
+
$el.removeClass('toolbar-new-transitioning');
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
$el.removeClass('toolbar-new-hidden');
|
|
86
|
+
$el.trigger('toolbar-new:show');
|
|
87
|
+
app.emit('toolbarNewShow', $el[0]);
|
|
88
|
+
},
|
|
89
|
+
initToolbarOnScroll(pageEl) {
|
|
90
|
+
const app = this;
|
|
91
|
+
const $pageEl = $(pageEl);
|
|
92
|
+
let $toolbarEl = $pageEl.parents('.view').children('.toolbar-new');
|
|
93
|
+
if ($toolbarEl.length === 0) {
|
|
94
|
+
$toolbarEl = $pageEl.find('.toolbar-new');
|
|
95
|
+
}
|
|
96
|
+
if ($toolbarEl.length === 0) {
|
|
97
|
+
$toolbarEl = $pageEl.parents('.views').children('.tabbar-new, .tabbar-new-icons');
|
|
98
|
+
}
|
|
99
|
+
if ($toolbarEl.length === 0) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
let previousScrollTop;
|
|
103
|
+
let currentScrollTop;
|
|
104
|
+
let scrollHeight;
|
|
105
|
+
let offsetHeight;
|
|
106
|
+
let reachEnd;
|
|
107
|
+
let action;
|
|
108
|
+
let toolbarHidden;
|
|
109
|
+
function handleScroll(e) {
|
|
110
|
+
if ($pageEl.hasClass('page-with-card-opened')) return;
|
|
111
|
+
if ($pageEl.hasClass('page-previous')) return;
|
|
112
|
+
const scrollContent = this;
|
|
113
|
+
if (e && e.target && e.target !== scrollContent) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
currentScrollTop = scrollContent.scrollTop;
|
|
117
|
+
scrollHeight = scrollContent.scrollHeight;
|
|
118
|
+
offsetHeight = scrollContent.offsetHeight;
|
|
119
|
+
reachEnd = currentScrollTop + offsetHeight >= scrollHeight;
|
|
120
|
+
toolbarHidden = $toolbarEl.hasClass('toolbar-new-hidden');
|
|
121
|
+
if (reachEnd) {
|
|
122
|
+
if (app.params.toolbarNew.showOnPageScrollEnd) {
|
|
123
|
+
action = 'show';
|
|
124
|
+
}
|
|
125
|
+
} else if (previousScrollTop > currentScrollTop) {
|
|
126
|
+
if (app.params.toolbarNew.showOnPageScrollTop || currentScrollTop <= 44) {
|
|
127
|
+
action = 'show';
|
|
128
|
+
} else {
|
|
129
|
+
action = 'hide';
|
|
130
|
+
}
|
|
131
|
+
} else if (currentScrollTop > 44) {
|
|
132
|
+
action = 'hide';
|
|
133
|
+
} else {
|
|
134
|
+
action = 'show';
|
|
135
|
+
}
|
|
136
|
+
if (action === 'show' && toolbarHidden) {
|
|
137
|
+
app.toolbarNew.show($toolbarEl);
|
|
138
|
+
toolbarHidden = false;
|
|
139
|
+
} else if (action === 'hide' && !toolbarHidden) {
|
|
140
|
+
app.toolbarNew.hide($toolbarEl);
|
|
141
|
+
toolbarHidden = true;
|
|
142
|
+
}
|
|
143
|
+
previousScrollTop = currentScrollTop;
|
|
144
|
+
}
|
|
145
|
+
$pageEl.on('scroll', '.page-content', handleScroll, true);
|
|
146
|
+
$pageEl[0].f7ScrollToolbarNewHandler = handleScroll;
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
export default {
|
|
150
|
+
name: 'toolbar-new',
|
|
151
|
+
create() {
|
|
152
|
+
const app = this;
|
|
153
|
+
bindMethods(app, {
|
|
154
|
+
toolbarNew: ToolbarNew
|
|
155
|
+
});
|
|
156
|
+
},
|
|
157
|
+
params: {
|
|
158
|
+
toolbarNew: {
|
|
159
|
+
hideOnPageScroll: false,
|
|
160
|
+
showOnPageScrollEnd: true,
|
|
161
|
+
showOnPageScrollTop: true
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
on: {
|
|
165
|
+
pageBeforeRemove(page) {
|
|
166
|
+
const app = this;
|
|
167
|
+
if (page.$el[0].f7ScrollToolbarNewHandler) {
|
|
168
|
+
page.$el.off('scroll', '.page-content', page.$el[0].f7ScrollToolbarNewHandler, true);
|
|
169
|
+
}
|
|
170
|
+
page.$el.find('.tabbar-new, .tabbar-new-icons').each(tabbarEl => {
|
|
171
|
+
app.toolbarNew.destroy(tabbarEl);
|
|
172
|
+
});
|
|
173
|
+
},
|
|
174
|
+
pageBeforeIn(page) {
|
|
175
|
+
const app = this;
|
|
176
|
+
let $toolbarEl = page.$el.parents('.view').children('.toolbar-new');
|
|
177
|
+
if ($toolbarEl.length === 0) {
|
|
178
|
+
$toolbarEl = page.$el.parents('.views').children('.tabbar-new, .tabbar-new-icons');
|
|
179
|
+
}
|
|
180
|
+
if ($toolbarEl.length === 0) {
|
|
181
|
+
$toolbarEl = page.$el.find('.toolbar-new');
|
|
182
|
+
}
|
|
183
|
+
if ($toolbarEl.length === 0) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
if (page.$el.hasClass('no-toolbar-new')) {
|
|
187
|
+
app.toolbarNew.hide($toolbarEl);
|
|
188
|
+
} else {
|
|
189
|
+
app.toolbarNew.show($toolbarEl);
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
pageInit(page) {
|
|
193
|
+
const app = this;
|
|
194
|
+
page.$el.find('.tabbar-new, .tabbar-new-icons').each(tabbarEl => {
|
|
195
|
+
app.toolbarNew.init(tabbarEl);
|
|
196
|
+
});
|
|
197
|
+
if (app.params.toolbarNew.hideOnPageScroll || page.$el.find('.hide-toolbar-new-on-scroll').length || page.$el.hasClass('hide-toolbar-new-on-scroll') || page.$el.find('.hide-bars-on-scroll').length || page.$el.hasClass('hide-bars-on-scroll')) {
|
|
198
|
+
if (page.$el.find('.keep-toolbar-new-on-scroll').length || page.$el.hasClass('keep-toolbar-new-on-scroll') || page.$el.find('.keep-bars-on-scroll').length || page.$el.hasClass('keep-bars-on-scroll')) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
app.toolbarNew.initToolbarOnScroll(page.el);
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
init() {
|
|
205
|
+
const app = this;
|
|
206
|
+
app.$el.find('.tabbar-new, .tabbar-new-icons').each(tabbarEl => {
|
|
207
|
+
app.toolbarNew.init(tabbarEl);
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
vnode: {
|
|
212
|
+
tabbarNew: {
|
|
213
|
+
insert(vnode) {
|
|
214
|
+
const app = this;
|
|
215
|
+
app.toolbarNew.init(vnode.elm);
|
|
216
|
+
},
|
|
217
|
+
destroy(vnode) {
|
|
218
|
+
const app = this;
|
|
219
|
+
app.toolbarNew.destroy(vnode.elm);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
};
|