Skip to content
This repository was archived by the owner on Feb 18, 2024. It is now read-only.

Commit 04c74c8

Browse files
committed
Fix initial password value
1 parent 843448d commit 04c74c8

File tree

6 files changed

+51
-27
lines changed

6 files changed

+51
-27
lines changed

dist/laravel-ui.min.js

Lines changed: 23 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/laravel-ui.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10875,6 +10875,13 @@
1087510875
event: 'input'
1087610876
},
1087710877
props: (0, _extends3.default)({}, _Text2.default.props, {
10878+
type: {
10879+
type: String,
10880+
default: 'password',
10881+
validator: function validator(value) {
10882+
return value === 'password';
10883+
}
10884+
},
1087810885
tipShow: {
1087910886
type: String,
1088010887
default: 'Show password'
@@ -11024,6 +11031,7 @@
1102411031
//
1102511032
//
1102611033
//
11034+
//
1102711035

1102811036
/***/ }),
1102911037
/* 393 */
@@ -11342,6 +11350,7 @@
1134211350
}
1134311351
}, [_c('ui-text', {
1134411352
attrs: {
11353+
"value": _vm.value,
1134511354
"disabled": _vm.disabled,
1134611355
"loading": _vm.loading,
1134711356
"title": _vm.title,

docs/laravel-ui.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Password.vue

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@
6969

7070
<template>
7171
<section class="password" :class="{ 'password-visible': isVisible }">
72-
<ui-text v-model="realValue"
72+
<ui-text v-model="internalValue"
73+
:value="value"
7374
:disabled="disabled"
7475
:loading="loading"
7576
:title="title"
@@ -116,11 +117,16 @@
116117
117118
export default {
118119
model: {
119-
prop: 'realValue',
120+
prop: 'internalValue',
120121
event: 'input'
121122
},
122123
props: {
123124
...Text.props,
125+
type: {
126+
type: String,
127+
default: 'password',
128+
validator: (value) => value === 'password'
129+
},
124130
tipShow: {
125131
type: String,
126132
default: 'Show password'
@@ -139,8 +145,8 @@
139145
isVisible: false,
140146
isVisibleDescription: this.tipHide,
141147
dynamicType: 'password',
142-
realValue: this.value
143-
}
148+
internalValue: this.value
149+
};
144150
},
145151
methods: {
146152
togglePasswordVisibility() {

src/components/Text.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134

135135
<ui-loading v-if="loading"></ui-loading>
136136

137-
<v-input v-model="realValue" :value="value" @input="onInput" @blur="onBlur" @focus="onFocus"
137+
<v-input v-model="internalValue" :value="value" @input="onInput" @blur="onBlur" @focus="onFocus"
138138
:name="name"
139139
:tag="type"
140140
:disabled="disabled"></v-input>
@@ -152,7 +152,7 @@
152152
153153
export default {
154154
model: {
155-
prop: 'realValue',
155+
prop: 'internalValue',
156156
event: 'input'
157157
},
158158
props: {
@@ -198,7 +198,7 @@
198198
/**
199199
* Real input value (Memory separation with "props: value")
200200
*/
201-
realValue: this.value
201+
internalValue: this.value
202202
};
203203
},
204204
mounted() {
@@ -217,18 +217,18 @@
217217
onBlur(event) {
218218
this.$emit('blur', event);
219219
220-
if (this.realValue.trim().length !== this.realValue.length) {
221-
this.realValue = this.realValue.trim();
220+
if (this.internalValue.trim().length !== this.internalValue.length) {
221+
this.internalValue = this.internalValue.trim();
222222
}
223223
224224
this.isFocus = false;
225-
this.isActive = this.realValue.length !== 0;
225+
this.isActive = this.internalValue.length !== 0;
226226
this.wasChanged = true;
227227
},
228228
onInput(event) {
229229
this.$emit('input', event);
230230
231-
this.isActive = this.realValue.trim().length !== 0;
231+
this.isActive = this.internalValue.trim().length !== 0;
232232
}
233233
}
234234
}

0 commit comments

Comments
 (0)