@ionic/core 7.4.3-dev.11696355997.1d94070b → 7.4.3-dev.11696514206.1c9669de
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/index4.js +14 -15
- package/components/ion-menu.js +0 -12
- package/components/ion-segment.js +23 -35
- package/dist/cjs/{index-5121bb90.js → index-7c1ae0f0.js} +14 -15
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/ion-menu_3.cjs.entry.js +5 -16
- package/dist/cjs/ion-segment_2.cjs.entry.js +24 -35
- package/dist/collection/components/menu/menu.js +0 -12
- package/dist/collection/components/menu/test/multiple/menu.e2e.js +56 -0
- package/dist/collection/components/segment/segment.js +23 -35
- package/dist/collection/components/segment/test/scrollable/segment.e2e.js +1 -53
- package/dist/collection/utils/menu-controller/index.js +14 -15
- package/dist/docs.json +1 -1
- package/dist/esm/{index-61bddc90.js → index-c6640d16.js} +14 -15
- package/dist/esm/index.js +2 -2
- package/dist/esm/ion-menu_3.entry.js +3 -14
- package/dist/esm/ion-segment_2.entry.js +24 -35
- package/dist/esm-es5/index-c6640d16.js +4 -0
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/ion-menu_3.entry.js +1 -1
- package/dist/esm-es5/ion-segment_2.entry.js +1 -1
- package/dist/ionic/index.esm.js +1 -1
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/p-1406c382.system.entry.js +4 -0
- package/dist/ionic/p-55b99166.entry.js +4 -0
- package/dist/ionic/p-6edbc09b.system.js +1 -1
- package/dist/ionic/p-7cea4407.js +4 -0
- package/dist/ionic/{p-b098f738.system.js → p-95e6d10b.system.js} +1 -1
- package/dist/ionic/p-ad90d46b.system.js +4 -0
- package/dist/ionic/p-b3462f01.entry.js +4 -0
- package/dist/ionic/p-b5637aeb.system.entry.js +4 -0
- package/dist/types/components/menu/menu-interface.d.ts +0 -1
- package/dist/types/components/segment/segment.d.ts +0 -1
- package/dist/types/utils/menu-controller/index.d.ts +0 -1
- package/hydrate/index.js +36 -60
- package/package.json +1 -1
- package/dist/esm-es5/index-61bddc90.js +0 -4
- package/dist/ionic/p-155dfdda.entry.js +0 -4
- package/dist/ionic/p-40e16caa.system.entry.js +0 -4
- package/dist/ionic/p-b95fd3c6.entry.js +0 -4
- package/dist/ionic/p-d4cea1ba.system.js +0 -4
- package/dist/ionic/p-f1a71e75.system.entry.js +0 -4
- package/dist/ionic/p-f978ccd1.js +0 -4
package/components/index4.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
3
|
*/
|
|
4
|
+
import { p as printIonWarning } from './index6.js';
|
|
4
5
|
import { MENU_BACK_BUTTON_PRIORITY } from './hardware-back-button.js';
|
|
5
6
|
import { c as componentOnReady } from './helpers.js';
|
|
6
7
|
import { b as getIonMode } from './ionic-global.js';
|
|
@@ -155,13 +156,22 @@ const createMenuController = () => {
|
|
|
155
156
|
if (menu === 'start' || menu === 'end') {
|
|
156
157
|
// there could be more than one menu on the same side
|
|
157
158
|
// so first try to get the enabled one
|
|
158
|
-
const
|
|
159
|
-
if (
|
|
160
|
-
|
|
159
|
+
const menuRefs = menus.filter((m) => m.side === menu && !m.disabled);
|
|
160
|
+
if (menuRefs.length >= 1) {
|
|
161
|
+
if (menuRefs.length > 1) {
|
|
162
|
+
printIonWarning(`menuController queried for a menu on the "${menu}" side, but ${menuRefs.length} menus were found. The first menu reference will be used. If this is not the behavior you want then pass the ID of the menu instead of its side.`, menuRefs.map((m) => m.el));
|
|
163
|
+
}
|
|
164
|
+
return menuRefs[0].el;
|
|
161
165
|
}
|
|
162
166
|
// didn't find a menu side that is enabled
|
|
163
167
|
// so try to get the first menu side found
|
|
164
|
-
|
|
168
|
+
const sideMenuRefs = menus.filter((m) => m.side === menu);
|
|
169
|
+
if (sideMenuRefs.length >= 1) {
|
|
170
|
+
if (sideMenuRefs.length > 1) {
|
|
171
|
+
printIonWarning(`menuController queried for a menu on the "${menu}" side, but ${sideMenuRefs.length} menus were found. The first menu reference will be used. If this is not the behavior you want then pass the ID of the menu instead of its side.`, sideMenuRefs.map((m) => m.el));
|
|
172
|
+
}
|
|
173
|
+
return sideMenuRefs[0].el;
|
|
174
|
+
}
|
|
165
175
|
}
|
|
166
176
|
else if (menu != null) {
|
|
167
177
|
// the menuId was not left or right
|
|
@@ -203,9 +213,6 @@ const createMenuController = () => {
|
|
|
203
213
|
};
|
|
204
214
|
const _register = (menu) => {
|
|
205
215
|
if (menus.indexOf(menu) < 0) {
|
|
206
|
-
if (!menu.disabled) {
|
|
207
|
-
_setActiveMenu(menu);
|
|
208
|
-
}
|
|
209
216
|
menus.push(menu);
|
|
210
217
|
}
|
|
211
218
|
};
|
|
@@ -215,13 +222,6 @@ const createMenuController = () => {
|
|
|
215
222
|
menus.splice(index, 1);
|
|
216
223
|
}
|
|
217
224
|
};
|
|
218
|
-
const _setActiveMenu = (menu) => {
|
|
219
|
-
// if this menu should be enabled
|
|
220
|
-
// then find all the other menus on this same side
|
|
221
|
-
// and automatically disable other same side menus
|
|
222
|
-
const side = menu.side;
|
|
223
|
-
menus.filter((m) => m.side === side && m !== menu).forEach((m) => (m.disabled = true));
|
|
224
|
-
};
|
|
225
225
|
const _setOpen = async (menu, shouldOpen, animated) => {
|
|
226
226
|
if (isAnimatingSync()) {
|
|
227
227
|
return false;
|
|
@@ -293,7 +293,6 @@ const createMenuController = () => {
|
|
|
293
293
|
_register,
|
|
294
294
|
_unregister,
|
|
295
295
|
_setOpen,
|
|
296
|
-
_setActiveMenu,
|
|
297
296
|
};
|
|
298
297
|
};
|
|
299
298
|
const menuController = /*@__PURE__*/ createMenuController();
|
package/components/ion-menu.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { proxyCustomElement, HTMLElement, createEvent, Build, h, Host } from '@stencil/core/internal/client';
|
|
5
5
|
import { g as getTimeGivenProgression } from './cubic-bezier.js';
|
|
6
|
-
import { d as doc } from './index5.js';
|
|
7
6
|
import { G as GESTURE_CONTROLLER } from './gesture-controller.js';
|
|
8
7
|
import { o as isEndSide, i as inheritAriaAttributes, p as assert, m as clamp } from './helpers.js';
|
|
9
8
|
import { m as menuController } from './index4.js';
|
|
@@ -549,17 +548,6 @@ const Menu = /*@__PURE__*/ proxyCustomElement(class Menu extends HTMLElement {
|
|
|
549
548
|
// close if this menu is open, and should not be enabled
|
|
550
549
|
this.forceClosing();
|
|
551
550
|
}
|
|
552
|
-
if (doc === null || doc === void 0 ? void 0 : doc.contains(this.el)) {
|
|
553
|
-
/**
|
|
554
|
-
* Only set the active menu if the menu element is
|
|
555
|
-
* present in the DOM. Otherwise if it was destructively
|
|
556
|
-
* re-hydrated (through Angular Universal), then ignore
|
|
557
|
-
* setting the removed node as the active menu.
|
|
558
|
-
*/
|
|
559
|
-
if (!this.disabled) {
|
|
560
|
-
menuController._setActiveMenu(this);
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
551
|
assert(!this.isAnimating, 'can not be animating');
|
|
564
552
|
}
|
|
565
553
|
forceClosing() {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
3
|
*/
|
|
4
4
|
import { proxyCustomElement, HTMLElement, createEvent, writeTask, h, Host } from '@stencil/core/internal/client';
|
|
5
|
-
import { r as raf } from './helpers.js';
|
|
6
5
|
import { i as isRTL } from './dir.js';
|
|
7
6
|
import { c as createColorClasses, h as hostContext } from './theme.js';
|
|
8
7
|
import { b as getIonMode } from './ionic-global.js';
|
|
@@ -87,7 +86,29 @@ const Segment = /*@__PURE__*/ proxyCustomElement(class Segment extends HTMLEleme
|
|
|
87
86
|
* Used by `ion-segment-button` to determine if the button should be checked.
|
|
88
87
|
*/
|
|
89
88
|
this.ionSelect.emit({ value });
|
|
90
|
-
this.
|
|
89
|
+
if (this.scrollable) {
|
|
90
|
+
const buttons = this.getButtons();
|
|
91
|
+
const activeButton = buttons.find((button) => button.value === value);
|
|
92
|
+
if (activeButton !== undefined) {
|
|
93
|
+
/**
|
|
94
|
+
* Scrollable segment buttons should be
|
|
95
|
+
* centered within the view including
|
|
96
|
+
* buttons that are partially offscreen.
|
|
97
|
+
*/
|
|
98
|
+
activeButton.scrollIntoView({
|
|
99
|
+
behavior: 'smooth',
|
|
100
|
+
inline: 'center',
|
|
101
|
+
/**
|
|
102
|
+
* Segment should scroll on the
|
|
103
|
+
* horizontal axis. `block: 'nearest'`
|
|
104
|
+
* ensures that the vertical axis
|
|
105
|
+
* does not scroll if the segment
|
|
106
|
+
* as a whole is already in view.
|
|
107
|
+
*/
|
|
108
|
+
block: 'nearest',
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
91
112
|
}
|
|
92
113
|
disabledChanged() {
|
|
93
114
|
this.gestureChanged();
|
|
@@ -109,13 +130,6 @@ const Segment = /*@__PURE__*/ proxyCustomElement(class Segment extends HTMLEleme
|
|
|
109
130
|
}
|
|
110
131
|
async componentDidLoad() {
|
|
111
132
|
this.setCheckedClasses();
|
|
112
|
-
/**
|
|
113
|
-
* We need to wait for the buttons to all be rendered
|
|
114
|
-
* before we can scroll.
|
|
115
|
-
*/
|
|
116
|
-
raf(() => {
|
|
117
|
-
this.scrollActiveButtonIntoView();
|
|
118
|
-
});
|
|
119
133
|
this.gesture = (await import('./index3.js')).createGesture({
|
|
120
134
|
el: this.el,
|
|
121
135
|
gestureName: 'segment',
|
|
@@ -244,32 +258,6 @@ const Segment = /*@__PURE__*/ proxyCustomElement(class Segment extends HTMLEleme
|
|
|
244
258
|
buttons[next].classList.add('segment-button-after-checked');
|
|
245
259
|
}
|
|
246
260
|
}
|
|
247
|
-
scrollActiveButtonIntoView() {
|
|
248
|
-
const { scrollable, value } = this;
|
|
249
|
-
if (scrollable) {
|
|
250
|
-
const buttons = this.getButtons();
|
|
251
|
-
const activeButton = buttons.find((button) => button.value === value);
|
|
252
|
-
if (activeButton !== undefined) {
|
|
253
|
-
/**
|
|
254
|
-
* Scrollable segment buttons should be
|
|
255
|
-
* centered within the view including
|
|
256
|
-
* buttons that are partially offscreen.
|
|
257
|
-
*/
|
|
258
|
-
activeButton.scrollIntoView({
|
|
259
|
-
behavior: 'smooth',
|
|
260
|
-
inline: 'center',
|
|
261
|
-
/**
|
|
262
|
-
* Segment should scroll on the
|
|
263
|
-
* horizontal axis. `block: 'nearest'`
|
|
264
|
-
* ensures that the vertical axis
|
|
265
|
-
* does not scroll if the segment
|
|
266
|
-
* as a whole is already in view.
|
|
267
|
-
*/
|
|
268
|
-
block: 'nearest',
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
261
|
setNextIndex(detail, isEnd = false) {
|
|
274
262
|
const rtl = isRTL(this.el);
|
|
275
263
|
const activated = this.activated;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
|
+
const index = require('./index-cc7dfb7c.js');
|
|
6
7
|
const hardwareBackButton = require('./hardware-back-button-b67c8e75.js');
|
|
7
8
|
const helpers = require('./helpers-ea4ccbcb.js');
|
|
8
9
|
const ionicGlobal = require('./ionic-global-14a0604b.js');
|
|
@@ -157,13 +158,22 @@ const createMenuController = () => {
|
|
|
157
158
|
if (menu === 'start' || menu === 'end') {
|
|
158
159
|
// there could be more than one menu on the same side
|
|
159
160
|
// so first try to get the enabled one
|
|
160
|
-
const
|
|
161
|
-
if (
|
|
162
|
-
|
|
161
|
+
const menuRefs = menus.filter((m) => m.side === menu && !m.disabled);
|
|
162
|
+
if (menuRefs.length >= 1) {
|
|
163
|
+
if (menuRefs.length > 1) {
|
|
164
|
+
index.printIonWarning(`menuController queried for a menu on the "${menu}" side, but ${menuRefs.length} menus were found. The first menu reference will be used. If this is not the behavior you want then pass the ID of the menu instead of its side.`, menuRefs.map((m) => m.el));
|
|
165
|
+
}
|
|
166
|
+
return menuRefs[0].el;
|
|
163
167
|
}
|
|
164
168
|
// didn't find a menu side that is enabled
|
|
165
169
|
// so try to get the first menu side found
|
|
166
|
-
|
|
170
|
+
const sideMenuRefs = menus.filter((m) => m.side === menu);
|
|
171
|
+
if (sideMenuRefs.length >= 1) {
|
|
172
|
+
if (sideMenuRefs.length > 1) {
|
|
173
|
+
index.printIonWarning(`menuController queried for a menu on the "${menu}" side, but ${sideMenuRefs.length} menus were found. The first menu reference will be used. If this is not the behavior you want then pass the ID of the menu instead of its side.`, sideMenuRefs.map((m) => m.el));
|
|
174
|
+
}
|
|
175
|
+
return sideMenuRefs[0].el;
|
|
176
|
+
}
|
|
167
177
|
}
|
|
168
178
|
else if (menu != null) {
|
|
169
179
|
// the menuId was not left or right
|
|
@@ -205,9 +215,6 @@ const createMenuController = () => {
|
|
|
205
215
|
};
|
|
206
216
|
const _register = (menu) => {
|
|
207
217
|
if (menus.indexOf(menu) < 0) {
|
|
208
|
-
if (!menu.disabled) {
|
|
209
|
-
_setActiveMenu(menu);
|
|
210
|
-
}
|
|
211
218
|
menus.push(menu);
|
|
212
219
|
}
|
|
213
220
|
};
|
|
@@ -217,13 +224,6 @@ const createMenuController = () => {
|
|
|
217
224
|
menus.splice(index, 1);
|
|
218
225
|
}
|
|
219
226
|
};
|
|
220
|
-
const _setActiveMenu = (menu) => {
|
|
221
|
-
// if this menu should be enabled
|
|
222
|
-
// then find all the other menus on this same side
|
|
223
|
-
// and automatically disable other same side menus
|
|
224
|
-
const side = menu.side;
|
|
225
|
-
menus.filter((m) => m.side === side && m !== menu).forEach((m) => (m.disabled = true));
|
|
226
|
-
};
|
|
227
227
|
const _setOpen = async (menu, shouldOpen, animated) => {
|
|
228
228
|
if (isAnimatingSync()) {
|
|
229
229
|
return false;
|
|
@@ -295,7 +295,6 @@ const createMenuController = () => {
|
|
|
295
295
|
_register,
|
|
296
296
|
_unregister,
|
|
297
297
|
_setOpen,
|
|
298
|
-
_setActiveMenu,
|
|
299
298
|
};
|
|
300
299
|
};
|
|
301
300
|
const menuController = /*@__PURE__*/ createMenuController();
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -14,14 +14,14 @@ const index$1 = require('./index-0ee995e4.js');
|
|
|
14
14
|
const ionicGlobal = require('./ionic-global-14a0604b.js');
|
|
15
15
|
const helpers = require('./helpers-ea4ccbcb.js');
|
|
16
16
|
const config = require('./config-d5882735.js');
|
|
17
|
-
const index$2 = require('./index-
|
|
17
|
+
const index$2 = require('./index-7c1ae0f0.js');
|
|
18
18
|
const overlays = require('./overlays-d3a13e61.js');
|
|
19
19
|
require('./index-306a7476.js');
|
|
20
20
|
require('./index-6f887430.js');
|
|
21
21
|
require('./gesture-controller-b46721be.js');
|
|
22
|
+
require('./index-cc7dfb7c.js');
|
|
22
23
|
require('./hardware-back-button-b67c8e75.js');
|
|
23
24
|
require('./framework-delegate-c0873a6f.js');
|
|
24
|
-
require('./index-cc7dfb7c.js');
|
|
25
25
|
|
|
26
26
|
const IonicSlides = (opts) => {
|
|
27
27
|
const { swiper, extendParams } = opts;
|
|
@@ -7,18 +7,18 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
7
7
|
|
|
8
8
|
const index = require('./index-6f887430.js');
|
|
9
9
|
const cubicBezier = require('./cubic-bezier-6b9222ad.js');
|
|
10
|
-
const index$2 = require('./index-306a7476.js');
|
|
11
10
|
const gestureController = require('./gesture-controller-b46721be.js');
|
|
12
11
|
const helpers = require('./helpers-ea4ccbcb.js');
|
|
13
|
-
const index$1 = require('./index-
|
|
12
|
+
const index$1 = require('./index-7c1ae0f0.js');
|
|
14
13
|
const overlays = require('./overlays-d3a13e61.js');
|
|
15
14
|
const ionicGlobal = require('./ionic-global-14a0604b.js');
|
|
16
15
|
const theme = require('./theme-fbc56b3b.js');
|
|
17
|
-
const index$
|
|
16
|
+
const index$2 = require('./index-d8d1fc0b.js');
|
|
17
|
+
require('./index-cc7dfb7c.js');
|
|
18
18
|
require('./hardware-back-button-b67c8e75.js');
|
|
19
19
|
require('./animation-2bb33618.js');
|
|
20
|
+
require('./index-306a7476.js');
|
|
20
21
|
require('./framework-delegate-c0873a6f.js');
|
|
21
|
-
require('./index-cc7dfb7c.js');
|
|
22
22
|
|
|
23
23
|
const menuIosCss = ":host{--width:304px;--min-width:auto;--max-width:auto;--height:100%;--min-height:auto;--max-height:auto;--background:var(--ion-background-color, #fff);left:0;right:0;top:0;bottom:0;display:none;position:absolute;contain:strict}:host(.show-menu){display:block}.menu-inner{-webkit-transform:translateX(-9999px);transform:translateX(-9999px);display:-ms-flexbox;display:flex;position:absolute;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:justify;justify-content:space-between;width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);background:var(--background);contain:strict}:host(.menu-side-start) .menu-inner{--ion-safe-area-right:0px;top:0;bottom:0}@supports (inset-inline-start: 0){:host(.menu-side-start) .menu-inner{inset-inline-start:0;inset-inline-end:auto}}@supports not (inset-inline-start: 0){:host(.menu-side-start) .menu-inner{left:0;right:auto}:host-context([dir=rtl]):host(.menu-side-start) .menu-inner,:host-context([dir=rtl]).menu-side-start .menu-inner{left:unset;right:unset;left:auto;right:0}@supports selector(:dir(rtl)){:host(.menu-side-start) .menu-inner:dir(rtl){left:unset;right:unset;left:auto;right:0}}}:host-context([dir=rtl]):host(.menu-side-start) .menu-inner,:host-context([dir=rtl]).menu-side-start .menu-inner{--ion-safe-area-right:unset;--ion-safe-area-left:0px}@supports selector(:dir(rtl)){:host(.menu-side-start) .menu-inner:dir(rtl){--ion-safe-area-right:unset;--ion-safe-area-left:0px}}:host(.menu-side-end) .menu-inner{--ion-safe-area-left:0px;top:0;bottom:0}@supports (inset-inline-start: 0){:host(.menu-side-end) .menu-inner{inset-inline-start:auto;inset-inline-end:0}}@supports not (inset-inline-start: 0){:host(.menu-side-end) .menu-inner{left:auto;right:0}:host-context([dir=rtl]):host(.menu-side-end) .menu-inner,:host-context([dir=rtl]).menu-side-end .menu-inner{left:unset;right:unset;left:0;right:auto}@supports selector(:dir(rtl)){:host(.menu-side-end) .menu-inner:dir(rtl){left:unset;right:unset;left:0;right:auto}}}:host-context([dir=rtl]):host(.menu-side-end) .menu-inner,:host-context([dir=rtl]).menu-side-end .menu-inner{--ion-safe-area-left:unset;--ion-safe-area-right:0px}@supports selector(:dir(rtl)){:host(.menu-side-end) .menu-inner:dir(rtl){--ion-safe-area-left:unset;--ion-safe-area-right:0px}}ion-backdrop{display:none;opacity:0.01;z-index:-1}@media (max-width: 340px){.menu-inner{--width:264px}}:host(.menu-type-reveal){z-index:0}:host(.menu-type-reveal.show-menu) .menu-inner{-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0)}:host(.menu-type-overlay){z-index:1000}:host(.menu-type-overlay) .show-backdrop{display:block;cursor:pointer}:host(.menu-pane-visible){width:var(--width);min-width:var(--min-width);max-width:var(--max-width)}:host(.menu-pane-visible) .menu-inner{left:0;right:0;width:auto;-webkit-transform:none !important;transform:none !important;-webkit-box-shadow:none !important;box-shadow:none !important}:host(.menu-pane-visible) ion-backdrop{display:hidden !important;}:host(.menu-type-push){z-index:1000}:host(.menu-type-push) .show-backdrop{display:block}";
|
|
24
24
|
|
|
@@ -553,17 +553,6 @@ const Menu = class {
|
|
|
553
553
|
// close if this menu is open, and should not be enabled
|
|
554
554
|
this.forceClosing();
|
|
555
555
|
}
|
|
556
|
-
if (index$2.doc === null || index$2.doc === void 0 ? void 0 : index$2.doc.contains(this.el)) {
|
|
557
|
-
/**
|
|
558
|
-
* Only set the active menu if the menu element is
|
|
559
|
-
* present in the DOM. Otherwise if it was destructively
|
|
560
|
-
* re-hydrated (through Angular Universal), then ignore
|
|
561
|
-
* setting the removed node as the active menu.
|
|
562
|
-
*/
|
|
563
|
-
if (!this.disabled) {
|
|
564
|
-
index$1.menuController._setActiveMenu(this);
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
556
|
helpers.assert(!this.isAnimating, 'can not be animating');
|
|
568
557
|
}
|
|
569
558
|
forceClosing() {
|
|
@@ -647,7 +636,7 @@ const MenuButton = class {
|
|
|
647
636
|
render() {
|
|
648
637
|
const { color, disabled, inheritedAttributes } = this;
|
|
649
638
|
const mode = ionicGlobal.getIonMode(this);
|
|
650
|
-
const menuIcon = ionicGlobal.config.get('menuIcon', mode === 'ios' ? index$
|
|
639
|
+
const menuIcon = ionicGlobal.config.get('menuIcon', mode === 'ios' ? index$2.menuOutline : index$2.menuSharp);
|
|
651
640
|
const hidden = this.autoHide && !this.visible;
|
|
652
641
|
const attrs = {
|
|
653
642
|
type: this.type,
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
7
7
|
|
|
8
8
|
const index = require('./index-6f887430.js');
|
|
9
|
-
const helpers = require('./helpers-ea4ccbcb.js');
|
|
10
9
|
const dir = require('./dir-f1e0ca26.js');
|
|
11
10
|
const theme = require('./theme-fbc56b3b.js');
|
|
12
11
|
const ionicGlobal = require('./ionic-global-14a0604b.js');
|
|
12
|
+
const helpers = require('./helpers-ea4ccbcb.js');
|
|
13
13
|
|
|
14
14
|
const segmentIosCss = ":host{--ripple-color:currentColor;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:grid;grid-auto-columns:1fr;position:relative;-ms-flex-align:stretch;align-items:stretch;-ms-flex-pack:center;justify-content:center;width:100%;background:var(--background);font-family:var(--ion-font-family, inherit);text-align:center;contain:paint;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host(.segment-scrollable){-ms-flex-pack:start;justify-content:start;width:auto;overflow-x:auto;grid-auto-columns:minmax(-webkit-min-content, 1fr);grid-auto-columns:minmax(min-content, 1fr)}:host(.segment-scrollable::-webkit-scrollbar){display:none}:host{--background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.065);border-radius:8px;overflow:hidden;z-index:0}:host(.ion-color){background:rgba(var(--ion-color-base-rgb), 0.065)}:host(.in-toolbar){-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0;width:auto}:host(.in-toolbar:not(.ion-color)){background:var(--ion-toolbar-segment-background, var(--background))}:host(.in-toolbar-color:not(.ion-color)){background:rgba(var(--ion-color-contrast-rgb), 0.11)}";
|
|
15
15
|
|
|
@@ -89,7 +89,29 @@ const Segment = class {
|
|
|
89
89
|
* Used by `ion-segment-button` to determine if the button should be checked.
|
|
90
90
|
*/
|
|
91
91
|
this.ionSelect.emit({ value });
|
|
92
|
-
this.
|
|
92
|
+
if (this.scrollable) {
|
|
93
|
+
const buttons = this.getButtons();
|
|
94
|
+
const activeButton = buttons.find((button) => button.value === value);
|
|
95
|
+
if (activeButton !== undefined) {
|
|
96
|
+
/**
|
|
97
|
+
* Scrollable segment buttons should be
|
|
98
|
+
* centered within the view including
|
|
99
|
+
* buttons that are partially offscreen.
|
|
100
|
+
*/
|
|
101
|
+
activeButton.scrollIntoView({
|
|
102
|
+
behavior: 'smooth',
|
|
103
|
+
inline: 'center',
|
|
104
|
+
/**
|
|
105
|
+
* Segment should scroll on the
|
|
106
|
+
* horizontal axis. `block: 'nearest'`
|
|
107
|
+
* ensures that the vertical axis
|
|
108
|
+
* does not scroll if the segment
|
|
109
|
+
* as a whole is already in view.
|
|
110
|
+
*/
|
|
111
|
+
block: 'nearest',
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
93
115
|
}
|
|
94
116
|
disabledChanged() {
|
|
95
117
|
this.gestureChanged();
|
|
@@ -111,13 +133,6 @@ const Segment = class {
|
|
|
111
133
|
}
|
|
112
134
|
async componentDidLoad() {
|
|
113
135
|
this.setCheckedClasses();
|
|
114
|
-
/**
|
|
115
|
-
* We need to wait for the buttons to all be rendered
|
|
116
|
-
* before we can scroll.
|
|
117
|
-
*/
|
|
118
|
-
helpers.raf(() => {
|
|
119
|
-
this.scrollActiveButtonIntoView();
|
|
120
|
-
});
|
|
121
136
|
this.gesture = (await Promise.resolve().then(function () { return require('./index-0ee995e4.js'); })).createGesture({
|
|
122
137
|
el: this.el,
|
|
123
138
|
gestureName: 'segment',
|
|
@@ -246,32 +261,6 @@ const Segment = class {
|
|
|
246
261
|
buttons[next].classList.add('segment-button-after-checked');
|
|
247
262
|
}
|
|
248
263
|
}
|
|
249
|
-
scrollActiveButtonIntoView() {
|
|
250
|
-
const { scrollable, value } = this;
|
|
251
|
-
if (scrollable) {
|
|
252
|
-
const buttons = this.getButtons();
|
|
253
|
-
const activeButton = buttons.find((button) => button.value === value);
|
|
254
|
-
if (activeButton !== undefined) {
|
|
255
|
-
/**
|
|
256
|
-
* Scrollable segment buttons should be
|
|
257
|
-
* centered within the view including
|
|
258
|
-
* buttons that are partially offscreen.
|
|
259
|
-
*/
|
|
260
|
-
activeButton.scrollIntoView({
|
|
261
|
-
behavior: 'smooth',
|
|
262
|
-
inline: 'center',
|
|
263
|
-
/**
|
|
264
|
-
* Segment should scroll on the
|
|
265
|
-
* horizontal axis. `block: 'nearest'`
|
|
266
|
-
* ensures that the vertical axis
|
|
267
|
-
* does not scroll if the segment
|
|
268
|
-
* as a whole is already in view.
|
|
269
|
-
*/
|
|
270
|
-
block: 'nearest',
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
264
|
setNextIndex(detail, isEnd = false) {
|
|
276
265
|
const rtl = dir.isRTL(this.el);
|
|
277
266
|
const activated = this.activated;
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Build, Host, h } from "@stencil/core";
|
|
5
5
|
import { getTimeGivenProgression } from "../../utils/animation/cubic-bezier";
|
|
6
|
-
import { doc } from "../../utils/browser/index";
|
|
7
6
|
import { GESTURE_CONTROLLER } from "../../utils/gesture/index";
|
|
8
7
|
import { inheritAriaAttributes, assert, clamp, isEndSide as isEnd } from "../../utils/helpers";
|
|
9
8
|
import { menuController } from "../../utils/menu-controller/index";
|
|
@@ -540,17 +539,6 @@ export class Menu {
|
|
|
540
539
|
// close if this menu is open, and should not be enabled
|
|
541
540
|
this.forceClosing();
|
|
542
541
|
}
|
|
543
|
-
if (doc === null || doc === void 0 ? void 0 : doc.contains(this.el)) {
|
|
544
|
-
/**
|
|
545
|
-
* Only set the active menu if the menu element is
|
|
546
|
-
* present in the DOM. Otherwise if it was destructively
|
|
547
|
-
* re-hydrated (through Angular Universal), then ignore
|
|
548
|
-
* setting the removed node as the active menu.
|
|
549
|
-
*/
|
|
550
|
-
if (!this.disabled) {
|
|
551
|
-
menuController._setActiveMenu(this);
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
542
|
assert(!this.isAnimating, 'can not be animating');
|
|
555
543
|
}
|
|
556
544
|
forceClosing() {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
|
+
*/
|
|
4
|
+
import { expect } from "@playwright/test";
|
|
5
|
+
import { configs, test } from "../../../../utils/test/playwright/index";
|
|
6
|
+
/**
|
|
7
|
+
* This behavior does not vary across modes/directions
|
|
8
|
+
*/
|
|
9
|
+
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => {
|
|
10
|
+
test.describe(title('menu: multiple'), () => {
|
|
11
|
+
test.beforeEach(async ({ page }) => {
|
|
12
|
+
await page.goto(`/src/components/menu/test/multiple`, config);
|
|
13
|
+
});
|
|
14
|
+
test('should present each menu on the same side individually', async ({ page }) => {
|
|
15
|
+
const primaryMenu = page.locator('ion-menu#primary-menu');
|
|
16
|
+
const secondaryMenu = page.locator('ion-menu#secondary-menu');
|
|
17
|
+
await primaryMenu.evaluate((el) => el.open());
|
|
18
|
+
await expect(primaryMenu).toBeVisible();
|
|
19
|
+
await primaryMenu.evaluate((el) => el.close());
|
|
20
|
+
await expect(primaryMenu).toBeHidden();
|
|
21
|
+
await secondaryMenu.evaluate((el) => el.open());
|
|
22
|
+
await expect(secondaryMenu).toBeVisible();
|
|
23
|
+
await secondaryMenu.evaluate((el) => el.close());
|
|
24
|
+
await expect(secondaryMenu).toBeHidden();
|
|
25
|
+
});
|
|
26
|
+
test('should close first menu when showing another menu on same side', async ({ page }) => {
|
|
27
|
+
const primaryMenu = page.locator('ion-menu#primary-menu');
|
|
28
|
+
const secondaryMenu = page.locator('ion-menu#secondary-menu');
|
|
29
|
+
await primaryMenu.evaluate((el) => el.open());
|
|
30
|
+
await expect(primaryMenu).toBeVisible();
|
|
31
|
+
await secondaryMenu.evaluate((el) => el.open());
|
|
32
|
+
await expect(primaryMenu).toBeHidden();
|
|
33
|
+
await expect(secondaryMenu).toBeVisible();
|
|
34
|
+
});
|
|
35
|
+
test('passing side to the menuController when multiple menus have that side should result in a warning', async ({ page, }) => {
|
|
36
|
+
const logs = [];
|
|
37
|
+
page.on('console', (msg) => {
|
|
38
|
+
if (msg.type() === 'warning') {
|
|
39
|
+
logs.push(msg.text());
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
await page.evaluate(() => window.menuController.open('start'));
|
|
43
|
+
expect(logs.length).toBe(1);
|
|
44
|
+
});
|
|
45
|
+
test('passing side to the menuController when multiple disabled menus have that side should result in a warning', async ({ page, }) => {
|
|
46
|
+
const logs = [];
|
|
47
|
+
page.on('console', (msg) => {
|
|
48
|
+
if (msg.type() === 'warning') {
|
|
49
|
+
logs.push(msg.text());
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
await page.evaluate(() => window.menuController.open('end'));
|
|
53
|
+
expect(logs.length).toBe(1);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
3
|
*/
|
|
4
4
|
import { Host, h, writeTask } from "@stencil/core";
|
|
5
|
-
import { raf } from "../../utils/helpers";
|
|
6
5
|
import { isRTL } from "../../utils/rtl/index";
|
|
7
6
|
import { createColorClasses, hostContext } from "../../utils/theme";
|
|
8
7
|
import { getIonMode } from "../../global/ionic-global";
|
|
@@ -79,7 +78,29 @@ export class Segment {
|
|
|
79
78
|
* Used by `ion-segment-button` to determine if the button should be checked.
|
|
80
79
|
*/
|
|
81
80
|
this.ionSelect.emit({ value });
|
|
82
|
-
this.
|
|
81
|
+
if (this.scrollable) {
|
|
82
|
+
const buttons = this.getButtons();
|
|
83
|
+
const activeButton = buttons.find((button) => button.value === value);
|
|
84
|
+
if (activeButton !== undefined) {
|
|
85
|
+
/**
|
|
86
|
+
* Scrollable segment buttons should be
|
|
87
|
+
* centered within the view including
|
|
88
|
+
* buttons that are partially offscreen.
|
|
89
|
+
*/
|
|
90
|
+
activeButton.scrollIntoView({
|
|
91
|
+
behavior: 'smooth',
|
|
92
|
+
inline: 'center',
|
|
93
|
+
/**
|
|
94
|
+
* Segment should scroll on the
|
|
95
|
+
* horizontal axis. `block: 'nearest'`
|
|
96
|
+
* ensures that the vertical axis
|
|
97
|
+
* does not scroll if the segment
|
|
98
|
+
* as a whole is already in view.
|
|
99
|
+
*/
|
|
100
|
+
block: 'nearest',
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
83
104
|
}
|
|
84
105
|
disabledChanged() {
|
|
85
106
|
this.gestureChanged();
|
|
@@ -101,13 +122,6 @@ export class Segment {
|
|
|
101
122
|
}
|
|
102
123
|
async componentDidLoad() {
|
|
103
124
|
this.setCheckedClasses();
|
|
104
|
-
/**
|
|
105
|
-
* We need to wait for the buttons to all be rendered
|
|
106
|
-
* before we can scroll.
|
|
107
|
-
*/
|
|
108
|
-
raf(() => {
|
|
109
|
-
this.scrollActiveButtonIntoView();
|
|
110
|
-
});
|
|
111
125
|
this.gesture = (await import('../../utils/gesture')).createGesture({
|
|
112
126
|
el: this.el,
|
|
113
127
|
gestureName: 'segment',
|
|
@@ -236,32 +250,6 @@ export class Segment {
|
|
|
236
250
|
buttons[next].classList.add('segment-button-after-checked');
|
|
237
251
|
}
|
|
238
252
|
}
|
|
239
|
-
scrollActiveButtonIntoView() {
|
|
240
|
-
const { scrollable, value } = this;
|
|
241
|
-
if (scrollable) {
|
|
242
|
-
const buttons = this.getButtons();
|
|
243
|
-
const activeButton = buttons.find((button) => button.value === value);
|
|
244
|
-
if (activeButton !== undefined) {
|
|
245
|
-
/**
|
|
246
|
-
* Scrollable segment buttons should be
|
|
247
|
-
* centered within the view including
|
|
248
|
-
* buttons that are partially offscreen.
|
|
249
|
-
*/
|
|
250
|
-
activeButton.scrollIntoView({
|
|
251
|
-
behavior: 'smooth',
|
|
252
|
-
inline: 'center',
|
|
253
|
-
/**
|
|
254
|
-
* Segment should scroll on the
|
|
255
|
-
* horizontal axis. `block: 'nearest'`
|
|
256
|
-
* ensures that the vertical axis
|
|
257
|
-
* does not scroll if the segment
|
|
258
|
-
* as a whole is already in view.
|
|
259
|
-
*/
|
|
260
|
-
block: 'nearest',
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
253
|
setNextIndex(detail, isEnd = false) {
|
|
266
254
|
const rtl = isRTL(this.el);
|
|
267
255
|
const activated = this.activated;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { expect } from "@playwright/test";
|
|
5
5
|
import { configs, test } from "../../../../utils/test/playwright/index";
|
|
6
6
|
configs().forEach(({ title, screenshot, config }) => {
|
|
7
|
-
test.describe(title('segment: scrollable
|
|
7
|
+
test.describe(title('segment: scrollable'), () => {
|
|
8
8
|
test('should not have visual regressions', async ({ page }) => {
|
|
9
9
|
await page.setContent(`
|
|
10
10
|
<ion-segment scrollable="true" value="2">
|
|
@@ -42,55 +42,3 @@ configs().forEach(({ title, screenshot, config }) => {
|
|
|
42
42
|
});
|
|
43
43
|
});
|
|
44
44
|
});
|
|
45
|
-
configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
|
|
46
|
-
test.describe(title('segment: scrollable (functionality)'), () => {
|
|
47
|
-
test('should scroll active button into view when value is already set', async ({ page }) => {
|
|
48
|
-
await page.setContent(`
|
|
49
|
-
<ion-segment scrollable="true" value="8">
|
|
50
|
-
<ion-segment-button value="1">
|
|
51
|
-
<ion-label>First</ion-label>
|
|
52
|
-
</ion-segment-button>
|
|
53
|
-
<ion-segment-button value="2">
|
|
54
|
-
<ion-label>Second</ion-label>
|
|
55
|
-
</ion-segment-button>
|
|
56
|
-
<ion-segment-button value="3">
|
|
57
|
-
<ion-label>Third</ion-label>
|
|
58
|
-
</ion-segment-button>
|
|
59
|
-
<ion-segment-button value="4">
|
|
60
|
-
<ion-label>Fourth</ion-label>
|
|
61
|
-
</ion-segment-button>
|
|
62
|
-
<ion-segment-button value="5">
|
|
63
|
-
<ion-label>Fifth</ion-label>
|
|
64
|
-
</ion-segment-button>
|
|
65
|
-
<ion-segment-button value="6">
|
|
66
|
-
<ion-label>Sixth</ion-label>
|
|
67
|
-
</ion-segment-button>
|
|
68
|
-
<ion-segment-button value="7">
|
|
69
|
-
<ion-label>Seventh</ion-label>
|
|
70
|
-
</ion-segment-button>
|
|
71
|
-
<ion-segment-button id="activeButton" value="8">
|
|
72
|
-
<ion-label>Eighth</ion-label>
|
|
73
|
-
</ion-segment-button>
|
|
74
|
-
<ion-segment-button value="9">
|
|
75
|
-
<ion-label>Ninth</ion-label>
|
|
76
|
-
</ion-segment-button>
|
|
77
|
-
</ion-segment>
|
|
78
|
-
`, config);
|
|
79
|
-
const activeButton = page.locator('#activeButton');
|
|
80
|
-
// wait for segment to scroll, which is done in a raf
|
|
81
|
-
await page.waitForTimeout(500);
|
|
82
|
-
/**
|
|
83
|
-
* We can't use toBeVisible() here because it returns true
|
|
84
|
-
* even if the element is outside the viewport.
|
|
85
|
-
*/
|
|
86
|
-
const box = await activeButton.boundingBox();
|
|
87
|
-
const viewport = page.viewportSize();
|
|
88
|
-
let isInViewport = false;
|
|
89
|
-
if (box && viewport) {
|
|
90
|
-
isInViewport =
|
|
91
|
-
box.x >= 0 && box.y >= 0 && box.x + box.width <= viewport.width && box.y + box.height <= viewport.height;
|
|
92
|
-
}
|
|
93
|
-
expect(isInViewport).toBe(true);
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
});
|