@xuda.io/runtime-bundle 1.0.716 → 1.0.718

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, parameters_raw_obj) {
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) {
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,7 +30923,6 @@ 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,
30927
30926
  };
30928
30927
 
30929
30928
  switch (screen_type) {
@@ -31090,7 +31089,7 @@ func.UI.screen.init = async function (SESSION_ID, prog_id, sourceScreenP, callin
31090
31089
  rowIdP,
31091
31090
  jobNoP,
31092
31091
  null,
31093
- parameters_raw_obj,
31092
+ null,
31094
31093
  null,
31095
31094
  null,
31096
31095
  null,
@@ -31469,7 +31468,7 @@ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, j
31469
31468
  }
31470
31469
  };
31471
31470
 
31472
- func.UI.screen.refresh_screen_bad = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
31471
+ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
31473
31472
  var found, refresh_reason, refresh_details;
31474
31473
  const validate_change = function (prog_doc, panelXuAttributes, skip_ui_check) {
31475
31474
  found = null;
@@ -31697,200 +31696,212 @@ func.UI.screen.refresh_screen_bad = async function (SESSION_ID, fields_changed_a
31697
31696
  }
31698
31697
  };
31699
31698
 
31700
- func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
31701
- // check the main program
31702
- if (fields_changed_datasource) {
31703
- const _session = SESSION_OBJ[SESSION_ID];
31704
- const _ds = _session.DS_GLB[fields_changed_datasource];
31705
- const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, _ds.prog_id);
31706
- const progDataSource_str = JSON.stringify(prog_doc.progDataSource);
31707
- for (const field_id of fields_changed_arr || []) {
31708
- }
31709
- }
31710
-
31711
- const panels_obj = await func.UI.utils.get_panels_wrapper_from_dom(SESSION_ID, $(SESSION_OBJ[SESSION_ID].root_element), false);
31712
-
31713
- for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
31714
- const progDataSource_str = JSON.stringify(panel_val.prog_doc.progDataSource);
31715
-
31716
- var found, refresh_reason, refresh_details;
31717
- if (fields_changed_arr) {
31718
- if (fields_changed_datasource && panel_val._ds.dsSession <= Number(fields_changed_datasource)) {
31719
- continue;
31720
- }
31721
- for (const field_id of fields_changed_arr) {
31722
- // get panel attributes
31723
- const _attributes = panel_val?.panelXuAttributes || {};
31699
+ // func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
31700
+ // // check the main program
31701
+ // if (fields_changed_datasource) {
31702
+ // const _session = SESSION_OBJ[SESSION_ID];
31703
+ // const _ds = _session.DS_GLB[fields_changed_datasource];
31704
+ // const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, _ds.prog_id);
31705
+ // const progDataSource_str = JSON.stringify(prog_doc.progDataSource);
31706
+ // for (const field_id of fields_changed_arr || []) {
31724
31707
 
31725
- // detect if program changed
31726
- found = _attributes['xu-exp:program']?.includes('@' + field_id);
31708
+ // }
31709
+ // }
31727
31710
 
31728
- if (found) {
31729
- refresh_reason = `program ${_attributes['xu-exp:program']} ${field_id} changed `;
31730
- refresh_details = _attributes;
31731
- break;
31732
- }
31711
+ // const panels_obj = await func.UI.utils.get_panels_wrapper_from_dom(SESSION_ID, $(SESSION_OBJ[SESSION_ID].root_element), false);
31733
31712
 
31734
- // _attributes holds also info of parameters in code_in: @code
31735
- // search field changed in panel call send parameters exp
31736
- for (const [attr, value] of Object.entries(_attributes)) {
31737
- const pattern = /xu-exp:(\w+)/;
31738
- const match = attr.match(pattern);
31713
+ // for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
31714
+ // const progDataSource_str = JSON.stringify(panel_val.prog_doc.progDataSource);
31739
31715
 
31740
- if (!match) {
31741
- // continue if attribute is not expression
31742
- continue;
31743
- }
31744
- // code_in
31745
- const parameter_in_field_id = match?.[1];
31746
- // @code
31747
- if (value.includes(field_id)) {
31748
- // search parameter in field in the target program's progDataSource
31749
- found = progDataSource_str?.includes('@' + parameter_in_field_id);
31716
+ // var found, refresh_reason, refresh_details;
31717
+ // if (fields_changed_arr) {
31718
+ // if (fields_changed_datasource && panel_val._ds.dsSession <= Number(fields_changed_datasource)) {
31719
+ // continue;
31720
+ // }
31721
+ // for (const field_id of fields_changed_arr) {
31722
+ // // get panel attributes
31723
+ // const _attributes = panel_val?.panelXuAttributes || {};
31750
31724
 
31751
- if (found) {
31752
- refresh_reason = `field ${field_id} in progDataSource parameter_in changed`;
31753
- refresh_details = panel_val?.prog_doc?.progDataSource;
31725
+ // // detect if program changed
31726
+ // found = _attributes['xu-exp:program']?.includes('@' + field_id);
31754
31727
 
31755
- break;
31756
- }
31728
+ // if (found) {
31729
+ // refresh_reason = `program ${_attributes['xu-exp:program']} ${field_id} changed `;
31730
+ // refresh_details = _attributes;
31731
+ // break;
31732
+ // }
31757
31733
 
31758
- // found = find_field_in_progUi(prog_doc.progUi, parameter_in_field_id, 'xu-for');
31759
- found = func.UI.find_field_in_progUi_attributes(panel_val.prog_doc.progUi, parameter_in_field_id, 'xu-for').length;
31734
+ // // _attributes holds also info of parameters in code_in: @code
31735
+ // // search field changed in panel call send parameters exp
31736
+ // for (const [attr, value] of Object.entries(_attributes)) {
31737
+ // const pattern = /xu-exp:(\w+)/;
31738
+ // const match = attr.match(pattern);
31760
31739
 
31761
- if (found) {
31762
- refresh_reason = `field ${field_id} in progUi xu-for parameter_in changed`;
31763
- refresh_details = found;
31740
+ // if (!match) {
31741
+ // // continue if attribute is not expression
31742
+ // continue;
31743
+ // }
31744
+ // // code_in
31745
+ // const parameter_in_field_id = match?.[1];
31746
+ // // @code
31747
+ // if (value.includes(field_id)) {
31748
+ // // search parameter in field in the target program's progDataSource
31749
+ // found = progDataSource_str?.includes('@' + parameter_in_field_id);
31750
+
31751
+ // if (found) {
31752
+ // refresh_reason = `field ${field_id} in progDataSource parameter_in changed`;
31753
+ // refresh_details = panel_val?.prog_doc?.progDataSource;
31754
+
31755
+ // break;
31756
+ // }
31764
31757
 
31765
- break;
31766
- }
31767
- }
31768
- }
31758
+ // // found = find_field_in_progUi(prog_doc.progUi, parameter_in_field_id, 'xu-for');
31759
+ // found = func.UI.find_field_in_progUi_attributes(panel_val.prog_doc.progUi, parameter_in_field_id, 'xu-for').length;
31769
31760
 
31770
- if (found) break;
31761
+ // if (found) {
31762
+ // refresh_reason = `field ${field_id} in progUi xu-for parameter_in changed`;
31763
+ // refresh_details = found;
31771
31764
 
31772
- // search field changed in the target program's progDataSource // @code
31773
- found = progDataSource_str?.includes('@' + field_id);
31774
- if (found) {
31775
- refresh_reason = `field ${field_id} in progDataSource changed`;
31776
- refresh_details = panel_val?.prog_doc?.progDataSource;
31765
+ // break;
31766
+ // }
31767
+ // }
31768
+ // }
31777
31769
 
31778
- break;
31779
- }
31770
+ // if (found) break;
31780
31771
 
31781
- found = func.UI.find_field_in_progUi_attributes(panel_val.prog_doc.progUi, field_id, 'xu-for').length;
31782
- if (found) {
31783
- refresh_reason = `field ${field_id} in progUi xu-for changed`;
31784
- refresh_details = found;
31772
+ // // search field changed in the target program's progDataSource // @code
31773
+ // found = progDataSource_str?.includes('@' + field_id);
31774
+ // if (found) {
31775
+ // refresh_reason = `field ${field_id} in progDataSource changed`;
31776
+ // refresh_details = panel_val?.prog_doc?.progDataSource;
31785
31777
 
31786
- break;
31787
- }
31778
+ // break;
31779
+ // }
31788
31780
 
31789
- if (found) {
31790
- break;
31791
- }
31792
- }
31793
- }
31781
+ // found = func.UI.find_field_in_progUi_attributes(panel_val.prog_doc.progUi, field_id, 'xu-for').length;
31782
+ // if (found) {
31783
+ // refresh_reason = `field ${field_id} in progUi xu-for changed`;
31784
+ // refresh_details = found;
31794
31785
 
31795
- if (datasource_changed) {
31796
- if (panel_val._ds.dsSession == datasource_changed) {
31797
- refresh_reason = `panel datasource ${datasource_changed} changed`;
31798
- refresh_details = '';
31786
+ // break;
31787
+ // }
31799
31788
 
31800
- found = true;
31801
- }
31802
- }
31803
- if (found) {
31804
- const _session = SESSION_OBJ[SESSION_ID];
31805
- if (_session.engine_mode === 'live_preview') {
31806
- console.info('========= refresh info ==============');
31807
- console.info('reason:', refresh_reason);
31808
- console.info('details:', refresh_details);
31809
- console.info('panel:', panel_val);
31810
- console.info('=====================================');
31811
- }
31812
- const $div_elm = panel_val.$panel_div;
31813
- const wrapper_data = $div_elm.data();
31789
+ // if (found) {
31790
+ // break;
31791
+ // }
31792
+ // }
31793
+ // }
31814
31794
 
31815
- if (_.isEmpty(wrapper_data)) continue;
31795
+ // if (datasource_changed) {
31796
+ // if (panel_val._ds.dsSession == datasource_changed) {
31797
+ // refresh_reason = `panel datasource ${datasource_changed} changed`;
31798
+ // refresh_details = '';
31816
31799
 
31817
- try {
31818
- const ts = Date.now();
31819
- // remove old panel content
31820
- $.each(panel_val.ids, async function (key, val) {
31821
- $("[xu-ui-id='" + val + "']")
31822
- .attr('xu-ui-id', val + ts)
31823
- .removeData();
31824
- });
31800
+ // found = true;
31801
+ // }
31802
+ // }
31803
+ // if (found) {
31804
+ // const _session = SESSION_OBJ[SESSION_ID];
31805
+ // if (_session.engine_mode === 'live_preview') {
31806
+ // console.info('========= refresh info ==============');
31807
+ // console.info('reason:', refresh_reason);
31808
+ // console.info('details:', refresh_details);
31809
+ // console.info('panel:', panel_val);
31810
+ // console.info('=====================================');
31811
+ // }
31812
+ // const $div_elm = panel_val.$panel_div;
31813
+ // const wrapper_data = $div_elm.data();
31814
+
31815
+ // if (_.isEmpty(wrapper_data)) continue;
31816
+
31817
+ // try {
31818
+ // const ts = Date.now();
31819
+ // // remove old panel content
31820
+ // $.each(panel_val.ids, async function (key, val) {
31821
+ // $("[xu-ui-id='" + val + "']")
31822
+ // .attr('xu-ui-id', val + ts)
31823
+ // .removeData();
31824
+ // });
31825
31825
 
31826
- let refreshed_ds;
31827
- // check if ds exist and deleted by garbage collector
31826
+ // let refreshed_ds;
31827
+ // // check if ds exist and deleted by garbage collector
31828
31828
 
31829
- if (_session.DS_GLB[panel_val._ds.dsSession]) {
31830
- refreshed_ds = panel_val._ds.dsSession;
31831
- }
31832
- for await (const item of wrapper_data.xuData.node_org.children) {
31833
- if (item.tagName !== 'xu-panel') continue;
31829
+ // if (_session.DS_GLB[panel_val._ds.dsSession]) {
31830
+ // refreshed_ds = panel_val._ds.dsSession;
31831
+ // }
31832
+ // for await (const item of wrapper_data.xuData.node_org.children) {
31833
+ // if (item.tagName !== 'xu-panel') continue;
31834
31834
 
31835
- const new_$div = await func.UI.screen.render_ui_tree(
31836
- SESSION_ID,
31837
- $div_elm, // the wrapper
31838
- _.cloneDeep(item), // _.cloneDeep(wrapper_data.xuData.node_org.children[0]), // the xu-panel node
31839
- {},
31840
- wrapper_data.xuData.paramsP, // the wrapper params
31841
- null,
31842
- null,
31843
- wrapper_data.xuData.key, // the wrapper key
31844
- refreshed_ds, // the refreshed_ds
31845
- wrapper_data.xuData.parent_node, // the wrapper parent node
31846
- null,
31847
- wrapper_data.xuData.$root_container, // the wrapper root container
31848
- );
31849
- }
31835
+ // const new_$div = await func.UI.screen.render_ui_tree(
31836
+ // SESSION_ID,
31837
+ // $div_elm, // the wrapper
31838
+ // _.cloneDeep(item), // _.cloneDeep(wrapper_data.xuData.node_org.children[0]), // the xu-panel node
31839
+ // {},
31840
+ // wrapper_data.xuData.paramsP, // the wrapper params
31841
+ // null,
31842
+ // null,
31843
+ // wrapper_data.xuData.key, // the wrapper key
31844
+ // refreshed_ds, // the refreshed_ds
31845
+ // wrapper_data.xuData.parent_node, // the wrapper parent node
31846
+ // null,
31847
+ // wrapper_data.xuData.$root_container, // the wrapper root container
31848
+ // );
31849
+ // }
31850
31850
 
31851
- // remove old panel content
31852
- $.each(panel_val.ids, async function (key, val) {
31853
- $("[xu-ui-id='" + val + ts + "']").remove();
31854
- });
31855
- } catch (error) {
31856
- debugger;
31857
- }
31858
- // continue;
31859
- }
31860
- }
31861
- };
31851
+ // // remove old panel content
31852
+ // $.each(panel_val.ids, async function (key, val) {
31853
+ // $("[xu-ui-id='" + val + ts + "']").remove();
31854
+ // });
31855
+ // } catch (error) {
31856
+ // debugger;
31857
+ // }
31858
+ // // continue;
31859
+ // }
31860
+ // }
31861
+ // };
31862
31862
 
31863
31863
  const get_params_obj_new = async function (SESSION_ID, prog_id, nodeP, dsSession) {
31864
31864
  const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);
31865
31865
  if (!_prog) return;
31866
31866
 
31867
31867
  // get in parameters
31868
- let params_res = {},
31869
- params_raw = {};
31868
+ var params_obj = {};
31870
31869
  if (_prog?.properties?.progParams) {
31871
31870
  for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
31872
31871
  if (!['in', 'out'].includes(val.data.dir)) continue;
31873
31872
 
31874
31873
  if (nodeP.attributes) {
31875
31874
  if (nodeP.attributes[val.data.parameter]) {
31876
- params_res[val.data.parameter] = nodeP.attributes[val.data.parameter];
31875
+ params_obj[val.data.parameter] = nodeP.attributes[val.data.parameter];
31877
31876
  } else if (nodeP.attributes[`xu-exp:${val.data.parameter}`]) {
31878
31877
  if (val.data.dir == 'out') {
31879
31878
  // only reference
31880
- params_res[val.data.parameter] = nodeP.attributes[`xu-exp:${val.data.parameter}`].replaceAll('@', '');
31879
+ params_obj[val.data.parameter] = nodeP.attributes[`xu-exp:${val.data.parameter}`].replaceAll('@', '');
31881
31880
  } else {
31882
31881
  // in parameter
31883
31882
  let ret = await func.expression.get(SESSION_ID, nodeP.attributes[`xu-exp:${val.data.parameter}`], dsSession, 'parameters');
31884
- params_res[val.data.parameter] = ret.result;
31885
- params_raw[val.data.parameter] = nodeP.attributes[`xu-exp:${val.data.parameter}`];
31883
+ params_obj[val.data.parameter] = ret.result;
31886
31884
  }
31887
31885
  }
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
+ // }
31888
31899
  continue;
31889
31900
  }
31890
31901
  console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
31891
31902
  }
31892
31903
  }
31893
- return { params_res, params_raw };
31904
+ return params_obj;
31894
31905
  };
31895
31906
 
31896
31907
  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) {
@@ -31907,8 +31918,8 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
31907
31918
  const init_program = async function () {
31908
31919
  async function render_panel() {
31909
31920
  const prog_id = val.value?.prog || val.value;
31910
- const params_obj = await get_params_obj_new(SESSION_ID, prog_id, nodeP, paramsP.dsSessionP);
31911
- 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);
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);
31912
31923
  ret = { $new_div: ret_panel };
31913
31924
  $container.data().xuData.xuPanelProps = $elm.data().xuAttributes;
31914
31925
  $container.data().xuData.xuPanelData = ret_panel.data();
@@ -31957,8 +31968,8 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
31957
31968
  const program = val.value?.prog || val.value;
31958
31969
  var $wrapper = $('<div>');
31959
31970
  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, '');
31960
- const params_obj = await get_params_obj_new(SESSION_ID, program, nodeP, paramsP.dsSessionP);
31961
- 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);
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');
31962
31973
  ret = {
31963
31974
  $new_div: ret_init,
31964
31975
  abort: true,