@nativescript-community/ui-collectionview-swipemenu 5.0.3
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/CHANGELOG.md +455 -0
- package/README.md +172 -0
- package/angular/esm2020/index.mjs +2 -0
- package/angular/esm2020/module.mjs +213 -0
- package/angular/esm2020/nativescript-community-ui-collectionview-swipemenu-angular.mjs +5 -0
- package/angular/fesm2015/nativescript-community-ui-collectionview-swipemenu-angular.mjs +248 -0
- package/angular/fesm2015/nativescript-community-ui-collectionview-swipemenu-angular.mjs.map +1 -0
- package/angular/fesm2020/nativescript-community-ui-collectionview-swipemenu-angular.mjs +220 -0
- package/angular/fesm2020/nativescript-community-ui-collectionview-swipemenu-angular.mjs.map +1 -0
- package/angular/index.d.ts +1 -0
- package/angular/module.d.ts +84 -0
- package/angular/package.json +30 -0
- package/index.d.ts +27 -0
- package/index.js +141 -0
- package/package.json +46 -0
- package/svelte/index.d.ts +11 -0
- package/svelte/index.js +27 -0
- package/vue/component.d.ts +11 -0
- package/vue/component.js +25 -0
- package/vue/index.d.ts +4 -0
- package/vue/index.js +12 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { ElementRef, ViewContainerRef, Component, Inject, Directive, NgModule } from '@angular/core';
|
|
3
|
+
import { install, SwipeMenu } from '@nativescript-community/ui-collectionview-swipemenu';
|
|
4
|
+
import { registerElement } from '@nativescript/angular';
|
|
5
|
+
|
|
6
|
+
const _c0 = ["*"];
|
|
7
|
+
install();
|
|
8
|
+
const LEFTDRAWER = 'LeftSwipeMenu';
|
|
9
|
+
const RIGHTDRAWER = 'RightSwipeMenu';
|
|
10
|
+
const TOPDRAWER = 'TopSwipeMenu';
|
|
11
|
+
const BOTTOMDRAWER = 'BottomSwipeMenu';
|
|
12
|
+
const MAINCONTENT = 'MainContent';
|
|
13
|
+
/**
|
|
14
|
+
* This is the SideSwipeMenu component. It separates your mobile app's screen
|
|
15
|
+
* into a main part and a menu part whereby the menu part is shown upon a swipe
|
|
16
|
+
* gesture using a transition effect.
|
|
17
|
+
*/
|
|
18
|
+
class SwipeMenuComponent {
|
|
19
|
+
constructor(elementRef, viewContainer) {
|
|
20
|
+
this.elementRef = elementRef;
|
|
21
|
+
this.viewContainer = viewContainer;
|
|
22
|
+
this.swipemenu = this.elementRef.nativeElement;
|
|
23
|
+
}
|
|
24
|
+
get nativeElement() {
|
|
25
|
+
return this.swipemenu;
|
|
26
|
+
}
|
|
27
|
+
set gestureEnabled(value) {
|
|
28
|
+
this._gestureEnabled = value;
|
|
29
|
+
this.updateGestureEnabled();
|
|
30
|
+
}
|
|
31
|
+
updateGestureEnabled() {
|
|
32
|
+
this.swipemenu.gestureEnabled = this._gestureEnabled;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
SwipeMenuComponent.ɵfac = function SwipeMenuComponent_Factory(t) { return new (t || SwipeMenuComponent)(i0.ɵɵdirectiveInject(ElementRef), i0.ɵɵdirectiveInject(ViewContainerRef)); };
|
|
36
|
+
SwipeMenuComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SwipeMenuComponent, selectors: [["SwipeMenu"]], ngContentSelectors: _c0, decls: 1, vars: 0, template: function SwipeMenuComponent_Template(rf, ctx) { if (rf & 1) {
|
|
37
|
+
i0.ɵɵprojectionDef();
|
|
38
|
+
i0.ɵɵprojection(0);
|
|
39
|
+
} }, encapsulation: 2 });
|
|
40
|
+
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SwipeMenuComponent, [{
|
|
41
|
+
type: Component,
|
|
42
|
+
args: [{
|
|
43
|
+
selector: 'SwipeMenu',
|
|
44
|
+
template: '<ng-content></ng-content>'
|
|
45
|
+
}]
|
|
46
|
+
}], function () { return [{ type: i0.ElementRef, decorators: [{
|
|
47
|
+
type: Inject,
|
|
48
|
+
args: [ElementRef]
|
|
49
|
+
}] }, { type: i0.ViewContainerRef, decorators: [{
|
|
50
|
+
type: Inject,
|
|
51
|
+
args: [ViewContainerRef]
|
|
52
|
+
}] }]; }, null); })();
|
|
53
|
+
/**
|
|
54
|
+
* Directive identifying the left swipemenu
|
|
55
|
+
*/
|
|
56
|
+
class LeftSwipeMenuDirective {
|
|
57
|
+
constructor(_elementRef) {
|
|
58
|
+
this._elementRef = _elementRef;
|
|
59
|
+
this._elementRef.nativeElement.id = LEFTDRAWER;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
LeftSwipeMenuDirective.ɵfac = function LeftSwipeMenuDirective_Factory(t) { return new (t || LeftSwipeMenuDirective)(i0.ɵɵdirectiveInject(ElementRef)); };
|
|
63
|
+
LeftSwipeMenuDirective.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: LeftSwipeMenuDirective, selectors: [["", "leftSwipeMenu", ""]] });
|
|
64
|
+
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(LeftSwipeMenuDirective, [{
|
|
65
|
+
type: Directive,
|
|
66
|
+
args: [{
|
|
67
|
+
selector: '[leftSwipeMenu]'
|
|
68
|
+
}]
|
|
69
|
+
}], function () { return [{ type: i0.ElementRef, decorators: [{
|
|
70
|
+
type: Inject,
|
|
71
|
+
args: [ElementRef]
|
|
72
|
+
}] }]; }, null); })();
|
|
73
|
+
/**
|
|
74
|
+
* Directive identifying the right swipemenu
|
|
75
|
+
*/
|
|
76
|
+
class RightSwipeMenuDirective {
|
|
77
|
+
constructor(_elementRef) {
|
|
78
|
+
this._elementRef = _elementRef;
|
|
79
|
+
this._elementRef.nativeElement.id = RIGHTDRAWER;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
RightSwipeMenuDirective.ɵfac = function RightSwipeMenuDirective_Factory(t) { return new (t || RightSwipeMenuDirective)(i0.ɵɵdirectiveInject(ElementRef)); };
|
|
83
|
+
RightSwipeMenuDirective.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: RightSwipeMenuDirective, selectors: [["", "rightSwipeMenu", ""]] });
|
|
84
|
+
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RightSwipeMenuDirective, [{
|
|
85
|
+
type: Directive,
|
|
86
|
+
args: [{
|
|
87
|
+
selector: '[rightSwipeMenu]'
|
|
88
|
+
}]
|
|
89
|
+
}], function () { return [{ type: i0.ElementRef, decorators: [{
|
|
90
|
+
type: Inject,
|
|
91
|
+
args: [ElementRef]
|
|
92
|
+
}] }]; }, null); })();
|
|
93
|
+
/**
|
|
94
|
+
* Directive identifying the right swipemenu
|
|
95
|
+
*/
|
|
96
|
+
class TopSwipeMenuDirective {
|
|
97
|
+
constructor(_elementRef) {
|
|
98
|
+
this._elementRef = _elementRef;
|
|
99
|
+
this._elementRef.nativeElement.id = TOPDRAWER;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
TopSwipeMenuDirective.ɵfac = function TopSwipeMenuDirective_Factory(t) { return new (t || TopSwipeMenuDirective)(i0.ɵɵdirectiveInject(ElementRef)); };
|
|
103
|
+
TopSwipeMenuDirective.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: TopSwipeMenuDirective, selectors: [["", "topSwipeMenu", ""]] });
|
|
104
|
+
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TopSwipeMenuDirective, [{
|
|
105
|
+
type: Directive,
|
|
106
|
+
args: [{
|
|
107
|
+
selector: '[topSwipeMenu]'
|
|
108
|
+
}]
|
|
109
|
+
}], function () { return [{ type: i0.ElementRef, decorators: [{
|
|
110
|
+
type: Inject,
|
|
111
|
+
args: [ElementRef]
|
|
112
|
+
}] }]; }, null); })();
|
|
113
|
+
/**
|
|
114
|
+
* Directive identifying the right swipemenu
|
|
115
|
+
*/
|
|
116
|
+
class BottomSwipeMenuDirective {
|
|
117
|
+
constructor(_elementRef) {
|
|
118
|
+
this._elementRef = _elementRef;
|
|
119
|
+
this._elementRef.nativeElement.id = BOTTOMDRAWER;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
BottomSwipeMenuDirective.ɵfac = function BottomSwipeMenuDirective_Factory(t) { return new (t || BottomSwipeMenuDirective)(i0.ɵɵdirectiveInject(ElementRef)); };
|
|
123
|
+
BottomSwipeMenuDirective.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: BottomSwipeMenuDirective, selectors: [["", "bottomSwipeMenu", ""]] });
|
|
124
|
+
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BottomSwipeMenuDirective, [{
|
|
125
|
+
type: Directive,
|
|
126
|
+
args: [{
|
|
127
|
+
selector: '[bottomSwipeMenu]'
|
|
128
|
+
}]
|
|
129
|
+
}], function () { return [{ type: i0.ElementRef, decorators: [{
|
|
130
|
+
type: Inject,
|
|
131
|
+
args: [ElementRef]
|
|
132
|
+
}] }]; }, null); })();
|
|
133
|
+
/**
|
|
134
|
+
* Directive identifying the main content.
|
|
135
|
+
*/
|
|
136
|
+
class MainContentDirective {
|
|
137
|
+
constructor(_elementRef) {
|
|
138
|
+
this._elementRef = _elementRef;
|
|
139
|
+
this._elementRef.nativeElement.id = MAINCONTENT;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
MainContentDirective.ɵfac = function MainContentDirective_Factory(t) { return new (t || MainContentDirective)(i0.ɵɵdirectiveInject(ElementRef)); };
|
|
143
|
+
MainContentDirective.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: MainContentDirective, selectors: [["", "mainContent", ""]] });
|
|
144
|
+
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MainContentDirective, [{
|
|
145
|
+
type: Directive,
|
|
146
|
+
args: [{
|
|
147
|
+
selector: '[mainContent]'
|
|
148
|
+
}]
|
|
149
|
+
}], function () { return [{ type: i0.ElementRef, decorators: [{
|
|
150
|
+
type: Inject,
|
|
151
|
+
args: [ElementRef]
|
|
152
|
+
}] }]; }, null); })();
|
|
153
|
+
const sideSwipeMenuMeta = {
|
|
154
|
+
insertChild: (parent, child) => {
|
|
155
|
+
const swipemenu = parent;
|
|
156
|
+
const childView = child;
|
|
157
|
+
if (childView.id === MAINCONTENT) {
|
|
158
|
+
swipemenu.mainContent = childView;
|
|
159
|
+
}
|
|
160
|
+
if (childView.id === LEFTDRAWER) {
|
|
161
|
+
swipemenu.leftDrawer = childView;
|
|
162
|
+
}
|
|
163
|
+
if (childView.id === RIGHTDRAWER) {
|
|
164
|
+
swipemenu.rightDrawer = childView;
|
|
165
|
+
}
|
|
166
|
+
if (childView.id === TOPDRAWER) {
|
|
167
|
+
swipemenu.topDrawer = childView;
|
|
168
|
+
}
|
|
169
|
+
if (childView.id === BOTTOMDRAWER) {
|
|
170
|
+
swipemenu.bottomDrawer = childView;
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
removeChild: (parent, child) => {
|
|
174
|
+
const swipemenu = parent;
|
|
175
|
+
const childView = child;
|
|
176
|
+
if (childView.id === MAINCONTENT) {
|
|
177
|
+
swipemenu.mainContent = null;
|
|
178
|
+
}
|
|
179
|
+
if (childView.id === LEFTDRAWER) {
|
|
180
|
+
swipemenu.leftDrawer = null;
|
|
181
|
+
}
|
|
182
|
+
if (childView.id === RIGHTDRAWER) {
|
|
183
|
+
swipemenu.rightDrawer = null;
|
|
184
|
+
}
|
|
185
|
+
if (childView.id === TOPDRAWER) {
|
|
186
|
+
swipemenu.topDrawer = null;
|
|
187
|
+
}
|
|
188
|
+
if (childView.id === BOTTOMDRAWER) {
|
|
189
|
+
swipemenu.bottomDrawer = null;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* Directives identifying the SwipeMenu.
|
|
195
|
+
*/
|
|
196
|
+
const SIDEDRAWER_DIRECTIVES = [LeftSwipeMenuDirective, RightSwipeMenuDirective, TopSwipeMenuDirective, BottomSwipeMenuDirective, MainContentDirective];
|
|
197
|
+
registerElement('SwipeMenu', () => SwipeMenu, sideSwipeMenuMeta);
|
|
198
|
+
/**
|
|
199
|
+
* NgModule containing all of the RadSideSwipeMenu directives.
|
|
200
|
+
*/
|
|
201
|
+
class SwipeMenuModule {
|
|
202
|
+
}
|
|
203
|
+
SwipeMenuModule.ɵfac = function SwipeMenuModule_Factory(t) { return new (t || SwipeMenuModule)(); };
|
|
204
|
+
SwipeMenuModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: SwipeMenuModule });
|
|
205
|
+
SwipeMenuModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
|
|
206
|
+
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SwipeMenuModule, [{
|
|
207
|
+
type: NgModule,
|
|
208
|
+
args: [{
|
|
209
|
+
declarations: [SwipeMenuComponent, SIDEDRAWER_DIRECTIVES],
|
|
210
|
+
exports: [SwipeMenuComponent, SIDEDRAWER_DIRECTIVES]
|
|
211
|
+
}]
|
|
212
|
+
}], null, null); })();
|
|
213
|
+
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(SwipeMenuModule, { declarations: [SwipeMenuComponent, LeftSwipeMenuDirective, RightSwipeMenuDirective, TopSwipeMenuDirective, BottomSwipeMenuDirective, MainContentDirective], exports: [SwipeMenuComponent, LeftSwipeMenuDirective, RightSwipeMenuDirective, TopSwipeMenuDirective, BottomSwipeMenuDirective, MainContentDirective] }); })();
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Generated bundle index. Do not edit.
|
|
217
|
+
*/
|
|
218
|
+
|
|
219
|
+
export { BottomSwipeMenuDirective, LeftSwipeMenuDirective, MainContentDirective, RightSwipeMenuDirective, SIDEDRAWER_DIRECTIVES, SwipeMenuComponent, SwipeMenuModule, TopSwipeMenuDirective };
|
|
220
|
+
//# sourceMappingURL=nativescript-community-ui-collectionview-swipemenu-angular.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativescript-community-ui-collectionview-swipemenu-angular.mjs","sources":["../../../../src/swipemenu/angular/module.ts","../../../../src/swipemenu/angular/nativescript-community-ui-collectionview-swipemenu-angular.ts"],"sourcesContent":["import { Component, Directive, ElementRef, EmbeddedViewRef, Inject, NgModule, TemplateRef, ViewContainerRef } from '@angular/core';\nimport { SwipeMenu, install as installSwipeMenu } from '@nativescript-community/ui-collectionview-swipemenu';\nimport { NgView, ViewClassMeta, registerElement } from '@nativescript/angular';\ninstallSwipeMenu();\nconst LEFTDRAWER: string = 'LeftSwipeMenu';\nconst RIGHTDRAWER: string = 'RightSwipeMenu';\nconst TOPDRAWER: string = 'TopSwipeMenu';\nconst BOTTOMDRAWER: string = 'BottomSwipeMenu';\nconst MAINCONTENT: string = 'MainContent';\n\nexport interface ItemEventArgs {\n object: any;\n view: EmbeddedViewRef<any>;\n returnValue?: boolean;\n}\n\n/**\n * This is the SideSwipeMenu component. It separates your mobile app's screen\n * into a main part and a menu part whereby the menu part is shown upon a swipe\n * gesture using a transition effect.\n */\n@Component({\n selector: 'SwipeMenu',\n template: '<ng-content></ng-content>'\n})\nexport class SwipeMenuComponent {\n public swipemenu: SwipeMenu;\n public mainTemplate: TemplateRef<ElementRef>;\n public swipemenuTemplate: TemplateRef<ElementRef>;\n\n private _gestureEnabled: boolean;\n\n constructor(@Inject(ElementRef) public elementRef: ElementRef, @Inject(ViewContainerRef) private viewContainer: ViewContainerRef) {\n this.swipemenu = this.elementRef.nativeElement;\n }\n\n public get nativeElement(): SwipeMenu {\n return this.swipemenu;\n }\n\n set gestureEnabled(value: boolean) {\n this._gestureEnabled = value;\n this.updateGestureEnabled();\n }\n\n private updateGestureEnabled() {\n this.swipemenu.gestureEnabled = this._gestureEnabled;\n }\n}\n\n/**\n * Directive identifying the left swipemenu\n */\n@Directive({\n selector: '[leftSwipeMenu]'\n})\nexport class LeftSwipeMenuDirective {\n constructor(@Inject(ElementRef) private _elementRef: ElementRef) {\n this._elementRef.nativeElement.id = LEFTDRAWER;\n }\n}\n/**\n * Directive identifying the right swipemenu\n */\n@Directive({\n selector: '[rightSwipeMenu]'\n})\nexport class RightSwipeMenuDirective {\n constructor(@Inject(ElementRef) private _elementRef: ElementRef) {\n this._elementRef.nativeElement.id = RIGHTDRAWER;\n }\n}\n\n/**\n * Directive identifying the right swipemenu\n */\n@Directive({\n selector: '[topSwipeMenu]'\n})\nexport class TopSwipeMenuDirective {\n constructor(@Inject(ElementRef) private _elementRef: ElementRef) {\n this._elementRef.nativeElement.id = TOPDRAWER;\n }\n}\n\n/**\n * Directive identifying the right swipemenu\n */\n@Directive({\n selector: '[bottomSwipeMenu]'\n})\nexport class BottomSwipeMenuDirective {\n constructor(@Inject(ElementRef) private _elementRef: ElementRef) {\n this._elementRef.nativeElement.id = BOTTOMDRAWER;\n }\n}\n\n/**\n * Directive identifying the main content.\n */\n@Directive({\n selector: '[mainContent]'\n})\nexport class MainContentDirective {\n constructor(@Inject(ElementRef) private _elementRef: ElementRef) {\n this._elementRef.nativeElement.id = MAINCONTENT;\n }\n}\n\nconst sideSwipeMenuMeta: ViewClassMeta = {\n insertChild: (parent: NgView, child: NgView) => {\n const swipemenu = parent as any as SwipeMenu;\n const childView = child;\n\n if (childView.id === MAINCONTENT) {\n swipemenu.mainContent = childView;\n }\n\n if (childView.id === LEFTDRAWER) {\n swipemenu.leftDrawer = childView;\n }\n if (childView.id === RIGHTDRAWER) {\n swipemenu.rightDrawer = childView;\n }\n if (childView.id === TOPDRAWER) {\n swipemenu.topDrawer = childView;\n }\n if (childView.id === BOTTOMDRAWER) {\n swipemenu.bottomDrawer = childView;\n }\n },\n removeChild: (parent: NgView, child: NgView) => {\n const swipemenu = parent as any as SwipeMenu;\n const childView = child;\n\n if (childView.id === MAINCONTENT) {\n swipemenu.mainContent = null;\n }\n\n if (childView.id === LEFTDRAWER) {\n swipemenu.leftDrawer = null;\n }\n if (childView.id === RIGHTDRAWER) {\n swipemenu.rightDrawer = null;\n }\n if (childView.id === TOPDRAWER) {\n swipemenu.topDrawer = null;\n }\n if (childView.id === BOTTOMDRAWER) {\n swipemenu.bottomDrawer = null;\n }\n }\n};\n\n/**\n * Directives identifying the SwipeMenu.\n */\nexport const SIDEDRAWER_DIRECTIVES = [LeftSwipeMenuDirective, RightSwipeMenuDirective, TopSwipeMenuDirective, BottomSwipeMenuDirective, MainContentDirective];\n\nregisterElement('SwipeMenu', () => SwipeMenu, sideSwipeMenuMeta);\n\n/**\n * NgModule containing all of the RadSideSwipeMenu directives.\n */\n@NgModule({\n declarations: [SwipeMenuComponent, SIDEDRAWER_DIRECTIVES],\n exports: [SwipeMenuComponent, SIDEDRAWER_DIRECTIVES]\n})\nexport class SwipeMenuModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["installSwipeMenu"],"mappings":";;;;;;AAGAA,OAAgB,EAAE,CAAC;AACnB,MAAM,UAAU,GAAW,eAAe,CAAC;AAC3C,MAAM,WAAW,GAAW,gBAAgB,CAAC;AAC7C,MAAM,SAAS,GAAW,cAAc,CAAC;AACzC,MAAM,YAAY,GAAW,iBAAiB,CAAC;AAC/C,MAAM,WAAW,GAAW,aAAa,CAAC;AAQ1C;;;;AAIG;MAKU,kBAAkB,CAAA;IAO3B,WAAuC,CAAA,UAAsB,EAAoC,aAA+B,EAAA;QAAzF,IAAU,CAAA,UAAA,GAAV,UAAU,CAAY;QAAoC,IAAa,CAAA,aAAA,GAAb,aAAa,CAAkB;QAC5H,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC;KAClD;AAED,IAAA,IAAW,aAAa,GAAA;QACpB,OAAO,IAAI,CAAC,SAAS,CAAC;KACzB;IAED,IAAI,cAAc,CAAC,KAAc,EAAA;AAC7B,QAAA,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAC7B,IAAI,CAAC,oBAAoB,EAAE,CAAC;KAC/B;IAEO,oBAAoB,GAAA;QACxB,I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enu } from '@nativescript-community/ui-collectionview-swipemenu';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export interface ItemEventArgs {
|
|
5
|
+
object: any;
|
|
6
|
+
view: EmbeddedViewRef<any>;
|
|
7
|
+
returnValue?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* This is the SideSwipeMenu component. It separates your mobile app's screen
|
|
11
|
+
* into a main part and a menu part whereby the menu part is shown upon a swipe
|
|
12
|
+
* gesture using a transition effect.
|
|
13
|
+
*/
|
|
14
|
+
export declare class SwipeMenuComponent {
|
|
15
|
+
elementRef: ElementRef;
|
|
16
|
+
private viewContainer;
|
|
17
|
+
swipemenu: SwipeMenu;
|
|
18
|
+
mainTemplate: TemplateRef<ElementRef>;
|
|
19
|
+
swipemenuTemplate: TemplateRef<ElementRef>;
|
|
20
|
+
private _gestureEnabled;
|
|
21
|
+
constructor(elementRef: ElementRef, viewContainer: ViewContainerRef);
|
|
22
|
+
get nativeElement(): SwipeMenu;
|
|
23
|
+
set gestureEnabled(value: boolean);
|
|
24
|
+
private updateGestureEnabled;
|
|
25
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SwipeMenuComponent, never>;
|
|
26
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SwipeMenuComponent, "SwipeMenu", never, {}, {}, never, ["*"], false, never>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Directive identifying the left swipemenu
|
|
30
|
+
*/
|
|
31
|
+
export declare class LeftSwipeMenuDirective {
|
|
32
|
+
private _elementRef;
|
|
33
|
+
constructor(_elementRef: ElementRef);
|
|
34
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LeftSwipeMenuDirective, never>;
|
|
35
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<LeftSwipeMenuDirective, "[leftSwipeMenu]", never, {}, {}, never, never, false, never>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Directive identifying the right swipemenu
|
|
39
|
+
*/
|
|
40
|
+
export declare class RightSwipeMenuDirective {
|
|
41
|
+
private _elementRef;
|
|
42
|
+
constructor(_elementRef: ElementRef);
|
|
43
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RightSwipeMenuDirective, never>;
|
|
44
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<RightSwipeMenuDirective, "[rightSwipeMenu]", never, {}, {}, never, never, false, never>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Directive identifying the right swipemenu
|
|
48
|
+
*/
|
|
49
|
+
export declare class TopSwipeMenuDirective {
|
|
50
|
+
private _elementRef;
|
|
51
|
+
constructor(_elementRef: ElementRef);
|
|
52
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TopSwipeMenuDirective, never>;
|
|
53
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<TopSwipeMenuDirective, "[topSwipeMenu]", never, {}, {}, never, never, false, never>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Directive identifying the right swipemenu
|
|
57
|
+
*/
|
|
58
|
+
export declare class BottomSwipeMenuDirective {
|
|
59
|
+
private _elementRef;
|
|
60
|
+
constructor(_elementRef: ElementRef);
|
|
61
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BottomSwipeMenuDirective, never>;
|
|
62
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BottomSwipeMenuDirective, "[bottomSwipeMenu]", never, {}, {}, never, never, false, never>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Directive identifying the main content.
|
|
66
|
+
*/
|
|
67
|
+
export declare class MainContentDirective {
|
|
68
|
+
private _elementRef;
|
|
69
|
+
constructor(_elementRef: ElementRef);
|
|
70
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MainContentDirective, never>;
|
|
71
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MainContentDirective, "[mainContent]", never, {}, {}, never, never, false, never>;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Directives identifying the SwipeMenu.
|
|
75
|
+
*/
|
|
76
|
+
export declare const SIDEDRAWER_DIRECTIVES: (typeof LeftSwipeMenuDirective | typeof RightSwipeMenuDirective | typeof TopSwipeMenuDirective | typeof BottomSwipeMenuDirective | typeof MainContentDirective)[];
|
|
77
|
+
/**
|
|
78
|
+
* NgModule containing all of the RadSideSwipeMenu directives.
|
|
79
|
+
*/
|
|
80
|
+
export declare class SwipeMenuModule {
|
|
81
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SwipeMenuModule, never>;
|
|
82
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<SwipeMenuModule, [typeof SwipeMenuComponent, typeof LeftSwipeMenuDirective, typeof RightSwipeMenuDirective, typeof TopSwipeMenuDirective, typeof BottomSwipeMenuDirective, typeof MainContentDirective], never, [typeof SwipeMenuComponent, typeof LeftSwipeMenuDirective, typeof RightSwipeMenuDirective, typeof TopSwipeMenuDirective, typeof BottomSwipeMenuDirective, typeof MainContentDirective]>;
|
|
83
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<SwipeMenuModule>;
|
|
84
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nativescript-community/ui-collectionview-swipemenu-angular",
|
|
3
|
+
"main": "index.js",
|
|
4
|
+
"module": "fesm2015/nativescript-community-ui-collectionview-swipemenu-angular.mjs",
|
|
5
|
+
"es2020": "fesm2020/nativescript-community-ui-collectionview-swipemenu-angular.mjs",
|
|
6
|
+
"esm2020": "esm2020/nativescript-community-ui-collectionview-swipemenu-angular.mjs",
|
|
7
|
+
"fesm2020": "fesm2020/nativescript-community-ui-collectionview-swipemenu-angular.mjs",
|
|
8
|
+
"fesm2015": "fesm2015/nativescript-community-ui-collectionview-swipemenu-angular.mjs",
|
|
9
|
+
"typings": "index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
"./package.json": {
|
|
12
|
+
"default": "./package.json"
|
|
13
|
+
},
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./index.d.ts",
|
|
16
|
+
"esm2020": "./esm2020/nativescript-community-ui-collectionview-swipemenu-angular.mjs",
|
|
17
|
+
"es2020": "./fesm2020/nativescript-community-ui-collectionview-swipemenu-angular.mjs",
|
|
18
|
+
"es2015": "./fesm2015/nativescript-community-ui-collectionview-swipemenu-angular.mjs",
|
|
19
|
+
"node": "./fesm2015/nativescript-community-ui-collectionview-swipemenu-angular.mjs",
|
|
20
|
+
"default": "./fesm2020/nativescript-community-ui-collectionview-swipemenu-angular.mjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"tslib": "^2.3.0"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"prepublishOnly": "node --eval \"console.error('ERROR: Trying to publish a package that has been compiled by Ivy in full compilation mode. This is not allowed.\\nPlease delete and rebuild the package with Ivy partial compilation mode, before attempting to publish.\\n')\" && exit 1"
|
|
29
|
+
}
|
|
30
|
+
}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CollectionView } from '@nativescript-community/ui-collectionview';
|
|
2
|
+
import { Drawer } from '@nativescript-community/ui-drawer';
|
|
3
|
+
import { Property, View } from '@nativescript/core';
|
|
4
|
+
export { Side } from '@nativescript-community/ui-drawer';
|
|
5
|
+
export declare const onlyOneMenuOpenedProperty: Property<CollectionView, boolean>;
|
|
6
|
+
declare module '@nativescript-community/ui-collectionview' {
|
|
7
|
+
interface CollectionView {
|
|
8
|
+
notifyForItemAtIndex(eventName: string, view: View, index: number, bindingContext?: any, native?: any): any;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
declare class CollectionViewWithSwipeMenu extends CollectionView {
|
|
12
|
+
onlyOneMenuOpened: any;
|
|
13
|
+
openedDrawerIndex: number;
|
|
14
|
+
setItemAtIndex(index: number, item: any): any;
|
|
15
|
+
closeCurrentMenu(): Promise<void>;
|
|
16
|
+
onItemMenuStart(event: any): Promise<void>;
|
|
17
|
+
onItemMenuOpened(event: any): void;
|
|
18
|
+
onItemMenuClosed(event: any): void;
|
|
19
|
+
}
|
|
20
|
+
export declare function overrideCollectionView(): void;
|
|
21
|
+
export declare class SwipeMenu extends Drawer {
|
|
22
|
+
constructor();
|
|
23
|
+
getParentCollectionView(): CollectionViewWithSwipeMenu;
|
|
24
|
+
initNativeView(): void;
|
|
25
|
+
disposeNativeView(): void;
|
|
26
|
+
}
|
|
27
|
+
export declare function install(): void;
|
package/index.js
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { applyMixins } from '@nativescript-community/class-mixins';
|
|
2
|
+
import { CollectionView, CollectionViewBase } from '@nativescript-community/ui-collectionview';
|
|
3
|
+
import { Drawer, install as installDrawer } from '@nativescript-community/ui-drawer';
|
|
4
|
+
import { CSSType, ContentView, Property, View, booleanConverter } from '@nativescript/core';
|
|
5
|
+
export const onlyOneMenuOpenedProperty = new Property({
|
|
6
|
+
defaultValue: true,
|
|
7
|
+
valueConverter: booleanConverter,
|
|
8
|
+
name: 'onlyOneMenuOpened'
|
|
9
|
+
});
|
|
10
|
+
let mixinInstalled = false;
|
|
11
|
+
class CollectionViewWithSwipeMenu extends CollectionView {
|
|
12
|
+
setItemAtIndex(index, item) {
|
|
13
|
+
// will be overriden in onItemsChangedInternal
|
|
14
|
+
const thisItems = this.items;
|
|
15
|
+
if (thisItems['setItem']) {
|
|
16
|
+
thisItems['setItem'](index, item);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
thisItems[index] = item;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
async closeCurrentMenu() {
|
|
23
|
+
try {
|
|
24
|
+
const openedIndex = this.openedDrawerIndex;
|
|
25
|
+
this.openedDrawerIndex = -1;
|
|
26
|
+
let view = this.getViewForItemAtIndex(openedIndex);
|
|
27
|
+
// console.log('closeCurrentMenu', openedIndex, view, view.bindingContext);
|
|
28
|
+
if (view instanceof ContentView) {
|
|
29
|
+
view = view.content;
|
|
30
|
+
}
|
|
31
|
+
if (view instanceof Drawer) {
|
|
32
|
+
view.close();
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
const oldItem = this.getItemAtIndex(openedIndex);
|
|
36
|
+
// console.log('closeCurrentMenu', view, openedIndex, oldItem, new Error().stack);
|
|
37
|
+
oldItem.startingSide = null;
|
|
38
|
+
// this.notifyForItemAtIndex(CollectionViewBase.itemLoadingEvent, view, openedIndex, oldItem);
|
|
39
|
+
setTimeout(() => {
|
|
40
|
+
this.setItemAtIndex(openedIndex, oldItem);
|
|
41
|
+
}, 0);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
console.error('closeCurrentMenu', error, error.stack);
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async onItemMenuStart(event) {
|
|
51
|
+
const view = event.object;
|
|
52
|
+
const bindingContext = view.bindingContext;
|
|
53
|
+
const index = this.items.findIndex((i) => i === bindingContext);
|
|
54
|
+
// console.error('onItemMenuStart', index, bindingContext, view, this.openedDrawerIndex);
|
|
55
|
+
if (this.openedDrawerIndex !== index && this.openedDrawerIndex >= 0) {
|
|
56
|
+
this.closeCurrentMenu();
|
|
57
|
+
}
|
|
58
|
+
this.openedDrawerIndex = index;
|
|
59
|
+
}
|
|
60
|
+
onItemMenuOpened(event) {
|
|
61
|
+
const view = event.object;
|
|
62
|
+
const bindingContext = view.bindingContext;
|
|
63
|
+
const index = this.items.findIndex((i) => i === bindingContext);
|
|
64
|
+
// console.error('onItemMenuOpened', index, bindingContext, view, this.openedDrawerIndex);
|
|
65
|
+
if (this.openedDrawerIndex >= 0 && this.openedDrawerIndex !== index) {
|
|
66
|
+
this.closeCurrentMenu();
|
|
67
|
+
}
|
|
68
|
+
this.openedDrawerIndex = index;
|
|
69
|
+
bindingContext.startingSide = view.startingSide = 'left';
|
|
70
|
+
this.notifyForItemAtIndex(CollectionViewBase.itemLoadingEvent, view, index, bindingContext);
|
|
71
|
+
}
|
|
72
|
+
onItemMenuClosed(event) {
|
|
73
|
+
const view = event.object;
|
|
74
|
+
const bindingContext = view.bindingContext;
|
|
75
|
+
const index = this.items.findIndex((i) => i === bindingContext);
|
|
76
|
+
// console.error('onItemMenuClosed', index, bindingContext, view, this.openedDrawerIndex);
|
|
77
|
+
if (bindingContext.startingSide !== null) {
|
|
78
|
+
if (index === this.openedDrawerIndex) {
|
|
79
|
+
this.openedDrawerIndex = -1;
|
|
80
|
+
}
|
|
81
|
+
bindingContext.startingSide = view.startingSide = null;
|
|
82
|
+
this.notifyForItemAtIndex(CollectionViewBase.itemLoadingEvent, view, index, bindingContext);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
export function overrideCollectionView() {
|
|
87
|
+
applyMixins(CollectionView, [CollectionViewWithSwipeMenu]);
|
|
88
|
+
}
|
|
89
|
+
let SwipeMenu = class SwipeMenu extends Drawer {
|
|
90
|
+
constructor() {
|
|
91
|
+
super();
|
|
92
|
+
this.gestureHandlerOptions = { activeOffsetXStart: -10, activeOffsetXEnd: 10, failOffsetYStart: -10, failOffsetYEnd: 10, minDist: 15 };
|
|
93
|
+
this.leftOpenedDrawerAllowDraging = true;
|
|
94
|
+
this.rightOpenedDrawerAllowDraging = true;
|
|
95
|
+
this.topOpenedDrawerAllowDraging = true;
|
|
96
|
+
this.bottomOpenedDrawerAllowDraging = true;
|
|
97
|
+
this.iosIgnoreSafeArea = true;
|
|
98
|
+
this.backDropEnabled = false;
|
|
99
|
+
this.leftDrawerMode = 'under';
|
|
100
|
+
this.rightDrawerMode = 'under';
|
|
101
|
+
this.topDrawerMode = 'under';
|
|
102
|
+
this.bottomDrawerMode = 'under';
|
|
103
|
+
}
|
|
104
|
+
getParentCollectionView() {
|
|
105
|
+
let collectionview = this.parent;
|
|
106
|
+
while (collectionview && !(collectionview instanceof CollectionView)) {
|
|
107
|
+
collectionview = collectionview.parent;
|
|
108
|
+
}
|
|
109
|
+
return collectionview instanceof CollectionView ? collectionview : null;
|
|
110
|
+
}
|
|
111
|
+
initNativeView() {
|
|
112
|
+
super.initNativeView();
|
|
113
|
+
const collectionview = this.getParentCollectionView();
|
|
114
|
+
if (collectionview) {
|
|
115
|
+
this.on('start', collectionview.onItemMenuStart, collectionview);
|
|
116
|
+
this.on('open', collectionview.onItemMenuOpened, collectionview);
|
|
117
|
+
this.on('close', collectionview.onItemMenuClosed, collectionview);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
disposeNativeView() {
|
|
121
|
+
super.disposeNativeView();
|
|
122
|
+
const collectionview = this.getParentCollectionView();
|
|
123
|
+
if (collectionview) {
|
|
124
|
+
this.on('start', collectionview.onItemMenuStart, collectionview);
|
|
125
|
+
this.on('open', collectionview.onItemMenuOpened, collectionview);
|
|
126
|
+
this.on('close', collectionview.onItemMenuClosed, collectionview);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
SwipeMenu = __decorate([
|
|
131
|
+
CSSType('SwipeMenu')
|
|
132
|
+
], SwipeMenu);
|
|
133
|
+
export { SwipeMenu };
|
|
134
|
+
export function install() {
|
|
135
|
+
if (!mixinInstalled) {
|
|
136
|
+
mixinInstalled = true;
|
|
137
|
+
installDrawer();
|
|
138
|
+
overrideCollectionView();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nativescript-community/ui-collectionview-swipemenu",
|
|
3
|
+
"version": "5.0.3",
|
|
4
|
+
"description": "A NativeScript CollectionView SwipeMenu Plugin.",
|
|
5
|
+
"main": "./index",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"typings": "./index.d.ts",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/nativescript-community/ui-collectionview.git"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "npm run tsc && npm run readme",
|
|
14
|
+
"build.all": "npm run build && npm run build.angular",
|
|
15
|
+
"build.angular": "ng-packagr -p ../../src/swipemenu/angular/ng-package.json -c ../../src/swipemenu/angular/tsconfig.json",
|
|
16
|
+
"readme": "readme generate -c ../../tools/readme/blueprint.json",
|
|
17
|
+
"tsc": "cpy '**/*.d.ts' '../../packages/swipemenu' --parents --cwd=../../src/swipemenu && tsc -skipLibCheck -d",
|
|
18
|
+
"clean": "rimraf ./*.d.ts ./*.js ./*.js.map"
|
|
19
|
+
},
|
|
20
|
+
"nativescript": {
|
|
21
|
+
"platforms": {
|
|
22
|
+
"android": "6.1.0",
|
|
23
|
+
"ios": "6.1.0"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"NativeScript",
|
|
28
|
+
"JavaScript",
|
|
29
|
+
"Android",
|
|
30
|
+
"iOS"
|
|
31
|
+
],
|
|
32
|
+
"author": {
|
|
33
|
+
"name": "Martin Guillon",
|
|
34
|
+
"email": "martin@akylas.fr"
|
|
35
|
+
},
|
|
36
|
+
"license": "ISC",
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/nativescript-community/ui-collectionview/issues"
|
|
39
|
+
},
|
|
40
|
+
"homepage": "https://github.com/nativescript-community/ui-collectionview#readme",
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@nativescript-community/class-mixins": "^1.0.0",
|
|
43
|
+
"@nativescript-community/ui-collectionview": "^5.0.4",
|
|
44
|
+
"@nativescript-community/ui-drawer": "^0.1.12"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NativeViewElementNode } from 'svelte-native/dom';
|
|
2
|
+
import { Side, SwipeMenu } from '../';
|
|
3
|
+
export default class DrawerElement extends NativeViewElementNode<SwipeMenu> {
|
|
4
|
+
constructor();
|
|
5
|
+
private get _drawer();
|
|
6
|
+
close(side?: Side): void;
|
|
7
|
+
isOpened(side?: Side): boolean;
|
|
8
|
+
open(side?: Side): void;
|
|
9
|
+
toggle(side?: Side): void;
|
|
10
|
+
static register(): void;
|
|
11
|
+
}
|
package/svelte/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { NativeViewElementNode, registerElement } from 'svelte-native/dom';
|
|
2
|
+
import { SwipeMenu, install } from '../';
|
|
3
|
+
export default class DrawerElement extends NativeViewElementNode {
|
|
4
|
+
constructor() {
|
|
5
|
+
super('swipemenu', SwipeMenu);
|
|
6
|
+
}
|
|
7
|
+
get _drawer() {
|
|
8
|
+
return this.nativeView;
|
|
9
|
+
}
|
|
10
|
+
close(side) {
|
|
11
|
+
this._drawer.close(side);
|
|
12
|
+
}
|
|
13
|
+
isOpened(side) {
|
|
14
|
+
return this._drawer.isOpened(side);
|
|
15
|
+
}
|
|
16
|
+
open(side) {
|
|
17
|
+
this._drawer.open(side);
|
|
18
|
+
}
|
|
19
|
+
toggle(side) {
|
|
20
|
+
this._drawer.toggle(side);
|
|
21
|
+
}
|
|
22
|
+
static register() {
|
|
23
|
+
install();
|
|
24
|
+
registerElement('swipemenu', () => new DrawerElement());
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
package/vue/component.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {},
|
|
3
|
+
template: `
|
|
4
|
+
<NativeSwipeMenu
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
v-on="$listeners">
|
|
7
|
+
<slot />
|
|
8
|
+
</NativeSwipeMenu>
|
|
9
|
+
`,
|
|
10
|
+
methods: {
|
|
11
|
+
open(side) {
|
|
12
|
+
return this.$refs.drawer.nativeView.open(side);
|
|
13
|
+
},
|
|
14
|
+
close(side) {
|
|
15
|
+
return this.$refs.drawer.nativeView.close(side);
|
|
16
|
+
},
|
|
17
|
+
isOpened(side) {
|
|
18
|
+
return this.$refs.drawer.nativeView.isOpened(side);
|
|
19
|
+
},
|
|
20
|
+
toggle(side) {
|
|
21
|
+
return this.$refs.drawer.nativeView.toggle(side);
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=component.js.map
|
package/vue/index.d.ts
ADDED