zek 19.0.21 → 19.0.22
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/fesm2022/zek.mjs +119 -18
- package/fesm2022/zek.mjs.map +1 -1
- package/lib/utils/storage-helper.d.ts +39 -1
- package/package.json +1 -1
package/fesm2022/zek.mjs
CHANGED
|
@@ -1379,30 +1379,131 @@ class RandomHelper {
|
|
|
1379
1379
|
}
|
|
1380
1380
|
|
|
1381
1381
|
class StorageHelper {
|
|
1382
|
+
// Check if logic is running in a browser environment
|
|
1383
|
+
static isBrowser() {
|
|
1384
|
+
return typeof window !== 'undefined' && typeof window.localStorage !== 'undefined';
|
|
1385
|
+
}
|
|
1386
|
+
/**
|
|
1387
|
+
* Saves data to localStorage.
|
|
1388
|
+
* Automatically stringifies objects, arrays, booleans, and numbers.
|
|
1389
|
+
*/
|
|
1382
1390
|
static set(key, value) {
|
|
1383
|
-
if (!key)
|
|
1391
|
+
if (!this.isBrowser() || !key)
|
|
1384
1392
|
return;
|
|
1393
|
+
// Fix: Only remove if strictly null or undefined.
|
|
1394
|
+
// Prevents accidental deletion of 0, false, or ""
|
|
1395
|
+
if (value === null || value === undefined) {
|
|
1396
|
+
this.remove(key);
|
|
1397
|
+
return;
|
|
1398
|
+
}
|
|
1399
|
+
try {
|
|
1400
|
+
// If it's a string, store as is. Otherwise, stringify it.
|
|
1401
|
+
const data = typeof value === 'string' ? value : JSON.stringify(value);
|
|
1402
|
+
localStorage.setItem(key, data);
|
|
1385
1403
|
}
|
|
1386
|
-
|
|
1387
|
-
|
|
1404
|
+
catch (error) {
|
|
1405
|
+
console.error(`Error saving ${key} to localStorage`, error);
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
/**
|
|
1409
|
+
* Retrieves data from localStorage.
|
|
1410
|
+
* Tries to parse JSON; returns string (or original type) if parsing fails.
|
|
1411
|
+
*/
|
|
1412
|
+
static get(key) {
|
|
1413
|
+
if (!this.isBrowser() || !key)
|
|
1414
|
+
return null;
|
|
1415
|
+
const item = localStorage.getItem(key);
|
|
1416
|
+
if (item === null)
|
|
1417
|
+
return null;
|
|
1418
|
+
try {
|
|
1419
|
+
// Fix: robust parsing handles objects, arrays, and stringified primitives
|
|
1420
|
+
return JSON.parse(item);
|
|
1421
|
+
}
|
|
1422
|
+
catch (e) {
|
|
1423
|
+
// If parsing fails, return the raw string
|
|
1424
|
+
return item;
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
/**
|
|
1428
|
+
* Removes a specific item.
|
|
1429
|
+
*/
|
|
1430
|
+
static remove(key) {
|
|
1431
|
+
if (!this.isBrowser() || !key)
|
|
1388
1432
|
return;
|
|
1433
|
+
localStorage.removeItem(key);
|
|
1434
|
+
}
|
|
1435
|
+
/**
|
|
1436
|
+
* Clears all local storage.
|
|
1437
|
+
*/
|
|
1438
|
+
static clear() {
|
|
1439
|
+
if (!this.isBrowser())
|
|
1440
|
+
return;
|
|
1441
|
+
localStorage.clear();
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
class SessionStorageHelper {
|
|
1445
|
+
// Check if logic is running in a browser environment
|
|
1446
|
+
static isBrowser() {
|
|
1447
|
+
return typeof window !== 'undefined' && typeof window.sessionStorage !== 'undefined';
|
|
1448
|
+
}
|
|
1449
|
+
/**
|
|
1450
|
+
* Saves data to sessionStorage.
|
|
1451
|
+
* automatically stringifies objects/arrays.
|
|
1452
|
+
*/
|
|
1453
|
+
static set(key, value) {
|
|
1454
|
+
if (!this.isBrowser() || !key)
|
|
1455
|
+
return;
|
|
1456
|
+
// Fix: Only remove if strictly null or undefined.
|
|
1457
|
+
// Allowing false, 0, or "" to be stored.
|
|
1458
|
+
if (value === null || value === undefined) {
|
|
1459
|
+
this.remove(key);
|
|
1460
|
+
return;
|
|
1461
|
+
}
|
|
1462
|
+
try {
|
|
1463
|
+
// Store strings as is, stringify everything else (objects, arrays, numbers, booleans)
|
|
1464
|
+
const data = typeof value === 'string' ? value : JSON.stringify(value);
|
|
1465
|
+
sessionStorage.setItem(key, data);
|
|
1389
1466
|
}
|
|
1390
|
-
|
|
1391
|
-
|
|
1467
|
+
catch (error) {
|
|
1468
|
+
console.error(`Error saving ${key} to sessionStorage`, error);
|
|
1392
1469
|
}
|
|
1393
|
-
localStorage.setItem(key, value);
|
|
1394
1470
|
}
|
|
1471
|
+
/**
|
|
1472
|
+
* Retrieves data from sessionStorage.
|
|
1473
|
+
* Tries to parse JSON; returns string if parsing fails.
|
|
1474
|
+
*/
|
|
1395
1475
|
static get(key) {
|
|
1396
|
-
|
|
1397
|
-
|
|
1476
|
+
if (!this.isBrowser() || !key)
|
|
1477
|
+
return null;
|
|
1478
|
+
const item = sessionStorage.getItem(key);
|
|
1479
|
+
if (item === null)
|
|
1398
1480
|
return null;
|
|
1481
|
+
try {
|
|
1482
|
+
// Attempt to parse. This handles objects "{}", arrays "[]",
|
|
1483
|
+
// and stringified primitives like "true" or "123".
|
|
1484
|
+
return JSON.parse(item);
|
|
1399
1485
|
}
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
return
|
|
1486
|
+
catch (e) {
|
|
1487
|
+
// If parsing fails, it was likely a simple string to begin with.
|
|
1488
|
+
// Return as-is.
|
|
1489
|
+
return item;
|
|
1404
1490
|
}
|
|
1405
|
-
|
|
1491
|
+
}
|
|
1492
|
+
/**
|
|
1493
|
+
* Removes a specific item.
|
|
1494
|
+
*/
|
|
1495
|
+
static remove(key) {
|
|
1496
|
+
if (!this.isBrowser() || !key)
|
|
1497
|
+
return;
|
|
1498
|
+
sessionStorage.removeItem(key);
|
|
1499
|
+
}
|
|
1500
|
+
/**
|
|
1501
|
+
* Clears all session storage.
|
|
1502
|
+
*/
|
|
1503
|
+
static clear() {
|
|
1504
|
+
if (!this.isBrowser())
|
|
1505
|
+
return;
|
|
1506
|
+
sessionStorage.clear();
|
|
1406
1507
|
}
|
|
1407
1508
|
}
|
|
1408
1509
|
|
|
@@ -3076,18 +3177,18 @@ class ListBaseComponent extends BaseComponent {
|
|
|
3076
3177
|
initStoredFilter() {
|
|
3077
3178
|
const filterParam = this.getQueryParam('filter') || this.getParam('filter');
|
|
3078
3179
|
if (filterParam) {
|
|
3079
|
-
const tmp =
|
|
3180
|
+
const tmp = SessionStorageHelper.get('filter');
|
|
3080
3181
|
if (tmp && tmp.url && tmp.url === this.url && tmp.filter) {
|
|
3081
3182
|
this.filter = Object.assign({}, tmp.filter);
|
|
3082
3183
|
//this.filter = { ...tmp.filter };
|
|
3083
3184
|
//we dont need this.assignFilter(); because after initStoredFilter(); will be assigned.
|
|
3084
3185
|
}
|
|
3085
3186
|
else {
|
|
3086
|
-
|
|
3187
|
+
SessionStorageHelper.remove('filter');
|
|
3087
3188
|
}
|
|
3088
3189
|
}
|
|
3089
3190
|
else {
|
|
3090
|
-
|
|
3191
|
+
SessionStorageHelper.remove('filter');
|
|
3091
3192
|
}
|
|
3092
3193
|
}
|
|
3093
3194
|
async changePage(page) {
|
|
@@ -3123,7 +3224,7 @@ class ListBaseComponent extends BaseComponent {
|
|
|
3123
3224
|
this.internalSaveFilter();
|
|
3124
3225
|
}
|
|
3125
3226
|
internalSaveFilter() {
|
|
3126
|
-
|
|
3227
|
+
SessionStorageHelper.set('filter', {
|
|
3127
3228
|
url: this.url,
|
|
3128
3229
|
filter: this.internalFilter
|
|
3129
3230
|
});
|
|
@@ -7952,5 +8053,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
|
|
|
7952
8053
|
* Generated bundle index. Do not edit.
|
|
7953
8054
|
*/
|
|
7954
8055
|
|
|
7955
|
-
export { API_BASE_URL, AgePipe, Alert, AlertService, ArrayHelper, AuthService, Base64Helper, BaseAlert, BaseComponent, BaseService, BitwiseHelper, BootstrapHelper, CacheHelper, Color, ComponentType, Convert, CoreComponent, CoreUiComponent, CrudService, CssHelper, CustomHttpParamEncoder, DATE_FORMAT, DateHelper, DateValueAccessor, DatepickerModule, EditBase, EditBaseComponent, EditComponent, EditFormComponent, ErrorHelper, ExcelHelper, FileHelper, FileService, FilterBase, FilterHelper, GOOGLE_CLIENT_ID, Gender, Guid, HtmlHelper, HttpErrorHandler, IdName, IdNameChecked, IntervalHelper, JwtHelper, KeyPair, KeyPairChecked, KeyPairEx, KeyPairRequired, LANGUAGE, ListBase, ListBaseComponent, MATCH_VALIDATOR, MatchValidator, MathHelper, Month, ObjectHelper, OverlapHelper, PagedList, Pager, PagerHelper, PeriodRelation, PrintType, RANGE_VALIDATOR, RECAPTCHA_SITE_KEY, RandomHelper, RangeValidator, ReCaptchaService, RecaptchaModule, StorageHelper, StringHelper, TimeHelper, TimeModule, TimePipe, TimerService, TmpHelper, Toast, Tree, UrlHelper, ValidEventArgs, ValidationHelper, Validators, ValidatorsModule, WebApiClient, WebApiModule, ZekAlert, ZekApproveModal, ZekAutoComplete, ZekButtonBrowse, ZekButtonBrowseModalBase, ZekButtonBrowseModalToolbar, ZekButtonBrowseModule, ZekCallbackPipe, ZekCard, ZekCountdown, ZekDateAgoPipe, ZekDelayedInputDirective, ZekDeleteModal, ZekDisapproveModal, ZekDropdown, ZekEditToolbar, ZekFieldValidator, ZekFileInput, ZekFileSizePipe, ZekFileViewer, ZekFilterModal, ZekGoogleLoginButton, ZekGoogleLoginModule, ZekGridToolbar, ZekGridToolbarBar, ZekListToolbar, ZekLoading, ZekLoadingModule, ZekLocalToUtcModule, ZekLocalToUtcPipe, ZekModal, ZekModalModule, ZekNumericDirective, ZekPageTitle, ZekPager, ZekPassword, ZekProgress, ZekRadio, ZekReadOnlyDirective, ZekRestoreModal, ZekSafePipe, ZekSelect2, ZekSelect2Multiple, ZekSelectMultiple, ZekSort, ZekSortButtonGroup, ZekSubmitModal, ZekSumModal, ZekTag, ZekToast, ZekTooltip, ZekUtcToLocalModule, ZekUtcToLocalPipe, ZekValidation, ZekWizard, ZekWizard2, firstBy, handler, matchValidator, nullValidator, rangeValidator, zekAuthGuard };
|
|
8056
|
+
export { API_BASE_URL, AgePipe, Alert, AlertService, ArrayHelper, AuthService, Base64Helper, BaseAlert, BaseComponent, BaseService, BitwiseHelper, BootstrapHelper, CacheHelper, Color, ComponentType, Convert, CoreComponent, CoreUiComponent, CrudService, CssHelper, CustomHttpParamEncoder, DATE_FORMAT, DateHelper, DateValueAccessor, DatepickerModule, EditBase, EditBaseComponent, EditComponent, EditFormComponent, ErrorHelper, ExcelHelper, FileHelper, FileService, FilterBase, FilterHelper, GOOGLE_CLIENT_ID, Gender, Guid, HtmlHelper, HttpErrorHandler, IdName, IdNameChecked, IntervalHelper, JwtHelper, KeyPair, KeyPairChecked, KeyPairEx, KeyPairRequired, LANGUAGE, ListBase, ListBaseComponent, MATCH_VALIDATOR, MatchValidator, MathHelper, Month, ObjectHelper, OverlapHelper, PagedList, Pager, PagerHelper, PeriodRelation, PrintType, RANGE_VALIDATOR, RECAPTCHA_SITE_KEY, RandomHelper, RangeValidator, ReCaptchaService, RecaptchaModule, SessionStorageHelper, StorageHelper, StringHelper, TimeHelper, TimeModule, TimePipe, TimerService, TmpHelper, Toast, Tree, UrlHelper, ValidEventArgs, ValidationHelper, Validators, ValidatorsModule, WebApiClient, WebApiModule, ZekAlert, ZekApproveModal, ZekAutoComplete, ZekButtonBrowse, ZekButtonBrowseModalBase, ZekButtonBrowseModalToolbar, ZekButtonBrowseModule, ZekCallbackPipe, ZekCard, ZekCountdown, ZekDateAgoPipe, ZekDelayedInputDirective, ZekDeleteModal, ZekDisapproveModal, ZekDropdown, ZekEditToolbar, ZekFieldValidator, ZekFileInput, ZekFileSizePipe, ZekFileViewer, ZekFilterModal, ZekGoogleLoginButton, ZekGoogleLoginModule, ZekGridToolbar, ZekGridToolbarBar, ZekListToolbar, ZekLoading, ZekLoadingModule, ZekLocalToUtcModule, ZekLocalToUtcPipe, ZekModal, ZekModalModule, ZekNumericDirective, ZekPageTitle, ZekPager, ZekPassword, ZekProgress, ZekRadio, ZekReadOnlyDirective, ZekRestoreModal, ZekSafePipe, ZekSelect2, ZekSelect2Multiple, ZekSelectMultiple, ZekSort, ZekSortButtonGroup, ZekSubmitModal, ZekSumModal, ZekTag, ZekToast, ZekTooltip, ZekUtcToLocalModule, ZekUtcToLocalPipe, ZekValidation, ZekWizard, ZekWizard2, firstBy, handler, matchValidator, nullValidator, rangeValidator, zekAuthGuard };
|
|
7956
8057
|
//# sourceMappingURL=zek.mjs.map
|