coer-elements 0.0.49 → 0.0.51
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/components/lib/coer-list/coer-list.component.d.ts +9 -2
- package/components/lib/coer-sidenav/coer-sidenav.component.d.ts +1 -0
- package/esm2022/components/lib/coer-list/coer-list.component.mjs +16 -3
- package/esm2022/components/lib/coer-sidenav/coer-menu-option/coer-menu-option.component.mjs +4 -4
- package/esm2022/components/lib/coer-sidenav/coer-sidenav.component.mjs +5 -4
- package/esm2022/tools/lib/filters.class.mjs +49 -0
- package/esm2022/tools/lib/page.class.mjs +19 -9
- package/esm2022/tools/public-api.mjs +2 -1
- package/fesm2022/coer-elements-components.mjs +22 -8
- package/fesm2022/coer-elements-components.mjs.map +1 -1
- package/fesm2022/coer-elements-tools.mjs +66 -9
- package/fesm2022/coer-elements-tools.mjs.map +1 -1
- package/package.json +1 -1
- package/tools/lib/filters.class.d.ts +11 -0
- package/tools/lib/page.class.d.ts +5 -0
- package/tools/public-api.d.ts +1 -0
@@ -776,6 +776,54 @@ class Files {
|
|
776
776
|
}
|
777
777
|
}
|
778
778
|
|
779
|
+
class Filters {
|
780
|
+
static { this.storage = 'COER-System'; }
|
781
|
+
/** */
|
782
|
+
static Add(filters, path) {
|
783
|
+
let storage = sessionStorage.getItem(this.storage);
|
784
|
+
storage = JSON.parse(storage);
|
785
|
+
let dictionary = [[path, filters]];
|
786
|
+
if (Tools.IsNotNull(storage?.filters)) {
|
787
|
+
if (!storage.filters.some((x) => x.some(y => y === path))) {
|
788
|
+
storage.filters.concat(dictionary);
|
789
|
+
}
|
790
|
+
}
|
791
|
+
storage = Object.assign({}, storage, {
|
792
|
+
filters: dictionary
|
793
|
+
});
|
794
|
+
sessionStorage.setItem(this.storage, JSON.stringify(storage));
|
795
|
+
}
|
796
|
+
/** */
|
797
|
+
static Get(path) {
|
798
|
+
let storage = sessionStorage.getItem(this.storage);
|
799
|
+
storage = JSON.parse(storage);
|
800
|
+
return (Tools.IsNotNull(storage?.filters))
|
801
|
+
? storage.filters.find((x) => x.some((y) => y === path))[1] || null
|
802
|
+
: null;
|
803
|
+
}
|
804
|
+
/** */
|
805
|
+
static Remove(path) {
|
806
|
+
let storage = sessionStorage.getItem(this.storage);
|
807
|
+
storage = JSON.parse(storage);
|
808
|
+
if (Tools.IsNotNull(storage?.filters)) {
|
809
|
+
const index = storage.filters.findIndex((x) => x.some((y) => y === path));
|
810
|
+
if (index >= 0) {
|
811
|
+
storage.filters.splice(index, 1);
|
812
|
+
}
|
813
|
+
}
|
814
|
+
sessionStorage.setItem(this.storage, JSON.stringify(storage));
|
815
|
+
}
|
816
|
+
/** */
|
817
|
+
static RemoveAll() {
|
818
|
+
let storage = sessionStorage.getItem(this.storage);
|
819
|
+
storage = JSON.parse(storage);
|
820
|
+
if (Tools.IsNotNull(storage?.filters)) {
|
821
|
+
delete storage.filters;
|
822
|
+
}
|
823
|
+
sessionStorage.setItem(this.storage, JSON.stringify(storage));
|
824
|
+
}
|
825
|
+
}
|
826
|
+
|
779
827
|
class Menu {
|
780
828
|
static { this.storage = 'COER-System'; }
|
781
829
|
/** */
|
@@ -896,6 +944,7 @@ class Page {
|
|
896
944
|
/** */
|
897
945
|
this.goBack = { show: false };
|
898
946
|
//Private Variables
|
947
|
+
this._path = '';
|
899
948
|
this._page = '';
|
900
949
|
this._source = null;
|
901
950
|
this._preventDestroy = false;
|
@@ -942,23 +991,23 @@ class Page {
|
|
942
991
|
/** Rename the last breadcrumb and update the url id */
|
943
992
|
SetPageName(name, id = null) {
|
944
993
|
this._page = name;
|
945
|
-
|
946
|
-
if (
|
947
|
-
|
994
|
+
this._path = this.router.url;
|
995
|
+
if (this._path.includes('?'))
|
996
|
+
this._path = this._path.split('?')[0];
|
948
997
|
if (id) {
|
949
|
-
const PATH_ARRAY =
|
998
|
+
const PATH_ARRAY = this._path.split('/');
|
950
999
|
const PATH_ID = Tools.BreakReference(PATH_ARRAY).pop();
|
951
1000
|
if (PATH_ID) {
|
952
1001
|
PATH_ARRAY[PATH_ARRAY.length - 1] = String(id);
|
953
|
-
|
1002
|
+
this._path = PATH_ARRAY.join('/');
|
954
1003
|
}
|
955
1004
|
}
|
956
1005
|
if (this.breadcrumbs.length > 0) {
|
957
1006
|
this.breadcrumbs[this.breadcrumbs.length - 1].page = name;
|
958
|
-
this.breadcrumbs[this.breadcrumbs.length - 1].path =
|
959
|
-
Breadcrumbs.SetLast(name,
|
1007
|
+
this.breadcrumbs[this.breadcrumbs.length - 1].path = this._path;
|
1008
|
+
Breadcrumbs.SetLast(name, this._path);
|
960
1009
|
}
|
961
|
-
this.router.navigateByUrl(
|
1010
|
+
this.router.navigateByUrl(this._path);
|
962
1011
|
}
|
963
1012
|
/** */
|
964
1013
|
__SetSource() {
|
@@ -1017,6 +1066,14 @@ class Page {
|
|
1017
1066
|
setTimeout(() => window.location.reload());
|
1018
1067
|
}
|
1019
1068
|
/** */
|
1069
|
+
SetPageFilters(filters) {
|
1070
|
+
Filters.Add(filters, this._path);
|
1071
|
+
}
|
1072
|
+
/** */
|
1073
|
+
GetPageFilters() {
|
1074
|
+
return Filters.Get(this._path);
|
1075
|
+
}
|
1076
|
+
/** */
|
1020
1077
|
Log(value, log = null) {
|
1021
1078
|
if (Tools.IsNotNull(log))
|
1022
1079
|
console.log({ log, value });
|
@@ -1492,5 +1549,5 @@ class Service {
|
|
1492
1549
|
* Generated bundle index. Do not edit.
|
1493
1550
|
*/
|
1494
1551
|
|
1495
|
-
export { Breadcrumbs, CONTROL_VALUE, CoerAlert, Colors, ControlValue, DateTime, Files, GridTemplates, Menu, Page, Screen, Service, Source, Tools };
|
1552
|
+
export { Breadcrumbs, CONTROL_VALUE, CoerAlert, Colors, ControlValue, DateTime, Files, Filters, GridTemplates, Menu, Page, Screen, Service, Source, Tools };
|
1496
1553
|
//# sourceMappingURL=coer-elements-tools.mjs.map
|