@fkui/logic 6.21.0 → 6.22.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 CHANGED
@@ -3842,6 +3842,82 @@ const TranslationService =
3842
3842
  /* @__PURE__ */
3843
3843
  new TranslationServiceImpl();
3844
3844
 
3845
+ /**
3846
+ * @internal
3847
+ */
3848
+ function createFieldsetValidator(element, validationService) {
3849
+ /* eslint-disable-next-line no-new, sonarjs/constructor-for-side-effects --
3850
+ * technical debt, this should be refactored as to not rely of side-effects
3851
+ * of the constructor */
3852
+ new FieldsetValidationHandler(element, validationService);
3853
+ }
3854
+ class FieldsetValidationHandler {
3855
+ hasDocumentListener = false;
3856
+ documentFocusInRef = undefined;
3857
+ element;
3858
+ validationService;
3859
+ constructor(element, validationService) {
3860
+ Object.assign(this);
3861
+ this.element = element;
3862
+ this.validationService = validationService;
3863
+ element.addEventListener("focusin", (event) => {
3864
+ this.onFocusIn(event);
3865
+ });
3866
+ // Handle checking of input by using keyboard (space)
3867
+ element.addEventListener("change", this.documentFocusIn.bind(this));
3868
+ Array.from(this.element.querySelectorAll("input[type='checkbox'], input[type='radio']"))
3869
+ .filter((childElement) => childElement.closest("fieldset") === element)
3870
+ .forEach((childElement) => {
3871
+ childElement.setAttribute("required", "");
3872
+ });
3873
+ }
3874
+ hasFocusableTarget(target) {
3875
+ return target
3876
+ ? Array.from(this.element.querySelectorAll("input, label")).some((element) => element === target)
3877
+ : false;
3878
+ }
3879
+ onFocusIn(event) {
3880
+ // IE11 (not Chrome / FF) trigger focusin-event on legends and other elements inside the fieldset
3881
+ // So we need to check the event target, if it's focusable.
3882
+ if (this.hasFocusableTarget(event.target) &&
3883
+ !this.hasDocumentListener) {
3884
+ this.documentFocusInRef = this.documentFocusIn.bind(this);
3885
+ document.addEventListener("focusin", this.documentFocusInRef);
3886
+ document.addEventListener("click", this.documentFocusInRef);
3887
+ this.hasDocumentListener = true;
3888
+ }
3889
+ }
3890
+ documentFocusIn(event) {
3891
+ this.validationService.setTouched(this.element);
3892
+ const children = Array.from(this.element.querySelectorAll("input"));
3893
+ for (const childElement of children) {
3894
+ this.validationService.setTouched(childElement);
3895
+ }
3896
+ if (!this.hasFocusableTarget(event.target)) {
3897
+ this.removeEventListeners();
3898
+ }
3899
+ else if (event.target.checked) {
3900
+ this.validateFieldsetAndChildren();
3901
+ }
3902
+ }
3903
+ removeEventListeners() {
3904
+ if (this.hasDocumentListener && this.documentFocusInRef) {
3905
+ document.removeEventListener("focusin", this.documentFocusInRef);
3906
+ document.removeEventListener("click", this.documentFocusInRef);
3907
+ this.hasDocumentListener = false;
3908
+ this.validateFieldsetAndChildren();
3909
+ }
3910
+ }
3911
+ validateFieldsetAndChildren() {
3912
+ const validatableElements = document.querySelectorAll(`fieldset#${this.element.id}, #${this.element.id} input[type='checkbox'], #${this.element.id} input[type='radio']`);
3913
+ validatableElements.forEach((element) => {
3914
+ if (element.id) {
3915
+ this.validationService.validateElement(element.id);
3916
+ }
3917
+ });
3918
+ }
3919
+ }
3920
+
3845
3921
  /**
3846
3922
  * Builder to create validation error message map.
3847
3923
  *
@@ -3965,89 +4041,6 @@ function getErrorMessages() {
3965
4041
  .build();
3966
4042
  }
3967
4043
 
3968
- /**
3969
- * @internal
3970
- */
3971
- function createFieldsetValidator(element, validationService) {
3972
- /* eslint-disable-next-line no-new, sonarjs/constructor-for-side-effects --
3973
- * technical debt, this should be refactored as to not rely of side-effects
3974
- * of the constructor */
3975
- new FieldsetValidationHandler(element, validationService);
3976
- }
3977
- class FieldsetValidationHandler {
3978
- hasDocumentListener = false;
3979
- documentFocusInRef = undefined;
3980
- element;
3981
- validationService;
3982
- constructor(element, validationService) {
3983
- Object.assign(this);
3984
- this.element = element;
3985
- this.validationService = validationService;
3986
- element.addEventListener("focusin", (event) => {
3987
- this.onFocusIn(event);
3988
- });
3989
- // Handle checking of input by using keyboard (space)
3990
- element.addEventListener("change", this.documentFocusIn.bind(this));
3991
- Array.from(this.element.querySelectorAll("input[type='checkbox'], input[type='radio']"))
3992
- .filter((childElement) => childElement.closest("fieldset") === element)
3993
- .forEach((childElement) => {
3994
- childElement.setAttribute("required", "");
3995
- });
3996
- }
3997
- hasFocusableTarget(target) {
3998
- return target
3999
- ? Array.from(this.element.querySelectorAll("input, label")).some((element) => element === target)
4000
- : false;
4001
- }
4002
- onFocusIn(event) {
4003
- // IE11 (not Chrome / FF) trigger focusin-event on legends and other elements inside the fieldset
4004
- // So we need to check the event target, if it's focusable.
4005
- if (this.hasFocusableTarget(event.target) &&
4006
- !this.hasDocumentListener) {
4007
- this.documentFocusInRef = this.documentFocusIn.bind(this);
4008
- document.addEventListener("focusin", this.documentFocusInRef);
4009
- document.addEventListener("click", this.documentFocusInRef);
4010
- this.hasDocumentListener = true;
4011
- }
4012
- }
4013
- documentFocusIn(event) {
4014
- this.validationService.setTouched(this.element);
4015
- const children = Array.from(this.element.querySelectorAll("input"));
4016
- for (const childElement of children) {
4017
- this.validationService.setTouched(childElement);
4018
- }
4019
- if (!this.hasFocusableTarget(event.target)) {
4020
- this.removeEventListeners();
4021
- }
4022
- else if (event.target.checked) {
4023
- this.validateFieldsetAndChildren();
4024
- }
4025
- }
4026
- removeEventListeners() {
4027
- if (this.hasDocumentListener && this.documentFocusInRef) {
4028
- document.removeEventListener("focusin", this.documentFocusInRef);
4029
- document.removeEventListener("click", this.documentFocusInRef);
4030
- this.hasDocumentListener = false;
4031
- this.validateFieldsetAndChildren();
4032
- }
4033
- }
4034
- validateFieldsetAndChildren() {
4035
- const validatableElements = document.querySelectorAll(`fieldset#${this.element.id}, #${this.element.id} input[type='checkbox'], #${this.element.id} input[type='radio']`);
4036
- validatableElements.forEach((element) => {
4037
- if (element.id) {
4038
- this.validationService.validateElement(element.id);
4039
- }
4040
- });
4041
- }
4042
- }
4043
-
4044
- /**
4045
- * Registered validators.
4046
- *
4047
- * @internal
4048
- */
4049
- const registry = {};
4050
-
4051
4044
  /**
4052
4045
  * Returns validation error message candidates in prioritized order.
4053
4046
  *
@@ -4096,6 +4089,13 @@ function getElementType(element) {
4096
4089
  }
4097
4090
  }
4098
4091
 
4092
+ /**
4093
+ * Registered validators.
4094
+ *
4095
+ * @internal
4096
+ */
4097
+ const registry = {};
4098
+
4099
4099
  /**
4100
4100
  * Returns true if given element is a validatable element.
4101
4101
  *
package/lib/esm/index.js CHANGED
@@ -3840,6 +3840,82 @@ const TranslationService =
3840
3840
  /* @__PURE__ */
3841
3841
  new TranslationServiceImpl();
3842
3842
 
3843
+ /**
3844
+ * @internal
3845
+ */
3846
+ function createFieldsetValidator(element, validationService) {
3847
+ /* eslint-disable-next-line no-new, sonarjs/constructor-for-side-effects --
3848
+ * technical debt, this should be refactored as to not rely of side-effects
3849
+ * of the constructor */
3850
+ new FieldsetValidationHandler(element, validationService);
3851
+ }
3852
+ class FieldsetValidationHandler {
3853
+ hasDocumentListener = false;
3854
+ documentFocusInRef = undefined;
3855
+ element;
3856
+ validationService;
3857
+ constructor(element, validationService) {
3858
+ Object.assign(this);
3859
+ this.element = element;
3860
+ this.validationService = validationService;
3861
+ element.addEventListener("focusin", (event) => {
3862
+ this.onFocusIn(event);
3863
+ });
3864
+ // Handle checking of input by using keyboard (space)
3865
+ element.addEventListener("change", this.documentFocusIn.bind(this));
3866
+ Array.from(this.element.querySelectorAll("input[type='checkbox'], input[type='radio']"))
3867
+ .filter((childElement) => childElement.closest("fieldset") === element)
3868
+ .forEach((childElement) => {
3869
+ childElement.setAttribute("required", "");
3870
+ });
3871
+ }
3872
+ hasFocusableTarget(target) {
3873
+ return target
3874
+ ? Array.from(this.element.querySelectorAll("input, label")).some((element) => element === target)
3875
+ : false;
3876
+ }
3877
+ onFocusIn(event) {
3878
+ // IE11 (not Chrome / FF) trigger focusin-event on legends and other elements inside the fieldset
3879
+ // So we need to check the event target, if it's focusable.
3880
+ if (this.hasFocusableTarget(event.target) &&
3881
+ !this.hasDocumentListener) {
3882
+ this.documentFocusInRef = this.documentFocusIn.bind(this);
3883
+ document.addEventListener("focusin", this.documentFocusInRef);
3884
+ document.addEventListener("click", this.documentFocusInRef);
3885
+ this.hasDocumentListener = true;
3886
+ }
3887
+ }
3888
+ documentFocusIn(event) {
3889
+ this.validationService.setTouched(this.element);
3890
+ const children = Array.from(this.element.querySelectorAll("input"));
3891
+ for (const childElement of children) {
3892
+ this.validationService.setTouched(childElement);
3893
+ }
3894
+ if (!this.hasFocusableTarget(event.target)) {
3895
+ this.removeEventListeners();
3896
+ }
3897
+ else if (event.target.checked) {
3898
+ this.validateFieldsetAndChildren();
3899
+ }
3900
+ }
3901
+ removeEventListeners() {
3902
+ if (this.hasDocumentListener && this.documentFocusInRef) {
3903
+ document.removeEventListener("focusin", this.documentFocusInRef);
3904
+ document.removeEventListener("click", this.documentFocusInRef);
3905
+ this.hasDocumentListener = false;
3906
+ this.validateFieldsetAndChildren();
3907
+ }
3908
+ }
3909
+ validateFieldsetAndChildren() {
3910
+ const validatableElements = document.querySelectorAll(`fieldset#${this.element.id}, #${this.element.id} input[type='checkbox'], #${this.element.id} input[type='radio']`);
3911
+ validatableElements.forEach((element) => {
3912
+ if (element.id) {
3913
+ this.validationService.validateElement(element.id);
3914
+ }
3915
+ });
3916
+ }
3917
+ }
3918
+
3843
3919
  /**
3844
3920
  * Builder to create validation error message map.
3845
3921
  *
@@ -3963,89 +4039,6 @@ function getErrorMessages() {
3963
4039
  .build();
3964
4040
  }
3965
4041
 
3966
- /**
3967
- * @internal
3968
- */
3969
- function createFieldsetValidator(element, validationService) {
3970
- /* eslint-disable-next-line no-new, sonarjs/constructor-for-side-effects --
3971
- * technical debt, this should be refactored as to not rely of side-effects
3972
- * of the constructor */
3973
- new FieldsetValidationHandler(element, validationService);
3974
- }
3975
- class FieldsetValidationHandler {
3976
- hasDocumentListener = false;
3977
- documentFocusInRef = undefined;
3978
- element;
3979
- validationService;
3980
- constructor(element, validationService) {
3981
- Object.assign(this);
3982
- this.element = element;
3983
- this.validationService = validationService;
3984
- element.addEventListener("focusin", (event) => {
3985
- this.onFocusIn(event);
3986
- });
3987
- // Handle checking of input by using keyboard (space)
3988
- element.addEventListener("change", this.documentFocusIn.bind(this));
3989
- Array.from(this.element.querySelectorAll("input[type='checkbox'], input[type='radio']"))
3990
- .filter((childElement) => childElement.closest("fieldset") === element)
3991
- .forEach((childElement) => {
3992
- childElement.setAttribute("required", "");
3993
- });
3994
- }
3995
- hasFocusableTarget(target) {
3996
- return target
3997
- ? Array.from(this.element.querySelectorAll("input, label")).some((element) => element === target)
3998
- : false;
3999
- }
4000
- onFocusIn(event) {
4001
- // IE11 (not Chrome / FF) trigger focusin-event on legends and other elements inside the fieldset
4002
- // So we need to check the event target, if it's focusable.
4003
- if (this.hasFocusableTarget(event.target) &&
4004
- !this.hasDocumentListener) {
4005
- this.documentFocusInRef = this.documentFocusIn.bind(this);
4006
- document.addEventListener("focusin", this.documentFocusInRef);
4007
- document.addEventListener("click", this.documentFocusInRef);
4008
- this.hasDocumentListener = true;
4009
- }
4010
- }
4011
- documentFocusIn(event) {
4012
- this.validationService.setTouched(this.element);
4013
- const children = Array.from(this.element.querySelectorAll("input"));
4014
- for (const childElement of children) {
4015
- this.validationService.setTouched(childElement);
4016
- }
4017
- if (!this.hasFocusableTarget(event.target)) {
4018
- this.removeEventListeners();
4019
- }
4020
- else if (event.target.checked) {
4021
- this.validateFieldsetAndChildren();
4022
- }
4023
- }
4024
- removeEventListeners() {
4025
- if (this.hasDocumentListener && this.documentFocusInRef) {
4026
- document.removeEventListener("focusin", this.documentFocusInRef);
4027
- document.removeEventListener("click", this.documentFocusInRef);
4028
- this.hasDocumentListener = false;
4029
- this.validateFieldsetAndChildren();
4030
- }
4031
- }
4032
- validateFieldsetAndChildren() {
4033
- const validatableElements = document.querySelectorAll(`fieldset#${this.element.id}, #${this.element.id} input[type='checkbox'], #${this.element.id} input[type='radio']`);
4034
- validatableElements.forEach((element) => {
4035
- if (element.id) {
4036
- this.validationService.validateElement(element.id);
4037
- }
4038
- });
4039
- }
4040
- }
4041
-
4042
- /**
4043
- * Registered validators.
4044
- *
4045
- * @internal
4046
- */
4047
- const registry = {};
4048
-
4049
4042
  /**
4050
4043
  * Returns validation error message candidates in prioritized order.
4051
4044
  *
@@ -4094,6 +4087,13 @@ function getElementType(element) {
4094
4087
  }
4095
4088
  }
4096
4089
 
4090
+ /**
4091
+ * Registered validators.
4092
+ *
4093
+ * @internal
4094
+ */
4095
+ const registry = {};
4096
+
4097
4097
  /**
4098
4098
  * Returns true if given element is a validatable element.
4099
4099
  *
@@ -268,25 +268,25 @@ export declare interface AllowListValidatorConfig extends ValidatorOptions {
268
268
  export {
269
269
  addFocusListener,
270
270
  documentOrderComparator,
271
- focus_2 as focus,
272
- isFocusable,
273
- isTabbable,
271
+ FocusOptions_2 as FocusOptions,
272
+ StackHandle,
274
273
  findTabbableElements,
274
+ focus_2 as focus,
275
275
  focusFirst,
276
276
  focusLast,
277
- restoreFocus,
278
- saveFocus,
279
- FocusOptions_2 as FocusOptions,
277
+ isFocusable,
278
+ isTabbable,
280
279
  popFocus,
281
280
  pushFocus,
282
- StackHandle,
281
+ restoreFocus,
282
+ saveFocus,
283
283
  handleTab,
284
284
  isValidatableFormElement,
285
285
  isVisible,
286
286
  isVisibleInViewport,
287
287
  removeFocusListener,
288
- scrollTo_2 as scrollTo,
289
- ScrollToOptions_2 as ScrollToOptions
288
+ ScrollToOptions_2 as ScrollToOptions,
289
+ scrollTo_2 as scrollTo
290
290
  }
291
291
  }
292
292
  export { DomUtils }
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.52.13"
8
+ "packageVersion": "7.53.0"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fkui/logic",
3
- "version": "6.21.0",
3
+ "version": "6.22.0",
4
4
  "description": "Logic",
5
5
  "keywords": [
6
6
  "fkui",
@@ -61,11 +61,11 @@
61
61
  "watch": "rollup --config --watch"
62
62
  },
63
63
  "peerDependencies": {
64
- "@fkui/date": "^6.21.0"
64
+ "@fkui/date": "^6.22.0"
65
65
  },
66
66
  "engines": {
67
67
  "node": ">= 20",
68
68
  "npm": ">= 7"
69
69
  },
70
- "gitHead": "300d22abdfd674d0d2aad5e710773cb83b38152a"
70
+ "gitHead": "ebc31640a950acc4a20ac6b07509aa12f78ee781"
71
71
  }