@nativescript-community/ui-label 1.2.14 → 1.2.15
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 +4 -0
- package/label.android.js +44 -46
- package/label.ios.js +26 -23
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [1.2.15](https://github.com/nativescript-community/ui-label/compare/v1.2.14...v1.2.15) (2022-11-21)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @nativescript-community/ui-label
|
9
|
+
|
6
10
|
## [1.2.14](https://github.com/nativescript-community/ui-label/compare/v1.2.13...v1.2.14) (2022-11-20)
|
7
11
|
|
8
12
|
**Note:** Version bump only for package @nativescript-community/ui-label
|
package/label.android.js
CHANGED
@@ -51,27 +51,26 @@ function initializeClickableSpan() {
|
|
51
51
|
if (ClickableSpan) {
|
52
52
|
return;
|
53
53
|
}
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
updateDrawState(tp) {
|
69
|
-
// don't style as link
|
70
|
-
}
|
54
|
+
var ClickableSpanImpl = /** @class */ (function (_super) {
|
55
|
+
__extends(ClickableSpanImpl, _super);
|
56
|
+
function ClickableSpanImpl(owner) {
|
57
|
+
var _this = _super.call(this) || this;
|
58
|
+
_this.owner = new WeakRef(owner);
|
59
|
+
return global.__native(_this);
|
60
|
+
}
|
61
|
+
ClickableSpanImpl.prototype.onClick = function (view) {
|
62
|
+
var owner = this.owner.get();
|
63
|
+
if (owner) {
|
64
|
+
owner._emit(Span.linkTapEvent);
|
65
|
+
}
|
66
|
+
view.clearFocus();
|
67
|
+
view.invalidate();
|
71
68
|
};
|
72
|
-
ClickableSpanImpl =
|
73
|
-
|
74
|
-
|
69
|
+
ClickableSpanImpl.prototype.updateDrawState = function (tp) {
|
70
|
+
// don't style as link
|
71
|
+
};
|
72
|
+
return ClickableSpanImpl;
|
73
|
+
}(android.text.style.ClickableSpan));
|
75
74
|
ClickableSpan = ClickableSpanImpl;
|
76
75
|
}
|
77
76
|
// eslint-disable-next-line no-redeclare
|
@@ -80,36 +79,35 @@ function initializeURLClickableSpan() {
|
|
80
79
|
if (URLClickableSpan) {
|
81
80
|
return;
|
82
81
|
}
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
82
|
+
var URLClickableSpanImpl = /** @class */ (function (_super) {
|
83
|
+
__extends(URLClickableSpanImpl, _super);
|
84
|
+
function URLClickableSpanImpl(url, owner) {
|
85
|
+
var _this = _super.call(this, url) || this;
|
86
|
+
_this.owner = new WeakRef(owner);
|
87
|
+
return global.__native(_this);
|
88
|
+
}
|
89
|
+
URLClickableSpanImpl.prototype.onClick = function (view) {
|
90
|
+
var owner = this.owner.get();
|
91
|
+
if (owner) {
|
92
|
+
owner.notify({ eventName: Span.linkTapEvent, object: owner, link: this.getURL() });
|
88
93
|
}
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
94
|
+
view.clearFocus();
|
95
|
+
view.invalidate();
|
96
|
+
};
|
97
|
+
URLClickableSpanImpl.prototype.updateDrawState = function (tp) {
|
98
|
+
var owner = this.owner.get();
|
99
|
+
if (!owner || owner.linkUnderline !== false) {
|
100
|
+
_super.prototype.updateDrawState.call(this, tp);
|
96
101
|
}
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
if (owner && owner.linkColor) {
|
103
|
-
const color = !owner.linkColor || owner.linkColor instanceof Color
|
104
|
-
? owner.linkColor
|
105
|
-
: new Color(owner.linkColor);
|
106
|
-
tp.setColor(color.android);
|
107
|
-
}
|
102
|
+
if (owner && owner.linkColor) {
|
103
|
+
var color = !owner.linkColor || owner.linkColor instanceof Color
|
104
|
+
? owner.linkColor
|
105
|
+
: new Color(owner.linkColor);
|
106
|
+
tp.setColor(color.android);
|
108
107
|
}
|
109
108
|
};
|
110
|
-
URLClickableSpanImpl
|
111
|
-
|
112
|
-
], URLClickableSpanImpl);
|
109
|
+
return URLClickableSpanImpl;
|
110
|
+
}(android.text.style.URLSpan));
|
113
111
|
URLClickableSpan = URLClickableSpanImpl;
|
114
112
|
}
|
115
113
|
let LabelBase = class LabelBase extends View {
|
package/label.ios.js
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
var LabelUITextViewDelegateImpl_1;
|
2
1
|
var _a, _b, _c, _d;
|
3
2
|
import { createNativeAttributedString, verticalTextAlignmentProperty } from '@nativescript-community/text';
|
4
3
|
import { Color, Font, Span, View } from '@nativescript/core';
|
@@ -60,44 +59,48 @@ function whiteSpaceToLineBreakMode(value) {
|
|
60
59
|
return 4 /* NSLineBreakMode.ByTruncatingTail */;
|
61
60
|
}
|
62
61
|
}
|
63
|
-
|
64
|
-
|
65
|
-
|
62
|
+
var LabelUITextViewDelegateImpl = /** @class */ (function (_super) {
|
63
|
+
__extends(LabelUITextViewDelegateImpl, _super);
|
64
|
+
function LabelUITextViewDelegateImpl() {
|
65
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
66
|
+
}
|
67
|
+
LabelUITextViewDelegateImpl.initWithOwner = function (owner) {
|
68
|
+
var impl = LabelUITextViewDelegateImpl.new();
|
66
69
|
impl._owner = owner;
|
67
70
|
return impl;
|
68
|
-
}
|
69
|
-
textViewShouldInteractWithURLInRangeInteraction(textView, URL, characterRange, interaction) {
|
70
|
-
|
71
|
+
};
|
72
|
+
LabelUITextViewDelegateImpl.prototype.textViewShouldInteractWithURLInRangeInteraction = function (textView, URL, characterRange, interaction) {
|
73
|
+
var owner = this._owner.get();
|
71
74
|
if (owner) {
|
72
75
|
return owner.textViewShouldInteractWithURLInRangeInteraction(textView, URL, characterRange, interaction);
|
73
76
|
}
|
74
77
|
return false;
|
75
|
-
}
|
76
|
-
textViewDidChange(textView) {
|
77
|
-
|
78
|
+
};
|
79
|
+
LabelUITextViewDelegateImpl.prototype.textViewDidChange = function (textView) {
|
80
|
+
var owner = this._owner.get();
|
78
81
|
if (owner) {
|
79
82
|
owner.textViewDidChange(textView);
|
80
83
|
}
|
84
|
+
};
|
85
|
+
LabelUITextViewDelegateImpl.ObjCProtocols = [UITextViewDelegate];
|
86
|
+
return LabelUITextViewDelegateImpl;
|
87
|
+
}(NSObject));
|
88
|
+
var LabelObserverClass = /** @class */ (function (_super) {
|
89
|
+
__extends(LabelObserverClass, _super);
|
90
|
+
function LabelObserverClass() {
|
91
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
81
92
|
}
|
82
|
-
};
|
83
|
-
LabelUITextViewDelegateImpl.ObjCProtocols = [UITextViewDelegate];
|
84
|
-
LabelUITextViewDelegateImpl = LabelUITextViewDelegateImpl_1 = __decorate([
|
85
|
-
NativeClass
|
86
|
-
], LabelUITextViewDelegateImpl);
|
87
|
-
let LabelObserverClass = class LabelObserverClass extends NSObject {
|
88
93
|
// NOTE: Refactor this - use Typescript property instead of strings....
|
89
|
-
observeValueForKeyPathOfObjectChangeContext(path, tv) {
|
94
|
+
LabelObserverClass.prototype.observeValueForKeyPathOfObjectChangeContext = function (path, tv) {
|
90
95
|
if (path === 'contentSize') {
|
91
|
-
|
96
|
+
var owner = this._owner && this._owner.get();
|
92
97
|
if (owner) {
|
93
98
|
owner.updateTextContainerInset();
|
94
99
|
}
|
95
100
|
}
|
96
|
-
}
|
97
|
-
|
98
|
-
|
99
|
-
NativeClass
|
100
|
-
], LabelObserverClass);
|
101
|
+
};
|
102
|
+
return LabelObserverClass;
|
103
|
+
}(NSObject));
|
101
104
|
export class Label extends LabelBase {
|
102
105
|
constructor() {
|
103
106
|
super(...arguments);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nativescript-community/ui-label",
|
3
|
-
"version": "1.2.
|
3
|
+
"version": "1.2.15",
|
4
4
|
"description": "Alternative to the built-in NativeScript Label but with better performance and additional features such as HTML rendering and more.",
|
5
5
|
"main": "./label",
|
6
6
|
"sideEffects": false,
|
@@ -34,5 +34,5 @@
|
|
34
34
|
"dependencies": {
|
35
35
|
"@nativescript-community/text": "^1.5.9"
|
36
36
|
},
|
37
|
-
"gitHead": "
|
37
|
+
"gitHead": "98ae1f7d0175445bd4110458f2d52fac8d471271"
|
38
38
|
}
|