coer-elements 2.0.17 → 2.0.19
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/extensions/lib/string.extension.d.ts +14 -10
- package/fesm2022/coer-elements-components.mjs +13 -13
- package/fesm2022/coer-elements-components.mjs.map +1 -1
- package/fesm2022/coer-elements-extensions.mjs +19 -21
- package/fesm2022/coer-elements-extensions.mjs.map +1 -1
- package/fesm2022/coer-elements-guards.mjs +7 -7
- package/fesm2022/coer-elements-guards.mjs.map +1 -1
- package/fesm2022/coer-elements-pages.mjs +4 -4
- package/fesm2022/coer-elements-pages.mjs.map +1 -1
- package/fesm2022/coer-elements-tools.mjs +116 -65
- package/fesm2022/coer-elements-tools.mjs.map +1 -1
- package/interfaces/lib/option.interface.d.ts +1 -0
- package/package.json +5 -5
- package/styles/coer-elements.css +3882 -3219
- package/styles/icons.scss +20 -0
- package/styles/index.scss +27 -8
- package/styles/layout-flex-wrap.scss +108 -0
- package/styles/layout-flex.scss +62 -0
- package/styles/layout-grid.scss +11 -0
- package/styles/margin.scss +21 -0
- package/styles/overflow.scss +9 -0
- package/styles/padding.scss +21 -0
- package/styles/position.scss +19 -1
- package/styles/scroll-bar.scss +7 -7
- package/svg/house.svg +3 -0
- package/tools/lib/elements-html.tools.d.ts +16 -0
- package/tools/lib/string.tools.d.ts +18 -0
- package/tools/lib/tools.d.ts +0 -10
- package/tools/public-api.d.ts +14 -13
- package/styles/bootstrap.scss +0 -9
- package/styles/layout.scss +0 -125
- package/styles/space.scss +0 -70
- package/tools/lib/elements-html.class.d.ts +0 -16
- /package/tools/lib/{breadcrumbs.class.d.ts → breadcrumbs.tools.d.ts} +0 -0
- /package/tools/lib/{colors.class.d.ts → colors.tools.d.ts} +0 -0
- /package/tools/lib/{control-value.class.d.ts → control-value.tools.d.ts} +0 -0
- /package/tools/lib/{date-time.class.d.ts → date-time.tools.d.ts} +0 -0
- /package/tools/lib/{files.class.d.ts → files.tools.d.ts} +0 -0
- /package/tools/lib/{filters.class.d.ts → filters.tools.d.ts} +0 -0
- /package/tools/lib/{menu.class.d.ts → menu.tools.d.ts} +0 -0
- /package/tools/lib/{page.class.d.ts → page.tools.d.ts} +0 -0
- /package/tools/lib/{screen.class.d.ts → screen.tools.d.ts} +0 -0
- /package/tools/lib/{section.class.d.ts → section.tools.d.ts} +0 -0
- /package/tools/lib/{service.class.d.ts → service.tools.d.ts} +0 -0
- /package/tools/lib/{source.class.d.ts → source.tools.d.ts} +0 -0
@@ -81,12 +81,6 @@ const Tools = {
|
|
81
81
|
default: return '';
|
82
82
|
}
|
83
83
|
},
|
84
|
-
/** */
|
85
|
-
RemoveAccents: (value) => {
|
86
|
-
if (Tools.IsOnlyWhiteSpace(value))
|
87
|
-
return '';
|
88
|
-
return value.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
89
|
-
},
|
90
84
|
/** Break reference of a object or array */
|
91
85
|
BreakReference: (object) => {
|
92
86
|
if (object === null)
|
@@ -102,14 +96,6 @@ const Tools = {
|
|
102
96
|
const OBJECT = JSON.parse(JSON.stringify(object));
|
103
97
|
return (Array.isArray(OBJECT) ? [...OBJECT] : { ...OBJECT });
|
104
98
|
},
|
105
|
-
/** Clean extra whitespaces */
|
106
|
-
CleanUpBlanks: (text) => {
|
107
|
-
if (Tools.IsOnlyWhiteSpace(text))
|
108
|
-
return '';
|
109
|
-
let words = String(text).split(' ');
|
110
|
-
words = words.filter(x => x.length > 0);
|
111
|
-
return words.join(' ');
|
112
|
-
},
|
113
99
|
/** Get properties of an object */
|
114
100
|
GetPropertyList: (object) => {
|
115
101
|
const properties = [];
|
@@ -137,32 +123,6 @@ const Tools = {
|
|
137
123
|
}
|
138
124
|
return Tools.BreakReference(array).map(item => Object.assign({ index: index++ }, item));
|
139
125
|
},
|
140
|
-
/** Set First Char To Lower */
|
141
|
-
FirstCharToLower: (text) => {
|
142
|
-
if (Tools.IsOnlyWhiteSpace(text))
|
143
|
-
return '';
|
144
|
-
const textArray = [];
|
145
|
-
for (let i = 0; i < text.length; i++) {
|
146
|
-
if (i === 0)
|
147
|
-
textArray.push(text[i].toLowerCase());
|
148
|
-
else
|
149
|
-
textArray.push(text[i]);
|
150
|
-
}
|
151
|
-
return textArray.join('');
|
152
|
-
},
|
153
|
-
/** Set First Char To Upper */
|
154
|
-
FirstCharToUpper: (text) => {
|
155
|
-
if (Tools.IsOnlyWhiteSpace(text))
|
156
|
-
return '';
|
157
|
-
const textArray = [];
|
158
|
-
for (let i = 0; i < text.length; i++) {
|
159
|
-
if (i === 0)
|
160
|
-
textArray.push(text[i].toUpperCase());
|
161
|
-
else
|
162
|
-
textArray.push(text[i]);
|
163
|
-
}
|
164
|
-
return textArray.join('');
|
165
|
-
},
|
166
126
|
/** Sort an array in ascending order by property */
|
167
127
|
SortBy: (array, property, propertyType = 'string') => {
|
168
128
|
switch (propertyType) {
|
@@ -291,12 +251,6 @@ const Tools = {
|
|
291
251
|
new CoerAlert().Warning('Unable to copy to clipboard', 'Quick Implement', 'bi bi-clipboard-fill');
|
292
252
|
}
|
293
253
|
},
|
294
|
-
/** */
|
295
|
-
RemoveLastChar: (text) => {
|
296
|
-
return Tools.IsNotOnlyWhiteSpace(text)
|
297
|
-
? text.trimEnd().substring(0, text.length - 1).trimEnd()
|
298
|
-
: '';
|
299
|
-
}
|
300
254
|
};
|
301
255
|
|
302
256
|
class Colors {
|
@@ -800,23 +754,23 @@ class DateTime {
|
|
800
754
|
}
|
801
755
|
}
|
802
756
|
|
803
|
-
|
757
|
+
class ElementsHTML {
|
804
758
|
/** */
|
805
|
-
GetElement
|
759
|
+
static { this.GetElement = (selector) => {
|
806
760
|
return document.querySelector(selector);
|
807
|
-
}
|
761
|
+
}; }
|
808
762
|
/** */
|
809
|
-
GetCssValueBy
|
763
|
+
static { this.GetCssValueBy = (selector, style) => {
|
810
764
|
return ElementsHTML.GetCssValue(document.querySelector(selector), style);
|
811
|
-
}
|
765
|
+
}; }
|
812
766
|
/** */
|
813
|
-
GetCssValue
|
767
|
+
static { this.GetCssValue = (element, style) => {
|
814
768
|
return Tools.IsNotNull(element)
|
815
769
|
? window.getComputedStyle(element).getPropertyValue(style)
|
816
770
|
: '';
|
817
|
-
}
|
771
|
+
}; }
|
818
772
|
/** Get width in px */
|
819
|
-
GetElementWidth
|
773
|
+
static { this.GetElementWidth = (element, ...args) => {
|
820
774
|
let width = 0;
|
821
775
|
if (Tools.IsNotNull(element) && Tools.IsNotOnlyWhiteSpace(element?.offsetWidth)) {
|
822
776
|
width += element.offsetWidth;
|
@@ -829,9 +783,9 @@ const ElementsHTML = {
|
|
829
783
|
}
|
830
784
|
}
|
831
785
|
return `${width}px`;
|
832
|
-
}
|
786
|
+
}; }
|
833
787
|
/** Get height in px */
|
834
|
-
GetElementHeight
|
788
|
+
static { this.GetElementHeight = (element, ...args) => {
|
835
789
|
let height = 0;
|
836
790
|
if (Tools.IsNotNull(element) && Tools.IsNotOnlyWhiteSpace(element?.offsetHeight)) {
|
837
791
|
height += element.offsetHeight;
|
@@ -844,9 +798,9 @@ const ElementsHTML = {
|
|
844
798
|
}
|
845
799
|
}
|
846
800
|
return `${height}px`;
|
847
|
-
}
|
801
|
+
}; }
|
848
802
|
/** */
|
849
|
-
IsInvalidElement
|
803
|
+
static { this.IsInvalidElement = (element) => {
|
850
804
|
let isInvalid = true;
|
851
805
|
if (Tools.IsNotNull(element)) {
|
852
806
|
if (typeof element == 'object') {
|
@@ -857,9 +811,9 @@ const ElementsHTML = {
|
|
857
811
|
}
|
858
812
|
}
|
859
813
|
return isInvalid;
|
860
|
-
}
|
814
|
+
}; }
|
861
815
|
/** Get color in hexadecimal format */
|
862
|
-
GetElementColor
|
816
|
+
static { this.GetElementColor = (element) => {
|
863
817
|
if (Tools.IsNotNull(element)) {
|
864
818
|
let rgb = window.getComputedStyle(element).getPropertyValue('color');
|
865
819
|
rgb = rgb.replace('rgb(', '').replace(')', '');
|
@@ -871,8 +825,105 @@ const ElementsHTML = {
|
|
871
825
|
return Colors.ToHexadecimal(red, green, blue, alpha);
|
872
826
|
}
|
873
827
|
return '';
|
828
|
+
}; }
|
829
|
+
}
|
830
|
+
;
|
831
|
+
|
832
|
+
class StringTools {
|
833
|
+
/** Sets the first character to lowercase */
|
834
|
+
static FirstCharToLower(value) {
|
835
|
+
if (Tools.IsOnlyWhiteSpace(value))
|
836
|
+
return '';
|
837
|
+
const array = [];
|
838
|
+
for (let i = 0; i < String(value).length; i++) {
|
839
|
+
if (i === 0)
|
840
|
+
array.push(String(value)[i].toLowerCase());
|
841
|
+
else
|
842
|
+
array.push(String(value)[i]);
|
843
|
+
}
|
844
|
+
return array.join('');
|
874
845
|
}
|
875
|
-
|
846
|
+
/** Sets the first character to uppercase */
|
847
|
+
static FirstCharToUpper(value) {
|
848
|
+
if (Tools.IsOnlyWhiteSpace(value))
|
849
|
+
return '';
|
850
|
+
const array = [];
|
851
|
+
for (let i = 0; i < String(value).length; i++) {
|
852
|
+
if (i === 0)
|
853
|
+
array.push(String(value)[i].toUpperCase());
|
854
|
+
else
|
855
|
+
array.push(String(value)[i]);
|
856
|
+
}
|
857
|
+
return array.join('');
|
858
|
+
}
|
859
|
+
/** Clean extra whitespaces */
|
860
|
+
static CleanUpBlanks(value) {
|
861
|
+
return (Tools.IsNotOnlyWhiteSpace(value))
|
862
|
+
? String(value).split(' ').filter(x => x.length > 0).join(' ')
|
863
|
+
: '';
|
864
|
+
}
|
865
|
+
/** Apply title formatting */
|
866
|
+
static ToTitle(value) {
|
867
|
+
return (Tools.IsNotOnlyWhiteSpace(value))
|
868
|
+
? String(value).split(' ').filter(x => x.length > 0).map(x => StringTools.FirstCharToUpper(x.toLowerCase())).join(' ')
|
869
|
+
: '';
|
870
|
+
}
|
871
|
+
/** Removes the last character */
|
872
|
+
static RemoveLastChar(value) {
|
873
|
+
return Tools.IsNotOnlyWhiteSpace(value)
|
874
|
+
? String(value).trimEnd().substring(0, String(value).length - 1).trimEnd()
|
875
|
+
: '';
|
876
|
+
}
|
877
|
+
/** Removes accents */
|
878
|
+
static RemoveAccents(value, except = []) {
|
879
|
+
if (Tools.IsOnlyWhiteSpace(value))
|
880
|
+
return '';
|
881
|
+
if (except.length > 0) {
|
882
|
+
let index = 0;
|
883
|
+
const mapValue = new Map();
|
884
|
+
for (const char of String(value)) {
|
885
|
+
mapValue.set(index++, char);
|
886
|
+
}
|
887
|
+
index = 0;
|
888
|
+
const mapNormalize = new Map();
|
889
|
+
for (const char of String(value).normalize('NFD').replace(/[\u0300-\u036f]/g, '')) {
|
890
|
+
mapNormalize.set(index++, char);
|
891
|
+
}
|
892
|
+
for (const char of except) {
|
893
|
+
for (const [index, value] of mapValue.entries()) {
|
894
|
+
if (value === char) {
|
895
|
+
mapNormalize.set(index, char);
|
896
|
+
}
|
897
|
+
}
|
898
|
+
}
|
899
|
+
return Array.from(mapNormalize.values()).join('');
|
900
|
+
}
|
901
|
+
else {
|
902
|
+
return String(value).normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
903
|
+
}
|
904
|
+
}
|
905
|
+
/** Removes special characters */
|
906
|
+
static OnlyAlphaNumeric(value) {
|
907
|
+
return (Tools.IsNotOnlyWhiteSpace(value))
|
908
|
+
? String(value).replace(/[^a-zA-Z0-9áéíóúÁÉÍÓÚüÜñÑ\s]/g, '') : '';
|
909
|
+
}
|
910
|
+
/** Validates if both strings are equal */
|
911
|
+
static Equals(value, value2, sensitive = false) {
|
912
|
+
if (typeof value === null && typeof value2 === null)
|
913
|
+
return true;
|
914
|
+
if (typeof value === 'undefined' && typeof value2 === 'undefined')
|
915
|
+
return true;
|
916
|
+
if (typeof value === 'string' && typeof value2 === 'string') {
|
917
|
+
if (!sensitive) {
|
918
|
+
value = value.toUpperCase();
|
919
|
+
value2 = value2.toUpperCase();
|
920
|
+
}
|
921
|
+
return value.length === value2.length
|
922
|
+
&& value === value2;
|
923
|
+
}
|
924
|
+
return false;
|
925
|
+
}
|
926
|
+
}
|
876
927
|
|
877
928
|
class Files {
|
878
929
|
static { this.EXCEL_EXTENSIONS = ['xls', 'xlsx', 'csv']; }
|
@@ -914,7 +965,7 @@ class Files {
|
|
914
965
|
});
|
915
966
|
//Get Headers
|
916
967
|
for (const column in dataSheet[0]) {
|
917
|
-
columns.push(
|
968
|
+
columns.push(StringTools.FirstCharToLower(String(dataSheet[0][column]).replaceAll(' ', '')));
|
918
969
|
}
|
919
970
|
//Get Rows
|
920
971
|
rows = XLSX.utils.sheet_to_json(sheet, { header: columns });
|
@@ -932,8 +983,8 @@ class Files {
|
|
932
983
|
}
|
933
984
|
/** Export to excel file */
|
934
985
|
static ExportExcel(data, fileName = 'coer_report', sheetName = 'Sheet1') {
|
935
|
-
sheetName =
|
936
|
-
fileName =
|
986
|
+
sheetName = StringTools.CleanUpBlanks(sheetName);
|
987
|
+
fileName = StringTools.CleanUpBlanks(fileName);
|
937
988
|
if (fileName.endsWith('.xls') || fileName.endsWith('.xlsx') || fileName.endsWith('.csv')) {
|
938
989
|
if (fileName.endsWith('.xls')) {
|
939
990
|
fileName = fileName.replaceAll('.xls', '.xlsx');
|
@@ -2093,5 +2144,5 @@ class Service {
|
|
2093
2144
|
* Generated bundle index. Do not edit.
|
2094
2145
|
*/
|
2095
2146
|
|
2096
|
-
export { Breadcrumbs, CONTROL_VALUE, CoerAlert, Colors, ControlValue, DateTime, ElementsHTML, Files, Filters, GridTemplates, Menu, Page, Screen, Section, Service, Source, Tools, User };
|
2147
|
+
export { Breadcrumbs, CONTROL_VALUE, CoerAlert, Colors, ControlValue, DateTime, ElementsHTML, Files, Filters, GridTemplates, Menu, Page, Screen, Section, Service, Source, StringTools, Tools, User };
|
2097
2148
|
//# sourceMappingURL=coer-elements-tools.mjs.map
|