1 | import { ViewBase } from '../core/view-base';
|
2 | import { isNullOrUndefined, isString } from '../../utils/types';
|
3 | export class Span extends ViewBase {
|
4 | constructor() {
|
5 | super(...arguments);
|
6 | this._tappable = false;
|
7 | }
|
8 | get fontFamily() {
|
9 | return this.style.fontFamily;
|
10 | }
|
11 | set fontFamily(value) {
|
12 | this.style.fontFamily = value;
|
13 | }
|
14 | get fontSize() {
|
15 | return this.style.fontSize;
|
16 | }
|
17 | set fontSize(value) {
|
18 | this.style.fontSize = value;
|
19 | }
|
20 |
|
21 | get fontStyle() {
|
22 | return this.style.fontStyle;
|
23 | }
|
24 | set fontStyle(value) {
|
25 | this.style.fontStyle = value;
|
26 | }
|
27 |
|
28 | get fontWeight() {
|
29 | return this.style.fontWeight;
|
30 | }
|
31 | set fontWeight(value) {
|
32 | this.style.fontWeight = value;
|
33 | }
|
34 | get fontVariationSettings() {
|
35 | return this.style.fontVariationSettings;
|
36 | }
|
37 | set fontVariationSettings(value) {
|
38 | this.style.fontVariationSettings = value;
|
39 | }
|
40 | get textDecoration() {
|
41 | return this.style.textDecoration;
|
42 | }
|
43 | set textDecoration(value) {
|
44 | this.style.textDecoration = value;
|
45 | }
|
46 | get color() {
|
47 | return this.style.color;
|
48 | }
|
49 | set color(value) {
|
50 | this.style.color = value;
|
51 | }
|
52 | get backgroundColor() {
|
53 | return this.style.backgroundColor;
|
54 | }
|
55 | set backgroundColor(value) {
|
56 | this.style.backgroundColor = value;
|
57 | }
|
58 | get iosAccessibilityAdjustsFontSize() {
|
59 | return this.style.iosAccessibilityAdjustsFontSize;
|
60 | }
|
61 | set iosAccessibilityAdjustsFontSize(value) {
|
62 | this.style.iosAccessibilityAdjustsFontSize = value;
|
63 | }
|
64 | get iosAccessibilityMinFontScale() {
|
65 | return this.style.iosAccessibilityMinFontScale;
|
66 | }
|
67 | set iosAccessibilityMinFontScale(value) {
|
68 | this.style.iosAccessibilityMinFontScale = value;
|
69 | }
|
70 | get iosAccessibilityMaxFontScale() {
|
71 | return this.style.iosAccessibilityMaxFontScale;
|
72 | }
|
73 | set iosAccessibilityMaxFontScale(value) {
|
74 | this.style.iosAccessibilityMaxFontScale = value;
|
75 | }
|
76 | get text() {
|
77 | return this._text;
|
78 | }
|
79 | set text(value) {
|
80 | if (this._text !== value) {
|
81 | if (isNullOrUndefined(value)) {
|
82 | this._text = '';
|
83 | }
|
84 | else {
|
85 |
|
86 | this._text = isString(value) ? `${value}`.replace('\\n', '\n').replace('\\t', '\t') : `${value}`;
|
87 | }
|
88 | this.notifyPropertyChange('text', this._text);
|
89 | }
|
90 | }
|
91 | get tappable() {
|
92 | return this._tappable;
|
93 | }
|
94 | addEventListener(arg, callback, thisArg) {
|
95 | super.addEventListener(arg, callback, thisArg);
|
96 | this._setTappable(this.hasListeners(Span.linkTapEvent));
|
97 | }
|
98 | removeEventListener(arg, callback, thisArg) {
|
99 | super.removeEventListener(arg, callback, thisArg);
|
100 | this._setTappable(this.hasListeners(Span.linkTapEvent));
|
101 | }
|
102 | _setTextInternal(value) {
|
103 | this._text = value;
|
104 | }
|
105 | _setTappable(value) {
|
106 | if (this._tappable !== value) {
|
107 | this._tappable = value;
|
108 | this.notifyPropertyChange('tappable', value);
|
109 | }
|
110 | }
|
111 | }
|
112 | Span.linkTapEvent = 'linkTap';
|
113 |
|
\ | No newline at end of file |