fleetcor-lwc 3.13.0 → 3.13.3
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/README.md
CHANGED
|
@@ -946,6 +946,24 @@ You can override them as you wish by global css variables as priority.
|
|
|
946
946
|
<details>
|
|
947
947
|
<summary>Click to expand/collapse</summary>
|
|
948
948
|
|
|
949
|
+
v.3.13.3
|
|
950
|
+
|
|
951
|
+
- Bug fix `flt-input-phone` component
|
|
952
|
+
|
|
953
|
+
---
|
|
954
|
+
|
|
955
|
+
v.3.13.2
|
|
956
|
+
|
|
957
|
+
- Bug fix `flt-input-phone` component
|
|
958
|
+
|
|
959
|
+
---
|
|
960
|
+
|
|
961
|
+
v.3.13.1
|
|
962
|
+
|
|
963
|
+
- Bug fix `flt-input-phone` and `flt-input-text` component
|
|
964
|
+
|
|
965
|
+
---
|
|
966
|
+
|
|
949
967
|
v.3.13.0
|
|
950
968
|
|
|
951
969
|
- Update `flt-collapsible-section` component
|
|
@@ -41,6 +41,26 @@ export default class InputPhone extends UserDataValidator {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
get maskOptions() {
|
|
45
|
+
let settings = {
|
|
46
|
+
mask: /[1-9]/,
|
|
47
|
+
overwrite: false,
|
|
48
|
+
lazy: false
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (this.codeValue == CODE_VALUE_SB) {
|
|
52
|
+
settings = {
|
|
53
|
+
mask: '#000000000',
|
|
54
|
+
definitions: {
|
|
55
|
+
'#': /[1-9]/
|
|
56
|
+
},
|
|
57
|
+
overwrite: false,
|
|
58
|
+
lazy: false
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return settings
|
|
62
|
+
}
|
|
63
|
+
|
|
44
64
|
@api getData(silent) {
|
|
45
65
|
return {
|
|
46
66
|
...super.getData(silent),
|
|
@@ -153,34 +173,35 @@ export default class InputPhone extends UserDataValidator {
|
|
|
153
173
|
reInitIMask() {
|
|
154
174
|
this.mask?.destroy()
|
|
155
175
|
this.mask = null
|
|
156
|
-
let settings = {
|
|
157
|
-
mask: Number,
|
|
158
|
-
overwrite: false,
|
|
159
|
-
lazy: false
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (this.codeValue == CODE_VALUE_SB) {
|
|
163
|
-
settings = {
|
|
164
|
-
mask: '#000000000',
|
|
165
|
-
definitions: {
|
|
166
|
-
'#': /[1-9]/
|
|
167
|
-
},
|
|
168
|
-
overwrite: false,
|
|
169
|
-
lazy: false
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
176
|
const inputEl = this.querySelector('input')
|
|
174
|
-
this.mask = IMask(inputEl,
|
|
177
|
+
this.mask = IMask(inputEl, this.maskOptions)
|
|
175
178
|
const inputElement = this.querySelector('flt-input-text')
|
|
176
179
|
this.mask.unmaskedValue = this.phoneNumber
|
|
177
180
|
inputElement.value = this.mask.value
|
|
178
181
|
this.mask.on('accept', () => {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
182
|
+
let value = inputElement.value?.replace(/[^\w\\s]/gi, '')
|
|
183
|
+
if (inputElement.value?.at(0) == '+' || inputElement.value?.at(0) == '0') {
|
|
184
|
+
if (inputElement.value?.at(0) == '0') {
|
|
185
|
+
value = CODE_VALUE_SB + value.slice(1)
|
|
186
|
+
} else {
|
|
187
|
+
value = '+' + value
|
|
188
|
+
}
|
|
189
|
+
let phoneNumberUtil = new LIB_PHONE_NUMBER.PhoneNumberUtil()
|
|
190
|
+
let number = phoneNumberUtil.parseAndKeepRawInput(value)
|
|
191
|
+
let regionCode = phoneNumberUtil.getRegionCodeForNumber(number)
|
|
192
|
+
let result = phoneNumberUtil.isValidNumberForRegion(number, regionCode)
|
|
193
|
+
if (result) {
|
|
194
|
+
const newCodeValue = `+${number.getCountryCode()}`
|
|
195
|
+
const newPhoneNumber = number.getNationalNumber() + ''
|
|
196
|
+
if (newCodeValue != this.codeValue) {
|
|
197
|
+
this.codeValue = newCodeValue
|
|
198
|
+
this.mask.updateOptions(this.maskOptions)
|
|
199
|
+
}
|
|
200
|
+
inputElement.value = newPhoneNumber
|
|
201
|
+
this.mask.value = newPhoneNumber
|
|
202
|
+
}
|
|
183
203
|
}
|
|
204
|
+
|
|
184
205
|
this.phoneNumber = this.mask.unmaskedValue
|
|
185
206
|
this.handleChange()
|
|
186
207
|
})
|
|
@@ -191,24 +212,13 @@ export default class InputPhone extends UserDataValidator {
|
|
|
191
212
|
if (!this.mask) {
|
|
192
213
|
this.reInitIMask()
|
|
193
214
|
this.querySelector('input').onpaste = (event) => {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
let regionCode = phoneNumberUtil.getRegionCodeForNumber(number)
|
|
200
|
-
let result = phoneNumberUtil.isValidNumberForRegion(number, regionCode)
|
|
201
|
-
if (result) {
|
|
202
|
-
const newCodeValue = `+${number.getCountryCode()}`
|
|
203
|
-
this.pastePhoneNumber = number.getNationalNumber() + ''
|
|
204
|
-
if (newCodeValue != this.codeValue) {
|
|
205
|
-
this.codeValue = newCodeValue
|
|
206
|
-
this.reInitIMask()
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
} catch (error) {
|
|
210
|
-
console.log('error', error)
|
|
215
|
+
let value = event.clipboardData.getData('text/plain').replace(/[^\w\\s]/gi, '')
|
|
216
|
+
if (value?.at(0) == '0') {
|
|
217
|
+
value = CODE_VALUE_SB + value.slice(1)
|
|
218
|
+
} else {
|
|
219
|
+
value = '+' + value
|
|
211
220
|
}
|
|
221
|
+
this.querySelector('input').value = ''
|
|
212
222
|
}
|
|
213
223
|
}
|
|
214
224
|
}
|
|
@@ -63,7 +63,7 @@ export default class InputText extends InputElement {
|
|
|
63
63
|
if (this.disabled) return
|
|
64
64
|
this.focused = false
|
|
65
65
|
this.touched = true
|
|
66
|
-
this.value = (event.target.value || '').
|
|
66
|
+
this.value = (event.target.value || '').trim()
|
|
67
67
|
event.target.value = this.value
|
|
68
68
|
this.dispatchEvent(
|
|
69
69
|
new CustomEvent('blur', {
|