zet-lib 3.0.8 → 3.0.9
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 +4 -0
- package/lib/Model.js +142 -1
- package/lib/Util.js +5 -3
- package/lib/generatorApi.js +1328 -1328
- package/lib/generatorModel.js +13 -5
- package/lib/moduleLib.js +57 -57
- package/lib/views/generatorjs.ejs +2 -2
- package/lib/views/zgenerator/routerApp.ejs +359 -359
- package/lib/zRoute.js +66 -1
- package/package.json +1 -1
package/lib/generatorModel.js
CHANGED
|
@@ -453,6 +453,10 @@ me.prepare = (MYMODEL) => {
|
|
|
453
453
|
widgets[key].code = property.values.code || "";
|
|
454
454
|
break;
|
|
455
455
|
|
|
456
|
+
case "money":
|
|
457
|
+
widgets[key].symbol = property.values.symbol || "";
|
|
458
|
+
break;
|
|
459
|
+
|
|
456
460
|
default:
|
|
457
461
|
break;
|
|
458
462
|
}
|
|
@@ -563,16 +567,12 @@ me.build_sql_api = (columns, constraintList, MYMODEL) => {
|
|
|
563
567
|
}
|
|
564
568
|
}
|
|
565
569
|
}
|
|
566
|
-
|
|
567
|
-
//var constraintList = await connection.query(connection.constraintList(MYMODEL.table));
|
|
568
|
-
//make a object instead of array
|
|
569
570
|
const constraintObject = Util.arrayToObject(constraintList, "conname");
|
|
570
|
-
|
|
571
571
|
const alter = [];
|
|
572
572
|
const index = [];
|
|
573
573
|
const defaultValue = [];
|
|
574
574
|
const fk = [];
|
|
575
|
-
const notAlters = ["virtual", "custom"];
|
|
575
|
+
const notAlters = ["virtual", "custom","html"];
|
|
576
576
|
for (const key in properties) {
|
|
577
577
|
const property = properties[key];
|
|
578
578
|
if (!notAlters.includes(property.type)) {
|
|
@@ -602,6 +602,14 @@ me.build_sql_api = (columns, constraintList, MYMODEL) => {
|
|
|
602
602
|
index.push(`DROP INDEX ${idx}; `);
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
|
+
if(property.type == "money"){
|
|
606
|
+
//ALTER TABLE nama_tabel
|
|
607
|
+
// ALTER COLUMN nama_kolom TYPE NUMERIC(15,2);
|
|
608
|
+
let digitDecimal = properties[key].values.digitDecimal || 0;
|
|
609
|
+
alter.push(
|
|
610
|
+
`ALTER TABLE "${MYMODEL.table}" ALTER COLUMN "${key}" TYPE NUMERIC(15,${digitDecimal});; `
|
|
611
|
+
);
|
|
612
|
+
}
|
|
605
613
|
//relations foreign key
|
|
606
614
|
const fkx = `fk_${MYMODEL.table}_${key}`;
|
|
607
615
|
if (sqlObject.foreignKey) {
|
package/lib/moduleLib.js
CHANGED
|
@@ -53,9 +53,9 @@ m.datepicker = function (req, res, elem) {
|
|
|
53
53
|
/* head += '<link href="/css/bootstrap-datepicker.css" rel="stylesheet">';
|
|
54
54
|
end += '<script src="/js/bootstrap-datepicker.min.js"></script>';*/
|
|
55
55
|
head +=
|
|
56
|
-
|
|
56
|
+
'<link href="/modules/bootstrap-datepicker/bootstrap-datepicker.min.css" rel="stylesheet">';
|
|
57
57
|
end +=
|
|
58
|
-
|
|
58
|
+
'<script src="/modules/bootstrap-datepicker/bootstrap-datepicker.min.js"></script>';
|
|
59
59
|
script = `$.fn.datepicker.defaults.format = "yyyy-mm-dd";$.fn.datepicker.defaults.todayHighlight = true;$("body").on("click", "${elem}", function(){$(this).datepicker();$(this).datepicker("show");});`;
|
|
60
60
|
|
|
61
61
|
return {
|
|
@@ -74,7 +74,7 @@ m.selectize = function (req, res, elem) {
|
|
|
74
74
|
let end = ``;
|
|
75
75
|
elem = elem || ".selectize";
|
|
76
76
|
head +=
|
|
77
|
-
|
|
77
|
+
'<link href="/modules/selectizejs/css/selectize.bootstrap5.css" rel="stylesheet">';
|
|
78
78
|
end += '<script src="/modules/selectizejs/js/selectize.min.js"></script>';
|
|
79
79
|
|
|
80
80
|
script += `$(() => {
|
|
@@ -339,11 +339,11 @@ m.datetimepicker = function (req, res, elem) {
|
|
|
339
339
|
let end = ``;
|
|
340
340
|
elem = elem || ".datetimepicker";
|
|
341
341
|
head +=
|
|
342
|
-
|
|
342
|
+
'<link href="/css/bootstrap-datetimepicker.min.css" rel="stylesheet" />';
|
|
343
343
|
end +=
|
|
344
|
-
|
|
344
|
+
'<script type="text/javascript" src="/js/moment-with-locales.min.js" ></script>';
|
|
345
345
|
end +=
|
|
346
|
-
|
|
346
|
+
'<script type="text/javascript" src="/js/bootstrap-datetimepicker.min.js" ></script>';
|
|
347
347
|
script += `$(function () { $("${elem}").datetimepicker({format:'YYYY-MM-DD hh:mm:ss'}); });`;
|
|
348
348
|
script += `setTimeout(function () { $("body").click();},1000);`;
|
|
349
349
|
script += `$("body").on("click", function(){$("${elem}").datetimepicker({format:'YYYY-MM-DD hh:mm:ss'});});`;
|
|
@@ -362,14 +362,14 @@ m.ckeditor = function (req, res, elem) {
|
|
|
362
362
|
let end = ``;
|
|
363
363
|
elem = elem || ".editor";
|
|
364
364
|
end +=
|
|
365
|
-
|
|
366
|
-
|
|
365
|
+
'<script src="/modules/ckeditor5-build-classic/ckeditor.js"></script>' +
|
|
366
|
+
newLine;
|
|
367
367
|
end += "<script>";
|
|
368
368
|
end +=
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
369
|
+
'ClassicEditor.create( document.querySelector( "' +
|
|
370
|
+
elem +
|
|
371
|
+
'" ) ).catch( error => {console.error( error );} );' +
|
|
372
|
+
newLine;
|
|
373
373
|
end += "</script>";
|
|
374
374
|
return {
|
|
375
375
|
head: head,
|
|
@@ -385,8 +385,8 @@ m.tinymce = function (req, res, elem) {
|
|
|
385
385
|
let end = ``;
|
|
386
386
|
elem = elem || ".tinymce";
|
|
387
387
|
end +=
|
|
388
|
-
|
|
389
|
-
|
|
388
|
+
'<script src="https://cdn.tiny.cloud/1/b7054u42l8lw67ch5oh9qutnvbyu8exzryg4edy0gg2snhtr/tinymce/6/tinymce.min.js" referrerpolicy="origin"></script>' +
|
|
389
|
+
newLine;
|
|
390
390
|
script += ` tinymce.init({
|
|
391
391
|
selector: '${elem}',
|
|
392
392
|
plugins: 'anchor autolink charmap codesample emoticons image link lists media searchreplace table visualblocks wordcount',
|
|
@@ -407,11 +407,11 @@ m.froala = function (req, res, elem) {
|
|
|
407
407
|
elem = elem || ".editor";
|
|
408
408
|
|
|
409
409
|
head +=
|
|
410
|
-
|
|
410
|
+
'<link href="https://cdn.jsdelivr.net/npm/froala-editor@2.9.0/css/froala_editor.pkgd.min.css" rel="stylesheet" type="text/css" />';
|
|
411
411
|
head +=
|
|
412
|
-
|
|
412
|
+
'<link href="https://cdn.jsdelivr.net/npm/froala-editor@2.9.0/css/froala_style.min.css" rel="stylesheet" type="text/css" />';
|
|
413
413
|
end +=
|
|
414
|
-
|
|
414
|
+
'<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/froala-editor@2.9.0/js/froala_editor.pkgd.min.js"></script>';
|
|
415
415
|
script += `$(function() {$("${elem}").froalaEditor({height: 200})});`;
|
|
416
416
|
|
|
417
417
|
return {
|
|
@@ -449,13 +449,13 @@ m.editor = (req, res, elem = "") => {
|
|
|
449
449
|
let end = ``;
|
|
450
450
|
|
|
451
451
|
head +=
|
|
452
|
-
|
|
452
|
+
'<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" />';
|
|
453
453
|
head +=
|
|
454
|
-
|
|
454
|
+
'<link href="https://cdn.jsdelivr.net/npm/froala-editor@2.9.0/css/froala_editor.pkgd.min.css" rel="stylesheet" type="text/css" />';
|
|
455
455
|
head +=
|
|
456
|
-
|
|
456
|
+
'<link href="https://cdn.jsdelivr.net/npm/froala-editor@2.9.0/css/froala_style.min.css" rel="stylesheet" type="text/css" />';
|
|
457
457
|
end +=
|
|
458
|
-
|
|
458
|
+
'<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/froala-editor@2.9.0/js/froala_editor.pkgd.min.js"></script>';
|
|
459
459
|
script += `$(function() {$("${elem}").froalaEditor({height: 200})});`;
|
|
460
460
|
|
|
461
461
|
return {
|
|
@@ -472,11 +472,11 @@ m.switch = function (req, res, elem, array) {
|
|
|
472
472
|
let end = ``;
|
|
473
473
|
|
|
474
474
|
head +=
|
|
475
|
-
|
|
476
|
-
|
|
475
|
+
'<link href="/modules/bootstrap-switch/bootstrap-switch.css" rel="stylesheet" type="text/css" />' +
|
|
476
|
+
newLine;
|
|
477
477
|
end +=
|
|
478
|
-
|
|
479
|
-
|
|
478
|
+
'<script type="text/javascript" src="/modules/bootstrap-switch/bootstrap-switch.js"></script>' +
|
|
479
|
+
newLine;
|
|
480
480
|
|
|
481
481
|
let labels = "";
|
|
482
482
|
if (Array.isArray(array)) {
|
|
@@ -496,11 +496,11 @@ m.switchOld = function (req, res, elem, array) {
|
|
|
496
496
|
let end = ``;
|
|
497
497
|
elem = elem || ".switch";
|
|
498
498
|
head +=
|
|
499
|
-
|
|
500
|
-
|
|
499
|
+
'<link href="https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.6.1/css/bootstrap4-toggle.min.css" rel="stylesheet">' +
|
|
500
|
+
newLine;
|
|
501
501
|
end +=
|
|
502
|
-
|
|
503
|
-
|
|
502
|
+
'<script src="https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.6.1/js/bootstrap4-toggle.min.js"></script>' +
|
|
503
|
+
newLine;
|
|
504
504
|
|
|
505
505
|
let labels = "";
|
|
506
506
|
if (Array.isArray(array)) {
|
|
@@ -521,11 +521,11 @@ m.clockpicker = function (req, res, elem) {
|
|
|
521
521
|
let end = ``;
|
|
522
522
|
elem = elem || ".clockpicker";
|
|
523
523
|
head +=
|
|
524
|
-
|
|
525
|
-
|
|
524
|
+
'<link href="/modules/jquery-clockpicker.min.css" rel="stylesheet" type="text/css" />' +
|
|
525
|
+
newLine;
|
|
526
526
|
end +=
|
|
527
|
-
|
|
528
|
-
|
|
527
|
+
'<script type="text/javascript" src="/modules/bootstrap-clockpicker.min.js"></script>' +
|
|
528
|
+
newLine;
|
|
529
529
|
script += `$("body").on("click", "${elem}", function(){$(this).clockpicker({donetext: "Done"});});`;
|
|
530
530
|
//end += '$("' + elem + '").clockpicker({donetext: "Done"});' + newLine;
|
|
531
531
|
return {
|
|
@@ -542,7 +542,7 @@ m.number = (req, res, elem) => {
|
|
|
542
542
|
elem = elem || ".number";
|
|
543
543
|
|
|
544
544
|
end +=
|
|
545
|
-
|
|
545
|
+
'<script type="text/javascript" src="/js/jquery-currency.js"></script>';
|
|
546
546
|
script += `$(function () { $(".number").formatCurrencyLive({symbol:"",roundToDecimalPlace :0,digitGroupSymbol :"."}); });`;
|
|
547
547
|
script += `setTimeout(function () { $("body").click();},1000);`;
|
|
548
548
|
script += `$("body").on("click", function(){$(".number").formatCurrencyLive({symbol:"",roundToDecimalPlace :0,digitGroupSymbol :"."});});`;
|
|
@@ -560,8 +560,8 @@ m.typeahead = (req, res, table, elem) => {
|
|
|
560
560
|
let end = ``;
|
|
561
561
|
elem = elem || ".typeahead";
|
|
562
562
|
end +=
|
|
563
|
-
|
|
564
|
-
|
|
563
|
+
'<script type="text/javascript" src="/modules/typeahead/typeahead.js"></script>' +
|
|
564
|
+
newLine;
|
|
565
565
|
|
|
566
566
|
let elemData = elem.replace(".", "").replace("#", "");
|
|
567
567
|
let element = elem.replace("Typeahead", "");
|
|
@@ -607,8 +607,8 @@ m.typeaheadFile = (req, res, elem, data) => {
|
|
|
607
607
|
data = data || [];
|
|
608
608
|
elem = elem || ".typeahead";
|
|
609
609
|
end +=
|
|
610
|
-
|
|
611
|
-
|
|
610
|
+
'<script type="text/javascript" src="/modules/typeahead/typeahead.js"></script>' +
|
|
611
|
+
newLine;
|
|
612
612
|
|
|
613
613
|
let elemData = elem.replace(".", "");
|
|
614
614
|
elemData = elemData.replace("#", "");
|
|
@@ -661,7 +661,7 @@ m.dropboxview = (req, res) => {
|
|
|
661
661
|
let head = ``;
|
|
662
662
|
let end = ``;
|
|
663
663
|
script +=
|
|
664
|
-
|
|
664
|
+
`let dropbox_image = {}
|
|
665
665
|
$(()=>{
|
|
666
666
|
$(".zdropbox-view").each(function (index, item) {
|
|
667
667
|
let dropboxLength = $(".zdropbox-view").length || 0;
|
|
@@ -729,9 +729,9 @@ m.addScript = (req, res, contentScript, at = "end", type = "script") => {
|
|
|
729
729
|
if (contentScript) {
|
|
730
730
|
let generateId = "app_" + Util.generate(6);
|
|
731
731
|
let tagOpen =
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
732
|
+
type == "script"
|
|
733
|
+
? `<script id="${generateId}">`
|
|
734
|
+
: '<style type="text/css">';
|
|
735
735
|
let tagClose = type == "script" ? "</script>" : "</style>";
|
|
736
736
|
let content = at == "end" ? res.locals.moduleEnd : res.locals.moduleHead;
|
|
737
737
|
content += tagOpen + newLine;
|
|
@@ -746,8 +746,8 @@ m.addScript = (req, res, contentScript, at = "end", type = "script") => {
|
|
|
746
746
|
|
|
747
747
|
m.addModule = (req, res, content, isModuleHead = false) => {
|
|
748
748
|
let moduleContent = isModuleHead
|
|
749
|
-
|
|
750
|
-
|
|
749
|
+
? res.locals.moduleHead
|
|
750
|
+
: res.locals.moduleEnd;
|
|
751
751
|
moduleContent += content;
|
|
752
752
|
if (isModuleHead) {
|
|
753
753
|
res.locals.moduleHead = moduleContent;
|
|
@@ -762,8 +762,8 @@ m.highchart = async (req, res, obj) => {
|
|
|
762
762
|
let end = res.locals.moduleEnd;
|
|
763
763
|
if (end.indexOf("highcharts") < 0) {
|
|
764
764
|
end +=
|
|
765
|
-
|
|
766
|
-
|
|
765
|
+
'<script src="https://code.highcharts.com/highcharts.js"></script>' +
|
|
766
|
+
newLine;
|
|
767
767
|
}
|
|
768
768
|
|
|
769
769
|
if (!Util.isEmptyObject(obj)) {
|
|
@@ -821,16 +821,16 @@ m.highlight = (req, res, elem) => {
|
|
|
821
821
|
let end = res.locals.moduleEnd;
|
|
822
822
|
if (head.indexOf("highlight") < 0) {
|
|
823
823
|
head +=
|
|
824
|
-
|
|
825
|
-
|
|
824
|
+
'<link rel="stylesheet" href="/modules/highlight/default.min.css"> ' +
|
|
825
|
+
newLine;
|
|
826
826
|
end +=
|
|
827
|
-
|
|
827
|
+
'<script src="/modules/highlight/highlight.min.js"></script>' + newLine;
|
|
828
828
|
}
|
|
829
829
|
end +=
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
830
|
+
'<script>$(function(){ document.querySelectorAll("' +
|
|
831
|
+
elem +
|
|
832
|
+
'").forEach((block) => {hljs.highlightBlock(block);}); })</script>' +
|
|
833
|
+
newLine;
|
|
834
834
|
res.locals.moduleHead = head;
|
|
835
835
|
res.locals.moduleEnd = end;
|
|
836
836
|
};
|
|
@@ -842,11 +842,11 @@ m.selectpicker = function (req, res, elem) {
|
|
|
842
842
|
let end = res.locals.moduleEnd;
|
|
843
843
|
if (head.indexOf("bootstrap-select") < 0) {
|
|
844
844
|
head +=
|
|
845
|
-
|
|
846
|
-
|
|
845
|
+
'<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/css/bootstrap-select.min.css">' +
|
|
846
|
+
newLine;
|
|
847
847
|
end +=
|
|
848
|
-
|
|
849
|
-
|
|
848
|
+
'<script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.14/dist/js/bootstrap-select.min.js"></script>' +
|
|
849
|
+
newLine;
|
|
850
850
|
end += `<script>$(function () {$('${elem}').selectpicker();});</script>${newLine}`;
|
|
851
851
|
}
|
|
852
852
|
res.locals.moduleHead = head;
|
|
@@ -139,8 +139,8 @@
|
|
|
139
139
|
dropdownRelations('dropdown_multi_table', 'dropdown_multi_name', '', $('#dropdown_multi_table').data('value'), $('#dropdown_multi_name').data('value'))
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
$("#
|
|
143
|
-
$("#
|
|
142
|
+
$("#money_decimalPlaces").css("font-size","2rem");
|
|
143
|
+
$("#money_thousandSeparator").css("font-size","2rem");
|
|
144
144
|
}
|
|
145
145
|
)
|
|
146
146
|
$('#modal_setting').modal('show')
|