@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.
@@ -3320,7 +3320,7 @@ func.datasource.create = async function (
3320
3320
  }
3321
3321
  }
3322
3322
 
3323
- var datasource_changes = {
3323
+ const datasource_changes = {
3324
3324
  [dsSessionP]: {
3325
3325
  ['datasource_main']: {
3326
3326
  stat: 'idle',
@@ -9097,15 +9097,6 @@ func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
9097
9097
  SYS_GLOBAL_OBJ_REFS[ref_field_id].props = _ds.in_parameters || {};
9098
9098
 
9099
9099
  if ($elm) {
9100
- // const get_attributes = function (retry = 0) {
9101
- // if (retry > 500) return;
9102
- // $elm?.data()?.xuPanelWrapper?.panelXuAttributes ||
9103
- // $elm?.data()?.xuData?.debug_info?.attribute_stat ||
9104
- // setTimeout(() => {
9105
- // get_attributes(retry + 1);
9106
- // }, 500);
9107
- // };
9108
-
9109
9100
  const attributes = $elm?.data()?.xuData?.xuPanelProps || $elm?.data()?.xuData?.debug_info?.attribute_stat || {};
9110
9101
  SYS_GLOBAL_OBJ_REFS[ref_field_id].attributes = attributes;
9111
9102
  SYS_GLOBAL_OBJ_REFS[ref_field_id].xu_ui_id = $elm.attr('xu-ui-id');
@@ -10825,7 +10816,7 @@ func.expression.get = async function (SESSION_ID, valP, dsSessionP, sourceP, row
10825
10816
  return new_class.get();
10826
10817
  };
10827
10818
 
10828
- func.expression.parse = function (strP) {
10819
+ func.expression.parse_org = function (strP) {
10829
10820
  var extract_str = function (strP, posP) {
10830
10821
  if (!posP) posP = 0;
10831
10822
  var clean_split_str = function (arrP) {
@@ -10920,6 +10911,119 @@ func.expression.parse = function (strP) {
10920
10911
  return res;
10921
10912
  };
10922
10913
 
10914
+ func.expression.parse_bad = function (strP) {
10915
+ const nonLettersPatt = /\W/;
10916
+ const validSymbolsNoArray = /[^.@\[]/;
10917
+ const validSymbolsWithArray = /[^.@"'\[\]]/;
10918
+
10919
+ function extractStr(str, startPos = 0) {
10920
+ const cleanSplit = (arr) => (arr?.length > 1 && arr[0] === '' && arr[1].includes('@') ? arr.slice(1) : arr);
10921
+
10922
+ const segments = cleanSplit(str.replace(/@/g, '^^@').split('^^'));
10923
+ const result = [];
10924
+
10925
+ for (const val of segments || []) {
10926
+ if (!val) continue;
10927
+ const pos = str.indexOf(val) + startPos;
10928
+
10929
+ if (val.startsWith('@')) {
10930
+ let tmpStr = '';
10931
+ let wordStart = null;
10932
+ let wordEnd = null;
10933
+ let validSymbols = validSymbolsNoArray;
10934
+
10935
+ for (let i = 0; i < val.length; i++) {
10936
+ const char = val[i];
10937
+
10938
+ if (char === '[') validSymbols = validSymbolsWithArray;
10939
+ if (char === '.' && wordStart === null) wordStart = i;
10940
+ else if (wordStart !== null && nonLettersPatt.test(char)) wordEnd = i;
10941
+
10942
+ if (wordStart !== null && wordEnd !== null) {
10943
+ const word = val.slice(wordStart + 1, wordEnd);
10944
+ tmpStr = tmpStr.slice(0, wordStart) + '^^' + tmpStr.slice(wordStart, wordEnd);
10945
+ wordStart = char === '.' ? wordEnd : null;
10946
+ wordEnd = null;
10947
+ }
10948
+
10949
+ tmpStr += nonLettersPatt.test(char) && validSymbols.test(char) && !tmpStr.includes('^^') ? '^^' + char : char;
10950
+ }
10951
+
10952
+ if (tmpStr.includes('^^')) {
10953
+ result.push(...extractStr(tmpStr, pos));
10954
+ } else {
10955
+ const fieldIdMatch = val.match(/^@([^.\[]+)/);
10956
+ result.push({
10957
+ value: val,
10958
+ fieldId: fieldIdMatch ? fieldIdMatch[1] : undefined,
10959
+ pos,
10960
+ });
10961
+ }
10962
+ } else {
10963
+ result.push({ value: val, pos });
10964
+ }
10965
+ }
10966
+ return result;
10967
+ }
10968
+
10969
+ return extractStr(strP);
10970
+ };
10971
+
10972
+ func.expression.parse = function (input) {
10973
+ if (typeof input !== 'string') return [];
10974
+
10975
+ const segments = [];
10976
+ let pos = 0;
10977
+
10978
+ const parts = input.split(/(@)/).filter(Boolean);
10979
+
10980
+ for (let i = 0; i < parts.length; i++) {
10981
+ const part = parts[i];
10982
+
10983
+ if (part === '@' && i + 1 < parts.length) {
10984
+ const nextPart = parts[i + 1];
10985
+ const varEnd = nextPart.search(/[.\[]/); // Split at first . or [
10986
+ let fieldId, remainder;
10987
+
10988
+ if (varEnd > 0) {
10989
+ fieldId = nextPart.slice(0, varEnd);
10990
+ remainder = nextPart.slice(varEnd);
10991
+ } else {
10992
+ fieldId = nextPart;
10993
+ remainder = '';
10994
+ }
10995
+
10996
+ // Add @variable segment
10997
+ const fullVarValue = `@${fieldId}`;
10998
+ segments.push({
10999
+ value: fullVarValue,
11000
+ fieldId,
11001
+ pos,
11002
+ });
11003
+ pos += fullVarValue.length;
11004
+
11005
+ // Add remainder as a separate segment, if any
11006
+ if (remainder) {
11007
+ segments.push({
11008
+ value: remainder,
11009
+ pos,
11010
+ });
11011
+ pos += remainder.length;
11012
+ }
11013
+
11014
+ i++; // Skip the next part since we consumed it
11015
+ } else if (part !== '@') {
11016
+ segments.push({
11017
+ value: part,
11018
+ pos,
11019
+ });
11020
+ pos += part.length;
11021
+ }
11022
+ }
11023
+
11024
+ return segments;
11025
+ };
11026
+
10923
11027
  func.expression.get_property = async function (valP) {
10924
11028
  async function secure_eval(val) {
10925
11029
  if (typeof IS_PROCESS_SERVER === 'undefined') {
@@ -11893,31 +11997,32 @@ func.UI.screen.refresh_screen_old = async function (SESSION_ID, fields_changed_a
11893
11997
  }
11894
11998
  };
11895
11999
 
11896
- const get_params_obj = async function (SESSION_ID, prog_id, parameters_obj_inP) {
11897
- const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);
11898
- if (!_prog) {
11899
- return;
11900
- }
12000
+ // const get_params_obj = async function (SESSION_ID, prog_id, parameters_obj_inP) {
12001
+ // const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);
12002
+ // if (!_prog) {
12003
+ // return;
12004
+ // }
12005
+
12006
+ // // get in parameters
12007
+ // var params_obj = {};
12008
+ // if (_prog?.properties?.progParams) {
12009
+ // for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
12010
+ // if (!val.data.dir === 'in') continue;
12011
+ // if (typeof parameters_obj_inP?.[val.data.parameter] !== 'undefined') {
12012
+ // if (parameters_obj_inP?.[val.data.parameter].fx) {
12013
+ // let ret = await func.expression.get(SESSION_ID, parameters_obj_inP?.[val.data.parameter].fx, dsSession, 'parameters');
12014
+ // params_obj[val.data.parameter] = ret.result;
12015
+ // } else {
12016
+ // params_obj[val.data.parameter] = parameters_obj_inP?.[val.data.parameter].value;
12017
+ // }
12018
+ // continue;
12019
+ // }
12020
+ // console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
12021
+ // }
12022
+ // }
12023
+ // return params_obj;
12024
+ // };
11901
12025
 
11902
- // get in parameters
11903
- var params_obj = {};
11904
- if (_prog?.properties?.progParams) {
11905
- for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
11906
- if (!val.data.dir === 'in') continue;
11907
- if (typeof parameters_obj_inP?.[val.data.parameter] !== 'undefined') {
11908
- if (parameters_obj_inP?.[val.data.parameter].fx) {
11909
- let ret = await func.expression.get(SESSION_ID, parameters_obj_inP?.[val.data.parameter].fx, dsSession, 'parameters');
11910
- params_obj[val.data.parameter] = ret.result;
11911
- } else {
11912
- params_obj[val.data.parameter] = parameters_obj_inP?.[val.data.parameter].value;
11913
- }
11914
- continue;
11915
- }
11916
- console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
11917
- }
11918
- }
11919
- return params_obj;
11920
- };
11921
12026
  const get_params_obj_new = async function (SESSION_ID, prog_id, nodeP, dsSession) {
11922
12027
  const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);
11923
12028
  if (!_prog) return;
@@ -3321,7 +3321,7 @@ func.datasource.create = async function (
3321
3321
  }
3322
3322
  }
3323
3323
 
3324
- var datasource_changes = {
3324
+ const datasource_changes = {
3325
3325
  [dsSessionP]: {
3326
3326
  ['datasource_main']: {
3327
3327
  stat: 'idle',
@@ -9098,15 +9098,6 @@ func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
9098
9098
  SYS_GLOBAL_OBJ_REFS[ref_field_id].props = _ds.in_parameters || {};
9099
9099
 
9100
9100
  if ($elm) {
9101
- // const get_attributes = function (retry = 0) {
9102
- // if (retry > 500) return;
9103
- // $elm?.data()?.xuPanelWrapper?.panelXuAttributes ||
9104
- // $elm?.data()?.xuData?.debug_info?.attribute_stat ||
9105
- // setTimeout(() => {
9106
- // get_attributes(retry + 1);
9107
- // }, 500);
9108
- // };
9109
-
9110
9101
  const attributes = $elm?.data()?.xuData?.xuPanelProps || $elm?.data()?.xuData?.debug_info?.attribute_stat || {};
9111
9102
  SYS_GLOBAL_OBJ_REFS[ref_field_id].attributes = attributes;
9112
9103
  SYS_GLOBAL_OBJ_REFS[ref_field_id].xu_ui_id = $elm.attr('xu-ui-id');
@@ -9966,31 +9957,32 @@ func.UI.screen.refresh_screen_old = async function (SESSION_ID, fields_changed_a
9966
9957
  }
9967
9958
  };
9968
9959
 
9969
- const get_params_obj = async function (SESSION_ID, prog_id, parameters_obj_inP) {
9970
- const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);
9971
- if (!_prog) {
9972
- return;
9973
- }
9960
+ // const get_params_obj = async function (SESSION_ID, prog_id, parameters_obj_inP) {
9961
+ // const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);
9962
+ // if (!_prog) {
9963
+ // return;
9964
+ // }
9965
+
9966
+ // // get in parameters
9967
+ // var params_obj = {};
9968
+ // if (_prog?.properties?.progParams) {
9969
+ // for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
9970
+ // if (!val.data.dir === 'in') continue;
9971
+ // if (typeof parameters_obj_inP?.[val.data.parameter] !== 'undefined') {
9972
+ // if (parameters_obj_inP?.[val.data.parameter].fx) {
9973
+ // let ret = await func.expression.get(SESSION_ID, parameters_obj_inP?.[val.data.parameter].fx, dsSession, 'parameters');
9974
+ // params_obj[val.data.parameter] = ret.result;
9975
+ // } else {
9976
+ // params_obj[val.data.parameter] = parameters_obj_inP?.[val.data.parameter].value;
9977
+ // }
9978
+ // continue;
9979
+ // }
9980
+ // console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
9981
+ // }
9982
+ // }
9983
+ // return params_obj;
9984
+ // };
9974
9985
 
9975
- // get in parameters
9976
- var params_obj = {};
9977
- if (_prog?.properties?.progParams) {
9978
- for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
9979
- if (!val.data.dir === 'in') continue;
9980
- if (typeof parameters_obj_inP?.[val.data.parameter] !== 'undefined') {
9981
- if (parameters_obj_inP?.[val.data.parameter].fx) {
9982
- let ret = await func.expression.get(SESSION_ID, parameters_obj_inP?.[val.data.parameter].fx, dsSession, 'parameters');
9983
- params_obj[val.data.parameter] = ret.result;
9984
- } else {
9985
- params_obj[val.data.parameter] = parameters_obj_inP?.[val.data.parameter].value;
9986
- }
9987
- continue;
9988
- }
9989
- console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
9990
- }
9991
- }
9992
- return params_obj;
9993
- };
9994
9986
  const get_params_obj_new = async function (SESSION_ID, prog_id, nodeP, dsSession) {
9995
9987
  const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);
9996
9988
  if (!_prog) return;
@@ -14621,7 +14613,7 @@ func.expression.get = async function (SESSION_ID, valP, dsSessionP, sourceP, row
14621
14613
  return new_class.get();
14622
14614
  };
14623
14615
 
14624
- func.expression.parse = function (strP) {
14616
+ func.expression.parse_org = function (strP) {
14625
14617
  var extract_str = function (strP, posP) {
14626
14618
  if (!posP) posP = 0;
14627
14619
  var clean_split_str = function (arrP) {
@@ -14716,6 +14708,119 @@ func.expression.parse = function (strP) {
14716
14708
  return res;
14717
14709
  };
14718
14710
 
14711
+ func.expression.parse_bad = function (strP) {
14712
+ const nonLettersPatt = /\W/;
14713
+ const validSymbolsNoArray = /[^.@\[]/;
14714
+ const validSymbolsWithArray = /[^.@"'\[\]]/;
14715
+
14716
+ function extractStr(str, startPos = 0) {
14717
+ const cleanSplit = (arr) => (arr?.length > 1 && arr[0] === '' && arr[1].includes('@') ? arr.slice(1) : arr);
14718
+
14719
+ const segments = cleanSplit(str.replace(/@/g, '^^@').split('^^'));
14720
+ const result = [];
14721
+
14722
+ for (const val of segments || []) {
14723
+ if (!val) continue;
14724
+ const pos = str.indexOf(val) + startPos;
14725
+
14726
+ if (val.startsWith('@')) {
14727
+ let tmpStr = '';
14728
+ let wordStart = null;
14729
+ let wordEnd = null;
14730
+ let validSymbols = validSymbolsNoArray;
14731
+
14732
+ for (let i = 0; i < val.length; i++) {
14733
+ const char = val[i];
14734
+
14735
+ if (char === '[') validSymbols = validSymbolsWithArray;
14736
+ if (char === '.' && wordStart === null) wordStart = i;
14737
+ else if (wordStart !== null && nonLettersPatt.test(char)) wordEnd = i;
14738
+
14739
+ if (wordStart !== null && wordEnd !== null) {
14740
+ const word = val.slice(wordStart + 1, wordEnd);
14741
+ tmpStr = tmpStr.slice(0, wordStart) + '^^' + tmpStr.slice(wordStart, wordEnd);
14742
+ wordStart = char === '.' ? wordEnd : null;
14743
+ wordEnd = null;
14744
+ }
14745
+
14746
+ tmpStr += nonLettersPatt.test(char) && validSymbols.test(char) && !tmpStr.includes('^^') ? '^^' + char : char;
14747
+ }
14748
+
14749
+ if (tmpStr.includes('^^')) {
14750
+ result.push(...extractStr(tmpStr, pos));
14751
+ } else {
14752
+ const fieldIdMatch = val.match(/^@([^.\[]+)/);
14753
+ result.push({
14754
+ value: val,
14755
+ fieldId: fieldIdMatch ? fieldIdMatch[1] : undefined,
14756
+ pos,
14757
+ });
14758
+ }
14759
+ } else {
14760
+ result.push({ value: val, pos });
14761
+ }
14762
+ }
14763
+ return result;
14764
+ }
14765
+
14766
+ return extractStr(strP);
14767
+ };
14768
+
14769
+ func.expression.parse = function (input) {
14770
+ if (typeof input !== 'string') return [];
14771
+
14772
+ const segments = [];
14773
+ let pos = 0;
14774
+
14775
+ const parts = input.split(/(@)/).filter(Boolean);
14776
+
14777
+ for (let i = 0; i < parts.length; i++) {
14778
+ const part = parts[i];
14779
+
14780
+ if (part === '@' && i + 1 < parts.length) {
14781
+ const nextPart = parts[i + 1];
14782
+ const varEnd = nextPart.search(/[.\[]/); // Split at first . or [
14783
+ let fieldId, remainder;
14784
+
14785
+ if (varEnd > 0) {
14786
+ fieldId = nextPart.slice(0, varEnd);
14787
+ remainder = nextPart.slice(varEnd);
14788
+ } else {
14789
+ fieldId = nextPart;
14790
+ remainder = '';
14791
+ }
14792
+
14793
+ // Add @variable segment
14794
+ const fullVarValue = `@${fieldId}`;
14795
+ segments.push({
14796
+ value: fullVarValue,
14797
+ fieldId,
14798
+ pos,
14799
+ });
14800
+ pos += fullVarValue.length;
14801
+
14802
+ // Add remainder as a separate segment, if any
14803
+ if (remainder) {
14804
+ segments.push({
14805
+ value: remainder,
14806
+ pos,
14807
+ });
14808
+ pos += remainder.length;
14809
+ }
14810
+
14811
+ i++; // Skip the next part since we consumed it
14812
+ } else if (part !== '@') {
14813
+ segments.push({
14814
+ value: part,
14815
+ pos,
14816
+ });
14817
+ pos += part.length;
14818
+ }
14819
+ }
14820
+
14821
+ return segments;
14822
+ };
14823
+
14719
14824
  func.expression.get_property = async function (valP) {
14720
14825
  async function secure_eval(val) {
14721
14826
  if (typeof IS_PROCESS_SERVER === 'undefined') {