inviton-powerduck 0.0.142 → 0.0.143
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.
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { TextBoxTextType } from './textbox';
|
|
2
1
|
import { Prop, toNative } from 'vue-facing-decorator';
|
|
3
|
-
import PowerduckState from '../../app/powerduck-state';
|
|
4
2
|
import TsxComponent, { Component } from '../../app/vuetsx';
|
|
5
|
-
import {
|
|
3
|
+
import type { TextBoxTextType } from './textbox';
|
|
4
|
+
import TextBox from './textbox';
|
|
6
5
|
|
|
7
6
|
interface TextBoxWithoutLabelArgs {
|
|
8
7
|
value: string;
|
|
@@ -22,7 +21,6 @@ interface TextBoxWithoutLabelArgs {
|
|
|
22
21
|
class TextBoxWithoutLabelComponent extends TsxComponent<TextBoxWithoutLabelArgs> implements TextBoxWithoutLabelArgs {
|
|
23
22
|
@Prop() value: string;
|
|
24
23
|
@Prop() placeholder!: string;
|
|
25
|
-
@Prop() cssClass!: string;
|
|
26
24
|
@Prop() disabled!: boolean;
|
|
27
25
|
@Prop() nameAttr?: string;
|
|
28
26
|
@Prop() textType: TextBoxTextType;
|
|
@@ -33,78 +31,25 @@ class TextBoxWithoutLabelComponent extends TsxComponent<TextBoxWithoutLabelArgs>
|
|
|
33
31
|
@Prop() updateMode?: 'input' | 'change';
|
|
34
32
|
@Prop() maxLength: number;
|
|
35
33
|
|
|
36
|
-
fieldValue: string = null;
|
|
37
|
-
|
|
38
|
-
mounted() {
|
|
39
|
-
this.fieldValue = this.value;
|
|
40
|
-
if (this.keyDown != null || this.enterPressed != null) {
|
|
41
|
-
this.$el.addEventListener('keydown', (e) => {
|
|
42
|
-
(this as any).keyDownHandler(e);
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
raiseChangeEvent(e) {
|
|
48
|
-
this.populateValidationDeclaration();
|
|
49
|
-
|
|
50
|
-
if (this.changed != null) {
|
|
51
|
-
const newValue = e.target.value;
|
|
52
|
-
this.fieldValue = newValue;
|
|
53
|
-
this.changed(newValue);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
getTypeAttribute(): string {
|
|
58
|
-
return this.textType || 'text';
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
getAutoCompleteText(): string {
|
|
62
|
-
if (this.autoCompleteEnabled == false) {
|
|
63
|
-
if (PortalUtils.isBrowserChrome()) {
|
|
64
|
-
return 'new-password';
|
|
65
|
-
} else {
|
|
66
|
-
return 'off';
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
keyDownHandler(e: KeyboardEvent) {
|
|
74
|
-
if (this.keyDown != null) {
|
|
75
|
-
this.keyDown(e);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (this.enterPressed != null && (e.keyCode == 13 || e.which == 13)) {
|
|
79
|
-
this.raiseChangeEvent(e);
|
|
80
|
-
this.enterPressed(e);
|
|
81
|
-
e.preventDefault();
|
|
82
|
-
e.stopPropagation();
|
|
83
|
-
e.stopImmediatePropagation();
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
34
|
render(h) {
|
|
88
35
|
return (
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
value={this.fieldValue}
|
|
93
|
-
maxlength={this.maxLength}
|
|
94
|
-
name={this.nameAttr}
|
|
95
|
-
onChange={e => this.raiseChangeEvent(e)}
|
|
96
|
-
onInput={(e) => {
|
|
97
|
-
if (this.updateMode == 'input') {
|
|
98
|
-
this.raiseChangeEvent(e);
|
|
99
|
-
}
|
|
100
|
-
}}
|
|
101
|
-
class={`${PowerduckState.getFormControlCssClass()} ${this.cssClass}`}
|
|
36
|
+
<TextBox
|
|
37
|
+
wrap={false}
|
|
38
|
+
value={this.value}
|
|
102
39
|
placeholder={this.placeholder}
|
|
103
|
-
|
|
40
|
+
textType={this.textType}
|
|
41
|
+
disabled={this.disabled}
|
|
42
|
+
autoCompleteEnabled={this.autoCompleteEnabled}
|
|
43
|
+
changed={this.changed}
|
|
44
|
+
maxLength={this.maxLength}
|
|
45
|
+
updateMode={this.updateMode}
|
|
46
|
+
nameAttr={this.nameAttr}
|
|
47
|
+
keyDown={this.keyDown}
|
|
48
|
+
enterPressed={this.enterPressed}
|
|
104
49
|
/>
|
|
105
50
|
);
|
|
106
51
|
}
|
|
107
52
|
}
|
|
108
53
|
|
|
109
54
|
const TextBoxWithoutLabel = toNative(TextBoxWithoutLabelComponent);
|
|
110
|
-
export default TextBoxWithoutLabel;
|
|
55
|
+
export default TextBoxWithoutLabel;
|