@xuda.io/xuda-dbs-plugin-xuda 1.0.215 → 1.0.216
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/server.js +7 -199
- package/studio.mjs +20 -3
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@xuda.io/xuda-dbs-plugin-xuda",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.216",
|
4
4
|
"description": "Xuda Database Socket for Xuda's proprietary structure powered by CouchDB",
|
5
5
|
"scripts": {
|
6
6
|
"pub": "npm version patch --force && npm publish --access public"
|
package/server.js
CHANGED
@@ -254,20 +254,13 @@ const get_opt = function (e, table_obj) {
|
|
254
254
|
opt.sort = sort;
|
255
255
|
}
|
256
256
|
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
// };
|
265
|
-
// }
|
266
|
-
// }
|
267
|
-
// }
|
268
|
-
|
269
|
-
if (e?.sortModel && JSON.parse(e.sortModel).length) {
|
270
|
-
opt.sort = JSON.parse(e.sortModel);
|
257
|
+
let _sortModel = e?.sortModel || [];
|
258
|
+
if (typeof _sortModel === "string") {
|
259
|
+
_sortModel = JSON.parse(e.sortModel);
|
260
|
+
}
|
261
|
+
|
262
|
+
if (_sortModel.length) {
|
263
|
+
opt.sort = _sortModel;
|
271
264
|
if (opt.sort) {
|
272
265
|
for (const [key, val] of Object.entries(opt.sort)) {
|
273
266
|
var field_name = val.field_id;
|
@@ -278,191 +271,6 @@ const get_opt = function (e, table_obj) {
|
|
278
271
|
}
|
279
272
|
}
|
280
273
|
|
281
|
-
// if (e.filterModel) {
|
282
|
-
// debugger;
|
283
|
-
// for (const [key, val] of Object.entries(e.filterModel)) {
|
284
|
-
// var field_name = key;
|
285
|
-
// var condition = "$and";
|
286
|
-
// const make_selector = function (val) {
|
287
|
-
// var value = "";
|
288
|
-
// var operator = "";
|
289
|
-
// var value_to = "";
|
290
|
-
// var operator_to = "";
|
291
|
-
|
292
|
-
// if (val.filterType === "date") {
|
293
|
-
// var date = val.dateFrom.substr(0, 10);
|
294
|
-
// switch (val.type) {
|
295
|
-
// case "equals":
|
296
|
-
// operator = "$regex";
|
297
|
-
// value = `^${date}`;
|
298
|
-
// break;
|
299
|
-
|
300
|
-
// case "greaterThan":
|
301
|
-
// operator = "$gt";
|
302
|
-
// value = `${date}`;
|
303
|
-
// break;
|
304
|
-
|
305
|
-
// case "lessThan":
|
306
|
-
// operator = "$lt";
|
307
|
-
// value = `${date}`;
|
308
|
-
// break;
|
309
|
-
|
310
|
-
// case "blank":
|
311
|
-
// operator = "$eq";
|
312
|
-
// value = "";
|
313
|
-
// break;
|
314
|
-
|
315
|
-
// case "inRange":
|
316
|
-
// operator = "$gte";
|
317
|
-
// value = date;
|
318
|
-
// operator_to = "$lte";
|
319
|
-
// value_to = val.dateTo.substr(0, 10);
|
320
|
-
// break;
|
321
|
-
|
322
|
-
// case "notEqual":
|
323
|
-
// operator = "$regex";
|
324
|
-
// value = `^((?!${date}).)*$`;
|
325
|
-
// break;
|
326
|
-
|
327
|
-
// case "notBlank":
|
328
|
-
// operator = "$ne";
|
329
|
-
// value = "";
|
330
|
-
// break;
|
331
|
-
|
332
|
-
// default:
|
333
|
-
// operator = "$regex";
|
334
|
-
// value = `^${date}`;
|
335
|
-
// }
|
336
|
-
// }
|
337
|
-
|
338
|
-
// if (val.filterType === "string" || val.filterType === "text") {
|
339
|
-
// switch (val.type) {
|
340
|
-
// case "contains":
|
341
|
-
// operator = "$regex";
|
342
|
-
// value = `${val.filter}`;
|
343
|
-
// break;
|
344
|
-
|
345
|
-
// case "notContains":
|
346
|
-
// operator = "$regex";
|
347
|
-
// value = `^((?!${val.filter}).)*$`;
|
348
|
-
// break;
|
349
|
-
|
350
|
-
// case "equals":
|
351
|
-
// operator = "$eq";
|
352
|
-
// value = `${val.filter}`;
|
353
|
-
// break;
|
354
|
-
|
355
|
-
// case "notEqual":
|
356
|
-
// operator = "$ne";
|
357
|
-
// value = `${val.filter}`;
|
358
|
-
// break;
|
359
|
-
|
360
|
-
// case "startsWith":
|
361
|
-
// operator = "$regex";
|
362
|
-
// value = `^${val.filter}`;
|
363
|
-
// break;
|
364
|
-
|
365
|
-
// case "endsWith":
|
366
|
-
// operator = "$regex";
|
367
|
-
// value = `${val.filter}$`;
|
368
|
-
// break;
|
369
|
-
|
370
|
-
// case "blank":
|
371
|
-
// operator = "$eq";
|
372
|
-
// value = "";
|
373
|
-
// break;
|
374
|
-
|
375
|
-
// case "notBlank":
|
376
|
-
// operator = "$ne";
|
377
|
-
// value = "";
|
378
|
-
// break;
|
379
|
-
|
380
|
-
// default:
|
381
|
-
// value = "^" + val.filter;
|
382
|
-
// }
|
383
|
-
// }
|
384
|
-
|
385
|
-
// if (val.filterType === "number") {
|
386
|
-
// switch (val.type) {
|
387
|
-
// case "equals":
|
388
|
-
// operator = "$eq";
|
389
|
-
// value = val.filter;
|
390
|
-
// break;
|
391
|
-
|
392
|
-
// case "notEqual":
|
393
|
-
// operator = "$ne";
|
394
|
-
// value = val.filter;
|
395
|
-
// break;
|
396
|
-
|
397
|
-
// case "lessThanOrEqual":
|
398
|
-
// operator = "$lte";
|
399
|
-
// value = val.filter;
|
400
|
-
// break;
|
401
|
-
|
402
|
-
// case "greaterThanOrEqual":
|
403
|
-
// operator = "$gte";
|
404
|
-
// value = val.filter;
|
405
|
-
// break;
|
406
|
-
|
407
|
-
// case "lessThan":
|
408
|
-
// operator = "$lt";
|
409
|
-
// value = val.filter;
|
410
|
-
// break;
|
411
|
-
|
412
|
-
// case "greaterThan":
|
413
|
-
// operator = "$gt";
|
414
|
-
// value = val.filter;
|
415
|
-
// break;
|
416
|
-
|
417
|
-
// case "blank":
|
418
|
-
// operator = "$eq";
|
419
|
-
// value = 0;
|
420
|
-
// break;
|
421
|
-
|
422
|
-
// case "notBlank":
|
423
|
-
// operator = "$ne";
|
424
|
-
// value = 0;
|
425
|
-
// break;
|
426
|
-
|
427
|
-
// case "inRange":
|
428
|
-
// operator = "$gte";
|
429
|
-
// value = val.filter;
|
430
|
-
// operator_to = "$lte";
|
431
|
-
// value_to = val.filterTo;
|
432
|
-
// break;
|
433
|
-
|
434
|
-
// default:
|
435
|
-
// operator = "$eq";
|
436
|
-
// value = val.filter;
|
437
|
-
// }
|
438
|
-
// }
|
439
|
-
// if (!opt.selector[field_name]) {
|
440
|
-
// opt.selector[field_name] = {};
|
441
|
-
// }
|
442
|
-
// if (!opt.selector[field_name][condition]) {
|
443
|
-
// opt.selector[field_name][condition] = [];
|
444
|
-
// }
|
445
|
-
// opt.selector[field_name][condition].push({
|
446
|
-
// [operator]: value,
|
447
|
-
// });
|
448
|
-
|
449
|
-
// if (operator_to) {
|
450
|
-
// opt.selector[field_name][condition].push({
|
451
|
-
// [operator_to]: value_to,
|
452
|
-
// });
|
453
|
-
// }
|
454
|
-
// };
|
455
|
-
|
456
|
-
// if (!val.condition1) {
|
457
|
-
// make_selector(val);
|
458
|
-
// } else {
|
459
|
-
// condition = "$" + val.operator.toLowerCase();
|
460
|
-
// make_selector(val.condition1);
|
461
|
-
// make_selector(val.condition2);
|
462
|
-
// }
|
463
|
-
// }
|
464
|
-
// }
|
465
|
-
|
466
274
|
if (e.total_fields_info) {
|
467
275
|
fields = [];
|
468
276
|
for (const [key, val] of Object.entries(JSON.parse(e.total_fields_info))) {
|
package/studio.mjs
CHANGED
@@ -283,11 +283,16 @@ const get_opt = function (e, table_obj) {
|
|
283
283
|
opt.sort = sort;
|
284
284
|
}
|
285
285
|
|
286
|
-
|
287
|
-
|
286
|
+
let _sortModel = e?.sortModel || [];
|
287
|
+
if (typeof _sortModel === "string") {
|
288
|
+
_sortModel = JSON.parse(e.sortModel);
|
289
|
+
}
|
290
|
+
|
291
|
+
if (_sortModel.length) {
|
292
|
+
opt.sort = _sortModel;
|
288
293
|
if (opt.sort) {
|
289
294
|
for (const [key, val] of Object.entries(opt.sort)) {
|
290
|
-
var field_name = val.
|
295
|
+
var field_name = val.field_id;
|
291
296
|
opt.sort[key] = {
|
292
297
|
["udfData.data." + field_name]: val.sort_dir,
|
293
298
|
};
|
@@ -295,6 +300,18 @@ const get_opt = function (e, table_obj) {
|
|
295
300
|
}
|
296
301
|
}
|
297
302
|
|
303
|
+
// if (e?.sortModel && JSON.parse(e.sortModel).length) {
|
304
|
+
// opt.sort = JSON.parse(e.sortModel);
|
305
|
+
// if (opt.sort) {
|
306
|
+
// for (const [key, val] of Object.entries(opt.sort)) {
|
307
|
+
// var field_name = val.colId;
|
308
|
+
// opt.sort[key] = {
|
309
|
+
// ["udfData.data." + field_name]: val.sort_dir,
|
310
|
+
// };
|
311
|
+
// }
|
312
|
+
// }
|
313
|
+
// }
|
314
|
+
|
298
315
|
if (e.total_fields_info) {
|
299
316
|
fields = [];
|
300
317
|
for (const [key, val] of Object.entries(JSON.parse(e.total_fields_info))) {
|