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