@nativescript-community/ui-material-tabs 7.2.38 → 7.2.41
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/angular/index.d.ts +10 -0
- package/index.android.d.ts +22 -0
- package/index.android.js +117 -0
- package/index.android.js.map +1 -0
- package/index.d.ts +89 -0
- package/index.ios.d.ts +31 -0
- package/index.ios.js +237 -0
- package/index.ios.js.map +1 -0
- package/package.json +16 -4
- package/react/index.d.ts +38 -0
- package/react/index.js +81 -0
- package/react/index.js.map +1 -0
- package/vue/component.d.ts +12 -0
- package/vue/component.js +22 -0
- package/vue/component.js.map +1 -0
- package/vue/index.d.ts +4 -0
- package/vue/index.js +20 -0
- package/vue/index.js.map +1 -0
@@ -0,0 +1,10 @@
|
|
1
|
+
import * as i0 from "@angular/core";
|
2
|
+
export declare class MaterialTabsDirective {
|
3
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MaterialTabsDirective, never>;
|
4
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MaterialTabsDirective, "MDTabs", never, {}, {}, never, never, false, never>;
|
5
|
+
}
|
6
|
+
export declare class NativeScriptMaterialTabsModule {
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NativeScriptMaterialTabsModule, never>;
|
8
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<NativeScriptMaterialTabsModule, [typeof MaterialTabsDirective], never, [typeof MaterialTabsDirective]>;
|
9
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<NativeScriptMaterialTabsModule>;
|
10
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { TabContentItem } from '@nativescript-community/ui-material-core-tabs/tab-content-item';
|
2
|
+
import { TabNavigation } from '@nativescript-community/ui-material-core-tabs/tab-navigation/index.android';
|
3
|
+
import { TabStrip } from '@nativescript-community/ui-material-core-tabs/tab-strip';
|
4
|
+
import { TabStripItem } from '@nativescript-community/ui-material-core-tabs/tab-strip-item';
|
5
|
+
export { TabContentItem, TabStrip, TabStripItem };
|
6
|
+
interface TabsBar extends com.nativescript.material.core.TabsBar {
|
7
|
+
new (context: android.content.Context, owner: Tabs): TabsBar;
|
8
|
+
onSelectedPositionChange(position: number, prevPosition: number): void;
|
9
|
+
}
|
10
|
+
declare let TabsBar: TabsBar;
|
11
|
+
export declare class Tabs extends TabNavigation<TabsBar> {
|
12
|
+
createNativeView(): org.nativescript.widgets.GridLayout;
|
13
|
+
protected updateTabsBarItemAt(position: number, itemSpec: com.nativescript.material.core.TabItemSpec): void;
|
14
|
+
protected setTabsBarSelectedIndicatorColors(colors: number[]): void;
|
15
|
+
protected getTabBarItemView(index: number): globalAndroid.widget.LinearLayout;
|
16
|
+
protected getTabBarItemTextView(index: number): globalAndroid.widget.TextView;
|
17
|
+
protected createNativeTabBar(context: android.content.Context): TabsBar;
|
18
|
+
protected setTabBarItems(tabItems: com.nativescript.material.core.TabItemSpec[]): void;
|
19
|
+
protected selectTabBar(oldIndex: number, newIndex: number): void;
|
20
|
+
protected setTabStripItems(items: TabStripItem[]): void;
|
21
|
+
onLoaded(): void;
|
22
|
+
}
|
package/index.android.js
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
import { TabContentItem } from '@nativescript-community/ui-material-core-tabs/tab-content-item';
|
2
|
+
import { PRIMARY_COLOR, TabNavigation, getDefaultAccentColor } from '@nativescript-community/ui-material-core-tabs/tab-navigation/index.android';
|
3
|
+
import { TabStrip } from '@nativescript-community/ui-material-core-tabs/tab-strip';
|
4
|
+
import { TabStripItem } from '@nativescript-community/ui-material-core-tabs/tab-strip-item';
|
5
|
+
import { CSSType, Utils } from '@nativescript/core';
|
6
|
+
export { TabContentItem, TabStrip, TabStripItem };
|
7
|
+
// eslint-disable-next-line no-redeclare
|
8
|
+
let TabsBar;
|
9
|
+
function initializeNativeClasses() {
|
10
|
+
if (TabsBar) {
|
11
|
+
return;
|
12
|
+
}
|
13
|
+
var TabsBarImplementation = /** @class */ (function (_super) {
|
14
|
+
__extends(TabsBarImplementation, _super);
|
15
|
+
function TabsBarImplementation(context, owner) {
|
16
|
+
var _this = _super.call(this, context) || this;
|
17
|
+
_this.owner = owner;
|
18
|
+
return global.__native(_this);
|
19
|
+
}
|
20
|
+
TabsBarImplementation.prototype.onSelectedPositionChange = function (position, prevPosition) {
|
21
|
+
var owner = this.owner;
|
22
|
+
if (!owner) {
|
23
|
+
return;
|
24
|
+
}
|
25
|
+
owner.onTabsBarSelectedPositionChange(position, prevPosition);
|
26
|
+
};
|
27
|
+
TabsBarImplementation.prototype.onTap = function (position) {
|
28
|
+
var owner = this.owner;
|
29
|
+
if (!owner) {
|
30
|
+
return false;
|
31
|
+
}
|
32
|
+
return owner.onTabsBarTap(position);
|
33
|
+
};
|
34
|
+
return TabsBarImplementation;
|
35
|
+
}(com.nativescript.material.core.TabsBar));
|
36
|
+
TabsBar = TabsBarImplementation;
|
37
|
+
}
|
38
|
+
let Tabs = class Tabs extends TabNavigation {
|
39
|
+
createNativeView() {
|
40
|
+
const view = super.createNativeView();
|
41
|
+
if (this.mTabsBar) {
|
42
|
+
this.mTabsBar.setViewPager(this.mViewPager);
|
43
|
+
}
|
44
|
+
return view;
|
45
|
+
}
|
46
|
+
updateTabsBarItemAt(position, itemSpec) {
|
47
|
+
this.mTabsBar.updateItemAt(position, itemSpec);
|
48
|
+
}
|
49
|
+
setTabsBarSelectedIndicatorColors(colors) {
|
50
|
+
this.mTabsBar.setSelectedIndicatorColors(colors);
|
51
|
+
}
|
52
|
+
getTabBarItemView(index) {
|
53
|
+
return this.mTabsBar.getViewForItemAt(index);
|
54
|
+
}
|
55
|
+
getTabBarItemTextView(index) {
|
56
|
+
return this.mTabsBar.getTextViewForItemAt(index);
|
57
|
+
}
|
58
|
+
createNativeTabBar(context) {
|
59
|
+
initializeNativeClasses();
|
60
|
+
const tabsBar = new TabsBar(context, this);
|
61
|
+
tabsBar.setViewPager(this.mViewPager);
|
62
|
+
const primaryColor = Utils.android.resources.getPaletteColor(PRIMARY_COLOR, context);
|
63
|
+
const accentColor = getDefaultAccentColor(context);
|
64
|
+
if (accentColor) {
|
65
|
+
tabsBar.setSelectedIndicatorColors([accentColor]);
|
66
|
+
}
|
67
|
+
if (primaryColor) {
|
68
|
+
tabsBar.setBackgroundColor(primaryColor);
|
69
|
+
}
|
70
|
+
tabsBar.setSelectedPosition(this.selectedIndex);
|
71
|
+
return tabsBar;
|
72
|
+
}
|
73
|
+
setTabBarItems(tabItems) {
|
74
|
+
this.mTabsBar.setItems(tabItems);
|
75
|
+
// The setTimeout below is necessary to ensure the scrollToTab is executed only after
|
76
|
+
// all tabs are recreated. The tabs' recreation is triggered by the setItems call above.
|
77
|
+
//
|
78
|
+
// The setTimeout is necessary to fix an Android issue:
|
79
|
+
// Android Issue: Active Tab item not displaying after nav back
|
80
|
+
// Reproduce steps:
|
81
|
+
// 1. On app with multiple (overflown) tab items, Switch to the last tab item
|
82
|
+
// 2. Navigate to a new page
|
83
|
+
// 3. Nav back to the page with Tabs
|
84
|
+
// 4. Notice the active last tab item is not showing. The tab strip is showing the most left / initial tab items instead.
|
85
|
+
setTimeout(() => {
|
86
|
+
this.mTabsBar.scrollToTab(this.selectedIndex);
|
87
|
+
}, 0);
|
88
|
+
}
|
89
|
+
selectTabBar(oldIndex, newIndex) {
|
90
|
+
this.mTabsBar.setSelectedPosition(newIndex);
|
91
|
+
}
|
92
|
+
setTabStripItems(items) {
|
93
|
+
if (items?.length > 0 && !this.mUnSelectedItemColor) {
|
94
|
+
items.some((item) => {
|
95
|
+
const color = item.label?.style.color;
|
96
|
+
if (color) {
|
97
|
+
this.mUnSelectedItemColor = color;
|
98
|
+
return true;
|
99
|
+
}
|
100
|
+
return false;
|
101
|
+
});
|
102
|
+
}
|
103
|
+
super.setTabStripItems(items);
|
104
|
+
}
|
105
|
+
onLoaded() {
|
106
|
+
super.onLoaded();
|
107
|
+
if (!this.tabStrip && this.mTabsBar) {
|
108
|
+
// manually set the visibility, so that the grid layout remeasures
|
109
|
+
this.mTabsBar.setVisibility(android.view.View.GONE);
|
110
|
+
}
|
111
|
+
}
|
112
|
+
};
|
113
|
+
Tabs = __decorate([
|
114
|
+
CSSType('Tabs')
|
115
|
+
], Tabs);
|
116
|
+
export { Tabs };
|
117
|
+
//# sourceMappingURL=index.android.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.android.js","sourceRoot":"","sources":["../../src/tabs/index.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gEAAgE,CAAC;AAChG,OAAO,EAAE,aAAa,EAAmB,aAAa,EAAE,qBAAqB,EAAE,MAAM,4EAA4E,CAAC;AAClK,OAAO,EAAE,QAAQ,EAAE,MAAM,yDAAyD,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAC;AAC5F,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;AAOlD,wCAAwC;AACxC,IAAI,OAAgB,CAAC;AAErB,SAAS,uBAAuB;IAC5B,IAAI,OAAO,EAAE;QACT,OAAO;KACV;;;;;;;;;;;;;;;;;;;;;;;;IA0BD,OAAO,GAAG,qBAA4B,CAAC;AAC3C,CAAC;AAGM,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,aAAsB;IAC5B,gBAAgB;QAC5B,MAAM,IAAI,GAAG,KAAK,CAAC,gBAAgB,EAAE,CAAC;QACtC,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SAC/C;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IACkB,mBAAmB,CAAC,QAAgB,EAAE,QAAoD;QACzG,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACnD,CAAC;IACkB,iCAAiC,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AI,CAAC,aAAa,CAAC,CAAC;QAClD,CAAC,EAAE,CAAC,CAAC,CAAC;IACV,CAAC;IAEkB,YAAY,CAAC,QAAgB,EAAE,QAAgB;QAC9D,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC;IAEkB,gBAAgB,CAAC,KAAqB;QACrD,IAAI,KAAK,EAAE,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE;YACjD,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;gBAChB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;gBACtC,IAAI,KAAK,EAAE;oBACP,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC;oBAClC,OAAO,IAAI,CAAC;iBACf;gBACD,OAAO,KAAK,CAAC;YACjB,CAAC,CAAC,CAAC;SACN;QACD,KAAK,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAEe,QAAQ;QACpB,KAAK,CAAC,QAAQ,EAAE,CAAC;QAEjB,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjC,kEAAkE;YAClE,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACvD;IACL,CAAC;CACJ,CAAA;AAhFY,IAAI;IADhB,OAAO,CAAC,MAAM,CAAC;GACH,IAAI,CAgFhB"}
|
package/index.d.ts
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
/**
|
2
|
+
* Contains the Tabs class, which represents a tab navigation component.
|
3
|
+
* @module @nativescript-community/ui-material-tabs
|
4
|
+
*/
|
5
|
+
|
6
|
+
import { Property } from '@nativescript/core';
|
7
|
+
import { TabNavigationBase } from '@nativescript-community/ui-material-core-tabs/tab-navigation-base';
|
8
|
+
import { TabContentItem } from '@nativescript-community/ui-material-core-tabs/tab-content-item';
|
9
|
+
import { TabStrip } from '@nativescript-community/ui-material-core-tabs/tab-strip';
|
10
|
+
import { TabStripItem } from '@nativescript-community/ui-material-core-tabs/tab-strip-item';
|
11
|
+
export { TabContentItem, TabStrip, TabStripItem };
|
12
|
+
/**
|
13
|
+
* Represents a swipeable tabs view.
|
14
|
+
*/
|
15
|
+
export class Tabs extends TabNavigationBase {
|
16
|
+
/**
|
17
|
+
* Gets or sets the items of the Tabs.
|
18
|
+
*/
|
19
|
+
items: TabContentItem[];
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Gets or sets the tab strip of the Tabs.
|
23
|
+
*/
|
24
|
+
tabStrip: TabStrip;
|
25
|
+
|
26
|
+
/**
|
27
|
+
*
|
28
|
+
* Gets or sets the selectedIndex of the Tabs.
|
29
|
+
*/
|
30
|
+
selectedIndex: number;
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Gets or sets the swipe enabled state of the Tabs.
|
34
|
+
*/
|
35
|
+
swipeEnabled: boolean;
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Gets or sets the number of offscreen preloaded tabs of the Tabs.
|
39
|
+
*/
|
40
|
+
offscreenTabLimit: number;
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Gets or sets the position state of the Tabs.
|
44
|
+
*/
|
45
|
+
tabsPosition: 'top' | 'bottom';
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Allow custom positioning of Tabs within another view
|
49
|
+
*/
|
50
|
+
public iosCustomPositioning?: boolean;
|
51
|
+
|
52
|
+
/**
|
53
|
+
* Gets or set the MDCTabBarAlignment of the tab bar icons in iOS. Defaults to "justified"
|
54
|
+
* Valid values are:
|
55
|
+
* - leading
|
56
|
+
* - justified
|
57
|
+
* - center
|
58
|
+
* - centerSelected
|
59
|
+
*/
|
60
|
+
// iOSTabBarItemsAlignment: IOSTabBarItemsAlignment;
|
61
|
+
|
62
|
+
/**
|
63
|
+
* Gets the native [android widget](http://developer.android.com/reference/android/support/v4/view/ViewPager.html) that represents the user interface for this component. Valid only when running on Android OS.
|
64
|
+
*/
|
65
|
+
android: any /* android.view.View */; //android.support.v4.view.ViewPager;
|
66
|
+
|
67
|
+
/**
|
68
|
+
* Gets the native iOS [UITabBarController](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITabBarController_Class/) that represents the user interface for this component. Valid only when running on iOS.
|
69
|
+
*/
|
70
|
+
ios: any /* UITabBarController */;
|
71
|
+
|
72
|
+
/**
|
73
|
+
* String value used when hooking to the selectedIndexChanged event.
|
74
|
+
*/
|
75
|
+
public static selectedIndexChangedEvent: string;
|
76
|
+
}
|
77
|
+
|
78
|
+
export const itemsProperty: Property<Tabs, TabContentItem[]>;
|
79
|
+
export const tabStripProperty: Property<Tabs, TabStrip>;
|
80
|
+
export const selectedIndexProperty: Property<Tabs, number>;
|
81
|
+
|
82
|
+
/**
|
83
|
+
* IOS Alignment of the Tabs TabStrip to use.
|
84
|
+
* - `leading` - tab items are aligned to the left
|
85
|
+
* - `justified` - tab strip is split equally to all the tab items
|
86
|
+
* - `center` - tabs items are aligned in the center
|
87
|
+
* - `centerSelected` - tab items move to make the selected tab in the center
|
88
|
+
*/
|
89
|
+
export type IOSTabBarItemsAlignment = 'leading' | 'justified' | 'center' | 'centerSelected';
|
package/index.ios.d.ts
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
import { TabContentItem } from '@nativescript-community/ui-material-core-tabs/tab-content-item';
|
2
|
+
import { TabNavigation } from '@nativescript-community/ui-material-core-tabs/tab-navigation/index.ios';
|
3
|
+
import { TabStrip } from '@nativescript-community/ui-material-core-tabs/tab-strip';
|
4
|
+
import { TabStripItem } from '@nativescript-community/ui-material-core-tabs/tab-strip-item';
|
5
|
+
export { TabContentItem, TabStrip, TabStripItem };
|
6
|
+
declare class MDCTabBarViewDelegateImpl extends NSObject implements MDCTabBarViewDelegate {
|
7
|
+
static ObjCProtocols: {
|
8
|
+
prototype: MDCTabBarViewDelegate;
|
9
|
+
}[];
|
10
|
+
private _owner;
|
11
|
+
static initWithOwner(owner: WeakRef<Tabs>): MDCTabBarViewDelegateImpl;
|
12
|
+
tabBarViewShouldSelectItem(tabBar: MDCTabBarView, item: UITabBarItem): boolean;
|
13
|
+
tabBarViewDidSelectItem(tabBar: MDCTabBarView, selectedItem: UITabBarItem): void;
|
14
|
+
}
|
15
|
+
declare class UIPageViewControllerImpl extends UIPageViewController {
|
16
|
+
tabBar: MDCTabBarView;
|
17
|
+
scrollView: UIScrollView;
|
18
|
+
tabBarDelegate: MDCTabBarViewDelegateImpl;
|
19
|
+
private _owner;
|
20
|
+
static initWithOwner(owner: WeakRef<Tabs>): UIPageViewControllerImpl;
|
21
|
+
accessibilityScroll(direction: UIAccessibilityScrollDirection): boolean;
|
22
|
+
viewDidLoad(): void;
|
23
|
+
viewDidUnload(): void;
|
24
|
+
viewWillAppear(animated: boolean): void;
|
25
|
+
viewDidLayoutSubviews(): void;
|
26
|
+
traitCollectionDidChange(previousTraitCollection: UITraitCollection): void;
|
27
|
+
viewWillTransitionToSizeWithTransitionCoordinator(size: CGSize, coordinator: UIViewControllerTransitionCoordinator): void;
|
28
|
+
}
|
29
|
+
export declare class Tabs extends TabNavigation<UIPageViewControllerImpl> {
|
30
|
+
protected createViewController(): UIPageViewControllerImpl;
|
31
|
+
}
|
package/index.ios.js
ADDED
@@ -0,0 +1,237 @@
|
|
1
|
+
import { themer } from '@nativescript-community/ui-material-core';
|
2
|
+
import { TabContentItem } from '@nativescript-community/ui-material-core-tabs/tab-content-item';
|
3
|
+
import { TabsPosition } from '@nativescript-community/ui-material-core-tabs/tab-navigation/index-common';
|
4
|
+
import { TabNavigation, updateBackgroundPositions, updateTitleAndIconPositions } from '@nativescript-community/ui-material-core-tabs/tab-navigation/index.ios';
|
5
|
+
import { TabStrip } from '@nativescript-community/ui-material-core-tabs/tab-strip';
|
6
|
+
import { TabStripItem } from '@nativescript-community/ui-material-core-tabs/tab-strip-item';
|
7
|
+
import { IOSHelper, Utils } from '@nativescript/core';
|
8
|
+
export { TabContentItem, TabStrip, TabStripItem };
|
9
|
+
const majorVersion = Utils.ios.MajorVersion;
|
10
|
+
var MDCTabBarViewDelegateImpl = /** @class */ (function (_super) {
|
11
|
+
__extends(MDCTabBarViewDelegateImpl, _super);
|
12
|
+
function MDCTabBarViewDelegateImpl() {
|
13
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
14
|
+
}
|
15
|
+
MDCTabBarViewDelegateImpl.initWithOwner = function (owner) {
|
16
|
+
var delegate = MDCTabBarViewDelegateImpl.new();
|
17
|
+
delegate._owner = owner;
|
18
|
+
return delegate;
|
19
|
+
};
|
20
|
+
MDCTabBarViewDelegateImpl.prototype.tabBarViewShouldSelectItem = function (tabBar, item) {
|
21
|
+
var _a;
|
22
|
+
var owner = (_a = this._owner) === null || _a === void 0 ? void 0 : _a.get();
|
23
|
+
if (owner) {
|
24
|
+
var shouldSelectItem = owner.mCanSelectItem;
|
25
|
+
var selectedIndex = owner.tabBarItems.indexOf(item);
|
26
|
+
if (owner.selectedIndex !== selectedIndex) {
|
27
|
+
owner.beginTabTransition();
|
28
|
+
}
|
29
|
+
var tabStrip = owner.tabStrip;
|
30
|
+
var tabStripItems = tabStrip && tabStrip.items;
|
31
|
+
if (tabStripItems && tabStripItems[selectedIndex]) {
|
32
|
+
tabStripItems[selectedIndex]._emit(TabStripItem.tapEvent);
|
33
|
+
tabStrip.notify({ eventName: TabStrip.itemTapEvent, object: tabStrip, index: selectedIndex });
|
34
|
+
}
|
35
|
+
return shouldSelectItem;
|
36
|
+
}
|
37
|
+
return false;
|
38
|
+
};
|
39
|
+
MDCTabBarViewDelegateImpl.prototype.tabBarViewDidSelectItem = function (tabBar, selectedItem) {
|
40
|
+
var _a;
|
41
|
+
var owner = (_a = this._owner) === null || _a === void 0 ? void 0 : _a.get();
|
42
|
+
if (owner) {
|
43
|
+
var tabBarItems = owner.tabBarItems;
|
44
|
+
var selectedIndex = tabBarItems.indexOf(selectedItem);
|
45
|
+
owner.selectedIndex = selectedIndex;
|
46
|
+
}
|
47
|
+
};
|
48
|
+
MDCTabBarViewDelegateImpl.ObjCProtocols = [MDCTabBarViewDelegate];
|
49
|
+
return MDCTabBarViewDelegateImpl;
|
50
|
+
}(NSObject));
|
51
|
+
var UIPageViewControllerImpl = /** @class */ (function (_super) {
|
52
|
+
__extends(UIPageViewControllerImpl, _super);
|
53
|
+
function UIPageViewControllerImpl() {
|
54
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
55
|
+
}
|
56
|
+
UIPageViewControllerImpl.initWithOwner = function (owner) {
|
57
|
+
var handler = UIPageViewControllerImpl.alloc().initWithTransitionStyleNavigationOrientationOptions(UIPageViewControllerTransitionStyle.Scroll, UIPageViewControllerNavigationOrientation.Horizontal, null);
|
58
|
+
handler._owner = owner;
|
59
|
+
return handler;
|
60
|
+
};
|
61
|
+
UIPageViewControllerImpl.prototype.accessibilityScroll = function (direction) {
|
62
|
+
var _a, _b;
|
63
|
+
if ((_b = (_a = this._owner.get()) === null || _a === void 0 ? void 0 : _a.swipeEnabled) !== null && _b !== void 0 ? _b : true) {
|
64
|
+
return _super.prototype.accessibilityScroll.call(this, direction);
|
65
|
+
}
|
66
|
+
return false;
|
67
|
+
};
|
68
|
+
UIPageViewControllerImpl.prototype.viewDidLoad = function () {
|
69
|
+
var owner = this._owner.get();
|
70
|
+
var tabBarItems = owner.tabBarItems;
|
71
|
+
var tabBar = MDCTabBarView.alloc().init();
|
72
|
+
this.tabBar = tabBar;
|
73
|
+
var colorScheme = themer.getAppColorScheme();
|
74
|
+
if (tabBarItems && tabBarItems.length) {
|
75
|
+
tabBar.items = NSArray.arrayWithArray(tabBarItems);
|
76
|
+
}
|
77
|
+
tabBar.tabBarDelegate = this.tabBarDelegate = MDCTabBarViewDelegateImpl.initWithOwner(new WeakRef(owner));
|
78
|
+
if (colorScheme && colorScheme.primaryColor) {
|
79
|
+
tabBar.rippleColor = colorScheme.primaryColor.colorWithAlphaComponent(0.24);
|
80
|
+
tabBar.tintColor = colorScheme.primaryColor;
|
81
|
+
tabBar.selectionIndicatorStrokeColor = colorScheme.primaryColor;
|
82
|
+
owner.setTabBarColor(colorScheme.primaryColor);
|
83
|
+
}
|
84
|
+
else {
|
85
|
+
if (majorVersion <= 12 || !UIColor.labelColor) {
|
86
|
+
tabBar.tintColor = UIColor.blueColor;
|
87
|
+
tabBar.barTintColor = UIColor.whiteColor;
|
88
|
+
tabBar.setTitleColorForState(UIColor.blackColor, UIControlState.Normal);
|
89
|
+
tabBar.setTitleColorForState(UIColor.blackColor, UIControlState.Selected);
|
90
|
+
}
|
91
|
+
else {
|
92
|
+
tabBar.tintColor = UIColor.systemBlueColor;
|
93
|
+
tabBar.barTintColor = UIColor.systemBackgroundColor;
|
94
|
+
tabBar.setTitleColorForState(UIColor.labelColor, UIControlState.Normal);
|
95
|
+
tabBar.setTitleColorForState(UIColor.labelColor, UIControlState.Selected);
|
96
|
+
tabBar.rippleColor = UIColor.clearColor;
|
97
|
+
}
|
98
|
+
}
|
99
|
+
tabBar.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleBottomMargin;
|
100
|
+
this.view.addSubview(tabBar);
|
101
|
+
tabBar.sizeToFit();
|
102
|
+
};
|
103
|
+
UIPageViewControllerImpl.prototype.viewDidUnload = function () {
|
104
|
+
if (this.tabBar) {
|
105
|
+
this.tabBar.tabBarDelegate = null;
|
106
|
+
this.tabBar = null;
|
107
|
+
}
|
108
|
+
};
|
109
|
+
UIPageViewControllerImpl.prototype.viewWillAppear = function (animated) {
|
110
|
+
_super.prototype.viewWillAppear.call(this, animated);
|
111
|
+
var owner = this._owner.get();
|
112
|
+
if (!owner) {
|
113
|
+
return;
|
114
|
+
}
|
115
|
+
IOSHelper.updateAutoAdjustScrollInsets(this, owner);
|
116
|
+
// Tabs can be reset as a root view. Call loaded here in this scenario.
|
117
|
+
if (!owner.isLoaded) {
|
118
|
+
owner.callLoaded();
|
119
|
+
}
|
120
|
+
};
|
121
|
+
// public viewWillLayoutSubviews(): void {
|
122
|
+
// super.viewWillLayoutSubviews();
|
123
|
+
// this.tabBar.sizeToFit();
|
124
|
+
// }
|
125
|
+
UIPageViewControllerImpl.prototype.viewDidLayoutSubviews = function () {
|
126
|
+
_super.prototype.viewDidLayoutSubviews.call(this);
|
127
|
+
var owner = this._owner.get();
|
128
|
+
if (!owner) {
|
129
|
+
return;
|
130
|
+
}
|
131
|
+
var safeAreaInsetsBottom = 0;
|
132
|
+
var safeAreaInsetsTop = 0;
|
133
|
+
if (majorVersion > 10) {
|
134
|
+
safeAreaInsetsBottom = this.view.safeAreaInsets.bottom;
|
135
|
+
safeAreaInsetsTop = this.view.safeAreaInsets.top;
|
136
|
+
}
|
137
|
+
else {
|
138
|
+
safeAreaInsetsTop = this.topLayoutGuide.length;
|
139
|
+
}
|
140
|
+
var conditionalSafeAreaBottom = owner.iosOverflowSafeArea ? safeAreaInsetsBottom : 0;
|
141
|
+
var scrollViewTop = 0;
|
142
|
+
var scrollViewHeight = this.view.bounds.size.height + conditionalSafeAreaBottom;
|
143
|
+
if (owner.tabStrip && this.tabBar) {
|
144
|
+
if (owner.tabStrip.visibility === 'visible') {
|
145
|
+
this.tabBar.hidden = false;
|
146
|
+
}
|
147
|
+
else {
|
148
|
+
this.tabBar.hidden = true;
|
149
|
+
}
|
150
|
+
// failsafe with !this.tabBar.hidden just in some really odd case where hidden is false and collapse is true
|
151
|
+
// which should never happen
|
152
|
+
if (!owner.tabStrip.isCollapsed || !this.tabBar.hidden) {
|
153
|
+
var viewWidth = this.view.bounds.size.width;
|
154
|
+
var viewHeight = this.view.bounds.size.height;
|
155
|
+
var tabBarHeight = this.tabBar.frame.size.height;
|
156
|
+
var tabBarTop = safeAreaInsetsTop;
|
157
|
+
scrollViewTop = tabBarHeight;
|
158
|
+
scrollViewHeight = this.view.bounds.size.height - tabBarHeight + conditionalSafeAreaBottom;
|
159
|
+
var tabsPosition = owner.tabsPosition;
|
160
|
+
if (tabsPosition === TabsPosition.Bottom) {
|
161
|
+
tabBarTop = viewHeight - tabBarHeight - safeAreaInsetsBottom;
|
162
|
+
scrollViewTop = this.view.frame.origin.y;
|
163
|
+
scrollViewHeight = viewHeight - tabBarHeight;
|
164
|
+
}
|
165
|
+
var parent = owner.parent;
|
166
|
+
// Handle Angular scenario where Tabs is in a ProxyViewContainer
|
167
|
+
// It is possible to wrap components in ProxyViewContainers indefinitely
|
168
|
+
while (parent && !parent.nativeViewProtected) {
|
169
|
+
parent = parent.parent;
|
170
|
+
}
|
171
|
+
if (parent && majorVersion > 10) {
|
172
|
+
// TODO: Figure out a better way to handle ViewController nesting/Safe Area nesting
|
173
|
+
tabBarTop = Math.max(tabBarTop, parent.nativeView.safeAreaInsets.top);
|
174
|
+
}
|
175
|
+
this.tabBar.frame = CGRectMake(0, tabBarTop, viewWidth, tabBarHeight);
|
176
|
+
}
|
177
|
+
}
|
178
|
+
else {
|
179
|
+
this.tabBar.hidden = true;
|
180
|
+
}
|
181
|
+
var subViews = this.view.subviews;
|
182
|
+
var scrollView = null;
|
183
|
+
for (var i = 0; i < subViews.count; i++) {
|
184
|
+
var view = subViews.objectAtIndex(i);
|
185
|
+
if (view instanceof UIScrollView && !(view instanceof MDCTabBarView)) {
|
186
|
+
scrollView = view;
|
187
|
+
}
|
188
|
+
}
|
189
|
+
if (scrollView) {
|
190
|
+
// The part of the UIPageViewController that is changing the pages is a UIScrollView
|
191
|
+
// We want to expand it to the size of the UIPageViewController as it is not so by default
|
192
|
+
this.scrollView = scrollView;
|
193
|
+
if (!owner.swipeEnabled) {
|
194
|
+
scrollView.scrollEnabled = false;
|
195
|
+
}
|
196
|
+
else {
|
197
|
+
scrollView.scrollEnabled = true;
|
198
|
+
}
|
199
|
+
scrollView.frame = CGRectMake(0, scrollViewTop, this.view.bounds.size.width, scrollViewHeight); //this.view.bounds;
|
200
|
+
}
|
201
|
+
};
|
202
|
+
// Mind implementation for other controllers
|
203
|
+
UIPageViewControllerImpl.prototype.traitCollectionDidChange = function (previousTraitCollection) {
|
204
|
+
_super.prototype.traitCollectionDidChange.call(this, previousTraitCollection);
|
205
|
+
if (majorVersion >= 13) {
|
206
|
+
var owner = this._owner.get();
|
207
|
+
if (owner &&
|
208
|
+
this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection &&
|
209
|
+
this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
|
210
|
+
owner.notify({ eventName: IOSHelper.traitCollectionColorAppearanceChangedEvent, object: owner });
|
211
|
+
}
|
212
|
+
}
|
213
|
+
};
|
214
|
+
UIPageViewControllerImpl.prototype.viewWillTransitionToSizeWithTransitionCoordinator = function (size, coordinator) {
|
215
|
+
var _this = this;
|
216
|
+
_super.prototype.viewWillTransitionToSizeWithTransitionCoordinator.call(this, size, coordinator);
|
217
|
+
coordinator.animateAlongsideTransitionCompletion(function () {
|
218
|
+
var owner = _this._owner.get();
|
219
|
+
if (owner && owner.tabStrip && owner.tabStrip.items) {
|
220
|
+
var tabStrip_1 = owner.tabStrip;
|
221
|
+
tabStrip_1.items.forEach(function (tabStripItem) {
|
222
|
+
updateBackgroundPositions(tabStrip_1, tabStripItem, owner.selectedIndex !== tabStripItem.index ? owner.mDefaultItemBackgroundColor : null);
|
223
|
+
var index = tabStripItem.index;
|
224
|
+
var tabBarItemController = owner.viewControllers[index];
|
225
|
+
updateTitleAndIconPositions(tabStripItem, tabBarItemController.tabBarItem, tabBarItemController);
|
226
|
+
});
|
227
|
+
}
|
228
|
+
}, null);
|
229
|
+
};
|
230
|
+
return UIPageViewControllerImpl;
|
231
|
+
}(UIPageViewController));
|
232
|
+
export class Tabs extends TabNavigation {
|
233
|
+
createViewController() {
|
234
|
+
return UIPageViewControllerImpl.initWithOwner(new WeakRef(this));
|
235
|
+
}
|
236
|
+
}
|
237
|
+
//# sourceMappingURL=index.ios.js.map
|
package/index.ios.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.ios.js","sourceRoot":"","sources":["../../src/tabs/index.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,0CAA0C,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,gEAAgE,CAAC;AAChG,OAAO,EAAE,YAAY,EAAE,MAAM,2EAA2E,CAAC;AACzG,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,MAAM,wEAAwE,CAAC;AAC/J,OAAO,EAAE,QAAQ,EAAE,MAAM,yDAAyD,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;AAElD,MAAM,YAAY,GAAG,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkQ5C,MAAM,OAAO,IAAK,SAAQ,aAAuC;IACnD,oBAAoB;QAC1B,OAAO,wBAAwB,CAAC,aAAa,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACrE,CAAC;CACJ"}
|
package/package.json
CHANGED
@@ -1,10 +1,22 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nativescript-community/ui-material-tabs",
|
3
|
-
"version": "7.2.
|
3
|
+
"version": "7.2.41",
|
4
4
|
"description": "Material Design Tabs organize content across different screens, data sets, and other interactions.",
|
5
5
|
"main": "./index",
|
6
6
|
"sideEffects": false,
|
7
7
|
"typings": "./index.d.ts",
|
8
|
+
"scripts": {
|
9
|
+
"tsc": "cpy ../../src/tabs/index.d.ts ./ && tsc -d",
|
10
|
+
"tsc-win": "cpy ..\\..\\src\\tabs\\index.d.ts .\\ && tsc -d",
|
11
|
+
"build": "npm run tsc",
|
12
|
+
"build.win": "npm run tsc-win",
|
13
|
+
"build.watch": "npm run tsc -- -w",
|
14
|
+
"build.all": "npm run build && npm run build.angular",
|
15
|
+
"build.all.win": "npm run build.win && npm run build.angular.win",
|
16
|
+
"build.angular": "ng-packagr -p ../../src/tabs/angular/ng-package.json -c ../../src/tabs/angular/tsconfig.json",
|
17
|
+
"build.angular.win": "ng-packagr -p ..\\..\\src\\tabs\\angular\\package.json -c ..\\..\\src\\tabs\\angular\\tsconfig.json",
|
18
|
+
"clean": "rimraf ./*.d.ts ./*.js ./*.js.map"
|
19
|
+
},
|
8
20
|
"nativescript": {
|
9
21
|
"platforms": {
|
10
22
|
"android": "6.2.0",
|
@@ -34,8 +46,8 @@
|
|
34
46
|
},
|
35
47
|
"readmeFilename": "README.md",
|
36
48
|
"dependencies": {
|
37
|
-
"@nativescript-community/ui-material-core": "^7.2.
|
38
|
-
"@nativescript-community/ui-material-core-tabs": "^7.2.
|
49
|
+
"@nativescript-community/ui-material-core": "^7.2.41",
|
50
|
+
"@nativescript-community/ui-material-core-tabs": "^7.2.41"
|
39
51
|
},
|
40
|
-
"gitHead": "
|
52
|
+
"gitHead": "b56f0b5c4776605e91f6ca76ba1f2ed4fd103989"
|
41
53
|
}
|
package/react/index.d.ts
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
import { NativeScriptProps } from 'react-nativescript';
|
2
|
+
import { PropertyChangeData } from '@nativescript/core';
|
3
|
+
import { Tabs } from '..';
|
4
|
+
import { TabNavigationBaseAttributes } from '@nativescript-community/ui-material-core-tabs/react';
|
5
|
+
import { SelectedIndexChangedEventData } from '@nativescript-community/ui-material-core-tabs/tab-navigation-base';
|
6
|
+
import { TabStrip } from '@nativescript-community/ui-material-core-tabs/tab-strip';
|
7
|
+
import { TabContentItem } from '@nativescript-community/ui-material-core-tabs/tab-content-item';
|
8
|
+
export type TabsAttributes = TabNavigationBaseAttributes & {
|
9
|
+
android?: any;
|
10
|
+
iOSTabBarItemsAlignment?: 'center' | 'leading' | 'justified' | 'centerSelected';
|
11
|
+
ios?: any;
|
12
|
+
items?: TabContentItem[];
|
13
|
+
offscreenTabLimit?: string | number;
|
14
|
+
onIOsTabBarItemsAlignmentChange?: (args: PropertyChangeData) => void;
|
15
|
+
onOffscreenTabLimitChange?: (args: PropertyChangeData) => void;
|
16
|
+
onSelectedIndexChanged?: (args: SelectedIndexChangedEventData) => void;
|
17
|
+
onSwipeEnabledChange?: (args: PropertyChangeData) => void;
|
18
|
+
onTabsPositionChange?: (args: PropertyChangeData) => void;
|
19
|
+
selectedIndex?: number;
|
20
|
+
swipeEnabled?: string | false | true;
|
21
|
+
tabStrip?: TabStrip;
|
22
|
+
tabsPosition?: 'top' | 'bottom';
|
23
|
+
};
|
24
|
+
declare global {
|
25
|
+
namespace JSX {
|
26
|
+
interface IntrinsicElements {
|
27
|
+
tabs: NativeScriptProps<TabsAttributes, Tabs>;
|
28
|
+
}
|
29
|
+
interface ElementChildrenAttribute {
|
30
|
+
children: {};
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
interface RegisterTabsOptions {
|
35
|
+
enableDebugLogging?: boolean;
|
36
|
+
}
|
37
|
+
export declare function registerTabs(opts?: RegisterTabsOptions): void;
|
38
|
+
export {};
|
package/react/index.js
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
import { registerElement } from 'react-nativescript';
|
2
|
+
import { warn } from 'react-nativescript/dist/shared/Logger';
|
3
|
+
import { Tabs } from '..';
|
4
|
+
import { TabStrip } from '@nativescript-community/ui-material-core-tabs/tab-strip';
|
5
|
+
import { TabContentItem } from '@nativescript-community/ui-material-core-tabs/tab-content-item';
|
6
|
+
let installed = false;
|
7
|
+
export function registerTabs(opts = {}) {
|
8
|
+
const { enableDebugLogging = false } = opts;
|
9
|
+
if (installed) {
|
10
|
+
return;
|
11
|
+
}
|
12
|
+
registerElement('tabs',
|
13
|
+
// @ts-ignore I can assure that this really does extend ViewBase
|
14
|
+
() => Tabs, {
|
15
|
+
// TODO: share the same NodeOps for both BottomNavigation and Tabs; they're identical as they both extend TabNavigationBase.
|
16
|
+
nodeOps: {
|
17
|
+
insert(child, parent, atIndex) {
|
18
|
+
const tabs = parent.nativeView;
|
19
|
+
if (child.nodeRole === 'tabStrip') {
|
20
|
+
if (child.nativeView instanceof TabStrip) {
|
21
|
+
tabs.tabStrip = child.nativeView;
|
22
|
+
}
|
23
|
+
else {
|
24
|
+
if (enableDebugLogging) {
|
25
|
+
warn(`Unable to add child "${child.nativeView.constructor.name}" as the tabStrip of <tabs> as it is not an instance of TabStrip.`);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
else if (child.nodeRole === 'items') {
|
30
|
+
if (child.nativeView instanceof TabContentItem === false) {
|
31
|
+
if (enableDebugLogging) {
|
32
|
+
warn(`Unable to add child "${child.nativeView.constructor.name}" to the items of <tabs> as it is not an instance of TabContentItem.`);
|
33
|
+
}
|
34
|
+
return;
|
35
|
+
}
|
36
|
+
const items = tabs.items || []; // Annoyingly, it's the consumer's responsibility to ensure there's an array there!
|
37
|
+
if (typeof atIndex === 'undefined' || atIndex === items.length) {
|
38
|
+
tabs._addChildFromBuilder('items', child.nativeView);
|
39
|
+
}
|
40
|
+
else {
|
41
|
+
const itemsClone = items.slice();
|
42
|
+
itemsClone.splice(atIndex, 0, child.nativeView);
|
43
|
+
tabs.items = itemsClone;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
else if (child.nodeRole === 'item') {
|
47
|
+
if (enableDebugLogging) {
|
48
|
+
warn(`Unable to add child "${child.nativeView.constructor.name}" to <tabs> as it had the nodeRole "item"; please correct it to "items".`);
|
49
|
+
}
|
50
|
+
}
|
51
|
+
else {
|
52
|
+
if (enableDebugLogging) {
|
53
|
+
warn(`Unable to add child "${child.nativeView.constructor.name}" to <tabs> as it does not have a nodeRole specified; ` + 'please set a nodeRole of "tabStrip", or "items".');
|
54
|
+
}
|
55
|
+
}
|
56
|
+
},
|
57
|
+
remove(child, parent) {
|
58
|
+
const tabs = parent.nativeView;
|
59
|
+
if (child.nodeRole === 'tabStrip') {
|
60
|
+
tabs.tabStrip = null; // Anything falsy should work.
|
61
|
+
}
|
62
|
+
else if (child.nodeRole === 'items') {
|
63
|
+
tabs.items = (tabs.items || []).filter((i) => i !== child.nativeView);
|
64
|
+
}
|
65
|
+
else if (child.nodeRole === 'item') {
|
66
|
+
if (enableDebugLogging) {
|
67
|
+
warn(`Unable to remove child "${child.nativeView.constructor.name}" from <tabs> as it had the nodeRole "item"; please correct it to "items".`);
|
68
|
+
}
|
69
|
+
}
|
70
|
+
else {
|
71
|
+
if (enableDebugLogging) {
|
72
|
+
warn(`Unable to remove child "${child.nativeView.constructor.name}" from <tabs> as it does not have a nodeRole specified; ` +
|
73
|
+
'please set a nodeRole of "tabStrip", or "items"');
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
78
|
+
});
|
79
|
+
installed = true;
|
80
|
+
}
|
81
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tabs/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEpF,OAAO,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAG1B,OAAO,EAAE,QAAQ,EAAE,MAAM,yDAAyD,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,gEAAgE,CAAC;AA+BhG,IAAI,SAAS,GAAY,KAAK,CAAC;AAM/B,MAAM,UAAU,YAAY,CAAC,OAA4B,EAAE;IACvD,MAAM,EAAE,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,IAAI,CAAC;AACrB,CAAC"}
|
package/vue/component.js
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
export default {
|
2
|
+
model: {
|
3
|
+
prop: 'selectedIndex',
|
4
|
+
event: 'selectedIndexChange'
|
5
|
+
},
|
6
|
+
render(h) {
|
7
|
+
return h('NativeMDTabs', {
|
8
|
+
on: this.$listeners,
|
9
|
+
attrs: this.$attrs
|
10
|
+
}, this.$slots.default);
|
11
|
+
},
|
12
|
+
methods: {
|
13
|
+
registerTabStrip(tabStrip) {
|
14
|
+
this.$el.setAttribute('tabStrip', tabStrip);
|
15
|
+
},
|
16
|
+
registerTabContentItem(tabContentItem) {
|
17
|
+
const items = this.$el.nativeView.items || [];
|
18
|
+
this.$el.setAttribute('items', items.concat([tabContentItem]));
|
19
|
+
}
|
20
|
+
}
|
21
|
+
};
|
22
|
+
//# sourceMappingURL=component.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/tabs/vue/component.ts"],"names":[],"mappings":"AAAA,eAAe;IACX,KAAK,EAAE;QACH,IAAI,EAAE,eAAe;QACrB,KAAK,EAAE,qBAAqB;KAC/B;IAED,MAAM,CAAC,CAAC;QACJ,OAAO,CAAC,CACJ,cAAc,EACd;YACI,EAAE,EAAE,IAAI,CAAC,UAAU;YACnB,KAAK,EAAE,IAAI,CAAC,MAAM;SACrB,EACD,IAAI,CAAC,MAAM,CAAC,OAAO,CACtB,CAAC;IACN,CAAC;IAED,OAAO,EAAE;QACL,gBAAgB,CAAC,QAAQ;YACrB,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAChD,CAAC;QACD,sBAAsB,CAAC,cAAc;YACjC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,IAAI,EAAE,CAAC;YAE9C,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;QACnE,CAAC;KACJ;CACJ,CAAC"}
|
package/vue/index.d.ts
ADDED
package/vue/index.js
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
import { TabContentItem, TabStrip, TabStripItem, Tabs } from '..';
|
2
|
+
let installed = false;
|
3
|
+
export default {
|
4
|
+
install(Vue) {
|
5
|
+
if (!installed) {
|
6
|
+
installed = true;
|
7
|
+
Vue.registerElement('MDTabs', () => Tabs, {
|
8
|
+
model: {
|
9
|
+
prop: 'selectedIndex',
|
10
|
+
event: 'selectedIndexChange'
|
11
|
+
},
|
12
|
+
component: require('./component').default
|
13
|
+
});
|
14
|
+
Vue.registerElement('MDTabContentItem', () => TabContentItem, {});
|
15
|
+
Vue.registerElement('MDTabStripItem', () => TabStripItem, {});
|
16
|
+
Vue.registerElement('MDTabStrip', () => TabStrip, {});
|
17
|
+
}
|
18
|
+
}
|
19
|
+
};
|
20
|
+
//# sourceMappingURL=index.js.map
|
package/vue/index.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tabs/vue/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAElE,IAAI,SAAS,GAAG,KAAK,CAAC;AAEtB,eAAe;IACX,OAAO,CAAC,GAAG;QACP,IAAI,CAAC,SAAS,EAAE;YACZ,SAAS,GAAG,IAAI,CAAC;YACjB,GAAG,CAAC,eAAe,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE;gBACtC,KAAK,EAAE;oBACH,IAAI,EAAE,eAAe;oBACrB,KAAK,EAAE,qBAAqB;iBAC/B;gBACD,SAAS,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,OAAO;aAC5C,CAAC,CAAC;YACH,GAAG,CAAC,eAAe,CAAC,kBAAkB,EAAE,GAAG,EAAE,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;YAClE,GAAG,CAAC,eAAe,CAAC,gBAAgB,EAAE,GAAG,EAAE,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;YAC9D,GAAG,CAAC,eAAe,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;SACzD;IACL,CAAC;CACJ,CAAC"}
|