@fkui/logic 6.32.0 → 6.33.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 +22 -1
- package/lib/esm/index.js +22 -1
- package/package.json +3 -3
package/lib/cjs/index.js
CHANGED
|
@@ -2213,6 +2213,7 @@ function deleteCookie(name) {
|
|
|
2213
2213
|
function findCookie(name) {
|
|
2214
2214
|
/* handle when document or cookie does not exist, e.g. when DOM isn't
|
|
2215
2215
|
* present */
|
|
2216
|
+
/* eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- technical debt */
|
|
2216
2217
|
if (!document?.cookie) {
|
|
2217
2218
|
return undefined;
|
|
2218
2219
|
}
|
|
@@ -3398,6 +3399,7 @@ function focus(element, options = {}) {
|
|
|
3398
3399
|
element.focus(params);
|
|
3399
3400
|
if (scrollToTop) {
|
|
3400
3401
|
element.focus({ ...params, preventScroll: true });
|
|
3402
|
+
/* eslint-disable-next-line @typescript-eslint/no-floating-promises -- technical debt */
|
|
3401
3403
|
scrollTo(element);
|
|
3402
3404
|
}
|
|
3403
3405
|
else {
|
|
@@ -3555,6 +3557,7 @@ function popFocus(handle, options = {}) {
|
|
|
3555
3557
|
}
|
|
3556
3558
|
}
|
|
3557
3559
|
if (restoreFocus) {
|
|
3560
|
+
/* eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- technical debt */
|
|
3558
3561
|
focus(top?.element);
|
|
3559
3562
|
}
|
|
3560
3563
|
}
|
|
@@ -3713,6 +3716,7 @@ new ElementIdServiceImpl();
|
|
|
3713
3716
|
const haveSessionStorage = /* @__PURE__ */ (() => {
|
|
3714
3717
|
const test = "fkui.sessionstorage.test";
|
|
3715
3718
|
try {
|
|
3719
|
+
/* eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- technical debt */
|
|
3716
3720
|
if (window.sessionStorage) {
|
|
3717
3721
|
window.sessionStorage.setItem(test, "test");
|
|
3718
3722
|
window.sessionStorage.removeItem(test);
|
|
@@ -3765,7 +3769,9 @@ class PersistenceService {
|
|
|
3765
3769
|
? window.sessionStorage.getItem(key)
|
|
3766
3770
|
: null;
|
|
3767
3771
|
if (persisted) {
|
|
3772
|
+
/* eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- technical debt */
|
|
3768
3773
|
const value = JSON.parse(persisted);
|
|
3774
|
+
/* eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- technical debt */
|
|
3769
3775
|
this.cache.set(key, value);
|
|
3770
3776
|
}
|
|
3771
3777
|
return this.cache.get(key);
|
|
@@ -3840,7 +3846,9 @@ class DefaultTranslationProvider {
|
|
|
3840
3846
|
: defaultValueOrArgs;
|
|
3841
3847
|
}
|
|
3842
3848
|
interpolate(defaultValue, args) {
|
|
3843
|
-
return defaultValue.replace(
|
|
3849
|
+
return defaultValue.replace(
|
|
3850
|
+
/* eslint-disable-next-line sonarjs/slow-regex -- technical debt */
|
|
3851
|
+
/{{\s*([^\s]+)\s*}}/g, (match, key) => {
|
|
3844
3852
|
return String(args[key]) || match;
|
|
3845
3853
|
});
|
|
3846
3854
|
}
|
|
@@ -3929,6 +3937,7 @@ class FieldsetValidationHandler {
|
|
|
3929
3937
|
const validatableElements = document.querySelectorAll(`fieldset#${this.element.id}, #${this.element.id} input[type='checkbox'], #${this.element.id} input[type='radio']`);
|
|
3930
3938
|
validatableElements.forEach((element) => {
|
|
3931
3939
|
if (element.id) {
|
|
3940
|
+
/* eslint-disable-next-line @typescript-eslint/no-floating-promises -- technical debt */
|
|
3932
3941
|
this.validationService.validateElement(element.id);
|
|
3933
3942
|
}
|
|
3934
3943
|
});
|
|
@@ -4406,16 +4415,19 @@ class ValidationServiceImpl {
|
|
|
4406
4415
|
}
|
|
4407
4416
|
else if (typeof element === "string") {
|
|
4408
4417
|
const found = document.getElementById(element);
|
|
4418
|
+
/* eslint-disable-next-line @typescript-eslint/no-deprecated -- internal usage */
|
|
4409
4419
|
this.setState(found, validationState);
|
|
4410
4420
|
}
|
|
4411
4421
|
else if (!isValidatableHTMLElement(element)) {
|
|
4412
4422
|
const childElements = this.getValidatableElements(element);
|
|
4413
4423
|
for (const childElement of childElements) {
|
|
4424
|
+
/* eslint-disable-next-line @typescript-eslint/no-deprecated -- internal usage */
|
|
4414
4425
|
this.setState(childElement, validationState);
|
|
4415
4426
|
}
|
|
4416
4427
|
}
|
|
4417
4428
|
else {
|
|
4418
4429
|
const existingState = this.validationStates[element.id];
|
|
4430
|
+
/* eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- technical debt */
|
|
4419
4431
|
if (existingState) {
|
|
4420
4432
|
this.validationStates[element.id] = {
|
|
4421
4433
|
...existingState,
|
|
@@ -4428,21 +4440,25 @@ class ValidationServiceImpl {
|
|
|
4428
4440
|
}
|
|
4429
4441
|
}
|
|
4430
4442
|
setSubmitted(element) {
|
|
4443
|
+
/* eslint-disable-next-line @typescript-eslint/no-deprecated -- internal usage */
|
|
4431
4444
|
this.setState(element, {
|
|
4432
4445
|
submitted: true,
|
|
4433
4446
|
});
|
|
4434
4447
|
}
|
|
4435
4448
|
setTouched(element) {
|
|
4449
|
+
/* eslint-disable-next-line @typescript-eslint/no-deprecated -- internal usage */
|
|
4436
4450
|
this.setState(element, {
|
|
4437
4451
|
touched: true,
|
|
4438
4452
|
});
|
|
4439
4453
|
}
|
|
4440
4454
|
setError(element, message) {
|
|
4455
|
+
/* eslint-disable-next-line @typescript-eslint/no-deprecated -- internal usage */
|
|
4441
4456
|
this.setState(element, {
|
|
4442
4457
|
serverError: message,
|
|
4443
4458
|
});
|
|
4444
4459
|
}
|
|
4445
4460
|
resetState(element) {
|
|
4461
|
+
/* eslint-disable-next-line @typescript-eslint/no-deprecated -- internal usage */
|
|
4446
4462
|
this.setState(element, {
|
|
4447
4463
|
touched: false,
|
|
4448
4464
|
submitted: false,
|
|
@@ -4494,8 +4510,10 @@ class ValidationServiceImpl {
|
|
|
4494
4510
|
}
|
|
4495
4511
|
getExistingStateOrSetDefault(element) {
|
|
4496
4512
|
let validationState = this.getState(element.id);
|
|
4513
|
+
/* eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- technical debt */
|
|
4497
4514
|
if (!validationState) {
|
|
4498
4515
|
validationState = { touched: false, submitted: false };
|
|
4516
|
+
/* eslint-disable-next-line @typescript-eslint/no-deprecated -- internal usage */
|
|
4499
4517
|
this.setState(element, validationState);
|
|
4500
4518
|
}
|
|
4501
4519
|
return validationState;
|
|
@@ -4504,6 +4522,7 @@ class ValidationServiceImpl {
|
|
|
4504
4522
|
const validatorNames = Object.keys(validatorConfigs);
|
|
4505
4523
|
return validatorNames.map((validatorName) => {
|
|
4506
4524
|
const validator = registry[validatorName];
|
|
4525
|
+
/* eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- technical debt */
|
|
4507
4526
|
if (validator) {
|
|
4508
4527
|
return validator;
|
|
4509
4528
|
}
|
|
@@ -5194,6 +5213,7 @@ function alertScreenReader(text, options) {
|
|
|
5194
5213
|
updateProperties(mergedOptions);
|
|
5195
5214
|
const msg = document.createElement("p");
|
|
5196
5215
|
msg.textContent = text;
|
|
5216
|
+
/* eslint-disable-next-line @typescript-eslint/no-floating-promises -- technical debt */
|
|
5197
5217
|
waitForScreenReader(() => {
|
|
5198
5218
|
while (wrapper.firstChild) {
|
|
5199
5219
|
wrapper.removeChild(wrapper.firstChild);
|
|
@@ -5214,6 +5234,7 @@ function alertScreenReader(text, options) {
|
|
|
5214
5234
|
* @param options - options for wrapper element attributes.
|
|
5215
5235
|
*/
|
|
5216
5236
|
function createScreenReaderWrapper(options) {
|
|
5237
|
+
/* eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- technical debt */
|
|
5217
5238
|
if (!getWrapper()) {
|
|
5218
5239
|
wrapper = document.createElement("div");
|
|
5219
5240
|
wrapper.id = "fkui-alert-screen-reader";
|
package/lib/esm/index.js
CHANGED
|
@@ -2211,6 +2211,7 @@ function deleteCookie(name) {
|
|
|
2211
2211
|
function findCookie(name) {
|
|
2212
2212
|
/* handle when document or cookie does not exist, e.g. when DOM isn't
|
|
2213
2213
|
* present */
|
|
2214
|
+
/* eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- technical debt */
|
|
2214
2215
|
if (!document?.cookie) {
|
|
2215
2216
|
return undefined;
|
|
2216
2217
|
}
|
|
@@ -3396,6 +3397,7 @@ function focus(element, options = {}) {
|
|
|
3396
3397
|
element.focus(params);
|
|
3397
3398
|
if (scrollToTop) {
|
|
3398
3399
|
element.focus({ ...params, preventScroll: true });
|
|
3400
|
+
/* eslint-disable-next-line @typescript-eslint/no-floating-promises -- technical debt */
|
|
3399
3401
|
scrollTo(element);
|
|
3400
3402
|
}
|
|
3401
3403
|
else {
|
|
@@ -3553,6 +3555,7 @@ function popFocus(handle, options = {}) {
|
|
|
3553
3555
|
}
|
|
3554
3556
|
}
|
|
3555
3557
|
if (restoreFocus) {
|
|
3558
|
+
/* eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- technical debt */
|
|
3556
3559
|
focus(top?.element);
|
|
3557
3560
|
}
|
|
3558
3561
|
}
|
|
@@ -3711,6 +3714,7 @@ new ElementIdServiceImpl();
|
|
|
3711
3714
|
const haveSessionStorage = /* @__PURE__ */ (() => {
|
|
3712
3715
|
const test = "fkui.sessionstorage.test";
|
|
3713
3716
|
try {
|
|
3717
|
+
/* eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- technical debt */
|
|
3714
3718
|
if (window.sessionStorage) {
|
|
3715
3719
|
window.sessionStorage.setItem(test, "test");
|
|
3716
3720
|
window.sessionStorage.removeItem(test);
|
|
@@ -3763,7 +3767,9 @@ class PersistenceService {
|
|
|
3763
3767
|
? window.sessionStorage.getItem(key)
|
|
3764
3768
|
: null;
|
|
3765
3769
|
if (persisted) {
|
|
3770
|
+
/* eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- technical debt */
|
|
3766
3771
|
const value = JSON.parse(persisted);
|
|
3772
|
+
/* eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- technical debt */
|
|
3767
3773
|
this.cache.set(key, value);
|
|
3768
3774
|
}
|
|
3769
3775
|
return this.cache.get(key);
|
|
@@ -3838,7 +3844,9 @@ class DefaultTranslationProvider {
|
|
|
3838
3844
|
: defaultValueOrArgs;
|
|
3839
3845
|
}
|
|
3840
3846
|
interpolate(defaultValue, args) {
|
|
3841
|
-
return defaultValue.replace(
|
|
3847
|
+
return defaultValue.replace(
|
|
3848
|
+
/* eslint-disable-next-line sonarjs/slow-regex -- technical debt */
|
|
3849
|
+
/{{\s*([^\s]+)\s*}}/g, (match, key) => {
|
|
3842
3850
|
return String(args[key]) || match;
|
|
3843
3851
|
});
|
|
3844
3852
|
}
|
|
@@ -3927,6 +3935,7 @@ class FieldsetValidationHandler {
|
|
|
3927
3935
|
const validatableElements = document.querySelectorAll(`fieldset#${this.element.id}, #${this.element.id} input[type='checkbox'], #${this.element.id} input[type='radio']`);
|
|
3928
3936
|
validatableElements.forEach((element) => {
|
|
3929
3937
|
if (element.id) {
|
|
3938
|
+
/* eslint-disable-next-line @typescript-eslint/no-floating-promises -- technical debt */
|
|
3930
3939
|
this.validationService.validateElement(element.id);
|
|
3931
3940
|
}
|
|
3932
3941
|
});
|
|
@@ -4404,16 +4413,19 @@ class ValidationServiceImpl {
|
|
|
4404
4413
|
}
|
|
4405
4414
|
else if (typeof element === "string") {
|
|
4406
4415
|
const found = document.getElementById(element);
|
|
4416
|
+
/* eslint-disable-next-line @typescript-eslint/no-deprecated -- internal usage */
|
|
4407
4417
|
this.setState(found, validationState);
|
|
4408
4418
|
}
|
|
4409
4419
|
else if (!isValidatableHTMLElement(element)) {
|
|
4410
4420
|
const childElements = this.getValidatableElements(element);
|
|
4411
4421
|
for (const childElement of childElements) {
|
|
4422
|
+
/* eslint-disable-next-line @typescript-eslint/no-deprecated -- internal usage */
|
|
4412
4423
|
this.setState(childElement, validationState);
|
|
4413
4424
|
}
|
|
4414
4425
|
}
|
|
4415
4426
|
else {
|
|
4416
4427
|
const existingState = this.validationStates[element.id];
|
|
4428
|
+
/* eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- technical debt */
|
|
4417
4429
|
if (existingState) {
|
|
4418
4430
|
this.validationStates[element.id] = {
|
|
4419
4431
|
...existingState,
|
|
@@ -4426,21 +4438,25 @@ class ValidationServiceImpl {
|
|
|
4426
4438
|
}
|
|
4427
4439
|
}
|
|
4428
4440
|
setSubmitted(element) {
|
|
4441
|
+
/* eslint-disable-next-line @typescript-eslint/no-deprecated -- internal usage */
|
|
4429
4442
|
this.setState(element, {
|
|
4430
4443
|
submitted: true,
|
|
4431
4444
|
});
|
|
4432
4445
|
}
|
|
4433
4446
|
setTouched(element) {
|
|
4447
|
+
/* eslint-disable-next-line @typescript-eslint/no-deprecated -- internal usage */
|
|
4434
4448
|
this.setState(element, {
|
|
4435
4449
|
touched: true,
|
|
4436
4450
|
});
|
|
4437
4451
|
}
|
|
4438
4452
|
setError(element, message) {
|
|
4453
|
+
/* eslint-disable-next-line @typescript-eslint/no-deprecated -- internal usage */
|
|
4439
4454
|
this.setState(element, {
|
|
4440
4455
|
serverError: message,
|
|
4441
4456
|
});
|
|
4442
4457
|
}
|
|
4443
4458
|
resetState(element) {
|
|
4459
|
+
/* eslint-disable-next-line @typescript-eslint/no-deprecated -- internal usage */
|
|
4444
4460
|
this.setState(element, {
|
|
4445
4461
|
touched: false,
|
|
4446
4462
|
submitted: false,
|
|
@@ -4492,8 +4508,10 @@ class ValidationServiceImpl {
|
|
|
4492
4508
|
}
|
|
4493
4509
|
getExistingStateOrSetDefault(element) {
|
|
4494
4510
|
let validationState = this.getState(element.id);
|
|
4511
|
+
/* eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- technical debt */
|
|
4495
4512
|
if (!validationState) {
|
|
4496
4513
|
validationState = { touched: false, submitted: false };
|
|
4514
|
+
/* eslint-disable-next-line @typescript-eslint/no-deprecated -- internal usage */
|
|
4497
4515
|
this.setState(element, validationState);
|
|
4498
4516
|
}
|
|
4499
4517
|
return validationState;
|
|
@@ -4502,6 +4520,7 @@ class ValidationServiceImpl {
|
|
|
4502
4520
|
const validatorNames = Object.keys(validatorConfigs);
|
|
4503
4521
|
return validatorNames.map((validatorName) => {
|
|
4504
4522
|
const validator = registry[validatorName];
|
|
4523
|
+
/* eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- technical debt */
|
|
4505
4524
|
if (validator) {
|
|
4506
4525
|
return validator;
|
|
4507
4526
|
}
|
|
@@ -5192,6 +5211,7 @@ function alertScreenReader(text, options) {
|
|
|
5192
5211
|
updateProperties(mergedOptions);
|
|
5193
5212
|
const msg = document.createElement("p");
|
|
5194
5213
|
msg.textContent = text;
|
|
5214
|
+
/* eslint-disable-next-line @typescript-eslint/no-floating-promises -- technical debt */
|
|
5195
5215
|
waitForScreenReader(() => {
|
|
5196
5216
|
while (wrapper.firstChild) {
|
|
5197
5217
|
wrapper.removeChild(wrapper.firstChild);
|
|
@@ -5212,6 +5232,7 @@ function alertScreenReader(text, options) {
|
|
|
5212
5232
|
* @param options - options for wrapper element attributes.
|
|
5213
5233
|
*/
|
|
5214
5234
|
function createScreenReaderWrapper(options) {
|
|
5235
|
+
/* eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- technical debt */
|
|
5215
5236
|
if (!getWrapper()) {
|
|
5216
5237
|
wrapper = document.createElement("div");
|
|
5217
5238
|
wrapper.id = "fkui-alert-screen-reader";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fkui/logic",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.33.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.
|
|
64
|
+
"@fkui/date": "^6.33.0"
|
|
65
65
|
},
|
|
66
66
|
"engines": {
|
|
67
67
|
"node": ">= 20",
|
|
68
68
|
"npm": ">= 7"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "aefd7e006c712b409aae7893129f1cd3aa8d04cb"
|
|
71
71
|
}
|