@ionic/angular 8.2.8 → 8.3.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/common/directives/navigation/tabs.d.ts +10 -3
- package/directives/navigation/ion-tabs.d.ts +3 -2
- package/directives/proxies-list.d.ts +1 -1
- package/directives/proxies.d.ts +9 -0
- package/esm2022/app-initialize.mjs +2 -2
- package/esm2022/common/directives/navigation/tabs.mjs +58 -1
- package/esm2022/directives/navigation/ion-tabs.mjs +14 -5
- package/esm2022/directives/proxies-list.mjs +2 -1
- package/esm2022/directives/proxies.mjs +29 -1
- package/esm2022/ionic-module.mjs +2 -2
- package/esm2022/standalone/directives/proxies.mjs +32 -1
- package/esm2022/standalone/navigation/tabs.mjs +14 -5
- package/fesm2022/ionic-angular-common.mjs +57 -0
- package/fesm2022/ionic-angular-common.mjs.map +1 -1
- package/fesm2022/ionic-angular-standalone.mjs +82 -44
- package/fesm2022/ionic-angular-standalone.mjs.map +1 -1
- package/fesm2022/ionic-angular.mjs +42 -6
- package/fesm2022/ionic-angular.mjs.map +1 -1
- package/ionic-module.d.ts +1 -1
- package/package.json +2 -2
- package/standalone/directives/proxies.d.ts +9 -0
- package/standalone/navigation/tabs.d.ts +3 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { NgIf } from '@angular/common';
|
|
1
2
|
import { Component, ContentChild, ContentChildren, ViewChild } from '@angular/core';
|
|
2
3
|
import { IonTabs as IonTabsBase } from '@ionic/angular/common';
|
|
3
|
-
import { IonTabBar } from '../directives/proxies';
|
|
4
|
+
import { IonTabBar, IonTab } from '../directives/proxies';
|
|
4
5
|
import { IonRouterOutlet } from './router-outlet';
|
|
5
6
|
import * as i0 from "@angular/core";
|
|
6
7
|
// eslint-disable-next-line @angular-eslint/component-class-suffix
|
|
@@ -8,19 +9,22 @@ export class IonTabs extends IonTabsBase {
|
|
|
8
9
|
outlet;
|
|
9
10
|
tabBar;
|
|
10
11
|
tabBars;
|
|
12
|
+
tabs;
|
|
11
13
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: IonTabs, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
12
|
-
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: IonTabs, isStandalone: true, selector: "ion-tabs", queries: [{ propertyName: "tabBar", first: true, predicate: IonTabBar, descendants: true }, { propertyName: "tabBars", predicate: IonTabBar }], viewQueries: [{ propertyName: "outlet", first: true, predicate: ["outlet"], descendants: true, read: IonRouterOutlet }], usesInheritance: true, ngImport: i0, template: `
|
|
14
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: IonTabs, isStandalone: true, selector: "ion-tabs", queries: [{ propertyName: "tabBar", first: true, predicate: IonTabBar, descendants: true }, { propertyName: "tabBars", predicate: IonTabBar }, { propertyName: "tabs", predicate: IonTab }], viewQueries: [{ propertyName: "outlet", first: true, predicate: ["outlet"], descendants: true, read: IonRouterOutlet }], usesInheritance: true, ngImport: i0, template: `
|
|
13
15
|
<ng-content select="[slot=top]"></ng-content>
|
|
14
16
|
<div class="tabs-inner" #tabsInner>
|
|
15
17
|
<ion-router-outlet
|
|
18
|
+
*ngIf="tabs.length === 0"
|
|
16
19
|
#outlet
|
|
17
20
|
tabs="true"
|
|
18
21
|
(stackWillChange)="onStackWillChange($event)"
|
|
19
22
|
(stackDidChange)="onStackDidChange($event)"
|
|
20
23
|
></ion-router-outlet>
|
|
24
|
+
<ng-content *ngIf="tabs.length > 0" select="ion-tab"></ng-content>
|
|
21
25
|
</div>
|
|
22
26
|
<ng-content></ng-content>
|
|
23
|
-
`, isInline: true, styles: [":host{display:flex;position:absolute;inset:0;flex-direction:column;width:100%;height:100%;contain:layout size style}.tabs-inner{position:relative;flex:1;contain:layout size style}\n"], dependencies: [{ kind: "component", type: IonRouterOutlet, selector: "ion-router-outlet" }] });
|
|
27
|
+
`, isInline: true, styles: [":host{display:flex;position:absolute;inset:0;flex-direction:column;width:100%;height:100%;contain:layout size style}.tabs-inner{position:relative;flex:1;contain:layout size style}\n"], dependencies: [{ kind: "component", type: IonRouterOutlet, selector: "ion-router-outlet" }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
24
28
|
}
|
|
25
29
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: IonTabs, decorators: [{
|
|
26
30
|
type: Component,
|
|
@@ -28,14 +32,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
28
32
|
<ng-content select="[slot=top]"></ng-content>
|
|
29
33
|
<div class="tabs-inner" #tabsInner>
|
|
30
34
|
<ion-router-outlet
|
|
35
|
+
*ngIf="tabs.length === 0"
|
|
31
36
|
#outlet
|
|
32
37
|
tabs="true"
|
|
33
38
|
(stackWillChange)="onStackWillChange($event)"
|
|
34
39
|
(stackDidChange)="onStackDidChange($event)"
|
|
35
40
|
></ion-router-outlet>
|
|
41
|
+
<ng-content *ngIf="tabs.length > 0" select="ion-tab"></ng-content>
|
|
36
42
|
</div>
|
|
37
43
|
<ng-content></ng-content>
|
|
38
|
-
`, standalone: true, imports: [IonRouterOutlet], styles: [":host{display:flex;position:absolute;inset:0;flex-direction:column;width:100%;height:100%;contain:layout size style}.tabs-inner{position:relative;flex:1;contain:layout size style}\n"] }]
|
|
44
|
+
`, standalone: true, imports: [IonRouterOutlet, NgIf], styles: [":host{display:flex;position:absolute;inset:0;flex-direction:column;width:100%;height:100%;contain:layout size style}.tabs-inner{position:relative;flex:1;contain:layout size style}\n"] }]
|
|
39
45
|
}], propDecorators: { outlet: [{
|
|
40
46
|
type: ViewChild,
|
|
41
47
|
args: ['outlet', { read: IonRouterOutlet, static: false }]
|
|
@@ -45,5 +51,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
45
51
|
}], tabBars: [{
|
|
46
52
|
type: ContentChildren,
|
|
47
53
|
args: [IonTabBar]
|
|
54
|
+
}], tabs: [{
|
|
55
|
+
type: ContentChildren,
|
|
56
|
+
args: [IonTab]
|
|
48
57
|
}] } });
|
|
49
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
58
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFicy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3N0YW5kYWxvbmUvc3JjL25hdmlnYXRpb24vdGFicy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsSUFBSSxFQUFFLE1BQU0saUJBQWlCLENBQUM7QUFDdkMsT0FBTyxFQUFFLFNBQVMsRUFBRSxZQUFZLEVBQUUsZUFBZSxFQUFFLFNBQVMsRUFBYSxNQUFNLGVBQWUsQ0FBQztBQUMvRixPQUFPLEVBQUUsT0FBTyxJQUFJLFdBQVcsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRS9ELE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFFMUQsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLGlCQUFpQixDQUFDOztBQStDbEQsa0VBQWtFO0FBQ2xFLE1BQU0sT0FBTyxPQUFRLFNBQVEsV0FBVztJQUN5QixNQUFNLENBQWtCO0lBRTNDLE1BQU0sQ0FBd0I7SUFDOUMsT0FBTyxDQUF1QjtJQUNqQyxJQUFJLENBQW9COzJIQUx0QyxPQUFPOytHQUFQLE9BQU8sd0dBR0osU0FBUyw2REFDTixTQUFTLHVDQUNULE1BQU0sMEdBSk0sZUFBZSxvREE3Q2xDOzs7Ozs7Ozs7Ozs7O0dBYVQ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LWlubmVyXCIgI3RhYnNJbm5lcj5cbiAgICAgIDxpb24tcm91dGVyLW91dGxldFxuICAgICAgICAqbmdJZj1cInRhYnMubGVuZ3RoID09PSAwXCJcbiAgICAgICAgI291dGxldFxuICAgICAgICB0YWJzPVwidHJ1ZVwiXG4gICAgICAgIChzdGFja1dpbGxDaGFuZ2UpPVwib25TdGFja1dpbGxDaGFuZ2UoJGV2ZW50KVwiXG4gICAgICAgIChzdGFja0RpZENoYW5nZSk9XCJvblN0YWNrRGlkQ2hhbmdlKCRldmVudClcIlxuICAgICAgPjwvaW9uLXJvdXRlci1vdXRsZXQ+XG4gICAgICA8bmctY29udGVudCAqbmdJZj1cInRhYnMubGVuZ3RoID4gMFwiIHNlbGVjdD1cImlvbi10YWJcIj48L25nLWNvbnRlbnQ+XG4gICAgPC9kaXY+XG4gICAgPG5nLWNvbnRlbnQ+PC9uZy1jb250ZW50PlxuICBgLFxuICBzdGFuZGFsb25lOiB0cnVlLFxuICBzdHlsZXM6IFtcbiAgICBgXG4gICAgICA6aG9zdCB7XG4gICAgICAgIGRpc3BsYXk6IGZsZXg7XG4gICAgICAgIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgICAgICAgdG9wOiAwO1xuICAgICAgICBsZWZ0OiAwO1xuICAgICAgICByaWdodDogMDtcbiAgICAgICAgYm90dG9tOiAwO1xuXG4gICAgICAgIGZsZXgtZGlyZWN0aW9uOiBjb2x1bW47XG5cbiAgICAgICAgd2lkdGg6IDEwMCU7XG4gICAgICAgIGhlaWdodDogMTAwJTtcblxuICAgICAgICBjb250YWluOiBsYXlvdXQgc2l6ZSBzdHlsZTtcbiAgICAgIH1cbiAgICAgIC50YWJzLWlubmVyIHtcbiAgICAgICAgcG9zaXRpb246IHJlbGF0aXZlO1xuXG4gICAgICAgIGZsZXg6IDE7XG5cbiAgICAgICAgY29udGFpbjogbGF5b3V0IHNpemUgc3R5bGU7XG4gICAgICB9XG4gICAgYCxcbiAgXSxcbiAgaW1wb3J0czogW0lvblJvdXRlck91dGxldCwgTmdJZl0sXG59KVxuLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEBhbmd1bGFyLWVzbGludC9jb21wb25lbnQtY2xhc3Mtc3VmZml4XG5leHBvcnQgY2xhc3MgSW9uVGFicyBleHRlbmRzIElvblRhYnNCYXNlIHtcbiAgQFZpZXdDaGlsZCgnb3V0bGV0JywgeyByZWFkOiBJb25Sb3V0ZXJPdXRsZXQsIHN0YXRpYzogZmFsc2UgfSkgb3V0bGV0OiBJb25Sb3V0ZXJPdXRsZXQ7XG5cbiAgQENvbnRlbnRDaGlsZChJb25UYWJCYXIsIHsgc3RhdGljOiBmYWxzZSB9KSB0YWJCYXI6IElvblRhYkJhciB8IHVuZGVmaW5lZDtcbiAgQENvbnRlbnRDaGlsZHJlbihJb25UYWJCYXIpIHRhYkJhcnM6IFF1ZXJ5TGlzdDxJb25UYWJCYXI+O1xuICBAQ29udGVudENoaWxkcmVuKElvblRhYikgdGFiczogUXVlcnlMaXN0PElvblRhYj47XG59XG4iXX0=
|
|
@@ -2201,9 +2201,27 @@ class IonTabs {
|
|
|
2201
2201
|
*/
|
|
2202
2202
|
ionTabsDidChange = new EventEmitter();
|
|
2203
2203
|
tabBarSlot = 'bottom';
|
|
2204
|
+
hasTab = false;
|
|
2205
|
+
selectedTab;
|
|
2206
|
+
leavingTab;
|
|
2204
2207
|
constructor(navCtrl) {
|
|
2205
2208
|
this.navCtrl = navCtrl;
|
|
2206
2209
|
}
|
|
2210
|
+
ngAfterViewInit() {
|
|
2211
|
+
/**
|
|
2212
|
+
* Developers must pass at least one ion-tab
|
|
2213
|
+
* inside of ion-tabs if they want to use a
|
|
2214
|
+
* basic tab-based navigation without the
|
|
2215
|
+
* history stack or URL updates associated
|
|
2216
|
+
* with the router.
|
|
2217
|
+
*/
|
|
2218
|
+
const firstTab = this.tabs.length > 0 ? this.tabs.first : undefined;
|
|
2219
|
+
if (firstTab) {
|
|
2220
|
+
this.hasTab = true;
|
|
2221
|
+
this.setActiveTab(firstTab.tab);
|
|
2222
|
+
this.tabSwitch();
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2207
2225
|
ngAfterContentInit() {
|
|
2208
2226
|
this.detectSlotChanges();
|
|
2209
2227
|
}
|
|
@@ -2254,6 +2272,16 @@ class IonTabs {
|
|
|
2254
2272
|
select(tabOrEvent) {
|
|
2255
2273
|
const isTabString = typeof tabOrEvent === 'string';
|
|
2256
2274
|
const tab = isTabString ? tabOrEvent : tabOrEvent.detail.tab;
|
|
2275
|
+
/**
|
|
2276
|
+
* If the tabs are not using the router, then
|
|
2277
|
+
* the tab switch logic is handled by the tabs
|
|
2278
|
+
* component itself.
|
|
2279
|
+
*/
|
|
2280
|
+
if (this.hasTab) {
|
|
2281
|
+
this.setActiveTab(tab);
|
|
2282
|
+
this.tabSwitch();
|
|
2283
|
+
return;
|
|
2284
|
+
}
|
|
2257
2285
|
const alreadySelected = this.outlet.getActiveStackId() === tab;
|
|
2258
2286
|
const tabRootUrl = `${this.outlet.tabsPrefix}/${tab}`;
|
|
2259
2287
|
/**
|
|
@@ -2295,7 +2323,36 @@ class IonTabs {
|
|
|
2295
2323
|
});
|
|
2296
2324
|
}
|
|
2297
2325
|
}
|
|
2326
|
+
setActiveTab(tab) {
|
|
2327
|
+
const tabs = this.tabs;
|
|
2328
|
+
const selectedTab = tabs.find((t) => t.tab === tab);
|
|
2329
|
+
if (!selectedTab) {
|
|
2330
|
+
console.error(`[Ionic Error]: Tab with id: "${tab}" does not exist`);
|
|
2331
|
+
return;
|
|
2332
|
+
}
|
|
2333
|
+
this.leavingTab = this.selectedTab;
|
|
2334
|
+
this.selectedTab = selectedTab;
|
|
2335
|
+
this.ionTabsWillChange.emit({ tab });
|
|
2336
|
+
selectedTab.el.active = true;
|
|
2337
|
+
}
|
|
2338
|
+
tabSwitch() {
|
|
2339
|
+
const { selectedTab, leavingTab } = this;
|
|
2340
|
+
if (this.tabBar && selectedTab) {
|
|
2341
|
+
this.tabBar.selectedTab = selectedTab.tab;
|
|
2342
|
+
}
|
|
2343
|
+
if (leavingTab?.tab !== selectedTab?.tab) {
|
|
2344
|
+
if (leavingTab?.el) {
|
|
2345
|
+
leavingTab.el.active = false;
|
|
2346
|
+
}
|
|
2347
|
+
}
|
|
2348
|
+
if (selectedTab) {
|
|
2349
|
+
this.ionTabsDidChange.emit({ tab: selectedTab.tab });
|
|
2350
|
+
}
|
|
2351
|
+
}
|
|
2298
2352
|
getSelected() {
|
|
2353
|
+
if (this.hasTab) {
|
|
2354
|
+
return this.selectedTab?.tab;
|
|
2355
|
+
}
|
|
2299
2356
|
return this.outlet.getActiveStackId();
|
|
2300
2357
|
}
|
|
2301
2358
|
/**
|