1 | var ScrollViewBase_1;
|
2 | import { ContentView } from '../content-view';
|
3 | import { profile } from '../../profiling';
|
4 | import { Property, makeParser, makeValidator } from '../core/properties';
|
5 | import { CSSType } from '../core/view';
|
6 | import { booleanConverter } from '../core/view-base';
|
7 | import { CoreTypes } from '../../core-types';
|
8 | let ScrollViewBase = ScrollViewBase_1 = class ScrollViewBase extends ContentView {
|
9 | constructor() {
|
10 | super(...arguments);
|
11 | this._scrollChangeCount = 0;
|
12 | }
|
13 | addEventListener(arg, callback, thisArg) {
|
14 | super.addEventListener(arg, callback, thisArg);
|
15 | if (arg === ScrollViewBase_1.scrollEvent) {
|
16 | this._scrollChangeCount++;
|
17 | this.attach();
|
18 | }
|
19 | }
|
20 | removeEventListener(arg, callback, thisArg) {
|
21 | super.removeEventListener(arg, callback, thisArg);
|
22 | if (arg === ScrollViewBase_1.scrollEvent) {
|
23 | this._scrollChangeCount--;
|
24 | this.dettach();
|
25 | }
|
26 | }
|
27 | onLoaded() {
|
28 | super.onLoaded();
|
29 | this.attach();
|
30 | }
|
31 | onUnloaded() {
|
32 | super.onUnloaded();
|
33 | this.dettach();
|
34 | }
|
35 | attach() {
|
36 | if (this._scrollChangeCount > 0 && this.isLoaded) {
|
37 | this.attachNative();
|
38 | }
|
39 | }
|
40 | dettach() {
|
41 | if (this._scrollChangeCount === 0 && this.isLoaded) {
|
42 | this.dettachNative();
|
43 | }
|
44 | }
|
45 | attachNative() {
|
46 |
|
47 | }
|
48 | dettachNative() {
|
49 |
|
50 | }
|
51 | get horizontalOffset() {
|
52 | return 0;
|
53 | }
|
54 | get verticalOffset() {
|
55 | return 0;
|
56 | }
|
57 | get scrollableWidth() {
|
58 | return 0;
|
59 | }
|
60 | get scrollableHeight() {
|
61 | return 0;
|
62 | }
|
63 | };
|
64 | ScrollViewBase.scrollEvent = 'scroll';
|
65 | __decorate([
|
66 | profile,
|
67 | __metadata("design:type", Function),
|
68 | __metadata("design:paramtypes", []),
|
69 | __metadata("design:returntype", void 0)
|
70 | ], ScrollViewBase.prototype, "onLoaded", null);
|
71 | ScrollViewBase = ScrollViewBase_1 = __decorate([
|
72 | CSSType('ScrollView')
|
73 | ], ScrollViewBase);
|
74 | export { ScrollViewBase };
|
75 | const converter = makeParser(makeValidator(CoreTypes.Orientation.horizontal, CoreTypes.Orientation.vertical));
|
76 | export const orientationProperty = new Property({
|
77 | name: 'orientation',
|
78 | defaultValue: CoreTypes.Orientation.vertical,
|
79 | affectsLayout: true,
|
80 | valueChanged: (target, oldValue, newValue) => {
|
81 | target._onOrientationChanged();
|
82 | },
|
83 | valueConverter: converter,
|
84 | });
|
85 | orientationProperty.register(ScrollViewBase);
|
86 | export const scrollBarIndicatorVisibleProperty = new Property({
|
87 | name: 'scrollBarIndicatorVisible',
|
88 | defaultValue: true,
|
89 | valueConverter: booleanConverter,
|
90 | });
|
91 | scrollBarIndicatorVisibleProperty.register(ScrollViewBase);
|
92 | export const isScrollEnabledProperty = new Property({
|
93 | name: 'isScrollEnabled',
|
94 | defaultValue: true,
|
95 | valueConverter: booleanConverter,
|
96 | });
|
97 | isScrollEnabledProperty.register(ScrollViewBase);
|
98 |
|
\ | No newline at end of file |