zet-lib 1.3.34 → 1.3.35
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 +24 -0
- package/lib/zRoute.js +13 -3
- package/package.json +1 -1
package/lib/moduleLib.js
CHANGED
|
@@ -63,6 +63,30 @@ m.datepicker = function (req, res, elem) {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
//module for selectize
|
|
67
|
+
//https://selectize.dev
|
|
68
|
+
//https://github.com/selectize/selectize.js
|
|
69
|
+
m.selectize = function (req, res, elem) {
|
|
70
|
+
let script = ''
|
|
71
|
+
let head = ``
|
|
72
|
+
let end = ``
|
|
73
|
+
elem = elem || '.selectize'
|
|
74
|
+
head += '<link href="/modules/selectizejs/css/selectize.bootstrap5.css" rel="stylesheet">'
|
|
75
|
+
end += '<script src="/modules/selectizejs/js/selectize.min.js"></script>'
|
|
76
|
+
|
|
77
|
+
script += `$(() => {
|
|
78
|
+
$('${elem}').selectize({
|
|
79
|
+
sortField: 'text'
|
|
80
|
+
});
|
|
81
|
+
});`
|
|
82
|
+
|
|
83
|
+
return {
|
|
84
|
+
head: head,
|
|
85
|
+
end: end,
|
|
86
|
+
script: script,
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
66
90
|
//module for dropzone
|
|
67
91
|
m.dropzone = function (req, res, elem) {
|
|
68
92
|
let script = ''
|
package/lib/zRoute.js
CHANGED
|
@@ -3370,6 +3370,7 @@ zRoute.generateJS = (req, res, MYMODEL, relations, zForms = '', data = {}) => {
|
|
|
3370
3370
|
let mapKey = ''
|
|
3371
3371
|
let hasAttributes = []
|
|
3372
3372
|
let joinsFields = []
|
|
3373
|
+
let selectize = []
|
|
3373
3374
|
if (MYMODEL.joins) {
|
|
3374
3375
|
joinsFields = MYMODEL.joins.list
|
|
3375
3376
|
}
|
|
@@ -3439,6 +3440,10 @@ zRoute.generateJS = (req, res, MYMODEL, relations, zForms = '', data = {}) => {
|
|
|
3439
3440
|
if (widgets[key].isAttributes) {
|
|
3440
3441
|
hasAttributes.push(key)
|
|
3441
3442
|
}
|
|
3443
|
+
//add search on select
|
|
3444
|
+
if (widgets[key].isSearch) {
|
|
3445
|
+
selectize.push(key)
|
|
3446
|
+
}
|
|
3442
3447
|
}
|
|
3443
3448
|
}
|
|
3444
3449
|
}
|
|
@@ -3478,9 +3483,14 @@ zRoute.generateJS = (req, res, MYMODEL, relations, zForms = '', data = {}) => {
|
|
|
3478
3483
|
headObj.datetimepicker = datetimepickerObj.head
|
|
3479
3484
|
endObj.datetimepicker = datetimepickerObj.end
|
|
3480
3485
|
}
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3486
|
+
if (selectize.length > 0) {
|
|
3487
|
+
selectize.map((item) => {
|
|
3488
|
+
let selectizeObj = moduleLib.selectize(req, res, `#${item}`)
|
|
3489
|
+
scriptForm += selectizeObj.script
|
|
3490
|
+
headObj.selectize = selectizeObj.head
|
|
3491
|
+
endObj.selectize = selectizeObj.end
|
|
3492
|
+
})
|
|
3493
|
+
}
|
|
3484
3494
|
if (hasIde) {
|
|
3485
3495
|
let ideCDNObj = moduleLib.ideCDN(req, res)
|
|
3486
3496
|
//scriptForm += ideCDNObj.script;
|