vevet 2.10.0 → 2.11.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/build/cdn/index.js +1 -1
- package/build/cjs/components/page/Page.js +32 -0
- package/build/es/components/page/Page.js +27 -0
- package/build/types/components/page/Page.d.ts +11 -0
- package/build/types/components/page/Page.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ts/components/page/Page.ts +34 -0
|
@@ -47,6 +47,7 @@ var Page = /** @class */ (function (_super) {
|
|
|
47
47
|
// set default vars
|
|
48
48
|
_this._blocked = false;
|
|
49
49
|
_this._created = false;
|
|
50
|
+
_this._beforeShown = false;
|
|
50
51
|
_this._shown = false;
|
|
51
52
|
_this._hidden = false;
|
|
52
53
|
_this._destroyed = false;
|
|
@@ -71,6 +72,13 @@ var Page = /** @class */ (function (_super) {
|
|
|
71
72
|
enumerable: false,
|
|
72
73
|
configurable: true
|
|
73
74
|
});
|
|
75
|
+
Object.defineProperty(Page.prototype, "beforeShown", {
|
|
76
|
+
get: function () {
|
|
77
|
+
return this._beforeShown;
|
|
78
|
+
},
|
|
79
|
+
enumerable: false,
|
|
80
|
+
configurable: true
|
|
81
|
+
});
|
|
74
82
|
Object.defineProperty(Page.prototype, "shown", {
|
|
75
83
|
get: function () {
|
|
76
84
|
return this._shown;
|
|
@@ -117,6 +125,7 @@ var Page = /** @class */ (function (_super) {
|
|
|
117
125
|
}
|
|
118
126
|
// update vars
|
|
119
127
|
_this._blocked = true;
|
|
128
|
+
_this._beforeShown = false;
|
|
120
129
|
_this._shown = false;
|
|
121
130
|
_this._hidden = false;
|
|
122
131
|
_this._destroyed = false;
|
|
@@ -177,6 +186,8 @@ var Page = /** @class */ (function (_super) {
|
|
|
177
186
|
_this._hidden = false;
|
|
178
187
|
_this._destroyed = false;
|
|
179
188
|
// actions
|
|
189
|
+
_this.callbacks.tbt('beforeshow', false);
|
|
190
|
+
_this._beforeShown = true;
|
|
180
191
|
_this._show().then(function () {
|
|
181
192
|
_this.callbacks.tbt('show', false);
|
|
182
193
|
_this._blocked = false;
|
|
@@ -226,6 +237,7 @@ var Page = /** @class */ (function (_super) {
|
|
|
226
237
|
// update vars
|
|
227
238
|
_this._blocked = true;
|
|
228
239
|
_this._created = true;
|
|
240
|
+
_this._beforeShown = false;
|
|
229
241
|
_this._shown = false;
|
|
230
242
|
_this._destroyed = false;
|
|
231
243
|
// actions
|
|
@@ -277,6 +289,7 @@ var Page = /** @class */ (function (_super) {
|
|
|
277
289
|
// change vars
|
|
278
290
|
_this._blocked = true;
|
|
279
291
|
_this._created = false;
|
|
292
|
+
_this._beforeShown = false;
|
|
280
293
|
_this._shown = false;
|
|
281
294
|
_this._hidden = true;
|
|
282
295
|
// update page
|
|
@@ -357,6 +370,25 @@ var Page = /** @class */ (function (_super) {
|
|
|
357
370
|
}
|
|
358
371
|
});
|
|
359
372
|
};
|
|
373
|
+
/**
|
|
374
|
+
* Add a 'show' callback.
|
|
375
|
+
* If the callback was added after the page was shown, it will be triggered immediately.
|
|
376
|
+
*/
|
|
377
|
+
Page.prototype.onBeforeShow = function () {
|
|
378
|
+
var _this = this;
|
|
379
|
+
return new p_cancelable_1.default(function (resolve) {
|
|
380
|
+
if (_this.shown || _this.beforeShown) {
|
|
381
|
+
resolve();
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
_this.addCallback('beforeshow', function () {
|
|
385
|
+
resolve();
|
|
386
|
+
}, {
|
|
387
|
+
once: true,
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
};
|
|
360
392
|
/**
|
|
361
393
|
* Add a 'hide' callback.
|
|
362
394
|
* If the callback was added after the page was hidden, it will be triggered immediately.
|
|
@@ -13,6 +13,7 @@ export class Page extends Component {
|
|
|
13
13
|
// set default vars
|
|
14
14
|
this._blocked = false;
|
|
15
15
|
this._created = false;
|
|
16
|
+
this._beforeShown = false;
|
|
16
17
|
this._shown = false;
|
|
17
18
|
this._hidden = false;
|
|
18
19
|
this._destroyed = false;
|
|
@@ -28,6 +29,9 @@ export class Page extends Component {
|
|
|
28
29
|
get created() {
|
|
29
30
|
return this._created;
|
|
30
31
|
}
|
|
32
|
+
get beforeShown() {
|
|
33
|
+
return this._beforeShown;
|
|
34
|
+
}
|
|
31
35
|
get shown() {
|
|
32
36
|
return this._shown;
|
|
33
37
|
}
|
|
@@ -56,6 +60,7 @@ export class Page extends Component {
|
|
|
56
60
|
}
|
|
57
61
|
// update vars
|
|
58
62
|
this._blocked = true;
|
|
63
|
+
this._beforeShown = false;
|
|
59
64
|
this._shown = false;
|
|
60
65
|
this._hidden = false;
|
|
61
66
|
this._destroyed = false;
|
|
@@ -114,6 +119,8 @@ export class Page extends Component {
|
|
|
114
119
|
this._hidden = false;
|
|
115
120
|
this._destroyed = false;
|
|
116
121
|
// actions
|
|
122
|
+
this.callbacks.tbt('beforeshow', false);
|
|
123
|
+
this._beforeShown = true;
|
|
117
124
|
this._show().then(() => {
|
|
118
125
|
this.callbacks.tbt('show', false);
|
|
119
126
|
this._blocked = false;
|
|
@@ -161,6 +168,7 @@ export class Page extends Component {
|
|
|
161
168
|
// update vars
|
|
162
169
|
this._blocked = true;
|
|
163
170
|
this._created = true;
|
|
171
|
+
this._beforeShown = false;
|
|
164
172
|
this._shown = false;
|
|
165
173
|
this._destroyed = false;
|
|
166
174
|
// actions
|
|
@@ -210,6 +218,7 @@ export class Page extends Component {
|
|
|
210
218
|
// change vars
|
|
211
219
|
this._blocked = true;
|
|
212
220
|
this._created = false;
|
|
221
|
+
this._beforeShown = false;
|
|
213
222
|
this._shown = false;
|
|
214
223
|
this._hidden = true;
|
|
215
224
|
// update page
|
|
@@ -286,6 +295,24 @@ export class Page extends Component {
|
|
|
286
295
|
}
|
|
287
296
|
});
|
|
288
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* Add a 'show' callback.
|
|
300
|
+
* If the callback was added after the page was shown, it will be triggered immediately.
|
|
301
|
+
*/
|
|
302
|
+
onBeforeShow() {
|
|
303
|
+
return new PCancelable((resolve) => {
|
|
304
|
+
if (this.shown || this.beforeShown) {
|
|
305
|
+
resolve();
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
this.addCallback('beforeshow', () => {
|
|
309
|
+
resolve();
|
|
310
|
+
}, {
|
|
311
|
+
once: true,
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
}
|
|
289
316
|
/**
|
|
290
317
|
* Add a 'hide' callback.
|
|
291
318
|
* If the callback was added after the page was hidden, it will be triggered immediately.
|
|
@@ -22,6 +22,7 @@ export declare namespace NPage {
|
|
|
22
22
|
*/
|
|
23
23
|
interface CallbacksTypes extends NComponent.CallbacksTypes {
|
|
24
24
|
'create': false;
|
|
25
|
+
'beforeshow': false;
|
|
25
26
|
'show': false;
|
|
26
27
|
'hide': false;
|
|
27
28
|
'destroy': false;
|
|
@@ -42,6 +43,11 @@ export declare class Page<StaticProp extends NPage.StaticProp = NPage.StaticProp
|
|
|
42
43
|
*/
|
|
43
44
|
protected _created: boolean;
|
|
44
45
|
get created(): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* If 'beforeshow' callback is called
|
|
48
|
+
*/
|
|
49
|
+
protected _beforeShown: boolean;
|
|
50
|
+
get beforeShown(): boolean;
|
|
45
51
|
/**
|
|
46
52
|
* If the page is shown
|
|
47
53
|
*/
|
|
@@ -119,6 +125,11 @@ export declare class Page<StaticProp extends NPage.StaticProp = NPage.StaticProp
|
|
|
119
125
|
* If the callback was added after the page was shown, it will be triggered immediately.
|
|
120
126
|
*/
|
|
121
127
|
onShow(): PCancelable<void>;
|
|
128
|
+
/**
|
|
129
|
+
* Add a 'show' callback.
|
|
130
|
+
* If the callback was added after the page was shown, it will be triggered immediately.
|
|
131
|
+
*/
|
|
132
|
+
onBeforeShow(): PCancelable<void>;
|
|
122
133
|
/**
|
|
123
134
|
* Add a 'hide' callback.
|
|
124
135
|
* If the callback was added after the page was hidden, it will be triggered immediately.
|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AO,CAAC;IAC5B,IAAI,OAAO,YAEV;IAED;;OAEG;IACH,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC;IAChC,IAAI,WAAW,YAEd;IACD;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC;IAC1B,IAAI,KAAK,YAER;IAED;;OAEG;IACH,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC;IAC3B,IAAI,MAAM,YAET;IAED;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC5B,IAAI,OAAO,YAEV;IAED,IAAI,aAAa,WAEhB;gBAGG,WAAW,CAAC,EAAE,CAAC,UAAU,GAAG,cAAc,CAAC,EAC3C,IAAI,UAAO;IAmBf,SAAS,CAAC,eAAe,CACrB,CAAC,SAAS,kBAAkB,CAAC,UAAU,GAAG,cAAc,CAAC,KACvD,CAAC;IASP;;;OAGG;IACI,MAAM,CACT,OAAO,UAAQ;IAsCnB;;OAEG;IACH,SAAS,CAAC,OAAO;IAQjB;;OAEG;IACI,SAAS;IAchB;;OAEG;IACI,IAAI;IAiCX;;OAEG;IACH,SAAS,CAAC,KAAK;IAQf;;OAEG;IACI,OAAO;IAcd;;OAEG;IACI,IAAI;IAgCX;;OAEG;IACH,SAAS,CAAC,KAAK;IAQf;;OAEG;IACI,OAAO;IAcd;;OAEG;IACI,OAAO;IAoCd;;OAEG;IACH,SAAS,CAAC,QAAQ;IASlB;;OAEG;IACI,UAAU;IAcjB;;;OAGG;IACH,QAAQ;IAgBR;;;OAGG;IACH,MAAM;IAgBN;;;OAGG;IACH,YAAY;IAgBZ;;;OAGG;IACH,MAAM;CAeT"}
|
package/package.json
CHANGED
|
@@ -27,6 +27,7 @@ export namespace NPage {
|
|
|
27
27
|
*/
|
|
28
28
|
export interface CallbacksTypes extends NComponent.CallbacksTypes {
|
|
29
29
|
'create': false;
|
|
30
|
+
'beforeshow': false;
|
|
30
31
|
'show': false;
|
|
31
32
|
'hide': false;
|
|
32
33
|
'destroy': false;
|
|
@@ -65,6 +66,13 @@ export class Page <
|
|
|
65
66
|
return this._created;
|
|
66
67
|
}
|
|
67
68
|
|
|
69
|
+
/**
|
|
70
|
+
* If 'beforeshow' callback is called
|
|
71
|
+
*/
|
|
72
|
+
protected _beforeShown: boolean;
|
|
73
|
+
get beforeShown () {
|
|
74
|
+
return this._beforeShown;
|
|
75
|
+
}
|
|
68
76
|
/**
|
|
69
77
|
* If the page is shown
|
|
70
78
|
*/
|
|
@@ -102,6 +110,7 @@ export class Page <
|
|
|
102
110
|
// set default vars
|
|
103
111
|
this._blocked = false;
|
|
104
112
|
this._created = false;
|
|
113
|
+
this._beforeShown = false;
|
|
105
114
|
this._shown = false;
|
|
106
115
|
this._hidden = false;
|
|
107
116
|
this._destroyed = false;
|
|
@@ -141,6 +150,7 @@ export class Page <
|
|
|
141
150
|
}
|
|
142
151
|
// update vars
|
|
143
152
|
this._blocked = true;
|
|
153
|
+
this._beforeShown = false;
|
|
144
154
|
this._shown = false;
|
|
145
155
|
this._hidden = false;
|
|
146
156
|
this._destroyed = false;
|
|
@@ -213,6 +223,8 @@ export class Page <
|
|
|
213
223
|
this._destroyed = false;
|
|
214
224
|
|
|
215
225
|
// actions
|
|
226
|
+
this.callbacks.tbt('beforeshow', false);
|
|
227
|
+
this._beforeShown = true;
|
|
216
228
|
this._show().then(() => {
|
|
217
229
|
this.callbacks.tbt('show', false);
|
|
218
230
|
this._blocked = false;
|
|
@@ -272,6 +284,7 @@ export class Page <
|
|
|
272
284
|
// update vars
|
|
273
285
|
this._blocked = true;
|
|
274
286
|
this._created = true;
|
|
287
|
+
this._beforeShown = false;
|
|
275
288
|
this._shown = false;
|
|
276
289
|
this._destroyed = false;
|
|
277
290
|
|
|
@@ -334,6 +347,7 @@ export class Page <
|
|
|
334
347
|
// change vars
|
|
335
348
|
this._blocked = true;
|
|
336
349
|
this._created = false;
|
|
350
|
+
this._beforeShown = false;
|
|
337
351
|
this._shown = false;
|
|
338
352
|
this._hidden = true;
|
|
339
353
|
|
|
@@ -425,6 +439,26 @@ export class Page <
|
|
|
425
439
|
});
|
|
426
440
|
}
|
|
427
441
|
|
|
442
|
+
/**
|
|
443
|
+
* Add a 'show' callback.
|
|
444
|
+
* If the callback was added after the page was shown, it will be triggered immediately.
|
|
445
|
+
*/
|
|
446
|
+
onBeforeShow () {
|
|
447
|
+
return new PCancelable<void>((
|
|
448
|
+
resolve,
|
|
449
|
+
) => {
|
|
450
|
+
if (this.shown || this.beforeShown) {
|
|
451
|
+
resolve();
|
|
452
|
+
} else {
|
|
453
|
+
this.addCallback('beforeshow', () => {
|
|
454
|
+
resolve();
|
|
455
|
+
}, {
|
|
456
|
+
once: true,
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
|
|
428
462
|
/**
|
|
429
463
|
* Add a 'hide' callback.
|
|
430
464
|
* If the callback was added after the page was hidden, it will be triggered immediately.
|