@xuda.io/runtime-bundle 1.0.480 → 1.0.482

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.
@@ -28256,15 +28256,6 @@ func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
28256
28256
  SYS_GLOBAL_OBJ_REFS[ref_field_id].props = _ds.in_parameters || {};
28257
28257
 
28258
28258
  if ($elm) {
28259
- // const get_attributes = function (retry = 0) {
28260
- // if (retry > 500) return;
28261
- // $elm?.data()?.xuPanelWrapper?.panelXuAttributes ||
28262
- // $elm?.data()?.xuData?.debug_info?.attribute_stat ||
28263
- // setTimeout(() => {
28264
- // get_attributes(retry + 1);
28265
- // }, 500);
28266
- // };
28267
-
28268
28259
  const attributes = $elm?.data()?.xuData?.xuPanelProps || $elm?.data()?.xuData?.debug_info?.attribute_stat || {};
28269
28260
  SYS_GLOBAL_OBJ_REFS[ref_field_id].attributes = attributes;
28270
28261
  SYS_GLOBAL_OBJ_REFS[ref_field_id].xu_ui_id = $elm.attr('xu-ui-id');
@@ -28413,7 +28404,7 @@ func.datasource.create = async function (
28413
28404
  }
28414
28405
  }
28415
28406
 
28416
- var datasource_changes = {
28407
+ const datasource_changes = {
28417
28408
  [dsSessionP]: {
28418
28409
  ['datasource_main']: {
28419
28410
  stat: 'idle',
@@ -31925,31 +31916,32 @@ func.UI.screen.refresh_screen_old = async function (SESSION_ID, fields_changed_a
31925
31916
  }
31926
31917
  };
31927
31918
 
31928
- const get_params_obj = async function (SESSION_ID, prog_id, parameters_obj_inP) {
31929
- const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);
31930
- if (!_prog) {
31931
- return;
31932
- }
31919
+ // const get_params_obj = async function (SESSION_ID, prog_id, parameters_obj_inP) {
31920
+ // const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);
31921
+ // if (!_prog) {
31922
+ // return;
31923
+ // }
31924
+
31925
+ // // get in parameters
31926
+ // var params_obj = {};
31927
+ // if (_prog?.properties?.progParams) {
31928
+ // for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
31929
+ // if (!val.data.dir === 'in') continue;
31930
+ // if (typeof parameters_obj_inP?.[val.data.parameter] !== 'undefined') {
31931
+ // if (parameters_obj_inP?.[val.data.parameter].fx) {
31932
+ // let ret = await func.expression.get(SESSION_ID, parameters_obj_inP?.[val.data.parameter].fx, dsSession, 'parameters');
31933
+ // params_obj[val.data.parameter] = ret.result;
31934
+ // } else {
31935
+ // params_obj[val.data.parameter] = parameters_obj_inP?.[val.data.parameter].value;
31936
+ // }
31937
+ // continue;
31938
+ // }
31939
+ // console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
31940
+ // }
31941
+ // }
31942
+ // return params_obj;
31943
+ // };
31933
31944
 
31934
- // get in parameters
31935
- var params_obj = {};
31936
- if (_prog?.properties?.progParams) {
31937
- for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
31938
- if (!val.data.dir === 'in') continue;
31939
- if (typeof parameters_obj_inP?.[val.data.parameter] !== 'undefined') {
31940
- if (parameters_obj_inP?.[val.data.parameter].fx) {
31941
- let ret = await func.expression.get(SESSION_ID, parameters_obj_inP?.[val.data.parameter].fx, dsSession, 'parameters');
31942
- params_obj[val.data.parameter] = ret.result;
31943
- } else {
31944
- params_obj[val.data.parameter] = parameters_obj_inP?.[val.data.parameter].value;
31945
- }
31946
- continue;
31947
- }
31948
- console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
31949
- }
31950
- }
31951
- return params_obj;
31952
- };
31953
31945
  const get_params_obj_new = async function (SESSION_ID, prog_id, nodeP, dsSession) {
31954
31946
  const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);
31955
31947
  if (!_prog) return;
@@ -35256,7 +35248,7 @@ func.expression.get = async function (SESSION_ID, valP, dsSessionP, sourceP, row
35256
35248
  return new_class.get();
35257
35249
  };
35258
35250
 
35259
- func.expression.parse = function (strP) {
35251
+ func.expression.parse_org = function (strP) {
35260
35252
  var extract_str = function (strP, posP) {
35261
35253
  if (!posP) posP = 0;
35262
35254
  var clean_split_str = function (arrP) {
@@ -35351,6 +35343,119 @@ func.expression.parse = function (strP) {
35351
35343
  return res;
35352
35344
  };
35353
35345
 
35346
+ func.expression.parse_bad = function (strP) {
35347
+ const nonLettersPatt = /\W/;
35348
+ const validSymbolsNoArray = /[^.@\[]/;
35349
+ const validSymbolsWithArray = /[^.@"'\[\]]/;
35350
+
35351
+ function extractStr(str, startPos = 0) {
35352
+ const cleanSplit = (arr) => (arr?.length > 1 && arr[0] === '' && arr[1].includes('@') ? arr.slice(1) : arr);
35353
+
35354
+ const segments = cleanSplit(str.replace(/@/g, '^^@').split('^^'));
35355
+ const result = [];
35356
+
35357
+ for (const val of segments || []) {
35358
+ if (!val) continue;
35359
+ const pos = str.indexOf(val) + startPos;
35360
+
35361
+ if (val.startsWith('@')) {
35362
+ let tmpStr = '';
35363
+ let wordStart = null;
35364
+ let wordEnd = null;
35365
+ let validSymbols = validSymbolsNoArray;
35366
+
35367
+ for (let i = 0; i < val.length; i++) {
35368
+ const char = val[i];
35369
+
35370
+ if (char === '[') validSymbols = validSymbolsWithArray;
35371
+ if (char === '.' && wordStart === null) wordStart = i;
35372
+ else if (wordStart !== null && nonLettersPatt.test(char)) wordEnd = i;
35373
+
35374
+ if (wordStart !== null && wordEnd !== null) {
35375
+ const word = val.slice(wordStart + 1, wordEnd);
35376
+ tmpStr = tmpStr.slice(0, wordStart) + '^^' + tmpStr.slice(wordStart, wordEnd);
35377
+ wordStart = char === '.' ? wordEnd : null;
35378
+ wordEnd = null;
35379
+ }
35380
+
35381
+ tmpStr += nonLettersPatt.test(char) && validSymbols.test(char) && !tmpStr.includes('^^') ? '^^' + char : char;
35382
+ }
35383
+
35384
+ if (tmpStr.includes('^^')) {
35385
+ result.push(...extractStr(tmpStr, pos));
35386
+ } else {
35387
+ const fieldIdMatch = val.match(/^@([^.\[]+)/);
35388
+ result.push({
35389
+ value: val,
35390
+ fieldId: fieldIdMatch ? fieldIdMatch[1] : undefined,
35391
+ pos,
35392
+ });
35393
+ }
35394
+ } else {
35395
+ result.push({ value: val, pos });
35396
+ }
35397
+ }
35398
+ return result;
35399
+ }
35400
+
35401
+ return extractStr(strP);
35402
+ };
35403
+
35404
+ func.expression.parse = function (input) {
35405
+ if (typeof input !== 'string') return [];
35406
+
35407
+ const segments = [];
35408
+ let pos = 0;
35409
+
35410
+ const parts = input.split(/(@)/).filter(Boolean);
35411
+
35412
+ for (let i = 0; i < parts.length; i++) {
35413
+ const part = parts[i];
35414
+
35415
+ if (part === '@' && i + 1 < parts.length) {
35416
+ const nextPart = parts[i + 1];
35417
+ const varEnd = nextPart.search(/[.\[]/); // Split at first . or [
35418
+ let fieldId, remainder;
35419
+
35420
+ if (varEnd > 0) {
35421
+ fieldId = nextPart.slice(0, varEnd);
35422
+ remainder = nextPart.slice(varEnd);
35423
+ } else {
35424
+ fieldId = nextPart;
35425
+ remainder = '';
35426
+ }
35427
+
35428
+ // Add @variable segment
35429
+ const fullVarValue = `@${fieldId}`;
35430
+ segments.push({
35431
+ value: fullVarValue,
35432
+ fieldId,
35433
+ pos,
35434
+ });
35435
+ pos += fullVarValue.length;
35436
+
35437
+ // Add remainder as a separate segment, if any
35438
+ if (remainder) {
35439
+ segments.push({
35440
+ value: remainder,
35441
+ pos,
35442
+ });
35443
+ pos += remainder.length;
35444
+ }
35445
+
35446
+ i++; // Skip the next part since we consumed it
35447
+ } else if (part !== '@') {
35448
+ segments.push({
35449
+ value: part,
35450
+ pos,
35451
+ });
35452
+ pos += part.length;
35453
+ }
35454
+ }
35455
+
35456
+ return segments;
35457
+ };
35458
+
35354
35459
  func.expression.get_property = async function (valP) {
35355
35460
  async function secure_eval(val) {
35356
35461
  if (typeof IS_PROCESS_SERVER === 'undefined') {