@everymatrix/general-registration 1.10.1 → 1.10.3
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 +28186 -770
- package/dist/cjs/general-registration.cjs.js +2 -2
- package/dist/cjs/{index-c04f4a2a.js → index-9a07d1e9.js} +5 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/components/general-registration/general-registration.js +299 -224
- package/dist/components/checkbox-input2.js +10 -5
- package/dist/components/date-input2.js +6493 -19
- package/dist/components/email-input2.js +7 -20
- package/dist/components/general-input2.js +11 -9
- package/dist/components/general-registration.js +299 -223
- package/dist/components/locale.utils.js +2 -1
- package/dist/components/number-input2.js +7 -20
- package/dist/components/password-input2.js +9 -1
- package/dist/components/radio-input2.js +3 -12
- package/dist/components/select-input2.js +16 -19
- package/dist/components/tel-input2.js +35 -21
- package/dist/components/text-input2.js +5 -4
- package/dist/components/vaadin-combo-box.js +4423 -0
- package/dist/components/virtual-keyboard-controller.js +16466 -0
- package/dist/esm/checkbox-input_11.entry.js +28193 -777
- package/dist/esm/general-registration.js +2 -2
- package/dist/esm/{index-79f297c1.js → index-0505440f.js} +5 -1
- package/dist/esm/loader.js +2 -2
- package/dist/general-registration/general-registration.esm.js +1 -1
- package/dist/general-registration/p-1a88a312.js +1 -0
- package/dist/general-registration/p-7c69629f.entry.js +3164 -0
- package/dist/types/Users/{user/workspace/everymatrix → adrian.pripon/Documents/Work/stencil}/widgets-stencil/packages/general-registration/.stencil/packages/general-input/src/utils/types.d.ts +8 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/stencil/widgets-stencil/packages/general-registration/.stencil/packages/general-registration/stencil.config.d.ts +2 -0
- package/dist/types/components/general-registration/general-registration.d.ts +267 -11
- package/package.json +6 -4
- package/dist/general-registration/p-0e7175cd.js +0 -1
- package/dist/general-registration/p-cadaffbe.entry.js +0 -1
- package/dist/types/Users/user/workspace/everymatrix/widgets-stencil/packages/general-registration/.stencil/packages/general-registration/stencil.config.d.ts +0 -2
- /package/dist/types/Users/{user/workspace/everymatrix → adrian.pripon/Documents/Work/stencil}/widgets-stencil/packages/general-registration/.stencil/packages/general-input/src/utils/locale.utils.d.ts +0 -0
|
@@ -49,7 +49,15 @@ export interface InputValueEvent {
|
|
|
49
49
|
value: string | number | boolean;
|
|
50
50
|
name: string;
|
|
51
51
|
}
|
|
52
|
+
export interface InputValue {
|
|
53
|
+
value: string | number | boolean;
|
|
54
|
+
name: string;
|
|
55
|
+
}
|
|
52
56
|
export interface RegisterStep {
|
|
53
57
|
registrationId: string;
|
|
54
58
|
}
|
|
59
|
+
export interface StepState {
|
|
60
|
+
event: string;
|
|
61
|
+
type: string;
|
|
62
|
+
}
|
|
55
63
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { InputStateEvent, InputValueEvent, RegistrationConfig } from '../../../../general-input/src/utils/types';
|
|
1
|
+
import type { InputStateEvent, InputValueEvent, RegistrationConfig, StepState, InputValue } from '../../../../general-input/src/utils/types';
|
|
2
2
|
import '@everymatrix/general-input';
|
|
3
3
|
export declare class GeneralRegistration {
|
|
4
4
|
data: {
|
|
5
5
|
type: string;
|
|
6
6
|
content: {
|
|
7
7
|
step: string;
|
|
8
|
-
fields: {
|
|
8
|
+
fields: ({
|
|
9
9
|
name: string;
|
|
10
10
|
displayName: string;
|
|
11
11
|
defaultValue: any;
|
|
@@ -13,9 +13,261 @@ export declare class GeneralRegistration {
|
|
|
13
13
|
mandatory: boolean;
|
|
14
14
|
minLength: number;
|
|
15
15
|
maxLength: number;
|
|
16
|
+
min?: undefined;
|
|
17
|
+
max?: undefined;
|
|
18
|
+
custom?: undefined;
|
|
19
|
+
type?: undefined;
|
|
16
20
|
};
|
|
17
21
|
autofill: boolean;
|
|
18
|
-
|
|
22
|
+
action?: undefined;
|
|
23
|
+
inputType?: undefined;
|
|
24
|
+
data?: undefined;
|
|
25
|
+
} | {
|
|
26
|
+
name: string;
|
|
27
|
+
displayName: string;
|
|
28
|
+
defaultValue: any;
|
|
29
|
+
validate: {
|
|
30
|
+
mandatory: boolean;
|
|
31
|
+
minLength: number;
|
|
32
|
+
maxLength: number;
|
|
33
|
+
min?: undefined;
|
|
34
|
+
max?: undefined;
|
|
35
|
+
custom?: undefined;
|
|
36
|
+
type?: undefined;
|
|
37
|
+
};
|
|
38
|
+
autofill?: undefined;
|
|
39
|
+
action?: undefined;
|
|
40
|
+
inputType?: undefined;
|
|
41
|
+
data?: undefined;
|
|
42
|
+
} | {
|
|
43
|
+
name: string;
|
|
44
|
+
displayName: string;
|
|
45
|
+
action: string;
|
|
46
|
+
defaultValue: any;
|
|
47
|
+
validate: {
|
|
48
|
+
mandatory: boolean;
|
|
49
|
+
minLength?: undefined;
|
|
50
|
+
maxLength?: undefined;
|
|
51
|
+
min?: undefined;
|
|
52
|
+
max?: undefined;
|
|
53
|
+
custom?: undefined;
|
|
54
|
+
type?: undefined;
|
|
55
|
+
};
|
|
56
|
+
autofill: boolean;
|
|
57
|
+
inputType: string;
|
|
58
|
+
data?: undefined;
|
|
59
|
+
} | {
|
|
60
|
+
name: string;
|
|
61
|
+
displayName: string;
|
|
62
|
+
defaultValue: any;
|
|
63
|
+
validate: {
|
|
64
|
+
min: string;
|
|
65
|
+
max: string;
|
|
66
|
+
mandatory: boolean;
|
|
67
|
+
minLength?: undefined;
|
|
68
|
+
maxLength?: undefined;
|
|
69
|
+
custom?: undefined;
|
|
70
|
+
type?: undefined;
|
|
71
|
+
};
|
|
72
|
+
inputType: string;
|
|
73
|
+
autofill?: undefined;
|
|
74
|
+
action?: undefined;
|
|
75
|
+
data?: undefined;
|
|
76
|
+
} | {
|
|
77
|
+
name: string;
|
|
78
|
+
displayName: string;
|
|
79
|
+
defaultValue: string;
|
|
80
|
+
validate: {
|
|
81
|
+
mandatory: boolean;
|
|
82
|
+
custom: {
|
|
83
|
+
rule: string;
|
|
84
|
+
pattern: string;
|
|
85
|
+
errorMessage: string;
|
|
86
|
+
}[];
|
|
87
|
+
minLength?: undefined;
|
|
88
|
+
maxLength?: undefined;
|
|
89
|
+
min?: undefined;
|
|
90
|
+
max?: undefined;
|
|
91
|
+
type?: undefined;
|
|
92
|
+
};
|
|
93
|
+
inputType: string;
|
|
94
|
+
autofill?: undefined;
|
|
95
|
+
action?: undefined;
|
|
96
|
+
data?: undefined;
|
|
97
|
+
} | {
|
|
98
|
+
name: string;
|
|
99
|
+
displayName: string;
|
|
100
|
+
defaultValue: any;
|
|
101
|
+
validate: {
|
|
102
|
+
mandatory: boolean;
|
|
103
|
+
minLength: number;
|
|
104
|
+
maxLength: number;
|
|
105
|
+
type: string;
|
|
106
|
+
custom: {
|
|
107
|
+
rule: string;
|
|
108
|
+
pattern: string;
|
|
109
|
+
errorMessage: string;
|
|
110
|
+
}[];
|
|
111
|
+
min?: undefined;
|
|
112
|
+
max?: undefined;
|
|
113
|
+
};
|
|
114
|
+
inputType: string;
|
|
115
|
+
autofill?: undefined;
|
|
116
|
+
action?: undefined;
|
|
117
|
+
data?: undefined;
|
|
118
|
+
} | {
|
|
119
|
+
name: string;
|
|
120
|
+
displayName: string;
|
|
121
|
+
defaultValue: any;
|
|
122
|
+
validate: {
|
|
123
|
+
mandatory: boolean;
|
|
124
|
+
type: string;
|
|
125
|
+
custom: ({
|
|
126
|
+
rule: string;
|
|
127
|
+
errorMessage: string;
|
|
128
|
+
pattern?: undefined;
|
|
129
|
+
displayName?: undefined;
|
|
130
|
+
} | {
|
|
131
|
+
rule: string;
|
|
132
|
+
pattern: string;
|
|
133
|
+
errorMessage: string;
|
|
134
|
+
displayName?: undefined;
|
|
135
|
+
} | {
|
|
136
|
+
rule: string;
|
|
137
|
+
displayName: string;
|
|
138
|
+
errorMessage: string;
|
|
139
|
+
pattern?: undefined;
|
|
140
|
+
})[];
|
|
141
|
+
minLength?: undefined;
|
|
142
|
+
maxLength?: undefined;
|
|
143
|
+
min?: undefined;
|
|
144
|
+
max?: undefined;
|
|
145
|
+
};
|
|
146
|
+
autofill?: undefined;
|
|
147
|
+
action?: undefined;
|
|
148
|
+
inputType?: undefined;
|
|
149
|
+
data?: undefined;
|
|
150
|
+
} | {
|
|
151
|
+
name: string;
|
|
152
|
+
displayName: string;
|
|
153
|
+
validate: {
|
|
154
|
+
mandatory: boolean;
|
|
155
|
+
type: string;
|
|
156
|
+
minLength?: undefined;
|
|
157
|
+
maxLength?: undefined;
|
|
158
|
+
min?: undefined;
|
|
159
|
+
max?: undefined;
|
|
160
|
+
custom?: undefined;
|
|
161
|
+
};
|
|
162
|
+
inputType: string;
|
|
163
|
+
defaultValue?: undefined;
|
|
164
|
+
autofill?: undefined;
|
|
165
|
+
action?: undefined;
|
|
166
|
+
data?: undefined;
|
|
167
|
+
} | {
|
|
168
|
+
name: string;
|
|
169
|
+
validate: {
|
|
170
|
+
mandatory: boolean;
|
|
171
|
+
minLength?: undefined;
|
|
172
|
+
maxLength?: undefined;
|
|
173
|
+
min?: undefined;
|
|
174
|
+
max?: undefined;
|
|
175
|
+
custom?: undefined;
|
|
176
|
+
type?: undefined;
|
|
177
|
+
};
|
|
178
|
+
inputType: string;
|
|
179
|
+
displayName?: undefined;
|
|
180
|
+
defaultValue?: undefined;
|
|
181
|
+
autofill?: undefined;
|
|
182
|
+
action?: undefined;
|
|
183
|
+
data?: undefined;
|
|
184
|
+
} | {
|
|
185
|
+
name: string;
|
|
186
|
+
data: {
|
|
187
|
+
values: {
|
|
188
|
+
label: string;
|
|
189
|
+
value: string;
|
|
190
|
+
}[];
|
|
191
|
+
};
|
|
192
|
+
validate: {
|
|
193
|
+
mandatory: boolean;
|
|
194
|
+
minLength?: undefined;
|
|
195
|
+
maxLength?: undefined;
|
|
196
|
+
min?: undefined;
|
|
197
|
+
max?: undefined;
|
|
198
|
+
custom?: undefined;
|
|
199
|
+
type?: undefined;
|
|
200
|
+
};
|
|
201
|
+
inputType: string;
|
|
202
|
+
displayName?: undefined;
|
|
203
|
+
defaultValue?: undefined;
|
|
204
|
+
autofill?: undefined;
|
|
205
|
+
action?: undefined;
|
|
206
|
+
} | {
|
|
207
|
+
name: string;
|
|
208
|
+
validate: {
|
|
209
|
+
mandatory: boolean;
|
|
210
|
+
custom: ({
|
|
211
|
+
rule: string;
|
|
212
|
+
pattern: string;
|
|
213
|
+
errorMessage: string;
|
|
214
|
+
} | {
|
|
215
|
+
rule: string;
|
|
216
|
+
errorMessage: string;
|
|
217
|
+
pattern?: undefined;
|
|
218
|
+
})[];
|
|
219
|
+
minLength?: undefined;
|
|
220
|
+
maxLength?: undefined;
|
|
221
|
+
min?: undefined;
|
|
222
|
+
max?: undefined;
|
|
223
|
+
type?: undefined;
|
|
224
|
+
};
|
|
225
|
+
displayName?: undefined;
|
|
226
|
+
defaultValue?: undefined;
|
|
227
|
+
autofill?: undefined;
|
|
228
|
+
action?: undefined;
|
|
229
|
+
inputType?: undefined;
|
|
230
|
+
data?: undefined;
|
|
231
|
+
} | {
|
|
232
|
+
name: string;
|
|
233
|
+
displayName: string;
|
|
234
|
+
action: any;
|
|
235
|
+
data: {
|
|
236
|
+
values: {
|
|
237
|
+
label: string;
|
|
238
|
+
value: string;
|
|
239
|
+
}[];
|
|
240
|
+
};
|
|
241
|
+
validate: {
|
|
242
|
+
mandatory: boolean;
|
|
243
|
+
minLength?: undefined;
|
|
244
|
+
maxLength?: undefined;
|
|
245
|
+
min?: undefined;
|
|
246
|
+
max?: undefined;
|
|
247
|
+
custom?: undefined;
|
|
248
|
+
type?: undefined;
|
|
249
|
+
};
|
|
250
|
+
inputType: string;
|
|
251
|
+
defaultValue?: undefined;
|
|
252
|
+
autofill?: undefined;
|
|
253
|
+
} | {
|
|
254
|
+
name: string;
|
|
255
|
+
displayName: string;
|
|
256
|
+
data: any;
|
|
257
|
+
action: string;
|
|
258
|
+
validate: {
|
|
259
|
+
mandatory: boolean;
|
|
260
|
+
minLength?: undefined;
|
|
261
|
+
maxLength?: undefined;
|
|
262
|
+
min?: undefined;
|
|
263
|
+
max?: undefined;
|
|
264
|
+
custom?: undefined;
|
|
265
|
+
type?: undefined;
|
|
266
|
+
};
|
|
267
|
+
inputType: string;
|
|
268
|
+
defaultValue?: undefined;
|
|
269
|
+
autofill?: undefined;
|
|
270
|
+
})[];
|
|
19
271
|
actions: string[];
|
|
20
272
|
};
|
|
21
273
|
};
|
|
@@ -41,27 +293,31 @@ export declare class GeneralRegistration {
|
|
|
41
293
|
language: string;
|
|
42
294
|
errorMessage: string;
|
|
43
295
|
emitValue: boolean;
|
|
44
|
-
|
|
296
|
+
isFormValid: boolean;
|
|
45
297
|
listOfInputs: any[];
|
|
298
|
+
isLoading: boolean;
|
|
46
299
|
private registrationID;
|
|
47
300
|
registrationStep: string;
|
|
48
|
-
|
|
49
|
-
listOfInputValues:
|
|
50
|
-
buttonReference: HTMLButtonElement;
|
|
301
|
+
logger(): void;
|
|
302
|
+
listOfInputValues: InputValue[];
|
|
51
303
|
listOfActions: any[];
|
|
52
|
-
|
|
53
|
-
|
|
304
|
+
steps: any[];
|
|
305
|
+
isLastStep: boolean;
|
|
306
|
+
registrationStepsState: {
|
|
307
|
+
regId: any;
|
|
308
|
+
};
|
|
54
309
|
checkInputsValidityHandler(event: CustomEvent<InputStateEvent>): void;
|
|
55
310
|
getInputsValueHandler(event: CustomEvent<InputValueEvent>): void;
|
|
56
|
-
connectedCallback(): void;
|
|
57
311
|
componentWillLoad(): Promise<void>;
|
|
58
312
|
nextHandler(e: any): void;
|
|
313
|
+
backHandler(e: any): void;
|
|
314
|
+
stepsStateMachine(state: StepState): void;
|
|
59
315
|
getRegisterConfig(registrationID?: string): Promise<RegistrationConfig>;
|
|
60
316
|
setRegisterStep(): void;
|
|
61
317
|
setRegister(): void;
|
|
62
318
|
formatConfig(config: RegistrationConfig): void;
|
|
63
319
|
getInvalidStatus(listOfInputs: any): boolean;
|
|
64
|
-
renderInputs():
|
|
320
|
+
renderInputs(): HTMLElement[];
|
|
65
321
|
renderButtons(): HTMLElement;
|
|
66
322
|
render(): any;
|
|
67
323
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@everymatrix/general-registration",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.3",
|
|
4
4
|
"main": "./dist/index.cjs.js",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"es2015": "./dist/esm/index.mjs",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"types": "./dist/types/index.d.ts",
|
|
9
9
|
"collection": "./dist/collection/collection-manifest.json",
|
|
10
10
|
"collection:main": "./dist/collection/index.js",
|
|
11
|
-
"unpkg": "./dist/general-registration/general-registration.
|
|
11
|
+
"unpkg": "./dist/general-registration/general-registration.js",
|
|
12
12
|
"files": [
|
|
13
13
|
"dist/",
|
|
14
14
|
"loader/"
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@everymatrix/general-input": "*"
|
|
20
|
+
"@everymatrix/general-input": "*",
|
|
21
|
+
"@vaadin/date-picker": "^23.1.5",
|
|
22
|
+
"@vaadin/combo-box": "^23.1.5"
|
|
21
23
|
}
|
|
22
|
-
}
|
|
24
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
let e,t,n=!1;const l="undefined"!=typeof window?window:{},s=l.document||{head:{}},o={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},c=e=>Promise.resolve(e),r=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),i=(e,t,n)=>{n&&n.map((([n,l,s])=>{const c=e,r=a(t,s),i=u(n);o.ael(c,l,r,i),(t.o=t.o||[]).push((()=>o.rel(c,l,r,i)))}))},a=(e,t)=>n=>{try{256&e.t?e.i[t](n):(e.u=e.u||[]).push([t,n])}catch(e){J(e)}},u=e=>0!=(2&e),f=new WeakMap,h=e=>"sc-"+e.h,$={},d=e=>"object"==(e=typeof e)||"function"===e,y=(e,t,...n)=>{let l=null,s=!1,o=!1,c=[];const r=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?r(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!d(l))&&(l+=""),s&&o?c[c.length-1].$+=l:c.push(s?m(null,l):l),o=s)};if(r(n),t){const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}const i=m(e,null);return i.m=t,c.length>0&&(i.p=c),i},m=(e,t)=>({t:0,S:e,$:t,g:null,p:null,m:null}),p={},b=(e,t,n,s,c,r)=>{if(n!==s){let i=I(e,t),a=t.toLowerCase();if("class"===t){const t=e.classList,l=S(n),o=S(s);t.remove(...l.filter((e=>e&&!o.includes(e)))),t.add(...o.filter((e=>e&&!l.includes(e))))}else if("ref"===t)s&&s(e);else if(i||"o"!==t[0]||"n"!==t[1]){const l=d(s);if((i||l&&null!==s)&&!c)try{if(e.tagName.includes("-"))e[t]=s;else{let l=null==s?"":s;"list"===t?i=!1:null!=n&&e[t]==l||(e[t]=l)}}catch(e){}null==s||!1===s?!1===s&&""!==e.getAttribute(t)||e.removeAttribute(t):(!i||4&r||c)&&!l&&e.setAttribute(t,s=!0===s?"":s)}else t="-"===t[2]?t.slice(3):I(l,a)?a.slice(2):a[2]+t.slice(3),n&&o.rel(e,t,n,!1),s&&o.ael(e,t,s,!1)}},w=/\s/,S=e=>e?e.split(w):[],g=(e,t,n,l)=>{const s=11===t.g.nodeType&&t.g.host?t.g.host:t.g,o=e&&e.m||$,c=t.m||$;for(l in o)l in c||b(s,l,o[l],void 0,n,t.t);for(l in c)b(s,l,o[l],c[l],n,t.t)},j=(t,n,l)=>{let o,c,r=n.p[l],i=0;if(null!==r.$)o=r.g=s.createTextNode(r.$);else if(o=r.g=s.createElement(r.S),g(null,r,!1),null!=e&&o["s-si"]!==e&&o.classList.add(o["s-si"]=e),r.p)for(i=0;i<r.p.length;++i)c=j(t,r,i),c&&o.appendChild(c);return o},v=(e,n,l,s,o,c)=>{let r,i=e;for(i.shadowRoot&&i.tagName===t&&(i=i.shadowRoot);o<=c;++o)s[o]&&(r=j(null,l,o),r&&(s[o].g=r,i.insertBefore(r,n)))},M=(e,t,n,l,s)=>{for(;t<=n;++t)(l=e[t])&&(s=l.g,O(l),s.remove())},k=(e,t)=>e.S===t.S,C=(e,t)=>{const n=t.g=e.g,l=e.p,s=t.p,o=t.$;null===o?(g(e,t,!1),null!==l&&null!==s?((e,t,n,l)=>{let s,o=0,c=0,r=t.length-1,i=t[0],a=t[r],u=l.length-1,f=l[0],h=l[u];for(;o<=r&&c<=u;)null==i?i=t[++o]:null==a?a=t[--r]:null==f?f=l[++c]:null==h?h=l[--u]:k(i,f)?(C(i,f),i=t[++o],f=l[++c]):k(a,h)?(C(a,h),a=t[--r],h=l[--u]):k(i,h)?(C(i,h),e.insertBefore(i.g,a.g.nextSibling),i=t[++o],h=l[--u]):k(a,f)?(C(a,f),e.insertBefore(a.g,i.g),a=t[--r],f=l[++c]):(s=j(t&&t[c],n,c),f=l[++c],s&&i.g.parentNode.insertBefore(s,i.g));o>r?v(e,null==l[u+1]?null:l[u+1].g,n,l,c,u):c>u&&M(t,o,r)})(n,l,t,s):null!==s?(null!==e.$&&(n.textContent=""),v(n,null,t,s,0,s.length-1)):null!==l&&M(l,0,l.length-1)):e.$!==o&&(n.data=o)},O=e=>{e.m&&e.m.ref&&e.m.ref(null),e.p&&e.p.map(O)},P=(e,t,n)=>{const l=(e=>B(e).j)(e);return{emit:e=>x(l,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},x=(e,t,n)=>{const l=o.ce(t,n);return e.dispatchEvent(l),l},E=(e,t)=>{t&&!e.v&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.v=t)))},L=(e,t)=>{if(e.t|=16,!(4&e.t))return E(e,e.M),se((()=>N(e,t)));e.t|=512},N=(e,t)=>{const n=e.i;let l;return t&&(e.t|=256,e.u&&(e.u.map((([e,t])=>R(n,e,t))),e.u=null),l=R(n,"componentWillLoad")),U(l,(()=>T(e,n,t)))},T=async(e,t,n)=>{const l=e.j,o=l["s-rc"];n&&(e=>{const t=e.k,n=e.j,l=t.t,o=((e,t)=>{let n=h(t),l=X.get(n);if(e=11===e.nodeType?e:s,l)if("string"==typeof l){let t,o=f.get(e=e.head||e);o||f.set(e,o=new Set),o.has(n)||(t=s.createElement("style"),t.innerHTML=l,e.insertBefore(t,e.querySelector("link")),o&&o.add(n))}else e.adoptedStyleSheets.includes(l)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,l]);return n})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"))})(e);W(e,t),o&&(o.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>A(e);0===t.length?n():(Promise.all(t).then(n),e.t|=4,t.length=0)}},W=(n,l)=>{try{l=l.render(),n.t&=-17,n.t|=2,((n,l)=>{const s=n.j,o=n.C||m(null,null),c=(e=>e&&e.S===p)(l)?l:y(null,null,l);t=s.tagName,c.S=null,c.t|=4,n.C=c,c.g=o.g=s.shadowRoot||s,e=s["s-sc"],C(o,c)})(n,l)}catch(e){J(e,n.j)}return null},A=e=>{const t=e.j,n=e.M;64&e.t||(e.t|=64,q(t),e.O(t),n||F()),e.v&&(e.v(),e.v=void 0),512&e.t&&le((()=>L(e,!1))),e.t&=-517},F=()=>{q(s.documentElement),le((()=>x(l,"appload",{detail:{namespace:"general-registration"}})))},R=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){J(e)}},U=(e,t)=>e&&e.then?e.then(t):t(),q=e=>e.classList.add("hydrated"),H=(e,t,n)=>{if(t.P){e.watchers&&(t.L=e.watchers);const l=Object.entries(t.P),s=e.prototype;if(l.map((([e,[l]])=>{(31&l||2&n&&32&l)&&Object.defineProperty(s,e,{get(){return((e,t)=>B(this).N.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=B(e),o=s.j,c=s.N.get(t),r=s.t,i=s.i;if(n=((e,t)=>null==e||d(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(n,l.P[t][0]),(!(8&r)||void 0===c)&&n!==c&&(!Number.isNaN(c)||!Number.isNaN(n))&&(s.N.set(t,n),i)){if(l.L&&128&r){const e=l.L[t];e&&e.map((e=>{try{i[e](n,c,t)}catch(e){J(e,o)}}))}2==(18&r)&&L(s,!1)}})(this,e,n,t)},configurable:!0,enumerable:!0})})),1&n){const t=new Map;s.attributeChangedCallback=function(e,n,l){o.jmp((()=>{const n=t.get(e);if(this.hasOwnProperty(n))l=this[n],delete this[n];else if(s.hasOwnProperty(n)&&"number"==typeof this[n]&&this[n]==l)return;this[n]=(null!==l||"boolean"!=typeof this[n])&&l}))},e.observedAttributes=l.filter((([e,t])=>15&t[0])).map((([e,n])=>{const l=n[1]||e;return t.set(l,e),l}))}}return e},V=e=>{R(e,"connectedCallback")},_=(e,t={})=>{const n=[],c=t.exclude||[],a=l.customElements,u=s.head,f=u.querySelector("meta[charset]"),$=s.createElement("style"),d=[];let y,m=!0;Object.assign(o,t),o.l=new URL(t.resourcesUrl||"./",s.baseURI).href,e.map((e=>{e[1].map((t=>{const l={t:t[0],h:t[1],P:t[2],T:t[3]};l.P=t[2],l.T=t[3],l.L={};const s=l.h,u=class extends HTMLElement{constructor(e){super(e),G(e=this,l),1&l.t&&e.attachShadow({mode:"open"})}connectedCallback(){y&&(clearTimeout(y),y=null),m?d.push(this):o.jmp((()=>(e=>{if(0==(1&o.t)){const t=B(e),n=t.k,l=()=>{};if(1&t.t)i(e,t,n.T),V(t.i);else{t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){E(t,t.M=n);break}}n.P&&Object.entries(n.P).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n,l,s)=>{if(0==(32&t.t)){{if(t.t|=32,(s=Q(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(n.L=s.watchers,H(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){J(e)}t.t&=-9,t.t|=128,e(),V(t.i)}if(s.style){let e=s.style;const t=h(n);if(!X.has(t)){const l=()=>{};((e,t,n)=>{let l=X.get(e);r&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,X.set(e,l)})(t,e,!!(1&n.t)),l()}}}const o=t.M,c=()=>L(t,!0);o&&o["s-rc"]?o["s-rc"].push(c):c()})(0,t,n)}l()}})(this)))}disconnectedCallback(){o.jmp((()=>(()=>{if(0==(1&o.t)){const e=B(this);e.o&&(e.o.map((e=>e())),e.o=void 0)}})()))}componentOnReady(){return B(this).W}};l.A=e[0],c.includes(s)||a.get(s)||(n.push(s),a.define(s,H(u,l,1)))}))})),$.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",$.setAttribute("data-styles",""),u.insertBefore($,f?f.nextSibling:u.firstChild),m=!1,d.length?d.map((e=>e.connectedCallback())):o.jmp((()=>y=setTimeout(F,30)))},z=new WeakMap,B=e=>z.get(e),D=(e,t)=>z.set(t.i=e,t),G=(e,t)=>{const n={t:0,j:e,k:t,N:new Map};return n.W=new Promise((e=>n.O=e)),e["s-p"]=[],e["s-rc"]=[],i(e,n,t.T),z.set(e,n)},I=(e,t)=>t in e,J=(e,t)=>(0,console.error)(e,t),K=new Map,Q=e=>{const t=e.h.replace(/-/g,"_"),n=e.A,l=K.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(K.set(n,e),e[t])),J)},X=new Map,Y=[],Z=[],ee=(e,t)=>l=>{e.push(l),n||(n=!0,t&&4&o.t?le(ne):o.raf(ne))},te=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){J(e)}e.length=0},ne=()=>{te(Y),te(Z),(n=Y.length>0)&&o.raf(ne)},le=e=>c().then(e),se=ee(Z,!0);export{_ as b,P as c,y as h,c as p,D as r}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as i,h as e}from"./p-0e7175cd.js";const s=["ro","en"],a={en:{dateError:"The selected date should be between {min} and {max}",numberLengthError:"The number should be between ${min} and ${max}",lengthError:"The length should be between {minLength} and {maxLength}",requiredError:"This input is required.",nextButton:"Next",backButton:"Back"},ro:{lengthError:"Cuvântul introdus este prea scurt. {minLength} and {maxLength}",requiredError:"Acest câmp este obligatoriu."}},r=(t,i,e)=>{const r=i;let n=a[void 0!==r&&s.includes(r)?r:"en"][t];if(void 0!==e)for(const[t,i]of Object.entries(e.values)){const e=new RegExp(`{${t}}`,"g");n=n.replace(e,i)}return n},n=class{constructor(e){t(this,e),this.sendValidityState=i(this,"sendValidityState",7),this.sendInputValue=i(this,"sendInputValue",7)}validityChanged(){this.validityStateHandler({valid:this.isValid,name:this.name}),1==this.emitValue&&this.valueHandler({name:this.name,value:this.value})}validityStateHandler(t){this.sendValidityState.emit(t)}emitValueHandler(t){1==t&&this.isValid&&this.valueHandler({name:this.name,value:this.value})}valueHandler(t){this.sendInputValue.emit(t)}connectedCallback(){}handleClick(){this.value=this.inputReference.checked,this.errorMessage=this.setErrorMessage(),this.isValid=this.setValidity(),this.validityStateHandler({valid:this.isValid,name:this.name})}setValidity(){return this.inputReference.validity.valid}setErrorMessage(){if(this.inputReference.validity.valueMissing)return r("requiredError",this.language)}render(){return e("div",{class:"checkbox__wrapper"},e("input",{type:"checkbox",id:`${this.name}__input`,ref:t=>this.inputReference=t,name:this.name,required:this.validation.mandatory,value:"jdjdj",onClick:()=>this.handleClick()}),e("label",{htmlFor:`${this.name}__input`},this.displayName," ",this.validation.mandatory?"*":""),e("small",{class:"checkbox__error-message"},this.errorMessage))}static get watchers(){return{isValid:["validityChanged"],emitValue:["emitValueHandler"]}}};n.style="*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.checkbox__wrapper{display:flex;gap:10px;position:relative;align-items:baseline}.checkbox__error-message{position:absolute;top:calc(100% + 5px);left:0;color:red}";const l=class{constructor(e){t(this,e),this.sendValidityState=i(this,"sendValidityState",7),this.sendInputValue=i(this,"sendInputValue",7)}checkValidityHandler(t){1==t&&(this.isValid=this.setValidity(),this.errorMessage=this.setErrorMessage(),this.validityStateHandler({valid:this.isValid,name:this.name}))}validityChanged(){1==this.checkValidity&&this.validityStateHandler({valid:this.isValid,name:this.name}),1==this.emitValue&&this.valueHandler({name:this.name,value:this.value})}validityStateHandler(t){this.sendValidityState.emit(t)}emitValueHandler(t){1==t&&this.isValid&&this.valueHandler({name:this.name,value:this.value})}valueHandler(t){this.sendInputValue.emit(t)}handleInput(t){this.value=t.target.value,this.errorMessage=this.setErrorMessage(),this.isValid=this.setValidity()}setValidity(){return this.inputReference.validity.valid}setErrorMessage(){return this.inputReference.validity.rangeUnderflow||this.inputReference.validity.rangeOverflow?r("dateError",this.language,{values:{min:this.validation.min,max:this.validation.max}}):this.inputReference.validity.valueMissing?r("requiredError",this.language):void 0}render(){return e("div",{class:"date__wrapper"},e("input",{id:`${this.name}__input`,type:"date",class:"date__input",value:this.defaultValue,placeholder:`${this.displayName} ${this.validation.mandatory?"*":""}`,ref:t=>this.inputReference=t,required:this.validation.mandatory,max:this.validation.max,min:this.validation.min,onInput:t=>this.handleInput(t)}),e("label",{class:`date__label ${this.validation.mandatory?"date__label--required":""}}`,htmlFor:`${this.name}__input`},this.displayName," ",this.validation.mandatory?"*":""),e("small",{class:"date__error-message"},this.errorMessage))}static get watchers(){return{checkValidity:["checkValidityHandler"],isValid:["validityChanged"],emitValue:["emitValueHandler"]}}};l.style='*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.date__wrapper{position:relative;display:flex;flex-direction:column-reverse;padding-top:10px}.date__label{color:#474747;font-size:16px;position:absolute;bottom:15px;left:5px;transform:translateY(-25px);transition:all 0.3s cubic-bezier(0.5, 0, 0.5, 1)}.date__label--required::after{content:"*";margin-left:5px;color:#666666}.date__input{width:inherit;padding:15px 6px;position:relative;border:none;border-bottom:3px solid #666666;background-color:transparent;color:#666666;font-size:16px;font-family:inherit}.date__input:focus{outline:none;box-shadow:0 5px 5px rgba(16, 15, 15, 0.1)}.date__input::placeholder{color:#666666}.date__input--invalid{border-bottom:3px solid #cc0000}.date__input:placeholder-shown+.date__label{opacity:0;visibility:hidden;transform:translateY(0)}.date__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000}';const o=class{constructor(e){t(this,e),this.sendValidityState=i(this,"sendValidityState",7),this.sendInputValue=i(this,"sendInputValue",7),this.validationPattern=""}checkValidityHandler(t){1==t&&(this.isValid=this.setValidity(),this.errorMessage=this.setErrorMessage(),this.validityStateHandler({valid:this.isValid,name:this.name}))}validityChanged(){1==this.checkValidity&&this.validityStateHandler({valid:this.isValid,name:this.name}),1==this.emitValue&&this.valueHandler({name:this.name,value:this.value})}validityStateHandler(t){this.sendValidityState.emit(t)}emitValueHandler(t){1==t&&this.isValid&&this.valueHandler({name:this.name,value:this.value})}valueHandler(t){this.sendInputValue.emit(t)}connectedCallback(){this.validationPattern=this.setPattern()}handleInput(t){this.value=t.target.value,this.debounceTime&&clearTimeout(this.debounceTime),this.debounceTime=setTimeout((()=>{this.errorMessage=this.setErrorMessage(),this.isValid=this.setValidity()}),500)}setValidity(){return this.inputReference.validity.valid}setPattern(){var t;if((null===(t=this.validation.custom)||void 0===t?void 0:t.length)>0)return this.validation.custom.find((t=>"regex"===t.rule)).pattern}setErrorMessage(){return this.inputReference.validity.patternMismatch?this.validation.custom.find((t=>"regex"===t.rule)).errorMessage:this.inputReference.validity.tooShort||this.inputReference.validity.tooLong?r("lengthError",this.language,{values:{minLength:this.validation.minLength,maxLength:this.validation.maxLength}}):this.inputReference.validity.valueMissing?r("requiredError",this.language):void 0}render(){return e("div",{class:"email__wrapper"},e("input",{id:`${this.name}__input`,type:"email",class:"email__input",value:this.defaultValue,placeholder:`${this.displayName} ${this.validation.mandatory?"*":""}`,ref:t=>this.inputReference=t,pattern:this.validationPattern,required:this.validation.mandatory,minlength:this.validation.minLength,maxlength:this.validation.maxLength,onInput:t=>this.handleInput(t)}),e("label",{class:"email__label "+(this.validation.mandatory?"email__label--required":""),htmlFor:`${this.name}__input`},this.displayName),e("small",{class:"email__error-message"},this.errorMessage))}static get watchers(){return{checkValidity:["checkValidityHandler"],isValid:["validityChanged"],emitValue:["emitValueHandler"]}}};o.style='*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.email__wrapper{position:relative;display:flex;flex-direction:column-reverse;padding-top:10px}.email__label{color:#474747;font-size:16px;position:absolute;bottom:15px;left:5px;transform:translateY(-25px);transition:all 0.3s cubic-bezier(0.5, 0, 0.5, 1)}.email__label--required::after{content:"*";margin-left:5px;color:#666666}.email__input{width:inherit;padding:15px 6px;position:relative;border:none;border-bottom:3px solid #666666;background-color:transparent;color:#666666;font-size:16px;font-family:inherit}.email__input:focus{outline:none;box-shadow:0 5px 5px rgba(16, 15, 15, 0.1)}.email__input::placeholder{color:#666666}.email__input--invalid{border-bottom:3px solid #cc0000}.email__input:placeholder-shown+.email__label{opacity:0;visibility:hidden;transform:translateY(0)}.email__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000}';const h=class{constructor(i){t(this,i),this.type="text"}render(){switch(this.type.toLowerCase()){case"text":return e("text-input",{name:this.name,displayName:this.displayName,validation:this.validation,defaultValue:this.defaultValue,emitValue:this.emitValue,language:this.language});case"email":return e("email-input",{name:this.name,displayName:this.displayName,validation:this.validation,defaultValue:this.defaultValue,emitValue:this.emitValue,language:this.language});case"number":return e("number-input",{name:this.name,displayName:this.displayName,validation:this.validation,defaultValue:this.defaultValue,emitValue:this.emitValue,language:this.language});case"checkbox":return e("checkbox-input",{name:this.name,displayName:this.displayName,validation:this.validation,emitValue:this.emitValue,language:this.language});case"datetime":return e("date-input",{name:this.name,displayName:this.displayName,validation:this.validation,defaultValue:this.defaultValue,emitValue:this.emitValue,language:this.language});case"password":return e("password-input",{name:this.name,displayName:this.displayName,validation:this.validation,emitValue:this.emitValue,language:this.language});case"radio":return e("radio-input",{name:this.name,displayName:this.displayName,optionsGroup:this.options,validation:this.validation,emitValue:this.emitValue,language:this.language});case"tel":return e("tel-input",{name:this.name,action:this.action,displayName:this.displayName,validation:this.validation,defaultValue:this.defaultValue,emitValue:this.emitValue,language:this.language});case"dropdown":return e("select-input",{name:this.name,action:this.action,displayName:this.displayName,options:this.options,validation:this.validation,emitValue:this.emitValue,language:this.language});default:return e("p",null,"The ",this.type," input type is not valid")}}};h.style=":host{display:block}";const d=["ro","en"],p={en:{dateError:"The selected date should be between {min} and {max}",numberLengthError:"The number should be between ${min} and ${max}",lengthError:"The length should be between {minLength} and {maxLength}",requiredError:"This input is required.",nextButton:"Next",backButton:"Back"},ro:{lengthError:"Cuvântul introdus este prea scurt. {minLength} and {maxLength}",requiredError:"Acest câmp este obligatoriu."}},u=(t,i,e)=>{const s=i;let a=p[void 0!==s&&d.includes(s)?s:"en"][t];if(void 0!==e)for(const[t,i]of Object.entries(e.values)){const e=new RegExp(`{${t}}`,"g");a=a.replace(e,i)}return a},c=class{constructor(i){t(this,i),this.data={type:"default",content:{step:"step1",fields:[{name:"firstName",displayName:"Username",defaultValue:null,validate:{mandatory:!0,minLength:3,maxLength:20},autofill:!1},{name:"firstName",displayName:"Username",defaultValue:null,validate:{mandatory:!0,minLength:3,maxLength:20},autofill:!1}],actions:["get-next-step","some-async-action-before-submitting","submit-step-data"]}},this.language="en",this.emitValue=!1,this.listOfInputs=[],this.isLoading=!1,this.listOfInputValues=[],this.listOfActions=[],this.actionsStepIndex=0}validityStateHandler(){console.log("bababa",this.isFormValid),this.buttonReference.disabled=!this.isFormValid}checkInputsValidityHandler(t){console.log("se ajunge aici"),this.listOfInputs.find((i=>i.name==t.detail.name)).isValid=t.detail.valid,this.isFormValid=!this.getInvalidStatus(this.listOfInputs)}getInputsValueHandler(t){console.log("sendInputValue"),this.listOfInputValues.find((i=>i.name==t.detail.name)).inputValue=t.detail.value}connectedCallback(){}componentWillLoad(){return this.getRegisterConfig().then((t=>{this.formatConfig(t)}))}nextHandler(t){t.preventDefault(),this.emitValue=!0,this.isFormValid&&this.setRegisterStep()}getRegisterConfig(t){const i=new URL(`${this.endpoint}/api/v1.0/registerCfg/`),e=new Headers;e.append("X-Tenant-ID",this.tenantId),e.append("X-Client-ID",this.clientId),e.append("X-Api-Key",this.apiKey),e.append("Content-Type","application/json"),e.append("Accept","application/json"),t&&i.searchParams.append("registrationId",t);const s={method:"GET",headers:e};return new Promise(((t,e)=>{this.isLoading=!0,fetch(i.href,s).then((t=>t.json())).then((i=>{t(i)})).catch((t=>{console.error(t),e(t)})).finally((()=>{this.isLoading=!1}))}))}setRegisterStep(){this.emitValue=!1;const t=new URL(`${this.endpoint}/api/v1.0/registerStep/`),i={registrationId:this.registrationID,registerUserDto:this.listOfInputValues.reduce(((t,i)=>(t[i.name]=i.inputValue,t)),{}),step:this.registrationStep},e=new Headers;e.append("X-Tenant-ID",this.tenantId),e.append("X-Client-ID",this.clientId),e.append("X-Api-Key",this.apiKey),e.append("Content-Type","application/json"),e.append("Accept","application/json");const s={method:"POST",body:JSON.stringify(i),headers:e};fetch(t.href,s).then((t=>{if(t.status>=300)throw new Error("err")})).then((t=>{this.registrationID=t.registrationId,this.listOfActions.some((t=>"/register"==t))?this.setRegister():this.getRegisterConfig(this.registrationID).then((t=>this.formatConfig(t)))})).catch((t=>{console.error(t)}))}setRegister(){const t=new URL(`${this.endpoint}/api/v1.0/register/`),i=new Headers;i.append("X-Tenant-ID",this.tenantId),i.append("X-Client-ID",this.clientId),i.append("X-Api-Key",this.apiKey),i.append("Content-Type","application/json"),i.append("Accept","application/json");const e={registrationId:this.registrationID,registerUserDto:this.listOfInputValues.reduce(((t,i)=>(t[i.name]=i.inputValue,t)),{}),step:this.registrationStep},s={method:"POST",body:JSON.stringify(e),headers:i};fetch(t.href,s).then((t=>{if(t.status>=300)throw new Error("err")})).then((t=>{console.log(t)})).catch((t=>{console.log(t)}))}formatConfig(t){this.listOfInputs=t.content.fields.map((t=>Object.assign(Object.assign({},t),{isValid:!1}))),this.listOfInputValues=t.content.fields.map((t=>({name:t.name,inputValue:null}))),this.listOfActions=t.content.actions.map((t=>t)),this.registrationID=t.content.registrationID,this.registrationStep=t.content.step}getInvalidStatus(t){return t.filter((t=>0==t.isValid)).length>0}renderInputs(){return this.listOfInputs.map((t=>e("general-input",{type:t.inputType,name:t.name,displayName:t.displayName,validation:t.validate,action:t.action||null,options:t.data?t.data.values:[],defaultValue:t.defaultValue,emitValue:this.emitValue,language:this.language})))}renderButtons(){return e("div",{class:"registration__buttons-wrapper"},e("button",{class:"registration__button",type:"submit",form:"RegistrationForm",onClick:t=>this.nextHandler(t),ref:t=>this.buttonReference=t},u("nextButton",this.language)),e("button",{class:"registration__button"},u("backButton",this.language)))}render(){return e("div",{class:"registration"},e("form",{action:".",id:"RegistrationForm",class:"registration__form"},this.renderInputs()),this.renderButtons())}static get watchers(){return{isFormValid:["validityStateHandler"]}}};c.style="*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.registration{display:flex;flex-direction:column;gap:20px;width:100%;height:100%}.registration__form{display:grid;grid-template-columns:repeat(2, minmax(min-content, 1fr));column-gap:65px;row-gap:30px;justify-items:stretch;align-content:flex-start;overflow:scroll;width:100%;height:100%}.registration__buttons-wrapper{display:flex;flex-direction:row-reverse;justify-content:space-between}.registration__button{background-color:#e69200;border-radius:30px;text-transform:uppercase;padding:10px 50px;border:none;box-shadow:0px 2px 2px rgba(0, 0, 0, 0.5)}.registration__button--disabled{background-color:grey}.registration__button--done{background-color:#176317}";const m=class{constructor(e){t(this,e),this.sendValidityState=i(this,"sendValidityState",7),this.sendInputValue=i(this,"sendInputValue",7)}checkValidityHandler(t){1==t&&(this.isValid=this.setValidity(),this.errorMessage=this.setErrorMessage(),this.validityStateHandler({valid:this.isValid,name:this.name}))}validityChanged(){1==this.checkValidity&&this.validityStateHandler({valid:this.isValid,name:this.name}),1==this.emitValue&&this.valueHandler({name:this.name,value:this.value})}validityStateHandler(t){this.sendValidityState.emit(t)}emitValueHandler(t){1==t&&this.isValid&&this.valueHandler({name:this.name,value:this.value})}valueHandler(t){this.sendInputValue.emit(t)}handleInput(t){this.value=t.target.value,this.debounceTime&&clearTimeout(this.debounceTime),this.debounceTime=setTimeout((()=>{this.errorMessage=this.setErrorMessage(),this.isValid=this.setValidity()}),500)}setValidity(){return this.inputReference.validity.valid}setErrorMessage(){return this.inputReference.validity.rangeUnderflow||this.inputReference.validity.rangeOverflow?r("numberLengthError",this.language,{values:{min:this.validation.min,max:this.validation.max}}):this.inputReference.validity.valueMissing?r("requiredError",this.language):void 0}render(){return e("div",{class:"number__wrapper"},e("input",{ref:t=>this.inputReference=t,type:"number",value:this.defaultValue,id:`${this.name}__input`,class:"number__input "+(1==this.isValid||null==this.isValid?"":"number__input--invalid"),placeholder:`${this.displayName} ${this.validation.mandatory?"*":""}`,required:this.validation.mandatory,max:this.validation.max,min:this.validation.min,onInput:t=>this.handleInput(t)}),e("label",{class:"number__label "+(this.validation.mandatory?"number__label--required":""),htmlFor:`${this.name}__input`},this.displayName),e("small",{class:"number__error-message"},this.errorMessage))}static get watchers(){return{checkValidity:["checkValidityHandler"],isValid:["validityChanged"],emitValue:["emitValueHandler"]}}};m.style='*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.number__wrapper{position:relative;display:flex;flex-direction:column-reverse;padding-top:10px}.number__label{color:#474747;font-size:16px;position:absolute;bottom:15px;left:5px;transform:translateY(-25px);transition:all 0.3s cubic-bezier(0.5, 0, 0.5, 1)}.number__label--required::after{content:"*";margin-left:5px;color:#666666}.number__input{width:inherit;padding:15px 6px;position:relative;border:none;border-bottom:3px solid #666666;background-color:transparent;color:#666666;font-size:16px;font-family:inherit;-moz-appearance:textfield;}.number__input::-webkit-outer-spin-button,.number__input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.number__input:focus{outline:none;box-shadow:0 5px 5px rgba(16, 15, 15, 0.1)}.number__input::placeholder{color:#666666}.number__input--invalid{border-bottom:3px solid #cc0000}.number__input:placeholder-shown+.number__label{opacity:0;visibility:hidden;transform:translateY(0)}.number__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000}';const _=class{constructor(e){t(this,e),this.sendValidityState=i(this,"sendValidityState",7),this.sendInputValue=i(this,"sendInputValue",7),this.validationPattern=""}validityChanged(){this.validityStateHandler({valid:this.isValid,name:this.name}),1==this.emitValue&&this.valueHandler({name:this.name,value:this.value})}validityStateHandler(t){this.sendValidityState.emit(t)}emitValueHandler(t){1==t&&this.isValid&&this.valueHandler({name:this.name,value:this.value})}valueHandler(t){this.sendInputValue.emit(t)}connectedCallback(){this.validationPattern=this.setPattern()}handleInput(t){this.value=t.target.value,this.errorMessage=this.setErrorMessage(),this.isValid=this.setValidity(),this.validityStateHandler({valid:this.isValid,name:this.name})}setValidity(){return this.inputReference.validity.valid}setPattern(){var t;if((null===(t=this.validation.custom)||void 0===t?void 0:t.length)>0)return this.validation.custom.find((t=>"regex"===t.rule)).pattern}setErrorMessage(){return this.inputReference.validity.patternMismatch?this.validation.custom.find((t=>"regex"===t.rule)).errorMessage:this.inputReference.validity.tooShort||this.inputReference.validity.tooLong?r("lengthError",this.language,{values:{minLength:this.validation.minLength,maxLength:this.validation.maxLength}}):this.inputReference.validity.valueMissing?r("requiredError",this.language):void 0}render(){return e("div",{class:"password__wrapper"},e("input",{type:"password",id:`${this.name}__input`,class:"password__input "+(1==this.isValid||null==this.isValid?"":"password__input--invalid"),name:this.name,ref:t=>this.inputReference=t,required:this.validation.mandatory,maxlength:this.validation.maxLength,minlength:this.validation.minLength,pattern:this.validationPattern,placeholder:`${this.displayName} ${this.validation.mandatory?"*":""}`,onBlur:t=>this.handleInput(t)}),e("label",{class:"password__label "+(this.validation.mandatory?"password__label--required":""),htmlFor:`${this.name}__input`},this.displayName),e("small",{class:"password__error-message"},this.errorMessage))}static get watchers(){return{isValid:["validityChanged"],emitValue:["emitValueHandler"]}}};_.style='*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.password__wrapper{position:relative;display:flex;flex-direction:column-reverse;padding-top:10px}.password__label{color:#474747;font-size:16px;position:absolute;bottom:15px;left:5px;transform:translateY(-25px);transition:all 0.3s cubic-bezier(0.5, 0, 0.5, 1)}.password__label--required::after{content:"*";margin-left:5px;color:#666666}.password__input{width:inherit;padding:15px 6px;position:relative;border:none;border-bottom:3px solid #666666;background-color:transparent;color:#666666;font-size:16px;font-family:inherit}.password__input:focus{outline:none;box-shadow:0 5px 5px rgba(16, 15, 15, 0.1)}.password__input::placeholder{color:#666666}.password__input--invalid{border-bottom:3px solid #cc0000}.password__input:placeholder-shown+.password__label{opacity:0;visibility:hidden;transform:translateY(0)}.password__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000}';const b=class{constructor(e){t(this,e),this.sendInputValue=i(this,"sendInputValue",7),this.sendValidityState=i(this,"sendValidityState",7)}checkValidityHandler(t){1==t&&(this.isValid=this.setValidity(),this.errorMessage=this.setErrorMessage(),this.validityStateHandler({valid:this.isValid,name:this.name}))}validityChanged(){1==this.checkValidity&&this.validityStateHandler({valid:this.isValid,name:this.name}),1==this.emitValue&&this.valueHandler({name:this.name,value:this.value})}emitValueHandler(t){1==t&&this.isValid&&this.valueHandler({name:this.name,value:this.value})}valueHandler(t){this.sendInputValue.emit(t)}validityStateHandler(t){this.sendValidityState.emit(t)}connectedCallback(){}handleClick(t){this.value=t.target.value,this.isValid=this.setValidity(),this.errorMessage=this.setErrorMessage()}setValidity(){return this.inputReference.validity.valid}setErrorMessage(){if(this.inputReference.validity.valueMissing)return r("requiredError",this.language)}render(){return e("fieldset",{class:"radio__fieldset"},e("legend",{class:"radio__legend"},this.displayName,":"),this.optionsGroup.map((t=>e("div",{class:"radio__wrapper"},e("input",{type:"radio",class:"radio__input",id:`${t.label}__input`,ref:t=>this.inputReference=t,value:t.value,name:this.name,required:this.validation.mandatory,onClick:t=>this.handleClick(t)}),e("label",{htmlFor:`${t.label}__input`},t.label)))),e("small",{class:"radio__error-message"},this.errorMessage))}static get watchers(){return{checkValidity:["checkValidityHandler"],isValid:["validityChanged"],emitValue:["emitValueHandler"]}}};b.style="*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.radio__fieldset{border:none;position:relative}.radio__wrapper{display:flex;gap:5px}.radio__error-message{position:absolute;top:calc(100% + 5px);left:0;color:red}";const g=class{constructor(e){t(this,e),this.sendValidityState=i(this,"sendValidityState",7),this.sendInputValue=i(this,"sendInputValue",7),this.options=[]}checkValidityHandler(t){1==t&&(this.isValid=this.setValidity(),this.errorMessage=this.setErrorMessage(),this.validityStateHandler({valid:this.isValid,name:this.name}))}validityChanged(){1==this.checkValidity&&this.validityStateHandler({valid:this.isValid,name:this.name}),1==this.emitValue&&this.valueHandler({name:this.name,value:this.value})}validityStateHandler(t){this.sendValidityState.emit(t)}emitValueHandler(t){1==t&&this.isValid&&this.valueHandler({name:this.name,value:this.value})}valueHandler(t){this.sendInputValue.emit(t)}connectedCallback(){this.displayedOptions=this.options,console.log(this.displayedOptions)}componentWillLoad(){if(console.log(this.action,this.options),this.action&&!this.options.length&&"GET"==this.action.split(" ")[0])return this.getOptions().then((t=>{this.displayedOptions=t.countries.map((t=>({label:t.Name,value:t.Alpha2Code})))}))}getOptions(){const t=new URL("https://demo-api.stage.norway.everymatrix.com/v1/player/countries");return new Promise(((i,e)=>{fetch(t.href).then((t=>t.json())).then((t=>{i(t)})).catch((t=>{console.error(t),e(t)}))}))}handleChange(t){this.value=t.target.value,this.errorMessage=this.setErrorMessage(),this.isValid=this.setValidity(),this.inputReference.previousElementSibling.classList.remove("select__label--hidden"),console.log(this.action,this.options)}setValidity(){return this.inputReference.validity.valid}setErrorMessage(){if(this.inputReference.validity.valueMissing)return r("requiredError",this.language)}render(){return console.log("RENDER"),e("div",{class:"select__wrapper"},e("label",{class:"select__label select__label--hidden",htmlFor:`${this.name}__input`},this.displayName,":"),e("select",{ref:t=>this.inputReference=t,name:this.name,id:`${this.name}__input`,required:this.validation.mandatory,class:"select__input",onChange:t=>this.handleChange(t)},e("option",{value:"",selected:!0,disabled:!0}," ",this.displayName," "),this.displayedOptions.map((t=>e("option",{value:t.value}," ",t.label," ")))),e("small",{class:"select__error-message"},this.errorMessage))}static get watchers(){return{checkValidity:["checkValidityHandler"],isValid:["validityChanged"],emitValue:["emitValueHandler"]}}};g.style="*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.select__wrapper{position:relative;display:flex;padding-top:10px;width:100%}.select__label{color:#474747;font-size:16px;position:absolute;bottom:15px;left:5px;transform:translateY(-25px);transition:all 0.3s cubic-bezier(0.5, 0, 0.5, 1)}.select__label--hidden{opacity:0;visibility:hidden;transform:translateY(0)}.select__input{width:inherit;padding:15px 6px;position:relative;border:none;border-bottom:3px solid #666666;background-color:transparent;color:#666666;font-size:16px;font-family:inherit}.select__input:focus{outline:none;box-shadow:0 5px 5px rgba(16, 15, 15, 0.1)}.select__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000}";const x=class{constructor(e){t(this,e),this.sendValidityState=i(this,"sendValidityState",7),this.sendInputValue=i(this,"sendInputValue",7),this.validationPattern=""}checkValidityHandler(t){1==t&&(this.isValid=this.setValidity(),this.errorMessage=this.setErrorMessage(),this.validityStateHandler({valid:this.isValid,name:this.name}))}validityChanged(){1==this.checkValidity&&this.validityStateHandler({valid:this.isValid,name:this.name}),1==this.emitValue&&this.valueHandler({name:this.name,value:this.value})}validityStateHandler(t){this.sendValidityState.emit(t)}emitValueHandler(t){1==t&&this.isValid&&this.valueHandler({name:this.name,value:this.value})}valueHandler(t){this.sendInputValue.emit(t)}connectedCallback(){this.validationPattern=this.setPattern()}handleInput(t){this.value=t.target.value,this.debounceTime&&clearTimeout(this.debounceTime),this.debounceTime=setTimeout((()=>{this.errorMessage=this.setErrorMessage(),this.isValid=this.setValidity()}),500)}setValidity(){return this.inputReference.validity.valid}setPattern(){var t;if((null===(t=this.validation.custom)||void 0===t?void 0:t.length)>0)return this.validation.custom.find((t=>"regex"===t.rule)).pattern}setErrorMessage(){return this.inputReference.validity.patternMismatch?this.validation.custom.find((t=>"regex"===t.rule)).errorMessage:this.inputReference.validity.tooShort||this.inputReference.validity.tooLong?r("lengthError",this.language,{values:{minLength:this.validation.minLength,maxLength:this.validation.maxLength}}):this.inputReference.validity.valueMissing?r("requiredError",this.language):void 0}render(){return e("div",{class:"tel__wrapper"},e("input",{type:"tel",ref:t=>this.inputReference=t,id:`${this.name}__input`,value:this.defaultValue,class:"tel__input "+(1==this.isValid||null==this.isValid?"":"tel__input--invalid"),placeholder:`${this.displayName} ${this.validation.mandatory?"*":""}`,required:this.validation.mandatory,minlength:this.validation.minLength,maxlength:this.validation.maxLength,pattern:this.validationPattern,onInput:t=>this.handleInput(t)}),e("label",{class:"tel__label "+(this.validation.mandatory?"tel__label--required":""),htmlFor:`${this.name}__input`},this.displayName),e("small",{class:"tel__error-message"},this.errorMessage))}static get watchers(){return{checkValidity:["checkValidityHandler"],isValid:["validityChanged"],emitValue:["emitValueHandler"]}}};x.style='*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.tel__wrapper{position:relative;display:flex;flex-direction:column-reverse;padding-top:10px}.tel__label{color:#474747;font-size:16px;position:absolute;bottom:15px;left:5px;transform:translateY(-25px);transition:all 0.3s cubic-bezier(0.5, 0, 0.5, 1)}.tel__label--required::after{content:"*";margin-left:5px;color:#666666}.tel__input{width:inherit;padding:15px 6px;position:relative;border:none;border-bottom:3px solid #666666;background-color:transparent;color:#666666;font-size:16px;font-family:inherit;-moz-appearance:textfield;}.tel__input::-webkit-outer-spin-button,.tel__input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.tel__input:focus{outline:none;box-shadow:0 5px 5px rgba(16, 15, 15, 0.1)}.tel__input::placeholder{color:#666666}.tel__input--invalid{border-bottom:3px solid #cc0000}.tel__input:placeholder-shown+.tel__label{opacity:0;visibility:hidden;transform:translateY(0)}.tel__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000}';const v=class{constructor(e){t(this,e),this.sendValidityState=i(this,"sendValidityState",7),this.sendInputValue=i(this,"sendInputValue",7),this.defaultValue="",this.errorMessage="",this.value="",this.customRules=[],this.validationPattern=""}validityChanged(){1==this.emitValue&&this.valueHandler({name:this.name,value:this.value})}validityStateHandler(t){this.sendValidityState.emit(t)}emitValueHandler(t){1==t&&this.isValid&&this.valueHandler({name:this.name,value:this.value})}valueHandler(t){this.sendInputValue.emit(t)}connectedCallback(){this.customRules=this.setCustomRules(),this.validationPattern=this.setPattern()}handleInput(t){this.value=t.target.value,this.isValid=this.setValidity(),this.errorMessage=this.setErrorMessage(),this.validityStateHandler({valid:this.isValid,name:this.name})}setValidity(){return this.inputReference.validity.valid}setCustomRules(){var t;if((null===(t=this.validation.custom)||void 0===t?void 0:t.length)>0)return this.validation.custom.filter((t=>"regex"!==t.rule))}setPattern(){var t;if((null===(t=this.validation.custom)||void 0===t?void 0:t.length)>0)return this.validation.custom.find((t=>"regex"===t.rule)).pattern}setErrorMessage(){return this.inputReference.validity.patternMismatch?this.validation.custom.find((t=>"regex"===t.rule)).errorMessage:this.inputReference.validity.tooShort||this.inputReference.validity.tooLong?r("lengthError",this.language,{values:{minLength:this.validation.minLength,maxLength:this.validation.maxLength}}):this.inputReference.validity.valueMissing?r("requiredError",this.language):void 0}render(){const t=1==this.isValid||null==this.isValid?"":"text__input--invalid";return console.log("this",this.name,this.defaultValue,this.displayName),e("div",{class:"text__wrapper"},e("input",{id:`${this.name}__input`,value:this.defaultValue,type:"text",class:`text__input ${t}`,placeholder:`${this.displayName} ${this.validation.mandatory?"*":""}`,ref:t=>this.inputReference=t,pattern:this.validationPattern,required:this.validation.mandatory,minlength:this.validation.minLength,maxlength:this.validation.maxLength,onBlur:t=>{this.handleInput(t)}}),e("label",{class:"text__label "+(this.validation.mandatory?"text__label--required":""),htmlFor:`${this.name}__input`},this.displayName),e("small",{class:"text__error-message"},this.errorMessage))}static get watchers(){return{isValid:["validityChanged"],emitValue:["emitValueHandler"]}}};v.style='*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.text__wrapper{position:relative;display:flex;flex-direction:column-reverse;padding-top:10px}.text__label{color:#474747;font-size:16px;position:absolute;bottom:15px;left:5px;transform:translateY(-25px);transition:all 0.3s cubic-bezier(0.5, 0, 0.5, 1)}.text__label--required::after{content:"*";margin-left:5px;color:#666666}.text__input{width:inherit;padding:15px 6px;position:relative;border:none;border-bottom:3px solid #666666;background-color:transparent;color:#666666;font-size:16px;font-family:inherit}.text__input:focus{outline:none;box-shadow:0 5px 5px rgba(16, 15, 15, 0.1)}.text__input::placeholder{color:#666666}.text__input--invalid{border-bottom:3px solid #cc0000}.text__input:placeholder-shown+.text__label{opacity:0;visibility:hidden;transform:translateY(0)}.text__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000}';export{n as checkbox_input,l as date_input,o as email_input,h as general_input,c as general_registration,m as number_input,_ as password_input,b as radio_input,g as select_input,x as tel_input,v as text_input}
|