@nativescript-community/ui-material-textview
Advanced tools
Comparing version 3.2.20 to 4.0.0
@@ -6,2 +6,10 @@ # Change Log | ||
# [4.0.0](https://github.com/Akylas/nativescript-material-components/compare/v3.2.20...v4.0.0) (2020-07-29) | ||
**Note:** Version bump only for package @nativescript-community/ui-material-textview | ||
## [3.2.20](https://github.com/Akylas/nativescript-material-components/compare/v3.2.19...v3.2.20) (2020-07-28) | ||
@@ -8,0 +16,0 @@ |
{ | ||
"name": "@nativescript-community/ui-material-textview", | ||
"version": "3.2.20", | ||
"version": "4.0.0", | ||
"description": "Material textview component", | ||
@@ -38,5 +38,5 @@ "main": "./textview", | ||
"dependencies": { | ||
"@nativescript-community/ui-material-core": "^3.2.20" | ||
"@nativescript-community/ui-material-core": "^4.0.0" | ||
}, | ||
"gitHead": "f594b28aa2ab5f4968b08b01100a9a141c913c06" | ||
"gitHead": "f0c903eb440eda20c2a9cd1243cb88d4a6313bcd" | ||
} |
@@ -1,3 +0,3 @@ | ||
import { Color, EditableTextBase } from '@nativescript/core'; | ||
export declare abstract class TextViewBase extends EditableTextBase { | ||
import { Color, TextView as NSTextView } from '@nativescript/core'; | ||
export declare abstract class TextViewBase extends NSTextView { | ||
abstract requestFocus(): any; | ||
@@ -4,0 +4,0 @@ abstract clearFocus(): any; |
import { cssProperty } from '@nativescript-community/ui-material-core'; | ||
import { CSSType, Color, EditableTextBase } from '@nativescript/core'; | ||
let TextViewBase = class TextViewBase extends EditableTextBase { | ||
import { CSSType, Color, TextView as NSTextView } from '@nativescript/core'; | ||
let TextViewBase = class TextViewBase extends NSTextView { | ||
constructor() { | ||
@@ -5,0 +5,0 @@ super(...arguments); |
import { Style } from '@nativescript/core'; | ||
import { TextViewBase } from './textview.common'; | ||
declare module '@nativescript/core/ui/text-field' { | ||
interface TextField { | ||
textFieldShouldChangeCharactersInRangeReplacementString(textField: UITextField, range: NSRange, replacementString: string): boolean; | ||
} | ||
} | ||
export declare class TextView extends TextViewBase { | ||
@@ -7,3 +12,2 @@ nativeViewProtected: MDCMultilineTextField; | ||
_isEditing: boolean; | ||
private _delegate; | ||
readonly style: Style & { | ||
@@ -16,5 +20,4 @@ variant: 'outline' | 'underline' | 'filled'; | ||
createNativeView(): MDCMultilineTextField; | ||
initNativeView(): void; | ||
blur(): void; | ||
setSelection(start: number, stop?: number): void; | ||
} |
@@ -17,6 +17,15 @@ import { themer } from '@nativescript-community/ui-material-core'; | ||
} | ||
const TextViewInputControllerUnderlineImpl = MDCTextInputControllerUnderline.extend({ | ||
textInsets(defaultValue) { | ||
let result = this.super.textInsets(defaultValue); | ||
const owner = this._owner ? this._owner.get() : null; | ||
var TextViewInputControllerUnderlineImpl = /** @class */ (function (_super) { | ||
__extends(TextViewInputControllerUnderlineImpl, _super); | ||
function TextViewInputControllerUnderlineImpl() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
TextViewInputControllerUnderlineImpl.initWithOwner = function (owner) { | ||
var delegate = TextViewInputControllerUnderlineImpl.new(); | ||
delegate._owner = new WeakRef(owner); | ||
return delegate; | ||
}; | ||
TextViewInputControllerUnderlineImpl.prototype.textInsets = function (defaultValue) { | ||
var result = _super.prototype.textInsets.call(this, defaultValue); | ||
var owner = this._owner ? this._owner.get() : null; | ||
if (owner) { | ||
@@ -26,8 +35,18 @@ result = owner._getTextInsetsForBounds(result); | ||
return result; | ||
}, | ||
}); | ||
const TextViewInputControllerImpl = MDCTextInputControllerBase.extend({ | ||
textInsets(defaultValue) { | ||
let result = this.super.textInsets(defaultValue); | ||
const owner = this._owner ? this._owner.get() : null; | ||
}; | ||
return TextViewInputControllerUnderlineImpl; | ||
}(MDCTextInputControllerUnderline)); | ||
var TextViewInputControllerImpl = /** @class */ (function (_super) { | ||
__extends(TextViewInputControllerImpl, _super); | ||
function TextViewInputControllerImpl() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
TextViewInputControllerImpl.initWithOwner = function (owner) { | ||
var delegate = TextViewInputControllerImpl.new(); | ||
delegate._owner = new WeakRef(owner); | ||
return delegate; | ||
}; | ||
TextViewInputControllerImpl.prototype.textInsets = function (defaultValue) { | ||
var result = _super.prototype.textInsets.call(this, defaultValue); | ||
var owner = this._owner ? this._owner.get() : null; | ||
if (owner) { | ||
@@ -37,8 +56,18 @@ result = owner._getTextInsetsForBounds(result); | ||
return result; | ||
}, | ||
}); | ||
const TextViewInputControllerOutlinedImpl = MDCTextInputControllerOutlined.extend({ | ||
textInsets(defaultValue) { | ||
let result = this.super.textInsets(defaultValue); | ||
const owner = this._owner ? this._owner.get() : null; | ||
}; | ||
return TextViewInputControllerImpl; | ||
}(MDCTextInputControllerBase)); | ||
var TextViewInputControllerOutlinedImpl = /** @class */ (function (_super) { | ||
__extends(TextViewInputControllerOutlinedImpl, _super); | ||
function TextViewInputControllerOutlinedImpl() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
TextViewInputControllerOutlinedImpl.initWithOwner = function (owner) { | ||
var delegate = TextViewInputControllerOutlinedImpl.new(); | ||
delegate._owner = new WeakRef(owner); | ||
return delegate; | ||
}; | ||
TextViewInputControllerOutlinedImpl.prototype.textInsets = function (defaultValue) { | ||
var result = _super.prototype.textInsets.call(this, defaultValue); | ||
var owner = this._owner ? this._owner.get() : null; | ||
if (owner) { | ||
@@ -48,8 +77,18 @@ result = owner._getTextInsetsForBounds(result); | ||
return result; | ||
}, | ||
}); | ||
const TextViewInputControllerFilledImpl = MDCTextInputControllerFilled.extend({ | ||
textInsets(defaultValue) { | ||
let result = this.super.textInsets(defaultValue); | ||
const owner = this._owner ? this._owner.get() : null; | ||
}; | ||
return TextViewInputControllerOutlinedImpl; | ||
}(MDCTextInputControllerOutlined)); | ||
var TextViewInputControllerFilledImpl = /** @class */ (function (_super) { | ||
__extends(TextViewInputControllerFilledImpl, _super); | ||
function TextViewInputControllerFilledImpl() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
TextViewInputControllerFilledImpl.initWithOwner = function (owner) { | ||
var delegate = TextViewInputControllerFilledImpl.new(); | ||
delegate._owner = new WeakRef(owner); | ||
return delegate; | ||
}; | ||
TextViewInputControllerFilledImpl.prototype.textInsets = function (defaultValue) { | ||
var result = _super.prototype.textInsets.call(this, defaultValue); | ||
var owner = this._owner ? this._owner.get() : null; | ||
if (owner) { | ||
@@ -59,41 +98,5 @@ result = owner._getTextInsetsForBounds(result); | ||
return result; | ||
}, | ||
}); | ||
const TextViewDelegateImpl = NSObject.extend({ | ||
textViewShouldBeginEditing(textView) { | ||
const owner = this._owner.get(); | ||
if (owner) { | ||
return owner.editable; | ||
} | ||
return true; | ||
}, | ||
textViewDidBeginEditing(textView) { | ||
const owner = this._owner.get(); | ||
if (owner) { | ||
owner._isEditing = true; | ||
owner.notify({ eventName: TextView.focusEvent, object: owner }); | ||
} | ||
}, | ||
textViewDidEndEditing(textView) { | ||
const owner = this._owner.get(); | ||
if (owner) { | ||
if (owner.updateTextTrigger === 'focusLost') { | ||
textProperty.nativeValueChange(owner, textView.text); | ||
} | ||
owner._isEditing = false; | ||
owner.dismissSoftInput(); | ||
} | ||
}, | ||
textViewDidChange(textView) { | ||
const owner = this._owner.get(); | ||
if (owner) { | ||
if (owner.updateTextTrigger === 'textChanged') { | ||
textProperty.nativeValueChange(owner, textView.text); | ||
} | ||
owner.requestLayout(); | ||
} | ||
}, | ||
}, { | ||
protocols: [UITextViewDelegate], | ||
}); | ||
}; | ||
return TextViewInputControllerFilledImpl; | ||
}(MDCTextInputControllerFilled)); | ||
export class TextView extends TextViewBase { | ||
@@ -123,16 +126,16 @@ clearFocus() { | ||
if (this.style.variant === 'filled') { | ||
this._controller = TextViewInputControllerFilledImpl.new(); | ||
this._controller = TextViewInputControllerFilledImpl.initWithOwner(this); | ||
; | ||
} | ||
else if (this.style.variant === 'outline') { | ||
this._controller = TextViewInputControllerOutlinedImpl.new(); | ||
this._controller = TextViewInputControllerOutlinedImpl.initWithOwner(this); | ||
} | ||
else if (this.style.variant === 'underline') { | ||
this._controller = TextViewInputControllerUnderlineImpl.new(); | ||
this._controller = TextViewInputControllerUnderlineImpl.initWithOwner(this); | ||
} | ||
else { | ||
this._controller = TextViewInputControllerImpl.new(); | ||
this._controller = TextViewInputControllerImpl.initWithOwner(this); | ||
this._controller.underlineHeightActive = 0; | ||
this._controller.underlineHeightNormal = 0; | ||
} | ||
this._controller._owner = new WeakRef(this); | ||
this._controller.textInput = view; | ||
@@ -147,8 +150,2 @@ view.textInsetsMode = 1; | ||
} | ||
initNativeView() { | ||
super.initNativeView(); | ||
this._delegate = TextViewDelegateImpl.new(); | ||
this._delegate._owner = new WeakRef(this); | ||
this.ios.textView.delegate = this._delegate; | ||
} | ||
blur() { | ||
@@ -155,0 +152,0 @@ this.dismissSoftInput(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
113539
+ Added@nativescript-community/ui-material-core@4.0.11(transitive)
- Removed@nativescript-community/ui-material-core@3.2.20(transitive)