zet-lib 1.0.8 → 1.0.10
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/moduleLib.js +12 -11
- package/lib/zMenuRouter.js +2 -15
- package/package.json +1 -1
package/lib/moduleLib.js
CHANGED
|
@@ -22,7 +22,7 @@ m.ide = function (req,res,elem) {
|
|
|
22
22
|
let head = ``;
|
|
23
23
|
let end = ``;
|
|
24
24
|
elem = elem || "#ide_editor";
|
|
25
|
-
|
|
25
|
+
end += `<script> var editor_${elem} = ace.edit("${elem}");
|
|
26
26
|
editor_${elem}.getSession().setMode("ace/mode/ejs");
|
|
27
27
|
</script> ${Util.newLine}`;
|
|
28
28
|
return {
|
|
@@ -50,8 +50,8 @@ m.datepicker = function (req, res, elem) {
|
|
|
50
50
|
let head = ``;
|
|
51
51
|
let end = ``;
|
|
52
52
|
elem = elem || ".datepicker";
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
/* head += '<link href="/css/bootstrap-datepicker.css" rel="stylesheet">';
|
|
54
|
+
end += '<script src="/js/bootstrap-datepicker.min.js"></script>';*/
|
|
55
55
|
head += '<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/css/bootstrap-datepicker.min.css" rel="stylesheet">';
|
|
56
56
|
end += '<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/js/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");});`;
|
|
@@ -69,12 +69,12 @@ m.datetimepicker = function (req, res, elem) {
|
|
|
69
69
|
let head = ``;
|
|
70
70
|
let end = ``;
|
|
71
71
|
elem = elem || ".datetimepicker";
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
head += '<link href="/css/bootstrap-datetimepicker.min.css" rel="stylesheet" />';
|
|
73
|
+
end += '<script type="text/javascript" src="/js/moment-with-locales.min.js" ></script>';
|
|
74
|
+
end += '<script type="text/javascript" src="/js/bootstrap-datetimepicker.min.js" ></script>';
|
|
75
|
+
script += `$(function () { $("${elem}").datetimepicker({format:'YYYY-MM-DD hh:mm:ss'}); });`;
|
|
76
|
+
script += `setTimeout(function () { $("body").click();},1000);`;
|
|
77
|
+
script += `$("body").on("click", function(){$("${elem}").datetimepicker({format:'YYYY-MM-DD hh:mm:ss'});});`;
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
return {
|
|
@@ -171,6 +171,7 @@ m.editor = (req, res, elem = "") => {
|
|
|
171
171
|
let head = ``;
|
|
172
172
|
let end = ``;
|
|
173
173
|
|
|
174
|
+
head += '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.4.2/css/all.min.css" integrity="sha512-NicFTMUg/LwBeG8C7VG+gC4YiiRtQACl98QdkmfsLy37RzXdkaUAuPyVMND0olPP4Jn8M/ctesGSB2pgUBDRIw==" crossorigin="anonymous" referrerpolicy="no-referrer" />';
|
|
174
175
|
head += '<link href="https://cdn.jsdelivr.net/npm/froala-editor@2.9.0/css/froala_editor.pkgd.min.css" rel="stylesheet" type="text/css" />';
|
|
175
176
|
head += '<link href="https://cdn.jsdelivr.net/npm/froala-editor@2.9.0/css/froala_style.min.css" rel="stylesheet" type="text/css" />';
|
|
176
177
|
end += '<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/froala-editor@2.9.0/js/froala_editor.pkgd.min.js"></script>';
|
|
@@ -273,8 +274,8 @@ m.typeahead = (req, res, elem, data) => {
|
|
|
273
274
|
let element = elem.replace("Typeahead", "");
|
|
274
275
|
|
|
275
276
|
script += 'const ' + elemData + 'Data = ' + JSON.stringify(data.filter(function (value, index, arr) {
|
|
276
|
-
|
|
277
|
-
|
|
277
|
+
return index > 0;
|
|
278
|
+
})) + ';' + newLine;
|
|
278
279
|
script += `$("body").on("change", "${elem}", function(){
|
|
279
280
|
var current = $("${elem}").typeahead("getActive");
|
|
280
281
|
if(current){
|
package/lib/zMenuRouter.js
CHANGED
|
@@ -10,6 +10,7 @@ const zRole = require('./zRole');
|
|
|
10
10
|
const zCache = require('./zCache');
|
|
11
11
|
const moduleLib = require('./moduleLib');
|
|
12
12
|
const config = require('dotenv').config();
|
|
13
|
+
const ejs = require('ejs');
|
|
13
14
|
|
|
14
15
|
/*
|
|
15
16
|
icons list for tabler and set to /public/js
|
|
@@ -20,16 +21,6 @@ const iconList = () => {
|
|
|
20
21
|
return icons;
|
|
21
22
|
};
|
|
22
23
|
|
|
23
|
-
const writeCss = () => {
|
|
24
|
-
const icons = iconList();
|
|
25
|
-
let text = '';
|
|
26
|
-
icons.forEach(function (icon) {
|
|
27
|
-
let item = icon.replace('.svg','');
|
|
28
|
-
text += `.tabler-${item}{background-image:url(/assets/icons/${item}.svg);display: inline-block;height: 24px;width: 24px;line-height : 1;filter: invert(100%) sepia(100%) saturate(2%) hue-rotate(94deg) brightness(102%) contrast(100%);}${Util.newLine}`;
|
|
29
|
-
});
|
|
30
|
-
fs.writeFileSync(`${dirRoot}/public/css/tabler.css`, text);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
24
|
router.get('/', async function (req, res, next) {
|
|
34
25
|
const levels = zRole.myLevel(req, res, 'zmenu');
|
|
35
26
|
if(Object.prototype.hasOwnProperty.call(levels,'index')) {
|
|
@@ -37,7 +28,6 @@ router.get('/', async function (req, res, next) {
|
|
|
37
28
|
return res.redirect(process.env.APP_AFTER_LOGIN);
|
|
38
29
|
}
|
|
39
30
|
}
|
|
40
|
-
//writeCss();
|
|
41
31
|
let name = "Standart";
|
|
42
32
|
let arr = [{"text":"Home","href":"zdashboard","icon":"fas fa-home","target":"_self","title":""}];
|
|
43
33
|
let hasAccessMenu = false;
|
|
@@ -106,13 +96,10 @@ router.get('/', async function (req, res, next) {
|
|
|
106
96
|
id: id,
|
|
107
97
|
refresh: refresh,
|
|
108
98
|
menuApp: "Menu Generator",
|
|
109
|
-
/*renderHead: "zmenu/indexcss.ejs",
|
|
110
|
-
renderBody: "zmenu/index.ejs",
|
|
111
|
-
renderEnd: "zmenu/indexjs.ejs"*/
|
|
112
99
|
}
|
|
113
100
|
const bodyHTML = ejs.render(body,datas);
|
|
114
101
|
const endBody = ejs.render(js, datas);
|
|
115
|
-
const headBody = ejs.render(css
|
|
102
|
+
const headBody = ejs.render(css);
|
|
116
103
|
datas.bodyHTML = bodyHTML;
|
|
117
104
|
moduleLib.addModule(req,res,headBody,true);
|
|
118
105
|
moduleLib.addModule(req,res,endBody);
|