@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.
- package/README.md +2 -2
- package/assets/style.css +277 -277
- package/azure-pipeline.yml +54 -0
- package/demo/index.html +585 -585
- package/demo/index.js +6109 -0
- package/demo/index.min.js +6110 -0
- package/demo/index.min.js.map +1 -0
- package/demo/index.ts +11 -11
- package/demo/old/index.html +586 -586
- package/demo/old/index.js +10849 -10849
- package/demo/old/index.min.js +10850 -10850
- package/demo/old/index.ts +10 -10
- package/dist/custom-form.d.ts +20 -20
- package/dist/custom-form.js +147 -146
- package/dist/custom-form.js.map +1 -1
- package/dist/elements/Address/AddressElement.d.ts +28 -28
- package/dist/elements/Address/AddressElement.js +206 -206
- package/dist/elements/BankField/BankFieldElement.d.ts +22 -22
- package/dist/elements/BankField/BankFieldElement.js +127 -127
- package/dist/elements/CPRElement/CPRElement.d.ts +14 -14
- package/dist/elements/CPRElement/CPRElement.js +82 -82
- package/dist/elements/CVRElement/CVRElement.d.ts +14 -14
- package/dist/elements/CVRElement/CVRElement.js +82 -82
- package/dist/elements/CheckBoxElement/CheckBoxElement.d.ts +14 -14
- package/dist/elements/CheckBoxElement/CheckBoxElement.js +96 -96
- package/dist/elements/CheckBoxElement/CheckBoxElement.js.map +1 -1
- package/dist/elements/CustomRegularExpression/CustomRegularExpressionElement.d.ts +12 -12
- package/dist/elements/CustomRegularExpression/CustomRegularExpressionElement.js +82 -82
- package/dist/elements/DateField/DateFieldElement.d.ts +12 -12
- package/dist/elements/DateField/DateFieldElement.js +85 -85
- package/dist/elements/DropDownList/DropDownListElement.d.ts +14 -14
- package/dist/elements/DropDownList/DropDownListElement.js +93 -93
- package/dist/elements/DropDownList/DropDownListElement.js.map +1 -1
- package/dist/elements/Elements.d.ts +18 -18
- package/dist/elements/Elements.js +37 -37
- package/dist/elements/EmailField/EmailFieldElement.d.ts +13 -13
- package/dist/elements/EmailField/EmailFieldElement.js +83 -83
- package/dist/elements/FileField/FileFieldElement.d.ts +15 -12
- package/dist/elements/FileField/FileFieldElement.js +103 -83
- package/dist/elements/FileField/FileFieldElement.js.map +1 -1
- package/dist/elements/IdentificationElement/IdentificationElement.d.ts +18 -18
- package/dist/elements/IdentificationElement/IdentificationElement.js +94 -94
- package/dist/elements/InternationaPhoneNumber/InternationaPhoneNumberElement.d.ts +16 -16
- package/dist/elements/InternationaPhoneNumber/InternationaPhoneNumberElement.js +114 -108
- package/dist/elements/InternationaPhoneNumber/InternationaPhoneNumberElement.js.map +1 -1
- package/dist/elements/NumericField/NumericFieldElement.d.ts +12 -12
- package/dist/elements/NumericField/NumericFieldElement.js +91 -91
- package/dist/elements/RadioButtonGroup/RadioButtonGroupElement.d.ts +14 -14
- package/dist/elements/RadioButtonGroup/RadioButtonGroupElement.js +99 -99
- package/dist/elements/RadioButtonGroup/RadioButtonGroupElement.js.map +1 -1
- package/dist/elements/TextAreaElement/TextAreaElement.d.ts +12 -12
- package/dist/elements/TextAreaElement/TextAreaElement.js +79 -79
- package/dist/elements/TextField/TextFieldElement.d.ts +12 -12
- package/dist/elements/TextField/TextFieldElement.js +79 -79
- package/dist/elements/TypeAhead/TypeAheadElement.d.ts +24 -24
- package/dist/elements/TypeAhead/TypeAheadElement.js +209 -209
- package/dist/framework/CustomEvents.d.ts +21 -21
- package/dist/framework/CustomEvents.js +47 -47
- package/dist/framework/CustomInputElement.d.ts +50 -50
- package/dist/framework/CustomInputElement.js +258 -257
- package/dist/framework/CustomInputElement.js.map +1 -1
- package/dist/framework/Language/Languages/Base/BaseDictionary.d.ts +4 -4
- package/dist/framework/Language/Languages/Base/BaseDictionary.js +20 -20
- package/dist/framework/Language/Languages/CzechDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/CzechDictionary.js +40 -0
- package/dist/framework/Language/Languages/CzechDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/DanishDictionary.d.ts +4 -4
- package/dist/framework/Language/Languages/DanishDictionary.js +39 -39
- package/dist/framework/Language/Languages/DutchDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/DutchDictionary.js +40 -0
- package/dist/framework/Language/Languages/DutchDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/EnglishDictionary.d.ts +4 -4
- package/dist/framework/Language/Languages/EnglishDictionary.js +39 -39
- package/dist/framework/Language/Languages/EstonianDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/EstonianDictionary.js +40 -0
- package/dist/framework/Language/Languages/EstonianDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/FinnishDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/FinnishDictionary.js +40 -0
- package/dist/framework/Language/Languages/FinnishDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/FrenchDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/FrenchDictionary.js +40 -0
- package/dist/framework/Language/Languages/FrenchDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/GermanDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/GermanDictionary.js +40 -0
- package/dist/framework/Language/Languages/GermanDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/GreekDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/GreekDictionary.js +40 -0
- package/dist/framework/Language/Languages/GreekDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/HungarianDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/HungarianDictionary.js +40 -0
- package/dist/framework/Language/Languages/HungarianDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/IcelandicDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/IcelandicDictionary.js +40 -0
- package/dist/framework/Language/Languages/IcelandicDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/ItalianDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/ItalianDictionary.js +40 -0
- package/dist/framework/Language/Languages/ItalianDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/LatvianDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/LatvianDictionary.js +40 -0
- package/dist/framework/Language/Languages/LatvianDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/LituanianDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/LituanianDictionary.js +40 -0
- package/dist/framework/Language/Languages/LituanianDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/NorwegianDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/NorwegianDictionary.js +40 -0
- package/dist/framework/Language/Languages/NorwegianDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/PolishDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/PolishDictionary.js +40 -0
- package/dist/framework/Language/Languages/PolishDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/PortugueseDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/PortugueseDictionary.js +40 -0
- package/dist/framework/Language/Languages/PortugueseDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/SpanishDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/SpanishDictionary.js +40 -0
- package/dist/framework/Language/Languages/SpanishDictionary.js.map +1 -0
- package/dist/framework/Language/Languages/SwedishDictionary.d.ts +4 -0
- package/dist/framework/Language/Languages/SwedishDictionary.js +40 -0
- package/dist/framework/Language/Languages/SwedishDictionary.js.map +1 -0
- package/dist/framework/Language/Translator.d.ts +23 -6
- package/dist/framework/Language/Translator.js +115 -32
- package/dist/framework/Language/Translator.js.map +1 -1
- package/dist/framework/Models/OptionWithDescription.d.ts +6 -6
- package/dist/framework/Models/OptionWithDescription.js +9 -9
- package/dist/framework/Polyfills/getAttributeNamesPolyfill.d.ts +1 -1
- package/dist/framework/Polyfills/getAttributeNamesPolyfill.js +17 -17
- package/dist/framework/Translations/CaseConverter.d.ts +5 -5
- package/dist/framework/Translations/CaseConverter.js +50 -50
- package/dist/framework/Utilities/ArrayUtil.d.ts +6 -0
- package/dist/framework/Utilities/ArrayUtil.js +37 -0
- package/dist/framework/Utilities/ArrayUtil.js.map +1 -0
- package/dist/framework/Utilities/DomUtil.d.ts +21 -0
- package/dist/framework/Utilities/DomUtil.js +102 -0
- package/dist/framework/Utilities/DomUtil.js.map +1 -0
- package/dist/framework/Utilities/DomUtility.d.ts +3 -3
- package/dist/framework/Utilities/DomUtility.js +12 -12
- package/dist/framework/Utilities/MakeRequest.d.ts +8 -0
- package/dist/framework/Utilities/MakeRequest.js +49 -0
- package/dist/framework/Utilities/MakeRequest.js.map +1 -0
- package/dist/framework/Utilities/StringUtil.d.ts +4 -0
- package/dist/framework/Utilities/StringUtil.js +17 -0
- package/dist/framework/Utilities/StringUtil.js.map +1 -0
- package/dist/framework/Utilities/ViewportUtil.d.ts +8 -0
- package/dist/framework/Utilities/ViewportUtil.js +43 -0
- package/dist/framework/Utilities/ViewportUtil.js.map +1 -0
- package/dist/framework/Utilities/debouncer.d.ts +8 -8
- package/dist/framework/Utilities/debouncer.js +51 -51
- package/dist/framework/Validation/IValidator.interface.d.ts +3 -3
- package/dist/framework/Validation/IValidator.interface.js +2 -2
- package/dist/framework/Validation/Validators/BankAccount.d.ts +4 -4
- package/dist/framework/Validation/Validators/BankAccount.js +12 -12
- package/dist/framework/Validation/Validators/BankAccountRegistrationNumber.d.ts +4 -4
- package/dist/framework/Validation/Validators/BankAccountRegistrationNumber.js +12 -12
- package/dist/framework/Validation/Validators/BankIdNorway.d.ts +5 -5
- package/dist/framework/Validation/Validators/BankIdNorway.js +21 -21
- package/dist/framework/Validation/Validators/BankIdSweden.d.ts +5 -5
- package/dist/framework/Validation/Validators/BankIdSweden.js +21 -21
- package/dist/framework/Validation/Validators/CPR.d.ts +9 -9
- package/dist/framework/Validation/Validators/CPR.js +75 -75
- package/dist/framework/Validation/Validators/CVR.d.ts +5 -5
- package/dist/framework/Validation/Validators/CVR.js +30 -30
- package/dist/framework/custom-element.decorator.d.ts +9 -9
- package/dist/framework/custom-element.decorator.js +51 -51
- package/dist/index.d.ts +7 -7
- package/dist/index.js +14 -14
- package/node_modules/@webcomponents/webcomponentsjs/CHANGELOG.md +15 -0
- package/node_modules/@webcomponents/webcomponentsjs/README.md +13 -0
- package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-ce.js +31 -31
- package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-ce.js.map +1 -1
- package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-pf_dom.js +15 -13
- package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-pf_dom.js.map +1 -1
- package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-pf_js.js.map +1 -1
- package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd-ce-pf.js +237 -223
- package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd-ce-pf.js.map +1 -1
- package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd-ce.js +188 -176
- package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd-ce.js.map +1 -1
- package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd.js +155 -144
- package/node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd.js.map +1 -1
- package/node_modules/@webcomponents/webcomponentsjs/package.json +31 -64
- package/node_modules/@webcomponents/webcomponentsjs/src/entrypoints/webcomponents-pf_dom-index.js +2 -0
- package/node_modules/@webcomponents/webcomponentsjs/src/platform/event-listener-options.js +122 -0
- package/node_modules/@webcomponents/webcomponentsjs/src/platform/toggle-attribute.js +39 -0
- package/node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.d.ts +1 -0
- package/node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js +239 -225
- package/node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js.map +1 -1
- package/node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js +35 -3
- package/package.json +38 -39
- package/src/custom-form.ts +140 -139
- package/src/elements/Address/AddressElement.ts +216 -216
- package/src/elements/BankField/BankFieldElement.ts +127 -127
- package/src/elements/CPRElement/CPRElement.ts +74 -74
- package/src/elements/CVRElement/CVRElement.ts +75 -75
- package/src/elements/CheckBoxElement/CheckBoxElement.ts +99 -99
- package/src/elements/CustomRegularExpression/CustomRegularExpressionElement.ts +75 -75
- package/src/elements/DateField/DateFieldElement.ts +78 -78
- package/src/elements/DropDownList/DropDownListElement.ts +100 -100
- package/src/elements/Elements.ts +37 -37
- package/src/elements/EmailField/EmailFieldElement.ts +78 -78
- package/src/elements/FileField/FileFieldElement.ts +96 -76
- package/src/elements/IdentificationElement/IdentificationElement.ts +104 -104
- package/src/elements/InternationaPhoneNumber/InternationaPhoneNumberElement.ts +116 -111
- package/src/elements/NumericField/NumericFieldElement.ts +84 -84
- package/src/elements/RadioButtonGroup/RadioButtonGroupElement.ts +103 -103
- package/src/elements/TextAreaElement/TextAreaElement.ts +72 -72
- package/src/elements/TextField/TextFieldElement.ts +72 -72
- package/src/elements/TypeAhead/TypeAheadElement.ts +248 -248
- package/src/framework/CustomEvents.ts +47 -47
- package/src/framework/CustomInputElement.ts +277 -276
- package/src/framework/Language/Languages/Base/BaseDictionary.ts +15 -15
- package/src/framework/Language/Languages/CzechDictionary.ts +18 -0
- package/src/framework/Language/Languages/DanishDictionary.ts +17 -17
- package/src/framework/Language/Languages/DutchDictionary.ts +18 -0
- package/src/framework/Language/Languages/EnglishDictionary.ts +18 -18
- package/src/framework/Language/Languages/EstonianDictionary.ts +18 -0
- package/src/framework/Language/Languages/FinnishDictionary.ts +18 -0
- package/src/framework/Language/Languages/FrenchDictionary.ts +18 -0
- package/src/framework/Language/Languages/GermanDictionary.ts +18 -0
- package/src/framework/Language/Languages/GreekDictionary.ts +18 -0
- package/src/framework/Language/Languages/HungarianDictionary.ts +18 -0
- package/src/framework/Language/Languages/IcelandicDictionary.ts +18 -0
- package/src/framework/Language/Languages/ItalianDictionary.ts +18 -0
- package/src/framework/Language/Languages/LatvianDictionary.ts +18 -0
- package/src/framework/Language/Languages/LituanianDictionary.ts +18 -0
- package/src/framework/Language/Languages/NorwegianDictionary.ts +18 -0
- package/src/framework/Language/Languages/PolishDictionary.ts +18 -0
- package/src/framework/Language/Languages/PortugueseDictionary.ts +18 -0
- package/src/framework/Language/Languages/SpanishDictionary.ts +18 -0
- package/src/framework/Language/Languages/SwedishDictionary.ts +18 -0
- package/src/framework/Language/Translator.ts +110 -26
- package/src/framework/Models/OptionWithDescription.ts +8 -8
- package/src/framework/Polyfills/getAttributeNamesPolyfill.ts +13 -13
- package/src/framework/Translations/CaseConverter.ts +43 -43
- package/src/framework/Utilities/ArrayUtil.ts +31 -0
- package/src/framework/Utilities/DomUtil.ts +117 -0
- package/src/framework/Utilities/DomUtility.ts +6 -6
- package/src/framework/Utilities/MakeRequest.ts +47 -0
- package/src/framework/Utilities/StringUtil.ts +9 -0
- package/src/framework/Utilities/ViewportUtil.ts +46 -0
- package/src/framework/Utilities/debouncer.ts +66 -66
- package/src/framework/Validation/IValidator.interface.ts +3 -3
- package/src/framework/Validation/Validators/BankAccount.ts +7 -7
- package/src/framework/Validation/Validators/BankAccountRegistrationNumber.ts +8 -8
- package/src/framework/Validation/Validators/BankIdNorway.ts +21 -21
- package/src/framework/Validation/Validators/BankIdSweden.ts +21 -21
- package/src/framework/Validation/Validators/CPR.ts +82 -82
- package/src/framework/Validation/Validators/CVR.ts +27 -27
- package/src/framework/custom-element.decorator.ts +57 -57
- package/src/index.ts +12 -12
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StringUtil = void 0;
|
|
4
|
+
var StringUtil = /** @class */ (function () {
|
|
5
|
+
function StringUtil() {
|
|
6
|
+
}
|
|
7
|
+
StringUtil.StringFormat = function (str) {
|
|
8
|
+
var args = [];
|
|
9
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
10
|
+
args[_i - 1] = arguments[_i];
|
|
11
|
+
}
|
|
12
|
+
return str.replace(/{(\d+)}/g, function (match, index) { return args[index] || ''; });
|
|
13
|
+
};
|
|
14
|
+
return StringUtil;
|
|
15
|
+
}());
|
|
16
|
+
exports.StringUtil = StringUtil;
|
|
17
|
+
//# sourceMappingURL=StringUtil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StringUtil.js","sourceRoot":"","sources":["../../../src/framework/Utilities/StringUtil.ts"],"names":[],"mappings":";;;AAAA;IAEI;IACA,CAAC;IAEa,uBAAY,GAA1B,UAA2B,GAAW;QAAE,cAAiB;aAAjB,UAAiB,EAAjB,qBAAiB,EAAjB,IAAiB;YAAjB,6BAAiB;;QACrD,OAAO,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,UAAC,KAAK,EAAE,KAAK,IAAK,OAAA,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,EAAjB,CAAiB,CAAC,CAAC;IACxE,CAAC;IACL,iBAAC;AAAD,CAAC,AARD,IAQC;AARY,gCAAU"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ViewportUtil = void 0;
|
|
4
|
+
var ViewportUtil = /** @class */ (function () {
|
|
5
|
+
function ViewportUtil(element) {
|
|
6
|
+
if (element === void 0) { element = null; }
|
|
7
|
+
this.element = element;
|
|
8
|
+
}
|
|
9
|
+
ViewportUtil.prototype.IsVisible = function () {
|
|
10
|
+
var bounds = this.element.getBoundingClientRect();
|
|
11
|
+
return (((bounds.top > 0 && bounds.top < innerHeight) ||
|
|
12
|
+
(bounds.bottom > 0 && bounds.bottom < innerHeight)) &&
|
|
13
|
+
((bounds.left > 0 && bounds.left < innerWidth) ||
|
|
14
|
+
(bounds.right > 0 && bounds.right < innerWidth)));
|
|
15
|
+
};
|
|
16
|
+
ViewportUtil.prototype.IsPartiallyVisible = function () {
|
|
17
|
+
var bounds = this.element.getBoundingClientRect();
|
|
18
|
+
return (bounds.top >= 0 ||
|
|
19
|
+
bounds.left >= 0 ||
|
|
20
|
+
bounds.bottom <= innerHeight ||
|
|
21
|
+
bounds.right <= innerWidth);
|
|
22
|
+
};
|
|
23
|
+
ViewportUtil.prototype.IsOffsetVisible = function (offset) {
|
|
24
|
+
if (offset === void 0) { offset = 300; }
|
|
25
|
+
var bounds = this.element.getBoundingClientRect();
|
|
26
|
+
// tslint:disable-next-line: max-line-length
|
|
27
|
+
return (bounds.top + offset >= 0 ||
|
|
28
|
+
bounds.left + offset >= 0 ||
|
|
29
|
+
bounds.bottom - offset <= innerHeight ||
|
|
30
|
+
bounds.right - offset <= innerWidth);
|
|
31
|
+
};
|
|
32
|
+
ViewportUtil.prototype.WindowTop = function (offset) {
|
|
33
|
+
if (offset === void 0) { offset = 0; }
|
|
34
|
+
var YOffset = window.pageYOffset ||
|
|
35
|
+
document.documentElement.scrollTop ||
|
|
36
|
+
document.body.scrollTop ||
|
|
37
|
+
0;
|
|
38
|
+
return offset <= YOffset;
|
|
39
|
+
};
|
|
40
|
+
return ViewportUtil;
|
|
41
|
+
}());
|
|
42
|
+
exports.ViewportUtil = ViewportUtil;
|
|
43
|
+
//# sourceMappingURL=ViewportUtil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ViewportUtil.js","sourceRoot":"","sources":["../../../src/framework/Utilities/ViewportUtil.ts"],"names":[],"mappings":";;;AAAA;IAEI,sBAAY,OAA2B;QAA3B,wBAAA,EAAA,cAA2B;QACnC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAEM,gCAAS,GAAhB;QACI,IAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC;QACpD,OAAO,CACH,CAAC,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,GAAG,WAAW,CAAC;YACzC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,GAAG,WAAW,CAAC,CAAC;YACvD,CAAC,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,IAAI,MAAM,CAAC,IAAI,GAAG,UAAU,CAAC;gBAC1C,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,IAAI,MAAM,CAAC,KAAK,GAAG,UAAU,CAAC,CAAC,CACvD,CAAC;IACN,CAAC;IAEM,yCAAkB,GAAzB;QACI,IAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC;QACpD,OAAO,CACH,MAAM,CAAC,GAAG,IAAI,CAAC;YACf,MAAM,CAAC,IAAI,IAAI,CAAC;YAChB,MAAM,CAAC,MAAM,IAAI,WAAW;YAC5B,MAAM,CAAC,KAAK,IAAI,UAAU,CAC7B,CAAC;IACN,CAAC;IAEM,sCAAe,GAAtB,UAAuB,MAAoB;QAApB,uBAAA,EAAA,YAAoB;QACvC,IAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC;QACpD,4CAA4C;QAC5C,OAAO,CACH,MAAM,CAAC,GAAG,GAAG,MAAM,IAAI,CAAC;YACxB,MAAM,CAAC,IAAI,GAAG,MAAM,IAAI,CAAC;YACzB,MAAM,CAAC,MAAM,GAAG,MAAM,IAAI,WAAW;YACrC,MAAM,CAAC,KAAK,GAAG,MAAM,IAAI,UAAU,CACtC,CAAC;IACN,CAAC;IAEM,gCAAS,GAAhB,UAAiB,MAAkB;QAAlB,uBAAA,EAAA,UAAkB;QAC/B,IAAM,OAAO,GACT,MAAM,CAAC,WAAW;YAClB,QAAQ,CAAC,eAAe,CAAC,SAAS;YAClC,QAAQ,CAAC,IAAI,CAAC,SAAS;YACvB,CAAC,CAAC;QACN,OAAO,MAAM,IAAI,OAAO,CAAC;IAC7B,CAAC;IACL,mBAAC;AAAD,CAAC,AA7CD,IA6CC;AA7CY,oCAAY"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
declare type Procedure = (...args: any[]) => any;
|
|
2
|
-
interface Debounce {
|
|
3
|
-
(...args: any[]): any;
|
|
4
|
-
clear: () => void;
|
|
5
|
-
flush: () => void;
|
|
6
|
-
}
|
|
7
|
-
declare const debouncer: (func: Procedure, wait: number, immediate?: boolean) => Debounce;
|
|
8
|
-
export default debouncer;
|
|
1
|
+
declare type Procedure = (...args: any[]) => any;
|
|
2
|
+
interface Debounce {
|
|
3
|
+
(...args: any[]): any;
|
|
4
|
+
clear: () => void;
|
|
5
|
+
flush: () => void;
|
|
6
|
+
}
|
|
7
|
+
declare const debouncer: (func: Procedure, wait: number, immediate?: boolean) => Debounce;
|
|
8
|
+
export default debouncer;
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var debouncer = function (func, wait, immediate) {
|
|
4
|
-
if (immediate === void 0) { immediate = false; }
|
|
5
|
-
var timeout;
|
|
6
|
-
var args;
|
|
7
|
-
var context;
|
|
8
|
-
var result;
|
|
9
|
-
var later = function () {
|
|
10
|
-
timeout = null;
|
|
11
|
-
if (!immediate) {
|
|
12
|
-
result = func.apply(context, args);
|
|
13
|
-
context = args = null;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
var debouncedFunc = function () {
|
|
17
|
-
context = this;
|
|
18
|
-
args = arguments;
|
|
19
|
-
var callNow = immediate && !timeout;
|
|
20
|
-
if (!timeout) {
|
|
21
|
-
timeout = window.setTimeout(later, wait);
|
|
22
|
-
}
|
|
23
|
-
if (callNow) {
|
|
24
|
-
result = func.apply(context, args);
|
|
25
|
-
context = args = null;
|
|
26
|
-
}
|
|
27
|
-
return result;
|
|
28
|
-
};
|
|
29
|
-
var clear = function () {
|
|
30
|
-
if (timeout) {
|
|
31
|
-
clearTimeout(timeout);
|
|
32
|
-
timeout = null;
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
var flush = function () {
|
|
36
|
-
if (timeout) {
|
|
37
|
-
result = func.apply(context, args);
|
|
38
|
-
context = args = null;
|
|
39
|
-
clearTimeout(timeout);
|
|
40
|
-
timeout = null;
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
var debounced = (function () {
|
|
44
|
-
var f = debouncedFunc;
|
|
45
|
-
f.clear = clear;
|
|
46
|
-
f.flush = flush;
|
|
47
|
-
return f;
|
|
48
|
-
})();
|
|
49
|
-
return debounced;
|
|
50
|
-
};
|
|
51
|
-
exports.default = debouncer;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var debouncer = function (func, wait, immediate) {
|
|
4
|
+
if (immediate === void 0) { immediate = false; }
|
|
5
|
+
var timeout;
|
|
6
|
+
var args;
|
|
7
|
+
var context;
|
|
8
|
+
var result;
|
|
9
|
+
var later = function () {
|
|
10
|
+
timeout = null;
|
|
11
|
+
if (!immediate) {
|
|
12
|
+
result = func.apply(context, args);
|
|
13
|
+
context = args = null;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var debouncedFunc = function () {
|
|
17
|
+
context = this;
|
|
18
|
+
args = arguments;
|
|
19
|
+
var callNow = immediate && !timeout;
|
|
20
|
+
if (!timeout) {
|
|
21
|
+
timeout = window.setTimeout(later, wait);
|
|
22
|
+
}
|
|
23
|
+
if (callNow) {
|
|
24
|
+
result = func.apply(context, args);
|
|
25
|
+
context = args = null;
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
var clear = function () {
|
|
30
|
+
if (timeout) {
|
|
31
|
+
clearTimeout(timeout);
|
|
32
|
+
timeout = null;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var flush = function () {
|
|
36
|
+
if (timeout) {
|
|
37
|
+
result = func.apply(context, args);
|
|
38
|
+
context = args = null;
|
|
39
|
+
clearTimeout(timeout);
|
|
40
|
+
timeout = null;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var debounced = (function () {
|
|
44
|
+
var f = debouncedFunc;
|
|
45
|
+
f.clear = clear;
|
|
46
|
+
f.flush = flush;
|
|
47
|
+
return f;
|
|
48
|
+
})();
|
|
49
|
+
return debounced;
|
|
50
|
+
};
|
|
51
|
+
exports.default = debouncer;
|
|
52
52
|
//# sourceMappingURL=debouncer.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export default interface IValidator {
|
|
2
|
-
isSatisfiedBy(input: string, allowEmpty: boolean): boolean;
|
|
3
|
-
}
|
|
1
|
+
export default interface IValidator {
|
|
2
|
+
isSatisfiedBy(input: string, allowEmpty: boolean): boolean;
|
|
3
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=IValidator.interface.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import IValidation from '../IValidator.interface';
|
|
2
|
-
export default class BankAccountValidator implements IValidation {
|
|
3
|
-
isSatisfiedBy(input: string, allowEmpty?: boolean): boolean;
|
|
4
|
-
}
|
|
1
|
+
import IValidation from '../IValidator.interface';
|
|
2
|
+
export default class BankAccountValidator implements IValidation {
|
|
3
|
+
isSatisfiedBy(input: string, allowEmpty?: boolean): boolean;
|
|
4
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var BankAccountValidator = /** @class */ (function () {
|
|
4
|
-
function BankAccountValidator() {
|
|
5
|
-
}
|
|
6
|
-
BankAccountValidator.prototype.isSatisfiedBy = function (input, allowEmpty) {
|
|
7
|
-
if (allowEmpty === void 0) { allowEmpty = true; }
|
|
8
|
-
return true;
|
|
9
|
-
};
|
|
10
|
-
return BankAccountValidator;
|
|
11
|
-
}());
|
|
12
|
-
exports.default = BankAccountValidator;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var BankAccountValidator = /** @class */ (function () {
|
|
4
|
+
function BankAccountValidator() {
|
|
5
|
+
}
|
|
6
|
+
BankAccountValidator.prototype.isSatisfiedBy = function (input, allowEmpty) {
|
|
7
|
+
if (allowEmpty === void 0) { allowEmpty = true; }
|
|
8
|
+
return true;
|
|
9
|
+
};
|
|
10
|
+
return BankAccountValidator;
|
|
11
|
+
}());
|
|
12
|
+
exports.default = BankAccountValidator;
|
|
13
13
|
//# sourceMappingURL=BankAccount.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import IValidation from '../IValidator.interface';
|
|
2
|
-
export default class BankAccountRegistrationNumberValidator implements IValidation {
|
|
3
|
-
isSatisfiedBy(input: string, allowEmpty?: boolean): boolean;
|
|
4
|
-
}
|
|
1
|
+
import IValidation from '../IValidator.interface';
|
|
2
|
+
export default class BankAccountRegistrationNumberValidator implements IValidation {
|
|
3
|
+
isSatisfiedBy(input: string, allowEmpty?: boolean): boolean;
|
|
4
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var BankAccountRegistrationNumberValidator = /** @class */ (function () {
|
|
4
|
-
function BankAccountRegistrationNumberValidator() {
|
|
5
|
-
}
|
|
6
|
-
BankAccountRegistrationNumberValidator.prototype.isSatisfiedBy = function (input, allowEmpty) {
|
|
7
|
-
if (allowEmpty === void 0) { allowEmpty = true; }
|
|
8
|
-
return true;
|
|
9
|
-
};
|
|
10
|
-
return BankAccountRegistrationNumberValidator;
|
|
11
|
-
}());
|
|
12
|
-
exports.default = BankAccountRegistrationNumberValidator;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var BankAccountRegistrationNumberValidator = /** @class */ (function () {
|
|
4
|
+
function BankAccountRegistrationNumberValidator() {
|
|
5
|
+
}
|
|
6
|
+
BankAccountRegistrationNumberValidator.prototype.isSatisfiedBy = function (input, allowEmpty) {
|
|
7
|
+
if (allowEmpty === void 0) { allowEmpty = true; }
|
|
8
|
+
return true;
|
|
9
|
+
};
|
|
10
|
+
return BankAccountRegistrationNumberValidator;
|
|
11
|
+
}());
|
|
12
|
+
exports.default = BankAccountRegistrationNumberValidator;
|
|
13
13
|
//# sourceMappingURL=BankAccountRegistrationNumber.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import IValidation from '../IValidator.interface';
|
|
2
|
-
export default class BankIdNorwayValidator implements IValidation {
|
|
3
|
-
isSatisfiedBy(input: string, allowEmpty?: boolean): boolean;
|
|
4
|
-
private checkNoPersonnummer;
|
|
5
|
-
}
|
|
1
|
+
import IValidation from '../IValidator.interface';
|
|
2
|
+
export default class BankIdNorwayValidator implements IValidation {
|
|
3
|
+
isSatisfiedBy(input: string, allowEmpty?: boolean): boolean;
|
|
4
|
+
private checkNoPersonnummer;
|
|
5
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var BankIdNorwayValidator = /** @class */ (function () {
|
|
4
|
-
function BankIdNorwayValidator() {
|
|
5
|
-
}
|
|
6
|
-
BankIdNorwayValidator.prototype.isSatisfiedBy = function (input, allowEmpty) {
|
|
7
|
-
if (allowEmpty === void 0) { allowEmpty = true; }
|
|
8
|
-
return this.checkNoPersonnummer(input, allowEmpty);
|
|
9
|
-
};
|
|
10
|
-
BankIdNorwayValidator.prototype.checkNoPersonnummer = function (input, allowEmpty) {
|
|
11
|
-
if (allowEmpty === void 0) { allowEmpty = true; }
|
|
12
|
-
if (!input) {
|
|
13
|
-
return allowEmpty;
|
|
14
|
-
}
|
|
15
|
-
var personnummer = input.replace(' ', '').replace('-', '');
|
|
16
|
-
var regex = new RegExp(/^(0[1-9]|1[0-9]|2[0-9]|3[0-1])(0[1-9]|1[0-2])(\d{2})(\d{5})$/);
|
|
17
|
-
return regex.test(personnummer);
|
|
18
|
-
};
|
|
19
|
-
return BankIdNorwayValidator;
|
|
20
|
-
}());
|
|
21
|
-
exports.default = BankIdNorwayValidator;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var BankIdNorwayValidator = /** @class */ (function () {
|
|
4
|
+
function BankIdNorwayValidator() {
|
|
5
|
+
}
|
|
6
|
+
BankIdNorwayValidator.prototype.isSatisfiedBy = function (input, allowEmpty) {
|
|
7
|
+
if (allowEmpty === void 0) { allowEmpty = true; }
|
|
8
|
+
return this.checkNoPersonnummer(input, allowEmpty);
|
|
9
|
+
};
|
|
10
|
+
BankIdNorwayValidator.prototype.checkNoPersonnummer = function (input, allowEmpty) {
|
|
11
|
+
if (allowEmpty === void 0) { allowEmpty = true; }
|
|
12
|
+
if (!input) {
|
|
13
|
+
return allowEmpty;
|
|
14
|
+
}
|
|
15
|
+
var personnummer = input.replace(' ', '').replace('-', '');
|
|
16
|
+
var regex = new RegExp(/^(0[1-9]|1[0-9]|2[0-9]|3[0-1])(0[1-9]|1[0-2])(\d{2})(\d{5})$/);
|
|
17
|
+
return regex.test(personnummer);
|
|
18
|
+
};
|
|
19
|
+
return BankIdNorwayValidator;
|
|
20
|
+
}());
|
|
21
|
+
exports.default = BankIdNorwayValidator;
|
|
22
22
|
//# sourceMappingURL=BankIdNorway.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import IValidation from '../IValidator.interface';
|
|
2
|
-
export default class BankIdSwedenValidator implements IValidation {
|
|
3
|
-
isSatisfiedBy(input: string, allowEmpty?: boolean): boolean;
|
|
4
|
-
private checkSePersonnummer;
|
|
5
|
-
}
|
|
1
|
+
import IValidation from '../IValidator.interface';
|
|
2
|
+
export default class BankIdSwedenValidator implements IValidation {
|
|
3
|
+
isSatisfiedBy(input: string, allowEmpty?: boolean): boolean;
|
|
4
|
+
private checkSePersonnummer;
|
|
5
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var BankIdSwedenValidator = /** @class */ (function () {
|
|
4
|
-
function BankIdSwedenValidator() {
|
|
5
|
-
}
|
|
6
|
-
BankIdSwedenValidator.prototype.isSatisfiedBy = function (input, allowEmpty) {
|
|
7
|
-
if (allowEmpty === void 0) { allowEmpty = true; }
|
|
8
|
-
return this.checkSePersonnummer(input, allowEmpty);
|
|
9
|
-
};
|
|
10
|
-
BankIdSwedenValidator.prototype.checkSePersonnummer = function (input, allowEmpty) {
|
|
11
|
-
if (allowEmpty === void 0) { allowEmpty = true; }
|
|
12
|
-
if (!input) {
|
|
13
|
-
return allowEmpty;
|
|
14
|
-
}
|
|
15
|
-
var personnummer = input.replace(' ', '').replace('-', '');
|
|
16
|
-
var regex = new RegExp(/^(19\d{2}|20\d{2})(0[1-9]|1[0-2])(0[1-9]|1[0-9]|2[0-9]|3[0-1])(\d{4})$/);
|
|
17
|
-
return regex.test(personnummer);
|
|
18
|
-
};
|
|
19
|
-
return BankIdSwedenValidator;
|
|
20
|
-
}());
|
|
21
|
-
exports.default = BankIdSwedenValidator;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var BankIdSwedenValidator = /** @class */ (function () {
|
|
4
|
+
function BankIdSwedenValidator() {
|
|
5
|
+
}
|
|
6
|
+
BankIdSwedenValidator.prototype.isSatisfiedBy = function (input, allowEmpty) {
|
|
7
|
+
if (allowEmpty === void 0) { allowEmpty = true; }
|
|
8
|
+
return this.checkSePersonnummer(input, allowEmpty);
|
|
9
|
+
};
|
|
10
|
+
BankIdSwedenValidator.prototype.checkSePersonnummer = function (input, allowEmpty) {
|
|
11
|
+
if (allowEmpty === void 0) { allowEmpty = true; }
|
|
12
|
+
if (!input) {
|
|
13
|
+
return allowEmpty;
|
|
14
|
+
}
|
|
15
|
+
var personnummer = input.replace(' ', '').replace('-', '');
|
|
16
|
+
var regex = new RegExp(/^(19\d{2}|20\d{2})(0[1-9]|1[0-2])(0[1-9]|1[0-9]|2[0-9]|3[0-1])(\d{4})$/);
|
|
17
|
+
return regex.test(personnummer);
|
|
18
|
+
};
|
|
19
|
+
return BankIdSwedenValidator;
|
|
20
|
+
}());
|
|
21
|
+
exports.default = BankIdSwedenValidator;
|
|
22
22
|
//# sourceMappingURL=BankIdSweden.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import IValidation from '../IValidator.interface';
|
|
2
|
-
export default class CprValidator implements IValidation {
|
|
3
|
-
isSatisfiedBy(input: string, allowEmpty?: boolean): boolean;
|
|
4
|
-
private modulus11Multiply;
|
|
5
|
-
private modulus11Exceptions;
|
|
6
|
-
private checkCprDate;
|
|
7
|
-
private getCprDate;
|
|
8
|
-
private checkCpr;
|
|
9
|
-
}
|
|
1
|
+
import IValidation from '../IValidator.interface';
|
|
2
|
+
export default class CprValidator implements IValidation {
|
|
3
|
+
isSatisfiedBy(input: string, allowEmpty?: boolean): boolean;
|
|
4
|
+
private modulus11Multiply;
|
|
5
|
+
private modulus11Exceptions;
|
|
6
|
+
private checkCprDate;
|
|
7
|
+
private getCprDate;
|
|
8
|
+
private checkCpr;
|
|
9
|
+
}
|
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var CprValidator = /** @class */ (function () {
|
|
4
|
-
function CprValidator() {
|
|
5
|
-
}
|
|
6
|
-
CprValidator.prototype.isSatisfiedBy = function (input, allowEmpty) {
|
|
7
|
-
if (allowEmpty === void 0) { allowEmpty = true; }
|
|
8
|
-
return this.checkCpr(input, allowEmpty);
|
|
9
|
-
};
|
|
10
|
-
CprValidator.prototype.modulus11Multiply = function (value, index) {
|
|
11
|
-
var control = [4, 3, 2, 7, 6, 5, 4, 3, 2, 1];
|
|
12
|
-
return control[index] * value;
|
|
13
|
-
};
|
|
14
|
-
CprValidator.prototype.modulus11Exceptions = function (input) {
|
|
15
|
-
var exceptionDates = [
|
|
16
|
-
1960,
|
|
17
|
-
1964,
|
|
18
|
-
1965,
|
|
19
|
-
1966,
|
|
20
|
-
1969,
|
|
21
|
-
1970,
|
|
22
|
-
1980,
|
|
23
|
-
1982,
|
|
24
|
-
1984,
|
|
25
|
-
1985,
|
|
26
|
-
1986,
|
|
27
|
-
1987,
|
|
28
|
-
1988,
|
|
29
|
-
1989,
|
|
30
|
-
1990,
|
|
31
|
-
].map(function (x) { return new Date(x, 0, 1); }); // months are 0-indexed
|
|
32
|
-
var cprDate = this.getCprDate(input);
|
|
33
|
-
return exceptionDates.some(function (x) { return x.getDate() === cprDate.getDate(); });
|
|
34
|
-
};
|
|
35
|
-
CprValidator.prototype.checkCprDate = function (input) {
|
|
36
|
-
var year = +input.substr(4, 2) + 2000;
|
|
37
|
-
year -= year > new Date().getFullYear() ? 100 : 0; // is 20xx or 19xx
|
|
38
|
-
var month = +input.substr(2, 2) - 1;
|
|
39
|
-
var day = +input.substr(0, 2);
|
|
40
|
-
var date = new Date(year, month, day);
|
|
41
|
-
return (date.getFullYear() === year &&
|
|
42
|
-
date.getMonth() === month &&
|
|
43
|
-
date.getDate() === day);
|
|
44
|
-
};
|
|
45
|
-
CprValidator.prototype.getCprDate = function (input) {
|
|
46
|
-
var year = +input.substr(4, 2) + 2000;
|
|
47
|
-
year -= year > new Date().getFullYear() ? 100 : 0; // is 20xx or 19xx
|
|
48
|
-
var month = +input.substr(2, 2) - 1;
|
|
49
|
-
var day = +input.substr(0, 2);
|
|
50
|
-
return new Date(year, month, day);
|
|
51
|
-
};
|
|
52
|
-
CprValidator.prototype.checkCpr = function (input, allowEmpty) {
|
|
53
|
-
if (allowEmpty === void 0) { allowEmpty = true; }
|
|
54
|
-
if (!input) {
|
|
55
|
-
return allowEmpty;
|
|
56
|
-
}
|
|
57
|
-
var cprnr = input.replace(' ', '').replace('-', '');
|
|
58
|
-
if (!cprnr.match(/^\d{10}$/)) {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
if (!this.checkCprDate(cprnr)) {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
if (this.modulus11Exceptions(cprnr)) {
|
|
65
|
-
return true;
|
|
66
|
-
}
|
|
67
|
-
var output = 0;
|
|
68
|
-
for (var i = 0; i < 10; i++) {
|
|
69
|
-
output += this.modulus11Multiply(parseInt(cprnr.substr(i, 1), 10), i);
|
|
70
|
-
}
|
|
71
|
-
return output % 11 === 0; // hvis output går op i 11, er det et gyldigt cpr.
|
|
72
|
-
};
|
|
73
|
-
return CprValidator;
|
|
74
|
-
}());
|
|
75
|
-
exports.default = CprValidator;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var CprValidator = /** @class */ (function () {
|
|
4
|
+
function CprValidator() {
|
|
5
|
+
}
|
|
6
|
+
CprValidator.prototype.isSatisfiedBy = function (input, allowEmpty) {
|
|
7
|
+
if (allowEmpty === void 0) { allowEmpty = true; }
|
|
8
|
+
return this.checkCpr(input, allowEmpty);
|
|
9
|
+
};
|
|
10
|
+
CprValidator.prototype.modulus11Multiply = function (value, index) {
|
|
11
|
+
var control = [4, 3, 2, 7, 6, 5, 4, 3, 2, 1];
|
|
12
|
+
return control[index] * value;
|
|
13
|
+
};
|
|
14
|
+
CprValidator.prototype.modulus11Exceptions = function (input) {
|
|
15
|
+
var exceptionDates = [
|
|
16
|
+
1960,
|
|
17
|
+
1964,
|
|
18
|
+
1965,
|
|
19
|
+
1966,
|
|
20
|
+
1969,
|
|
21
|
+
1970,
|
|
22
|
+
1980,
|
|
23
|
+
1982,
|
|
24
|
+
1984,
|
|
25
|
+
1985,
|
|
26
|
+
1986,
|
|
27
|
+
1987,
|
|
28
|
+
1988,
|
|
29
|
+
1989,
|
|
30
|
+
1990,
|
|
31
|
+
].map(function (x) { return new Date(x, 0, 1); }); // months are 0-indexed
|
|
32
|
+
var cprDate = this.getCprDate(input);
|
|
33
|
+
return exceptionDates.some(function (x) { return x.getDate() === cprDate.getDate(); });
|
|
34
|
+
};
|
|
35
|
+
CprValidator.prototype.checkCprDate = function (input) {
|
|
36
|
+
var year = +input.substr(4, 2) + 2000;
|
|
37
|
+
year -= year > new Date().getFullYear() ? 100 : 0; // is 20xx or 19xx
|
|
38
|
+
var month = +input.substr(2, 2) - 1;
|
|
39
|
+
var day = +input.substr(0, 2);
|
|
40
|
+
var date = new Date(year, month, day);
|
|
41
|
+
return (date.getFullYear() === year &&
|
|
42
|
+
date.getMonth() === month &&
|
|
43
|
+
date.getDate() === day);
|
|
44
|
+
};
|
|
45
|
+
CprValidator.prototype.getCprDate = function (input) {
|
|
46
|
+
var year = +input.substr(4, 2) + 2000;
|
|
47
|
+
year -= year > new Date().getFullYear() ? 100 : 0; // is 20xx or 19xx
|
|
48
|
+
var month = +input.substr(2, 2) - 1;
|
|
49
|
+
var day = +input.substr(0, 2);
|
|
50
|
+
return new Date(year, month, day);
|
|
51
|
+
};
|
|
52
|
+
CprValidator.prototype.checkCpr = function (input, allowEmpty) {
|
|
53
|
+
if (allowEmpty === void 0) { allowEmpty = true; }
|
|
54
|
+
if (!input) {
|
|
55
|
+
return allowEmpty;
|
|
56
|
+
}
|
|
57
|
+
var cprnr = input.replace(' ', '').replace('-', '');
|
|
58
|
+
if (!cprnr.match(/^\d{10}$/)) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
if (!this.checkCprDate(cprnr)) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
if (this.modulus11Exceptions(cprnr)) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
var output = 0;
|
|
68
|
+
for (var i = 0; i < 10; i++) {
|
|
69
|
+
output += this.modulus11Multiply(parseInt(cprnr.substr(i, 1), 10), i);
|
|
70
|
+
}
|
|
71
|
+
return output % 11 === 0; // hvis output går op i 11, er det et gyldigt cpr.
|
|
72
|
+
};
|
|
73
|
+
return CprValidator;
|
|
74
|
+
}());
|
|
75
|
+
exports.default = CprValidator;
|
|
76
76
|
//# sourceMappingURL=CPR.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import IValidation from '../IValidator.interface';
|
|
2
|
-
export default class CvrValidator implements IValidation {
|
|
3
|
-
isSatisfiedBy(input: string, allowEmpty?: boolean): boolean;
|
|
4
|
-
private checkCvr;
|
|
5
|
-
}
|
|
1
|
+
import IValidation from '../IValidator.interface';
|
|
2
|
+
export default class CvrValidator implements IValidation {
|
|
3
|
+
isSatisfiedBy(input: string, allowEmpty?: boolean): boolean;
|
|
4
|
+
private checkCvr;
|
|
5
|
+
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var CvrValidator = /** @class */ (function () {
|
|
4
|
-
function CvrValidator() {
|
|
5
|
-
}
|
|
6
|
-
CvrValidator.prototype.isSatisfiedBy = function (input, allowEmpty) {
|
|
7
|
-
if (allowEmpty === void 0) { allowEmpty = true; }
|
|
8
|
-
return this.checkCvr(input, allowEmpty);
|
|
9
|
-
};
|
|
10
|
-
CvrValidator.prototype.checkCvr = function (input, allowEmpty) {
|
|
11
|
-
if (allowEmpty === void 0) { allowEmpty = true; }
|
|
12
|
-
if (!allowEmpty && !input)
|
|
13
|
-
return false;
|
|
14
|
-
var cvrnr = input.replace(' ', '').replace('-', '');
|
|
15
|
-
if (!cvrnr) {
|
|
16
|
-
return allowEmpty;
|
|
17
|
-
}
|
|
18
|
-
if (!/^\d{8}$/.test(cvrnr)) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
// cvr numre kan åbenbart også modulus11 testes.
|
|
22
|
-
var total = 0;
|
|
23
|
-
[2, 7, 6, 5, 4, 3, 2, 1].forEach(function (elm, index) {
|
|
24
|
-
total += parseInt(cvrnr[index], 10) * elm;
|
|
25
|
-
});
|
|
26
|
-
return total % 11 === 0;
|
|
27
|
-
};
|
|
28
|
-
return CvrValidator;
|
|
29
|
-
}());
|
|
30
|
-
exports.default = CvrValidator;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var CvrValidator = /** @class */ (function () {
|
|
4
|
+
function CvrValidator() {
|
|
5
|
+
}
|
|
6
|
+
CvrValidator.prototype.isSatisfiedBy = function (input, allowEmpty) {
|
|
7
|
+
if (allowEmpty === void 0) { allowEmpty = true; }
|
|
8
|
+
return this.checkCvr(input, allowEmpty);
|
|
9
|
+
};
|
|
10
|
+
CvrValidator.prototype.checkCvr = function (input, allowEmpty) {
|
|
11
|
+
if (allowEmpty === void 0) { allowEmpty = true; }
|
|
12
|
+
if (!allowEmpty && !input)
|
|
13
|
+
return false;
|
|
14
|
+
var cvrnr = input.replace(' ', '').replace('-', '');
|
|
15
|
+
if (!cvrnr) {
|
|
16
|
+
return allowEmpty;
|
|
17
|
+
}
|
|
18
|
+
if (!/^\d{8}$/.test(cvrnr)) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
// cvr numre kan åbenbart også modulus11 testes.
|
|
22
|
+
var total = 0;
|
|
23
|
+
[2, 7, 6, 5, 4, 3, 2, 1].forEach(function (elm, index) {
|
|
24
|
+
total += parseInt(cvrnr[index], 10) * elm;
|
|
25
|
+
});
|
|
26
|
+
return total % 11 === 0;
|
|
27
|
+
};
|
|
28
|
+
return CvrValidator;
|
|
29
|
+
}());
|
|
30
|
+
exports.default = CvrValidator;
|
|
31
31
|
//# sourceMappingURL=CVR.js.map
|