@fkui/logic 6.39.0 → 6.41.0
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/lib/cjs/index.js +79 -79
- package/lib/esm/index.js +79 -79
- package/lib/types/tsdoc-metadata.json +1 -1
- package/package.json +9 -9
package/lib/cjs/index.js
CHANGED
|
@@ -3871,84 +3871,6 @@ const TranslationService =
|
|
|
3871
3871
|
/* @__PURE__ */
|
|
3872
3872
|
new TranslationServiceImpl();
|
|
3873
3873
|
|
|
3874
|
-
/**
|
|
3875
|
-
* @internal
|
|
3876
|
-
*/
|
|
3877
|
-
function createFieldsetValidator(element, validationService) {
|
|
3878
|
-
/* eslint-disable-next-line no-new, sonarjs/constructor-for-side-effects --
|
|
3879
|
-
* technical debt, this should be refactored as to not rely of side-effects
|
|
3880
|
-
* of the constructor */
|
|
3881
|
-
new FieldsetValidationHandler(element, validationService);
|
|
3882
|
-
}
|
|
3883
|
-
class FieldsetValidationHandler {
|
|
3884
|
-
hasDocumentListener = false;
|
|
3885
|
-
documentFocusInRef = undefined;
|
|
3886
|
-
element;
|
|
3887
|
-
validationService;
|
|
3888
|
-
constructor(element, validationService) {
|
|
3889
|
-
Object.assign(this);
|
|
3890
|
-
this.element = element;
|
|
3891
|
-
this.validationService = validationService;
|
|
3892
|
-
element.addEventListener("focusin", (event) => {
|
|
3893
|
-
this.onFocusIn(event);
|
|
3894
|
-
});
|
|
3895
|
-
// Handle checking of input by using keyboard (space)
|
|
3896
|
-
element.addEventListener("change", this.documentFocusIn.bind(this));
|
|
3897
|
-
Array.from(this.element.querySelectorAll("input[type='checkbox'], input[type='radio']"))
|
|
3898
|
-
.filter((childElement) => childElement.closest("fieldset") === element)
|
|
3899
|
-
/* eslint-disable-next-line unicorn/no-array-for-each -- technical debt */
|
|
3900
|
-
.forEach((childElement) => {
|
|
3901
|
-
childElement.setAttribute("required", "");
|
|
3902
|
-
});
|
|
3903
|
-
}
|
|
3904
|
-
hasFocusableTarget(target) {
|
|
3905
|
-
return target
|
|
3906
|
-
? Array.from(this.element.querySelectorAll("input, label")).some((element) => element === target)
|
|
3907
|
-
: false;
|
|
3908
|
-
}
|
|
3909
|
-
onFocusIn(event) {
|
|
3910
|
-
// IE11 (not Chrome / FF) trigger focusin-event on legends and other elements inside the fieldset
|
|
3911
|
-
// So we need to check the event target, if it's focusable.
|
|
3912
|
-
if (this.hasFocusableTarget(event.target) &&
|
|
3913
|
-
!this.hasDocumentListener) {
|
|
3914
|
-
this.documentFocusInRef = this.documentFocusIn.bind(this);
|
|
3915
|
-
document.addEventListener("focusin", this.documentFocusInRef);
|
|
3916
|
-
document.addEventListener("click", this.documentFocusInRef);
|
|
3917
|
-
this.hasDocumentListener = true;
|
|
3918
|
-
}
|
|
3919
|
-
}
|
|
3920
|
-
documentFocusIn(event) {
|
|
3921
|
-
this.validationService.setTouched(this.element);
|
|
3922
|
-
const children = Array.from(this.element.querySelectorAll("input"));
|
|
3923
|
-
for (const childElement of children) {
|
|
3924
|
-
this.validationService.setTouched(childElement);
|
|
3925
|
-
}
|
|
3926
|
-
if (!this.hasFocusableTarget(event.target)) {
|
|
3927
|
-
this.removeEventListeners();
|
|
3928
|
-
}
|
|
3929
|
-
else if (event.target.checked) {
|
|
3930
|
-
this.validateFieldsetAndChildren();
|
|
3931
|
-
}
|
|
3932
|
-
}
|
|
3933
|
-
removeEventListeners() {
|
|
3934
|
-
if (this.hasDocumentListener && this.documentFocusInRef) {
|
|
3935
|
-
document.removeEventListener("focusin", this.documentFocusInRef);
|
|
3936
|
-
document.removeEventListener("click", this.documentFocusInRef);
|
|
3937
|
-
this.hasDocumentListener = false;
|
|
3938
|
-
this.validateFieldsetAndChildren();
|
|
3939
|
-
}
|
|
3940
|
-
}
|
|
3941
|
-
validateFieldsetAndChildren() {
|
|
3942
|
-
const validatableElements = document.querySelectorAll(`fieldset#${this.element.id}, #${this.element.id} input[type='checkbox'], #${this.element.id} input[type='radio']`);
|
|
3943
|
-
for (const element of validatableElements) {
|
|
3944
|
-
if (element.id) {
|
|
3945
|
-
/* eslint-disable-next-line @typescript-eslint/no-floating-promises -- technical debt */
|
|
3946
|
-
this.validationService.validateElement(element.id);
|
|
3947
|
-
}
|
|
3948
|
-
}
|
|
3949
|
-
}
|
|
3950
|
-
}
|
|
3951
|
-
|
|
3952
3874
|
/**
|
|
3953
3875
|
* Builder to create validation error message map.
|
|
3954
3876
|
*
|
|
@@ -4072,6 +3994,84 @@ function getErrorMessages() {
|
|
|
4072
3994
|
.build();
|
|
4073
3995
|
}
|
|
4074
3996
|
|
|
3997
|
+
/**
|
|
3998
|
+
* @internal
|
|
3999
|
+
*/
|
|
4000
|
+
function createFieldsetValidator(element, validationService) {
|
|
4001
|
+
/* eslint-disable-next-line no-new, sonarjs/constructor-for-side-effects --
|
|
4002
|
+
* technical debt, this should be refactored as to not rely of side-effects
|
|
4003
|
+
* of the constructor */
|
|
4004
|
+
new FieldsetValidationHandler(element, validationService);
|
|
4005
|
+
}
|
|
4006
|
+
class FieldsetValidationHandler {
|
|
4007
|
+
hasDocumentListener = false;
|
|
4008
|
+
documentFocusInRef = undefined;
|
|
4009
|
+
element;
|
|
4010
|
+
validationService;
|
|
4011
|
+
constructor(element, validationService) {
|
|
4012
|
+
Object.assign(this);
|
|
4013
|
+
this.element = element;
|
|
4014
|
+
this.validationService = validationService;
|
|
4015
|
+
element.addEventListener("focusin", (event) => {
|
|
4016
|
+
this.onFocusIn(event);
|
|
4017
|
+
});
|
|
4018
|
+
// Handle checking of input by using keyboard (space)
|
|
4019
|
+
element.addEventListener("change", this.documentFocusIn.bind(this));
|
|
4020
|
+
Array.from(this.element.querySelectorAll("input[type='checkbox'], input[type='radio']"))
|
|
4021
|
+
.filter((childElement) => childElement.closest("fieldset") === element)
|
|
4022
|
+
/* eslint-disable-next-line unicorn/no-array-for-each -- technical debt */
|
|
4023
|
+
.forEach((childElement) => {
|
|
4024
|
+
childElement.setAttribute("required", "");
|
|
4025
|
+
});
|
|
4026
|
+
}
|
|
4027
|
+
hasFocusableTarget(target) {
|
|
4028
|
+
return target
|
|
4029
|
+
? Array.from(this.element.querySelectorAll("input, label")).some((element) => element === target)
|
|
4030
|
+
: false;
|
|
4031
|
+
}
|
|
4032
|
+
onFocusIn(event) {
|
|
4033
|
+
// IE11 (not Chrome / FF) trigger focusin-event on legends and other elements inside the fieldset
|
|
4034
|
+
// So we need to check the event target, if it's focusable.
|
|
4035
|
+
if (this.hasFocusableTarget(event.target) &&
|
|
4036
|
+
!this.hasDocumentListener) {
|
|
4037
|
+
this.documentFocusInRef = this.documentFocusIn.bind(this);
|
|
4038
|
+
document.addEventListener("focusin", this.documentFocusInRef);
|
|
4039
|
+
document.addEventListener("click", this.documentFocusInRef);
|
|
4040
|
+
this.hasDocumentListener = true;
|
|
4041
|
+
}
|
|
4042
|
+
}
|
|
4043
|
+
documentFocusIn(event) {
|
|
4044
|
+
this.validationService.setTouched(this.element);
|
|
4045
|
+
const children = Array.from(this.element.querySelectorAll("input"));
|
|
4046
|
+
for (const childElement of children) {
|
|
4047
|
+
this.validationService.setTouched(childElement);
|
|
4048
|
+
}
|
|
4049
|
+
if (!this.hasFocusableTarget(event.target)) {
|
|
4050
|
+
this.removeEventListeners();
|
|
4051
|
+
}
|
|
4052
|
+
else if (event.target.checked) {
|
|
4053
|
+
this.validateFieldsetAndChildren();
|
|
4054
|
+
}
|
|
4055
|
+
}
|
|
4056
|
+
removeEventListeners() {
|
|
4057
|
+
if (this.hasDocumentListener && this.documentFocusInRef) {
|
|
4058
|
+
document.removeEventListener("focusin", this.documentFocusInRef);
|
|
4059
|
+
document.removeEventListener("click", this.documentFocusInRef);
|
|
4060
|
+
this.hasDocumentListener = false;
|
|
4061
|
+
this.validateFieldsetAndChildren();
|
|
4062
|
+
}
|
|
4063
|
+
}
|
|
4064
|
+
validateFieldsetAndChildren() {
|
|
4065
|
+
const validatableElements = document.querySelectorAll(`fieldset#${this.element.id}, #${this.element.id} input[type='checkbox'], #${this.element.id} input[type='radio']`);
|
|
4066
|
+
for (const element of validatableElements) {
|
|
4067
|
+
if (element.id) {
|
|
4068
|
+
/* eslint-disable-next-line @typescript-eslint/no-floating-promises -- technical debt */
|
|
4069
|
+
this.validationService.validateElement(element.id);
|
|
4070
|
+
}
|
|
4071
|
+
}
|
|
4072
|
+
}
|
|
4073
|
+
}
|
|
4074
|
+
|
|
4075
4075
|
/**
|
|
4076
4076
|
* Returns validation error message candidates in prioritized order.
|
|
4077
4077
|
*
|
|
@@ -4630,7 +4630,7 @@ class ValidationServiceImpl {
|
|
|
4630
4630
|
}
|
|
4631
4631
|
getErrorMessage(validatorName, validators, validatorConfigs, elementType) {
|
|
4632
4632
|
const validatorConfig = validatorConfigs[validatorName];
|
|
4633
|
-
if (validatorConfig
|
|
4633
|
+
if (validatorConfig?.errorMessage) {
|
|
4634
4634
|
return validatorConfig.errorMessage;
|
|
4635
4635
|
}
|
|
4636
4636
|
const candidates = getCandidates(validatorName, validators, elementType);
|
package/lib/esm/index.js
CHANGED
|
@@ -3869,84 +3869,6 @@ const TranslationService =
|
|
|
3869
3869
|
/* @__PURE__ */
|
|
3870
3870
|
new TranslationServiceImpl();
|
|
3871
3871
|
|
|
3872
|
-
/**
|
|
3873
|
-
* @internal
|
|
3874
|
-
*/
|
|
3875
|
-
function createFieldsetValidator(element, validationService) {
|
|
3876
|
-
/* eslint-disable-next-line no-new, sonarjs/constructor-for-side-effects --
|
|
3877
|
-
* technical debt, this should be refactored as to not rely of side-effects
|
|
3878
|
-
* of the constructor */
|
|
3879
|
-
new FieldsetValidationHandler(element, validationService);
|
|
3880
|
-
}
|
|
3881
|
-
class FieldsetValidationHandler {
|
|
3882
|
-
hasDocumentListener = false;
|
|
3883
|
-
documentFocusInRef = undefined;
|
|
3884
|
-
element;
|
|
3885
|
-
validationService;
|
|
3886
|
-
constructor(element, validationService) {
|
|
3887
|
-
Object.assign(this);
|
|
3888
|
-
this.element = element;
|
|
3889
|
-
this.validationService = validationService;
|
|
3890
|
-
element.addEventListener("focusin", (event) => {
|
|
3891
|
-
this.onFocusIn(event);
|
|
3892
|
-
});
|
|
3893
|
-
// Handle checking of input by using keyboard (space)
|
|
3894
|
-
element.addEventListener("change", this.documentFocusIn.bind(this));
|
|
3895
|
-
Array.from(this.element.querySelectorAll("input[type='checkbox'], input[type='radio']"))
|
|
3896
|
-
.filter((childElement) => childElement.closest("fieldset") === element)
|
|
3897
|
-
/* eslint-disable-next-line unicorn/no-array-for-each -- technical debt */
|
|
3898
|
-
.forEach((childElement) => {
|
|
3899
|
-
childElement.setAttribute("required", "");
|
|
3900
|
-
});
|
|
3901
|
-
}
|
|
3902
|
-
hasFocusableTarget(target) {
|
|
3903
|
-
return target
|
|
3904
|
-
? Array.from(this.element.querySelectorAll("input, label")).some((element) => element === target)
|
|
3905
|
-
: false;
|
|
3906
|
-
}
|
|
3907
|
-
onFocusIn(event) {
|
|
3908
|
-
// IE11 (not Chrome / FF) trigger focusin-event on legends and other elements inside the fieldset
|
|
3909
|
-
// So we need to check the event target, if it's focusable.
|
|
3910
|
-
if (this.hasFocusableTarget(event.target) &&
|
|
3911
|
-
!this.hasDocumentListener) {
|
|
3912
|
-
this.documentFocusInRef = this.documentFocusIn.bind(this);
|
|
3913
|
-
document.addEventListener("focusin", this.documentFocusInRef);
|
|
3914
|
-
document.addEventListener("click", this.documentFocusInRef);
|
|
3915
|
-
this.hasDocumentListener = true;
|
|
3916
|
-
}
|
|
3917
|
-
}
|
|
3918
|
-
documentFocusIn(event) {
|
|
3919
|
-
this.validationService.setTouched(this.element);
|
|
3920
|
-
const children = Array.from(this.element.querySelectorAll("input"));
|
|
3921
|
-
for (const childElement of children) {
|
|
3922
|
-
this.validationService.setTouched(childElement);
|
|
3923
|
-
}
|
|
3924
|
-
if (!this.hasFocusableTarget(event.target)) {
|
|
3925
|
-
this.removeEventListeners();
|
|
3926
|
-
}
|
|
3927
|
-
else if (event.target.checked) {
|
|
3928
|
-
this.validateFieldsetAndChildren();
|
|
3929
|
-
}
|
|
3930
|
-
}
|
|
3931
|
-
removeEventListeners() {
|
|
3932
|
-
if (this.hasDocumentListener && this.documentFocusInRef) {
|
|
3933
|
-
document.removeEventListener("focusin", this.documentFocusInRef);
|
|
3934
|
-
document.removeEventListener("click", this.documentFocusInRef);
|
|
3935
|
-
this.hasDocumentListener = false;
|
|
3936
|
-
this.validateFieldsetAndChildren();
|
|
3937
|
-
}
|
|
3938
|
-
}
|
|
3939
|
-
validateFieldsetAndChildren() {
|
|
3940
|
-
const validatableElements = document.querySelectorAll(`fieldset#${this.element.id}, #${this.element.id} input[type='checkbox'], #${this.element.id} input[type='radio']`);
|
|
3941
|
-
for (const element of validatableElements) {
|
|
3942
|
-
if (element.id) {
|
|
3943
|
-
/* eslint-disable-next-line @typescript-eslint/no-floating-promises -- technical debt */
|
|
3944
|
-
this.validationService.validateElement(element.id);
|
|
3945
|
-
}
|
|
3946
|
-
}
|
|
3947
|
-
}
|
|
3948
|
-
}
|
|
3949
|
-
|
|
3950
3872
|
/**
|
|
3951
3873
|
* Builder to create validation error message map.
|
|
3952
3874
|
*
|
|
@@ -4070,6 +3992,84 @@ function getErrorMessages() {
|
|
|
4070
3992
|
.build();
|
|
4071
3993
|
}
|
|
4072
3994
|
|
|
3995
|
+
/**
|
|
3996
|
+
* @internal
|
|
3997
|
+
*/
|
|
3998
|
+
function createFieldsetValidator(element, validationService) {
|
|
3999
|
+
/* eslint-disable-next-line no-new, sonarjs/constructor-for-side-effects --
|
|
4000
|
+
* technical debt, this should be refactored as to not rely of side-effects
|
|
4001
|
+
* of the constructor */
|
|
4002
|
+
new FieldsetValidationHandler(element, validationService);
|
|
4003
|
+
}
|
|
4004
|
+
class FieldsetValidationHandler {
|
|
4005
|
+
hasDocumentListener = false;
|
|
4006
|
+
documentFocusInRef = undefined;
|
|
4007
|
+
element;
|
|
4008
|
+
validationService;
|
|
4009
|
+
constructor(element, validationService) {
|
|
4010
|
+
Object.assign(this);
|
|
4011
|
+
this.element = element;
|
|
4012
|
+
this.validationService = validationService;
|
|
4013
|
+
element.addEventListener("focusin", (event) => {
|
|
4014
|
+
this.onFocusIn(event);
|
|
4015
|
+
});
|
|
4016
|
+
// Handle checking of input by using keyboard (space)
|
|
4017
|
+
element.addEventListener("change", this.documentFocusIn.bind(this));
|
|
4018
|
+
Array.from(this.element.querySelectorAll("input[type='checkbox'], input[type='radio']"))
|
|
4019
|
+
.filter((childElement) => childElement.closest("fieldset") === element)
|
|
4020
|
+
/* eslint-disable-next-line unicorn/no-array-for-each -- technical debt */
|
|
4021
|
+
.forEach((childElement) => {
|
|
4022
|
+
childElement.setAttribute("required", "");
|
|
4023
|
+
});
|
|
4024
|
+
}
|
|
4025
|
+
hasFocusableTarget(target) {
|
|
4026
|
+
return target
|
|
4027
|
+
? Array.from(this.element.querySelectorAll("input, label")).some((element) => element === target)
|
|
4028
|
+
: false;
|
|
4029
|
+
}
|
|
4030
|
+
onFocusIn(event) {
|
|
4031
|
+
// IE11 (not Chrome / FF) trigger focusin-event on legends and other elements inside the fieldset
|
|
4032
|
+
// So we need to check the event target, if it's focusable.
|
|
4033
|
+
if (this.hasFocusableTarget(event.target) &&
|
|
4034
|
+
!this.hasDocumentListener) {
|
|
4035
|
+
this.documentFocusInRef = this.documentFocusIn.bind(this);
|
|
4036
|
+
document.addEventListener("focusin", this.documentFocusInRef);
|
|
4037
|
+
document.addEventListener("click", this.documentFocusInRef);
|
|
4038
|
+
this.hasDocumentListener = true;
|
|
4039
|
+
}
|
|
4040
|
+
}
|
|
4041
|
+
documentFocusIn(event) {
|
|
4042
|
+
this.validationService.setTouched(this.element);
|
|
4043
|
+
const children = Array.from(this.element.querySelectorAll("input"));
|
|
4044
|
+
for (const childElement of children) {
|
|
4045
|
+
this.validationService.setTouched(childElement);
|
|
4046
|
+
}
|
|
4047
|
+
if (!this.hasFocusableTarget(event.target)) {
|
|
4048
|
+
this.removeEventListeners();
|
|
4049
|
+
}
|
|
4050
|
+
else if (event.target.checked) {
|
|
4051
|
+
this.validateFieldsetAndChildren();
|
|
4052
|
+
}
|
|
4053
|
+
}
|
|
4054
|
+
removeEventListeners() {
|
|
4055
|
+
if (this.hasDocumentListener && this.documentFocusInRef) {
|
|
4056
|
+
document.removeEventListener("focusin", this.documentFocusInRef);
|
|
4057
|
+
document.removeEventListener("click", this.documentFocusInRef);
|
|
4058
|
+
this.hasDocumentListener = false;
|
|
4059
|
+
this.validateFieldsetAndChildren();
|
|
4060
|
+
}
|
|
4061
|
+
}
|
|
4062
|
+
validateFieldsetAndChildren() {
|
|
4063
|
+
const validatableElements = document.querySelectorAll(`fieldset#${this.element.id}, #${this.element.id} input[type='checkbox'], #${this.element.id} input[type='radio']`);
|
|
4064
|
+
for (const element of validatableElements) {
|
|
4065
|
+
if (element.id) {
|
|
4066
|
+
/* eslint-disable-next-line @typescript-eslint/no-floating-promises -- technical debt */
|
|
4067
|
+
this.validationService.validateElement(element.id);
|
|
4068
|
+
}
|
|
4069
|
+
}
|
|
4070
|
+
}
|
|
4071
|
+
}
|
|
4072
|
+
|
|
4073
4073
|
/**
|
|
4074
4074
|
* Returns validation error message candidates in prioritized order.
|
|
4075
4075
|
*
|
|
@@ -4628,7 +4628,7 @@ class ValidationServiceImpl {
|
|
|
4628
4628
|
}
|
|
4629
4629
|
getErrorMessage(validatorName, validators, validatorConfigs, elementType) {
|
|
4630
4630
|
const validatorConfig = validatorConfigs[validatorName];
|
|
4631
|
-
if (validatorConfig
|
|
4631
|
+
if (validatorConfig?.errorMessage) {
|
|
4632
4632
|
return validatorConfig.errorMessage;
|
|
4633
4633
|
}
|
|
4634
4634
|
const candidates = getCandidates(validatorName, validators, elementType);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fkui/logic",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.41.0",
|
|
4
4
|
"description": "Logic",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fkui",
|
|
@@ -23,18 +23,18 @@
|
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|
|
25
25
|
"types": "./lib/types/index.d.ts",
|
|
26
|
-
"
|
|
27
|
-
"
|
|
26
|
+
"import": "./lib/esm/index.js",
|
|
27
|
+
"require": "./lib/cjs/index.js"
|
|
28
28
|
},
|
|
29
29
|
"./polyfills": {
|
|
30
30
|
"types": "./lib/types/polyfills.d.ts",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
31
|
+
"import": "./lib/esm/polyfills.js",
|
|
32
|
+
"require": "./lib/cjs/polyfills.js"
|
|
33
33
|
},
|
|
34
34
|
"./lib/polyfills": {
|
|
35
35
|
"types": "./lib/types/polyfills.d.ts",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
36
|
+
"import": "./lib/esm/polyfills.js",
|
|
37
|
+
"require": "./lib/cjs/polyfills.js"
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"main": "lib/cjs/index.js",
|
|
@@ -61,11 +61,11 @@
|
|
|
61
61
|
"watch": "rollup --config --watch"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"@fkui/date": "^6.
|
|
64
|
+
"@fkui/date": "^6.41.0"
|
|
65
65
|
},
|
|
66
66
|
"engines": {
|
|
67
67
|
"node": ">= 20",
|
|
68
68
|
"npm": ">= 7"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "b5a8d5801dff4745cf7007b9209a9bc5a8bbe40c"
|
|
71
71
|
}
|