@everymatrix/general-registration 1.10.19 → 1.10.20
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-input_11.cjs.entry.js → checkbox-group-input_12.cjs.entry.js} +18994 -12733
- package/dist/cjs/general-registration.cjs.js +2 -2
- package/dist/cjs/{index-5b4544e8.js → index-dfef7446.js} +41 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/general-registration/general-registration.js +85 -26
- package/dist/collection/utils/locale.utils.js +13 -3
- package/dist/components/active-mixin.js +975 -0
- package/dist/components/checkbox-group-input.js +6 -0
- package/dist/components/checkbox-group-input2.js +1121 -0
- package/dist/components/date-input2.js +5064 -4
- package/dist/components/email-input2.js +2 -1
- package/dist/components/field-mixin.js +12712 -0
- package/dist/components/general-input2.js +20 -11
- package/dist/components/general-registration.js +101 -27
- package/dist/components/input-field-shared-styles.js +403 -13065
- package/dist/components/number-input2.js +2 -1
- package/dist/components/password-input2.js +51 -11
- package/dist/components/pattern-mixin.js +2 -1
- package/dist/components/select-input2.js +5 -4
- package/dist/components/tel-input2.js +7 -1
- package/dist/components/text-input2.js +15 -3
- package/dist/components/tooltipIcon.js +9 -5
- package/dist/components/vaadin-button.js +3 -974
- package/dist/components/vaadin-combo-box.js +12 -27
- package/dist/components/virtual-keyboard-controller.js +3 -38
- package/dist/esm/{checkbox-input_11.entry.js → checkbox-group-input_12.entry.js} +18994 -12734
- package/dist/esm/general-registration.js +2 -2
- package/dist/esm/{index-5b8d16cc.js → index-fdb6785f.js} +41 -1
- package/dist/esm/loader.js +2 -2
- package/dist/general-registration/general-registration.esm.js +1 -1
- package/dist/general-registration/p-64b59a7b.js +1 -0
- package/dist/general-registration/p-cb8af7e3.entry.js +3582 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/stencil/widgets-stencil/packages/general-registration/.stencil/packages/general-input/src/utils/types.d.ts +22 -5
- package/dist/types/components/general-registration/general-registration.d.ts +7 -3
- package/dist/types/components.d.ts +10 -2
- package/dist/types/utils/locale.utils.d.ts +8 -0
- package/package.json +4 -2
- package/dist/general-registration/p-0f29dba0.entry.js +0 -3274
- package/dist/general-registration/p-cba9c0b1.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
3
|
+
const index = require('./index-dfef7446.js');
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["checkbox-
|
|
18
|
+
return index.bootstrapLazy([["checkbox-group-input_12.cjs",[[1,"general-registration",{"endpoint":[513],"language":[513],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"dateFormat":[513,"date-format"],"errorMessage":[32],"isFormValid":[32],"listOfInputs":[32],"isLoading":[32],"registrationStep":[32]},[[0,"sendValidityState","checkInputsValidityHandler"],[0,"sendInputValue","getInputsValueHandler"]]],[1,"general-input",{"type":[513],"name":[513],"displayName":[513,"display-name"],"placeholder":[513],"action":[513],"validation":[16],"options":[520],"language":[513],"autofilled":[516],"tooltip":[513],"defaultValue":[520,"default-value"],"emitValue":[516,"emit-value"],"isDuplicateInput":[516,"is-duplicate-input"],"clientStyling":[520,"client-styling"],"dateFormat":[513,"date-format"]}],[1,"checkbox-group-input",{"name":[513],"displayName":[513,"display-name"],"defaultValue":[513,"default-value"],"autofilled":[516],"tooltip":[513],"options":[520],"validation":[16],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32],"showTooltip":[32],"selectedValues":[32]},[[4,"click","handleClickOutside"]]],[1,"checkbox-input",{"name":[513],"displayName":[513,"display-name"],"defaultValue":[513,"default-value"],"autofilled":[516],"tooltip":[513],"validation":[16],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32],"showTooltip":[32]},[[4,"click","handleClickOutside"]]],[1,"date-input",{"name":[513],"displayName":[513,"display-name"],"placeholder":[513],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"tooltip":[513],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"dateFormat":[513,"date-format"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32],"showTooltip":[32]},[[4,"click","handleClickOutside"]]],[1,"email-input",{"name":[513],"displayName":[513,"display-name"],"placeholder":[513],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"tooltip":[513],"language":[513],"emitValue":[516,"emit-value"],"isDuplicateInput":[516,"is-duplicate-input"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32],"showTooltip":[32]},[[4,"click","handleClickOutside"],[16,"sendInputValue","valueChangedHandler"]]],[1,"number-input",{"name":[513],"displayName":[513,"display-name"],"placeholder":[513],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"tooltip":[513],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32],"showTooltip":[32]},[[4,"click","handleClickOutside"]]],[1,"password-input",{"name":[513],"displayName":[513,"display-name"],"placeholder":[513],"defaultValue":[513,"default-value"],"autofilled":[516],"tooltip":[513],"validation":[16],"language":[513],"emitValue":[516,"emit-value"],"isDuplicateInput":[516,"is-duplicate-input"],"clientStyling":[513,"client-styling"],"isValid":[32],"errorMessage":[32],"limitStylingAppends":[32],"showTooltip":[32],"passwordComplexity":[32],"showPopup":[32]},[[16,"sendInputValue","valueChangedHandler"],[4,"click","handleClickOutside"]]],[1,"radio-input",{"name":[513],"displayName":[513,"display-name"],"optionsGroup":[16],"validation":[16],"tooltip":[513],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32],"showTooltip":[32]},[[4,"click","handleClickOutside"]]],[1,"select-input",{"name":[513],"displayName":[513,"display-name"],"placeholder":[513],"action":[513],"defaultValue":[513,"default-value"],"autofilled":[516],"tooltip":[513],"options":[16],"validation":[16],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32],"showTooltip":[32]},[[4,"click","handleClickOutside"]]],[1,"tel-input",{"name":[513],"displayName":[513,"display-name"],"placeholder":[513],"showLabels":[516,"show-labels"],"action":[513],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"tooltip":[513],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"isValid":[32],"errorMessage":[32],"limitStylingAppends":[32],"showTooltip":[32]},[[4,"click","handleClickOutside"]]],[1,"text-input",{"name":[513],"displayName":[513,"display-name"],"placeholder":[513],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"tooltip":[513],"language":[513],"checkValidity":[516,"check-validity"],"emitValue":[516,"emit-value"],"isDuplicateInput":[516,"is-duplicate-input"],"clientStyling":[513,"client-styling"],"isValid":[32],"errorMessage":[32],"limitStylingAppends":[32],"showTooltip":[32]},[[4,"click","handleClickOutside"],[16,"sendInputValue","valueChangedHandler"]]]]]], options);
|
|
19
19
|
});
|
|
@@ -190,6 +190,7 @@ const isComplexType = (o) => {
|
|
|
190
190
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
|
|
191
191
|
const h = (nodeName, vnodeData, ...children) => {
|
|
192
192
|
let child = null;
|
|
193
|
+
let key = null;
|
|
193
194
|
let simple = false;
|
|
194
195
|
let lastSimple = false;
|
|
195
196
|
let vNodeChildren = [];
|
|
@@ -217,6 +218,10 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
217
218
|
};
|
|
218
219
|
walk(children);
|
|
219
220
|
if (vnodeData) {
|
|
221
|
+
// normalize class / classname attributes
|
|
222
|
+
if (vnodeData.key) {
|
|
223
|
+
key = vnodeData.key;
|
|
224
|
+
}
|
|
220
225
|
{
|
|
221
226
|
const classData = vnodeData.className || vnodeData.class;
|
|
222
227
|
if (classData) {
|
|
@@ -234,6 +239,9 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
234
239
|
if (vNodeChildren.length > 0) {
|
|
235
240
|
vnode.$children$ = vNodeChildren;
|
|
236
241
|
}
|
|
242
|
+
{
|
|
243
|
+
vnode.$key$ = key;
|
|
244
|
+
}
|
|
237
245
|
return vnode;
|
|
238
246
|
};
|
|
239
247
|
const newVNode = (tag, text) => {
|
|
@@ -247,6 +255,9 @@ const newVNode = (tag, text) => {
|
|
|
247
255
|
{
|
|
248
256
|
vnode.$attrs$ = null;
|
|
249
257
|
}
|
|
258
|
+
{
|
|
259
|
+
vnode.$key$ = null;
|
|
260
|
+
}
|
|
250
261
|
return vnode;
|
|
251
262
|
};
|
|
252
263
|
const Host = {};
|
|
@@ -270,6 +281,8 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
270
281
|
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
271
282
|
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
272
283
|
}
|
|
284
|
+
else if (memberName === 'key')
|
|
285
|
+
;
|
|
273
286
|
else if (memberName === 'ref') {
|
|
274
287
|
// minifier will clean this up
|
|
275
288
|
if (newValue) {
|
|
@@ -441,6 +454,8 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
|
441
454
|
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
442
455
|
let oldStartIdx = 0;
|
|
443
456
|
let newStartIdx = 0;
|
|
457
|
+
let idxInOld = 0;
|
|
458
|
+
let i = 0;
|
|
444
459
|
let oldEndIdx = oldCh.length - 1;
|
|
445
460
|
let oldStartVnode = oldCh[0];
|
|
446
461
|
let oldEndVnode = oldCh[oldEndIdx];
|
|
@@ -448,6 +463,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
448
463
|
let newStartVnode = newCh[0];
|
|
449
464
|
let newEndVnode = newCh[newEndIdx];
|
|
450
465
|
let node;
|
|
466
|
+
let elmToMove;
|
|
451
467
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
452
468
|
if (oldStartVnode == null) {
|
|
453
469
|
// Vnode might have been moved left
|
|
@@ -485,7 +501,29 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
485
501
|
newStartVnode = newCh[++newStartIdx];
|
|
486
502
|
}
|
|
487
503
|
else {
|
|
504
|
+
// createKeyToOldIdx
|
|
505
|
+
idxInOld = -1;
|
|
488
506
|
{
|
|
507
|
+
for (i = oldStartIdx; i <= oldEndIdx; ++i) {
|
|
508
|
+
if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
|
|
509
|
+
idxInOld = i;
|
|
510
|
+
break;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
if (idxInOld >= 0) {
|
|
515
|
+
elmToMove = oldCh[idxInOld];
|
|
516
|
+
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
517
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
|
|
518
|
+
}
|
|
519
|
+
else {
|
|
520
|
+
patch(elmToMove, newStartVnode);
|
|
521
|
+
oldCh[idxInOld] = undefined;
|
|
522
|
+
node = elmToMove.$elm$;
|
|
523
|
+
}
|
|
524
|
+
newStartVnode = newCh[++newStartIdx];
|
|
525
|
+
}
|
|
526
|
+
else {
|
|
489
527
|
// new element
|
|
490
528
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
491
529
|
newStartVnode = newCh[++newStartIdx];
|
|
@@ -508,7 +546,9 @@ const isSameVnode = (vnode1, vnode2) => {
|
|
|
508
546
|
// compare if two vnode to see if they're "technically" the same
|
|
509
547
|
// need to have the same element tag, and same key to be the same
|
|
510
548
|
if (vnode1.$tag$ === vnode2.$tag$) {
|
|
511
|
-
|
|
549
|
+
{
|
|
550
|
+
return vnode1.$key$ === vnode2.$key$;
|
|
551
|
+
}
|
|
512
552
|
}
|
|
513
553
|
return false;
|
|
514
554
|
};
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-dfef7446.js');
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
8
|
Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["checkbox-
|
|
17
|
+
return index.bootstrapLazy([["checkbox-group-input_12.cjs",[[1,"general-registration",{"endpoint":[513],"language":[513],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"dateFormat":[513,"date-format"],"errorMessage":[32],"isFormValid":[32],"listOfInputs":[32],"isLoading":[32],"registrationStep":[32]},[[0,"sendValidityState","checkInputsValidityHandler"],[0,"sendInputValue","getInputsValueHandler"]]],[1,"general-input",{"type":[513],"name":[513],"displayName":[513,"display-name"],"placeholder":[513],"action":[513],"validation":[16],"options":[520],"language":[513],"autofilled":[516],"tooltip":[513],"defaultValue":[520,"default-value"],"emitValue":[516,"emit-value"],"isDuplicateInput":[516,"is-duplicate-input"],"clientStyling":[520,"client-styling"],"dateFormat":[513,"date-format"]}],[1,"checkbox-group-input",{"name":[513],"displayName":[513,"display-name"],"defaultValue":[513,"default-value"],"autofilled":[516],"tooltip":[513],"options":[520],"validation":[16],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32],"showTooltip":[32],"selectedValues":[32]},[[4,"click","handleClickOutside"]]],[1,"checkbox-input",{"name":[513],"displayName":[513,"display-name"],"defaultValue":[513,"default-value"],"autofilled":[516],"tooltip":[513],"validation":[16],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32],"showTooltip":[32]},[[4,"click","handleClickOutside"]]],[1,"date-input",{"name":[513],"displayName":[513,"display-name"],"placeholder":[513],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"tooltip":[513],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"dateFormat":[513,"date-format"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32],"showTooltip":[32]},[[4,"click","handleClickOutside"]]],[1,"email-input",{"name":[513],"displayName":[513,"display-name"],"placeholder":[513],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"tooltip":[513],"language":[513],"emitValue":[516,"emit-value"],"isDuplicateInput":[516,"is-duplicate-input"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32],"showTooltip":[32]},[[4,"click","handleClickOutside"],[16,"sendInputValue","valueChangedHandler"]]],[1,"number-input",{"name":[513],"displayName":[513,"display-name"],"placeholder":[513],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"tooltip":[513],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32],"showTooltip":[32]},[[4,"click","handleClickOutside"]]],[1,"password-input",{"name":[513],"displayName":[513,"display-name"],"placeholder":[513],"defaultValue":[513,"default-value"],"autofilled":[516],"tooltip":[513],"validation":[16],"language":[513],"emitValue":[516,"emit-value"],"isDuplicateInput":[516,"is-duplicate-input"],"clientStyling":[513,"client-styling"],"isValid":[32],"errorMessage":[32],"limitStylingAppends":[32],"showTooltip":[32],"passwordComplexity":[32],"showPopup":[32]},[[16,"sendInputValue","valueChangedHandler"],[4,"click","handleClickOutside"]]],[1,"radio-input",{"name":[513],"displayName":[513,"display-name"],"optionsGroup":[16],"validation":[16],"tooltip":[513],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32],"showTooltip":[32]},[[4,"click","handleClickOutside"]]],[1,"select-input",{"name":[513],"displayName":[513,"display-name"],"placeholder":[513],"action":[513],"defaultValue":[513,"default-value"],"autofilled":[516],"tooltip":[513],"options":[16],"validation":[16],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32],"showTooltip":[32]},[[4,"click","handleClickOutside"]]],[1,"tel-input",{"name":[513],"displayName":[513,"display-name"],"placeholder":[513],"showLabels":[516,"show-labels"],"action":[513],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"tooltip":[513],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"isValid":[32],"errorMessage":[32],"limitStylingAppends":[32],"showTooltip":[32]},[[4,"click","handleClickOutside"]]],[1,"text-input",{"name":[513],"displayName":[513,"display-name"],"placeholder":[513],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"tooltip":[513],"language":[513],"checkValidity":[516,"check-validity"],"emitValue":[516,"emit-value"],"isDuplicateInput":[516,"is-duplicate-input"],"clientStyling":[513,"client-styling"],"isValid":[32],"errorMessage":[32],"limitStylingAppends":[32],"showTooltip":[32]},[[4,"click","handleClickOutside"],[16,"sendInputValue","valueChangedHandler"]]]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component, h, Listen, Prop, State, Watch, Event } from '@stencil/core';
|
|
2
|
-
import { translate } from '../../utils/locale.utils';
|
|
2
|
+
import { getTranslations, translate, TRANSLATIONS } from '../../utils/locale.utils';
|
|
3
3
|
import '@everymatrix/general-input';
|
|
4
4
|
export class GeneralRegistration {
|
|
5
5
|
constructor() {
|
|
@@ -18,12 +18,12 @@ export class GeneralRegistration {
|
|
|
18
18
|
/**
|
|
19
19
|
* Translations via URL
|
|
20
20
|
*/
|
|
21
|
-
this.
|
|
21
|
+
this.translationUrl = '';
|
|
22
22
|
this.listOfInputs = [];
|
|
23
23
|
this.isLoading = true;
|
|
24
24
|
this.listOfInputValues = [];
|
|
25
|
+
this.listOfInputValidity = [];
|
|
25
26
|
this.listOfActions = [];
|
|
26
|
-
this.indexStep = 0;
|
|
27
27
|
this.emitValue = false;
|
|
28
28
|
this.registrationStepsState = {
|
|
29
29
|
regId: null
|
|
@@ -51,26 +51,49 @@ export class GeneralRegistration {
|
|
|
51
51
|
}
|
|
52
52
|
setFormValidity() {
|
|
53
53
|
this.errorMessage = '';
|
|
54
|
-
this.isFormValid = !this.getInvalidStatus(this.
|
|
54
|
+
this.isFormValid = !this.getInvalidStatus(this.listOfInputValidity);
|
|
55
55
|
}
|
|
56
56
|
checkInputsValidityHandler(event) {
|
|
57
57
|
// Set isValid state of the input in the list.
|
|
58
|
-
this.
|
|
58
|
+
this.listOfInputValidity.find(input => input.name == event.detail.name).isValid = event.detail.valid;
|
|
59
59
|
// Check if any one is invalid.
|
|
60
|
-
this.isFormValid = !this.getInvalidStatus(this.
|
|
60
|
+
this.isFormValid = !this.getInvalidStatus(this.listOfInputValidity);
|
|
61
61
|
}
|
|
62
62
|
getInputsValueHandler(event) {
|
|
63
63
|
this.listOfInputValues.find(input => {
|
|
64
64
|
if (input.name == event.detail.name) {
|
|
65
65
|
input.value = event.detail.value;
|
|
66
|
+
input.type = event.detail.type || null;
|
|
66
67
|
}
|
|
67
68
|
});
|
|
68
69
|
this.stepsStateMachine({ event: 'set', type: 'values' });
|
|
69
70
|
}
|
|
70
71
|
componentWillLoad() {
|
|
71
|
-
return this.getRegisterConfig()
|
|
72
|
-
|
|
73
|
-
this.
|
|
72
|
+
return this.getRegisterConfig()
|
|
73
|
+
.then((config) => {
|
|
74
|
+
if (this.translationUrl) {
|
|
75
|
+
getTranslations(this.translationUrl).then(() => {
|
|
76
|
+
config.content.fields.forEach(field => {
|
|
77
|
+
if (TRANSLATIONS[this.language][field.name]) {
|
|
78
|
+
Object.keys(TRANSLATIONS[this.language][field.name]).forEach((key) => {
|
|
79
|
+
field[key] = TRANSLATIONS[this.language][field.name][key];
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return field;
|
|
83
|
+
});
|
|
84
|
+
})
|
|
85
|
+
.catch((error) => {
|
|
86
|
+
console.error('Failed to fetch translations:', error);
|
|
87
|
+
}).finally(() => {
|
|
88
|
+
this.formatConfig(config);
|
|
89
|
+
this.stepsStateMachine({ event: 'set', type: 'inputs' });
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
this.formatConfig(config);
|
|
94
|
+
this.isFormValid = !this.getInvalidStatus(this.listOfInputValidity);
|
|
95
|
+
this.stepsStateMachine({ event: 'set', type: 'inputs' });
|
|
96
|
+
}
|
|
74
97
|
});
|
|
75
98
|
}
|
|
76
99
|
componentDidRender() {
|
|
@@ -104,6 +127,7 @@ export class GeneralRegistration {
|
|
|
104
127
|
if (state.type == 'inputs') {
|
|
105
128
|
this.registrationStepsState[this.registrationStep].fields = this.listOfInputs;
|
|
106
129
|
this.registrationStepsState[this.registrationStep].actions = this.listOfActions;
|
|
130
|
+
this.registrationStepsState[this.registrationStep].fieldsValidity = this.listOfInputValidity;
|
|
107
131
|
}
|
|
108
132
|
if (state.type == 'values') {
|
|
109
133
|
this.registrationStepsState[this.registrationStep].registerUserData = this.listOfInputValues.reduce((acc, curr) => {
|
|
@@ -120,6 +144,7 @@ export class GeneralRegistration {
|
|
|
120
144
|
if (state.type == 'inputs') {
|
|
121
145
|
this.listOfInputs = this.registrationStepsState[this.registrationStep].fields;
|
|
122
146
|
this.listOfActions = this.registrationStepsState[this.registrationStep].actions;
|
|
147
|
+
this.listOfInputValidity = this.registrationStepsState[this.registrationStep].fieldsValidity;
|
|
123
148
|
}
|
|
124
149
|
if (state.type == 'values') {
|
|
125
150
|
const savedValues = savedUserData[this.registrationStep].registerUserData;
|
|
@@ -134,6 +159,7 @@ export class GeneralRegistration {
|
|
|
134
159
|
}
|
|
135
160
|
});
|
|
136
161
|
}
|
|
162
|
+
this.isFormValid = !this.getInvalidStatus(this.listOfInputValidity);
|
|
137
163
|
break;
|
|
138
164
|
}
|
|
139
165
|
}
|
|
@@ -154,8 +180,10 @@ export class GeneralRegistration {
|
|
|
154
180
|
fetch(url.href, options)
|
|
155
181
|
.then((res) => res.json())
|
|
156
182
|
.then((config) => {
|
|
183
|
+
this.isLoading = false;
|
|
157
184
|
resolve(config);
|
|
158
185
|
}).catch((err) => {
|
|
186
|
+
this.isLoading = false;
|
|
159
187
|
console.error(err);
|
|
160
188
|
reject(err);
|
|
161
189
|
}).finally(() => {
|
|
@@ -164,18 +192,26 @@ export class GeneralRegistration {
|
|
|
164
192
|
});
|
|
165
193
|
}
|
|
166
194
|
setRegisterStep() {
|
|
167
|
-
this.isLoading = true;
|
|
168
195
|
const url = new URL(`${this.endpoint}/v1/player/legislation/registration/step`);
|
|
169
196
|
const registerStep = {
|
|
170
197
|
registrationId: this.registrationID,
|
|
171
198
|
registerUserDto: this.listOfInputValues
|
|
172
199
|
.filter(input => !input.isDuplicate)
|
|
173
200
|
.reduce((acc, curr) => {
|
|
174
|
-
//
|
|
175
|
-
if (curr.name ==
|
|
201
|
+
// Because the API is very robust, some values need to be split as separate entities.
|
|
202
|
+
if (curr.name == 'Mobile') {
|
|
176
203
|
acc['MobilePrefix'] = curr.value.split('|')[0];
|
|
177
204
|
acc[curr.name] = curr.value.split('|')[1];
|
|
178
205
|
}
|
|
206
|
+
else if (curr.type === 'checkboxgroup') {
|
|
207
|
+
// Skip adding the parent of the checkboxgroup as a key.
|
|
208
|
+
if (curr.value !== null && curr.value !== '') {
|
|
209
|
+
const subCheckboxesValues = curr.value.split('|');
|
|
210
|
+
subCheckboxesValues.forEach((checkboxValue) => {
|
|
211
|
+
acc[checkboxValue] = 'true';
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
}
|
|
179
215
|
else {
|
|
180
216
|
acc[curr.name] = curr.value;
|
|
181
217
|
}
|
|
@@ -211,9 +247,6 @@ export class GeneralRegistration {
|
|
|
211
247
|
return res.json();
|
|
212
248
|
})
|
|
213
249
|
.then((data) => {
|
|
214
|
-
this.isLoading = false;
|
|
215
|
-
if (!data)
|
|
216
|
-
return;
|
|
217
250
|
this.registrationID = data.registrationId;
|
|
218
251
|
if (this.listOfActions.some(action => action == '/register')) {
|
|
219
252
|
this.setRegister();
|
|
@@ -235,13 +268,10 @@ export class GeneralRegistration {
|
|
|
235
268
|
this.stepsStateMachine({ event: 'set', type: 'inputs' });
|
|
236
269
|
});
|
|
237
270
|
}
|
|
238
|
-
// Set it in local storage.
|
|
239
|
-
this.stepsStateMachine({ event: 'set', type: 'inputs' });
|
|
240
271
|
}
|
|
241
272
|
})
|
|
242
273
|
.catch((err) => {
|
|
243
274
|
console.error(err);
|
|
244
|
-
// this.isLoading = false;
|
|
245
275
|
});
|
|
246
276
|
}
|
|
247
277
|
setRegister() {
|
|
@@ -263,12 +293,14 @@ export class GeneralRegistration {
|
|
|
263
293
|
return res.json();
|
|
264
294
|
})
|
|
265
295
|
.then((data) => {
|
|
296
|
+
this.isLoading = false;
|
|
266
297
|
if (data.userId) {
|
|
267
298
|
alert(`User registered - the user ID is ${data.userId}`);
|
|
268
299
|
}
|
|
269
300
|
window.postMessage({ type: 'registrationSuccessful' }, window.location.href);
|
|
270
301
|
})
|
|
271
302
|
.catch((err) => {
|
|
303
|
+
this.isLoading = false;
|
|
272
304
|
console.error(err);
|
|
273
305
|
})
|
|
274
306
|
.finally(() => {
|
|
@@ -276,25 +308,34 @@ export class GeneralRegistration {
|
|
|
276
308
|
});
|
|
277
309
|
}
|
|
278
310
|
formatConfig(config) {
|
|
279
|
-
// Populate the list of inputs
|
|
311
|
+
// Populate the list of inputs
|
|
280
312
|
this.listOfInputs = config.content.fields.flatMap((field) => {
|
|
281
313
|
// Special case for inputs that need to be duplicated.
|
|
282
314
|
const duplicateInputRule = field.validate.custom.find(customRule => customRule.rule === 'duplicate-input');
|
|
283
|
-
const inputElement = Object.assign(
|
|
315
|
+
const inputElement = Object.assign({}, field);
|
|
284
316
|
if (duplicateInputRule) {
|
|
285
|
-
const duplicateInput = Object.assign(Object.assign({}, field), { name: `${field.name}Duplicate`, displayName: duplicateInputRule.displayName,
|
|
317
|
+
const duplicateInput = Object.assign(Object.assign({}, field), { name: `${field.name}Duplicate`, displayName: duplicateInputRule.displayName, isDuplicateInput: true });
|
|
286
318
|
return [inputElement, duplicateInput];
|
|
287
319
|
}
|
|
288
320
|
else {
|
|
289
321
|
return [inputElement];
|
|
290
322
|
}
|
|
291
323
|
});
|
|
324
|
+
// Set validity status of each input
|
|
325
|
+
this.listOfInputValidity = this.listOfInputs.map(field => {
|
|
326
|
+
return {
|
|
327
|
+
name: field.name,
|
|
328
|
+
isValid: this.setInitialValidStatus(field)
|
|
329
|
+
};
|
|
330
|
+
});
|
|
292
331
|
// Populate the list of inputs values and set as null in the beginning (or false for checkbox type inputs)
|
|
293
332
|
this.listOfInputValues = this.listOfInputs.map(field => {
|
|
294
|
-
var _a;
|
|
333
|
+
var _a, _b;
|
|
295
334
|
return { name: field.name,
|
|
296
335
|
value: ((_a = field.inputType) === null || _a === void 0 ? void 0 : _a.toLowerCase()) == 'checkbox' ? 'false' : null,
|
|
297
|
-
isDuplicate: field.isDuplicateInput || false
|
|
336
|
+
isDuplicate: field.isDuplicateInput || false,
|
|
337
|
+
type: ((_b = field.inputType) === null || _b === void 0 ? void 0 : _b.toLowerCase()) == 'checkboxgroup' ? 'checkboxgroup' : null
|
|
338
|
+
};
|
|
298
339
|
});
|
|
299
340
|
// Set the list of actions
|
|
300
341
|
this.listOfActions = config.content.actions.map(action => action);
|
|
@@ -306,6 +347,7 @@ export class GeneralRegistration {
|
|
|
306
347
|
if (!this.registrationStepsState[this.registrationStep]) {
|
|
307
348
|
this.registrationStepsState[this.registrationStep] = {
|
|
308
349
|
fields: [],
|
|
350
|
+
fieldsValidity: [],
|
|
309
351
|
registerUserData: {},
|
|
310
352
|
actions: []
|
|
311
353
|
};
|
|
@@ -336,7 +378,7 @@ export class GeneralRegistration {
|
|
|
336
378
|
return listOfInputs.filter(input => input.isValid == false).length > 0;
|
|
337
379
|
}
|
|
338
380
|
renderInputs() {
|
|
339
|
-
return (this.listOfInputs.map(input => h("general-input", { type: input.inputType, name: input.name, displayName: input.displayName, validation: input.validate, action: input.action || null, options: input.data ? 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 })));
|
|
381
|
+
return (this.listOfInputs.map(input => 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 })));
|
|
340
382
|
}
|
|
341
383
|
;
|
|
342
384
|
renderButtons() {
|
|
@@ -433,7 +475,7 @@ export class GeneralRegistration {
|
|
|
433
475
|
"reflect": true,
|
|
434
476
|
"defaultValue": "''"
|
|
435
477
|
},
|
|
436
|
-
"
|
|
478
|
+
"translationUrl": {
|
|
437
479
|
"type": "string",
|
|
438
480
|
"mutable": false,
|
|
439
481
|
"complexType": {
|
|
@@ -447,9 +489,26 @@ export class GeneralRegistration {
|
|
|
447
489
|
"tags": [],
|
|
448
490
|
"text": "Translations via URL"
|
|
449
491
|
},
|
|
450
|
-
"attribute": "
|
|
492
|
+
"attribute": "translation-url",
|
|
451
493
|
"reflect": true,
|
|
452
494
|
"defaultValue": "''"
|
|
495
|
+
},
|
|
496
|
+
"dateFormat": {
|
|
497
|
+
"type": "string",
|
|
498
|
+
"mutable": false,
|
|
499
|
+
"complexType": {
|
|
500
|
+
"original": "string",
|
|
501
|
+
"resolved": "string",
|
|
502
|
+
"references": {}
|
|
503
|
+
},
|
|
504
|
+
"required": false,
|
|
505
|
+
"optional": false,
|
|
506
|
+
"docs": {
|
|
507
|
+
"tags": [],
|
|
508
|
+
"text": "Date format for date picker"
|
|
509
|
+
},
|
|
510
|
+
"attribute": "date-format",
|
|
511
|
+
"reflect": true
|
|
453
512
|
}
|
|
454
513
|
}; }
|
|
455
514
|
static get states() { return {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const DEFAULT_LANGUAGE = 'en';
|
|
2
|
-
const
|
|
3
|
-
const TRANSLATIONS = {
|
|
2
|
+
export const TRANSLATIONS = {
|
|
4
3
|
"en": {
|
|
5
4
|
"nextButton": 'Next',
|
|
6
5
|
"backButton": 'Back',
|
|
@@ -11,6 +10,17 @@ const TRANSLATIONS = {
|
|
|
11
10
|
"GmErr_Unauthorized": 'Something went wrong... Please try again.',
|
|
12
11
|
"GmErr_NotFound": 'Something went wrong... Please try again.',
|
|
13
12
|
"GmErr_UnexpectedException": 'Something went wrong... Please try again.',
|
|
13
|
+
},
|
|
14
|
+
"hu": {
|
|
15
|
+
"nextButton": 'Következő',
|
|
16
|
+
"backButton": 'Vissza',
|
|
17
|
+
"doneButton": 'Kész',
|
|
18
|
+
"GmErr_BadRequest_Duplicate_User": 'Már létezik felhasználó ezzel az információval.',
|
|
19
|
+
"GmErr_BadRequest_ModelValidationFailed": 'Valami hiba történt... Kérjük, próbálja újra.',
|
|
20
|
+
"GmErr_BadInternalConfigs": 'Valami hiba történt... Kérjük, próbálja újra.',
|
|
21
|
+
"GmErr_Unauthorized": 'Valami hiba történt... Kérjük, próbálja újra.',
|
|
22
|
+
"GmErr_NotFound": 'Valami hiba történt... Kérjük, próbálja újra.',
|
|
23
|
+
"GmErr_UnexpectedException": 'Valami hiba történt... Kérjük, próbálja újra.',
|
|
14
24
|
}
|
|
15
25
|
};
|
|
16
26
|
export const getTranslations = (url) => {
|
|
@@ -30,7 +40,7 @@ export const getTranslations = (url) => {
|
|
|
30
40
|
};
|
|
31
41
|
export const translate = (key, customLang, values) => {
|
|
32
42
|
const lang = customLang;
|
|
33
|
-
let translation = TRANSLATIONS[lang !== undefined
|
|
43
|
+
let translation = TRANSLATIONS[lang !== undefined ? lang : DEFAULT_LANGUAGE][key];
|
|
34
44
|
if (values !== undefined) {
|
|
35
45
|
for (const [key, value] of Object.entries(values.values)) {
|
|
36
46
|
const regex = new RegExp(`{${key}}`, 'g');
|