zet-lib 1.2.41 → 1.2.44
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/Util.js +7 -0
- package/lib/moduleLib.js +10 -10
- package/lib/zRoute.js +3 -0
- package/lib/zdataTable.js +1 -1
- package/package.json +1 -1
package/lib/Util.js
CHANGED
|
@@ -654,6 +654,13 @@ Util.formatNumber = function (num, thousandSeparator = '.') {
|
|
|
654
654
|
}
|
|
655
655
|
}
|
|
656
656
|
|
|
657
|
+
//usage Util.round(12345.6789, 2) // 12345.68
|
|
658
|
+
Util.round = (value, precision = 0) => {
|
|
659
|
+
value = +value || 0
|
|
660
|
+
var multiplier = Math.pow(10, precision)
|
|
661
|
+
return Math.round(value * multiplier) / multiplier
|
|
662
|
+
}
|
|
663
|
+
|
|
657
664
|
Util.fileAttribute = function (filename = '') {
|
|
658
665
|
filename = filename.toLowerCase() || ''
|
|
659
666
|
let ext = filename.split('.').pop()
|
package/lib/moduleLib.js
CHANGED
|
@@ -8,7 +8,7 @@ m.ideCDN = function (req, res) {
|
|
|
8
8
|
let script = ''
|
|
9
9
|
let head = ``
|
|
10
10
|
let end = ``
|
|
11
|
-
end += `<script src="
|
|
11
|
+
end += `<script src="/modules/ace.js"></script>${Util.newLine}`
|
|
12
12
|
|
|
13
13
|
return {
|
|
14
14
|
head: head,
|
|
@@ -37,7 +37,7 @@ m.tags = function (req, res, elem) {
|
|
|
37
37
|
let head = ``
|
|
38
38
|
let end = ``
|
|
39
39
|
elem = elem || '.tags'
|
|
40
|
-
end += `<script type="module">import Tags from "
|
|
40
|
+
end += `<script type="module">import Tags from "/modules/tags.js";Tags.init("${elem}");</script>`
|
|
41
41
|
return {
|
|
42
42
|
head: head,
|
|
43
43
|
end: end,
|
|
@@ -52,8 +52,8 @@ m.datepicker = function (req, res, elem) {
|
|
|
52
52
|
elem = elem || '.datepicker'
|
|
53
53
|
/* head += '<link href="/css/bootstrap-datepicker.css" rel="stylesheet">';
|
|
54
54
|
end += '<script src="/js/bootstrap-datepicker.min.js"></script>';*/
|
|
55
|
-
head += '<link href="
|
|
56
|
-
end += '<script src="
|
|
55
|
+
head += '<link href="/modules/bootstrap-datepicker/bootstrap-datepicker.min.css" rel="stylesheet">'
|
|
56
|
+
end += '<script src="/modules/bootstrap-datepicker/bootstrap-datepicker.min.js"></script>'
|
|
57
57
|
script = `$.fn.datepicker.defaults.format = "yyyy-mm-dd";$.fn.datepicker.defaults.todayHighlight = true;$("body").on("click", "${elem}", function(){$(this).datepicker();$(this).datepicker("show");});`
|
|
58
58
|
|
|
59
59
|
return {
|
|
@@ -184,8 +184,8 @@ m.switch = function (req, res, elem, array) {
|
|
|
184
184
|
let head = ``
|
|
185
185
|
let end = ``
|
|
186
186
|
|
|
187
|
-
head += '<link href="
|
|
188
|
-
end += '<script type="text/javascript" src="
|
|
187
|
+
head += '<link href="/modules/bootstrap-switch/bootstrap-switch.css" rel="stylesheet" type="text/css" />' + newLine
|
|
188
|
+
end += '<script type="text/javascript" src="/modules/bootstrap-switch/bootstrap-switch.js"></script>' + newLine
|
|
189
189
|
|
|
190
190
|
let labels = ''
|
|
191
191
|
if (Array.isArray(array)) {
|
|
@@ -225,8 +225,8 @@ m.clockpicker = function (req, res, elem) {
|
|
|
225
225
|
let head = ``
|
|
226
226
|
let end = ``
|
|
227
227
|
elem = elem || '.clockpicker'
|
|
228
|
-
head += '<link href="
|
|
229
|
-
end += '<script type="text/javascript" src="
|
|
228
|
+
head += '<link href="/modules/jquery-clockpicker.min.css" rel="stylesheet" type="text/css" />' + newLine
|
|
229
|
+
end += '<script type="text/javascript" src="/modules/bootstrap-clockpicker.min.js"></script>' + newLine
|
|
230
230
|
script += `$("body").on("click", "${elem}", function(){$(this).clockpicker({donetext: "Done"});});`
|
|
231
231
|
//end += '$("' + elem + '").clockpicker({donetext: "Done"});' + newLine;
|
|
232
232
|
return {
|
|
@@ -448,8 +448,8 @@ m.highlight = (req, res, elem) => {
|
|
|
448
448
|
let head = res.locals.moduleHead
|
|
449
449
|
let end = res.locals.moduleEnd
|
|
450
450
|
if (head.indexOf('highlight') < 0) {
|
|
451
|
-
head += '<link rel="stylesheet" href="
|
|
452
|
-
end += '<script src="
|
|
451
|
+
head += '<link rel="stylesheet" href="/modules/highlight/styles/default.min.css"> ' + newLine
|
|
452
|
+
end += '<script src="/modules/highlight/highlight.min.js"></script>' + newLine
|
|
453
453
|
}
|
|
454
454
|
end += '<script>$(function(){ document.querySelectorAll("' + elem + '").forEach((block) => {hljs.highlightBlock(block);}); })</script>' + newLine
|
|
455
455
|
res.locals.moduleHead = head
|
package/lib/zRoute.js
CHANGED
|
@@ -2549,6 +2549,9 @@ zRoute.viewForm = (req, res, MYMODEL, relations, data = {}) => {
|
|
|
2549
2549
|
obj[key].type = 'text'
|
|
2550
2550
|
obj[key].value = data[key] || ''
|
|
2551
2551
|
break
|
|
2552
|
+
case 'number':
|
|
2553
|
+
obj[key].value = data[key] ? Util.formatNumber(data[key], ',') : ''
|
|
2554
|
+
break
|
|
2552
2555
|
case 'typeahead':
|
|
2553
2556
|
obj[key].type = 'text'
|
|
2554
2557
|
obj[key].value = relations[key + 'Object'][data[key]] || ''
|
package/lib/zdataTable.js
CHANGED
|
@@ -8,7 +8,7 @@ class dataTable {
|
|
|
8
8
|
this.visibles = visibles //array object
|
|
9
9
|
this.setColumns = ''
|
|
10
10
|
this.setTable = ''
|
|
11
|
-
this.srcScript = '
|
|
11
|
+
this.srcScript = '/modules/datatables.min.js'
|
|
12
12
|
this.dataTableScript = '/js/datatable-grids.js'
|
|
13
13
|
this.dataTableButtons = '/js/datatable-buttons.min.js'
|
|
14
14
|
this.customButtons = ''
|