@live-change/user-frontend 0.9.32 → 0.9.33

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.
Files changed (54) hide show
  1. package/front/locales/en.json +3 -1
  2. package/front/src/App.vue +32 -1
  3. package/front/src/Index.vue +3 -3
  4. package/front/src/NavBar.vue +8 -8
  5. package/front/src/SettingsTabs.vue +1 -1
  6. package/front/src/config.js +19 -0
  7. package/front/src/connected/ConnectEmail.vue +13 -10
  8. package/front/src/connected/ConnectFinished.vue +4 -4
  9. package/front/src/connected/ConnectPhone.vue +13 -9
  10. package/front/src/connected/Connected.vue +13 -13
  11. package/front/src/delete/Delete.vue +5 -5
  12. package/front/src/delete/DeleteFeedbackSent.vue +4 -4
  13. package/front/src/delete/DeleteFinished.vue +6 -6
  14. package/front/src/google-access/GoogleAccess.vue +4 -4
  15. package/front/src/google-access/GoogleAccessGained.vue +6 -6
  16. package/front/src/identification/IdentificationSettings.vue +16 -13
  17. package/front/src/identification/UserIdentification.vue +8 -8
  18. package/front/src/locale/LocaleSettings.vue +9 -7
  19. package/front/src/message-auth/MessageLink.vue +12 -12
  20. package/front/src/message-auth/MessageSent.vue +20 -17
  21. package/front/src/message-auth/email/ConnectEmail.vue +1 -1
  22. package/front/src/message-auth/email/ResetPasswordEmail.vue +1 -1
  23. package/front/src/message-auth/email/SignInEmail.vue +1 -1
  24. package/front/src/message-auth/email/SignUpEmail.vue +1 -1
  25. package/front/src/nav/UserIcon.vue +11 -12
  26. package/front/src/nav/UserMenu.vue +20 -15
  27. package/front/src/notifications/NotificationButtons.vue +3 -3
  28. package/front/src/notifications/NotificationListPage.vue +2 -2
  29. package/front/src/notifications/NotificationsIcon.vue +12 -10
  30. package/front/src/notifications/NotificationsList.vue +4 -4
  31. package/front/src/notifications/NotificationsSettings.vue +4 -4
  32. package/front/src/notifications/SimpleNotification.vue +3 -3
  33. package/front/src/password/ChangePassword.vue +19 -14
  34. package/front/src/password/ChangePasswordFinished.vue +4 -4
  35. package/front/src/password/Password.vue +406 -449
  36. package/front/src/password/ResetPassword.vue +11 -8
  37. package/front/src/password/ResetPasswordFinished.vue +4 -4
  38. package/front/src/password/ResetPasswordForm.vue +22 -19
  39. package/front/src/phone/CountryInput.vue +13 -15
  40. package/front/src/phone/PhoneInput.vue +3 -3
  41. package/front/src/settings/Settings.vue +5 -5
  42. package/front/src/settings/SettingsIndex.vue +4 -4
  43. package/front/src/settings/SettingsMenu.vue +10 -10
  44. package/front/src/sign/GoogleAuth.vue +4 -4
  45. package/front/src/sign/GoogleAuthReturn.vue +4 -4
  46. package/front/src/sign/LinkedinAuth.vue +4 -4
  47. package/front/src/sign/LinkedinAuthReturn.vue +4 -4
  48. package/front/src/sign/SignInEmail.vue +22 -21
  49. package/front/src/sign/SignInFinished.vue +6 -6
  50. package/front/src/sign/SignOut.vue +5 -5
  51. package/front/src/sign/SignOutFinished.vue +4 -4
  52. package/front/src/sign/SignUpEmail.vue +14 -13
  53. package/front/src/sign/SignUpFinished.vue +19 -16
  54. package/package.json +26 -26
@@ -1,48 +1,64 @@
1
1
  <template>
2
- <div :class="containerClass">
3
- <PInputText
2
+ <div :class="cx('root')" :style="sx('root')" v-bind="ptmi('root')">
3
+ <InputText
4
4
  ref="input"
5
5
  :id="inputId"
6
6
  :type="inputType"
7
- :class="inputFieldClass"
7
+ :class="[cx('pcInputText'), inputClass]"
8
8
  :style="inputStyle"
9
- :value="modelValue"
9
+ :defaultValue="d_value"
10
+ :name="$formName"
10
11
  :aria-labelledby="ariaLabelledby"
11
12
  :aria-label="ariaLabel"
12
- :aria-controls="(panelProps && panelProps.id) || panelId || panelUniqueId"
13
+ :aria-controls="(overlayProps && overlayProps.id) || overlayId || (panelProps && panelProps.id) || panelId || overlayUniqueId"
13
14
  :aria-expanded="overlayVisible"
14
15
  :aria-haspopup="true"
15
16
  :placeholder="placeholder"
16
17
  :required="required"
18
+ :fluid="fluid"
19
+ :disabled="disabled"
20
+ :variant="variant"
21
+ :invalid="invalid"
22
+ :size="size"
23
+ :autofocus="autofocus"
17
24
  @input="onInput"
18
25
  @focus="onFocus"
19
26
  @blur="onBlur"
20
27
  @keyup="onKeyUp"
21
28
  @invalid="onInvalid"
22
29
  v-bind="inputProps"
30
+ :pt="ptm('pcInputText')"
31
+ :unstyled="unstyled"
23
32
  />
24
- <i v-if="toggleMask" :class="toggleIconClass" @click="onMaskToggle" />
25
- <span class="p-hidden-accessible" aria-live="polite">
33
+ <!-- TODO: hideicon and showicon slots are deprecated since v4.0-->
34
+ <slot v-if="toggleMask && unmasked" :name="$slots.maskicon ? 'maskicon' : 'hideicon'" :toggleCallback="onMaskToggle">
35
+ <component :is="maskIcon ? 'i' : 'EyeSlashIcon'" :class="[cx('maskIcon'), maskIcon]" @click="onMaskToggle" v-bind="ptm('maskIcon')" />
36
+ </slot>
37
+ <slot v-if="toggleMask && !unmasked" :name="$slots.unmaskicon ? 'unmaskicon' : 'showicon'" :toggleCallback="onMaskToggle">
38
+ <component :is="unmaskIcon ? 'i' : 'EyeIcon'" :class="[cx('unmaskIcon'), unmaskIcon]" @click="onMaskToggle" v-bind="ptm('unmaskIcon')" />
39
+ </slot>
40
+ <span class="p-hidden-accessible" aria-live="polite" v-bind="ptm('hiddenAccesible')" :data-p-hidden-accessible="true">
26
41
  {{ infoText }}
27
42
  </span>
28
43
  <Portal :appendTo="appendTo">
29
- <transition name="p-connected-overlay"
30
- @enter="onOverlayEnter"
31
- @leave="onOverlayLeave"
32
- @after-leave="onOverlayAfterLeave">
33
- <div v-if="overlayVisible"
34
- :ref="overlayRef"
35
- :id="panelId || panelUniqueId"
36
- :class="panelStyleClass"
37
- :style="panelStyle"
38
- @click="onOverlayClick"
39
- v-bind="panelProps">
44
+ <transition name="p-connected-overlay" @enter="onOverlayEnter" @leave="onOverlayLeave" @after-leave="onOverlayAfterLeave" v-bind="ptm('transition')">
45
+ <div
46
+ v-if="overlayVisible"
47
+ :ref="overlayRef"
48
+ :id="overlayId || panelId || overlayUniqueId"
49
+ :class="[cx('overlay'), panelClass, overlayClass]"
50
+ :style="[overlayStyle, panelStyle]"
51
+ @click="onOverlayClick"
52
+ v-bind="{ ...panelProps, ...overlayProps, ...ptm('overlay') }"
53
+ >
40
54
  <slot name="header"></slot>
41
55
  <slot name="content">
42
- <div class="p-password-meter">
43
- <div :class="strengthClass" :style="{ width: meter ? meter.width : '' }"></div>
56
+ <div :class="cx('content')" v-bind="ptm('content')">
57
+ <div :class="cx('meter')" v-bind="ptm('meter')">
58
+ <div :class="cx('meterLabel')" :style="{ width: meter ? meter.width : '' }" v-bind="ptm('meterLabel')"></div>
59
+ </div>
60
+ <div :class="cx('meterText')" v-bind="ptm('meterText')">{{ infoText }}</div>
44
61
  </div>
45
- <div class="p-password-info">{{ infoText }}</div>
46
62
  </slot>
47
63
  <slot name="footer"></slot>
48
64
  </div>
@@ -52,463 +68,404 @@
52
68
  </template>
53
69
 
54
70
  <script>
55
- import InputText from 'primevue/inputtext';
56
- import OverlayEventBus from 'primevue/overlayeventbus';
57
- import Portal from 'primevue/portal';
58
- import { ConnectedOverlayScrollHandler, DomHandler, UniqueComponentId, ZIndexUtils } from 'primevue/utils';
59
-
60
- function absolutePosition(element, target) {
61
- if (element) {
62
- const elementDimensions = element.offsetParent ? { width: element.offsetWidth, height: element.offsetHeight } : this.getHiddenElementDimensions(element);
63
- const elementOuterHeight = elementDimensions.height;
64
- const elementOuterWidth = elementDimensions.width;
65
- const targetOuterHeight = target.offsetHeight;
66
- const targetOuterWidth = target.offsetWidth;
67
- const targetOffset = target.getBoundingClientRect();
68
- const windowScrollTop = DomHandler.getWindowScrollTop();
69
- const windowScrollLeft = DomHandler.getWindowScrollLeft();
70
- const viewport = DomHandler.getViewport();
71
- let top, left;
72
-
73
- //if (targetOffset.top + targetOuterHeight + elementOuterHeight > viewport.height) {
74
- top = targetOffset.top + windowScrollTop - elementOuterHeight;
75
- element.style.transformOrigin = 'bottom';
76
-
77
- if (top < 0) {
78
- top = windowScrollTop;
71
+ import { absolutePosition, addStyle, getOuterWidth, isTouchDevice, relativePosition } from '@primeuix/utils/dom';
72
+ import { ZIndex } from '@primeuix/utils/zindex';
73
+ import { ConnectedOverlayScrollHandler } from '@primevue/core/utils';
74
+ import EyeIcon from '@primevue/icons/eye';
75
+ import EyeSlashIcon from '@primevue/icons/eyeslash';
76
+ import InputText from 'primevue/inputtext';
77
+ import OverlayEventBus from 'primevue/overlayeventbus';
78
+ import Portal from 'primevue/portal';
79
+ import BaseInput from '@primevue/core/baseinput';
80
+ import PasswordStyle from 'primevue/password/style';
81
+
82
+ export default {
83
+ name: 'Password',
84
+ extends: BaseInput,
85
+ props: {
86
+ promptLabel: {
87
+ type: String,
88
+ default: null
89
+ },
90
+ mediumRegex: {
91
+ type: [String, RegExp],
92
+ default: '^(((?=.*[a-z])(?=.*[A-Z]))|((?=.*[a-z])(?=.*[0-9]))|((?=.*[A-Z])(?=.*[0-9])))(?=.{6,})' // eslint-disable-line
93
+ },
94
+ strongRegex: {
95
+ type: [String, RegExp],
96
+ default: '^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.{8,})' // eslint-disable-line
97
+ },
98
+ weakLabel: {
99
+ type: String,
100
+ default: null
101
+ },
102
+ mediumLabel: {
103
+ type: String,
104
+ default: null
105
+ },
106
+ strongLabel: {
107
+ type: String,
108
+ default: null
109
+ },
110
+ feedback: {
111
+ type: Boolean,
112
+ default: true
113
+ },
114
+ appendTo: {
115
+ type: [String, Object],
116
+ default: 'body'
117
+ },
118
+ toggleMask: {
119
+ type: Boolean,
120
+ default: false
121
+ },
122
+ hideIcon: {
123
+ type: String,
124
+ default: undefined
125
+ },
126
+ maskIcon: {
127
+ type: String,
128
+ default: undefined
129
+ },
130
+ showIcon: {
131
+ type: String,
132
+ default: undefined
133
+ },
134
+ unmaskIcon: {
135
+ type: String,
136
+ default: undefined
137
+ },
138
+ disabled: {
139
+ type: Boolean,
140
+ default: false
141
+ },
142
+ placeholder: {
143
+ type: String,
144
+ default: null
145
+ },
146
+ required: {
147
+ type: Boolean,
148
+ default: false
149
+ },
150
+ inputId: {
151
+ type: String,
152
+ default: null
153
+ },
154
+ inputClass: {
155
+ type: [String, Object],
156
+ default: null
157
+ },
158
+ inputStyle: {
159
+ type: Object,
160
+ default: null
161
+ },
162
+ inputProps: {
163
+ type: null,
164
+ default: null
165
+ },
166
+ panelId: {
167
+ type: String,
168
+ default: null
169
+ },
170
+ panelClass: {
171
+ type: [String, Object],
172
+ default: null
173
+ },
174
+ panelStyle: {
175
+ type: Object,
176
+ default: null
177
+ },
178
+ panelProps: {
179
+ type: null,
180
+ default: null
181
+ },
182
+ overlayId: {
183
+ type: String,
184
+ default: null
185
+ },
186
+ overlayClass: {
187
+ type: [String, Object],
188
+ default: null
189
+ },
190
+ overlayStyle: {
191
+ type: Object,
192
+ default: null
193
+ },
194
+ overlayProps: {
195
+ type: null,
196
+ default: null
197
+ },
198
+ ariaLabelledby: {
199
+ type: String,
200
+ default: null
201
+ },
202
+ ariaLabel: {
203
+ type: String,
204
+ default: null
205
+ },
206
+ autofocus: {
207
+ type: Boolean,
208
+ default: null
209
+ },
210
+ masked: {
211
+ type: Boolean,
212
+ default: false
79
213
  }
80
- /* } else {
81
- top = targetOuterHeight + targetOffset.top + windowScrollTop;
82
- element.style.transformOrigin = 'top';
83
- }*/
84
-
85
- if (targetOffset.left + elementOuterWidth > viewport.width) left = Math.max(0, targetOffset.left + windowScrollLeft + targetOuterWidth - elementOuterWidth);
86
- else left = targetOffset.left + windowScrollLeft;
87
-
88
- element.style.top = top + 'px';
89
- element.style.left = left + 'px';
90
- }
91
- }
92
-
93
- export default {
94
- name: 'Password',
95
- emits: ['update:modelValue', 'change', 'focus', 'blur', 'invalid', 'update:masked'],
96
- props: {
97
- modelValue: String,
98
- promptLabel: {
99
- type: String,
100
- default: null
101
- },
102
- mediumRegex: {
103
- type: String,
104
- default: '^(((?=.*[a-z])(?=.*[A-Z]))|((?=.*[a-z])(?=.*[0-9]))|((?=.*[A-Z])(?=.*[0-9])))(?=.{6,})' // eslint-disable-line
105
- },
106
- strongRegex: {
107
- type: String,
108
- default: '^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.{8,})' // eslint-disable-line
109
- },
110
- weakLabel: {
111
- type: String,
112
- default: null
113
- },
114
- mediumLabel: {
115
- type: String,
116
- default: null
117
- },
118
- strongLabel: {
119
- type: String,
120
- default: null
121
- },
122
- feedback: {
123
- type: Boolean,
124
- default: true
125
- },
126
- appendTo: {
127
- type: String,
128
- default: 'body'
129
- },
130
- toggleMask: {
131
- type: Boolean,
132
- default: false
133
- },
134
- hideIcon: {
135
- type: String,
136
- default: 'pi pi-eye-slash'
137
- },
138
- showIcon: {
139
- type: String,
140
- default: 'pi pi-eye'
141
- },
142
- disabled: {
143
- type: Boolean,
144
- default: false
145
- },
146
- placeholder: {
147
- type: String,
148
- default: null
149
- },
150
- required: {
151
- type: Boolean,
152
- default: false
153
- },
154
- inputId: {
155
- type: String,
156
- default: null
157
- },
158
- inputClass: {
159
- type: [String, Object],
160
- default: null
161
- },
162
- inputStyle: {
163
- type: Object,
164
- default: null
165
- },
166
- inputProps: {
167
- type: null,
168
- default: null
169
- },
170
- panelId: {
171
- type: String,
172
- default: null
173
- },
174
- panelClass: {
175
- type: [String, Object],
176
- default: null
177
- },
178
- panelStyle: {
179
- type: Object,
180
- default: null
181
- },
182
- panelProps: {
183
- type: null,
184
- default: null
185
- },
186
- 'aria-labelledby': {
187
- type: String,
188
- default: null
189
214
  },
190
- 'aria-label': {
191
- type: String,
192
- default: null
193
- },
194
- masked: {
195
- type: Boolean,
196
- default: true
197
- }
198
- },
199
- data() {
200
- return {
201
- overlayVisible: false,
202
- meter: null,
203
- infoText: null,
204
- focused: false,
205
- unmasked: !this.masked
206
- };
207
- },
208
- mediumCheckRegExp: null,
209
- strongCheckRegExp: null,
210
- resizeListener: null,
211
- scrollHandler: null,
212
- overlay: null,
213
- mounted() {
214
- this.infoText = this.promptText;
215
- this.mediumCheckRegExp = new RegExp(this.mediumRegex);
216
- this.strongCheckRegExp = new RegExp(this.strongRegex);
217
- },
218
- beforeUnmount() {
219
- this.unbindResizeListener();
215
+ style: PasswordStyle,
216
+ provide() {
217
+ return {
218
+ $pcPassword: this,
219
+ $parentInstance: this
220
+ };
221
+ },
222
+ inheritAttrs: false,
223
+ emits: ['change', 'focus', 'blur', 'invalid', 'update:masked'],
224
+ inject: {
225
+ $pcFluid: { default: null }
226
+ },
227
+ data() {
228
+ return {
229
+ overlayVisible: false,
230
+ meter: null,
231
+ infoText: null,
232
+ focused: false,
233
+ unmasked: false
234
+ };
235
+ },
236
+ mediumCheckRegExp: null,
237
+ strongCheckRegExp: null,
238
+ resizeListener: null,
239
+ scrollHandler: null,
240
+ overlay: null,
241
+ mounted() {
242
+ this.infoText = this.promptText;
243
+ this.mediumCheckRegExp = new RegExp(this.mediumRegex);
244
+ this.strongCheckRegExp = new RegExp(this.strongRegex);
245
+ },
246
+ beforeUnmount() {
247
+ this.unbindResizeListener();
220
248
 
221
- if (this.scrollHandler) {
222
- this.scrollHandler.destroy();
223
- this.scrollHandler = null;
224
- }
249
+ if (this.scrollHandler) {
250
+ this.scrollHandler.destroy();
251
+ this.scrollHandler = null;
252
+ }
225
253
 
226
- if (this.overlay) {
227
- ZIndexUtils.clear(this.overlay);
228
- this.overlay = null;
229
- }
230
- },
231
- methods: {
232
- onOverlayEnter(el) {
233
- ZIndexUtils.set('overlay', el, this.$primevue.config.zIndex.overlay);
234
- this.alignOverlay();
235
- this.bindScrollListener();
236
- this.bindResizeListener();
237
- },
238
- onOverlayLeave() {
239
- this.unbindScrollListener();
240
- this.unbindResizeListener();
241
- this.overlay = null;
242
- },
243
- onOverlayAfterLeave(el) {
244
- ZIndexUtils.clear(el);
245
- },
246
- alignOverlay() {
247
- if (this.appendTo === 'self') {
248
- DomHandler.relativePosition(this.overlay, this.$refs.input.$el);
249
- } else {
250
- this.overlay.style.minWidth = DomHandler.getOuterWidth(this.$refs.input.$el) + 'px';
251
- absolutePosition(this.overlay, this.$refs.input.$el);
254
+ if (this.overlay) {
255
+ ZIndex.clear(this.overlay);
256
+ this.overlay = null;
252
257
  }
253
258
  },
254
- testStrength(str) {
255
- let level = 0;
256
-
257
- if (this.strongCheckRegExp.test(str)) level = 3;
258
- else if (this.mediumCheckRegExp.test(str)) level = 2;
259
- else if (str.length) level = 1;
259
+ methods: {
260
+ onOverlayEnter(el) {
261
+ ZIndex.set('overlay', el, this.$primevue.config.zIndex.overlay);
262
+
263
+ addStyle(el, { position: 'absolute', top: '0', left: '0' });
264
+ this.alignOverlay();
265
+ this.bindScrollListener();
266
+ this.bindResizeListener();
267
+ },
268
+ onOverlayLeave() {
269
+ this.unbindScrollListener();
270
+ this.unbindResizeListener();
271
+ this.overlay = null;
272
+ },
273
+ onOverlayAfterLeave(el) {
274
+ ZIndex.clear(el);
275
+ },
276
+ alignOverlay() {
277
+ if (this.appendTo === 'self') {
278
+ relativePosition(this.overlay, this.$refs.input.$el);
279
+ } else {
280
+ this.overlay.style.minWidth = getOuterWidth(this.$refs.input.$el) + 'px';
281
+ absolutePosition(this.overlay, this.$refs.input.$el);
282
+ }
283
+ },
284
+ testStrength(str) {
285
+ let level = 0;
286
+
287
+ if (this.strongCheckRegExp.test(str)) level = 3;
288
+ else if (this.mediumCheckRegExp.test(str)) level = 2;
289
+ else if (str.length) level = 1;
290
+
291
+ return level;
292
+ },
293
+ onInput(event) {
294
+ this.writeValue(event.target.value, event);
295
+ this.$emit('change', event);
296
+ },
297
+ onFocus(event) {
298
+ this.focused = true;
299
+
300
+ if (this.feedback) {
301
+ this.setPasswordMeter(this.d_value);
302
+ this.overlayVisible = true;
303
+ }
260
304
 
261
- return level;
262
- },
263
- onInput(event) {
264
- this.$emit('update:modelValue', event.target.value);
265
- },
266
- onFocus(event) {
267
- this.focused = true;
305
+ this.$emit('focus', event);
306
+ },
307
+ onBlur(event) {
308
+ this.focused = false;
268
309
 
269
- if (this.feedback) {
270
- this.setPasswordMeter(this.modelValue);
271
- this.overlayVisible = true;
272
- }
310
+ if (this.feedback) {
311
+ this.overlayVisible = false;
312
+ }
273
313
 
274
- this.$emit('focus', event);
275
- },
276
- onBlur(event) {
277
- this.focused = false;
314
+ this.$emit('blur', event);
315
+ },
316
+ onKeyUp(event) {
317
+ if (this.feedback) {
318
+ const value = event.target.value;
319
+ const { meter, label } = this.checkPasswordStrength(value);
278
320
 
279
- if (this.feedback) {
280
- this.overlayVisible = false;
281
- }
321
+ this.meter = meter;
322
+ this.infoText = label;
282
323
 
283
- this.$emit('blur', event);
284
- },
285
- onKeyUp(event) {
286
- if (this.feedback) {
287
- const value = event.target.value;
288
- const { meter, label } = this.checkPasswordStrength(value);
324
+ if (event.code === 'Escape') {
325
+ this.overlayVisible && (this.overlayVisible = false);
289
326
 
290
- this.meter = meter;
291
- this.infoText = label;
327
+ return;
328
+ }
292
329
 
293
- if (event.code === 'Escape') {
294
- this.overlayVisible && (this.overlayVisible = false);
330
+ if (!this.overlayVisible) {
331
+ this.overlayVisible = true;
332
+ }
333
+ }
334
+ },
335
+ setPasswordMeter() {
336
+ if (!this.d_value) {
337
+ this.meter = null;
338
+ this.infoText = this.promptText;
295
339
 
296
340
  return;
297
341
  }
298
342
 
343
+ const { meter, label } = this.checkPasswordStrength(this.d_value);
344
+
345
+ this.meter = meter;
346
+ this.infoText = label;
347
+
299
348
  if (!this.overlayVisible) {
300
349
  this.overlayVisible = true;
301
350
  }
302
- }
303
- },
304
- setPasswordMeter() {
305
- if (!this.modelValue) return;
306
-
307
- const { meter, label } = this.checkPasswordStrength(this.modelValue);
308
-
309
- this.meter = meter;
310
- this.infoText = label;
311
-
312
- if (!this.overlayVisible) {
313
- this.overlayVisible = true;
314
- }
315
- },
316
- checkPasswordStrength(value) {
317
- let label = null;
318
- let meter = null;
319
-
320
- switch (this.testStrength(value)) {
321
- case 1:
322
- label = this.weakText;
323
- meter = {
324
- strength: 'weak',
325
- width: '33.33%'
326
- };
327
- break;
351
+ },
352
+ checkPasswordStrength(value) {
353
+ let label = null;
354
+ let meter = null;
355
+
356
+ switch (this.testStrength(value)) {
357
+ case 1:
358
+ label = this.weakText;
359
+ meter = {
360
+ strength: 'weak',
361
+ width: '33.33%'
362
+ };
363
+ break;
364
+
365
+ case 2:
366
+ label = this.mediumText;
367
+ meter = {
368
+ strength: 'medium',
369
+ width: '66.66%'
370
+ };
371
+ break;
372
+
373
+ case 3:
374
+ label = this.strongText;
375
+ meter = {
376
+ strength: 'strong',
377
+ width: '100%'
378
+ };
379
+ break;
380
+
381
+ default:
382
+ label = this.promptText;
383
+ meter = null;
384
+ break;
385
+ }
328
386
 
329
- case 2:
330
- label = this.mediumText;
331
- meter = {
332
- strength: 'medium',
333
- width: '66.66%'
334
- };
335
- break;
387
+ return { label, meter };
388
+ },
389
+ onInvalid(event) {
390
+ this.$emit('invalid', event);
391
+ },
392
+ bindScrollListener() {
393
+ if (!this.scrollHandler) {
394
+ this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.input.$el, () => {
395
+ if (this.overlayVisible) {
396
+ this.overlayVisible = false;
397
+ }
398
+ });
399
+ }
336
400
 
337
- case 3:
338
- label = this.strongText;
339
- meter = {
340
- strength: 'strong',
341
- width: '100%'
401
+ this.scrollHandler.bindScrollListener();
402
+ },
403
+ unbindScrollListener() {
404
+ if (this.scrollHandler) {
405
+ this.scrollHandler.unbindScrollListener();
406
+ }
407
+ },
408
+ bindResizeListener() {
409
+ if (!this.resizeListener) {
410
+ this.resizeListener = () => {
411
+ if (this.overlayVisible && !isTouchDevice()) {
412
+ this.overlayVisible = false;
413
+ }
342
414
  };
343
- break;
344
-
345
- default:
346
- label = this.promptText;
347
- meter = null;
348
- break;
349
- }
350
415
 
351
- return { label, meter };
352
- },
353
- onInvalid(event) {
354
- this.$emit('invalid', event);
355
- },
356
- bindScrollListener() {
357
- if (!this.scrollHandler) {
358
- this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.input.$el, () => {
359
- if (this.overlayVisible) {
360
- this.overlayVisible = false;
361
- }
416
+ window.addEventListener('resize', this.resizeListener);
417
+ }
418
+ },
419
+ unbindResizeListener() {
420
+ if (this.resizeListener) {
421
+ window.removeEventListener('resize', this.resizeListener);
422
+ this.resizeListener = null;
423
+ }
424
+ },
425
+ overlayRef(el) {
426
+ this.overlay = el;
427
+ },
428
+ onMaskToggle() {
429
+ this.unmasked = !this.unmasked;
430
+ this.$emit('update:masked', !this.unmasked);
431
+ },
432
+ onOverlayClick(event) {
433
+ OverlayEventBus.emit('overlay-click', {
434
+ originalEvent: event,
435
+ target: this.$el
362
436
  });
363
437
  }
364
-
365
- this.scrollHandler.bindScrollListener();
366
438
  },
367
- unbindScrollListener() {
368
- if (this.scrollHandler) {
369
- this.scrollHandler.unbindScrollListener();
439
+ computed: {
440
+ inputType() {
441
+ return this.unmasked ? 'text' : 'password';
442
+ },
443
+ weakText() {
444
+ return this.weakLabel || this.$primevue.config.locale.weak;
445
+ },
446
+ mediumText() {
447
+ return this.mediumLabel || this.$primevue.config.locale.medium;
448
+ },
449
+ strongText() {
450
+ return this.strongLabel || this.$primevue.config.locale.strong;
451
+ },
452
+ promptText() {
453
+ return this.promptLabel || this.$primevue.config.locale.passwordPrompt;
454
+ },
455
+ overlayUniqueId() {
456
+ return this.$id + '_overlay';
370
457
  }
371
458
  },
372
- bindResizeListener() {
373
- if (!this.resizeListener) {
374
- this.resizeListener = () => {
375
- if (this.overlayVisible && !DomHandler.isTouchDevice()) {
376
- this.overlayVisible = false;
377
- }
378
- };
379
-
380
- window.addEventListener('resize', this.resizeListener);
459
+ watch: {
460
+ masked(value) {
461
+ this.unmasked = !value
381
462
  }
382
463
  },
383
- unbindResizeListener() {
384
- if (this.resizeListener) {
385
- window.removeEventListener('resize', this.resizeListener);
386
- this.resizeListener = null;
387
- }
388
- },
389
- overlayRef(el) {
390
- this.overlay = el;
391
- },
392
- onMaskToggle() {
393
- this.unmasked = !this.unmasked;
394
- this.$emit('update:masked', !this.unmasked);
395
- },
396
- onOverlayClick(event) {
397
- OverlayEventBus.emit('overlay-click', {
398
- originalEvent: event,
399
- target: this.$el
400
- });
464
+ components: {
465
+ InputText,
466
+ Portal,
467
+ EyeSlashIcon,
468
+ EyeIcon
401
469
  }
402
- },
403
- computed: {
404
- containerClass() {
405
- return [
406
- 'p-password p-component p-inputwrapper',
407
- {
408
- 'p-inputwrapper-filled': this.filled,
409
- 'p-inputwrapper-focus': this.focused,
410
- 'p-input-icon-right': this.toggleMask
411
- }
412
- ];
413
- },
414
- inputFieldClass() {
415
- return [
416
- 'p-password-input',
417
- this.inputClass,
418
- {
419
- 'p-disabled': this.disabled
420
- }
421
- ];
422
- },
423
- panelStyleClass() {
424
- return [
425
- 'p-password-panel p-component',
426
- this.panelClass,
427
- {
428
- 'p-input-filled': this.$primevue.config.inputStyle === 'filled',
429
- 'p-ripple-disabled': this.$primevue.config.ripple === false
430
- }
431
- ];
432
- },
433
- toggleIconClass() {
434
- return this.unmasked ? this.hideIcon : this.showIcon;
435
- },
436
- strengthClass() {
437
- return `p-password-strength ${this.meter ? this.meter.strength : ''}`;
438
- },
439
- inputType() {
440
- return this.unmasked ? 'text' : 'password';
441
- },
442
- filled() {
443
- return this.modelValue != null && this.modelValue.toString().length > 0;
444
- },
445
- weakText() {
446
- return this.weakLabel || this.$primevue.config.locale.weak;
447
- },
448
- mediumText() {
449
- return this.mediumLabel || this.$primevue.config.locale.medium;
450
- },
451
- strongText() {
452
- return this.strongLabel || this.$primevue.config.locale.strong;
453
- },
454
- promptText() {
455
- return this.promptLabel || this.$primevue.config.locale.passwordPrompt;
456
- },
457
- panelUniqueId() {
458
- return UniqueComponentId() + '_panel';
459
- }
460
- },
461
- watch: {
462
- masked(value) {
463
- this.unmasked = !value;
464
- },
465
- },
466
- components: {
467
- PInputText: InputText,
468
- Portal: Portal
469
- }
470
- };
471
- </script>
472
-
473
- <style>
474
- .p-password {
475
- position: relative;
476
- display: inline-flex;
477
- }
478
-
479
- .p-password-panel {
480
- position: absolute;
481
- top: 0;
482
- left: 0;
483
- }
484
-
485
- .p-password .p-password-panel {
486
- min-width: 100%;
487
- }
488
-
489
- .p-password-meter {
490
- height: 10px;
491
- }
492
-
493
- .p-password-strength {
494
- height: 100%;
495
- width: 0;
496
- transition: width 1s ease-in-out;
497
- }
498
-
499
- .p-fluid .p-password {
500
- display: flex;
501
- }
502
-
503
- .p-password-input::-ms-reveal,
504
- .p-password-input::-ms-clear {
505
- display: none;
506
- }
507
-
508
- .p-password i {
509
- position: absolute;
510
- top: 0.69em;
511
- top: calc(50% - 0.5em);
512
- right: 1em
513
- }
514
- </style>
470
+ };
471
+ </script>