@everymatrix/general-registration 1.10.20 → 1.10.22
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/cjs/checkbox-group-input_12.cjs.entry.js +253 -118
- package/dist/cjs/general-registration.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/general-registration/general-registration.css +4 -0
- package/dist/collection/components/general-registration/general-registration.js +49 -19
- package/dist/components/checkbox-group-input2.js +8 -4
- package/dist/components/checkbox-input2.js +4 -2
- package/dist/components/date-input2.js +17 -7
- package/dist/components/email-input2.js +27 -10
- package/dist/components/general-registration.js +30 -19
- package/dist/components/number-input2.js +27 -10
- package/dist/components/password-input2.js +46 -19
- package/dist/components/radio-input2.js +1 -2
- package/dist/components/select-input2.js +15 -10
- package/dist/components/tel-input2.js +39 -22
- package/dist/components/text-input2.js +43 -16
- package/dist/esm/checkbox-group-input_12.entry.js +253 -118
- package/dist/esm/general-registration.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/general-registration/general-registration.esm.js +1 -1
- package/dist/general-registration/{p-cb8af7e3.entry.js → p-201aaed1.entry.js} +34 -34
- package/dist/types/Users/adrian.pripon/Documents/Work/stencil/widgets-stencil/packages/general-registration/.stencil/packages/general-input/src/utils/types.d.ts +3 -0
- package/dist/types/components/general-registration/general-registration.d.ts +10 -3
- package/dist/types/components.d.ts +8 -0
- package/package.json +1 -1
|
@@ -14716,7 +14716,6 @@ const CheckboxGroupInput = class {
|
|
|
14716
14716
|
this.limitStylingAppends = false;
|
|
14717
14717
|
this.showTooltip = false;
|
|
14718
14718
|
this.selectedValues = [];
|
|
14719
|
-
this.value = '';
|
|
14720
14719
|
this.setClientStyling = () => {
|
|
14721
14720
|
let sheet = document.createElement('style');
|
|
14722
14721
|
sheet.innerHTML = this.clientStyling;
|
|
@@ -14724,12 +14723,16 @@ const CheckboxGroupInput = class {
|
|
|
14724
14723
|
};
|
|
14725
14724
|
}
|
|
14726
14725
|
validityChanged() {
|
|
14726
|
+
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
14727
14727
|
if (this.emitValue == true) {
|
|
14728
14728
|
this.valueHandler({ name: this.name, value: this.value, type: 'checkboxgroup' });
|
|
14729
14729
|
}
|
|
14730
14730
|
}
|
|
14731
14731
|
setValue() {
|
|
14732
|
-
this.value = this.
|
|
14732
|
+
this.value = this.options.reduce((acc, option) => {
|
|
14733
|
+
acc[option.name] = this.selectedValues.includes(option.name);
|
|
14734
|
+
return acc;
|
|
14735
|
+
}, {});
|
|
14733
14736
|
this.emitValueHandler(true);
|
|
14734
14737
|
}
|
|
14735
14738
|
validityStateHandler(inputStateEvent) {
|
|
@@ -14763,9 +14766,10 @@ const CheckboxGroupInput = class {
|
|
|
14763
14766
|
// For now this input has no validation. Send isValid as true immediately.
|
|
14764
14767
|
//@TODO: add validation logic to it, if business reason arises.
|
|
14765
14768
|
this.isValid = this.setValidity();
|
|
14766
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
14767
14769
|
if (this.defaultValue) {
|
|
14768
14770
|
this.selectedValues = this.options.map((checkbox) => checkbox.name);
|
|
14771
|
+
this.value = this.defaultValue;
|
|
14772
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
14769
14773
|
}
|
|
14770
14774
|
}
|
|
14771
14775
|
setValidity() {
|
|
@@ -14789,7 +14793,7 @@ const CheckboxGroupInput = class {
|
|
|
14789
14793
|
: [];
|
|
14790
14794
|
}
|
|
14791
14795
|
render() {
|
|
14792
|
-
return index.h("div", { class:
|
|
14796
|
+
return index.h("div", { class: `checkboxgroup__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("div", { class: 'checkboxgroup__wrapper--flex' }, index.h("vaadin-checkbox", { label: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, checked: this.selectedValues.length === this.options.length || this.defaultValue === 'true', indeterminate: this.selectedValues.length > 0 && this.selectedValues.length < this.options.length, onChange: (e) => this.handleParentCheckbox(e) }), this.tooltip &&
|
|
14793
14797
|
index.h("img", { class: 'checkboxgroup__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip()), index.h("small", { class: 'checkboxgroup__error-message' }, this.errorMessage), index.h("vaadin-checkbox-group", { theme: "vertical", value: this.selectedValues, "on-value-changed": (event) => {
|
|
14794
14798
|
this.selectedValues = event.detail.value;
|
|
14795
14799
|
} }, this.options.map((checkbox) => index.h("vaadin-checkbox", { name: checkbox.name, value: checkbox.name, label: checkbox.displayName }))));
|
|
@@ -14828,6 +14832,7 @@ const CheckboxInput = class {
|
|
|
14828
14832
|
};
|
|
14829
14833
|
}
|
|
14830
14834
|
validityChanged() {
|
|
14835
|
+
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
14831
14836
|
if (this.emitValue == true) {
|
|
14832
14837
|
this.valueHandler({ name: this.name, value: this.value });
|
|
14833
14838
|
}
|
|
@@ -14857,6 +14862,8 @@ const CheckboxInput = class {
|
|
|
14857
14862
|
this.limitStylingAppends = true;
|
|
14858
14863
|
}
|
|
14859
14864
|
// end custom styling area
|
|
14865
|
+
}
|
|
14866
|
+
componentDidLoad() {
|
|
14860
14867
|
if (this.defaultValue) {
|
|
14861
14868
|
this.value = this.defaultValue;
|
|
14862
14869
|
this.valueHandler({ name: this.name, value: this.value });
|
|
@@ -14866,7 +14873,6 @@ const CheckboxInput = class {
|
|
|
14866
14873
|
this.value = this.inputReference.checked.toString();
|
|
14867
14874
|
this.errorMessage = this.setErrorMessage();
|
|
14868
14875
|
this.isValid = this.setValidity();
|
|
14869
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
14870
14876
|
this.emitValueHandler(true);
|
|
14871
14877
|
}
|
|
14872
14878
|
setValidity() {
|
|
@@ -14887,7 +14893,7 @@ const CheckboxInput = class {
|
|
|
14887
14893
|
return null;
|
|
14888
14894
|
}
|
|
14889
14895
|
render() {
|
|
14890
|
-
return index.h("div", { class:
|
|
14896
|
+
return index.h("div", { class: `checkbox__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("input", { type: "checkbox", id: `${this.name}__input`, ref: (el) => this.inputReference = el, name: this.name, checked: this.defaultValue === "true", readOnly: this.autofilled, required: this.validation.mandatory, value: this.value, onClick: () => this.handleClick() }), this.renderLabel(), index.h("small", { class: 'checkbox__error-message' }, this.errorMessage), index.h("div", { class: 'checkbox__wrapper--relative' }, this.tooltip &&
|
|
14891
14897
|
index.h("img", { class: 'checkbox__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip()));
|
|
14892
14898
|
}
|
|
14893
14899
|
static get watchers() { return {
|
|
@@ -29225,6 +29231,7 @@ const DateInput = class {
|
|
|
29225
29231
|
this.clientStyling = '';
|
|
29226
29232
|
this.limitStylingAppends = false;
|
|
29227
29233
|
this.showTooltip = false;
|
|
29234
|
+
this.touched = false;
|
|
29228
29235
|
this.formatDate = (dateParts) => {
|
|
29229
29236
|
const { year, month, day } = dateParts;
|
|
29230
29237
|
const date = new Date(year, month, day);
|
|
@@ -29234,6 +29241,11 @@ const DateInput = class {
|
|
|
29234
29241
|
const date = parse(inputValue, this.dateFormat || 'yyyy-MM-dd', new Date());
|
|
29235
29242
|
return { year: date.getFullYear(), month: date.getMonth(), day: date.getDate() };
|
|
29236
29243
|
};
|
|
29244
|
+
this.handleBlur = () => {
|
|
29245
|
+
this.isValid = this.setValidity();
|
|
29246
|
+
this.errorMessage = this.setErrorMessage();
|
|
29247
|
+
this.touched = true;
|
|
29248
|
+
};
|
|
29237
29249
|
this.setClientStyling = () => {
|
|
29238
29250
|
let sheet = document.createElement('style');
|
|
29239
29251
|
sheet.innerHTML = this.clientStyling;
|
|
@@ -29271,21 +29283,22 @@ const DateInput = class {
|
|
|
29271
29283
|
this.limitStylingAppends = true;
|
|
29272
29284
|
}
|
|
29273
29285
|
// end custom styling area
|
|
29274
|
-
if (this.defaultValue) {
|
|
29275
|
-
this.value = this.defaultValue;
|
|
29276
|
-
this.valueHandler({ name: this.name, value: this.value });
|
|
29277
|
-
}
|
|
29278
29286
|
}
|
|
29279
29287
|
componentDidLoad() {
|
|
29280
29288
|
this.datePicker = this.element.shadowRoot.querySelector('vaadin-date-picker');
|
|
29281
29289
|
this.inputReference = this.element.shadowRoot.querySelector('input');
|
|
29282
29290
|
this.datePicker.i18n = Object.assign(Object.assign({}, this.datePicker.i18n), { formatDate: this.formatDate, parseDate: this.parseDate });
|
|
29291
|
+
this.isValid = this.setValidity();
|
|
29292
|
+
if (this.defaultValue) {
|
|
29293
|
+
this.value = this.defaultValue;
|
|
29294
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
29295
|
+
}
|
|
29283
29296
|
}
|
|
29284
29297
|
handleInput(event) {
|
|
29285
29298
|
this.value = event.target.value;
|
|
29299
|
+
this.touched = true;
|
|
29286
29300
|
this.errorMessage = this.setErrorMessage();
|
|
29287
29301
|
this.isValid = this.setValidity();
|
|
29288
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
29289
29302
|
this.emitValueHandler(true);
|
|
29290
29303
|
}
|
|
29291
29304
|
setValidity() {
|
|
@@ -29306,8 +29319,11 @@ const DateInput = class {
|
|
|
29306
29319
|
return null;
|
|
29307
29320
|
}
|
|
29308
29321
|
render() {
|
|
29309
|
-
|
|
29310
|
-
|
|
29322
|
+
let invalidClass;
|
|
29323
|
+
if (this.touched) {
|
|
29324
|
+
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
29325
|
+
}
|
|
29326
|
+
return index.h("div", { class: `date__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("label", { class: `date__label ${this.validation.mandatory ? 'date__label--required' : ''}}`, htmlFor: `${this.name}__input` }, this.displayName, " ", this.validation.mandatory ? '*' : ''), index.h("vaadin-date-picker", { id: `${this.name}__input`, type: 'date', class: `date__input ${invalidClass}`, value: this.defaultValue, readOnly: this.autofilled, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, required: this.validation.mandatory, max: this.validation.max, min: this.validation.min, onChange: (e) => this.handleInput(e), onBlur: this.handleBlur }), index.h("small", { class: 'date__error-message' }, this.errorMessage), this.tooltip &&
|
|
29311
29327
|
index.h("img", { class: 'date__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip());
|
|
29312
29328
|
}
|
|
29313
29329
|
get element() { return index.getElement(this); }
|
|
@@ -29332,6 +29348,24 @@ const EmailInput = class {
|
|
|
29332
29348
|
this.limitStylingAppends = false;
|
|
29333
29349
|
this.showTooltip = false;
|
|
29334
29350
|
this.validationPattern = '';
|
|
29351
|
+
this.touched = false;
|
|
29352
|
+
this.handleInput = (event) => {
|
|
29353
|
+
this.value = event.target.value;
|
|
29354
|
+
this.touched = true;
|
|
29355
|
+
if (this.debounceTime) {
|
|
29356
|
+
clearTimeout(this.debounceTime);
|
|
29357
|
+
}
|
|
29358
|
+
this.debounceTime = setTimeout(() => {
|
|
29359
|
+
this.isValid = this.setValidity();
|
|
29360
|
+
this.errorMessage = this.setErrorMessage();
|
|
29361
|
+
this.emitValueHandler(true);
|
|
29362
|
+
}, 500);
|
|
29363
|
+
};
|
|
29364
|
+
this.handleBlur = () => {
|
|
29365
|
+
this.isValid = this.setValidity();
|
|
29366
|
+
this.errorMessage = this.setErrorMessage();
|
|
29367
|
+
this.touched = true;
|
|
29368
|
+
};
|
|
29335
29369
|
this.setClientStyling = () => {
|
|
29336
29370
|
let sheet = document.createElement('style');
|
|
29337
29371
|
sheet.innerHTML = this.clientStyling;
|
|
@@ -29379,18 +29413,14 @@ const EmailInput = class {
|
|
|
29379
29413
|
this.limitStylingAppends = true;
|
|
29380
29414
|
}
|
|
29381
29415
|
// end custom styling area
|
|
29416
|
+
}
|
|
29417
|
+
componentDidLoad() {
|
|
29418
|
+
this.isValid = this.setValidity();
|
|
29382
29419
|
if (this.defaultValue) {
|
|
29383
29420
|
this.value = this.defaultValue;
|
|
29384
29421
|
this.valueHandler({ name: this.name, value: this.value });
|
|
29385
29422
|
}
|
|
29386
29423
|
}
|
|
29387
|
-
handleInput(event) {
|
|
29388
|
-
this.value = event.target.value;
|
|
29389
|
-
this.errorMessage = this.setErrorMessage();
|
|
29390
|
-
this.isValid = this.setValidity();
|
|
29391
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
29392
|
-
this.emitValueHandler(true);
|
|
29393
|
-
}
|
|
29394
29424
|
setValidity() {
|
|
29395
29425
|
return this.inputReference.validity.valid;
|
|
29396
29426
|
}
|
|
@@ -29422,9 +29452,12 @@ const EmailInput = class {
|
|
|
29422
29452
|
return null;
|
|
29423
29453
|
}
|
|
29424
29454
|
render() {
|
|
29425
|
-
|
|
29426
|
-
|
|
29427
|
-
|
|
29455
|
+
let invalidClass;
|
|
29456
|
+
if (this.touched) {
|
|
29457
|
+
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
29458
|
+
}
|
|
29459
|
+
return index.h("div", { class: `email__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("div", { class: 'email__wrapper--flex' }, index.h("label", { class: `email__label ${this.validation.mandatory ? 'email__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("div", { class: 'email__wrapper--relative' }, this.tooltip &&
|
|
29460
|
+
index.h("img", { class: 'email__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), index.h("input", { id: `${this.name}__input`, type: 'email', class: `email__input ${invalidClass}`, value: this.defaultValue, readOnly: this.autofilled, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, ref: (el) => this.inputReference = el, pattern: this.validationPattern, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, onInput: this.handleInput, onBlur: this.handleBlur }), index.h("small", { class: 'email__error-message' }, this.errorMessage));
|
|
29428
29461
|
}
|
|
29429
29462
|
static get watchers() { return {
|
|
29430
29463
|
"isValid": ["validityChanged"],
|
|
@@ -29529,7 +29562,7 @@ const translate = (key, customLang, values) => {
|
|
|
29529
29562
|
return translation;
|
|
29530
29563
|
};
|
|
29531
29564
|
|
|
29532
|
-
const generalRegistrationCss = "*,\n*::before,\n*::after {\n padding: 0;\n margin: 0;\n box-sizing: border-box;\n}\n\n.registration {\n font-family: \"Roboto\";\n font-style: normal;\n font-family: sans-serif;\n display: flex;\n flex-direction: column;\n gap: 24px;\n width: 100%;\n height: 100%;\n container-type: inline-size;\n}\n.registration__error-message {\n color: #cc0000b3;\n}\n.registration__form {\n display: grid;\n grid-template-columns: repeat(1, 1fr);\n gap: 40px;\n justify-items: stretch;\n align-content: flex-start;\n overflow: auto;\n width: 100%;\n height: 100%;\n}\n.registration__buttons-wrapper {\n display: flex;\n flex-direction: column;\n justify-content: space-around;\n align-items: center;\n}\n.registration__button {\n text-transform: uppercase;\n width: 250px;\n height: 40px;\n border-radius: 3px;\n}\n.registration__button:hover {\n opacity: 0.8;\n}\n.registration__button:active {\n opacity: 1;\n}\n.registration__button--next {\n color: #FFFFFF;\n background-color: #B0B0B0;\n border: none;\n}\n.registration__button--back {\n color: #B0B0B0;\n background-color: #FFFFFF;\n border: 2px solid #B0B0B0;\n}\n.registration__button--disabled {\n opacity: 0.5;\n}\n.registration__button--disabled:hover {\n opacity: 0.5;\n}\n.registration__button--first-step {\n display: none;\n}\n\n@container (min-width: 450px) {\n .registration__form {\n grid-template-columns: repeat(2, 1fr);\n }\n\n .registration__buttons-wrapper {\n flex-direction: row-reverse;\n gap: 15px;\n }\n}";
|
|
29565
|
+
const generalRegistrationCss = "*,\n*::before,\n*::after {\n padding: 0;\n margin: 0;\n box-sizing: border-box;\n}\n\n.registration__form.hidden {\n display: none;\n}\n\n.registration {\n font-family: \"Roboto\";\n font-style: normal;\n font-family: sans-serif;\n display: flex;\n flex-direction: column;\n gap: 24px;\n width: 100%;\n height: 100%;\n container-type: inline-size;\n}\n.registration__error-message {\n color: #cc0000b3;\n}\n.registration__form {\n display: grid;\n grid-template-columns: repeat(1, 1fr);\n gap: 40px;\n justify-items: stretch;\n align-content: flex-start;\n overflow: auto;\n width: 100%;\n height: 100%;\n}\n.registration__buttons-wrapper {\n display: flex;\n flex-direction: column;\n justify-content: space-around;\n align-items: center;\n}\n.registration__button {\n text-transform: uppercase;\n width: 250px;\n height: 40px;\n border-radius: 3px;\n}\n.registration__button:hover {\n opacity: 0.8;\n}\n.registration__button:active {\n opacity: 1;\n}\n.registration__button--next {\n color: #FFFFFF;\n background-color: #B0B0B0;\n border: none;\n}\n.registration__button--back {\n color: #B0B0B0;\n background-color: #FFFFFF;\n border: 2px solid #B0B0B0;\n}\n.registration__button--disabled {\n opacity: 0.5;\n}\n.registration__button--disabled:hover {\n opacity: 0.5;\n}\n.registration__button--first-step {\n display: none;\n}\n\n@container (min-width: 450px) {\n .registration__form {\n grid-template-columns: repeat(2, 1fr);\n }\n\n .registration__buttons-wrapper {\n flex-direction: row-reverse;\n gap: 15px;\n }\n}";
|
|
29533
29566
|
|
|
29534
29567
|
const GeneralRegistration = class {
|
|
29535
29568
|
constructor(hostRef) {
|
|
@@ -29552,12 +29585,14 @@ const GeneralRegistration = class {
|
|
|
29552
29585
|
* Translations via URL
|
|
29553
29586
|
*/
|
|
29554
29587
|
this.translationUrl = '';
|
|
29555
|
-
this.listOfInputs = [];
|
|
29556
29588
|
this.isLoading = true;
|
|
29589
|
+
this.forms = [];
|
|
29557
29590
|
this.listOfInputValues = [];
|
|
29558
29591
|
this.listOfInputValidity = [];
|
|
29559
29592
|
this.listOfActions = [];
|
|
29593
|
+
this.listOfInputs = [];
|
|
29560
29594
|
this.emitValue = false;
|
|
29595
|
+
this.backButtonPressed = false;
|
|
29561
29596
|
this.registrationStepsState = {
|
|
29562
29597
|
regId: null
|
|
29563
29598
|
};
|
|
@@ -29584,7 +29619,9 @@ const GeneralRegistration = class {
|
|
|
29584
29619
|
}
|
|
29585
29620
|
setFormValidity() {
|
|
29586
29621
|
this.errorMessage = '';
|
|
29587
|
-
|
|
29622
|
+
if (this.listOfInputValidity) {
|
|
29623
|
+
this.isFormValid = !this.getInvalidStatus(this.listOfInputValidity);
|
|
29624
|
+
}
|
|
29588
29625
|
}
|
|
29589
29626
|
checkInputsValidityHandler(event) {
|
|
29590
29627
|
// Set isValid state of the input in the list.
|
|
@@ -29649,7 +29686,6 @@ const GeneralRegistration = class {
|
|
|
29649
29686
|
}
|
|
29650
29687
|
backHandler(e) {
|
|
29651
29688
|
e.preventDefault();
|
|
29652
|
-
this.isLastStep = false;
|
|
29653
29689
|
this.registrationStep = this.stepChange('decrement');
|
|
29654
29690
|
this.stepsStateMachine({ event: 'get', type: 'inputs' });
|
|
29655
29691
|
this.stepsStateMachine({ event: 'get', type: 'values' });
|
|
@@ -29732,16 +29768,17 @@ const GeneralRegistration = class {
|
|
|
29732
29768
|
.filter(input => !input.isDuplicate)
|
|
29733
29769
|
.reduce((acc, curr) => {
|
|
29734
29770
|
// Because the API is very robust, some values need to be split as separate entities.
|
|
29735
|
-
if (curr.
|
|
29736
|
-
|
|
29737
|
-
acc[
|
|
29771
|
+
if (curr.type === 'tel') {
|
|
29772
|
+
//@ts-ignore
|
|
29773
|
+
acc['MobilePrefix'] = curr.value.prefix;
|
|
29774
|
+
//@ts-ignore
|
|
29775
|
+
acc[curr.name] = curr.value.phone;
|
|
29738
29776
|
}
|
|
29739
29777
|
else if (curr.type === 'checkboxgroup') {
|
|
29740
29778
|
// Skip adding the parent of the checkboxgroup as a key.
|
|
29741
|
-
if (curr.value !== null
|
|
29742
|
-
|
|
29743
|
-
|
|
29744
|
-
acc[checkboxValue] = 'true';
|
|
29779
|
+
if (curr.value !== null) {
|
|
29780
|
+
Object.entries(curr.value).forEach(([key, value]) => {
|
|
29781
|
+
acc[key] = value ? 'true' : 'false';
|
|
29745
29782
|
});
|
|
29746
29783
|
}
|
|
29747
29784
|
}
|
|
@@ -29872,9 +29909,13 @@ const GeneralRegistration = class {
|
|
|
29872
29909
|
});
|
|
29873
29910
|
// Set the list of actions
|
|
29874
29911
|
this.listOfActions = config.content.actions.map(action => action);
|
|
29875
|
-
this.isLastStep = this.listOfActions.some(action => action == '/register');
|
|
29876
29912
|
this.registrationID = config.content.registrationID;
|
|
29877
29913
|
this.registrationStep = config.content.step;
|
|
29914
|
+
if (this.listOfActions.some(action => action == '/register')) {
|
|
29915
|
+
this.lastStep = this.registrationStep;
|
|
29916
|
+
}
|
|
29917
|
+
// this.forms.push({ [this.registrationStep] : this.listOfInputs});
|
|
29918
|
+
this.forms = [...this.forms, { [this.registrationStep]: this.listOfInputs }];
|
|
29878
29919
|
// Add the step to the registrationStepsData
|
|
29879
29920
|
this.registrationStepsState.regId = this.registrationID;
|
|
29880
29921
|
if (!this.registrationStepsState[this.registrationStep]) {
|
|
@@ -29910,22 +29951,24 @@ const GeneralRegistration = class {
|
|
|
29910
29951
|
getInvalidStatus(listOfInputs) {
|
|
29911
29952
|
return listOfInputs.filter(input => input.isValid == false).length > 0;
|
|
29912
29953
|
}
|
|
29913
|
-
|
|
29914
|
-
return
|
|
29954
|
+
renderForm() {
|
|
29955
|
+
return this.forms.map((form, index$1) => {
|
|
29956
|
+
return index.h("form", { action: '.', id: `RegistrationForm${this.registrationStep}`, class: `registration__form ${this.registrationStep !== `Step${index$1 + 1}` ? 'hidden' : ''}`, ref: el => this.form = el }, form[this.registrationStep] && form[this.registrationStep].map(input => index.h("general-input", { type: input.inputType, name: input.name, displayName: input.displayName, validation: input.validate, action: input.action || null, options: input.data ? input.inputType.toLowerCase() == 'checkboxgroup' ? input.data.subFields : input.data.values : [], defaultValue: input.defaultValue, autofilled: input.autofill, emitValue: this.emitValue, language: this.language, isDuplicateInput: input.isDuplicateInput, "client-styling": this.clientStyling, tooltip: input.tooltip, placeholder: input.placeholder == null ? '' : input.placeholder, dateFormat: this.dateFormat })), this.buttonInsideForm && this.renderButtons());
|
|
29957
|
+
});
|
|
29915
29958
|
}
|
|
29916
29959
|
;
|
|
29917
29960
|
renderButtons() {
|
|
29918
|
-
return (index.h("div", { class: 'registration__buttons-wrapper' }, index.h("button", { class: `registration__button registration__button--next ${this.isFormValid ? '' : 'registration__button--disabled'}`, type: 'submit', form:
|
|
29961
|
+
return (index.h("div", { class: 'registration__buttons-wrapper' }, index.h("button", { class: `registration__button registration__button--next ${this.isFormValid ? '' : 'registration__button--disabled'}`, type: 'submit', form: `RegistrationForm${this.registrationStep}`, onClick: (e) => this.nextHandler(e), disabled: !this.isFormValid }, this.lastStep === this.registrationStep ? translate('doneButton', this.language) : translate('nextButton', this.language)), index.h("button", { class: `registration__button registration__button--back ${this.registrationStep == 'Step1' ? 'registration__button--first-step' : ''}`, onClick: (e) => this.backHandler(e) }, translate('backButton', this.language))));
|
|
29919
29962
|
}
|
|
29920
29963
|
render() {
|
|
29921
29964
|
if (this.isLoading) {
|
|
29922
29965
|
return index.h("p", null, "Please wait, loading ...");
|
|
29923
29966
|
}
|
|
29924
|
-
return (index.h("div", { class: `registration registration__${this.registrationStep}`, ref: el => this.stylingContainer = el },
|
|
29967
|
+
return (index.h("div", { class: `registration registration__${this.registrationStep}`, ref: el => this.stylingContainer = el }, this.renderForm(), index.h("p", { class: 'registration__error-message' }, this.errorMessage), !this.buttonInsideForm && this.renderButtons()));
|
|
29925
29968
|
}
|
|
29926
29969
|
static get watchers() { return {
|
|
29927
29970
|
"registrationStep": ["sendStep"],
|
|
29928
|
-
"
|
|
29971
|
+
"forms": ["setFormValidity"]
|
|
29929
29972
|
}; }
|
|
29930
29973
|
};
|
|
29931
29974
|
GeneralRegistration.style = generalRegistrationCss;
|
|
@@ -29944,6 +29987,24 @@ const NumberInput = class {
|
|
|
29944
29987
|
this.limitStylingAppends = false;
|
|
29945
29988
|
this.showTooltip = false;
|
|
29946
29989
|
this.validationPattern = '';
|
|
29990
|
+
this.touched = false;
|
|
29991
|
+
this.handleInput = (event) => {
|
|
29992
|
+
this.value = event.target.value;
|
|
29993
|
+
this.touched = true;
|
|
29994
|
+
if (this.debounceTime) {
|
|
29995
|
+
clearTimeout(this.debounceTime);
|
|
29996
|
+
}
|
|
29997
|
+
this.debounceTime = setTimeout(() => {
|
|
29998
|
+
this.isValid = this.setValidity();
|
|
29999
|
+
this.errorMessage = this.setErrorMessage();
|
|
30000
|
+
this.emitValueHandler(true);
|
|
30001
|
+
}, 500);
|
|
30002
|
+
};
|
|
30003
|
+
this.handleBlur = () => {
|
|
30004
|
+
this.isValid = this.setValidity();
|
|
30005
|
+
this.errorMessage = this.setErrorMessage();
|
|
30006
|
+
this.touched = true;
|
|
30007
|
+
};
|
|
29947
30008
|
this.setClientStyling = () => {
|
|
29948
30009
|
let sheet = document.createElement('style');
|
|
29949
30010
|
sheet.innerHTML = this.clientStyling;
|
|
@@ -29984,18 +30045,14 @@ const NumberInput = class {
|
|
|
29984
30045
|
this.limitStylingAppends = true;
|
|
29985
30046
|
}
|
|
29986
30047
|
// end custom styling area
|
|
30048
|
+
}
|
|
30049
|
+
componentDidLoad() {
|
|
30050
|
+
this.isValid = this.setValidity();
|
|
29987
30051
|
if (this.defaultValue) {
|
|
29988
30052
|
this.value = this.defaultValue;
|
|
29989
30053
|
this.valueHandler({ name: this.name, value: this.value });
|
|
29990
30054
|
}
|
|
29991
30055
|
}
|
|
29992
|
-
handleInput(event) {
|
|
29993
|
-
this.value = event.target.value;
|
|
29994
|
-
this.errorMessage = this.setErrorMessage();
|
|
29995
|
-
this.isValid = this.setValidity();
|
|
29996
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
29997
|
-
this.emitValueHandler(true);
|
|
29998
|
-
}
|
|
29999
30056
|
setValidity() {
|
|
30000
30057
|
return this.inputReference.validity.valid;
|
|
30001
30058
|
}
|
|
@@ -30024,9 +30081,12 @@ const NumberInput = class {
|
|
|
30024
30081
|
return null;
|
|
30025
30082
|
}
|
|
30026
30083
|
render() {
|
|
30027
|
-
|
|
30028
|
-
|
|
30029
|
-
|
|
30084
|
+
let invalidClass;
|
|
30085
|
+
if (this.touched) {
|
|
30086
|
+
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
30087
|
+
}
|
|
30088
|
+
return index.h("div", { class: `number__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("div", { class: 'number__wrapper--flex' }, index.h("label", { class: `number__label ${this.validation.mandatory ? 'number__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("div", { class: 'number__wrapper--relative' }, this.tooltip &&
|
|
30089
|
+
index.h("img", { class: 'number__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), index.h("input", { ref: (el) => this.inputReference = el, type: "number", value: this.defaultValue, readOnly: this.autofilled, id: `${this.name}__input`, class: `number__input ${invalidClass}`, pattern: this.validationPattern, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, required: this.validation.mandatory, max: this.validation.max, min: this.validation.min, onInput: this.handleInput, onBlur: this.handleBlur }), index.h("small", { class: 'number__error-message' }, this.errorMessage));
|
|
30030
30090
|
}
|
|
30031
30091
|
static get watchers() { return {
|
|
30032
30092
|
"isValid": ["validityChanged"],
|
|
@@ -30852,6 +30912,27 @@ const PasswordInput = class {
|
|
|
30852
30912
|
this.value = '';
|
|
30853
30913
|
this.validationPattern = '';
|
|
30854
30914
|
this.duplicateInputValue = null;
|
|
30915
|
+
this.handleInput = (event) => {
|
|
30916
|
+
this.value = event.target.value;
|
|
30917
|
+
this.calculateComplexity(this.value);
|
|
30918
|
+
this.showPopup = true;
|
|
30919
|
+
this.touched = true;
|
|
30920
|
+
if (this.debounceTime) {
|
|
30921
|
+
clearTimeout(this.debounceTime);
|
|
30922
|
+
}
|
|
30923
|
+
this.debounceTime = setTimeout(() => {
|
|
30924
|
+
this.isValid = this.setValidity();
|
|
30925
|
+
this.errorMessage = this.setErrorMessage();
|
|
30926
|
+
this.emitValueHandler(true);
|
|
30927
|
+
}, 500);
|
|
30928
|
+
};
|
|
30929
|
+
this.handleBlur = (event) => {
|
|
30930
|
+
this.value = event.target.value;
|
|
30931
|
+
this.showPopup = false;
|
|
30932
|
+
this.touched = true;
|
|
30933
|
+
this.isValid = this.setValidity();
|
|
30934
|
+
this.errorMessage = this.setErrorMessage();
|
|
30935
|
+
};
|
|
30855
30936
|
this.setClientStyling = () => {
|
|
30856
30937
|
let sheet = document.createElement('style');
|
|
30857
30938
|
sheet.innerHTML = this.clientStyling;
|
|
@@ -30866,7 +30947,7 @@ const PasswordInput = class {
|
|
|
30866
30947
|
}
|
|
30867
30948
|
emitValueHandler(newValue) {
|
|
30868
30949
|
if (newValue == true && this.isValid) {
|
|
30869
|
-
this.valueHandler({ name: this.name, value: this.value });
|
|
30950
|
+
this.valueHandler({ name: this.name, value: this.value, type: 'duplicate' });
|
|
30870
30951
|
}
|
|
30871
30952
|
}
|
|
30872
30953
|
validityStateHandler(inputStateEvent) {
|
|
@@ -30876,12 +30957,16 @@ const PasswordInput = class {
|
|
|
30876
30957
|
this.sendInputValue.emit(inputValueEvent);
|
|
30877
30958
|
}
|
|
30878
30959
|
valueChangedHandler(event) {
|
|
30879
|
-
if (this.isDuplicateInput) {
|
|
30880
|
-
|
|
30881
|
-
|
|
30960
|
+
if (this.isDuplicateInput && this.name === event.detail.name + 'Duplicate') {
|
|
30961
|
+
this.duplicateInputValue = event.detail.value;
|
|
30962
|
+
if (this.touched) {
|
|
30963
|
+
this.isValid = this.setValidity();
|
|
30964
|
+
this.errorMessage = this.setErrorMessage();
|
|
30882
30965
|
}
|
|
30883
30966
|
}
|
|
30884
|
-
if (this.name === event.detail.name + 'Duplicate'
|
|
30967
|
+
if (this.name === event.detail.name + 'Duplicate'
|
|
30968
|
+
&& this.name.replace('Duplicate', '') === event.detail.name
|
|
30969
|
+
&& this.touched === true) {
|
|
30885
30970
|
this.isValid = this.setValidity();
|
|
30886
30971
|
this.errorMessage = this.setErrorMessage();
|
|
30887
30972
|
}
|
|
@@ -30908,22 +30993,17 @@ const PasswordInput = class {
|
|
|
30908
30993
|
this.inputReference = this.element.shadowRoot.querySelector('input');
|
|
30909
30994
|
this.passwordButton = this.element.shadowRoot.querySelector('vaadin-password-field-button');
|
|
30910
30995
|
this.passwordButton.tabIndex = -1;
|
|
30996
|
+
this.isValid = this.setValidity();
|
|
30911
30997
|
if (this.defaultValue) {
|
|
30912
30998
|
this.value = this.defaultValue;
|
|
30913
30999
|
this.calculateComplexity(this.value);
|
|
30914
31000
|
this.valueHandler({ name: this.name, value: this.value });
|
|
31001
|
+
if (this.isDuplicateInput) {
|
|
31002
|
+
this.duplicateInputValue = this.defaultValue;
|
|
31003
|
+
this.touched = true;
|
|
31004
|
+
}
|
|
30915
31005
|
}
|
|
30916
31006
|
}
|
|
30917
|
-
handleInput(event) {
|
|
30918
|
-
this.value = event.target.value;
|
|
30919
|
-
this.calculateComplexity(this.value);
|
|
30920
|
-
this.showPopup = true;
|
|
30921
|
-
this.errorMessage = this.setErrorMessage();
|
|
30922
|
-
this.isValid = this.setValidity();
|
|
30923
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
30924
|
-
this.emitValueHandler(true);
|
|
30925
|
-
this.touched = true;
|
|
30926
|
-
}
|
|
30927
31007
|
calculateComplexity(password) {
|
|
30928
31008
|
this.passwordComplexity = this.validation.custom
|
|
30929
31009
|
.filter(rule => rule.rule === 'regex')
|
|
@@ -30934,11 +31014,15 @@ const PasswordInput = class {
|
|
|
30934
31014
|
});
|
|
30935
31015
|
}
|
|
30936
31016
|
setValidity() {
|
|
31017
|
+
var _a, _b;
|
|
30937
31018
|
if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
|
|
30938
31019
|
return false;
|
|
30939
31020
|
}
|
|
31021
|
+
else if (!((_a = this.passwordComplexity) === null || _a === void 0 ? void 0 : _a.every(complexity => complexity.passed))) {
|
|
31022
|
+
return false;
|
|
31023
|
+
}
|
|
30940
31024
|
else {
|
|
30941
|
-
return this.inputReference.validity.valid;
|
|
31025
|
+
return (_b = this.inputReference) === null || _b === void 0 ? void 0 : _b.validity.valid;
|
|
30942
31026
|
}
|
|
30943
31027
|
}
|
|
30944
31028
|
setPattern() {
|
|
@@ -30980,9 +31064,12 @@ const PasswordInput = class {
|
|
|
30980
31064
|
}))));
|
|
30981
31065
|
}
|
|
30982
31066
|
render() {
|
|
30983
|
-
|
|
30984
|
-
|
|
30985
|
-
|
|
31067
|
+
let invalidClass;
|
|
31068
|
+
if (this.touched) {
|
|
31069
|
+
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
31070
|
+
}
|
|
31071
|
+
return index.h("div", { class: `password__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("div", { class: 'password__wrapper--flex' }, index.h("label", { class: `password__label ${this.validation.mandatory ? 'password__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("div", { class: 'password__wrapper--relative' }, this.tooltip &&
|
|
31072
|
+
index.h("img", { class: 'password__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), index.h("vaadin-password-field", { type: "password", id: `${this.name}__input`, class: `password__input ${invalidClass}`, name: this.name, readOnly: this.autofilled, value: this.defaultValue, required: this.validation.mandatory, maxlength: this.validation.maxLength, minlength: this.validation.minLength, pattern: this.validationPattern, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, onInput: this.handleInput, onBlur: this.handleBlur, onFocus: () => this.showPopup = true }), index.h("small", { class: 'password__error-message' }, this.errorMessage), this.passwordComplexity && !this.isDuplicateInput && this.renderComplexityPopup());
|
|
30986
31073
|
}
|
|
30987
31074
|
get element() { return index.getElement(this); }
|
|
30988
31075
|
static get watchers() { return {
|
|
@@ -31047,7 +31134,6 @@ const RadioInput = class {
|
|
|
31047
31134
|
this.value = event.target.value;
|
|
31048
31135
|
this.isValid = this.setValidity();
|
|
31049
31136
|
this.errorMessage = this.setErrorMessage();
|
|
31050
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
31051
31137
|
this.emitValueHandler(true);
|
|
31052
31138
|
}
|
|
31053
31139
|
setValidity() {
|
|
@@ -31065,7 +31151,7 @@ const RadioInput = class {
|
|
|
31065
31151
|
return null;
|
|
31066
31152
|
}
|
|
31067
31153
|
render() {
|
|
31068
|
-
return index.h("fieldset", { class:
|
|
31154
|
+
return index.h("fieldset", { class: `radio__fieldset ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("legend", { class: 'radio__legend' }, this.displayName, ":"), this.optionsGroup.map(option => index.h("div", { class: 'radio__wrapper' }, index.h("input", { type: "radio", class: 'radio__input', id: `${option.label}__input`, ref: (el) => this.inputReference = el, value: option.value, name: this.name, required: this.validation.mandatory, onClick: (e) => this.handleClick(e) }), index.h("label", { htmlFor: `${option.label}__input` }, option.label))), index.h("small", { class: 'radio__error-message' }, this.errorMessage), this.tooltip &&
|
|
31069
31155
|
index.h("img", { class: 'radio__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip());
|
|
31070
31156
|
}
|
|
31071
31157
|
static get watchers() { return {
|
|
@@ -35421,6 +35507,14 @@ const SelectInput = class {
|
|
|
35421
35507
|
this.clientStyling = '';
|
|
35422
35508
|
this.limitStylingAppends = false;
|
|
35423
35509
|
this.showTooltip = false;
|
|
35510
|
+
this.touched = false;
|
|
35511
|
+
this.handleChange = (event) => {
|
|
35512
|
+
this.touched = true;
|
|
35513
|
+
this.value = event.target.value;
|
|
35514
|
+
this.isValid = this.setValidity();
|
|
35515
|
+
this.errorMessage = this.setErrorMessage();
|
|
35516
|
+
this.emitValueHandler(true);
|
|
35517
|
+
};
|
|
35424
35518
|
this.setClientStyling = () => {
|
|
35425
35519
|
let sheet = document.createElement('style');
|
|
35426
35520
|
sheet.innerHTML = this.clientStyling;
|
|
@@ -35475,6 +35569,7 @@ const SelectInput = class {
|
|
|
35475
35569
|
}
|
|
35476
35570
|
componentDidLoad() {
|
|
35477
35571
|
this.inputReference = this.element.shadowRoot.querySelector('input');
|
|
35572
|
+
this.isValid = this.setValidity();
|
|
35478
35573
|
if (this.defaultValue) {
|
|
35479
35574
|
this.value = this.defaultValue;
|
|
35480
35575
|
this.valueHandler({ name: this.name, value: this.value });
|
|
@@ -35494,13 +35589,6 @@ const SelectInput = class {
|
|
|
35494
35589
|
});
|
|
35495
35590
|
});
|
|
35496
35591
|
}
|
|
35497
|
-
handleChange(event) {
|
|
35498
|
-
this.value = event.target.value;
|
|
35499
|
-
this.errorMessage = this.setErrorMessage();
|
|
35500
|
-
this.isValid = this.setValidity();
|
|
35501
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
35502
|
-
this.emitValueHandler(true);
|
|
35503
|
-
}
|
|
35504
35592
|
setValidity() {
|
|
35505
35593
|
return this.inputReference.validity.valid;
|
|
35506
35594
|
}
|
|
@@ -35516,9 +35604,12 @@ const SelectInput = class {
|
|
|
35516
35604
|
return null;
|
|
35517
35605
|
}
|
|
35518
35606
|
render() {
|
|
35519
|
-
|
|
35520
|
-
|
|
35521
|
-
|
|
35607
|
+
let invalidClass;
|
|
35608
|
+
if (this.touched) {
|
|
35609
|
+
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
35610
|
+
}
|
|
35611
|
+
return index.h("div", { class: `select__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("div", { class: 'select__wrapper--flex' }, index.h("label", { class: 'select__label', htmlFor: `${this.name}__input` }, `${this.displayName} ${this.validation.mandatory ? '*' : ''}`), index.h("div", { class: 'select__wrapper--relative' }, this.tooltip &&
|
|
35612
|
+
index.h("img", { class: 'select__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), index.h("vaadin-combo-box", { name: this.name, id: `${this.name}__input`, class: `select__input ${invalidClass}`, "item-label-path": "label", "item-value-path": "value", readOnly: this.autofilled, required: this.validation.mandatory, value: this.defaultValue, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, items: this.displayedOptions, onChange: this.handleChange }), index.h("small", { class: 'select__error-message' }, this.errorMessage));
|
|
35522
35613
|
}
|
|
35523
35614
|
get element() { return index.getElement(this); }
|
|
35524
35615
|
static get watchers() { return {
|
|
@@ -35542,6 +35633,25 @@ const TelInput = class {
|
|
|
35542
35633
|
this.limitStylingAppends = false;
|
|
35543
35634
|
this.showTooltip = false;
|
|
35544
35635
|
this.validationPattern = '';
|
|
35636
|
+
this.touched = false;
|
|
35637
|
+
this.handleInput = (event) => {
|
|
35638
|
+
this.phoneValue = event.target.value;
|
|
35639
|
+
this.value = { prefix: this.prefixValue, phone: this.phoneValue };
|
|
35640
|
+
this.touched = true;
|
|
35641
|
+
if (this.debounceTime) {
|
|
35642
|
+
clearTimeout(this.debounceTime);
|
|
35643
|
+
}
|
|
35644
|
+
this.debounceTime = setTimeout(() => {
|
|
35645
|
+
this.isValid = this.setValidity();
|
|
35646
|
+
this.errorMessage = this.setErrorMessage();
|
|
35647
|
+
this.emitValueHandler(true);
|
|
35648
|
+
}, 500);
|
|
35649
|
+
};
|
|
35650
|
+
this.handleBlur = () => {
|
|
35651
|
+
this.isValid = this.setValidity();
|
|
35652
|
+
this.touched = true;
|
|
35653
|
+
this.errorMessage = this.setErrorMessage();
|
|
35654
|
+
};
|
|
35545
35655
|
this.setClientStyling = () => {
|
|
35546
35656
|
let sheet = document.createElement('style');
|
|
35547
35657
|
sheet.innerHTML = this.clientStyling;
|
|
@@ -35551,7 +35661,7 @@ const TelInput = class {
|
|
|
35551
35661
|
validityChanged() {
|
|
35552
35662
|
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
35553
35663
|
if (this.emitValue == true) {
|
|
35554
|
-
this.valueHandler({ name: this.name, value: this.value });
|
|
35664
|
+
this.valueHandler({ name: this.name, value: this.value, type: 'tel' });
|
|
35555
35665
|
}
|
|
35556
35666
|
}
|
|
35557
35667
|
validityStateHandler(inputStateEvent) {
|
|
@@ -35559,7 +35669,7 @@ const TelInput = class {
|
|
|
35559
35669
|
}
|
|
35560
35670
|
emitValueHandler(newValue) {
|
|
35561
35671
|
if (newValue == true && this.isValid) {
|
|
35562
|
-
this.valueHandler({ name: this.name, value: this.value });
|
|
35672
|
+
this.valueHandler({ name: this.name, value: this.value, type: 'tel' });
|
|
35563
35673
|
}
|
|
35564
35674
|
}
|
|
35565
35675
|
valueHandler(inputValueEvent) {
|
|
@@ -35574,14 +35684,15 @@ const TelInput = class {
|
|
|
35574
35684
|
connectedCallback() {
|
|
35575
35685
|
this.validationPattern = this.setPattern();
|
|
35576
35686
|
if (this.defaultValue) {
|
|
35577
|
-
this.prefixValue = this.defaultValue.
|
|
35578
|
-
this.phoneValue = this.defaultValue.
|
|
35687
|
+
this.prefixValue = this.defaultValue.prefix ? this.defaultValue.prefix : this.defaultValue;
|
|
35688
|
+
this.phoneValue = this.defaultValue.phone || null;
|
|
35579
35689
|
}
|
|
35580
35690
|
}
|
|
35581
35691
|
componentWillLoad() {
|
|
35582
35692
|
if (this.action) {
|
|
35583
35693
|
if (this.action.split(" ")[0] == 'GET') {
|
|
35584
|
-
|
|
35694
|
+
const endpoint = this.action.split(" ")[1];
|
|
35695
|
+
return this.getPhoneCodes(endpoint).then((options) => {
|
|
35585
35696
|
this.phoneCodesOptions = options.phoneCodes.map(code => {
|
|
35586
35697
|
return { label: code.Prefix, value: code.Prefix };
|
|
35587
35698
|
});
|
|
@@ -35597,14 +35708,16 @@ const TelInput = class {
|
|
|
35597
35708
|
this.limitStylingAppends = true;
|
|
35598
35709
|
}
|
|
35599
35710
|
// end custom styling area
|
|
35711
|
+
}
|
|
35712
|
+
componentDidLoad() {
|
|
35713
|
+
this.isValid = this.setValidity();
|
|
35600
35714
|
if (this.defaultValue) {
|
|
35601
|
-
this.value =
|
|
35715
|
+
this.value = this.defaultValue;
|
|
35602
35716
|
this.valueHandler({ name: this.name, value: this.value });
|
|
35603
35717
|
}
|
|
35604
35718
|
}
|
|
35605
|
-
getPhoneCodes() {
|
|
35606
|
-
|
|
35607
|
-
const url = new URL("https://demo-api.stage.norway.everymatrix.com/v1/player/phonecodes");
|
|
35719
|
+
getPhoneCodes(endpoint) {
|
|
35720
|
+
const url = new URL(endpoint);
|
|
35608
35721
|
return new Promise((resolve, reject) => {
|
|
35609
35722
|
fetch(url.href)
|
|
35610
35723
|
.then((res) => res.json())
|
|
@@ -35616,17 +35729,9 @@ const TelInput = class {
|
|
|
35616
35729
|
});
|
|
35617
35730
|
});
|
|
35618
35731
|
}
|
|
35619
|
-
handleInput(event) {
|
|
35620
|
-
this.phoneValue = event.target.value;
|
|
35621
|
-
this.value = `${this.prefixValue}|${this.phoneValue}`;
|
|
35622
|
-
this.errorMessage = this.setErrorMessage();
|
|
35623
|
-
this.isValid = this.setValidity();
|
|
35624
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
35625
|
-
this.emitValueHandler(true);
|
|
35626
|
-
}
|
|
35627
35732
|
handlePrefixInput(event) {
|
|
35628
35733
|
this.prefixValue = event.target.value;
|
|
35629
|
-
this.value =
|
|
35734
|
+
this.value = { prefix: this.prefixValue, phone: this.phoneValue };
|
|
35630
35735
|
this.emitValueHandler(true);
|
|
35631
35736
|
}
|
|
35632
35737
|
setValidity() {
|
|
@@ -35657,9 +35762,12 @@ const TelInput = class {
|
|
|
35657
35762
|
return null;
|
|
35658
35763
|
}
|
|
35659
35764
|
render() {
|
|
35660
|
-
|
|
35661
|
-
|
|
35662
|
-
|
|
35765
|
+
let invalidClass;
|
|
35766
|
+
if (this.touched) {
|
|
35767
|
+
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
35768
|
+
}
|
|
35769
|
+
return index.h("div", { class: `tel__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("div", { class: 'tel__wrapper--flex-label' }, index.h("label", { class: `tel__label ${this.validation.mandatory ? 'tel__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("div", { class: 'tel__wrapper--relative' }, this.tooltip &&
|
|
35770
|
+
index.h("img", { class: 'tel__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), index.h("div", { class: `tel__wrapper--flex ${invalidClass}` }, index.h("vaadin-combo-box", { class: 'tel__prefix', items: this.phoneCodesOptions, value: this.prefixValue, readOnly: this.autofilled, onChange: (e) => this.handlePrefixInput(e) }), index.h("input", { type: "tel", ref: (el) => this.inputReference = el, id: `${this.name}__input`, readOnly: this.autofilled, class: `tel__input`, value: this.phoneValue, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, pattern: this.validationPattern, onInput: this.handleInput, onBlur: this.handleBlur })), index.h("small", { class: 'tel__error-message' }, this.errorMessage));
|
|
35663
35771
|
}
|
|
35664
35772
|
static get watchers() { return {
|
|
35665
35773
|
"isValid": ["validityChanged"],
|
|
@@ -35690,6 +35798,26 @@ const TextInput = class {
|
|
|
35690
35798
|
this.validationPattern = '';
|
|
35691
35799
|
this.duplicateInputValue = null;
|
|
35692
35800
|
this.touched = false;
|
|
35801
|
+
this.handleInput = (event) => {
|
|
35802
|
+
this.value = event.target.value;
|
|
35803
|
+
this.touched = true;
|
|
35804
|
+
if (this.debounceTime) {
|
|
35805
|
+
clearTimeout(this.debounceTime);
|
|
35806
|
+
}
|
|
35807
|
+
this.debounceTime = setTimeout(() => {
|
|
35808
|
+
this.isValid = this.setValidity();
|
|
35809
|
+
this.errorMessage = this.setErrorMessage();
|
|
35810
|
+
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
35811
|
+
this.emitValueHandler(true);
|
|
35812
|
+
}, 500);
|
|
35813
|
+
};
|
|
35814
|
+
this.handleBlur = (event) => {
|
|
35815
|
+
this.value = event.target.value;
|
|
35816
|
+
this.touched = true;
|
|
35817
|
+
this.isValid = this.setValidity();
|
|
35818
|
+
this.errorMessage = this.setErrorMessage();
|
|
35819
|
+
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
35820
|
+
};
|
|
35693
35821
|
this.setClientStyling = () => {
|
|
35694
35822
|
let sheet = document.createElement('style');
|
|
35695
35823
|
sheet.innerHTML = this.clientStyling;
|
|
@@ -35697,6 +35825,7 @@ const TextInput = class {
|
|
|
35697
35825
|
};
|
|
35698
35826
|
}
|
|
35699
35827
|
validityChanged() {
|
|
35828
|
+
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
35700
35829
|
if (this.emitValue == true) {
|
|
35701
35830
|
this.valueHandler({ name: this.name, value: this.value });
|
|
35702
35831
|
}
|
|
@@ -35719,12 +35848,16 @@ const TextInput = class {
|
|
|
35719
35848
|
this.showTooltip = false;
|
|
35720
35849
|
}
|
|
35721
35850
|
valueChangedHandler(event) {
|
|
35722
|
-
if (this.isDuplicateInput) {
|
|
35723
|
-
|
|
35724
|
-
|
|
35851
|
+
if (this.isDuplicateInput && this.name === event.detail.name + 'Duplicate') {
|
|
35852
|
+
this.duplicateInputValue = event.detail.value;
|
|
35853
|
+
if (this.touched) {
|
|
35854
|
+
this.isValid = this.setValidity();
|
|
35855
|
+
this.errorMessage = this.setErrorMessage();
|
|
35725
35856
|
}
|
|
35726
35857
|
}
|
|
35727
|
-
if (this.name === event.detail.name + 'Duplicate'
|
|
35858
|
+
if (this.name === event.detail.name + 'Duplicate'
|
|
35859
|
+
&& this.name.replace('Duplicate', '') === event.detail.name
|
|
35860
|
+
&& this.touched === true) {
|
|
35728
35861
|
this.isValid = this.setValidity();
|
|
35729
35862
|
this.errorMessage = this.setErrorMessage();
|
|
35730
35863
|
}
|
|
@@ -35740,25 +35873,24 @@ const TextInput = class {
|
|
|
35740
35873
|
this.limitStylingAppends = true;
|
|
35741
35874
|
}
|
|
35742
35875
|
// end custom styling area
|
|
35876
|
+
}
|
|
35877
|
+
componentDidLoad() {
|
|
35878
|
+
this.isValid = this.setValidity();
|
|
35743
35879
|
if (this.defaultValue) {
|
|
35744
35880
|
this.value = this.defaultValue;
|
|
35745
35881
|
this.valueHandler({ name: this.name, value: this.value });
|
|
35882
|
+
if (this.isDuplicateInput) {
|
|
35883
|
+
this.touched = true;
|
|
35884
|
+
}
|
|
35746
35885
|
}
|
|
35747
35886
|
}
|
|
35748
|
-
handleInput(event) {
|
|
35749
|
-
this.value = event.target.value;
|
|
35750
|
-
this.isValid = this.setValidity();
|
|
35751
|
-
this.errorMessage = this.setErrorMessage();
|
|
35752
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
35753
|
-
this.emitValueHandler(true);
|
|
35754
|
-
this.touched = true;
|
|
35755
|
-
}
|
|
35756
35887
|
setValidity() {
|
|
35888
|
+
var _a;
|
|
35757
35889
|
if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
|
|
35758
35890
|
return false;
|
|
35759
35891
|
}
|
|
35760
35892
|
else {
|
|
35761
|
-
return this.inputReference.validity.valid;
|
|
35893
|
+
return (_a = this.inputReference) === null || _a === void 0 ? void 0 : _a.validity.valid;
|
|
35762
35894
|
}
|
|
35763
35895
|
}
|
|
35764
35896
|
setPattern() {
|
|
@@ -35789,9 +35921,12 @@ const TextInput = class {
|
|
|
35789
35921
|
return null;
|
|
35790
35922
|
}
|
|
35791
35923
|
render() {
|
|
35792
|
-
|
|
35793
|
-
|
|
35794
|
-
|
|
35924
|
+
let invalidClass;
|
|
35925
|
+
if (this.touched) {
|
|
35926
|
+
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
35927
|
+
}
|
|
35928
|
+
return index.h("div", { class: `text__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("div", { class: 'text__wrapper--flex' }, index.h("label", { class: `text__label ${this.validation.mandatory ? 'text__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("div", { class: 'text__wrapper--relative' }, this.tooltip &&
|
|
35929
|
+
index.h("img", { class: 'text__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), index.h("input", { name: this.name, id: `${this.name}__input`, value: this.defaultValue, type: 'text', class: `text__input ${invalidClass}`, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, ref: (el) => this.inputReference = el, readOnly: this.autofilled, pattern: this.validationPattern, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, onInput: this.handleInput, onBlur: this.handleBlur }), index.h("small", { class: 'text__error-message' }, this.errorMessage));
|
|
35795
35930
|
}
|
|
35796
35931
|
static get watchers() { return {
|
|
35797
35932
|
"isValid": ["validityChanged"],
|