zet-lib 1.5.19 → 1.5.21

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/Form.js CHANGED
@@ -179,9 +179,9 @@ Form.field = (obj) => {
179
179
  let imageLinkParent = obj.routeName
180
180
  if(bracketsImage>1){
181
181
  const matchImage = imageLinkName.match(regex);
182
- imageLinkParent = `${matchFile[1]}/${matchFile[2]}`;
182
+ imageLinkParent = `${matchImage[1] ? matchImage[1] : '' }/${matchImage[2] ? matchImage[2] : ''}`;
183
183
  }
184
- let stringvalue = value ? value.substring(13) : "";
184
+ let stringvalue = value ? value.replace(/^[^_]+_/, '') : "";
185
185
  let trashicon = stringvalue ? `<img class="tabler-icons icons-filter-danger" src="/assets/icons/trash-filled.svg" onclick="removeimage(this)">`: "";
186
186
  displayForm = `${prepend}<input ${tabindex} type="file" accept="image/*" onchange="loadFile(this,'${obj.id}' )" data-width="${obj.width}" class="form-control ${obj.class || ""}" ${id} ${name} ${placeholder} value="${value}" ${htmlOptions}>
187
187
  <div id="body${obj.id}" class="isfile" data-id="${obj.id}" data-table="${obj.routeName}" data-width="${obj.width}" data-name="${obj.title}" data-filename="${value}" data-required="${obj.required}"> <img class="mb-3" width="${obj.width}" id="file${
@@ -196,9 +196,9 @@ Form.field = (obj) => {
196
196
  let fileLinkParent = obj.routeName
197
197
  if(bracketsFile>1){
198
198
  const matchFile = fileLinkName.match(regex);
199
- fileLinkParent = `${matchFile[1]}/${matchFile[2]}`;
199
+ fileLinkParent = `${matchFile[1]?matchFile[1]:''}/${matchFile[2]?matchFile[2]:''}`;
200
200
  }
201
- let stringvaluefile = value ? value.substring(13) : "";
201
+ let stringvaluefile = value ? value.replace(/^[^_]+_/, '') : "";
202
202
  let trashiconfile = stringvaluefile? `<img class="tabler-icons icons-filter-danger" src="/assets/icons/trash-filled.svg" onclick="removeimage(this)">`: "";
203
203
  displayForm = `${prepend}<input ${tabindex} type="file" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/msword, application/vnd.ms-excel, application/vnd.ms-powerpoint,text/plain, application/pdf,.css,.js,.jpg,.png,.gif" onchange="loadFile(this,'${obj.id}' )" class="form-control ${
204
204
  obj.class || ""}" ${id} ${name} ${placeholder} value="${value}" ${htmlOptions}>
package/lib/Util.js CHANGED
@@ -55,7 +55,7 @@ Util.newLines = (n) => Util.newLine.repeat(n);
55
55
  // Hashing functions
56
56
  Util.hash = (string) => sha256(string);
57
57
  Util.hashCompare = (myPlaintextPassword, hash) =>
58
- Util.hash(myPlaintextPassword) === hash;
58
+ Util.hash(myPlaintextPassword) === hash;
59
59
 
60
60
  // Excel sequence generator - optimized with memoization
61
61
  const excelSequenceCache = new Map();
@@ -65,7 +65,7 @@ Util.excelSequence = function () {
65
65
  }
66
66
 
67
67
  const abjads = Array.from({ length: 26 }, (_, i) =>
68
- String.fromCharCode(65 + i)
68
+ String.fromCharCode(65 + i)
69
69
  );
70
70
  const arr = [...abjads];
71
71
  let num = 26;
@@ -90,22 +90,22 @@ const defaultDateFormat = "YYYY-MM-DD";
90
90
  const defaultTimeFormat = "YYYY-MM-DD HH:mm:ss";
91
91
 
92
92
  Util.dateSql = (date, format = defaultDateFormat) =>
93
- date && date !== "0000-00-00" ? moment(date).format(format) : "";
93
+ date && date !== "0000-00-00" ? moment(date).format(format) : "";
94
94
 
95
95
  Util.dateOriginal = (date) =>
96
- date && date !== "0000-00-00" ? moment(date).utc(false) : "";
96
+ date && date !== "0000-00-00" ? moment(date).utc(false) : "";
97
97
 
98
98
  Util.dateFormat = (date, format = defaultDateFormat) =>
99
- date && date !== "0000-00-00" ? moment(date).format(format) : "";
99
+ date && date !== "0000-00-00" ? moment(date).format(format) : "";
100
100
 
101
101
  Util.timePublic = (date) => (date ? moment(date).format("DD MMM YYYY") : "");
102
102
 
103
103
  Util.timeSql = (date, format = defaultTimeFormat) =>
104
- date && date !== "0000-00-00 00:00:00" ? moment(date).format(format) : "";
104
+ date && date !== "0000-00-00 00:00:00" ? moment(date).format(format) : "";
105
105
 
106
106
  // Optimized date difference calculation
107
107
  Util.dateDiff = (start, end, format = "months") =>
108
- start && end ? moment(end).diff(moment(start), format, true) : 0;
108
+ start && end ? moment(end).diff(moment(start), format, true) : 0;
109
109
 
110
110
  // Optimized date parsing
111
111
  Util.getDate = (date = "") => {
@@ -124,15 +124,15 @@ Util.dateIsBetween = (compare, start, end) => {
124
124
  const endDate = moment(end);
125
125
 
126
126
  return (
127
- compareDate.isSame(startDate) ||
128
- compareDate.isSame(endDate) ||
129
- compareDate.isBetween(startDate, endDate)
127
+ compareDate.isSame(startDate) ||
128
+ compareDate.isSame(endDate) ||
129
+ compareDate.isBetween(startDate, endDate)
130
130
  );
131
131
  };
132
132
 
133
133
  // Optimized month and year extraction
134
134
  Util.getMonth = (date) =>
135
- date?.length > 5 ? new Date(date).getMonth() + 1 : 0;
135
+ date?.length > 5 ? new Date(date).getMonth() + 1 : 0;
136
136
 
137
137
  Util.getYear = (date) => Util.dateSql(date)?.slice(0, 4) || "";
138
138
 
@@ -149,14 +149,14 @@ Util.calculateDay = function (from, to, holidayInWeek = 0) {
149
149
 
150
150
  if (holidayInWeek === 1) {
151
151
  const days = Util.enumerateDaysBetweenDates(
152
- moment(from).format("YYYY-MM-DD"),
153
- moment(to).format("YYYY-MM-DD")
152
+ moment(from).format("YYYY-MM-DD"),
153
+ moment(to).format("YYYY-MM-DD")
154
154
  );
155
155
  count = days.filter((item) => moment(item).day() !== 0).length;
156
156
  } else if (holidayInWeek === 2) {
157
157
  const days = Util.enumerateDaysBetweenDates(
158
- moment(from).format("YYYY-MM-DD"),
159
- moment(to).format("YYYY-MM-DD")
158
+ moment(from).format("YYYY-MM-DD"),
159
+ moment(to).format("YYYY-MM-DD")
160
160
  );
161
161
  count = days.filter((item) => {
162
162
  const day = moment(item).day();
@@ -209,7 +209,7 @@ Util.escapeRegExp = function (str = "") {
209
209
 
210
210
  Util.validateEmail = function (email) {
211
211
  let re =
212
- /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
212
+ /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
213
213
  return re.test(email);
214
214
  };
215
215
 
@@ -296,13 +296,13 @@ Util.arrayToObject = (array = [], keyField, isInteger = false) => {
296
296
  if (array.length) {
297
297
  array.forEach(function (item) {
298
298
  var name =
299
- item[keyField] == null
300
- ? "xxxxxx"
301
- : item[keyField] == "null"
302
- ? "xxxxxx"
303
- : isInteger
304
- ? item[keyField]
305
- : item[keyField] + "";
299
+ item[keyField] == null
300
+ ? "xxxxxx"
301
+ : item[keyField] == "null"
302
+ ? "xxxxxx"
303
+ : isInteger
304
+ ? item[keyField]
305
+ : item[keyField] + "";
306
306
  obj[name] = item;
307
307
  });
308
308
  }
@@ -374,7 +374,7 @@ Util.random = function (length) {
374
374
  length = length || 5;
375
375
  let text = "";
376
376
  const possible =
377
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
377
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
378
378
  for (let i = 0; i < length; i++)
379
379
  text += possible.charAt(Math.floor(Math.random() * possible.length));
380
380
 
@@ -403,13 +403,13 @@ Util.getFormattedDate = function (date) {
403
403
  let day = date.getDate().toString();
404
404
  day = day.length > 1 ? day : "0" + day;
405
405
  let time =
406
- date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
406
+ date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
407
407
  return year + "-" + month + "-" + day + " " + time;
408
408
  };
409
409
 
410
410
  Util.uniqueId = function () {
411
411
  return (
412
- Date.now().toString(36) + Math.random().toString(36).substr(2, 5)
412
+ Date.now().toString(36) + Math.random().toString(36).substr(2, 5)
413
413
  ).toUpperCase();
414
414
  };
415
415
 
@@ -460,7 +460,7 @@ Util.objectToGridFormat = function (obj = {}, isInteger = false) {
460
460
  Util.random = function (length = 5) {
461
461
  let text = "";
462
462
  const possible =
463
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
463
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
464
464
  for (let i = 0; i < length; i++)
465
465
  text += possible.charAt(Math.floor(Math.random() * possible.length));
466
466
 
@@ -469,26 +469,26 @@ Util.random = function (length = 5) {
469
469
 
470
470
  Util.typePrint = {
471
471
  register:
472
- '{"paper_size":"F4","paper_size_width":"215","paper_size_height":"330","padding_top":"8","padding_right":"8","padding_bottom":"8","padding_left":"8","border":"1","font":"0","font_size":"10","header":"SURAT PERINTAH KERJA","header_font":"0","header_font_size":"26"}',
472
+ '{"paper_size":"F4","paper_size_width":"215","paper_size_height":"330","padding_top":"8","padding_right":"8","padding_bottom":"8","padding_left":"8","border":"1","font":"0","font_size":"10","header":"SURAT PERINTAH KERJA","header_font":"0","header_font_size":"26"}',
473
473
  estimation:
474
- '{"paper_size":"F4","paper_size_width":"215","paper_size_height":"330","padding_top":"8","padding_right":"8","padding_bottom":"8","padding_left":"8","border":"1","font":"0","font_size":"12","header":"ESTIMASI BIAYA PERBAIKAN","header_font":"0","header_font_size":"18"}',
474
+ '{"paper_size":"F4","paper_size_width":"215","paper_size_height":"330","padding_top":"8","padding_right":"8","padding_bottom":"8","padding_left":"8","border":"1","font":"0","font_size":"12","header":"ESTIMASI BIAYA PERBAIKAN","header_font":"0","header_font_size":"18"}',
475
475
  invoice:
476
- '{"paper_size":"A5","paper_size_width":"148","paper_size_height":"210","padding_top":"8","padding_right":"8","padding_bottom":"8","padding_left":"8","border":"1","font":"0","font_size":"12","header":"INVOICE","header_font":"0","header_font_size":"18"}',
476
+ '{"paper_size":"A5","paper_size_width":"148","paper_size_height":"210","padding_top":"8","padding_right":"8","padding_bottom":"8","padding_left":"8","border":"1","font":"0","font_size":"12","header":"INVOICE","header_font":"0","header_font_size":"18"}',
477
477
  currency: '{"symbol":"Rp","name":"Rupiah","thousand":"."}',
478
478
  };
479
479
 
480
480
  Util.isJson = function (text) {
481
481
  if (text) {
482
482
  if (
483
- /^[\],:{}\s]*$/.test(
484
- text
485
- .replace(/\\["\\\/bfnrtu]/g, "@")
486
- .replace(
487
- /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
488
- "]"
489
- )
490
- .replace(/(?:^|:|,)(?:\s*\[)+/g, "")
491
- )
483
+ /^[\],:{}\s]*$/.test(
484
+ text
485
+ .replace(/\\["\\\/bfnrtu]/g, "@")
486
+ .replace(
487
+ /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
488
+ "]"
489
+ )
490
+ .replace(/(?:^|:|,)(?:\s*\[)+/g, "")
491
+ )
492
492
  ) {
493
493
  //the json is ok
494
494
  return true;
@@ -526,20 +526,20 @@ Util.getKey = function (obj = {}, field = "") {
526
526
 
527
527
  Util.camelize = function (text = "") {
528
528
  return text.replace(
529
- /^([A-Z])|[\s-_]+(\w)/g,
530
- function (match, p1, p2, offset) {
531
- if (p2) return p2.toUpperCase();
532
- return p1.toLowerCase();
533
- }
529
+ /^([A-Z])|[\s-_]+(\w)/g,
530
+ function (match, p1, p2, offset) {
531
+ if (p2) return p2.toUpperCase();
532
+ return p1.toLowerCase();
533
+ }
534
534
  );
535
535
  };
536
536
 
537
537
  Util.decamelize = function (str = "", separator = "_") {
538
538
  return str
539
- .replace(/([a-z\d])([A-Z])/g, "$1" + separator + "$2")
540
- .replace(/([A-Z]+)([A-Z][a-z\d]+)/g, "$1" + separator + "$2")
541
- .replace("_", separator)
542
- .toLowerCase();
539
+ .replace(/([a-z\d])([A-Z])/g, "$1" + separator + "$2")
540
+ .replace(/([A-Z]+)([A-Z][a-z\d]+)/g, "$1" + separator + "$2")
541
+ .replace("_", separator)
542
+ .toLowerCase();
543
543
  };
544
544
 
545
545
  /*
@@ -582,9 +582,9 @@ Util.fieldToName = function (str = "") {
582
582
 
583
583
  Util.capitalizeWord = (string = "") => {
584
584
  return string
585
- .split(" ")
586
- .map((m) => m[0].toUpperCase() + m.substr(1))
587
- .join(" ");
585
+ .split(" ")
586
+ .map((m) => m[0].toUpperCase() + m.substr(1))
587
+ .join(" ");
588
588
  };
589
589
 
590
590
  Util.capitalizeFirstLetter = (string = "") => {
@@ -648,7 +648,7 @@ Util.gridSearch = function (visibles, relations, name, value) {
648
648
  }
649
649
  }
650
650
  return (
651
- "searchValue.eq(" + index + ').find("' + elm + '").val("' + value + '");'
651
+ "searchValue.eq(" + index + ').find("' + elm + '").val("' + value + '");'
652
652
  );
653
653
  };
654
654
 
@@ -664,8 +664,8 @@ Util.formatNumber = function (num, thousandSeparator = ".") {
664
664
  const parts = strValue.split(",");
665
665
  // Format integer part with thousand separators
666
666
  const integerPart = parts[0].replace(
667
- /\B(?=(\d{3})+(?!\d))/g,
668
- thousandSeparator
667
+ /\B(?=(\d{3})+(?!\d))/g,
668
+ thousandSeparator
669
669
  );
670
670
  // If there's a decimal part, add it back
671
671
  if (parts.length > 1) {
@@ -749,8 +749,8 @@ Util.fileView = function (dir = "", file = "", attributes = {}) {
749
749
  let withIcon = attributes.hasOwnProperty("withIcon") ? true : false;
750
750
  let obj = Util.fileExtension(filename);
751
751
  let className = attributes.hasOwnProperty("class")
752
- ? ` class="${attributes.class}" `
753
- : "";
752
+ ? ` class="${attributes.class}" `
753
+ : "";
754
754
  if (filename.includes("https")) {
755
755
  html = `<img src="${file}" ${className} class="img-responsive">`;
756
756
  } else {
@@ -760,14 +760,10 @@ Util.fileView = function (dir = "", file = "", attributes = {}) {
760
760
  if (file) {
761
761
  if (withIcon) {
762
762
  html = `<img class="mb-3 boxy-small" src="/img/${
763
- obj.file
764
- }" height="45px" width="45px"><a class="text-success" target="_blank" href="${filename}"> ${file.substring(
765
- 13
766
- )}</a>`;
763
+ obj.file
764
+ }" height="45px" width="45px"><a class="text-success" target="_blank" href="${filename}"> ${file.replace(/^[^_]+_/,'')}</a>`;
767
765
  } else {
768
- html = `<a class="text-success" target="_blank" href="${filename}"> ${file.substring(
769
- 13
770
- )}</a>`;
766
+ html = `<a class="text-success" target="_blank" href="${filename}"> ${file.replace(/^[^_]+_/,'')}</a>`;
771
767
  }
772
768
  }
773
769
  }
@@ -792,9 +788,9 @@ Util.arrayToList = function (arr, array, delimiter, isCount) {
792
788
  if (arr) {
793
789
  for (var i = 0; i < arr.length; i++) {
794
790
  html +=
795
- isCount == 1
796
- ? i + 1 + ". " + array[arr[i]] + delimiter
797
- : " " + array[arr[i]] + delimiter;
791
+ isCount == 1
792
+ ? i + 1 + ". " + array[arr[i]] + delimiter
793
+ : " " + array[arr[i]] + delimiter;
798
794
  }
799
795
  html = html.slice(0, delimiter.length * -1);
800
796
  }
@@ -817,14 +813,14 @@ Util.dropdownHelper = function (data, field, model) {
817
813
  let fieldsx = field + "[]";
818
814
  let name = field + "[]";
819
815
  let myvalue =
820
- typeof data[fieldsx] == undefined
821
- ? " "
822
- : typeof data[fieldsx] == "string"
823
- ? '["' + data[fieldsx] + '"]'
824
- : JSON.stringify(data[name]);
816
+ typeof data[fieldsx] == undefined
817
+ ? " "
818
+ : typeof data[fieldsx] == "string"
819
+ ? '["' + data[fieldsx] + '"]'
820
+ : JSON.stringify(data[name]);
825
821
  if (myvalue) {
826
822
  let unique =
827
- myvalue.indexOf("[") > -1 ? myvalue : !myvalue ? "" : "[" + myvalue + "]";
823
+ myvalue.indexOf("[") > -1 ? myvalue : !myvalue ? "" : "[" + myvalue + "]";
828
824
  unique = JSON.parse(unique);
829
825
  data[field] = JSON.stringify(unique.filter(Util.arrayUnique));
830
826
  delete data[name];
@@ -840,14 +836,14 @@ Util.dropdownHelper = function (data, field, model) {
840
836
  Util.dropdownAdd = function (data, field, model, datas) {
841
837
  let name = field + "[]";
842
838
  let myvalue =
843
- typeof datas == undefined
844
- ? " "
845
- : typeof datas == "string"
846
- ? '["' + datas + '"]'
847
- : JSON.stringify(datas);
839
+ typeof datas == undefined
840
+ ? " "
841
+ : typeof datas == "string"
842
+ ? '["' + datas + '"]'
843
+ : JSON.stringify(datas);
848
844
  if (myvalue) {
849
845
  let unique =
850
- myvalue.indexOf("[") > -1 ? myvalue : !myvalue ? "" : "[" + myvalue + "]";
846
+ myvalue.indexOf("[") > -1 ? myvalue : !myvalue ? "" : "[" + myvalue + "]";
851
847
  unique = JSON.parse(unique);
852
848
  myvalue = JSON.stringify(unique.filter(Util.arrayUnique));
853
849
  delete data[name];
@@ -946,7 +942,7 @@ Util.arrayToConcat = function (arr = []) {
946
942
  Util.arraySequence = function (arr = [], left = [], right = []) {
947
943
  let obj = Util.arrayToObject(arr, "Field");
948
944
  let temp = [],
949
- stores = [];
945
+ stores = [];
950
946
  for (let i = 0; i < arr.length; i++) {
951
947
  if (arr[i].Field == "id") {
952
948
  stores.push(arr[i].Field);
@@ -998,10 +994,10 @@ Util.arraySequence = function (arr = [], left = [], right = []) {
998
994
 
999
995
  Util.isInteger = (value) => {
1000
996
  return (
1001
- !isNaN(value) &&
1002
- (function (x) {
1003
- return (x | 0) === x;
1004
- })(parseFloat(value))
997
+ !isNaN(value) &&
998
+ (function (x) {
999
+ return (x | 0) === x;
1000
+ })(parseFloat(value))
1005
1001
  );
1006
1002
  };
1007
1003
 
@@ -1078,8 +1074,8 @@ Util.regexPassword = (lengthMin, lengthMax) => {
1078
1074
  lengthMax = lengthMax || 20;
1079
1075
 
1080
1076
  return new RegExp(
1081
- "^[a-zA-Z0-9_-]{" + lengthMin + "," + lengthMax + "}$",
1082
- "i"
1077
+ "^[a-zA-Z0-9_-]{" + lengthMin + "," + lengthMax + "}$",
1078
+ "i"
1083
1079
  );
1084
1080
  };
1085
1081
 
@@ -1093,10 +1089,10 @@ Util.regexCode = (lengthMin, lengthMax) => {
1093
1089
 
1094
1090
  Util.imageProfile = function (image = "") {
1095
1091
  return image
1096
- ? image.indexOf("http") > -1
1097
- ? image
1098
- : "/uploads/zuser/" + image
1099
- : "/img/user.png";
1092
+ ? image.indexOf("http") > -1
1093
+ ? image
1094
+ : "/uploads/zuser/" + image
1095
+ : "/img/user.png";
1100
1096
  };
1101
1097
 
1102
1098
  /*
@@ -1262,10 +1258,10 @@ Util.array_to_arraypg = (arr = []) => {
1262
1258
 
1263
1259
  Util.userAvatar = (img = "") => {
1264
1260
  return img
1265
- ? img.includes("http")
1266
- ? img
1267
- : `/uploads/user/${img}`
1268
- : `/img/user.png`;
1261
+ ? img.includes("http")
1262
+ ? img
1263
+ : `/uploads/user/${img}`
1264
+ : `/img/user.png`;
1269
1265
  };
1270
1266
 
1271
1267
  /*
@@ -1306,7 +1302,7 @@ Util.selectParser = (fields = [], MYMODEL = {}) => {
1306
1302
  Util.fieldWithTable = (field, MYMODEL, isWhere = false) => {
1307
1303
  let name = "";
1308
1304
  let joinList =
1309
- MYMODEL.joins && MYMODEL.joins.list.length > 0 ? MYMODEL.joins.list : [];
1305
+ MYMODEL.joins && MYMODEL.joins.list.length > 0 ? MYMODEL.joins.list : [];
1310
1306
  if (joinList.length > 0) {
1311
1307
  if (joinList.includes(field)) {
1312
1308
  let split = field.split("___");
@@ -1326,8 +1322,8 @@ Util.fieldWithTable = (field, MYMODEL, isWhere = false) => {
1326
1322
 
1327
1323
  Util.tableWithJoin = (MYMODEL) => {
1328
1324
  return MYMODEL.joins && MYMODEL.joins.list.length > 0
1329
- ? MYMODEL.joins.sql
1330
- : [];
1325
+ ? MYMODEL.joins.sql
1326
+ : [];
1331
1327
  };
1332
1328
 
1333
1329
  Util.selectMysql = (fields = [], relations = {}) => {
@@ -1383,10 +1379,10 @@ Util.sortArray = (arr, key) => {
1383
1379
 
1384
1380
  Util.cleanString = (str = "") => {
1385
1381
  return str
1386
- .replaceAll("(", "")
1387
- .replaceAll(")", "")
1388
- .replaceAll("%", "")
1389
- .replaceAll("-", "");
1382
+ .replaceAll("(", "")
1383
+ .replaceAll(")", "")
1384
+ .replaceAll("%", "")
1385
+ .replaceAll("-", "");
1390
1386
  };
1391
1387
 
1392
1388
  Util.encrypt = (str, key) => {
@@ -1444,17 +1440,17 @@ Util.terbilang = (nilai) => {
1444
1440
  } else if (nilai < 1000000000) {
1445
1441
  bagi = Math.floor(nilai / 1000000);
1446
1442
  penyimpanan =
1447
- Util.terbilang(bagi) + " Juta" + Util.terbilang(nilai % 1000000);
1443
+ Util.terbilang(bagi) + " Juta" + Util.terbilang(nilai % 1000000);
1448
1444
  } else if (nilai < 1000000000000) {
1449
1445
  bagi = Math.floor(nilai / 1000000000);
1450
1446
  penyimpanan =
1451
- Util.terbilang(bagi) + " Miliar" + Util.terbilang(nilai % 1000000000);
1447
+ Util.terbilang(bagi) + " Miliar" + Util.terbilang(nilai % 1000000000);
1452
1448
  } else if (nilai < 1000000000000000) {
1453
1449
  bagi = Math.floor(nilai / 1000000000000);
1454
1450
  penyimpanan =
1455
- Util.terbilang(nilai / 1000000000000) +
1456
- " Triliun" +
1457
- Util.terbilang(nilai % 1000000000000);
1451
+ Util.terbilang(nilai / 1000000000000) +
1452
+ " Triliun" +
1453
+ Util.terbilang(nilai % 1000000000000);
1458
1454
  }
1459
1455
  return penyimpanan;
1460
1456
  };
@@ -1499,12 +1495,12 @@ Util.tableShowInGrid = (arr, qey, MYMODEL, myCache, companyId) => {
1499
1495
  value = value ? mywidget[key].fields[value] : "";
1500
1496
  } else if (mywidget[key].name == "relation") {
1501
1497
  value = value
1502
- ? Util.array_id_to_zname(
1503
- myCache.get(
1504
- `${mywidget[key].table}_${MYMODEL.widgets[qey].table}___${key}_${companyId}`
1505
- )
1498
+ ? Util.array_id_to_zname(
1499
+ myCache.get(
1500
+ `${mywidget[key].table}_${MYMODEL.widgets[qey].table}___${key}_${companyId}`
1501
+ )
1506
1502
  )[value]
1507
- : "";
1503
+ : "";
1508
1504
  } else {
1509
1505
  if (Util.isNumeric(value)) {
1510
1506
  value = Util.formatNumber(value, ".");
package/lib/zRoute.js CHANGED
@@ -1447,7 +1447,7 @@ zRoute.resetPassword = async (req, res) => {
1447
1447
  zRoute.loginAuth = async (username, fields) => {
1448
1448
  let results = await connection.results({
1449
1449
  table: "zuser",
1450
- where: { username: username },
1450
+ where: { email: username },
1451
1451
  });
1452
1452
  if (results.length) {
1453
1453
  await connection.update({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zet-lib",
3
- "version": "1.5.19",
3
+ "version": "1.5.21",
4
4
  "description": "zet is a library that part of zet generator.",
5
5
  "engines": {
6
6
  "node": ">=18"