@everymatrix/pam-forgot-password 1.89.3 → 1.90.1
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.
|
@@ -6018,6 +6018,63 @@ const DateInput = class {
|
|
|
6018
6018
|
this.errorMessage = this.setErrorMessage();
|
|
6019
6019
|
this.valueHandler({ name: this.name, value: this.value });
|
|
6020
6020
|
};
|
|
6021
|
+
this.handleMaskedTyping = (e) => {
|
|
6022
|
+
var _a;
|
|
6023
|
+
const input = e.target;
|
|
6024
|
+
if (!input)
|
|
6025
|
+
return;
|
|
6026
|
+
const prevPos = (_a = input.selectionStart) !== null && _a !== void 0 ? _a : input.value.length;
|
|
6027
|
+
const prevValue = input.value;
|
|
6028
|
+
const [a, b, c] = this.getFormatStructure(this.dateFormat);
|
|
6029
|
+
const { seps } = this.parseFormat(this.dateFormat);
|
|
6030
|
+
const [sep1, sep2] = seps;
|
|
6031
|
+
const maxDigits = a + b + c;
|
|
6032
|
+
const digitsOnly = prevValue.replace(/\D/g, '').slice(0, maxDigits);
|
|
6033
|
+
const block1 = digitsOnly.slice(0, a);
|
|
6034
|
+
const block2 = digitsOnly.slice(a, a + b);
|
|
6035
|
+
const block3 = digitsOnly.slice(a + b, a + b + c);
|
|
6036
|
+
let formatted = block1;
|
|
6037
|
+
if (digitsOnly.length > a) {
|
|
6038
|
+
formatted += sep1 + block2;
|
|
6039
|
+
}
|
|
6040
|
+
if (digitsOnly.length > a + b) {
|
|
6041
|
+
formatted += sep2 + block3;
|
|
6042
|
+
}
|
|
6043
|
+
input.value = formatted;
|
|
6044
|
+
const oldSepLen = this.totalSeparatorLength(prevValue, [sep1, sep2]);
|
|
6045
|
+
const newSepLen = this.totalSeparatorLength(formatted, [sep1, sep2]);
|
|
6046
|
+
let newPos = prevPos + Math.max(0, newSepLen - oldSepLen);
|
|
6047
|
+
newPos = Math.max(0, Math.min(newPos, formatted.length));
|
|
6048
|
+
try {
|
|
6049
|
+
input.setSelectionRange(newPos, newPos);
|
|
6050
|
+
}
|
|
6051
|
+
catch (_b) { }
|
|
6052
|
+
if (digitsOnly.length < maxDigits) {
|
|
6053
|
+
this.errorMessage = '';
|
|
6054
|
+
this.resetIncompleteState();
|
|
6055
|
+
return;
|
|
6056
|
+
}
|
|
6057
|
+
try {
|
|
6058
|
+
const parsed = parse(formatted, this.dateFormat, new Date());
|
|
6059
|
+
if (parsed && !isNaN(parsed.getTime())) {
|
|
6060
|
+
const iso = format(parsed, 'yyyy-MM-dd');
|
|
6061
|
+
this.value = iso;
|
|
6062
|
+
this.valueAsDate = parsed;
|
|
6063
|
+
this.isValid = true;
|
|
6064
|
+
this.errorMessage = '';
|
|
6065
|
+
if (this.datePicker) {
|
|
6066
|
+
this.datePicker.value = iso;
|
|
6067
|
+
}
|
|
6068
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
6069
|
+
}
|
|
6070
|
+
else {
|
|
6071
|
+
this.resetIncompleteState();
|
|
6072
|
+
}
|
|
6073
|
+
}
|
|
6074
|
+
catch (_c) {
|
|
6075
|
+
this.resetIncompleteState();
|
|
6076
|
+
}
|
|
6077
|
+
};
|
|
6021
6078
|
this.name = undefined;
|
|
6022
6079
|
this.displayName = undefined;
|
|
6023
6080
|
this.placeholder = undefined;
|
|
@@ -6093,6 +6150,7 @@ const DateInput = class {
|
|
|
6093
6150
|
// end custom styling area
|
|
6094
6151
|
}
|
|
6095
6152
|
componentDidLoad() {
|
|
6153
|
+
var _a;
|
|
6096
6154
|
this.datePicker = this.element.shadowRoot.querySelector('vaadin-date-picker');
|
|
6097
6155
|
this.inputReference = this.element.shadowRoot.querySelector('input');
|
|
6098
6156
|
if (this.datePicker) {
|
|
@@ -6111,6 +6169,12 @@ const DateInput = class {
|
|
|
6111
6169
|
this.touched = true;
|
|
6112
6170
|
}
|
|
6113
6171
|
});
|
|
6172
|
+
if (this.enableManualDateInput) {
|
|
6173
|
+
const inputEl = (_a = this.datePicker) === null || _a === void 0 ? void 0 : _a.inputElement;
|
|
6174
|
+
if (inputEl) {
|
|
6175
|
+
inputEl.addEventListener('input', this.handleMaskedTyping);
|
|
6176
|
+
}
|
|
6177
|
+
}
|
|
6114
6178
|
}
|
|
6115
6179
|
if (this.enableSouthAfricanMode) {
|
|
6116
6180
|
window.addEventListener('documentIdUpdated', this.handleDocumentIdUpdate);
|
|
@@ -6123,9 +6187,16 @@ const DateInput = class {
|
|
|
6123
6187
|
this.isValid = this.setValidity();
|
|
6124
6188
|
}
|
|
6125
6189
|
disconnectedCallback() {
|
|
6190
|
+
var _a;
|
|
6126
6191
|
if (this.enableSouthAfricanMode) {
|
|
6127
6192
|
window.removeEventListener('documentIdUpdated', this.handleDocumentIdUpdate);
|
|
6128
6193
|
}
|
|
6194
|
+
if (this.enableManualDateInput) {
|
|
6195
|
+
const inputEl = (_a = this.datePicker) === null || _a === void 0 ? void 0 : _a.inputElement;
|
|
6196
|
+
if (inputEl) {
|
|
6197
|
+
inputEl.removeEventListener('input', this.handleMaskedTyping);
|
|
6198
|
+
}
|
|
6199
|
+
}
|
|
6129
6200
|
}
|
|
6130
6201
|
handleCalendarIconClick() {
|
|
6131
6202
|
if (this.datePicker.opened && this.emitOnClick) {
|
|
@@ -6178,13 +6249,64 @@ const DateInput = class {
|
|
|
6178
6249
|
}
|
|
6179
6250
|
return null;
|
|
6180
6251
|
}
|
|
6252
|
+
parseFormat(format) {
|
|
6253
|
+
var _a;
|
|
6254
|
+
const f = format !== null && format !== void 0 ? format : 'dd-MM-yyyy';
|
|
6255
|
+
const tokenRegex = /([dMy]+)|([^dMy]+)/g;
|
|
6256
|
+
const tokens = [];
|
|
6257
|
+
const seps = [];
|
|
6258
|
+
let match;
|
|
6259
|
+
while ((match = tokenRegex.exec(f))) {
|
|
6260
|
+
if (match[1]) {
|
|
6261
|
+
tokens.push(match[1]);
|
|
6262
|
+
}
|
|
6263
|
+
else if (match[2]) {
|
|
6264
|
+
seps.push(match[2]);
|
|
6265
|
+
}
|
|
6266
|
+
}
|
|
6267
|
+
if (seps.length < 2) {
|
|
6268
|
+
const fallback = (_a = seps[0]) !== null && _a !== void 0 ? _a : '-';
|
|
6269
|
+
while (seps.length < 2)
|
|
6270
|
+
seps.push(fallback);
|
|
6271
|
+
}
|
|
6272
|
+
return { tokens, seps: [seps[0], seps[1]] };
|
|
6273
|
+
}
|
|
6274
|
+
getFormatStructure(format) {
|
|
6275
|
+
const { tokens } = this.parseFormat(format);
|
|
6276
|
+
if (tokens.length < 3)
|
|
6277
|
+
return [2, 2, 4];
|
|
6278
|
+
const lens = tokens.map(t => t.length);
|
|
6279
|
+
return [lens[0], lens[1], lens[2]];
|
|
6280
|
+
}
|
|
6281
|
+
totalSeparatorLength(s, seps) {
|
|
6282
|
+
if (!s)
|
|
6283
|
+
return 0;
|
|
6284
|
+
let total = 0;
|
|
6285
|
+
for (const sep of seps) {
|
|
6286
|
+
if (!sep)
|
|
6287
|
+
continue;
|
|
6288
|
+
const re = new RegExp(this.escapeRegExp(sep), 'g');
|
|
6289
|
+
const matches = s.match(re);
|
|
6290
|
+
if (matches)
|
|
6291
|
+
total += matches.length * sep.length;
|
|
6292
|
+
}
|
|
6293
|
+
return total;
|
|
6294
|
+
}
|
|
6295
|
+
escapeRegExp(str) {
|
|
6296
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
6297
|
+
}
|
|
6298
|
+
resetIncompleteState() {
|
|
6299
|
+
this.value = '';
|
|
6300
|
+
this.valueAsDate = undefined;
|
|
6301
|
+
this.isValid = false;
|
|
6302
|
+
}
|
|
6181
6303
|
render() {
|
|
6182
6304
|
let invalidClass = '';
|
|
6183
6305
|
if (this.touched) {
|
|
6184
6306
|
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
6185
6307
|
}
|
|
6186
|
-
return index.h("div", { key: '
|
|
6187
|
-
index.h("img", { key: '
|
|
6308
|
+
return index.h("div", { key: 'f8011520dee6f11203da18cc27a6f278283daace', class: `date__wrapper ${this.autofilled ? 'date__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("label", { key: 'e1e21a234b5f20f05a5c2d6eb38095bb50748ad6', class: `date__label ${this.validation.mandatory ? 'date__label--required' : ''}}`, htmlFor: `${this.name}__input` }, this.displayName, index.h("span", { key: '8dbd7ecb2e8fc686afc02a15a247f5f78484ec22', class: this.validation.mandatory ? 'date__label--required' : '' })), index.h("vaadin-date-picker", { key: '40b5106d0b80799cd81b154889461fa5378264b8', id: `${this.name}__input`, type: 'date', class: `date__input ${invalidClass} ${this.enableManualDateInput && 'date__manual-mode'}`, value: this.defaultValue, readOnly: this.autofilled, placeholder: `${this.placeholder}`, required: this.validation.mandatory, max: this.validation.max, min: this.validation.min, onChange: (e) => this.handleInput(e), onValidated: () => this.handleValidated(), autoOpenDisabled: this.enableManualDateInput }), index.h("small", { key: 'cd96dd3bb68896ea44d5071d783a7a2e2d75738f', class: 'date__error-message' }, this.errorMessage), this.tooltip &&
|
|
6309
|
+
index.h("img", { key: '971aeba271d68264bb9ff23b86bed878699d81b1', class: 'date__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip());
|
|
6188
6310
|
}
|
|
6189
6311
|
get element() { return index.getElement(this); }
|
|
6190
6312
|
static get watchers() { return {
|
|
@@ -6014,6 +6014,63 @@ const DateInput = class {
|
|
|
6014
6014
|
this.errorMessage = this.setErrorMessage();
|
|
6015
6015
|
this.valueHandler({ name: this.name, value: this.value });
|
|
6016
6016
|
};
|
|
6017
|
+
this.handleMaskedTyping = (e) => {
|
|
6018
|
+
var _a;
|
|
6019
|
+
const input = e.target;
|
|
6020
|
+
if (!input)
|
|
6021
|
+
return;
|
|
6022
|
+
const prevPos = (_a = input.selectionStart) !== null && _a !== void 0 ? _a : input.value.length;
|
|
6023
|
+
const prevValue = input.value;
|
|
6024
|
+
const [a, b, c] = this.getFormatStructure(this.dateFormat);
|
|
6025
|
+
const { seps } = this.parseFormat(this.dateFormat);
|
|
6026
|
+
const [sep1, sep2] = seps;
|
|
6027
|
+
const maxDigits = a + b + c;
|
|
6028
|
+
const digitsOnly = prevValue.replace(/\D/g, '').slice(0, maxDigits);
|
|
6029
|
+
const block1 = digitsOnly.slice(0, a);
|
|
6030
|
+
const block2 = digitsOnly.slice(a, a + b);
|
|
6031
|
+
const block3 = digitsOnly.slice(a + b, a + b + c);
|
|
6032
|
+
let formatted = block1;
|
|
6033
|
+
if (digitsOnly.length > a) {
|
|
6034
|
+
formatted += sep1 + block2;
|
|
6035
|
+
}
|
|
6036
|
+
if (digitsOnly.length > a + b) {
|
|
6037
|
+
formatted += sep2 + block3;
|
|
6038
|
+
}
|
|
6039
|
+
input.value = formatted;
|
|
6040
|
+
const oldSepLen = this.totalSeparatorLength(prevValue, [sep1, sep2]);
|
|
6041
|
+
const newSepLen = this.totalSeparatorLength(formatted, [sep1, sep2]);
|
|
6042
|
+
let newPos = prevPos + Math.max(0, newSepLen - oldSepLen);
|
|
6043
|
+
newPos = Math.max(0, Math.min(newPos, formatted.length));
|
|
6044
|
+
try {
|
|
6045
|
+
input.setSelectionRange(newPos, newPos);
|
|
6046
|
+
}
|
|
6047
|
+
catch (_b) { }
|
|
6048
|
+
if (digitsOnly.length < maxDigits) {
|
|
6049
|
+
this.errorMessage = '';
|
|
6050
|
+
this.resetIncompleteState();
|
|
6051
|
+
return;
|
|
6052
|
+
}
|
|
6053
|
+
try {
|
|
6054
|
+
const parsed = parse(formatted, this.dateFormat, new Date());
|
|
6055
|
+
if (parsed && !isNaN(parsed.getTime())) {
|
|
6056
|
+
const iso = format(parsed, 'yyyy-MM-dd');
|
|
6057
|
+
this.value = iso;
|
|
6058
|
+
this.valueAsDate = parsed;
|
|
6059
|
+
this.isValid = true;
|
|
6060
|
+
this.errorMessage = '';
|
|
6061
|
+
if (this.datePicker) {
|
|
6062
|
+
this.datePicker.value = iso;
|
|
6063
|
+
}
|
|
6064
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
6065
|
+
}
|
|
6066
|
+
else {
|
|
6067
|
+
this.resetIncompleteState();
|
|
6068
|
+
}
|
|
6069
|
+
}
|
|
6070
|
+
catch (_c) {
|
|
6071
|
+
this.resetIncompleteState();
|
|
6072
|
+
}
|
|
6073
|
+
};
|
|
6017
6074
|
this.name = undefined;
|
|
6018
6075
|
this.displayName = undefined;
|
|
6019
6076
|
this.placeholder = undefined;
|
|
@@ -6089,6 +6146,7 @@ const DateInput = class {
|
|
|
6089
6146
|
// end custom styling area
|
|
6090
6147
|
}
|
|
6091
6148
|
componentDidLoad() {
|
|
6149
|
+
var _a;
|
|
6092
6150
|
this.datePicker = this.element.shadowRoot.querySelector('vaadin-date-picker');
|
|
6093
6151
|
this.inputReference = this.element.shadowRoot.querySelector('input');
|
|
6094
6152
|
if (this.datePicker) {
|
|
@@ -6107,6 +6165,12 @@ const DateInput = class {
|
|
|
6107
6165
|
this.touched = true;
|
|
6108
6166
|
}
|
|
6109
6167
|
});
|
|
6168
|
+
if (this.enableManualDateInput) {
|
|
6169
|
+
const inputEl = (_a = this.datePicker) === null || _a === void 0 ? void 0 : _a.inputElement;
|
|
6170
|
+
if (inputEl) {
|
|
6171
|
+
inputEl.addEventListener('input', this.handleMaskedTyping);
|
|
6172
|
+
}
|
|
6173
|
+
}
|
|
6110
6174
|
}
|
|
6111
6175
|
if (this.enableSouthAfricanMode) {
|
|
6112
6176
|
window.addEventListener('documentIdUpdated', this.handleDocumentIdUpdate);
|
|
@@ -6119,9 +6183,16 @@ const DateInput = class {
|
|
|
6119
6183
|
this.isValid = this.setValidity();
|
|
6120
6184
|
}
|
|
6121
6185
|
disconnectedCallback() {
|
|
6186
|
+
var _a;
|
|
6122
6187
|
if (this.enableSouthAfricanMode) {
|
|
6123
6188
|
window.removeEventListener('documentIdUpdated', this.handleDocumentIdUpdate);
|
|
6124
6189
|
}
|
|
6190
|
+
if (this.enableManualDateInput) {
|
|
6191
|
+
const inputEl = (_a = this.datePicker) === null || _a === void 0 ? void 0 : _a.inputElement;
|
|
6192
|
+
if (inputEl) {
|
|
6193
|
+
inputEl.removeEventListener('input', this.handleMaskedTyping);
|
|
6194
|
+
}
|
|
6195
|
+
}
|
|
6125
6196
|
}
|
|
6126
6197
|
handleCalendarIconClick() {
|
|
6127
6198
|
if (this.datePicker.opened && this.emitOnClick) {
|
|
@@ -6174,13 +6245,64 @@ const DateInput = class {
|
|
|
6174
6245
|
}
|
|
6175
6246
|
return null;
|
|
6176
6247
|
}
|
|
6248
|
+
parseFormat(format) {
|
|
6249
|
+
var _a;
|
|
6250
|
+
const f = format !== null && format !== void 0 ? format : 'dd-MM-yyyy';
|
|
6251
|
+
const tokenRegex = /([dMy]+)|([^dMy]+)/g;
|
|
6252
|
+
const tokens = [];
|
|
6253
|
+
const seps = [];
|
|
6254
|
+
let match;
|
|
6255
|
+
while ((match = tokenRegex.exec(f))) {
|
|
6256
|
+
if (match[1]) {
|
|
6257
|
+
tokens.push(match[1]);
|
|
6258
|
+
}
|
|
6259
|
+
else if (match[2]) {
|
|
6260
|
+
seps.push(match[2]);
|
|
6261
|
+
}
|
|
6262
|
+
}
|
|
6263
|
+
if (seps.length < 2) {
|
|
6264
|
+
const fallback = (_a = seps[0]) !== null && _a !== void 0 ? _a : '-';
|
|
6265
|
+
while (seps.length < 2)
|
|
6266
|
+
seps.push(fallback);
|
|
6267
|
+
}
|
|
6268
|
+
return { tokens, seps: [seps[0], seps[1]] };
|
|
6269
|
+
}
|
|
6270
|
+
getFormatStructure(format) {
|
|
6271
|
+
const { tokens } = this.parseFormat(format);
|
|
6272
|
+
if (tokens.length < 3)
|
|
6273
|
+
return [2, 2, 4];
|
|
6274
|
+
const lens = tokens.map(t => t.length);
|
|
6275
|
+
return [lens[0], lens[1], lens[2]];
|
|
6276
|
+
}
|
|
6277
|
+
totalSeparatorLength(s, seps) {
|
|
6278
|
+
if (!s)
|
|
6279
|
+
return 0;
|
|
6280
|
+
let total = 0;
|
|
6281
|
+
for (const sep of seps) {
|
|
6282
|
+
if (!sep)
|
|
6283
|
+
continue;
|
|
6284
|
+
const re = new RegExp(this.escapeRegExp(sep), 'g');
|
|
6285
|
+
const matches = s.match(re);
|
|
6286
|
+
if (matches)
|
|
6287
|
+
total += matches.length * sep.length;
|
|
6288
|
+
}
|
|
6289
|
+
return total;
|
|
6290
|
+
}
|
|
6291
|
+
escapeRegExp(str) {
|
|
6292
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
6293
|
+
}
|
|
6294
|
+
resetIncompleteState() {
|
|
6295
|
+
this.value = '';
|
|
6296
|
+
this.valueAsDate = undefined;
|
|
6297
|
+
this.isValid = false;
|
|
6298
|
+
}
|
|
6177
6299
|
render() {
|
|
6178
6300
|
let invalidClass = '';
|
|
6179
6301
|
if (this.touched) {
|
|
6180
6302
|
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
6181
6303
|
}
|
|
6182
|
-
return h("div", { key: '
|
|
6183
|
-
h("img", { key: '
|
|
6304
|
+
return h("div", { key: 'f8011520dee6f11203da18cc27a6f278283daace', class: `date__wrapper ${this.autofilled ? 'date__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, h("label", { key: 'e1e21a234b5f20f05a5c2d6eb38095bb50748ad6', class: `date__label ${this.validation.mandatory ? 'date__label--required' : ''}}`, htmlFor: `${this.name}__input` }, this.displayName, h("span", { key: '8dbd7ecb2e8fc686afc02a15a247f5f78484ec22', class: this.validation.mandatory ? 'date__label--required' : '' })), h("vaadin-date-picker", { key: '40b5106d0b80799cd81b154889461fa5378264b8', id: `${this.name}__input`, type: 'date', class: `date__input ${invalidClass} ${this.enableManualDateInput && 'date__manual-mode'}`, value: this.defaultValue, readOnly: this.autofilled, placeholder: `${this.placeholder}`, required: this.validation.mandatory, max: this.validation.max, min: this.validation.min, onChange: (e) => this.handleInput(e), onValidated: () => this.handleValidated(), autoOpenDisabled: this.enableManualDateInput }), h("small", { key: 'cd96dd3bb68896ea44d5071d783a7a2e2d75738f', class: 'date__error-message' }, this.errorMessage), this.tooltip &&
|
|
6305
|
+
h("img", { key: '971aeba271d68264bb9ff23b86bed878699d81b1', class: 'date__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip());
|
|
6184
6306
|
}
|
|
6185
6307
|
get element() { return getElement(this); }
|
|
6186
6308
|
static get watchers() { return {
|