@xuda.io/xuda-dbs-plugin-xuda 1.0.181 → 1.0.183

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/studio.mjs +16 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-dbs-plugin-xuda",
3
- "version": "1.0.181",
3
+ "version": "1.0.183",
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/studio.mjs CHANGED
@@ -298,7 +298,7 @@ const get_opt = function (e, table_obj) {
298
298
  if (e.filterModel && JSON.parse(e.filterModel)) {
299
299
  debugger;
300
300
  for (const [key, val] of Object.entries(JSON.parse(e.filterModel))) {
301
- var field_name = key;
301
+ var field_name = "udfData.data." + key;
302
302
  var condition = "$and";
303
303
  const make_selector = function (val) {
304
304
  var value = "";
@@ -454,19 +454,20 @@ const get_opt = function (e, table_obj) {
454
454
  }
455
455
  }
456
456
  if (!opt.selector[condition]) {
457
- opt.selector[condition] = {};
457
+ opt.selector[condition] = [];
458
458
  }
459
- if (!opt.selector[condition][field_name]) {
460
- opt.selector[condition][field_name] = [];
461
- }
462
- opt.selector[condition][field_name].push({
463
- [operator]: value,
464
- });
459
+ // if (!opt.selector[condition][field_name]) {
460
+ // opt.selector[condition][field_name] = [];
461
+ // }
462
+ opt.selector[condition].push({ [field_name]: { [operator]: value } });
465
463
 
466
464
  if (operator_to) {
467
- opt.selector[condition][field_name].push({
468
- [operator_to]: value_to,
465
+ opt.selector[condition].push({
466
+ [field_name]: { [operator_to]: value_to },
469
467
  });
468
+ // opt.selector[condition][field_name].push({
469
+ // [operator_to]: value_to,
470
+ // });
470
471
  }
471
472
  };
472
473
 
@@ -494,6 +495,7 @@ const get_opt = function (e, table_obj) {
494
495
  for (const [key, val] of Object.entries(opt.fields)) {
495
496
  opt.fields[key] = "udfData.data." + val;
496
497
  }
498
+
497
499
  if (!e?.sortModel || !JSON.parse(e.sortModel).length) {
498
500
  // added 2021 09 10
499
501
  if (opt.sort) {
@@ -508,6 +510,10 @@ const get_opt = function (e, table_obj) {
508
510
  var selector_new = {};
509
511
 
510
512
  for (const [key, val] of Object.entries(opt.selector)) {
513
+ if (key.substring(0) === "$") {
514
+ selector_new[+key] = val;
515
+ continue;
516
+ }
511
517
  selector_new["udfData.data." + key] = val;
512
518
  }
513
519