Skip to content

Commit 422dcb5

Browse files
authored
Merge pull request #26 from oooholdings/dev
Pull show value on update for release
2 parents 2b350ab + 18bd003 commit 422dcb5

20 files changed

+217
-196
lines changed

dist/js/field.js

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

readme.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,11 @@ public function fields()
259259

260260
PasswordGenerator::make( 'Personal Access Token' )
261261
// Show the password as plain-text by default on the respective pages
262-
// These two methods work well with the others as they just show the password
262+
// These three methods work well with the others as they just show the field value
263263
// on page load, you can use the other methods below for the styling
264264
->showValueOnDetail( bool $show = true )
265265
->showValueOnIndex( bool $show = true )
266+
->showValueOnUpdate( bool $show = true )
266267
// Hide the password with a blur effect on the respective pages
267268
->blurValueOnDetail( bool $show = true )
268269
->blurValueOnIndex( bool $show = true )

resources/js/components/DetailField.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
<div v-if="!showValueOnDetail || blurValueOnDetail || redactValueOnDetail">
2020
<icon-show v-if="hidden && !hideShowPasswordToggle"
2121
class="h-4 w-4"
22-
v-tooltip="tooltips.showPassword.disabled"
22+
v-tooltip="tooltips.showPassword.enabled"
2323
@click="showValue"></icon-show>
2424
<icon-hide v-else
2525
class="h-4 w-4"
26-
v-tooltip="tooltips.showPassword.enabled"
26+
v-tooltip="tooltips.showPassword.disabled"
2727
@click="hideValue"></icon-hide>
2828
</div>
2929

@@ -40,9 +40,9 @@
4040

4141
<script>
4242
import baseField from '../mixins/baseField';
43+
import copyIcon from './icons/copyIcon';
4344
import hideIcon from './icons/hideIcon';
4445
import showIcon from './icons/showIcon';
45-
import copyIcon from './icons/copyIcon';
4646
4747
export default {
4848
mixins: [ baseField ],
@@ -96,10 +96,10 @@ export default {
9696
}
9797
} else {
9898
Nova.error( this.__( 'Nothing to copy, type or generate a :name.', {
99-
name: this.__( this.field.name )
99+
name: this.__( this.field.name ),
100100
} ) );
101101
}
102102
},
103-
}
104-
}
103+
},
104+
};
105105
</script>

resources/js/components/FormField.vue

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
class="ooo:pg-option hover:text-primary-400 active:text-primary-600"
1919
:class="showPassword ? classes.enabled : classes.disabled"
2020
@click="toggleShowPassword"
21-
v-tooltip="showPassword ? tooltips.showPassword.enabled : tooltips.showPassword.disabled">
21+
v-tooltip="showPassword ? tooltips.showPassword.disabled : tooltips.showPassword.enabled">
2222
<icon-hide v-if="showPassword"
2323
class="h-4 w-4"></icon-hide>
2424
<icon-show v-else
@@ -102,16 +102,16 @@
102102
<script>
103103
import { FormField, HandlesValidationErrors } from 'laravel-nova';
104104
import baseField from '../mixins/baseField';
105+
import atIcon from './icons/atIcon';
106+
import copyIcon from './icons/copyIcon';
107+
import hashtagIcon from './icons/hashtagIcon';
105108
import hideIcon from './icons/hideIcon';
106-
import showIcon from './icons/showIcon';
107-
import uppercaseIcon from './icons/uppercaseIcon';
108109
import lowercaseIcon from './icons/lowercaseIcon';
109-
import hashtagIcon from './icons/hashtagIcon';
110-
import atIcon from './icons/atIcon';
111110
import minusIcon from './icons/minusIcon';
112111
import plusIcon from './icons/plusIcon';
113-
import copyIcon from './icons/copyIcon';
114112
import refreshIcon from './icons/refreshIcon';
113+
import showIcon from './icons/showIcon';
114+
import uppercaseIcon from './icons/uppercaseIcon';
115115
116116
export default {
117117
mixins: [ FormField, HandlesValidationErrors, baseField ],
@@ -130,12 +130,12 @@ export default {
130130
},
131131
data() {
132132
return {
133-
status: null,
134-
toolbarOnTop: this.field.toolbarOnTop ?? false,
135-
responsive: this.field.responsive ?? true,
136-
showPassword: this.field.showPassword ?? false,
137-
fillOnCreate: this.field.fillOnCreate ?? false,
138-
fillOnUpdate: this.field.fillOnUpdate ?? false,
133+
status: null,
134+
toolbarOnTop: this.field.toolbarOnTop ?? false,
135+
responsive: this.field.responsive ?? true,
136+
showPassword: this.field.showPassword ?? false,
137+
fillOnCreate: this.field.fillOnCreate ?? false,
138+
fillOnUpdate: this.field.fillOnUpdate ?? false,
139139
};
140140
},
141141
mounted() {
@@ -166,7 +166,9 @@ export default {
166166
* Set the initial, internal value for the field.
167167
*/
168168
setInitialValue() {
169-
this.value = null;
169+
this.value = this.showValueOnUpdate
170+
? this.field.value
171+
: null;
170172
},
171173
172174
/**
@@ -219,10 +221,10 @@ export default {
219221
}
220222
} else {
221223
Nova.error( this.__( 'Nothing to copy, type or generate a :name.', {
222-
name: this.__( this.field.name )
224+
name: this.__( this.field.name ),
223225
} ) );
224226
}
225227
},
226228
},
227-
}
229+
};
228230
</script>

resources/js/components/IndexField.vue

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
import baseField from '../mixins/baseField';
1919
2020
export default {
21-
mixins: [ baseField ],
22-
props: [ 'resourceName', 'field' ],
21+
mixins: [ baseField ],
22+
props: [ 'resourceName', 'field' ],
2323
data() {
2424
return {
2525
hidden: !this.field.showValueOnIndex,
@@ -28,19 +28,19 @@ export default {
2828
mounted() {
2929
console.log( this.field );
3030
},
31-
}
31+
};
3232
</script>
3333

3434
<style lang="scss">
3535
.ooo\:pg-value {
36-
position : relative;
37-
display : inline-flex;
38-
justify-content : center;
39-
align-items : center;
36+
position: relative;
37+
display: inline-flex;
38+
justify-content: center;
39+
align-items: center;
4040
4141
.ooo\:pg-value-blurred {
42-
filter : blur(3px);
43-
user-select : none;
42+
filter: blur(3px);
43+
user-select: none;
4444
}
4545
}
4646
</style>

resources/js/components/icons/atIcon.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212

1313
<script>
1414
export default {
15-
name: 'atIcon'
16-
}
15+
name: 'atIcon',
16+
};
1717
</script>

resources/js/components/icons/copyIcon.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212

1313
<script>
1414
export default {
15-
name: 'copyIcon'
16-
}
15+
name: 'copyIcon',
16+
};
1717
</script>

resources/js/components/icons/hashtagIcon.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212

1313
<script>
1414
export default {
15-
name: 'hashtagIcon'
16-
}
15+
name: 'hashtagIcon',
16+
};
1717
</script>

resources/js/components/icons/hideIcon.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212

1313
<script>
1414
export default {
15-
name: 'hideIcon'
16-
}
15+
name: 'hideIcon',
16+
};
1717
</script>

resources/js/components/icons/lowercaseIcon.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515

1616
<script>
1717
export default {
18-
name: 'lowercaseIcon'
19-
}
18+
name: 'lowercaseIcon',
19+
};
2020
</script>

resources/js/components/icons/minusIcon.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212

1313
<script>
1414
export default {
15-
name: 'minusIcon'
16-
}
15+
name: 'minusIcon',
16+
};
1717
</script>

resources/js/components/icons/plusIcon.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212

1313
<script>
1414
export default {
15-
name: 'plusIcon'
16-
}
15+
name: 'plusIcon',
16+
};
1717
</script>

resources/js/components/icons/refreshIcon.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212

1313
<script>
1414
export default {
15-
name: 'refreshIcon'
16-
}
15+
name: 'refreshIcon',
16+
};
1717
</script>

resources/js/components/icons/showIcon.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515

1616
<script>
1717
export default {
18-
name: 'showIcon'
19-
}
18+
name: 'showIcon',
19+
};
2020
</script>

resources/js/components/icons/uppercaseIcon.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313

1414
<script>
1515
export default {
16-
name: 'uppercaseIcon'
17-
}
16+
name: 'uppercaseIcon',
17+
};
1818
</script>

resources/js/field.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import IndexField from './components/IndexField'
2-
import DetailField from './components/DetailField'
3-
import FormField from './components/FormField'
1+
import DetailField from './components/DetailField';
2+
import FormField from './components/FormField';
3+
import IndexField from './components/IndexField';
44

55
Nova.booting( ( app, store ) => {
6-
app.component( 'index-password-generator', IndexField )
7-
app.component( 'detail-password-generator', DetailField )
8-
app.component( 'form-password-generator', FormField )
9-
} )
6+
app.component( 'index-password-generator', IndexField );
7+
app.component( 'detail-password-generator', DetailField );
8+
app.component( 'form-password-generator', FormField );
9+
} );

resources/js/mixins/baseField.js

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export default {
1919
showValueOnDetail: this.field.showValueOnDetail ?? false,
2020
showValueOnIndex: this.field.showValueOnIndex ?? false,
2121
blurValueOnDetail: this.field.blurValueOnDetail ?? false,
22+
showValueOnUpdate: this.field.showValueOnUpdate ?? false,
2223
blurValueOnIndex: this.field.blurValueOnIndex ?? false,
2324
redactValueOnDetail: this.field.redactValueOnDetail ?? false,
2425
redactValueOnIndex: this.field.redactValueOnIndex ?? false,
@@ -57,7 +58,7 @@ export default {
5758
'dark:text-gray-900',
5859
'font-bold',
5960
'text-sm',
60-
'ooo:pg-enabled'
61+
'ooo:pg-enabled',
6162
],
6263
disabled: [
6364
'border',
@@ -67,7 +68,7 @@ export default {
6768
'dark:bg-gray-800',
6869
'font-bold',
6970
'text-sm',
70-
'ooo:pg-disabled'
71+
'ooo:pg-disabled',
7172
],
7273
enabledPill: [
7374
'bg-primary-500',
@@ -83,41 +84,41 @@ export default {
8384
// 'dark:text-white',
8485
'font-bold',
8586
'text-sm',
86-
'ooo:pg-enabled'
87+
'ooo:pg-enabled',
8788
],
8889
disabledPill: [
8990
'font-bold',
9091
'text-sm',
91-
'ooo:pg-disabled'
92+
'ooo:pg-disabled',
9293
],
9394
},
9495
tooltips: {
9596
showPassword: {
9697
enabled: this.__( 'Show :Name', { name: this.__( this.field.name ) } ),
97-
disabled: this.__( 'Hide :Name', { name: this.__( this.field.name ) } )
98+
disabled: this.__( 'Hide :Name', { name: this.__( this.field.name ) } ),
9899
},
99100
uppercase: {
100101
enabled: this.__( 'Exclude :Option', { option: this.__( 'Uppercase' ) } ),
101-
disabled: this.__( 'Include :Option', { option: this.__( 'Uppercase' ) } )
102+
disabled: this.__( 'Include :Option', { option: this.__( 'Uppercase' ) } ),
102103
},
103104
lowercase: {
104105
enabled: this.__( 'Exclude :Option', { option: this.__( 'Lowercase' ) } ),
105-
disabled: this.__( 'Include :Option', { option: this.__( 'Lowercase' ) } )
106+
disabled: this.__( 'Include :Option', { option: this.__( 'Lowercase' ) } ),
106107
},
107108
numbers: {
108109
enabled: this.__( 'Exclude :Option', { option: this.__( 'Numbers' ) } ),
109-
disabled: this.__( 'Include :Option', { option: this.__( 'Numbers' ) } )
110+
disabled: this.__( 'Include :Option', { option: this.__( 'Numbers' ) } ),
110111
},
111112
symbols: {
112113
enabled: this.__( 'Exclude :Option', { option: this.__( 'Symbols' ) } ),
113-
disabled: this.__( 'Include :Option', { option: this.__( 'Symbols' ) } )
114+
disabled: this.__( 'Include :Option', { option: this.__( 'Symbols' ) } ),
114115
},
115116
decreaseLength: this.__( 'Decrease :Option', { option: this.__( 'Length' ) } ),
116117
increaseLength: this.__( 'Increase :Option', { option: this.__( 'Length' ) } ),
117118
copyPassword: {
118119
dynamic: this.__( 'Copy :Name', { name: this.__( this.field.name ) } ),
119120
enabled: this.__( 'Copied!' ),
120-
disabled: this.__( 'Copy :Name', { name: this.__( this.field.name ) } )
121+
disabled: this.__( 'Copy :Name', { name: this.__( this.field.name ) } ),
121122
},
122123
regeneratePassword: this.__( 'Regenerate :Name', { name: this.__( this.field.name ) } ),
123124
},
@@ -203,8 +204,11 @@ export default {
203204

204205
repeatString( string, count ) {
205206
if ( count <= 0 ) return '';
206-
if ( count === 1 ) return string;
207-
else return string + this.repeatString( string, count - 1 );
207+
if ( count === 1 ) {
208+
return string;
209+
} else {
210+
return string + this.repeatString( string, count - 1 );
211+
}
208212
},
209213

210214
validateToggles() {
@@ -240,7 +244,7 @@ export default {
240244
} else {
241245
Nova.error( this.__( 'Minimum generated :name length is: :length', {
242246
name: this.__( this.field.name ),
243-
length: this.passwordMin
247+
length: this.passwordMin,
244248
} ) );
245249
}
246250
},

0 commit comments

Comments
 (0)