@xuda.io/runtime-bundle 1.0.481 → 1.0.483

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.
@@ -30183,6 +30183,15 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
30183
30183
  }
30184
30184
  };
30185
30185
 
30186
+ const update_xu_ref = async function () {
30187
+ let _ds_0 = _session.DS_GLB[0];
30188
+ for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
30189
+ if (val.ds.dsSession == dataSource) {
30190
+ func.UI.update_xu_ref(SESSION_ID, dataSource, ref_name);
30191
+ }
30192
+ }
30193
+ };
30194
+
30186
30195
  var fields_changed = [];
30187
30196
  var datasource_changed = [];
30188
30197
  let client_datasource_changes = {};
@@ -30200,6 +30209,7 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
30200
30209
  // mechanism to make update directly on the datasource object
30201
30210
  if (record_id === 'datasource_main') {
30202
30211
  _.set(_ds, field_id, value);
30212
+ update_xu_ref();
30203
30213
  continue;
30204
30214
  }
30205
30215
 
@@ -30217,15 +30227,16 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
30217
30227
  await set_fieldComputed_dependencies(dataSource, field_id, null);
30218
30228
 
30219
30229
  // search the field in refs
30220
- let _ds_0 = _session.DS_GLB[0];
30221
- for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
30222
- if (val.ds.dsSession == dataSource) {
30223
- func.UI.update_xu_ref(SESSION_ID, dataSource, ref_name);
30224
- // if (!fields_changed.includes(ref_name)) {
30225
- // fields_changed.push(ref_name);
30226
- // }
30227
- }
30228
- }
30230
+ update_xu_ref();
30231
+ // let _ds_0 = _session.DS_GLB[0];
30232
+ // for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
30233
+ // if (val.ds.dsSession == dataSource) {
30234
+ // func.UI.update_xu_ref(SESSION_ID, dataSource, ref_name);
30235
+ // // if (!fields_changed.includes(ref_name)) {
30236
+ // // fields_changed.push(ref_name);
30237
+ // // }
30238
+ // }
30239
+ // }
30229
30240
 
30230
30241
  if (!update_local_scope_only) {
30231
30242
  let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
@@ -35248,102 +35259,102 @@ func.expression.get = async function (SESSION_ID, valP, dsSessionP, sourceP, row
35248
35259
  return new_class.get();
35249
35260
  };
35250
35261
 
35251
- // func.expression.parse = function (strP) {
35252
- // var extract_str = function (strP, posP) {
35253
- // if (!posP) posP = 0;
35254
- // var clean_split_str = function (arrP) {
35255
- // var arr = [];
35256
- // if (arrP && arrP.length > 1 && arrP[0] === '' && arrP[1].indexOf('@') > -1) {
35257
- // for (var i = 1; i <= arrP.length; i++) {
35258
- // arr.push(arrP[i]);
35259
- // }
35260
- // return arr;
35261
- // } else return arrP;
35262
- // };
35263
- // var nonLettersPatt = /\W/; // non letters
35264
- // var validSymbolsNoArray = /[^.@\[]/; //valid symbols no array /[^.@\[\]\]]/
35265
- // var validSymbolsWithArray = /[^.@"'\[\]]/; //valid symbols with array
35266
- // var validSymbols = validSymbolsNoArray;
35267
- // var splitTmp = strP.replace(/@/g, '^^@').split('^^');
35268
- // var split = clean_split_str(splitTmp);
35269
- // var obj = [];
35270
- // if (split) {
35271
- // for (let val of split) {
35272
- // // run on @ segments
35273
- // if (val) {
35274
- // var pos = strP.indexOf(val);
35275
- // if (val && val.substr(0, 1) === '@') {
35276
- // var tmpStr = '';
35277
- // var word_start_pos = undefined;
35278
- // var word_end_pos = undefined;
35279
- // // run on @ segment string
35280
- // for (var i = 0; i <= val.length; i++) {
35281
- // var key1 = i;
35282
- // var val1 = val.substr(i, 1);
35283
- // if (
35284
- // val1 === '.' &&
35285
- // !word_start_pos // find first dot
35286
- // )
35287
- // word_start_pos = key1;
35288
- // if (
35289
- // word_start_pos &&
35290
- // key1 > word_start_pos &&
35291
- // nonLettersPatt.test(val1) // find any sign character to mark the end of word
35292
- // )
35293
- // word_end_pos = key1;
35294
- // if (word_start_pos && word_start_pos >= 0 && word_end_pos && word_end_pos >= 0) {
35295
- // // find the word
35296
- // var word = val.substr(word_start_pos + 1, word_end_pos - word_start_pos - 1); // get the word
35297
- // // if (glb.ALL_PROPERTIES_ARR.indexOf(word) === -1) {
35298
- // // compare with internal properties
35299
- // tmpStr = tmpStr.substr(0, word_start_pos) + '^^' + tmpStr.substr(word_start_pos, word_end_pos);
35300
- // // }
35301
- // if (val.substr(word_end_pos, 1) === '.') word_start_pos = word_end_pos;
35302
- // else word_start_pos = null;
35303
- // word_end_pos = null;
35304
- // }
35305
- // if (val1 === '[') validSymbols = validSymbolsWithArray;
35306
- // if (nonLettersPatt.test(val1) && validSymbols.test(val1) && tmpStr.indexOf('^^') === -1) {
35307
- // tmpStr += '^^' + val1;
35308
- // } else tmpStr += val1;
35309
- // }
35310
- // // });
35311
- // if (tmpStr.indexOf('^^') > -1) {
35312
- // var obj1 = extract_str(tmpStr, pos);
35313
- // obj = obj.concat(obj1);
35314
- // } else {
35315
- // // push clean @var
35316
- // var fieldId = undefined;
35317
- // if (val) {
35318
- // fieldId = val.substr(1, val.length);
35319
- // if (val.indexOf('.') > -1) fieldId = val.substr(1, val.indexOf('.') - 1);
35320
- // if (val.indexOf('[') > -1) fieldId = val.substr(1, val.indexOf('[') - 1);
35321
- // //
35322
- // // if (val.indexOf("]") > -1)
35323
- // // fieldId = val.substr(1, val.indexOf("]") - 1);
35324
- // }
35325
- // obj.push({
35326
- // value: val,
35327
- // fieldId: fieldId,
35328
- // pos: pos + posP,
35329
- // });
35330
- // }
35331
- // } else {
35332
- // obj.push({
35333
- // value: val,
35334
- // pos: pos + posP,
35335
- // });
35336
- // }
35337
- // }
35338
- // }
35339
- // return obj;
35340
- // }
35341
- // };
35342
- // var res = extract_str(strP);
35343
- // return res;
35344
- // };
35262
+ func.expression.parse_org = function (strP) {
35263
+ var extract_str = function (strP, posP) {
35264
+ if (!posP) posP = 0;
35265
+ var clean_split_str = function (arrP) {
35266
+ var arr = [];
35267
+ if (arrP && arrP.length > 1 && arrP[0] === '' && arrP[1].indexOf('@') > -1) {
35268
+ for (var i = 1; i <= arrP.length; i++) {
35269
+ arr.push(arrP[i]);
35270
+ }
35271
+ return arr;
35272
+ } else return arrP;
35273
+ };
35274
+ var nonLettersPatt = /\W/; // non letters
35275
+ var validSymbolsNoArray = /[^.@\[]/; //valid symbols no array /[^.@\[\]\]]/
35276
+ var validSymbolsWithArray = /[^.@"'\[\]]/; //valid symbols with array
35277
+ var validSymbols = validSymbolsNoArray;
35278
+ var splitTmp = strP.replace(/@/g, '^^@').split('^^');
35279
+ var split = clean_split_str(splitTmp);
35280
+ var obj = [];
35281
+ if (split) {
35282
+ for (let val of split) {
35283
+ // run on @ segments
35284
+ if (val) {
35285
+ var pos = strP.indexOf(val);
35286
+ if (val && val.substr(0, 1) === '@') {
35287
+ var tmpStr = '';
35288
+ var word_start_pos = undefined;
35289
+ var word_end_pos = undefined;
35290
+ // run on @ segment string
35291
+ for (var i = 0; i <= val.length; i++) {
35292
+ var key1 = i;
35293
+ var val1 = val.substr(i, 1);
35294
+ if (
35295
+ val1 === '.' &&
35296
+ !word_start_pos // find first dot
35297
+ )
35298
+ word_start_pos = key1;
35299
+ if (
35300
+ word_start_pos &&
35301
+ key1 > word_start_pos &&
35302
+ nonLettersPatt.test(val1) // find any sign character to mark the end of word
35303
+ )
35304
+ word_end_pos = key1;
35305
+ if (word_start_pos && word_start_pos >= 0 && word_end_pos && word_end_pos >= 0) {
35306
+ // find the word
35307
+ var word = val.substr(word_start_pos + 1, word_end_pos - word_start_pos - 1); // get the word
35308
+ // if (glb.ALL_PROPERTIES_ARR.indexOf(word) === -1) {
35309
+ // compare with internal properties
35310
+ tmpStr = tmpStr.substr(0, word_start_pos) + '^^' + tmpStr.substr(word_start_pos, word_end_pos);
35311
+ // }
35312
+ if (val.substr(word_end_pos, 1) === '.') word_start_pos = word_end_pos;
35313
+ else word_start_pos = null;
35314
+ word_end_pos = null;
35315
+ }
35316
+ if (val1 === '[') validSymbols = validSymbolsWithArray;
35317
+ if (nonLettersPatt.test(val1) && validSymbols.test(val1) && tmpStr.indexOf('^^') === -1) {
35318
+ tmpStr += '^^' + val1;
35319
+ } else tmpStr += val1;
35320
+ }
35321
+ // });
35322
+ if (tmpStr.indexOf('^^') > -1) {
35323
+ var obj1 = extract_str(tmpStr, pos);
35324
+ obj = obj.concat(obj1);
35325
+ } else {
35326
+ // push clean @var
35327
+ var fieldId = undefined;
35328
+ if (val) {
35329
+ fieldId = val.substr(1, val.length);
35330
+ if (val.indexOf('.') > -1) fieldId = val.substr(1, val.indexOf('.') - 1);
35331
+ if (val.indexOf('[') > -1) fieldId = val.substr(1, val.indexOf('[') - 1);
35332
+ //
35333
+ // if (val.indexOf("]") > -1)
35334
+ // fieldId = val.substr(1, val.indexOf("]") - 1);
35335
+ }
35336
+ obj.push({
35337
+ value: val,
35338
+ fieldId: fieldId,
35339
+ pos: pos + posP,
35340
+ });
35341
+ }
35342
+ } else {
35343
+ obj.push({
35344
+ value: val,
35345
+ pos: pos + posP,
35346
+ });
35347
+ }
35348
+ }
35349
+ }
35350
+ return obj;
35351
+ }
35352
+ };
35353
+ var res = extract_str(strP);
35354
+ return res;
35355
+ };
35345
35356
 
35346
- func.expression.parse = function (strP) {
35357
+ func.expression.parse_bad = function (strP) {
35347
35358
  const nonLettersPatt = /\W/;
35348
35359
  const validSymbolsNoArray = /[^.@\[]/;
35349
35360
  const validSymbolsWithArray = /[^.@"'\[\]]/;
@@ -35401,6 +35412,61 @@ func.expression.parse = function (strP) {
35401
35412
  return extractStr(strP);
35402
35413
  };
35403
35414
 
35415
+ func.expression.parse = function (input) {
35416
+ if (typeof input !== 'string') return [];
35417
+
35418
+ const segments = [];
35419
+ let pos = 0;
35420
+
35421
+ const parts = input.split(/(@)/).filter(Boolean);
35422
+
35423
+ for (let i = 0; i < parts.length; i++) {
35424
+ const part = parts[i];
35425
+
35426
+ if (part === '@' && i + 1 < parts.length) {
35427
+ const nextPart = parts[i + 1];
35428
+ const varEnd = nextPart.search(/[.\[]/); // Split at first . or [
35429
+ let fieldId, remainder;
35430
+
35431
+ if (varEnd > 0) {
35432
+ fieldId = nextPart.slice(0, varEnd);
35433
+ remainder = nextPart.slice(varEnd);
35434
+ } else {
35435
+ fieldId = nextPart;
35436
+ remainder = '';
35437
+ }
35438
+
35439
+ // Add @variable segment
35440
+ const fullVarValue = `@${fieldId}`;
35441
+ segments.push({
35442
+ value: fullVarValue,
35443
+ fieldId,
35444
+ pos,
35445
+ });
35446
+ pos += fullVarValue.length;
35447
+
35448
+ // Add remainder as a separate segment, if any
35449
+ if (remainder) {
35450
+ segments.push({
35451
+ value: remainder,
35452
+ pos,
35453
+ });
35454
+ pos += remainder.length;
35455
+ }
35456
+
35457
+ i++; // Skip the next part since we consumed it
35458
+ } else if (part !== '@') {
35459
+ segments.push({
35460
+ value: part,
35461
+ pos,
35462
+ });
35463
+ pos += part.length;
35464
+ }
35465
+ }
35466
+
35467
+ return segments;
35468
+ };
35469
+
35404
35470
  func.expression.get_property = async function (valP) {
35405
35471
  async function secure_eval(val) {
35406
35472
  if (typeof IS_PROCESS_SERVER === 'undefined') {