@everymatrix/general-registration 1.10.23 → 1.10.24
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 → checkbox-group-input_13.cjs.entry.js} +168 -40
- package/dist/cjs/general-registration.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/general-registration/general-registration.css +11 -23
- package/dist/collection/components/general-registration/general-registration.js +63 -29
- package/dist/components/checkbox-group-input2.js +2 -2
- package/dist/components/checkbox-input2.js +2 -2
- package/dist/components/date-input2.js +1 -1
- package/dist/components/email-input2.js +1 -1
- package/dist/components/general-input2.js +218 -22
- package/dist/components/general-registration.js +90 -51
- package/dist/components/number-input2.js +1 -1
- package/dist/components/password-input2.js +1 -1
- package/dist/components/select-input2.js +1 -1
- package/dist/components/tel-input2.js +2 -2
- package/dist/components/text-input2.js +1 -1
- package/dist/components/toggle-checkbox-input.js +6 -0
- package/dist/esm/{checkbox-group-input_12.entry.js → checkbox-group-input_13.entry.js} +168 -41
- 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-482c4c1e.entry.js → p-7852ad99.entry.js} +96 -96
- package/dist/types/components/general-registration/general-registration.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, h, Listen, Prop, State, Watch, Event } from '@stencil/core';
|
|
1
|
+
import { Component, h, Listen, Prop, State, Watch, Event, Element } from '@stencil/core';
|
|
2
2
|
import { getTranslations, translate, TRANSLATIONS } from '../../utils/locale.utils';
|
|
3
3
|
import '@everymatrix/general-input';
|
|
4
4
|
export class GeneralRegistration {
|
|
@@ -21,6 +21,7 @@ export class GeneralRegistration {
|
|
|
21
21
|
this.translationUrl = '';
|
|
22
22
|
this.isLoading = true;
|
|
23
23
|
this.forms = [];
|
|
24
|
+
this.limitStylingAppends = false;
|
|
24
25
|
this.listOfInputValues = [];
|
|
25
26
|
this.listOfInputValidity = [];
|
|
26
27
|
this.listOfActions = [];
|
|
@@ -33,7 +34,7 @@ export class GeneralRegistration {
|
|
|
33
34
|
this.setClientStyling = () => {
|
|
34
35
|
let sheet = document.createElement('style');
|
|
35
36
|
sheet.innerHTML = this.clientStyling;
|
|
36
|
-
this.
|
|
37
|
+
this.host.shadowRoot.prepend(sheet);
|
|
37
38
|
};
|
|
38
39
|
this.setClientStylingURL = () => {
|
|
39
40
|
let url = new URL(this.clientStylingUrl);
|
|
@@ -43,7 +44,7 @@ export class GeneralRegistration {
|
|
|
43
44
|
.then((data) => {
|
|
44
45
|
cssFile.innerHTML = data;
|
|
45
46
|
this.clientStyling = data;
|
|
46
|
-
setTimeout(() => { this.
|
|
47
|
+
setTimeout(() => { this.host.shadowRoot.prepend(cssFile); }, 1);
|
|
47
48
|
});
|
|
48
49
|
};
|
|
49
50
|
}
|
|
@@ -100,18 +101,17 @@ export class GeneralRegistration {
|
|
|
100
101
|
}
|
|
101
102
|
});
|
|
102
103
|
}
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
componentDidLoad() {
|
|
105
|
+
this.registrationWidgetLoaded.emit();
|
|
106
|
+
window.postMessage({ type: 'registrationWidgetLoaded' }, window.location.href);
|
|
107
|
+
if (!this.limitStylingAppends && this.host) {
|
|
105
108
|
if (this.clientStyling)
|
|
106
109
|
this.setClientStyling();
|
|
107
110
|
if (this.clientStylingUrl)
|
|
108
111
|
this.setClientStylingURL();
|
|
112
|
+
this.limitStylingAppends = true;
|
|
109
113
|
}
|
|
110
114
|
}
|
|
111
|
-
componentDidLoad() {
|
|
112
|
-
this.registrationWidgetLoaded.emit();
|
|
113
|
-
window.postMessage({ type: 'registrationWidgetLoaded' }, window.location.href);
|
|
114
|
-
}
|
|
115
115
|
nextHandler(e) {
|
|
116
116
|
e.preventDefault();
|
|
117
117
|
// Trigger events in subwidgets.
|
|
@@ -325,22 +325,51 @@ export class GeneralRegistration {
|
|
|
325
325
|
return [inputElement];
|
|
326
326
|
}
|
|
327
327
|
});
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
328
|
+
this.listOfInputValidity = this.listOfInputs.reduce((acc, field) => {
|
|
329
|
+
var _a;
|
|
330
|
+
// If the field is a togglecheckbox, add its subfields
|
|
331
|
+
if (((_a = field.inputType) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "togglecheckbox") {
|
|
332
|
+
field.data.subFields.forEach(subfield => {
|
|
333
|
+
acc.push({
|
|
334
|
+
name: subfield.name,
|
|
335
|
+
isValid: this.setInitialValidStatus(subfield)
|
|
336
|
+
});
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
acc.push({
|
|
341
|
+
name: field.name,
|
|
342
|
+
isValid: this.setInitialValidStatus(field)
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
return acc;
|
|
346
|
+
}, []);
|
|
347
|
+
this.listOfInputValues = this.listOfInputs.reduce((acc, field) => {
|
|
348
|
+
var _a, _b, _c;
|
|
349
|
+
// If the field type is a 'togglecheckbox', add its subfields
|
|
350
|
+
if (((_a = field.inputType) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "togglecheckbox") {
|
|
351
|
+
field.data.subFields.forEach(subfield => {
|
|
352
|
+
var _a, _b;
|
|
353
|
+
acc.push({
|
|
354
|
+
name: subfield.name,
|
|
355
|
+
value: ((_a = subfield.inputType) === null || _a === void 0 ? void 0 : _a.toLowerCase()) == 'checkbox' ? 'false' : null,
|
|
356
|
+
isDuplicate: subfield.isDuplicateInput || false,
|
|
357
|
+
type: ((_b = field.inputType) === null || _b === void 0 ? void 0 : _b.toLowerCase()) == 'togglecheckbox'
|
|
358
|
+
? 'togglecheckbox'
|
|
359
|
+
: null
|
|
360
|
+
});
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
acc.push({
|
|
365
|
+
name: field.name,
|
|
366
|
+
value: ((_b = field.inputType) === null || _b === void 0 ? void 0 : _b.toLowerCase()) == 'checkbox' ? 'false' : null,
|
|
367
|
+
isDuplicate: field.isDuplicateInput || false,
|
|
368
|
+
type: ((_c = field.inputType) === null || _c === void 0 ? void 0 : _c.toLowerCase()) == 'checkboxgroup' ? 'checkboxgroup' : null
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
return acc;
|
|
372
|
+
}, []);
|
|
344
373
|
// Set the list of actions
|
|
345
374
|
this.listOfActions = config.content.actions.map(action => action);
|
|
346
375
|
this.registrationID = config.content.registrationID;
|
|
@@ -349,7 +378,6 @@ export class GeneralRegistration {
|
|
|
349
378
|
this.lastStep = this.registrationStep;
|
|
350
379
|
}
|
|
351
380
|
;
|
|
352
|
-
// this.forms.push({ [this.registrationStep] : this.listOfInputs});
|
|
353
381
|
this.forms = [...this.forms, { [this.registrationStep]: this.listOfInputs }];
|
|
354
382
|
// Add the step to the registrationStepsData
|
|
355
383
|
this.registrationStepsState.regId = this.registrationID;
|
|
@@ -389,7 +417,11 @@ export class GeneralRegistration {
|
|
|
389
417
|
renderForm() {
|
|
390
418
|
return this.forms.map((form, index) => {
|
|
391
419
|
return h("form", { action: '.', id: `RegistrationForm${this.registrationStep}`, class: `registration__form ${this.registrationStep !== `Step${index + 1}` ? 'hidden' : ''}`, ref: el => this.form = el },
|
|
392
|
-
form[this.registrationStep] && form[this.registrationStep].map(input => h("general-input", { type: input.inputType, name: input.name, displayName: input.displayName, validation: input.validate, action: input.action || null, options: input.data
|
|
420
|
+
form[this.registrationStep] && form[this.registrationStep].map(input => h("general-input", { type: input.inputType, name: input.name, displayName: input.displayName, validation: input.validate, action: input.action || null, options: input.data
|
|
421
|
+
? (input.inputType.toLowerCase() == 'checkboxgroup' || input.inputType.toLowerCase() == 'togglecheckbox')
|
|
422
|
+
? input.data.subFields
|
|
423
|
+
: input.data.values
|
|
424
|
+
: [], 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 })),
|
|
393
425
|
this.buttonInsideForm && this.renderButtons());
|
|
394
426
|
});
|
|
395
427
|
}
|
|
@@ -403,7 +435,7 @@ export class GeneralRegistration {
|
|
|
403
435
|
if (this.isLoading) {
|
|
404
436
|
return h("p", null, "Please wait, loading ...");
|
|
405
437
|
}
|
|
406
|
-
return (h("div", { class: `registration registration__${this.registrationStep}
|
|
438
|
+
return (h("div", { class: `registration registration__${this.registrationStep}` },
|
|
407
439
|
this.renderForm(),
|
|
408
440
|
h("p", { class: 'registration__error-message' }, this.errorMessage),
|
|
409
441
|
!this.buttonInsideForm && this.renderButtons()));
|
|
@@ -546,7 +578,8 @@ export class GeneralRegistration {
|
|
|
546
578
|
"isFormValid": {},
|
|
547
579
|
"isLoading": {},
|
|
548
580
|
"registrationStep": {},
|
|
549
|
-
"forms": {}
|
|
581
|
+
"forms": {},
|
|
582
|
+
"limitStylingAppends": {}
|
|
550
583
|
}; }
|
|
551
584
|
static get events() { return [{
|
|
552
585
|
"method": "registrationWidgetLoaded",
|
|
@@ -579,6 +612,7 @@ export class GeneralRegistration {
|
|
|
579
612
|
"references": {}
|
|
580
613
|
}
|
|
581
614
|
}]; }
|
|
615
|
+
static get elementRef() { return "host"; }
|
|
582
616
|
static get watchers() { return [{
|
|
583
617
|
"propName": "registrationStep",
|
|
584
618
|
"methodName": "sendStep"
|
|
@@ -1079,10 +1079,10 @@ const CheckboxGroupInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
1079
1079
|
: [];
|
|
1080
1080
|
}
|
|
1081
1081
|
render() {
|
|
1082
|
-
return h("div", { class: `checkboxgroup__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, h("div", { class: 'checkboxgroup__wrapper--flex' }, 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 &&
|
|
1082
|
+
return h("div", { class: `checkboxgroup__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, h("div", { class: 'checkboxgroup__wrapper--flex' }, h("vaadin-checkbox", { class: 'checkbox__input', 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 &&
|
|
1083
1083
|
h("img", { class: 'checkboxgroup__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip()), h("small", { class: 'checkboxgroup__error-message' }, this.errorMessage), h("vaadin-checkbox-group", { theme: "vertical", value: this.selectedValues, "on-value-changed": (event) => {
|
|
1084
1084
|
this.selectedValues = event.detail.value;
|
|
1085
|
-
} }, this.options.map((checkbox) => h("vaadin-checkbox", { name: checkbox.name, value: checkbox.name, label: checkbox.displayName }))));
|
|
1085
|
+
} }, this.options.map((checkbox) => h("vaadin-checkbox", { class: 'checkbox__input', name: checkbox.name, value: checkbox.name, label: checkbox.displayName }))));
|
|
1086
1086
|
}
|
|
1087
1087
|
get element() { return this; }
|
|
1088
1088
|
static get watchers() { return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
import { t as translate, a as tooltipIconSvg } from './tooltipIcon.js';
|
|
3
3
|
|
|
4
|
-
const checkboxInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.checkbox{font-family:\"Roboto\";font-style:normal}.checkbox__wrapper{display:flex;gap:10px;position:relative;align-items:baseline}.checkbox__wrapper--flex{display:flex;gap:5px}.checkbox__wrapper--relative{position:relative}.checkbox__label{font-style:inherit;font-family:inherit;font-weight:400;font-size:16px;color:#2B2D3F;line-height:14px}.checkbox__label-text{font-size:16px}.checkbox__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000b3}.checkbox__tooltip-icon{width:16px;height:auto}.checkbox__tooltip{position:absolute;top:0;right:20px;background-color:#FFFFFF;border:1px solid #B0B0B0;color:#2B2D3F;padding:10px;border-radius:5px;opacity:0;transition:opacity 0.3s ease-in-out;z-index:10}.checkbox__tooltip.visible{opacity:1}";
|
|
4
|
+
const checkboxInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.checkbox{font-family:\"Roboto\";font-style:normal}.checkbox__wrapper{display:flex;gap:10px;position:relative;align-items:baseline}.checkbox__wrapper--flex{display:flex;gap:5px}.checkbox__wrapper--relative{position:relative}.checkbox__input{transform:scale(1.307, 1.307);margin-left:2px}.checkbox__label{font-style:inherit;font-family:inherit;font-weight:400;font-size:16px;color:#2B2D3F;line-height:14px}.checkbox__label-text{font-size:16px}.checkbox__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000b3}.checkbox__tooltip-icon{width:16px;height:auto}.checkbox__tooltip{position:absolute;top:0;right:20px;background-color:#FFFFFF;border:1px solid #B0B0B0;color:#2B2D3F;padding:10px;border-radius:5px;opacity:0;transition:opacity 0.3s ease-in-out;z-index:10}.checkbox__tooltip.visible{opacity:1}";
|
|
5
5
|
|
|
6
6
|
const CheckboxInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
7
|
constructor() {
|
|
@@ -89,7 +89,7 @@ const CheckboxInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
89
89
|
return null;
|
|
90
90
|
}
|
|
91
91
|
render() {
|
|
92
|
-
return h("div", { class: `checkbox__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, 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(), h("small", { class: 'checkbox__error-message' }, this.errorMessage), h("div", { class: 'checkbox__wrapper--relative' }, this.tooltip &&
|
|
92
|
+
return h("div", { class: `checkbox__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, h("input", { class: 'checkbox__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(), h("small", { class: 'checkbox__error-message' }, this.errorMessage), h("div", { class: 'checkbox__wrapper--relative' }, this.tooltip &&
|
|
93
93
|
h("img", { class: 'checkbox__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip()));
|
|
94
94
|
}
|
|
95
95
|
static get watchers() { return {
|
|
@@ -10099,7 +10099,7 @@ function cleanEscapedString(input) {
|
|
|
10099
10099
|
return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
|
|
10100
10100
|
}
|
|
10101
10101
|
|
|
10102
|
-
const dateInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.date{font-family:\"Roboto\";font-style:normal}.date__wrapper{position:relative;width:100%;padding-top:26px}.date__label{font-family:inherit;font-style:normal;font-weight:500;font-size:16px;line-height:20px;color:#
|
|
10102
|
+
const dateInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.date{font-family:\"Roboto\";font-style:normal}.date__wrapper{position:relative;width:100%;padding-top:26px}.date__label{font-family:inherit;font-style:normal;font-weight:500;font-size:16px;line-height:20px;color:#2A3841;position:absolute;top:0;left:0}.date__label--required::after{content:\"*\";font-family:inherit;color:#2A3841;margin-left:2px}.date__input{border:none;width:inherit;position:relative}.date__input[focused]::part(input-field){border-color:#3E3E3E}.date__input[invalid]::part(input-field){border-color:#cc0000b3}.date__input::part(input-field){border-radius:4px;background-color:#FFFFFF;border:2px solid #DEE1EE;color:#2A2E3F;border-radius:4px;background-color:transparent;font-family:inherit;font-style:normal;font-weight:300;font-size:16px;line-height:19px}.date__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000b3}.date__tooltip-icon{position:absolute;right:0;bottom:10px}.date__tooltip{position:absolute;bottom:35px;right:10px;background-color:#FFFFFF;border:1px solid #B0B0B0;color:#2B2D3F;padding:10px;border-radius:5px;opacity:0;transition:opacity 0.3s ease-in-out;z-index:10}.date__tooltip.visible{opacity:1}";
|
|
10103
10103
|
|
|
10104
10104
|
const DateInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
10105
10105
|
constructor() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
import { t as translate, a as tooltipIconSvg } from './tooltipIcon.js';
|
|
3
3
|
|
|
4
|
-
const emailInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.email{font-family:\"Roboto\";font-style:normal}.email__wrapper{position:relative;width:100%}.email__wrapper--flex{display:flex;gap:5px}.email__wrapper--relative{position:relative}.email__label{font-family:inherit;font-style:normal;font-weight:500;font-size:16px;line-height:20px;color:#
|
|
4
|
+
const emailInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.email{font-family:\"Roboto\";font-style:normal}.email__wrapper{position:relative;width:100%}.email__wrapper--flex{display:flex;gap:5px}.email__wrapper--relative{position:relative}.email__label{font-family:inherit;font-style:normal;font-weight:500;font-size:16px;line-height:20px;color:#2A3841}.email__label--required::after{content:\"*\";font-family:inherit;color:#2A3841;margin-left:2px}.email__input{border-radius:4px;background-color:transparent;font-family:inherit;font-style:normal;font-weight:300;font-size:16px;line-height:19px;color:#2A2E3F;padding:10px 20px;width:inherit;position:relative;border:2px solid #DEE1EE}.email__input:focus{outline-color:#3E3E3E}.email__input--invalid{border:2px solid #cc0000b3}.email__input::placeholder{color:#979797}.email__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000b3}.email__tooltip-icon{width:16px;height:auto}.email__tooltip{position:absolute;top:0;left:20px;background-color:#FFFFFF;border:1px solid #B0B0B0;color:#2B2D3F;padding:10px;border-radius:5px;opacity:0;transition:opacity 0.3s ease-in-out;z-index:10}.email__tooltip.visible{opacity:1}";
|
|
5
5
|
|
|
6
6
|
const EmailInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
7
|
constructor() {
|
|
@@ -1,14 +1,198 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
-
import { d as defineCustomElement$
|
|
3
|
-
import { d as defineCustomElement$
|
|
4
|
-
import { d as defineCustomElement$
|
|
5
|
-
import { d as defineCustomElement$
|
|
6
|
-
import { d as defineCustomElement$
|
|
7
|
-
import { d as defineCustomElement$
|
|
8
|
-
import { d as defineCustomElement$
|
|
9
|
-
import { d as defineCustomElement$
|
|
10
|
-
import { d as defineCustomElement$
|
|
11
|
-
import { d as defineCustomElement$
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { d as defineCustomElement$b } from './checkbox-group-input2.js';
|
|
3
|
+
import { d as defineCustomElement$a } from './checkbox-input2.js';
|
|
4
|
+
import { d as defineCustomElement$9 } from './date-input2.js';
|
|
5
|
+
import { d as defineCustomElement$8 } from './email-input2.js';
|
|
6
|
+
import { d as defineCustomElement$7 } from './number-input2.js';
|
|
7
|
+
import { d as defineCustomElement$6 } from './password-input2.js';
|
|
8
|
+
import { d as defineCustomElement$5 } from './radio-input2.js';
|
|
9
|
+
import { d as defineCustomElement$4 } from './select-input2.js';
|
|
10
|
+
import { d as defineCustomElement$3 } from './tel-input2.js';
|
|
11
|
+
import { d as defineCustomElement$2 } from './text-input2.js';
|
|
12
|
+
import { t as translate, a as tooltipIconSvg } from './tooltipIcon.js';
|
|
13
|
+
|
|
14
|
+
const toggleCheckboxInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.togglecheckbox{font-family:\"Roboto\";font-style:normal;font-size:15px}.togglecheckbox__wrapper{position:relative}.togglecheckbox__wrapper--flex{display:flex;gap:5px;align-content:flex-start}.togglecheckbox__wrapper--relative{position:relative;display:inline}.togglecheckbox__input{transform:scale(1.307, 1.307);margin-left:2px}.togglecheckbox__label{font-style:inherit;font-family:inherit;font-weight:400;font-size:16px;color:#2B2D3F;line-height:14px}.togglecheckbox__label-text{font-size:16px}.togglecheckbox__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000b3}.togglecheckbox__tooltip-icon{width:16px;height:auto}.togglecheckbox__tooltip{position:absolute;top:0;right:0;background-color:#FFFFFF;border:1px solid #B0B0B0;color:#2B2D3F;padding:10px;border-radius:5px;opacity:0;transition:opacity 0.3s ease-in-out;z-index:10}.togglecheckbox__tooltip.visible{opacity:1}.togglecheckbox__fields-wrapper{margin-top:40px;display:flex;flex-direction:column;gap:40px}.hidden{display:none}";
|
|
15
|
+
|
|
16
|
+
const ToggleCheckboxInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
19
|
+
this.__registerHost();
|
|
20
|
+
this.__attachShadow();
|
|
21
|
+
this.sendValidityState = createEvent(this, "sendValidityState", 7);
|
|
22
|
+
this.sendInputValue = createEvent(this, "sendInputValue", 7);
|
|
23
|
+
/**
|
|
24
|
+
* Default value for the input.
|
|
25
|
+
*/
|
|
26
|
+
this.defaultValue = '';
|
|
27
|
+
/**
|
|
28
|
+
* Options of the input.
|
|
29
|
+
*/
|
|
30
|
+
this.options = [];
|
|
31
|
+
/**
|
|
32
|
+
* Client custom styling via inline style
|
|
33
|
+
*/
|
|
34
|
+
this.clientStyling = '';
|
|
35
|
+
this.limitStylingAppends = false;
|
|
36
|
+
this.showTooltip = false;
|
|
37
|
+
this.value = '';
|
|
38
|
+
this.setClientStyling = () => {
|
|
39
|
+
let sheet = document.createElement('style');
|
|
40
|
+
sheet.innerHTML = this.clientStyling;
|
|
41
|
+
this.stylingContainer.prepend(sheet);
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
validityChanged() {
|
|
45
|
+
}
|
|
46
|
+
validityStateHandler(inputStateEvent) {
|
|
47
|
+
this.sendValidityState.emit(inputStateEvent);
|
|
48
|
+
}
|
|
49
|
+
emitValueHandler(newValue) {
|
|
50
|
+
}
|
|
51
|
+
valueHandler(inputValueEvent) {
|
|
52
|
+
this.sendInputValue.emit(inputValueEvent);
|
|
53
|
+
}
|
|
54
|
+
handleClickOutside(event) {
|
|
55
|
+
if (event.composedPath()[0] === this.tooltipIconReference)
|
|
56
|
+
return;
|
|
57
|
+
if (event.composedPath()[0] !== this.tooltipReference)
|
|
58
|
+
this.showTooltip = false;
|
|
59
|
+
}
|
|
60
|
+
connectedCallback() {
|
|
61
|
+
}
|
|
62
|
+
componentDidRender() {
|
|
63
|
+
// start custom styling area
|
|
64
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
65
|
+
if (this.clientStyling)
|
|
66
|
+
this.setClientStyling();
|
|
67
|
+
this.limitStylingAppends = true;
|
|
68
|
+
}
|
|
69
|
+
// end custom styling area
|
|
70
|
+
}
|
|
71
|
+
componentDidLoad() {
|
|
72
|
+
}
|
|
73
|
+
handleClick() {
|
|
74
|
+
this.showFields = this.checkboxReference.checked;
|
|
75
|
+
this.errorMessage = this.setErrorMessage();
|
|
76
|
+
this.isValid = this.setValidity();
|
|
77
|
+
}
|
|
78
|
+
setValidity() {
|
|
79
|
+
return this.checkboxReference.validity.valid;
|
|
80
|
+
}
|
|
81
|
+
setErrorMessage() {
|
|
82
|
+
if (this.checkboxReference.validity.valueMissing) {
|
|
83
|
+
return translate('requiredError', this.language);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
renderLabel() {
|
|
87
|
+
return (h("label", { class: 'togglecheckbox__label', htmlFor: `${this.name}__input` }, h("div", { class: 'togglecheckbox__label-text', innerHTML: `${this.displayName} ${this.validation.mandatory ? '*' : ''}` })));
|
|
88
|
+
}
|
|
89
|
+
renderTooltip() {
|
|
90
|
+
if (this.showTooltip) {
|
|
91
|
+
return (h("div", { class: `togglecheckbox__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
render() {
|
|
96
|
+
return h("div", { class: `togglecheckbox__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, h("div", { class: 'togglecheckbox__wrapper--flex' }, h("input", { class: 'togglecheckbox__input', type: "checkbox", id: `${this.name}__input`, ref: (el) => this.checkboxReference = el, name: this.name, checked: this.defaultValue === "true", readOnly: this.autofilled, required: this.validation.mandatory, value: this.value, onClick: () => this.handleClick() }), this.renderLabel()), h("small", { class: 'togglecheckbox__error-message' }, this.errorMessage), h("div", { class: 'togglecheckbox__wrapper--relative' }, this.tooltip &&
|
|
97
|
+
h("img", { class: 'togglecheckbox__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip()), h("div", { class: `togglecheckbox__fields-wrapper ${this.showFields ? '' : 'hidden'}` }, this.options.map(subfield => {
|
|
98
|
+
return h("general-input", { type: subfield.inputType, name: subfield.name, displayName: subfield.displayName, validation: subfield.validate, action: subfield.action || null, defaultValue: subfield.defaultValue, autofilled: subfield.autofill, emitValue: this.emitValue, language: this.language, isDuplicateInput: subfield.isDuplicateInput, "client-styling": this.clientStyling, tooltip: subfield.tooltip, placeholder: subfield.placeholder == null ? '' : subfield.placeholder });
|
|
99
|
+
})));
|
|
100
|
+
}
|
|
101
|
+
static get watchers() { return {
|
|
102
|
+
"isValid": ["validityChanged"],
|
|
103
|
+
"emitValue": ["emitValueHandler"]
|
|
104
|
+
}; }
|
|
105
|
+
static get style() { return toggleCheckboxInputCss; }
|
|
106
|
+
}, [1, "toggle-checkbox-input", {
|
|
107
|
+
"name": [513],
|
|
108
|
+
"displayName": [513, "display-name"],
|
|
109
|
+
"defaultValue": [513, "default-value"],
|
|
110
|
+
"options": [520],
|
|
111
|
+
"autofilled": [516],
|
|
112
|
+
"tooltip": [513],
|
|
113
|
+
"validation": [16],
|
|
114
|
+
"language": [513],
|
|
115
|
+
"emitValue": [516, "emit-value"],
|
|
116
|
+
"clientStyling": [513, "client-styling"],
|
|
117
|
+
"errorMessage": [32],
|
|
118
|
+
"isValid": [32],
|
|
119
|
+
"limitStylingAppends": [32],
|
|
120
|
+
"showTooltip": [32],
|
|
121
|
+
"showFields": [32]
|
|
122
|
+
}, [[4, "click", "handleClickOutside"]]]);
|
|
123
|
+
function defineCustomElement$1() {
|
|
124
|
+
if (typeof customElements === "undefined") {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const components = ["toggle-checkbox-input", "checkbox-group-input", "checkbox-input", "date-input", "email-input", "general-input", "number-input", "password-input", "radio-input", "select-input", "tel-input", "text-input", "toggle-checkbox-input"];
|
|
128
|
+
components.forEach(tagName => { switch (tagName) {
|
|
129
|
+
case "toggle-checkbox-input":
|
|
130
|
+
if (!customElements.get(tagName)) {
|
|
131
|
+
customElements.define(tagName, ToggleCheckboxInput);
|
|
132
|
+
}
|
|
133
|
+
break;
|
|
134
|
+
case "checkbox-group-input":
|
|
135
|
+
if (!customElements.get(tagName)) {
|
|
136
|
+
defineCustomElement$b();
|
|
137
|
+
}
|
|
138
|
+
break;
|
|
139
|
+
case "checkbox-input":
|
|
140
|
+
if (!customElements.get(tagName)) {
|
|
141
|
+
defineCustomElement$a();
|
|
142
|
+
}
|
|
143
|
+
break;
|
|
144
|
+
case "date-input":
|
|
145
|
+
if (!customElements.get(tagName)) {
|
|
146
|
+
defineCustomElement$9();
|
|
147
|
+
}
|
|
148
|
+
break;
|
|
149
|
+
case "email-input":
|
|
150
|
+
if (!customElements.get(tagName)) {
|
|
151
|
+
defineCustomElement$8();
|
|
152
|
+
}
|
|
153
|
+
break;
|
|
154
|
+
case "general-input":
|
|
155
|
+
if (!customElements.get(tagName)) {
|
|
156
|
+
defineCustomElement();
|
|
157
|
+
}
|
|
158
|
+
break;
|
|
159
|
+
case "number-input":
|
|
160
|
+
if (!customElements.get(tagName)) {
|
|
161
|
+
defineCustomElement$7();
|
|
162
|
+
}
|
|
163
|
+
break;
|
|
164
|
+
case "password-input":
|
|
165
|
+
if (!customElements.get(tagName)) {
|
|
166
|
+
defineCustomElement$6();
|
|
167
|
+
}
|
|
168
|
+
break;
|
|
169
|
+
case "radio-input":
|
|
170
|
+
if (!customElements.get(tagName)) {
|
|
171
|
+
defineCustomElement$5();
|
|
172
|
+
}
|
|
173
|
+
break;
|
|
174
|
+
case "select-input":
|
|
175
|
+
if (!customElements.get(tagName)) {
|
|
176
|
+
defineCustomElement$4();
|
|
177
|
+
}
|
|
178
|
+
break;
|
|
179
|
+
case "tel-input":
|
|
180
|
+
if (!customElements.get(tagName)) {
|
|
181
|
+
defineCustomElement$3();
|
|
182
|
+
}
|
|
183
|
+
break;
|
|
184
|
+
case "text-input":
|
|
185
|
+
if (!customElements.get(tagName)) {
|
|
186
|
+
defineCustomElement$2();
|
|
187
|
+
}
|
|
188
|
+
break;
|
|
189
|
+
case "toggle-checkbox-input":
|
|
190
|
+
if (!customElements.get(tagName)) {
|
|
191
|
+
defineCustomElement$1();
|
|
192
|
+
}
|
|
193
|
+
break;
|
|
194
|
+
} });
|
|
195
|
+
}
|
|
12
196
|
|
|
13
197
|
const generalInputCss = ":host{display:block}";
|
|
14
198
|
|
|
@@ -39,6 +223,8 @@ const GeneralInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
39
223
|
return h("checkbox-input", { name: this.name, displayName: this.displayName, validation: this.validation, emitValue: this.emitValue, defaultValue: this.defaultValue, autofilled: this.autofilled, language: this.language, "client-styling": this.clientStyling, tooltip: this.tooltip });
|
|
40
224
|
case 'checkboxgroup':
|
|
41
225
|
return h("checkbox-group-input", { name: this.name, displayName: this.displayName, validation: this.validation, defaultValue: this.defaultValue, autofilled: this.autofilled, emitValue: this.emitValue, language: this.language, "client-styling": this.clientStyling, tooltip: this.tooltip, options: this.options });
|
|
226
|
+
case 'togglecheckbox':
|
|
227
|
+
return h("toggle-checkbox-input", { name: this.name, displayName: this.displayName, validation: this.validation, defaultValue: this.defaultValue, autofilled: this.autofilled, emitValue: this.emitValue, language: this.language, "client-styling": this.clientStyling, tooltip: this.tooltip, options: this.options });
|
|
42
228
|
case 'datetime':
|
|
43
229
|
return h("date-input", { name: this.name, displayName: this.displayName, validation: this.validation, defaultValue: this.defaultValue, autofilled: this.autofilled, emitValue: this.emitValue, language: this.language, "client-styling": this.clientStyling, tooltip: this.tooltip, placeholder: this.placeholder, dateFormat: this.dateFormat });
|
|
44
230
|
case 'password':
|
|
@@ -75,7 +261,7 @@ function defineCustomElement() {
|
|
|
75
261
|
if (typeof customElements === "undefined") {
|
|
76
262
|
return;
|
|
77
263
|
}
|
|
78
|
-
const components = ["general-input", "checkbox-group-input", "checkbox-input", "date-input", "email-input", "number-input", "password-input", "radio-input", "select-input", "tel-input", "text-input"];
|
|
264
|
+
const components = ["general-input", "checkbox-group-input", "checkbox-input", "date-input", "email-input", "general-input", "number-input", "password-input", "radio-input", "select-input", "tel-input", "text-input", "toggle-checkbox-input"];
|
|
79
265
|
components.forEach(tagName => { switch (tagName) {
|
|
80
266
|
case "general-input":
|
|
81
267
|
if (!customElements.get(tagName)) {
|
|
@@ -84,50 +270,60 @@ function defineCustomElement() {
|
|
|
84
270
|
break;
|
|
85
271
|
case "checkbox-group-input":
|
|
86
272
|
if (!customElements.get(tagName)) {
|
|
87
|
-
defineCustomElement$
|
|
273
|
+
defineCustomElement$b();
|
|
88
274
|
}
|
|
89
275
|
break;
|
|
90
276
|
case "checkbox-input":
|
|
91
277
|
if (!customElements.get(tagName)) {
|
|
92
|
-
defineCustomElement$
|
|
278
|
+
defineCustomElement$a();
|
|
93
279
|
}
|
|
94
280
|
break;
|
|
95
281
|
case "date-input":
|
|
96
282
|
if (!customElements.get(tagName)) {
|
|
97
|
-
defineCustomElement$
|
|
283
|
+
defineCustomElement$9();
|
|
98
284
|
}
|
|
99
285
|
break;
|
|
100
286
|
case "email-input":
|
|
101
287
|
if (!customElements.get(tagName)) {
|
|
102
|
-
defineCustomElement$
|
|
288
|
+
defineCustomElement$8();
|
|
289
|
+
}
|
|
290
|
+
break;
|
|
291
|
+
case "general-input":
|
|
292
|
+
if (!customElements.get(tagName)) {
|
|
293
|
+
defineCustomElement();
|
|
103
294
|
}
|
|
104
295
|
break;
|
|
105
296
|
case "number-input":
|
|
106
297
|
if (!customElements.get(tagName)) {
|
|
107
|
-
defineCustomElement$
|
|
298
|
+
defineCustomElement$7();
|
|
108
299
|
}
|
|
109
300
|
break;
|
|
110
301
|
case "password-input":
|
|
111
302
|
if (!customElements.get(tagName)) {
|
|
112
|
-
defineCustomElement$
|
|
303
|
+
defineCustomElement$6();
|
|
113
304
|
}
|
|
114
305
|
break;
|
|
115
306
|
case "radio-input":
|
|
116
307
|
if (!customElements.get(tagName)) {
|
|
117
|
-
defineCustomElement$
|
|
308
|
+
defineCustomElement$5();
|
|
118
309
|
}
|
|
119
310
|
break;
|
|
120
311
|
case "select-input":
|
|
121
312
|
if (!customElements.get(tagName)) {
|
|
122
|
-
defineCustomElement$
|
|
313
|
+
defineCustomElement$4();
|
|
123
314
|
}
|
|
124
315
|
break;
|
|
125
316
|
case "tel-input":
|
|
126
317
|
if (!customElements.get(tagName)) {
|
|
127
|
-
defineCustomElement$
|
|
318
|
+
defineCustomElement$3();
|
|
128
319
|
}
|
|
129
320
|
break;
|
|
130
321
|
case "text-input":
|
|
322
|
+
if (!customElements.get(tagName)) {
|
|
323
|
+
defineCustomElement$2();
|
|
324
|
+
}
|
|
325
|
+
break;
|
|
326
|
+
case "toggle-checkbox-input":
|
|
131
327
|
if (!customElements.get(tagName)) {
|
|
132
328
|
defineCustomElement$1();
|
|
133
329
|
}
|
|
@@ -135,4 +331,4 @@ function defineCustomElement() {
|
|
|
135
331
|
} });
|
|
136
332
|
}
|
|
137
333
|
|
|
138
|
-
export { GeneralInput as G, defineCustomElement as d };
|
|
334
|
+
export { GeneralInput as G, ToggleCheckboxInput as T, defineCustomElement$1 as a, defineCustomElement as d };
|