bootstrap-italia 2.9.2 → 2.10.0
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.
- package/dist/css/bootstrap-italia.min.css +1 -1
- package/dist/css/bootstrap-italia.min.css.map +1 -1
- package/dist/js/bootstrap-italia.bundle.min.js +6 -10
- package/dist/js/bootstrap-italia.min.js +5 -9
- package/dist/plugins/input-password.js +205 -117
- package/dist/plugins/input-password.js.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +2 -2
- package/src/js/plugins/input-password.js +204 -117
- package/src/js/version.js +1 -1
- package/src/scss/custom/_form-password.scss +1 -1
- package/src/scss/custom/_version.scss +1 -1
|
@@ -3,7 +3,6 @@ import EventHandler from 'bootstrap/js/src/dom/event-handler'
|
|
|
3
3
|
import SelectorEngine from 'bootstrap/js/src/dom/selector-engine'
|
|
4
4
|
import Manipulator from 'bootstrap/js/src/dom/manipulator'
|
|
5
5
|
|
|
6
|
-
//import Input from './input'
|
|
7
6
|
import InputLabel from './input-label'
|
|
8
7
|
|
|
9
8
|
const NAME = 'inputpassword'
|
|
@@ -12,38 +11,45 @@ const EVENT_KEY = `.${DATA_KEY}`
|
|
|
12
11
|
const DATA_API_KEY = '.data-api'
|
|
13
12
|
|
|
14
13
|
const Default = {
|
|
15
|
-
shortPass: 'Password
|
|
16
|
-
badPass: 'Password debole',
|
|
17
|
-
goodPass: 'Password sicura',
|
|
18
|
-
strongPass: 'Password
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
shortPass: 'Password troppo breve',
|
|
15
|
+
badPass: 'Password debole.',
|
|
16
|
+
goodPass: 'Password abbastanza sicura.',
|
|
17
|
+
strongPass: 'Password sicura.',
|
|
18
|
+
minimumLength: 8,
|
|
19
|
+
suggestionsLabel: 'Suggerimenti per una buona password:',
|
|
20
|
+
suggestionFollowed: 'suggerimenti seguito',
|
|
21
|
+
suggestionFollowedPlural: 'suggerimenti seguiti',
|
|
22
|
+
suggestionOf: 'di',
|
|
23
|
+
suggestionMetLabel: 'Soddisfatto: ',
|
|
24
|
+
suggestionMetIconPath: `
|
|
25
|
+
M9.6 16.9 4 11.4l.8-.7 4.8 4.8 8.5-8.4.7.7-9.2 9.1z
|
|
26
|
+
`,
|
|
27
|
+
suggestionLength: 'Almeno {minLength} caratteri.',
|
|
28
|
+
suggestionUppercase: 'Una o più maiuscole.',
|
|
29
|
+
suggestionLowercase: 'Una o più minuscole.',
|
|
30
|
+
suggestionNumber: 'Uno o più numeri.',
|
|
31
|
+
suggestionSpecial: 'Uno o più caratteri speciali.',
|
|
23
32
|
}
|
|
24
33
|
|
|
25
34
|
const EVENT_CLICK = `click${EVENT_KEY}`
|
|
26
35
|
const EVENT_KEYUP = `keyup${EVENT_KEY}`
|
|
27
|
-
const EVENT_KEYDOWN = `keydown${EVENT_KEY}`
|
|
28
|
-
const EVENT_KEYPRESS = `keypress${EVENT_KEY}`
|
|
29
36
|
const EVENT_SCORE = `score${EVENT_KEY}`
|
|
30
37
|
const EVENT_TEXT = `text${EVENT_KEY}`
|
|
38
|
+
const EVENT_SUGGS = `suggs${EVENT_KEY}`
|
|
31
39
|
|
|
32
40
|
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`
|
|
33
41
|
const EVENT_MOUSEDOWN_DATA_API = `mousedown${EVENT_KEY}${DATA_API_KEY}`
|
|
34
42
|
const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY}${DATA_API_KEY}`
|
|
35
43
|
|
|
36
44
|
const CLASS_NAME_PASSWORD = 'input-password'
|
|
37
|
-
//const CLASS_NAME_METER = 'input-password-strength-meter'
|
|
38
|
-
const CLASS_NAME_SHOW = 'show'
|
|
39
45
|
|
|
40
46
|
const SELECTOR_PASSWORD = 'input[data-bs-input][type="password"]'
|
|
41
47
|
const SELECTOR_BTN_SHOW_PWD = '.password-icon'
|
|
42
48
|
const SELECTOR_METER = '.password-strength-meter'
|
|
43
49
|
const SELECTOR_METER_GRAYBAR = '.password-meter'
|
|
44
50
|
const SELECTOR_METER_COLBAR = '.progress-bar'
|
|
45
|
-
const
|
|
46
|
-
const
|
|
51
|
+
const SELECTOR_METER_TEXT = '.strength-meter-info'
|
|
52
|
+
const SELECTOR_METER_SUGGS = '.strenght-meter-suggestions'
|
|
47
53
|
|
|
48
54
|
class InputPassword extends BaseComponent {
|
|
49
55
|
constructor(element, config) {
|
|
@@ -52,31 +58,54 @@ class InputPassword extends BaseComponent {
|
|
|
52
58
|
this._config = this._getConfig(config)
|
|
53
59
|
this._isCustom = this._element.classList.contains(CLASS_NAME_PASSWORD)
|
|
54
60
|
this._meter = this._element.parentNode.querySelector(SELECTOR_METER)
|
|
55
|
-
this._isShiftPressed = false
|
|
56
|
-
this._isCapsOn = false
|
|
57
61
|
|
|
58
62
|
this._grayBarElement = null
|
|
59
63
|
this._colorBarElement = null
|
|
60
64
|
this._textElement = null
|
|
61
|
-
this.
|
|
65
|
+
this._suggsElement = null
|
|
62
66
|
this._showPwdElement = null
|
|
63
67
|
|
|
64
68
|
this._text = {}
|
|
65
69
|
|
|
66
70
|
this._label = new InputLabel(element)
|
|
67
71
|
|
|
72
|
+
this._suggestions = [
|
|
73
|
+
{
|
|
74
|
+
key: 'length',
|
|
75
|
+
text: (config) => config.suggestionLength.replace('{minLength}', config.minimumLength.toString()),
|
|
76
|
+
test: (password, config) => password.length >= config.minimumLength,
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
key: 'uppercase',
|
|
80
|
+
text: (config) => config.suggestionUppercase,
|
|
81
|
+
test: (password) => /[A-Z]/.test(password),
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
key: 'lowercase',
|
|
85
|
+
text: (config) => config.suggestionLowercase,
|
|
86
|
+
test: (password) => /[a-z]/.test(password),
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
key: 'number',
|
|
90
|
+
text: (config) => config.suggestionNumber,
|
|
91
|
+
test: (password) => /[0-9]/.test(password),
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
key: 'special',
|
|
95
|
+
text: (config) => config.suggestionSpecial,
|
|
96
|
+
test: (password) => /[^A-Za-z0-9]/.test(password),
|
|
97
|
+
},
|
|
98
|
+
]
|
|
99
|
+
|
|
68
100
|
this._init()
|
|
69
101
|
this._bindEvents()
|
|
70
102
|
}
|
|
71
103
|
|
|
72
104
|
// Getters
|
|
73
|
-
|
|
74
105
|
static get NAME() {
|
|
75
106
|
return NAME
|
|
76
107
|
}
|
|
77
108
|
|
|
78
|
-
// Public
|
|
79
|
-
|
|
80
109
|
// Private
|
|
81
110
|
_getConfig(config) {
|
|
82
111
|
config = {
|
|
@@ -88,118 +117,174 @@ class InputPassword extends BaseComponent {
|
|
|
88
117
|
}
|
|
89
118
|
|
|
90
119
|
_init() {
|
|
91
|
-
if (this._meter) {
|
|
92
|
-
this._grayBarElement = this._meter.querySelector(SELECTOR_METER_GRAYBAR)
|
|
93
|
-
this._colorBarElement = this._meter.querySelector(SELECTOR_METER_COLBAR)
|
|
94
|
-
this._textElement = this._meter.querySelector(SELECTOR_TEXT)
|
|
95
|
-
|
|
96
|
-
if (this._textElement) {
|
|
97
|
-
this._config = Object.assign({}, this._config, { ...Manipulator.getDataAttributes(this._textElement) }, { enterPass: this._textElement.innerText })
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
120
|
if (this._isCustom) {
|
|
101
|
-
this.
|
|
121
|
+
this._handleAutofill()
|
|
122
|
+
this._showPwdElement = SelectorEngine.findOne(SELECTOR_BTN_SHOW_PWD, this._element.parentNode)
|
|
123
|
+
if (this._meter) {
|
|
124
|
+
this._grayBarElement = this._meter.querySelector(SELECTOR_METER_GRAYBAR)
|
|
125
|
+
this._colorBarElement = this._meter.querySelector(SELECTOR_METER_COLBAR)
|
|
126
|
+
this._textElement = this._meter.querySelector(SELECTOR_METER_TEXT)
|
|
127
|
+
this._suggsElement = this._meter.querySelector(SELECTOR_METER_SUGGS)
|
|
128
|
+
if (this._textElement) {
|
|
129
|
+
this._config = Object.assign({}, this._config, { ...Manipulator.getDataAttributes(this._textElement) })
|
|
130
|
+
}
|
|
131
|
+
if (this._suggsElement) {
|
|
132
|
+
this._createsuggestionsList()
|
|
133
|
+
}
|
|
134
|
+
}
|
|
102
135
|
}
|
|
103
|
-
|
|
104
|
-
this._showPwdElement = SelectorEngine.findOne(SELECTOR_BTN_SHOW_PWD, this._element.parentNode)
|
|
105
136
|
}
|
|
106
137
|
|
|
107
138
|
_bindEvents() {
|
|
108
|
-
if (this._meter) {
|
|
109
|
-
EventHandler.on(this._element, EVENT_KEYUP, () => this._checkPassword())
|
|
110
|
-
}
|
|
111
|
-
|
|
112
139
|
if (this._isCustom) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
this._isShiftPressed = false
|
|
121
|
-
}
|
|
122
|
-
if (evt.key === 'CapsLock') {
|
|
123
|
-
this._isCapsOn = !this._isCapsOn
|
|
124
|
-
if (this._isCapsOn) {
|
|
125
|
-
this._showCapsMsg()
|
|
126
|
-
} else {
|
|
127
|
-
this._hideCapsMsg()
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
})
|
|
131
|
-
EventHandler.on(this._element, EVENT_KEYPRESS, (evt) => {
|
|
132
|
-
const matches = evt.key.match(/[A-Z]$/) || []
|
|
133
|
-
if (matches.length > 0 && !this._isShiftPressed) {
|
|
134
|
-
this._isCapsOn = true
|
|
135
|
-
this._showCapsMsg()
|
|
136
|
-
} else if (this._isCapsOn) {
|
|
137
|
-
this._isCapsOn = false
|
|
138
|
-
this._hideCapsMsg()
|
|
139
|
-
}
|
|
140
|
-
})
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
if (this._showPwdElement) {
|
|
144
|
-
EventHandler.on(this._showPwdElement, EVENT_CLICK, () => this._toggleShowPassword())
|
|
140
|
+
if (this._showPwdElement) {
|
|
141
|
+
EventHandler.on(this._showPwdElement, EVENT_CLICK, () => this._toggleShowPassword())
|
|
142
|
+
}
|
|
143
|
+
if (this._meter) {
|
|
144
|
+
EventHandler.on(this._element, EVENT_KEYUP, () => this._checkPassword())
|
|
145
|
+
EventHandler.on(this._element, 'input', () => this._checkPassword())
|
|
146
|
+
}
|
|
145
147
|
}
|
|
146
148
|
}
|
|
147
149
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
this.
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
if (this._capsElement) {
|
|
155
|
-
this._capsElement.classList.remove(CLASS_NAME_SHOW)
|
|
150
|
+
_handleAutofill() {
|
|
151
|
+
const checkAndActivate = () => {
|
|
152
|
+
if (this._element.value !== '') {
|
|
153
|
+
this._label._labelOut()
|
|
154
|
+
this._checkPassword()
|
|
155
|
+
}
|
|
156
156
|
}
|
|
157
|
+
checkAndActivate()
|
|
158
|
+
setTimeout(checkAndActivate, 100)
|
|
159
|
+
EventHandler.on(this._element, 'animationstart', (event) => {
|
|
160
|
+
if (event.animationName === 'onAutoFillStart') {
|
|
161
|
+
checkAndActivate()
|
|
162
|
+
}
|
|
163
|
+
})
|
|
157
164
|
}
|
|
158
165
|
|
|
159
166
|
_toggleShowPassword() {
|
|
160
167
|
const toShow = this._element.getAttribute('type') === 'password'
|
|
161
168
|
SelectorEngine.find('[class^="password-icon"]', this._showPwdElement).forEach((icon) => icon.classList.toggle('d-none'))
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
} else {
|
|
165
|
-
this._element.setAttribute('type', 'password')
|
|
166
|
-
}
|
|
169
|
+
this._element.setAttribute('type', toShow ? 'text' : 'password')
|
|
170
|
+
this._showPwdElement.setAttribute('aria-checked', toShow.toString())
|
|
167
171
|
}
|
|
168
172
|
|
|
169
173
|
_checkPassword() {
|
|
170
|
-
const
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
this.
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
})
|
|
178
|
-
this._colorBarElement.classList.add('bg-' + this._scoreColor(score))
|
|
179
|
-
this._colorBarElement.style.width = perc + '%'
|
|
180
|
-
this._colorBarElement.setAttribute('aria-valuenow', perc)
|
|
174
|
+
const password = this._element.value
|
|
175
|
+
const score = this._calculateScore(password)
|
|
176
|
+
this._updateMeter(score)
|
|
177
|
+
this._updateText(score, password)
|
|
178
|
+
this._updateSuggestions(password)
|
|
179
|
+
}
|
|
181
180
|
|
|
181
|
+
_updateMeter(score) {
|
|
182
|
+
const perc = score < 0 ? 0 : score
|
|
183
|
+
if (this._colorBarElement) {
|
|
184
|
+
this._colorBarElement.classList.forEach((className) => {
|
|
185
|
+
if (className.match(/(^|\s)bg-\S+/g)) {
|
|
186
|
+
this._colorBarElement.classList.remove(className)
|
|
187
|
+
}
|
|
188
|
+
})
|
|
189
|
+
this._colorBarElement.classList.add(`bg-${this._scoreColor(score)}`)
|
|
190
|
+
this._colorBarElement.style.width = `${perc}%`
|
|
191
|
+
this._colorBarElement.setAttribute('aria-valuenow', perc)
|
|
192
|
+
}
|
|
182
193
|
EventHandler.trigger(this._element, EVENT_SCORE)
|
|
194
|
+
}
|
|
183
195
|
|
|
196
|
+
_updateText(score, password) {
|
|
184
197
|
if (this._textElement) {
|
|
185
198
|
let text = this._scoreText(score)
|
|
186
|
-
if (this.
|
|
187
|
-
|
|
199
|
+
if (this._suggsElement) {
|
|
200
|
+
const { completedCount, totalCount } = this._getCompletedSuggestions(password)
|
|
201
|
+
const suggestionText = completedCount === 1 ? this._config.suggestionFollowed : this._config.suggestionFollowedPlural
|
|
202
|
+
text += ` ${completedCount} ${this._config.suggestionOf} ${totalCount} ${suggestionText}.`
|
|
188
203
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
this._textElement.innerHTML = text
|
|
204
|
+
if (this._textElement.textContent !== text) {
|
|
205
|
+
this._textElement.textContent = text
|
|
192
206
|
this._textElement.classList.forEach((className) => {
|
|
193
207
|
if (className.match(/(^|\s)text-\S+/g)) {
|
|
194
208
|
this._textElement.classList.remove(className)
|
|
195
209
|
}
|
|
196
210
|
})
|
|
197
|
-
this._textElement.classList.add(
|
|
211
|
+
this._textElement.classList.add(`text-${this._scoreColor(score)}`)
|
|
198
212
|
EventHandler.trigger(this._element, EVENT_TEXT)
|
|
199
213
|
}
|
|
200
214
|
}
|
|
201
215
|
}
|
|
202
216
|
|
|
217
|
+
_updateSuggestions(password) {
|
|
218
|
+
if (this._suggsElement) {
|
|
219
|
+
this._updateSuggestionsList(password)
|
|
220
|
+
EventHandler.trigger(this._element, EVENT_SUGGS)
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
_getCompletedSuggestions(password) {
|
|
225
|
+
let completedCount = 0
|
|
226
|
+
const totalCount = this._suggestions.length
|
|
227
|
+
this._suggestions.forEach((sugg) => {
|
|
228
|
+
if (sugg.test(password, this._config)) completedCount++
|
|
229
|
+
})
|
|
230
|
+
return { completedCount, totalCount }
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
_createsuggestionsList() {
|
|
234
|
+
if (this._suggsElement.querySelector('.password-suggestions')) {
|
|
235
|
+
return
|
|
236
|
+
}
|
|
237
|
+
const suggLabel = document.createElement('label')
|
|
238
|
+
suggLabel.className = 'visually-hidden'
|
|
239
|
+
suggLabel.htmlFor = 'suggestions'
|
|
240
|
+
suggLabel.textContent = Default.suggestionsLabel
|
|
241
|
+
const suggContainer = document.createElement('div')
|
|
242
|
+
suggContainer.id = 'suggestions'
|
|
243
|
+
suggContainer.className = 'password-suggestions'
|
|
244
|
+
|
|
245
|
+
this._suggestions.forEach((sugg) => {
|
|
246
|
+
const suggElement = document.createElement('div')
|
|
247
|
+
suggElement.className = 'suggestion'
|
|
248
|
+
suggElement.dataset.suggestion = sugg.key
|
|
249
|
+
const checkIcon = this._createIconCheck()
|
|
250
|
+
const textSpan = document.createElement('span')
|
|
251
|
+
textSpan.textContent = sugg.text(this._config)
|
|
252
|
+
suggElement.appendChild(checkIcon)
|
|
253
|
+
suggElement.appendChild(textSpan)
|
|
254
|
+
suggContainer.appendChild(suggElement)
|
|
255
|
+
})
|
|
256
|
+
|
|
257
|
+
this._suggsElement.appendChild(suggLabel)
|
|
258
|
+
this._suggsElement.appendChild(suggContainer)
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
_createIconCheck() {
|
|
262
|
+
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg')
|
|
263
|
+
svg.setAttribute('class', `icon icon-xs me-1 d-none`)
|
|
264
|
+
svg.setAttribute('aria-label', this._config.suggestionMetLabel)
|
|
265
|
+
svg.setAttribute('viewBox', '0 0 24 24')
|
|
266
|
+
svg.style.width = '1em'
|
|
267
|
+
svg.style.height = '1em'
|
|
268
|
+
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path')
|
|
269
|
+
path.setAttribute('d', this._config.suggestionMetIconPath.trim())
|
|
270
|
+
svg.appendChild(path)
|
|
271
|
+
return svg
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
_updateSuggestionsList(password) {
|
|
275
|
+
if (!this._suggsElement) return
|
|
276
|
+
this._suggestions.forEach((sugg) => {
|
|
277
|
+
const suggElement = this._suggsElement.querySelector(`[data-suggestion="${sugg.key}"]`)
|
|
278
|
+
if (suggElement) {
|
|
279
|
+
const isMet = sugg.test(password, this._config)
|
|
280
|
+
const checkIcon = suggElement.querySelector('.icon')
|
|
281
|
+
if (checkIcon) {
|
|
282
|
+
checkIcon.classList.toggle('d-none', !isMet)
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
})
|
|
286
|
+
}
|
|
287
|
+
|
|
203
288
|
/**
|
|
204
289
|
* Returns strings based on the score given.
|
|
205
290
|
*
|
|
@@ -211,10 +296,14 @@ class InputPassword extends BaseComponent {
|
|
|
211
296
|
return this._config.shortPass
|
|
212
297
|
}
|
|
213
298
|
|
|
299
|
+
if (score === -2) {
|
|
300
|
+
return ''
|
|
301
|
+
}
|
|
302
|
+
|
|
214
303
|
score = score < 0 ? 0 : score
|
|
215
304
|
|
|
216
305
|
if (score < 26) {
|
|
217
|
-
return this._config.
|
|
306
|
+
return this._config.badPass
|
|
218
307
|
}
|
|
219
308
|
if (score < 51) {
|
|
220
309
|
return this._config.badPass
|
|
@@ -227,16 +316,7 @@ class InputPassword extends BaseComponent {
|
|
|
227
316
|
}
|
|
228
317
|
|
|
229
318
|
_scoreColor(score) {
|
|
230
|
-
if (score === -1) {
|
|
231
|
-
return 'danger'
|
|
232
|
-
}
|
|
233
|
-
if (score === -2) {
|
|
234
|
-
return 'muted'
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
score = score < 0 ? 0 : score
|
|
238
|
-
|
|
239
|
-
if (score < 26) {
|
|
319
|
+
if (score === -1 || score === -2 || score < 26) {
|
|
240
320
|
return 'danger'
|
|
241
321
|
}
|
|
242
322
|
if (score < 51) {
|
|
@@ -245,7 +325,6 @@ class InputPassword extends BaseComponent {
|
|
|
245
325
|
if (score < 76) {
|
|
246
326
|
return 'success'
|
|
247
327
|
}
|
|
248
|
-
|
|
249
328
|
return 'success'
|
|
250
329
|
}
|
|
251
330
|
|
|
@@ -281,7 +360,7 @@ class InputPassword extends BaseComponent {
|
|
|
281
360
|
score += 5
|
|
282
361
|
}
|
|
283
362
|
|
|
284
|
-
// password has at least 2
|
|
363
|
+
// password has at least 2 symbols
|
|
285
364
|
var symbols = '.*[!,@,#,$,%,^,&,*,?,_,~]'
|
|
286
365
|
symbols = new RegExp('(' + symbols + symbols + ')')
|
|
287
366
|
if (password.match(symbols)) {
|
|
@@ -360,11 +439,6 @@ class InputPassword extends BaseComponent {
|
|
|
360
439
|
* ------------------------------------------------------------------------
|
|
361
440
|
*/
|
|
362
441
|
|
|
363
|
-
/*const inputs = SelectorEngine.find(SELECTOR_PASSWORD)
|
|
364
|
-
inputs.forEach((input) => {
|
|
365
|
-
InputPassword.getOrCreateInstance(input)
|
|
366
|
-
})*/
|
|
367
|
-
|
|
368
442
|
const createInput = (element) => {
|
|
369
443
|
if (element && element.matches(SELECTOR_PASSWORD)) {
|
|
370
444
|
return InputPassword.getOrCreateInstance(element)
|
|
@@ -372,6 +446,19 @@ const createInput = (element) => {
|
|
|
372
446
|
return null
|
|
373
447
|
}
|
|
374
448
|
|
|
449
|
+
const initInputPassword = () => {
|
|
450
|
+
const element = SelectorEngine.findOne(SELECTOR_PASSWORD)
|
|
451
|
+
if (element) {
|
|
452
|
+
InputPassword.getOrCreateInstance(element)
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
if (document.readyState !== 'loading') {
|
|
457
|
+
initInputPassword()
|
|
458
|
+
} else {
|
|
459
|
+
document.addEventListener('DOMContentLoaded', initInputPassword)
|
|
460
|
+
}
|
|
461
|
+
|
|
375
462
|
EventHandler.on(document, EVENT_MOUSEDOWN_DATA_API, SELECTOR_PASSWORD + ', label', function () {
|
|
376
463
|
const target = InputLabel.getInputFromLabel(this) || this
|
|
377
464
|
createInput(target)
|
package/src/js/version.js
CHANGED