@xuda.io/runtime-bundle 1.0.714 → 1.0.715

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.
@@ -30870,7 +30870,7 @@ func.datasource.get_args_property_value = async function (SESSION_ID, dsSession,
30870
30870
  return _value;
30871
30871
  };
30872
30872
  func.UI.screen = {};
30873
- func.UI.screen.init = async function (SESSION_ID, prog_id, sourceScreenP, callingDataSource_objP, $callingContainerP, triggerIdP, rowIdP, jobNoP, is_panelP, parameters_obj_inP, source_functionP, call_screen_propertiesP, refreshed_ds) {
30873
+ func.UI.screen.init = async function (SESSION_ID, prog_id, sourceScreenP, callingDataSource_objP, $callingContainerP, triggerIdP, rowIdP, jobNoP, is_panelP, parameters_obj_inP, source_functionP, call_screen_propertiesP, refreshed_ds, parameters_raw_obj) {
30874
30874
  if (!prog_id) return console.error('program is empty');
30875
30875
  let screen_ret = await func.utils.get_screen_obj(SESSION_ID, prog_id);
30876
30876
  if (!screen_ret) return console.error('program is not a screen object');
@@ -30923,6 +30923,7 @@ func.UI.screen.init = async function (SESSION_ID, prog_id, sourceScreenP, callin
30923
30923
  screenInfo,
30924
30924
  call_screen_propertiesP,
30925
30925
  parentDataSourceNoP: _session.DS_GLB?.[callingDataSource_objP?.dsSession]?.dsSession || callingDataSource_objP?.parentDataSourceNo || 0,
30926
+ parameters_raw_obj,
30926
30927
  };
30927
30928
 
30928
30929
  switch (screen_type) {
@@ -31089,7 +31090,7 @@ func.UI.screen.init = async function (SESSION_ID, prog_id, sourceScreenP, callin
31089
31090
  rowIdP,
31090
31091
  jobNoP,
31091
31092
  null,
31092
- null,
31093
+ parameters_raw_obj,
31093
31094
  null,
31094
31095
  null,
31095
31096
  null,
@@ -31550,71 +31551,71 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
31550
31551
  }
31551
31552
  };
31552
31553
 
31553
- // check the main program
31554
- if (fields_changed_datasource) {
31555
- const _session = SESSION_OBJ[SESSION_ID];
31556
- const _ds = _session.DS_GLB[fields_changed_datasource];
31557
- const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, _ds.prog_id);
31558
- if (prog_doc.progUi) {
31559
- validate_change(prog_doc, null, true);
31560
- if (found) {
31561
- const $elm = $(`#container_${_ds.prog_id}_0`);
31562
- if ($elm?.length) {
31563
- const elm_data = $elm.data();
31564
- const $wrapper = $elm.parent();
31565
- // const wrapper_data = $wrapper.data();
31566
- const refreshed_ds = _ds.dsSession;
31567
-
31568
- // let elm_to_delete = [];
31569
- // const ts = Date.now();
31570
- // $.each($elm.find('xu-root-component-' + SESSION_ID).find('*'), function (key, val) {
31571
- // let xu_ui_id = $(val).attr('xu-ui-id');
31572
- // if (xu_ui_id) {
31573
- // let new_id = xu_ui_id + ts;
31574
- // elm_to_delete.push(new_id);
31575
-
31576
- // $(val).attr('xu-ui-id', new_id).removeData();
31577
- // }
31578
- // // else {
31579
- // // $(val).remove();
31580
- // // }
31581
- // });
31582
-
31583
- $elm.empty();
31584
- if ($elm.data()) {
31585
- const new_$div = await func.UI.screen.render_ui_tree(
31586
- SESSION_ID,
31587
- $elm, // the wrapper
31588
- _.cloneDeep($elm.data().xuData.node), // the xu-panel node
31589
- {},
31590
- elm_data.xuData.paramsP, // the wrapper params
31591
- null,
31592
- null,
31593
- elm_data.xuData.key, // the wrapper key
31594
- refreshed_ds, // the refreshed_ds
31595
- elm_data.xuData.parent_node, // the wrapper parent node
31596
- null,
31597
- elm_data.xuData.$root_container, // the wrapper root container
31598
- );
31599
-
31600
- // // remove old screen content
31601
- // $.each(elm_to_delete, async function (key, val) {
31602
- // $("[xu-ui-id='" + elm_to_delete + "']").remove();
31603
- // });
31604
-
31605
- if (_session.engine_mode === 'live_preview') {
31606
- console.info('========= refresh main info ==============');
31607
- console.info('reason:', refresh_reason);
31608
- console.info('element:', $elm);
31609
- console.info('==========================================');
31610
- }
31611
-
31612
- return;
31613
- }
31614
- }
31615
- }
31616
- }
31617
- }
31554
+ // // check the main program
31555
+ // if (fields_changed_datasource) {
31556
+ // const _session = SESSION_OBJ[SESSION_ID];
31557
+ // const _ds = _session.DS_GLB[fields_changed_datasource];
31558
+ // const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, _ds.prog_id);
31559
+ // if (prog_doc.progUi) {
31560
+ // validate_change(prog_doc, null, true);
31561
+ // if (found) {
31562
+ // const $elm = $(`#container_${_ds.prog_id}_0`);
31563
+ // if ($elm?.length) {
31564
+ // const elm_data = $elm.data();
31565
+ // const $wrapper = $elm.parent();
31566
+ // // const wrapper_data = $wrapper.data();
31567
+ // const refreshed_ds = _ds.dsSession;
31568
+
31569
+ // // let elm_to_delete = [];
31570
+ // // const ts = Date.now();
31571
+ // // $.each($elm.find('xu-root-component-' + SESSION_ID).find('*'), function (key, val) {
31572
+ // // let xu_ui_id = $(val).attr('xu-ui-id');
31573
+ // // if (xu_ui_id) {
31574
+ // // let new_id = xu_ui_id + ts;
31575
+ // // elm_to_delete.push(new_id);
31576
+
31577
+ // // $(val).attr('xu-ui-id', new_id).removeData();
31578
+ // // }
31579
+ // // // else {
31580
+ // // // $(val).remove();
31581
+ // // // }
31582
+ // // });
31583
+
31584
+ // $elm.empty();
31585
+ // if ($elm.data()) {
31586
+ // const new_$div = await func.UI.screen.render_ui_tree(
31587
+ // SESSION_ID,
31588
+ // $elm, // the wrapper
31589
+ // _.cloneDeep($elm.data().xuData.node), // the xu-panel node
31590
+ // {},
31591
+ // elm_data.xuData.paramsP, // the wrapper params
31592
+ // null,
31593
+ // null,
31594
+ // elm_data.xuData.key, // the wrapper key
31595
+ // refreshed_ds, // the refreshed_ds
31596
+ // elm_data.xuData.parent_node, // the wrapper parent node
31597
+ // null,
31598
+ // elm_data.xuData.$root_container, // the wrapper root container
31599
+ // );
31600
+
31601
+ // // // remove old screen content
31602
+ // // $.each(elm_to_delete, async function (key, val) {
31603
+ // // $("[xu-ui-id='" + elm_to_delete + "']").remove();
31604
+ // // });
31605
+
31606
+ // if (_session.engine_mode === 'live_preview') {
31607
+ // console.info('========= refresh main info ==============');
31608
+ // console.info('reason:', refresh_reason);
31609
+ // console.info('element:', $elm);
31610
+ // console.info('==========================================');
31611
+ // }
31612
+
31613
+ // return;
31614
+ // }
31615
+ // }
31616
+ // }
31617
+ // }
31618
+ // }
31618
31619
 
31619
31620
  const panels_obj = await func.UI.utils.get_panels_wrapper_from_dom(SESSION_ID, $(SESSION_OBJ[SESSION_ID].root_element), false);
31620
31621
 
@@ -31865,43 +31866,32 @@ const get_params_obj_new = async function (SESSION_ID, prog_id, nodeP, dsSession
31865
31866
  if (!_prog) return;
31866
31867
 
31867
31868
  // get in parameters
31868
- var params_obj = {};
31869
+ let params_res = {},
31870
+ params_raw = {};
31869
31871
  if (_prog?.properties?.progParams) {
31870
31872
  for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
31871
31873
  if (!['in', 'out'].includes(val.data.dir)) continue;
31872
31874
 
31873
31875
  if (nodeP.attributes) {
31874
31876
  if (nodeP.attributes[val.data.parameter]) {
31875
- params_obj[val.data.parameter] = nodeP.attributes[val.data.parameter];
31877
+ params_res[val.data.parameter] = nodeP.attributes[val.data.parameter];
31876
31878
  } else if (nodeP.attributes[`xu-exp:${val.data.parameter}`]) {
31877
31879
  if (val.data.dir == 'out') {
31878
31880
  // only reference
31879
- params_obj[val.data.parameter] = nodeP.attributes[`xu-exp:${val.data.parameter}`].replaceAll('@', '');
31881
+ params_res[val.data.parameter] = nodeP.attributes[`xu-exp:${val.data.parameter}`].replaceAll('@', '');
31880
31882
  } else {
31881
31883
  // in parameter
31882
31884
  let ret = await func.expression.get(SESSION_ID, nodeP.attributes[`xu-exp:${val.data.parameter}`], dsSession, 'parameters');
31883
- params_obj[val.data.parameter] = ret.result;
31885
+ params_res[val.data.parameter] = ret.result;
31886
+ params_raw[val.data.parameter] = nodeP.attributes[`xu-exp:${val.data.parameter}`];
31884
31887
  }
31885
31888
  }
31886
-
31887
- // if (parameters_obj_inP?.[val.data.parameter].fx) {
31888
- // let ret = await func.expression.get(
31889
- // SESSION_ID,
31890
- // parameters_obj_inP?.[val.data.parameter].fx,
31891
- // dsSession,
31892
- // "parameters"
31893
- // );
31894
- // params_obj[val.data.parameter] = ret.result;
31895
- // } else {
31896
- // params_obj[val.data.parameter] =
31897
- // parameters_obj_inP?.[val.data.parameter].value;
31898
- // }
31899
31889
  continue;
31900
31890
  }
31901
31891
  console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
31902
31892
  }
31903
31893
  }
31904
- return params_obj;
31894
+ return { params_res, params_raw };
31905
31895
  };
31906
31896
 
31907
31897
  func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, xu_func, $elm, val, is_init, refreshed_ds) {
@@ -31918,8 +31908,8 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
31918
31908
  const init_program = async function () {
31919
31909
  async function render_panel() {
31920
31910
  const prog_id = val.value?.prog || val.value;
31921
- const param_obj = await get_params_obj_new(SESSION_ID, prog_id, nodeP, paramsP.dsSessionP);
31922
- let ret_panel = await func.UI.screen.init(SESSION_ID, prog_id, paramsP.screenId, _ds, $elm, null, _ds.currentRecordId, null, true, param_obj, 'initXu_panel', undefined, prog_id !== _ds.prog_id ? null : refreshed_ds);
31911
+ const params_obj = await get_params_obj_new(SESSION_ID, prog_id, nodeP, paramsP.dsSessionP);
31912
+ let ret_panel = await func.UI.screen.init(SESSION_ID, prog_id, paramsP.screenId, _ds, $elm, null, _ds.currentRecordId, null, true, params_obj.params_res, 'initXu_panel', undefined, prog_id !== _ds.prog_id ? null : refreshed_ds, params_obj.params_raw);
31923
31913
  ret = { $new_div: ret_panel };
31924
31914
  $container.data().xuData.xuPanelProps = $elm.data().xuAttributes;
31925
31915
  $container.data().xuData.xuPanelData = ret_panel.data();
@@ -31968,8 +31958,8 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
31968
31958
  const program = val.value?.prog || val.value;
31969
31959
  var $wrapper = $('<div>');
31970
31960
  var $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, nodeP.attributes, null, null, null, $wrapper, '');
31971
- const param_obj = await get_params_obj_new(SESSION_ID, program, nodeP, paramsP.dsSessionP);
31972
- let ret_init = await func.UI.screen.init(SESSION_ID, program, paramsP.screenId, _ds, $div, null, _ds.currentRecordId, jobNoP, true, param_obj, 'alterXu_panel');
31961
+ const params_obj = await get_params_obj_new(SESSION_ID, program, nodeP, paramsP.dsSessionP);
31962
+ let ret_init = await func.UI.screen.init(SESSION_ID, program, paramsP.screenId, _ds, $div, null, _ds.currentRecordId, jobNoP, true, params_obj.params_res, 'alterXu_panel', undefined, undefined, params_obj.params_raw);
31973
31963
  ret = {
31974
31964
  $new_div: ret_init,
31975
31965
  abort: true,