zet-lib 1.5.9 → 1.5.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/Util.js +6 -0
- package/lib/zRoute.js +0 -6118
- package/package.json +1 -1
package/lib/Util.js
CHANGED
|
@@ -1238,16 +1238,22 @@ Util.userAvatar = (img = "") => {
|
|
|
1238
1238
|
Util.selectParser = (fields = [], MYMODEL = {}) => {
|
|
1239
1239
|
let table = MYMODEL.table;
|
|
1240
1240
|
let virtuals = [];
|
|
1241
|
+
let typeaheads = [];
|
|
1241
1242
|
let select = "";
|
|
1242
1243
|
for (var key in MYMODEL.widgets) {
|
|
1243
1244
|
if (MYMODEL.widgets[key].name === "virtual") {
|
|
1244
1245
|
virtuals.push(key);
|
|
1245
1246
|
}
|
|
1247
|
+
if (MYMODEL.widgets[key].name === "typeahead") {
|
|
1248
|
+
typeaheads.push(key);
|
|
1249
|
+
}
|
|
1246
1250
|
}
|
|
1247
1251
|
let arr = [];
|
|
1248
1252
|
fields.forEach((item) => {
|
|
1249
1253
|
if (virtuals.includes(item)) {
|
|
1250
1254
|
select += `${MYMODEL.widgets[item].fields},`;
|
|
1255
|
+
} else if (typeaheads.includes(item)) {
|
|
1256
|
+
select += `(select ${MYMODEL.widgets[item].fields[1]} from ${MYMODEL.widgets[item].table} WHERE ${MYMODEL.widgets[item].table}.id = ${MYMODEL.table}.${item} LIMIT 1 ) as ${item},`;
|
|
1251
1257
|
} else if (item === "no") {
|
|
1252
1258
|
arr.push(`${table}.id`);
|
|
1253
1259
|
} else if (item === "actionColumn") {
|