zet-lib 1.0.34 → 1.0.36
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/views/generatorjs.ejs +1 -0
- package/lib/zdataTable.js +112 -105
- package/package.json +1 -1
|
@@ -328,6 +328,7 @@
|
|
|
328
328
|
}
|
|
329
329
|
$("#tabs").append("<div class='divtabs'> " + counter + ". " + tabname.val() + " <input type='hidden' name='tabs[]' value='" + tabname.val() + "' /> <button type='button' onclick='$(this).parent().remove();' class='trashtab'><i class='fas fa-trash'></i> </button></div><br>");
|
|
330
330
|
tabname.val("");
|
|
331
|
+
$("#savetab").click();
|
|
331
332
|
counter++;
|
|
332
333
|
});
|
|
333
334
|
|
package/lib/zdataTable.js
CHANGED
|
@@ -1,137 +1,144 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Created by sintret dev on 1/6/2022.
|
|
3
3
|
*/
|
|
4
|
-
const Util = require(
|
|
4
|
+
const Util = require('./Util')
|
|
5
5
|
|
|
6
6
|
class dataTable {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
constructor(visibles) {
|
|
8
|
+
this.visibles = visibles //array object
|
|
9
|
+
this.setColumns = ''
|
|
10
|
+
this.setTable = ''
|
|
11
|
+
this.srcScript = 'https://cdn.datatables.net/v/bs5/dt-1.11.3/date-1.1.1/fc-4.0.1/fh-3.2.1/r-2.2.9/rg-1.1.4/sc-2.0.5/sl-1.3.4/datatables.min.js'
|
|
12
|
+
this.dataTableScript = '/js/datatable-default.js';
|
|
13
|
+
this.dataTableButtons = '/js/datatable-buttons.js';
|
|
14
|
+
this.customButtons = '';
|
|
15
|
+
this.MYMODEL = null
|
|
16
|
+
this.searchColumns = {}
|
|
17
|
+
this.relations;
|
|
18
|
+
this.routeName;
|
|
19
|
+
this.types = {}
|
|
20
|
+
this.levels = {}
|
|
21
|
+
}
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
// for filter html
|
|
24
|
+
set filterMODEL(obj) {
|
|
25
|
+
this.MYMODEL = obj.MYMODEL
|
|
26
|
+
this.relations = obj.relations
|
|
27
|
+
this.routeName = this.MYMODEL.routeName
|
|
28
|
+
this.types = obj.TYPES
|
|
29
|
+
delete obj.MYMODEL
|
|
30
|
+
delete obj.relations
|
|
31
|
+
delete obj.TYPES
|
|
32
|
+
this.searchColumns = obj
|
|
33
|
+
}
|
|
30
34
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
return html;
|
|
35
|
+
get columns() {
|
|
36
|
+
if (this.setColumns)
|
|
37
|
+
return this.setColumns
|
|
38
|
+
let html = ''
|
|
39
|
+
for (const key in this.visibles) {
|
|
40
|
+
html += `<th id="data_${key}_label">${this.visibles[key]}</th>`
|
|
39
41
|
}
|
|
42
|
+
return html
|
|
43
|
+
}
|
|
40
44
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
html += '</tr>';
|
|
47
|
-
return html;
|
|
45
|
+
get columnsFilter() {
|
|
46
|
+
let html = '<tr class="filters">'
|
|
47
|
+
for (const key in this.visibles) {
|
|
48
|
+
html += `<th id="data_${key}">${this.searchColumns[key]}</th>`
|
|
48
49
|
}
|
|
50
|
+
html += '</tr>'
|
|
51
|
+
return html
|
|
52
|
+
}
|
|
49
53
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
/*
|
|
55
|
+
Create table html header
|
|
56
|
+
*/
|
|
57
|
+
get table() {
|
|
58
|
+
if (this.setTable)
|
|
59
|
+
return this.setTable
|
|
60
|
+
return `<table id="dataTable" class="display table table-hover table-responsive" style="width:100%">
|
|
57
61
|
<thead>${this.columns} ${this.columnsFilter}</thead>
|
|
58
|
-
</table
|
|
59
|
-
|
|
62
|
+
</table>`
|
|
63
|
+
}
|
|
60
64
|
|
|
61
65
|
get buttons() {
|
|
62
|
-
let html = `<div class="dataTables_wrapper dt-bootstrap5 no-footer "><div class="dt-buttons btn-group flex-wrap"
|
|
66
|
+
let html = `<div class="dataTables_wrapper dt-bootstrap5 no-footer "><div class="dt-buttons btn-group flex-wrap">`
|
|
63
67
|
if (this.levels.create) {
|
|
64
|
-
html += `<button title="${LANGUAGE.create_info}" class="btn create gridadd boxy-small dimens2x" tabindex="0" aria-controls="DataTables_Table_0" type="button"><
|
|
68
|
+
html += `<button title="${LANGUAGE.create_info}" class="btn create gridadd image-button boxy-small dimens2x" tabindex="0" aria-controls="DataTables_Table_0" type="button"><img src="/assets/icons/plus.svg" class="icons-bg-black"> ${LANGUAGE.create}</button>`
|
|
65
69
|
}
|
|
66
70
|
if (this.levels.import) {
|
|
67
|
-
html += `<button title="${LANGUAGE.import_info}" class="btn buttons-copy buttons-html5 copy gridimport boxy-small dimens2x" tabindex="0" aria-controls="DataTables_Table_0" type="button"><
|
|
71
|
+
html += `<button title="${LANGUAGE.import_info}" class="btn buttons-copy buttons-html5 copy gridimport boxy-small dimens2x image-button" tabindex="0" aria-controls="DataTables_Table_0" type="button"><img src="/assets/icons/database-import.svg" class="icons-bg-black"> ${LANGUAGE.import}</span></span></button>`
|
|
68
72
|
}
|
|
69
|
-
html += `<button title="${LANGUAGE.
|
|
70
|
-
html += `<button class="btn refresh gridreload boxy-small dimens2x" title="${LANGUAGE.grid_refresh}" tabindex="0" aria-controls="DataTables_Table_0" type="button"><
|
|
73
|
+
html += `<button title="${LANGUAGE.settings}" class="btn buttons-excel buttons-html5 setting gridsettings boxy-small dimens2x image-button" tabindex="0" aria-controls="DataTables_Table_0" type="button" data-bs-toggle="modal" data-bs-target="#grid-modal"><img src="/assets/icons/settings.svg" class="icons-bg-black"> ${LANGUAGE.settings}</button>`
|
|
74
|
+
html += `<button class="btn refresh gridreload boxy-small dimens2x image-button" title="${LANGUAGE.grid_refresh}" tabindex="0" aria-controls="DataTables_Table_0" type="button"><img src="/assets/icons/refresh.svg" class="icons-bg-black"></button>`
|
|
71
75
|
if (this.levels.export) {
|
|
72
76
|
html += `<div class="btn-group" role="group">
|
|
73
|
-
<button id="dropdownExport" type="button" class="btn dropdown-toggle boxy-small dimens2x" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
|
74
|
-
<
|
|
77
|
+
<button id="dropdownExport" type="button" class="btn dropdown-toggle boxy-small dimens2x image-button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
|
78
|
+
<img src="/assets/icons/download.svg" class="icons-bg-black"> ${LANGUAGE.download}
|
|
75
79
|
</button>
|
|
76
|
-
<div class="dropdown-menu dimens3x" aria-labelledby="dropdownExport"
|
|
77
|
-
html += `<a class="dropdown-header">Excel</a
|
|
78
|
-
html += `<a class="dropdown-item export-search-prety" href="#"><i class="text-success fa fa-file-excel-o"></i>Excel</a
|
|
79
|
-
html += `<a class="dropdown-item export-search-raw" href="#"><i class="text-success fa fa-file-excel-o"></i>Excel (${LANGUAGE.import}) </a
|
|
80
|
-
html += `<a class="dropdown-item export-all-prety" href="#"><i class="text-success fa fa-file-excel-o"></i>Excel (${LANGUAGE.all}) </a
|
|
81
|
-
html += `<hr
|
|
82
|
-
html += `<a class="dropdown-header">PDF</a
|
|
83
|
-
html += `<a class="dropdown-item export-pdf" href="#"><i class="text-success fa fa-file-excel-o"></i>PDF </a
|
|
84
|
-
html += `<a class="dropdown-item export-all-pdf" href="#"><i class="text-success fa fa-file-excel-o"></i>PDF (${LANGUAGE.all}) </a
|
|
85
|
-
html += `</div
|
|
80
|
+
<div class="dropdown-menu dimens3x" aria-labelledby="dropdownExport">`
|
|
81
|
+
html += `<a class="dropdown-header">Excel</a>`
|
|
82
|
+
html += `<a class="dropdown-item export-search-prety" href="#"><i class="text-success fa fa-file-excel-o"></i>Excel</a>`
|
|
83
|
+
html += `<a class="dropdown-item export-search-raw" href="#"><i class="text-success fa fa-file-excel-o"></i>Excel (${LANGUAGE.import}) </a>`
|
|
84
|
+
html += `<a class="dropdown-item export-all-prety" href="#"><i class="text-success fa fa-file-excel-o"></i>Excel (${LANGUAGE.all}) </a>`
|
|
85
|
+
html += `<hr>`
|
|
86
|
+
html += `<a class="dropdown-header">PDF</a>`
|
|
87
|
+
html += `<a class="dropdown-item export-pdf" href="#"><i class="text-success fa fa-file-excel-o"></i>PDF </a>`
|
|
88
|
+
html += `<a class="dropdown-item export-all-pdf" href="#"><i class="text-success fa fa-file-excel-o"></i>PDF (${LANGUAGE.all}) </a>`
|
|
89
|
+
html += `</div>`
|
|
86
90
|
}
|
|
87
|
-
html += `</div></div
|
|
88
|
-
|
|
89
|
-
return html;
|
|
91
|
+
html += `</div></div>`
|
|
92
|
+
return html
|
|
90
93
|
}
|
|
91
94
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
95
|
+
get buttons2() {
|
|
96
|
+
let html = `<div class="dataTables_wrapper dt-bootstrap5 no-footer "><div class="dt-buttons btn-group flex-wrap">`
|
|
97
|
+
if (this.levels.create) {
|
|
98
|
+
html += `<button title="${LANGUAGE.create_info}" class="btn create gridadd image-button boxy-small dimens2x" tabindex="0" aria-controls="DataTables_Table_0" type="button"><img src="/assets/icons/plus.svg" class="icons-bg-black"> ${LANGUAGE.create}</button>`
|
|
99
|
+
}
|
|
100
|
+
if (this.levels.import) {
|
|
101
|
+
html += `<button title="${LANGUAGE.import_info}" class="btn buttons-copy buttons-html5 copy gridimport boxy-small dimens2x image-button" tabindex="0" aria-controls="DataTables_Table_0" type="button"><img src="/assets/icons/database-import.svg" class="icons-bg-black"> ${LANGUAGE.import}</span></span></button>`
|
|
102
|
+
}
|
|
103
|
+
html += `<button title="${LANGUAGE.settings}" class="btn buttons-excel buttons-html5 setting gridsettings boxy-small dimens2x image-button" tabindex="0" aria-controls="DataTables_Table_0" type="button" data-bs-toggle="modal" data-bs-target="#grid-modal"><img src="/assets/icons/settings.svg" class="icons-bg-black"> ${LANGUAGE.settings}</button>`
|
|
104
|
+
html += `<button class="btn refresh gridreload boxy-small dimens2x image-button" title="${LANGUAGE.grid_refresh}" tabindex="0" aria-controls="DataTables_Table_0" type="button"><img src="/assets/icons/refresh.svg" class="icons-bg-black"></button>`
|
|
105
|
+
if (this.levels.export) {
|
|
106
|
+
html += `<div class="btn-group" role="group">
|
|
104
107
|
<button id="dropdownExport" type="button" class="btn dropdown-toggle boxy-small dimens2x image-button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
|
105
108
|
<img src="/assets/icons/download.svg" class="icons-bg-black"> ${LANGUAGE.download}
|
|
106
109
|
</button>
|
|
107
|
-
<div class="dropdown-menu dimens3x" aria-labelledby="dropdownExport"
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
html += `</div></div>`;
|
|
119
|
-
return html;
|
|
110
|
+
<div class="dropdown-menu dimens3x" aria-labelledby="dropdownExport">`
|
|
111
|
+
html += `<a class="dropdown-header">Excel</a>`
|
|
112
|
+
html += `<a class="dropdown-item export-search-prety" href="#"><i class="text-success fa fa-file-excel-o"></i>Excel</a>`
|
|
113
|
+
html += `<a class="dropdown-item export-search-raw" href="#"><i class="text-success fa fa-file-excel-o"></i>Excel (${LANGUAGE.import}) </a>`
|
|
114
|
+
html += `<a class="dropdown-item export-all-prety" href="#"><i class="text-success fa fa-file-excel-o"></i>Excel (${LANGUAGE.all}) </a>`
|
|
115
|
+
html += `<hr>`
|
|
116
|
+
html += `<a class="dropdown-header">PDF</a>`
|
|
117
|
+
html += `<a class="dropdown-item export-pdf" href="#"><i class="text-success fa fa-file-excel-o"></i>PDF </a>`
|
|
118
|
+
html += `<a class="dropdown-item export-all-pdf" href="#"><i class="text-success fa fa-file-excel-o"></i>PDF (${LANGUAGE.all}) </a>`
|
|
119
|
+
html += `</div>`
|
|
120
120
|
}
|
|
121
|
+
html += `</div></div>`
|
|
122
|
+
return html
|
|
123
|
+
}
|
|
121
124
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
return script;
|
|
125
|
+
|
|
126
|
+
get scripts() {
|
|
127
|
+
let script = `<script type="text/javascript" src="${this.srcScript}"></script>`
|
|
128
|
+
script += `<script>${Util.newLine}`
|
|
129
|
+
script += `var dataTableFields = ${JSON.stringify(Object.keys(this.visibles, null, 2))};${Util.newLine}`
|
|
130
|
+
script += `var dataTableTypes = ${JSON.stringify(this.types, null, 2)};${Util.newLine}`
|
|
131
|
+
script += `var dataTableRoute = "${this.routeName}";${Util.newLine}`;
|
|
132
|
+
script += `</script>${Util.newLine}`
|
|
133
|
+
script += `<script type="text/javascript" src="${this.dataTableScript}"></script>${Util.newLine}`
|
|
134
|
+
if (this.searchColumns.FILTERKEY) {
|
|
135
|
+
script += `<script>$(function () { setTimeout(function () { ${this.searchColumns.FILTERKEY} },500) });</script>${Util.newLine}`
|
|
134
136
|
}
|
|
137
|
+
script += `<script type="text/javascript" src="${this.dataTableButtons}"></script>${Util.newLine}`
|
|
138
|
+
|
|
139
|
+
return script
|
|
140
|
+
}
|
|
141
|
+
|
|
135
142
|
}
|
|
136
143
|
|
|
137
|
-
module.exports = dataTable
|
|
144
|
+
module.exports = dataTable
|