@xuda.io/runtime-bundle 1.0.1423 → 1.0.1425

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.
@@ -16053,10 +16053,11 @@ func.runtime.render.bind_xu_event = function (options) {
16053
16053
  evt[val.event_modifiers]();
16054
16054
  }
16055
16055
 
16056
- if (val.workflow) {
16057
- const workflow_keys = Object.keys(val.workflow);
16056
+ const workflow = val.workflow || val.event;
16057
+ if (workflow) {
16058
+ const workflow_keys = Object.keys(workflow);
16058
16059
  for (let workflow_index = 0; workflow_index < workflow_keys.length; workflow_index++) {
16059
- const val2 = val.workflow[workflow_keys[workflow_index]];
16060
+ const val2 = workflow[workflow_keys[workflow_index]];
16060
16061
  if (!val2.data.enabled) continue;
16061
16062
 
16062
16063
  func.events.add_to_queue(
@@ -16768,7 +16769,7 @@ func.runtime.render.normalize_node_attributes = function (nodeP) {
16768
16769
  {
16769
16770
  handler: 'custom',
16770
16771
  props: {},
16771
- event: [
16772
+ workflow: [
16772
16773
  {
16773
16774
  id: Date.now(),
16774
16775
  data: {
@@ -20158,6 +20159,25 @@ func.expression.get = async function (SESSION_ID, valP, dsSessionP, sourceP, row
20158
20159
 
20159
20160
  // var split = [];
20160
20161
  var var_Arr = [];
20162
+ const get_iterate_value_ret = function (fieldIdP) {
20163
+ if (!iterate_info || (iterate_info.iterator_key !== fieldIdP && iterate_info.iterator_val !== fieldIdP)) {
20164
+ return null;
20165
+ }
20166
+
20167
+ const iter_value = iterate_info.iterator_key === fieldIdP ? iterate_info._key : iterate_info._val;
20168
+ const iter_type = typeof iter_value !== 'undefined' ? {}.toString.call(iter_value).match(/\s([a-zA-Z]+)/)[1].toLowerCase() : 'string';
20169
+
20170
+ return {
20171
+ ret: {
20172
+ value: iter_value,
20173
+ type: iter_type,
20174
+ prop: ['array', 'object'].includes(iter_type) ? iter_value : null,
20175
+ },
20176
+ fieldIdP,
20177
+ currentRecordId: rowIdP,
20178
+ found: typeof iter_value !== 'undefined',
20179
+ };
20180
+ };
20161
20181
  const split = func.expression.parse(ret) || [];
20162
20182
  // console.log(valP, split);
20163
20183
  const split_entries = Object.entries(split);
@@ -20254,7 +20274,7 @@ func.expression.get = async function (SESSION_ID, valP, dsSessionP, sourceP, row
20254
20274
  } // put default
20255
20275
  fields[val.fieldId] = var_Arr[key].value;
20256
20276
 
20257
- const ret = await func.datasource.get_value(SESSION_ID, val.fieldId, dsSessionP, rowIdP); // find field in dataSources
20277
+ const ret = get_iterate_value_ret(val.fieldId) || (await func.datasource.get_value(SESSION_ID, val.fieldId, dsSessionP, rowIdP)); // find field in dataSources
20258
20278
 
20259
20279
  await replace_value_in_string(ret.ret, ret.fieldIdP);
20260
20280
  }
@@ -15979,10 +15979,11 @@ func.runtime.render.bind_xu_event = function (options) {
15979
15979
  evt[val.event_modifiers]();
15980
15980
  }
15981
15981
 
15982
- if (val.workflow) {
15983
- const workflow_keys = Object.keys(val.workflow);
15982
+ const workflow = val.workflow || val.event;
15983
+ if (workflow) {
15984
+ const workflow_keys = Object.keys(workflow);
15984
15985
  for (let workflow_index = 0; workflow_index < workflow_keys.length; workflow_index++) {
15985
- const val2 = val.workflow[workflow_keys[workflow_index]];
15986
+ const val2 = workflow[workflow_keys[workflow_index]];
15986
15987
  if (!val2.data.enabled) continue;
15987
15988
 
15988
15989
  func.events.add_to_queue(
@@ -16694,7 +16695,7 @@ func.runtime.render.normalize_node_attributes = function (nodeP) {
16694
16695
  {
16695
16696
  handler: 'custom',
16696
16697
  props: {},
16697
- event: [
16698
+ workflow: [
16698
16699
  {
16699
16700
  id: Date.now(),
16700
16701
  data: {
@@ -20849,6 +20850,25 @@ func.expression.get = async function (SESSION_ID, valP, dsSessionP, sourceP, row
20849
20850
 
20850
20851
  // var split = [];
20851
20852
  var var_Arr = [];
20853
+ const get_iterate_value_ret = function (fieldIdP) {
20854
+ if (!iterate_info || (iterate_info.iterator_key !== fieldIdP && iterate_info.iterator_val !== fieldIdP)) {
20855
+ return null;
20856
+ }
20857
+
20858
+ const iter_value = iterate_info.iterator_key === fieldIdP ? iterate_info._key : iterate_info._val;
20859
+ const iter_type = typeof iter_value !== 'undefined' ? {}.toString.call(iter_value).match(/\s([a-zA-Z]+)/)[1].toLowerCase() : 'string';
20860
+
20861
+ return {
20862
+ ret: {
20863
+ value: iter_value,
20864
+ type: iter_type,
20865
+ prop: ['array', 'object'].includes(iter_type) ? iter_value : null,
20866
+ },
20867
+ fieldIdP,
20868
+ currentRecordId: rowIdP,
20869
+ found: typeof iter_value !== 'undefined',
20870
+ };
20871
+ };
20852
20872
  const split = func.expression.parse(ret) || [];
20853
20873
  // console.log(valP, split);
20854
20874
  const split_entries = Object.entries(split);
@@ -20945,7 +20965,7 @@ func.expression.get = async function (SESSION_ID, valP, dsSessionP, sourceP, row
20945
20965
  } // put default
20946
20966
  fields[val.fieldId] = var_Arr[key].value;
20947
20967
 
20948
- const ret = await func.datasource.get_value(SESSION_ID, val.fieldId, dsSessionP, rowIdP); // find field in dataSources
20968
+ const ret = get_iterate_value_ret(val.fieldId) || (await func.datasource.get_value(SESSION_ID, val.fieldId, dsSessionP, rowIdP)); // find field in dataSources
20949
20969
 
20950
20970
  await replace_value_in_string(ret.ret, ret.fieldIdP);
20951
20971
  }