@firestitch/list 18.0.27 → 18.0.28
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/app/classes/persistance-controller.d.ts +4 -2
- package/app/interfaces/listconfig.interface.d.ts +1 -0
- package/esm2022/app/classes/list-controller.mjs +7 -2
- package/esm2022/app/classes/persistance-controller.mjs +19 -14
- package/esm2022/app/interfaces/listconfig.interface.mjs +1 -1
- package/fesm2022/firestitch-list.mjs +24 -14
- package/fesm2022/firestitch-list.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -2374,9 +2374,11 @@ class PersistanceController {
|
|
|
2374
2374
|
columnsEnabled = false;
|
|
2375
2375
|
pagingEnabled = false;
|
|
2376
2376
|
sortingEnabled = false;
|
|
2377
|
+
queryEnabled = false;
|
|
2378
|
+
name;
|
|
2377
2379
|
_store = inject(FsStore);
|
|
2378
|
-
_name;
|
|
2379
2380
|
_data = {};
|
|
2381
|
+
_storeKey = 'fs-list-persist';
|
|
2380
2382
|
_location = inject(Location);
|
|
2381
2383
|
init(listConfig, inDialog) {
|
|
2382
2384
|
const config = this._initConfig(listConfig, inDialog);
|
|
@@ -2385,7 +2387,8 @@ class PersistanceController {
|
|
|
2385
2387
|
this.columnsEnabled = config.persistColumn;
|
|
2386
2388
|
this.pagingEnabled = config.persistPaging;
|
|
2387
2389
|
this.sortingEnabled = config.persistSorting;
|
|
2388
|
-
this.
|
|
2390
|
+
this.queryEnabled = config.persistQuery;
|
|
2391
|
+
this.name = config.name;
|
|
2389
2392
|
this._data = this._get() || {};
|
|
2390
2393
|
}
|
|
2391
2394
|
}
|
|
@@ -2409,32 +2412,34 @@ class PersistanceController {
|
|
|
2409
2412
|
}
|
|
2410
2413
|
_set(key, value) {
|
|
2411
2414
|
this._data[key] = value;
|
|
2412
|
-
const storeData = this._store.get(
|
|
2413
|
-
storeData[this.
|
|
2414
|
-
this._store.set(
|
|
2415
|
+
const storeData = this._store.get(this._storeKey) || {};
|
|
2416
|
+
storeData[this.name] = this._data;
|
|
2417
|
+
this._store.set(this._storeKey, storeData);
|
|
2415
2418
|
}
|
|
2416
2419
|
_get() {
|
|
2417
|
-
const storeData = this._store.get(
|
|
2420
|
+
const storeData = this._store.get(this._storeKey);
|
|
2418
2421
|
if (storeData) {
|
|
2419
|
-
return storeData[this.
|
|
2422
|
+
return storeData[this.name];
|
|
2420
2423
|
}
|
|
2421
2424
|
return {};
|
|
2422
2425
|
}
|
|
2423
2426
|
_initConfig(config, inDialog) {
|
|
2424
|
-
let persistanceConfig = this.
|
|
2427
|
+
let persistanceConfig = this._getConfig(config);
|
|
2425
2428
|
if (persistanceConfig) {
|
|
2429
|
+
const persist = !inDialog || !!persistanceConfig.name;
|
|
2426
2430
|
persistanceConfig = {
|
|
2427
2431
|
name: persistanceConfig.name || getNormalizedPath(this._location),
|
|
2428
|
-
persistFilter:
|
|
2429
|
-
persistPaging:
|
|
2430
|
-
persistSorting:
|
|
2431
|
-
persistColumn:
|
|
2432
|
+
persistFilter: persist,
|
|
2433
|
+
persistPaging: persist,
|
|
2434
|
+
persistSorting: persist,
|
|
2435
|
+
persistColumn: persist,
|
|
2436
|
+
persistQuery: persist,
|
|
2432
2437
|
...persistanceConfig,
|
|
2433
2438
|
};
|
|
2434
2439
|
}
|
|
2435
2440
|
return persistanceConfig;
|
|
2436
2441
|
}
|
|
2437
|
-
|
|
2442
|
+
_getConfig(config) {
|
|
2438
2443
|
if (config) {
|
|
2439
2444
|
return {
|
|
2440
2445
|
...(config === true ? {} : config),
|
|
@@ -4882,7 +4887,6 @@ class List {
|
|
|
4882
4887
|
: null;
|
|
4883
4888
|
// Config
|
|
4884
4889
|
this.filterConfig = {
|
|
4885
|
-
persist: this.persist,
|
|
4886
4890
|
items: this.filters || [],
|
|
4887
4891
|
savedFilters: this.savedFilters,
|
|
4888
4892
|
actions: this.actions.actions,
|
|
@@ -4897,6 +4901,12 @@ class List {
|
|
|
4897
4901
|
reload: (this._config.reload ?? true) ? this.reload.bind(this) : null,
|
|
4898
4902
|
sortChange: this._filterSort.bind(this),
|
|
4899
4903
|
};
|
|
4904
|
+
if (this._persistance.queryEnabled) {
|
|
4905
|
+
this.filterConfig.persist = {
|
|
4906
|
+
name: this._persistance.name,
|
|
4907
|
+
persistQuery: true,
|
|
4908
|
+
};
|
|
4909
|
+
}
|
|
4900
4910
|
}
|
|
4901
4911
|
/**
|
|
4902
4912
|
* Callback when Filter has been initialized
|