@luftborn/custom-elements 1.1.44 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/README.md +2 -2
  2. package/assets/style.css +277 -277
  3. package/azure-pipeline.yml +54 -0
  4. package/demo/index.html +585 -585
  5. package/demo/index.js +6109 -0
  6. package/demo/index.min.js +6110 -0
  7. package/demo/index.min.js.map +1 -0
  8. package/demo/index.ts +11 -11
  9. package/demo/old/index.html +586 -586
  10. package/demo/old/index.js +10849 -10849
  11. package/demo/old/index.min.js +10850 -10850
  12. package/demo/old/index.ts +10 -10
  13. package/dist/custom-form.d.ts +20 -20
  14. package/dist/custom-form.js +147 -146
  15. package/dist/custom-form.js.map +1 -1
  16. package/dist/elements/Address/AddressElement.d.ts +28 -28
  17. package/dist/elements/Address/AddressElement.js +206 -206
  18. package/dist/elements/BankField/BankFieldElement.d.ts +22 -22
  19. package/dist/elements/BankField/BankFieldElement.js +127 -127
  20. package/dist/elements/CPRElement/CPRElement.d.ts +14 -14
  21. package/dist/elements/CPRElement/CPRElement.js +82 -82
  22. package/dist/elements/CVRElement/CVRElement.d.ts +14 -14
  23. package/dist/elements/CVRElement/CVRElement.js +82 -82
  24. package/dist/elements/CheckBoxElement/CheckBoxElement.d.ts +14 -14
  25. package/dist/elements/CheckBoxElement/CheckBoxElement.js +96 -96
  26. package/dist/elements/CheckBoxElement/CheckBoxElement.js.map +1 -1
  27. package/dist/elements/CustomRegularExpression/CustomRegularExpressionElement.d.ts +12 -12
  28. package/dist/elements/CustomRegularExpression/CustomRegularExpressionElement.js +82 -82
  29. package/dist/elements/DateField/DateFieldElement.d.ts +12 -12
  30. package/dist/elements/DateField/DateFieldElement.js +85 -85
  31. package/dist/elements/DropDownList/DropDownListElement.d.ts +14 -14
  32. package/dist/elements/DropDownList/DropDownListElement.js +93 -93
  33. package/dist/elements/DropDownList/DropDownListElement.js.map +1 -1
  34. package/dist/elements/Elements.d.ts +18 -18
  35. package/dist/elements/Elements.js +37 -37
  36. package/dist/elements/EmailField/EmailFieldElement.d.ts +13 -13
  37. package/dist/elements/EmailField/EmailFieldElement.js +83 -83
  38. package/dist/elements/FileField/FileFieldElement.d.ts +15 -12
  39. package/dist/elements/FileField/FileFieldElement.js +103 -83
  40. package/dist/elements/FileField/FileFieldElement.js.map +1 -1
  41. package/dist/elements/IdentificationElement/IdentificationElement.d.ts +18 -18
  42. package/dist/elements/IdentificationElement/IdentificationElement.js +94 -94
  43. package/dist/elements/InternationaPhoneNumber/InternationaPhoneNumberElement.d.ts +16 -16
  44. package/dist/elements/InternationaPhoneNumber/InternationaPhoneNumberElement.js +114 -108
  45. package/dist/elements/InternationaPhoneNumber/InternationaPhoneNumberElement.js.map +1 -1
  46. package/dist/elements/NumericField/NumericFieldElement.d.ts +12 -12
  47. package/dist/elements/NumericField/NumericFieldElement.js +91 -91
  48. package/dist/elements/RadioButtonGroup/RadioButtonGroupElement.d.ts +14 -14
  49. package/dist/elements/RadioButtonGroup/RadioButtonGroupElement.js +99 -99
  50. package/dist/elements/RadioButtonGroup/RadioButtonGroupElement.js.map +1 -1
  51. package/dist/elements/TextAreaElement/TextAreaElement.d.ts +12 -12
  52. package/dist/elements/TextAreaElement/TextAreaElement.js +79 -79
  53. package/dist/elements/TextField/TextFieldElement.d.ts +12 -12
  54. package/dist/elements/TextField/TextFieldElement.js +79 -79
  55. package/dist/elements/TypeAhead/TypeAheadElement.d.ts +24 -24
  56. package/dist/elements/TypeAhead/TypeAheadElement.js +209 -209
  57. package/dist/framework/CustomEvents.d.ts +21 -21
  58. package/dist/framework/CustomEvents.js +47 -47
  59. package/dist/framework/CustomInputElement.d.ts +50 -50
  60. package/dist/framework/CustomInputElement.js +258 -257
  61. package/dist/framework/CustomInputElement.js.map +1 -1
  62. package/dist/framework/Language/Languages/Base/BaseDictionary.d.ts +4 -4
  63. package/dist/framework/Language/Languages/Base/BaseDictionary.js +20 -20
  64. package/dist/framework/Language/Languages/CzechDictionary.d.ts +4 -0
  65. package/dist/framework/Language/Languages/CzechDictionary.js +40 -0
  66. package/dist/framework/Language/Languages/CzechDictionary.js.map +1 -0
  67. package/dist/framework/Language/Languages/DanishDictionary.d.ts +4 -4
  68. package/dist/framework/Language/Languages/DanishDictionary.js +39 -39
  69. package/dist/framework/Language/Languages/DutchDictionary.d.ts +4 -0
  70. package/dist/framework/Language/Languages/DutchDictionary.js +40 -0
  71. package/dist/framework/Language/Languages/DutchDictionary.js.map +1 -0
  72. package/dist/framework/Language/Languages/EnglishDictionary.d.ts +4 -4
  73. package/dist/framework/Language/Languages/EnglishDictionary.js +39 -39
  74. package/dist/framework/Language/Languages/EstonianDictionary.d.ts +4 -0
  75. package/dist/framework/Language/Languages/EstonianDictionary.js +40 -0
  76. package/dist/framework/Language/Languages/EstonianDictionary.js.map +1 -0
  77. package/dist/framework/Language/Languages/FinnishDictionary.d.ts +4 -0
  78. package/dist/framework/Language/Languages/FinnishDictionary.js +40 -0
  79. package/dist/framework/Language/Languages/FinnishDictionary.js.map +1 -0
  80. package/dist/framework/Language/Languages/FrenchDictionary.d.ts +4 -0
  81. package/dist/framework/Language/Languages/FrenchDictionary.js +40 -0
  82. package/dist/framework/Language/Languages/FrenchDictionary.js.map +1 -0
  83. package/dist/framework/Language/Languages/GermanDictionary.d.ts +4 -0
  84. package/dist/framework/Language/Languages/GermanDictionary.js +40 -0
  85. package/dist/framework/Language/Languages/GermanDictionary.js.map +1 -0
  86. package/dist/framework/Language/Languages/GreekDictionary.d.ts +4 -0
  87. package/dist/framework/Language/Languages/GreekDictionary.js +40 -0
  88. package/dist/framework/Language/Languages/GreekDictionary.js.map +1 -0
  89. package/dist/framework/Language/Languages/HungarianDictionary.d.ts +4 -0
  90. package/dist/framework/Language/Languages/HungarianDictionary.js +40 -0
  91. package/dist/framework/Language/Languages/HungarianDictionary.js.map +1 -0
  92. package/dist/framework/Language/Languages/IcelandicDictionary.d.ts +4 -0
  93. package/dist/framework/Language/Languages/IcelandicDictionary.js +40 -0
  94. package/dist/framework/Language/Languages/IcelandicDictionary.js.map +1 -0
  95. package/dist/framework/Language/Languages/ItalianDictionary.d.ts +4 -0
  96. package/dist/framework/Language/Languages/ItalianDictionary.js +40 -0
  97. package/dist/framework/Language/Languages/ItalianDictionary.js.map +1 -0
  98. package/dist/framework/Language/Languages/LatvianDictionary.d.ts +4 -0
  99. package/dist/framework/Language/Languages/LatvianDictionary.js +40 -0
  100. package/dist/framework/Language/Languages/LatvianDictionary.js.map +1 -0
  101. package/dist/framework/Language/Languages/LituanianDictionary.d.ts +4 -0
  102. package/dist/framework/Language/Languages/LituanianDictionary.js +40 -0
  103. package/dist/framework/Language/Languages/LituanianDictionary.js.map +1 -0
  104. package/dist/framework/Language/Languages/NorwegianDictionary.d.ts +4 -0
  105. package/dist/framework/Language/Languages/NorwegianDictionary.js +40 -0
  106. package/dist/framework/Language/Languages/NorwegianDictionary.js.map +1 -0
  107. package/dist/framework/Language/Languages/PolishDictionary.d.ts +4 -0
  108. package/dist/framework/Language/Languages/PolishDictionary.js +40 -0
  109. package/dist/framework/Language/Languages/PolishDictionary.js.map +1 -0
  110. package/dist/framework/Language/Languages/PortugueseDictionary.d.ts +4 -0
  111. package/dist/framework/Language/Languages/PortugueseDictionary.js +40 -0
  112. package/dist/framework/Language/Languages/PortugueseDictionary.js.map +1 -0
  113. package/dist/framework/Language/Languages/SpanishDictionary.d.ts +4 -0
  114. package/dist/framework/Language/Languages/SpanishDictionary.js +40 -0
  115. package/dist/framework/Language/Languages/SpanishDictionary.js.map +1 -0
  116. package/dist/framework/Language/Languages/SwedishDictionary.d.ts +4 -0
  117. package/dist/framework/Language/Languages/SwedishDictionary.js +40 -0
  118. package/dist/framework/Language/Languages/SwedishDictionary.js.map +1 -0
  119. package/dist/framework/Language/Translator.d.ts +23 -6
  120. package/dist/framework/Language/Translator.js +115 -32
  121. package/dist/framework/Language/Translator.js.map +1 -1
  122. package/dist/framework/Models/OptionWithDescription.d.ts +6 -6
  123. package/dist/framework/Models/OptionWithDescription.js +9 -9
  124. package/dist/framework/Polyfills/getAttributeNamesPolyfill.d.ts +1 -1
  125. package/dist/framework/Polyfills/getAttributeNamesPolyfill.js +17 -17
  126. package/dist/framework/Translations/CaseConverter.d.ts +5 -5
  127. package/dist/framework/Translations/CaseConverter.js +50 -50
  128. package/dist/framework/Utilities/ArrayUtil.d.ts +6 -0
  129. package/dist/framework/Utilities/ArrayUtil.js +37 -0
  130. package/dist/framework/Utilities/ArrayUtil.js.map +1 -0
  131. package/dist/framework/Utilities/DomUtil.d.ts +21 -0
  132. package/dist/framework/Utilities/DomUtil.js +102 -0
  133. package/dist/framework/Utilities/DomUtil.js.map +1 -0
  134. package/dist/framework/Utilities/DomUtility.d.ts +3 -3
  135. package/dist/framework/Utilities/DomUtility.js +12 -12
  136. package/dist/framework/Utilities/MakeRequest.d.ts +8 -0
  137. package/dist/framework/Utilities/MakeRequest.js +49 -0
  138. package/dist/framework/Utilities/MakeRequest.js.map +1 -0
  139. package/dist/framework/Utilities/StringUtil.d.ts +4 -0
  140. package/dist/framework/Utilities/StringUtil.js +17 -0
  141. package/dist/framework/Utilities/StringUtil.js.map +1 -0
  142. package/dist/framework/Utilities/ViewportUtil.d.ts +8 -0
  143. package/dist/framework/Utilities/ViewportUtil.js +43 -0
  144. package/dist/framework/Utilities/ViewportUtil.js.map +1 -0
  145. package/dist/framework/Utilities/debouncer.d.ts +8 -8
  146. package/dist/framework/Utilities/debouncer.js +51 -51
  147. package/dist/framework/Validation/IValidator.interface.d.ts +3 -3
  148. package/dist/framework/Validation/IValidator.interface.js +2 -2
  149. package/dist/framework/Validation/Validators/BankAccount.d.ts +4 -4
  150. package/dist/framework/Validation/Validators/BankAccount.js +12 -12
  151. package/dist/framework/Validation/Validators/BankAccountRegistrationNumber.d.ts +4 -4
  152. package/dist/framework/Validation/Validators/BankAccountRegistrationNumber.js +12 -12
  153. package/dist/framework/Validation/Validators/BankIdNorway.d.ts +5 -5
  154. package/dist/framework/Validation/Validators/BankIdNorway.js +21 -21
  155. package/dist/framework/Validation/Validators/BankIdSweden.d.ts +5 -5
  156. package/dist/framework/Validation/Validators/BankIdSweden.js +21 -21
  157. package/dist/framework/Validation/Validators/CPR.d.ts +9 -9
  158. package/dist/framework/Validation/Validators/CPR.js +75 -75
  159. package/dist/framework/Validation/Validators/CVR.d.ts +5 -5
  160. package/dist/framework/Validation/Validators/CVR.js +30 -30
  161. package/dist/framework/custom-element.decorator.d.ts +9 -9
  162. package/dist/framework/custom-element.decorator.js +51 -51
  163. package/dist/index.d.ts +7 -7
  164. package/dist/index.js +14 -14
  165. package/node_modules/@webcomponents/webcomponentsjs/CHANGELOG.md +15 -0
  166. package/node_modules/@webcomponents/webcomponentsjs/README.md +13 -0
  167. package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-ce.js +31 -31
  168. package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-ce.js.map +1 -1
  169. package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-pf_dom.js +15 -13
  170. package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-pf_dom.js.map +1 -1
  171. package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-pf_js.js.map +1 -1
  172. package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd-ce-pf.js +237 -223
  173. package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd-ce-pf.js.map +1 -1
  174. package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd-ce.js +188 -176
  175. package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd-ce.js.map +1 -1
  176. package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd.js +155 -144
  177. package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd.js.map +1 -1
  178. package/node_modules/@webcomponents/webcomponentsjs/package.json +31 -64
  179. package/node_modules/@webcomponents/webcomponentsjs/src/entrypoints/webcomponents-pf_dom-index.js +2 -0
  180. package/node_modules/@webcomponents/webcomponentsjs/src/platform/event-listener-options.js +122 -0
  181. package/node_modules/@webcomponents/webcomponentsjs/src/platform/toggle-attribute.js +39 -0
  182. package/node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.d.ts +1 -0
  183. package/node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js +239 -225
  184. package/node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js.map +1 -1
  185. package/node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js +35 -3
  186. package/package.json +38 -39
  187. package/src/custom-form.ts +140 -139
  188. package/src/elements/Address/AddressElement.ts +216 -216
  189. package/src/elements/BankField/BankFieldElement.ts +127 -127
  190. package/src/elements/CPRElement/CPRElement.ts +74 -74
  191. package/src/elements/CVRElement/CVRElement.ts +75 -75
  192. package/src/elements/CheckBoxElement/CheckBoxElement.ts +99 -99
  193. package/src/elements/CustomRegularExpression/CustomRegularExpressionElement.ts +75 -75
  194. package/src/elements/DateField/DateFieldElement.ts +78 -78
  195. package/src/elements/DropDownList/DropDownListElement.ts +100 -100
  196. package/src/elements/Elements.ts +37 -37
  197. package/src/elements/EmailField/EmailFieldElement.ts +78 -78
  198. package/src/elements/FileField/FileFieldElement.ts +96 -76
  199. package/src/elements/IdentificationElement/IdentificationElement.ts +104 -104
  200. package/src/elements/InternationaPhoneNumber/InternationaPhoneNumberElement.ts +116 -111
  201. package/src/elements/NumericField/NumericFieldElement.ts +84 -84
  202. package/src/elements/RadioButtonGroup/RadioButtonGroupElement.ts +103 -103
  203. package/src/elements/TextAreaElement/TextAreaElement.ts +72 -72
  204. package/src/elements/TextField/TextFieldElement.ts +72 -72
  205. package/src/elements/TypeAhead/TypeAheadElement.ts +248 -248
  206. package/src/framework/CustomEvents.ts +47 -47
  207. package/src/framework/CustomInputElement.ts +277 -276
  208. package/src/framework/Language/Languages/Base/BaseDictionary.ts +15 -15
  209. package/src/framework/Language/Languages/CzechDictionary.ts +18 -0
  210. package/src/framework/Language/Languages/DanishDictionary.ts +17 -17
  211. package/src/framework/Language/Languages/DutchDictionary.ts +18 -0
  212. package/src/framework/Language/Languages/EnglishDictionary.ts +18 -18
  213. package/src/framework/Language/Languages/EstonianDictionary.ts +18 -0
  214. package/src/framework/Language/Languages/FinnishDictionary.ts +18 -0
  215. package/src/framework/Language/Languages/FrenchDictionary.ts +18 -0
  216. package/src/framework/Language/Languages/GermanDictionary.ts +18 -0
  217. package/src/framework/Language/Languages/GreekDictionary.ts +18 -0
  218. package/src/framework/Language/Languages/HungarianDictionary.ts +18 -0
  219. package/src/framework/Language/Languages/IcelandicDictionary.ts +18 -0
  220. package/src/framework/Language/Languages/ItalianDictionary.ts +18 -0
  221. package/src/framework/Language/Languages/LatvianDictionary.ts +18 -0
  222. package/src/framework/Language/Languages/LituanianDictionary.ts +18 -0
  223. package/src/framework/Language/Languages/NorwegianDictionary.ts +18 -0
  224. package/src/framework/Language/Languages/PolishDictionary.ts +18 -0
  225. package/src/framework/Language/Languages/PortugueseDictionary.ts +18 -0
  226. package/src/framework/Language/Languages/SpanishDictionary.ts +18 -0
  227. package/src/framework/Language/Languages/SwedishDictionary.ts +18 -0
  228. package/src/framework/Language/Translator.ts +110 -26
  229. package/src/framework/Models/OptionWithDescription.ts +8 -8
  230. package/src/framework/Polyfills/getAttributeNamesPolyfill.ts +13 -13
  231. package/src/framework/Translations/CaseConverter.ts +43 -43
  232. package/src/framework/Utilities/ArrayUtil.ts +31 -0
  233. package/src/framework/Utilities/DomUtil.ts +117 -0
  234. package/src/framework/Utilities/DomUtility.ts +6 -6
  235. package/src/framework/Utilities/MakeRequest.ts +47 -0
  236. package/src/framework/Utilities/StringUtil.ts +9 -0
  237. package/src/framework/Utilities/ViewportUtil.ts +46 -0
  238. package/src/framework/Utilities/debouncer.ts +66 -66
  239. package/src/framework/Validation/IValidator.interface.ts +3 -3
  240. package/src/framework/Validation/Validators/BankAccount.ts +7 -7
  241. package/src/framework/Validation/Validators/BankAccountRegistrationNumber.ts +8 -8
  242. package/src/framework/Validation/Validators/BankIdNorway.ts +21 -21
  243. package/src/framework/Validation/Validators/BankIdSweden.ts +21 -21
  244. package/src/framework/Validation/Validators/CPR.ts +82 -82
  245. package/src/framework/Validation/Validators/CVR.ts +27 -27
  246. package/src/framework/custom-element.decorator.ts +57 -57
  247. package/src/index.ts +12 -12
@@ -1,50 +1,50 @@
1
- import { CustomElementEvent, CustomElementEventArgs } from "./CustomEvents";
2
- import { DomUtil } from "@luftborn/utilities";
3
- import OptionWithDescription from "./Models/OptionWithDescription";
4
- export declare abstract class CustomInputElement extends HTMLElement {
5
- private dependentOnList;
6
- private visibilityState;
7
- protected touched: boolean;
8
- protected domUtil: DomUtil;
9
- protected hasValueDependency: any;
10
- protected noValueDependency: any;
11
- protected dependencies: any[];
12
- onChange: CustomElementEvent<CustomElementEventArgs>;
13
- onValidate: CustomElementEvent<CustomElementEventArgs>;
14
- onVisibilityChanged: CustomElementEvent<CustomElementEventArgs>;
15
- name: string;
16
- options: any[];
17
- optionsWithDescriptions: OptionWithDescription[];
18
- required: boolean;
19
- customValue: string;
20
- allDependenciesMustBeMet: boolean;
21
- multi: boolean;
22
- max: any;
23
- min: any;
24
- step: any;
25
- constructor();
26
- abstract get value(): any;
27
- abstract set value(value: any);
28
- abstract get valid(): boolean;
29
- abstract initChildInputs(): void;
30
- abstract validate(): void;
31
- abstract change($event: any): void;
32
- compareVlaues: any[];
33
- isValueConditionMatched(val: any): boolean;
34
- connectedCallback(): void;
35
- init(): void;
36
- private parseData;
37
- private bindEvents;
38
- private setAttributes;
39
- private bindDependencies;
40
- private bindDependency;
41
- private setVisibility;
42
- private hide;
43
- private show;
44
- protected getChildInput(selector: string): HTMLInputElement;
45
- protected getChildInputs(selector: string): HTMLInputElement[];
46
- protected getChildElement(selector: string): HTMLElement;
47
- protected getChildElements(selector: string): HTMLElement[];
48
- RegisterDependentOn(name: string, initialValue?: boolean): void;
49
- DependentOnStateChanged(name: string, state: boolean): void;
50
- }
1
+ import { CustomElementEvent, CustomElementEventArgs } from "./CustomEvents";
2
+ import OptionWithDescription from "./Models/OptionWithDescription";
3
+ import DomUtil from "./Utilities/DomUtil";
4
+ export declare abstract class CustomInputElement extends HTMLElement {
5
+ private dependentOnList;
6
+ private visibilityState;
7
+ protected touched: boolean;
8
+ protected domUtil: DomUtil;
9
+ protected hasValueDependency: any;
10
+ protected noValueDependency: any;
11
+ protected dependencies: any[];
12
+ onChange: CustomElementEvent<CustomElementEventArgs>;
13
+ onValidate: CustomElementEvent<CustomElementEventArgs>;
14
+ onVisibilityChanged: CustomElementEvent<CustomElementEventArgs>;
15
+ name: string;
16
+ options: any[];
17
+ optionsWithDescriptions: OptionWithDescription[];
18
+ required: boolean;
19
+ customValue: string;
20
+ allDependenciesMustBeMet: boolean;
21
+ multi: boolean;
22
+ max: any;
23
+ min: any;
24
+ step: any;
25
+ constructor();
26
+ abstract get value(): any;
27
+ abstract set value(value: any);
28
+ abstract get valid(): boolean;
29
+ abstract initChildInputs(): void;
30
+ abstract validate(): void;
31
+ abstract change($event: any): void;
32
+ compareVlaues: any[];
33
+ isValueConditionMatched(val: any): boolean;
34
+ connectedCallback(): void;
35
+ init(): void;
36
+ private parseData;
37
+ private bindEvents;
38
+ private setAttributes;
39
+ private bindDependencies;
40
+ private bindDependency;
41
+ private setVisibility;
42
+ private hide;
43
+ private show;
44
+ protected getChildInput(selector: string): HTMLInputElement;
45
+ protected getChildInputs(selector: string): HTMLInputElement[];
46
+ protected getChildElement(selector: string): HTMLElement;
47
+ protected getChildElements(selector: string): HTMLElement[];
48
+ RegisterDependentOn(name: string, initialValue?: boolean): void;
49
+ DependentOnStateChanged(name: string, state: boolean): void;
50
+ }
@@ -1,258 +1,259 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.CustomInputElement = void 0;
19
- var CustomEvents_1 = require("./CustomEvents");
20
- var utilities_1 = require("@luftborn/utilities");
21
- var IDictionary = /** @class */ (function () {
22
- function IDictionary() {
23
- }
24
- return IDictionary;
25
- }());
26
- var CustomInputElement = /** @class */ (function (_super) {
27
- __extends(CustomInputElement, _super);
28
- function CustomInputElement() {
29
- var _this = _super.call(this) || this;
30
- _this.dependentOnList = new IDictionary();
31
- _this.visibilityState = true;
32
- _this.touched = false;
33
- _this.onChange = new CustomEvents_1.CustomElementEvent();
34
- _this.onValidate = new CustomEvents_1.CustomElementEvent();
35
- _this.onVisibilityChanged = new CustomEvents_1.CustomElementEvent();
36
- _this.allDependenciesMustBeMet = false;
37
- _this.multi = false;
38
- _this.compareVlaues = [];
39
- return _this;
40
- }
41
- CustomInputElement.prototype.isValueConditionMatched = function (val) {
42
- var _this = this;
43
- if (val && Array.isArray(val) && val.length) {
44
- var result_1 = false;
45
- val.forEach(function (element) {
46
- var elementMatched = _this.compareVlaues.findIndex(function (x) { return x == element; }) !== -1;
47
- if (elementMatched) {
48
- result_1 = true;
49
- return;
50
- }
51
- });
52
- return result_1;
53
- }
54
- return this.compareVlaues.findIndex(function (x) { return x == val; }) !== -1;
55
- };
56
- CustomInputElement.prototype.connectedCallback = function () {
57
- this.init();
58
- this.setAttributes();
59
- };
60
- CustomInputElement.prototype.init = function () {
61
- var _this = this;
62
- this.style.width = "100%";
63
- this.domUtil = new utilities_1.DomUtil(this);
64
- this.parseData();
65
- this.initChildInputs();
66
- this.bindEvents();
67
- this.setAttributes();
68
- window.addEventListener("load", function () {
69
- _this.bindDependencies();
70
- });
71
- };
72
- CustomInputElement.prototype.parseData = function () {
73
- try {
74
- if (!(this.children[0] instanceof HTMLScriptElement)) {
75
- return;
76
- }
77
- var data = JSON.parse(this.children[0].innerHTML);
78
- this.options = data.options;
79
- this.optionsWithDescriptions = data.optionsWithDescriptions;
80
- this.hasValueDependency = data.hasValueDependency;
81
- this.noValueDependency = data.noValueDependency;
82
- this.dependencies = data.dependencies;
83
- this.required = data.required;
84
- this.name = data.name;
85
- this.allDependenciesMustBeMet = data.allDependenciesMustBeMet;
86
- this.multi = data.multi;
87
- this.max = data.max;
88
- this.min = data.min;
89
- this.step = data.step;
90
- this.customValue = data.value;
91
- }
92
- catch (ex) {
93
- console.error(ex);
94
- }
95
- };
96
- CustomInputElement.prototype.bindEvents = function () {
97
- var _this = this;
98
- this.onValidate.on(function (e) {
99
- if (_this.valid) {
100
- if (_this.closest('.custom-validation-target')) {
101
- _this.closest('.custom-validation-target').classList.remove("invalid");
102
- _this.closest('.custom-validation-target').classList.add("valid");
103
- }
104
- }
105
- else {
106
- if (_this.closest('.custom-validation-target')) {
107
- _this.closest('.custom-validation-target').classList.add("invalid");
108
- _this.closest('.custom-validation-target').classList.remove("valid");
109
- }
110
- _this.domUtil.focus();
111
- }
112
- });
113
- this.onChange.on(function (e) {
114
- if (_this.touched) {
115
- _this.validate();
116
- }
117
- });
118
- };
119
- CustomInputElement.prototype.setAttributes = function () {
120
- this.setAttribute("custom-input", "");
121
- this.setAttribute("name", this.name);
122
- };
123
- CustomInputElement.prototype.bindDependencies = function () {
124
- if (this.hasValueDependency && this.hasValueDependency.items.length) {
125
- for (var _i = 0, _a = this.hasValueDependency.items; _i < _a.length; _i++) {
126
- var fieldName = _a[_i];
127
- this.bindDependency(fieldName, "has");
128
- }
129
- }
130
- if (this.noValueDependency && this.noValueDependency.items.length) {
131
- for (var _b = 0, _c = this.noValueDependency.items; _b < _c.length; _b++) {
132
- var fieldName = _c[_b];
133
- this.bindDependency(fieldName, "no");
134
- }
135
- }
136
- if (this.dependencies && this.dependencies.length) {
137
- for (var index in this.dependencies) {
138
- if (this.dependencies.hasOwnProperty(index)) {
139
- var dependency = this.dependencies[index];
140
- for (var _d = 0, _e = dependency.items; _d < _e.length; _d++) {
141
- var fieldName = _e[_d];
142
- this.bindDependency(fieldName, "custom", dependency.value, dependency.criteria);
143
- }
144
- }
145
- }
146
- }
147
- };
148
- CustomInputElement.prototype.bindDependency = function (elementName, type, value, criteria) {
149
- var _this = this;
150
- var element = document.querySelector("[name=\"" + elementName + "\"]");
151
- if (element instanceof CustomInputElement) {
152
- element.compareVlaues.push(value);
153
- if (this.dependentOnList.hasOwnProperty(element.name)) {
154
- return;
155
- }
156
- var isVisibleByDefault = type === "no";
157
- element.RegisterDependentOn(this.name, isVisibleByDefault);
158
- this.onChange.on(function (e) {
159
- var IsConditionMatched = false;
160
- if (type === "has") {
161
- IsConditionMatched = !!e.value;
162
- }
163
- if (type === "no") {
164
- IsConditionMatched = !e.value;
165
- }
166
- if (type === "custom") {
167
- if (criteria === "Exact") {
168
- IsConditionMatched = element.isValueConditionMatched(e.value);
169
- }
170
- else if (criteria === "LessThan") {
171
- IsConditionMatched = e.value < value;
172
- }
173
- else if (criteria === "MoreThan") {
174
- IsConditionMatched = e.value > value;
175
- }
176
- }
177
- element.DependentOnStateChanged(_this.name, IsConditionMatched);
178
- });
179
- this.onVisibilityChanged.on(function (e) {
180
- if (_this.visibilityState) {
181
- _this.onChange.emit(new CustomEvents_1.CustomElementEventArgs(_this.value, "change"));
182
- }
183
- else {
184
- element.DependentOnStateChanged(_this.name, false);
185
- }
186
- });
187
- }
188
- };
189
- CustomInputElement.prototype.setVisibility = function () {
190
- if (this.allDependenciesMustBeMet) {
191
- this.visibilityState = Object.values(this.dependentOnList).every(function (state) { return state; });
192
- }
193
- else {
194
- this.visibilityState = Object.values(this.dependentOnList).some(function (state) { return state; });
195
- }
196
- if (this.visibilityState) {
197
- this.show();
198
- }
199
- else {
200
- this.hide();
201
- }
202
- this.onVisibilityChanged.emit(new CustomEvents_1.CustomElementEventArgs(this.value, "VisibilityChanged"));
203
- };
204
- CustomInputElement.prototype.hide = function () {
205
- this.setAttribute("hidden", "");
206
- if (this.closest('.custom-validation-target')) {
207
- this.closest('.custom-validation-target').setAttribute("hidden", "");
208
- }
209
- };
210
- CustomInputElement.prototype.show = function () {
211
- this.removeAttribute("hidden");
212
- if (this.closest('.custom-validation-target')) {
213
- this.closest('.custom-validation-target').removeAttribute("hidden");
214
- }
215
- };
216
- CustomInputElement.prototype.getChildInput = function (selector) {
217
- var element = this;
218
- if (this.shadowRoot) {
219
- element = this.shadowRoot;
220
- }
221
- return element.querySelector(selector);
222
- };
223
- CustomInputElement.prototype.getChildInputs = function (selector) {
224
- var element = this;
225
- if (this.shadowRoot) {
226
- element = this.shadowRoot;
227
- }
228
- return utilities_1.ArrayUtil.FromNodeList(element.querySelectorAll(selector));
229
- };
230
- CustomInputElement.prototype.getChildElement = function (selector) {
231
- var element = this;
232
- if (this.shadowRoot) {
233
- element = this.shadowRoot;
234
- }
235
- return element.querySelector(selector);
236
- };
237
- CustomInputElement.prototype.getChildElements = function (selector) {
238
- var element = this;
239
- if (this.shadowRoot) {
240
- element = this.shadowRoot;
241
- }
242
- return element.querySelectorAll(selector);
243
- };
244
- CustomInputElement.prototype.RegisterDependentOn = function (name, initialValue) {
245
- if (initialValue === void 0) { initialValue = false; }
246
- this.dependentOnList[name] = initialValue;
247
- this.setVisibility();
248
- };
249
- CustomInputElement.prototype.DependentOnStateChanged = function (name, state) {
250
- if (this.dependentOnList.hasOwnProperty(name)) {
251
- this.dependentOnList[name] = state;
252
- }
253
- this.setVisibility();
254
- };
255
- return CustomInputElement;
256
- }(HTMLElement));
257
- exports.CustomInputElement = CustomInputElement;
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.CustomInputElement = void 0;
19
+ var CustomEvents_1 = require("./CustomEvents");
20
+ var ArrayUtil_1 = require("./Utilities/ArrayUtil");
21
+ var DomUtil_1 = require("./Utilities/DomUtil");
22
+ var IDictionary = /** @class */ (function () {
23
+ function IDictionary() {
24
+ }
25
+ return IDictionary;
26
+ }());
27
+ var CustomInputElement = /** @class */ (function (_super) {
28
+ __extends(CustomInputElement, _super);
29
+ function CustomInputElement() {
30
+ var _this = _super.call(this) || this;
31
+ _this.dependentOnList = new IDictionary();
32
+ _this.visibilityState = true;
33
+ _this.touched = false;
34
+ _this.onChange = new CustomEvents_1.CustomElementEvent();
35
+ _this.onValidate = new CustomEvents_1.CustomElementEvent();
36
+ _this.onVisibilityChanged = new CustomEvents_1.CustomElementEvent();
37
+ _this.allDependenciesMustBeMet = false;
38
+ _this.multi = false;
39
+ _this.compareVlaues = [];
40
+ return _this;
41
+ }
42
+ CustomInputElement.prototype.isValueConditionMatched = function (val) {
43
+ var _this = this;
44
+ if (val && Array.isArray(val) && val.length) {
45
+ var result_1 = false;
46
+ val.forEach(function (element) {
47
+ var elementMatched = _this.compareVlaues.findIndex(function (x) { return x == element; }) !== -1;
48
+ if (elementMatched) {
49
+ result_1 = true;
50
+ return;
51
+ }
52
+ });
53
+ return result_1;
54
+ }
55
+ return this.compareVlaues.findIndex(function (x) { return x == val; }) !== -1;
56
+ };
57
+ CustomInputElement.prototype.connectedCallback = function () {
58
+ this.init();
59
+ this.setAttributes();
60
+ };
61
+ CustomInputElement.prototype.init = function () {
62
+ var _this = this;
63
+ this.style.width = "100%";
64
+ this.domUtil = new DomUtil_1.default(this);
65
+ this.parseData();
66
+ this.initChildInputs();
67
+ this.bindEvents();
68
+ this.setAttributes();
69
+ window.addEventListener("load", function () {
70
+ _this.bindDependencies();
71
+ });
72
+ };
73
+ CustomInputElement.prototype.parseData = function () {
74
+ try {
75
+ if (!(this.children[0] instanceof HTMLScriptElement)) {
76
+ return;
77
+ }
78
+ var data = JSON.parse(this.children[0].innerHTML);
79
+ this.options = data.options;
80
+ this.optionsWithDescriptions = data.optionsWithDescriptions;
81
+ this.hasValueDependency = data.hasValueDependency;
82
+ this.noValueDependency = data.noValueDependency;
83
+ this.dependencies = data.dependencies;
84
+ this.required = data.required;
85
+ this.name = data.name;
86
+ this.allDependenciesMustBeMet = data.allDependenciesMustBeMet;
87
+ this.multi = data.multi;
88
+ this.max = data.max;
89
+ this.min = data.min;
90
+ this.step = data.step;
91
+ this.customValue = data.value;
92
+ }
93
+ catch (ex) {
94
+ console.error(ex);
95
+ }
96
+ };
97
+ CustomInputElement.prototype.bindEvents = function () {
98
+ var _this = this;
99
+ this.onValidate.on(function (e) {
100
+ if (_this.valid) {
101
+ if (_this.closest('.custom-validation-target')) {
102
+ _this.closest('.custom-validation-target').classList.remove("invalid");
103
+ _this.closest('.custom-validation-target').classList.add("valid");
104
+ }
105
+ }
106
+ else {
107
+ if (_this.closest('.custom-validation-target')) {
108
+ _this.closest('.custom-validation-target').classList.add("invalid");
109
+ _this.closest('.custom-validation-target').classList.remove("valid");
110
+ }
111
+ _this.domUtil.focus();
112
+ }
113
+ });
114
+ this.onChange.on(function (e) {
115
+ if (_this.touched) {
116
+ _this.validate();
117
+ }
118
+ });
119
+ };
120
+ CustomInputElement.prototype.setAttributes = function () {
121
+ this.setAttribute("custom-input", "");
122
+ this.setAttribute("name", this.name);
123
+ };
124
+ CustomInputElement.prototype.bindDependencies = function () {
125
+ if (this.hasValueDependency && this.hasValueDependency.items.length) {
126
+ for (var _i = 0, _a = this.hasValueDependency.items; _i < _a.length; _i++) {
127
+ var fieldName = _a[_i];
128
+ this.bindDependency(fieldName, "has");
129
+ }
130
+ }
131
+ if (this.noValueDependency && this.noValueDependency.items.length) {
132
+ for (var _b = 0, _c = this.noValueDependency.items; _b < _c.length; _b++) {
133
+ var fieldName = _c[_b];
134
+ this.bindDependency(fieldName, "no");
135
+ }
136
+ }
137
+ if (this.dependencies && this.dependencies.length) {
138
+ for (var index in this.dependencies) {
139
+ if (this.dependencies.hasOwnProperty(index)) {
140
+ var dependency = this.dependencies[index];
141
+ for (var _d = 0, _e = dependency.items; _d < _e.length; _d++) {
142
+ var fieldName = _e[_d];
143
+ this.bindDependency(fieldName, "custom", dependency.value, dependency.criteria);
144
+ }
145
+ }
146
+ }
147
+ }
148
+ };
149
+ CustomInputElement.prototype.bindDependency = function (elementName, type, value, criteria) {
150
+ var _this = this;
151
+ var element = document.querySelector("[name=\"" + elementName + "\"]");
152
+ if (element instanceof CustomInputElement) {
153
+ element.compareVlaues.push(value);
154
+ if (this.dependentOnList.hasOwnProperty(element.name)) {
155
+ return;
156
+ }
157
+ var isVisibleByDefault = type === "no";
158
+ element.RegisterDependentOn(this.name, isVisibleByDefault);
159
+ this.onChange.on(function (e) {
160
+ var IsConditionMatched = false;
161
+ if (type === "has") {
162
+ IsConditionMatched = !!e.value;
163
+ }
164
+ if (type === "no") {
165
+ IsConditionMatched = !e.value;
166
+ }
167
+ if (type === "custom") {
168
+ if (criteria === "Exact") {
169
+ IsConditionMatched = element.isValueConditionMatched(e.value);
170
+ }
171
+ else if (criteria === "LessThan") {
172
+ IsConditionMatched = e.value < value;
173
+ }
174
+ else if (criteria === "MoreThan") {
175
+ IsConditionMatched = e.value > value;
176
+ }
177
+ }
178
+ element.DependentOnStateChanged(_this.name, IsConditionMatched);
179
+ });
180
+ this.onVisibilityChanged.on(function (e) {
181
+ if (_this.visibilityState) {
182
+ _this.onChange.emit(new CustomEvents_1.CustomElementEventArgs(_this.value, "change"));
183
+ }
184
+ else {
185
+ element.DependentOnStateChanged(_this.name, false);
186
+ }
187
+ });
188
+ }
189
+ };
190
+ CustomInputElement.prototype.setVisibility = function () {
191
+ if (this.allDependenciesMustBeMet) {
192
+ this.visibilityState = Object.values(this.dependentOnList).every(function (state) { return state; });
193
+ }
194
+ else {
195
+ this.visibilityState = Object.values(this.dependentOnList).some(function (state) { return state; });
196
+ }
197
+ if (this.visibilityState) {
198
+ this.show();
199
+ }
200
+ else {
201
+ this.hide();
202
+ }
203
+ this.onVisibilityChanged.emit(new CustomEvents_1.CustomElementEventArgs(this.value, "VisibilityChanged"));
204
+ };
205
+ CustomInputElement.prototype.hide = function () {
206
+ this.setAttribute("hidden", "");
207
+ if (this.closest('.custom-validation-target')) {
208
+ this.closest('.custom-validation-target').setAttribute("hidden", "");
209
+ }
210
+ };
211
+ CustomInputElement.prototype.show = function () {
212
+ this.removeAttribute("hidden");
213
+ if (this.closest('.custom-validation-target')) {
214
+ this.closest('.custom-validation-target').removeAttribute("hidden");
215
+ }
216
+ };
217
+ CustomInputElement.prototype.getChildInput = function (selector) {
218
+ var element = this;
219
+ if (this.shadowRoot) {
220
+ element = this.shadowRoot;
221
+ }
222
+ return element.querySelector(selector);
223
+ };
224
+ CustomInputElement.prototype.getChildInputs = function (selector) {
225
+ var element = this;
226
+ if (this.shadowRoot) {
227
+ element = this.shadowRoot;
228
+ }
229
+ return ArrayUtil_1.default.FromNodeList(element.querySelectorAll(selector));
230
+ };
231
+ CustomInputElement.prototype.getChildElement = function (selector) {
232
+ var element = this;
233
+ if (this.shadowRoot) {
234
+ element = this.shadowRoot;
235
+ }
236
+ return element.querySelector(selector);
237
+ };
238
+ CustomInputElement.prototype.getChildElements = function (selector) {
239
+ var element = this;
240
+ if (this.shadowRoot) {
241
+ element = this.shadowRoot;
242
+ }
243
+ return element.querySelectorAll(selector);
244
+ };
245
+ CustomInputElement.prototype.RegisterDependentOn = function (name, initialValue) {
246
+ if (initialValue === void 0) { initialValue = false; }
247
+ this.dependentOnList[name] = initialValue;
248
+ this.setVisibility();
249
+ };
250
+ CustomInputElement.prototype.DependentOnStateChanged = function (name, state) {
251
+ if (this.dependentOnList.hasOwnProperty(name)) {
252
+ this.dependentOnList[name] = state;
253
+ }
254
+ this.setVisibility();
255
+ };
256
+ return CustomInputElement;
257
+ }(HTMLElement));
258
+ exports.CustomInputElement = CustomInputElement;
258
259
  //# sourceMappingURL=CustomInputElement.js.map