@xuda.io/runtime-bundle 1.0.719 → 1.0.721

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.
@@ -28009,7 +28009,7 @@ func.datasource.create = async function (
28009
28009
  rowIdP,
28010
28010
  jobNoP,
28011
28011
  calling_trigger_prop,
28012
- screen_param,
28012
+ parameters_raw_obj,
28013
28013
  NA_isInitP,
28014
28014
  NA_callingSourceP,
28015
28015
  calling_jobP,
@@ -28042,6 +28042,7 @@ func.datasource.create = async function (
28042
28042
  parameters_obj_inP,
28043
28043
  static_refreshP,
28044
28044
  worker_id,
28045
+ parameters_raw_obj,
28045
28046
  };
28046
28047
 
28047
28048
  var IS_DATASOURCE_REFRESH = null;
@@ -28177,7 +28178,7 @@ func.datasource.create = async function (
28177
28178
  args.rowIdP,
28178
28179
  args.jobNoP,
28179
28180
  args.calling_trigger_prop,
28180
- null,
28181
+ args.parameters_raw_obj,
28181
28182
  null,
28182
28183
  null,
28183
28184
  args.calling_jobP,
@@ -28218,7 +28219,7 @@ func.datasource.create = async function (
28218
28219
  return done(SESSION_ID, jsonP.dsSession, true);
28219
28220
  });
28220
28221
  };
28221
- func.datasource.prepare = async function (SESSION_ID, prog_id, dataSourceNoP, parentDataSourceNoP, containerIdP, rowIdP, jobNoP, calling_trigger_prop, NA_screen_param, NA_isInitP, callingSourceP, calling_jobP, NA_screen_dsP, is_panelP, parameters_obj_inP, static_refreshP, run_atP, worker_id) {
28222
+ func.datasource.prepare = async function (SESSION_ID, prog_id, dataSourceNoP, parentDataSourceNoP, containerIdP, rowIdP, jobNoP, calling_trigger_prop, parameters_raw_obj, NA_isInitP, callingSourceP, calling_jobP, NA_screen_dsP, is_panelP, parameters_obj_inP, static_refreshP, run_atP, worker_id) {
28222
28223
  const set_parameters = async function () {
28223
28224
  var _session = SESSION_OBJ[SESSION_ID];
28224
28225
  const get_Out_parameters = async function (fieldIdP, located_field_param_idxP, param_row_idP) {
@@ -28347,6 +28348,7 @@ func.datasource.prepare = async function (SESSION_ID, prog_id, dataSourceNoP, pa
28347
28348
  static_refreshP,
28348
28349
  run_atP,
28349
28350
  worker_id,
28351
+ parameters_raw_obj,
28350
28352
  };
28351
28353
 
28352
28354
  var dataSourceSession = null;
@@ -29265,7 +29267,7 @@ func.datasource.run_events_functions = async function (SESSION_ID, dataSourceSes
29265
29267
  clearInterval(interval);
29266
29268
  resolve(job_num);
29267
29269
  }
29268
- if (i > 20) {
29270
+ if (i > 50) {
29269
29271
  console.error('deadlock detected');
29270
29272
  clearInterval(interval);
29271
29273
  resolve(job_num);
@@ -30003,6 +30005,18 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
30003
30005
 
30004
30006
  if (!fields_changed.includes(field_id)) {
30005
30007
  fields_changed.push(field_id);
30008
+
30009
+ ///// REFRESH PARAMETERS IN
30010
+ // for (const [_dsSession, _ds] of Object.entries(_session.DS_GLB)) {
30011
+ // if (_ds.args.parameters_raw_obj) {
30012
+ // for (const [key, exp] of Object.entries(_ds.args.parameters_raw_obj)) {
30013
+ // if (exp.includes(field_id)) {
30014
+ // let ret = await func.expression.get(SESSION_ID, exp, _dsSession, 'parameters');
30015
+ // _ds.in_parameters[key].value = ret.result;
30016
+ // }
30017
+ // }
30018
+ // }
30019
+ // }
30006
30020
  }
30007
30021
  if (!datasource_changed.includes(dataSource)) {
30008
30022
  datasource_changed.push(dataSource);
@@ -30049,6 +30063,19 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
30049
30063
  datasource_changed[0], // refresh the current datasource only
30050
30064
  );
30051
30065
  }
30066
+ // ///// REFRESH PARAMETERS IN
30067
+ // if (fields_changed.length) {
30068
+ // for (const [_dsSession, _ds] of Object.entries(_session.DS_GLB)) {
30069
+ // if (_ds.args.parameters_raw_obj) {
30070
+ // for (const [key, val] of Object.entries(_ds.args.parameters_raw_obj)) {
30071
+ // if (fields_changed.includes(val)) {
30072
+ // let ret = await func.expression.get(SESSION_ID, '@' + val, _dsSession, 'parameters');
30073
+ // _ds.in_parameters[val].value = ret.result;
30074
+ // }
30075
+ // }
30076
+ // }
30077
+ // }
30078
+ // }
30052
30079
  }
30053
30080
  resolve();
30054
30081
  });
@@ -30843,7 +30870,7 @@ func.datasource.get_args_property_value = async function (SESSION_ID, dsSession,
30843
30870
  return _value;
30844
30871
  };
30845
30872
  func.UI.screen = {};
30846
- 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) {
30847
30874
  if (!prog_id) return console.error('program is empty');
30848
30875
  let screen_ret = await func.utils.get_screen_obj(SESSION_ID, prog_id);
30849
30876
  if (!screen_ret) return console.error('program is not a screen object');
@@ -30896,6 +30923,7 @@ func.UI.screen.init = async function (SESSION_ID, prog_id, sourceScreenP, callin
30896
30923
  screenInfo,
30897
30924
  call_screen_propertiesP,
30898
30925
  parentDataSourceNoP: _session.DS_GLB?.[callingDataSource_objP?.dsSession]?.dsSession || callingDataSource_objP?.parentDataSourceNo || 0,
30926
+ parameters_raw_obj,
30899
30927
  };
30900
30928
 
30901
30929
  switch (screen_type) {
@@ -31062,7 +31090,7 @@ func.UI.screen.init = async function (SESSION_ID, prog_id, sourceScreenP, callin
31062
31090
  rowIdP,
31063
31091
  jobNoP,
31064
31092
  null,
31065
- null,
31093
+ parameters_raw_obj,
31066
31094
  null,
31067
31095
  null,
31068
31096
  null,
@@ -31669,212 +31697,200 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
31669
31697
  }
31670
31698
  };
31671
31699
 
31672
- // func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
31673
- // // check the main program
31674
- // if (fields_changed_datasource) {
31675
- // const _session = SESSION_OBJ[SESSION_ID];
31676
- // const _ds = _session.DS_GLB[fields_changed_datasource];
31677
- // const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, _ds.prog_id);
31678
- // const progDataSource_str = JSON.stringify(prog_doc.progDataSource);
31679
- // for (const field_id of fields_changed_arr || []) {
31700
+ func.UI.screen.refresh_screen_old = 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
+ }
31680
31710
 
31681
- // }
31682
- // }
31711
+ const panels_obj = await func.UI.utils.get_panels_wrapper_from_dom(SESSION_ID, $(SESSION_OBJ[SESSION_ID].root_element), false);
31683
31712
 
31684
- // const panels_obj = await func.UI.utils.get_panels_wrapper_from_dom(SESSION_ID, $(SESSION_OBJ[SESSION_ID].root_element), false);
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);
31685
31715
 
31686
- // for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
31687
- // const progDataSource_str = JSON.stringify(panel_val.prog_doc.progDataSource);
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 || {};
31688
31724
 
31689
- // var found, refresh_reason, refresh_details;
31690
- // if (fields_changed_arr) {
31691
- // if (fields_changed_datasource && panel_val._ds.dsSession <= Number(fields_changed_datasource)) {
31692
- // continue;
31693
- // }
31694
- // for (const field_id of fields_changed_arr) {
31695
- // // get panel attributes
31696
- // const _attributes = panel_val?.panelXuAttributes || {};
31725
+ // detect if program changed
31726
+ found = _attributes['xu-exp:program']?.includes('@' + field_id);
31697
31727
 
31698
- // // detect if program changed
31699
- // found = _attributes['xu-exp:program']?.includes('@' + field_id);
31728
+ if (found) {
31729
+ refresh_reason = `program ${_attributes['xu-exp:program']} ${field_id} changed `;
31730
+ refresh_details = _attributes;
31731
+ break;
31732
+ }
31700
31733
 
31701
- // if (found) {
31702
- // refresh_reason = `program ${_attributes['xu-exp:program']} ${field_id} changed `;
31703
- // refresh_details = _attributes;
31704
- // break;
31705
- // }
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);
31706
31739
 
31707
- // // _attributes holds also info of parameters in code_in: @code
31708
- // // search field changed in panel call send parameters exp
31709
- // for (const [attr, value] of Object.entries(_attributes)) {
31710
- // const pattern = /xu-exp:(\w+)/;
31711
- // const match = attr.match(pattern);
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);
31712
31750
 
31713
- // if (!match) {
31714
- // // continue if attribute is not expression
31715
- // continue;
31716
- // }
31717
- // // code_in
31718
- // const parameter_in_field_id = match?.[1];
31719
- // // @code
31720
- // if (value.includes(field_id)) {
31721
- // // search parameter in field in the target program's progDataSource
31722
- // found = progDataSource_str?.includes('@' + parameter_in_field_id);
31723
-
31724
- // if (found) {
31725
- // refresh_reason = `field ${field_id} in progDataSource parameter_in changed`;
31726
- // refresh_details = panel_val?.prog_doc?.progDataSource;
31727
-
31728
- // break;
31729
- // }
31751
+ if (found) {
31752
+ refresh_reason = `field ${field_id} in progDataSource parameter_in changed`;
31753
+ refresh_details = panel_val?.prog_doc?.progDataSource;
31730
31754
 
31731
- // // found = find_field_in_progUi(prog_doc.progUi, parameter_in_field_id, 'xu-for');
31732
- // found = func.UI.find_field_in_progUi_attributes(panel_val.prog_doc.progUi, parameter_in_field_id, 'xu-for').length;
31755
+ break;
31756
+ }
31733
31757
 
31734
- // if (found) {
31735
- // refresh_reason = `field ${field_id} in progUi xu-for parameter_in changed`;
31736
- // refresh_details = found;
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;
31737
31760
 
31738
- // break;
31739
- // }
31740
- // }
31741
- // }
31761
+ if (found) {
31762
+ refresh_reason = `field ${field_id} in progUi xu-for parameter_in changed`;
31763
+ refresh_details = found;
31742
31764
 
31743
- // if (found) break;
31765
+ break;
31766
+ }
31767
+ }
31768
+ }
31744
31769
 
31745
- // // search field changed in the target program's progDataSource // @code
31746
- // found = progDataSource_str?.includes('@' + field_id);
31747
- // if (found) {
31748
- // refresh_reason = `field ${field_id} in progDataSource changed`;
31749
- // refresh_details = panel_val?.prog_doc?.progDataSource;
31770
+ if (found) break;
31750
31771
 
31751
- // break;
31752
- // }
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;
31753
31777
 
31754
- // found = func.UI.find_field_in_progUi_attributes(panel_val.prog_doc.progUi, field_id, 'xu-for').length;
31755
- // if (found) {
31756
- // refresh_reason = `field ${field_id} in progUi xu-for changed`;
31757
- // refresh_details = found;
31778
+ break;
31779
+ }
31758
31780
 
31759
- // break;
31760
- // }
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;
31761
31785
 
31762
- // if (found) {
31763
- // break;
31764
- // }
31765
- // }
31766
- // }
31786
+ break;
31787
+ }
31767
31788
 
31768
- // if (datasource_changed) {
31769
- // if (panel_val._ds.dsSession == datasource_changed) {
31770
- // refresh_reason = `panel datasource ${datasource_changed} changed`;
31771
- // refresh_details = '';
31789
+ if (found) {
31790
+ break;
31791
+ }
31792
+ }
31793
+ }
31772
31794
 
31773
- // found = true;
31774
- // }
31775
- // }
31776
- // if (found) {
31777
- // const _session = SESSION_OBJ[SESSION_ID];
31778
- // if (_session.engine_mode === 'live_preview') {
31779
- // console.info('========= refresh info ==============');
31780
- // console.info('reason:', refresh_reason);
31781
- // console.info('details:', refresh_details);
31782
- // console.info('panel:', panel_val);
31783
- // console.info('=====================================');
31784
- // }
31785
- // const $div_elm = panel_val.$panel_div;
31786
- // const wrapper_data = $div_elm.data();
31787
-
31788
- // if (_.isEmpty(wrapper_data)) continue;
31789
-
31790
- // try {
31791
- // const ts = Date.now();
31792
- // // remove old panel content
31793
- // $.each(panel_val.ids, async function (key, val) {
31794
- // $("[xu-ui-id='" + val + "']")
31795
- // .attr('xu-ui-id', val + ts)
31796
- // .removeData();
31797
- // });
31795
+ if (datasource_changed) {
31796
+ if (panel_val._ds.dsSession == datasource_changed) {
31797
+ refresh_reason = `panel datasource ${datasource_changed} changed`;
31798
+ refresh_details = '';
31798
31799
 
31799
- // let refreshed_ds;
31800
- // // check if ds exist and deleted by garbage collector
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();
31801
31814
 
31802
- // if (_session.DS_GLB[panel_val._ds.dsSession]) {
31803
- // refreshed_ds = panel_val._ds.dsSession;
31804
- // }
31805
- // for await (const item of wrapper_data.xuData.node_org.children) {
31806
- // if (item.tagName !== 'xu-panel') continue;
31815
+ if (_.isEmpty(wrapper_data)) continue;
31807
31816
 
31808
- // const new_$div = await func.UI.screen.render_ui_tree(
31809
- // SESSION_ID,
31810
- // $div_elm, // the wrapper
31811
- // _.cloneDeep(item), // _.cloneDeep(wrapper_data.xuData.node_org.children[0]), // the xu-panel node
31812
- // {},
31813
- // wrapper_data.xuData.paramsP, // the wrapper params
31814
- // null,
31815
- // null,
31816
- // wrapper_data.xuData.key, // the wrapper key
31817
- // refreshed_ds, // the refreshed_ds
31818
- // wrapper_data.xuData.parent_node, // the wrapper parent node
31819
- // null,
31820
- // wrapper_data.xuData.$root_container, // the wrapper root container
31821
- // );
31822
- // }
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
+ });
31823
31825
 
31824
- // // remove old panel content
31825
- // $.each(panel_val.ids, async function (key, val) {
31826
- // $("[xu-ui-id='" + val + ts + "']").remove();
31827
- // });
31828
- // } catch (error) {
31829
- // debugger;
31830
- // }
31831
- // // continue;
31832
- // }
31833
- // }
31834
- // };
31826
+ let refreshed_ds;
31827
+ // check if ds exist and deleted by garbage collector
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;
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
+ }
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
+ };
31835
31862
 
31836
31863
  const get_params_obj_new = async function (SESSION_ID, prog_id, nodeP, dsSession) {
31837
31864
  const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);
31838
31865
  if (!_prog) return;
31839
31866
 
31840
31867
  // get in parameters
31841
- var params_obj = {};
31868
+ let params_res = {},
31869
+ params_raw = {};
31842
31870
  if (_prog?.properties?.progParams) {
31843
31871
  for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
31844
31872
  if (!['in', 'out'].includes(val.data.dir)) continue;
31845
31873
 
31846
31874
  if (nodeP.attributes) {
31847
31875
  if (nodeP.attributes[val.data.parameter]) {
31848
- params_obj[val.data.parameter] = nodeP.attributes[val.data.parameter];
31876
+ params_res[val.data.parameter] = nodeP.attributes[val.data.parameter];
31849
31877
  } else if (nodeP.attributes[`xu-exp:${val.data.parameter}`]) {
31850
31878
  if (val.data.dir == 'out') {
31851
31879
  // only reference
31852
- params_obj[val.data.parameter] = nodeP.attributes[`xu-exp:${val.data.parameter}`].replaceAll('@', '');
31880
+ params_res[val.data.parameter] = nodeP.attributes[`xu-exp:${val.data.parameter}`].replaceAll('@', '');
31853
31881
  } else {
31854
31882
  // in parameter
31855
31883
  let ret = await func.expression.get(SESSION_ID, nodeP.attributes[`xu-exp:${val.data.parameter}`], dsSession, 'parameters');
31856
- params_obj[val.data.parameter] = ret.result;
31884
+ params_res[val.data.parameter] = ret.result;
31885
+ params_raw[val.data.parameter] = nodeP.attributes[`xu-exp:${val.data.parameter}`];
31857
31886
  }
31858
31887
  }
31859
-
31860
- // if (parameters_obj_inP?.[val.data.parameter].fx) {
31861
- // let ret = await func.expression.get(
31862
- // SESSION_ID,
31863
- // parameters_obj_inP?.[val.data.parameter].fx,
31864
- // dsSession,
31865
- // "parameters"
31866
- // );
31867
- // params_obj[val.data.parameter] = ret.result;
31868
- // } else {
31869
- // params_obj[val.data.parameter] =
31870
- // parameters_obj_inP?.[val.data.parameter].value;
31871
- // }
31872
31888
  continue;
31873
31889
  }
31874
31890
  console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
31875
31891
  }
31876
31892
  }
31877
- return params_obj;
31893
+ return { params_res, params_raw };
31878
31894
  };
31879
31895
 
31880
31896
  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) {
@@ -31891,8 +31907,8 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
31891
31907
  const init_program = async function () {
31892
31908
  async function render_panel() {
31893
31909
  const prog_id = val.value?.prog || val.value;
31894
- const param_obj = await get_params_obj_new(SESSION_ID, prog_id, nodeP, paramsP.dsSessionP);
31895
- 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);
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);
31896
31912
  ret = { $new_div: ret_panel };
31897
31913
  $container.data().xuData.xuPanelProps = $elm.data().xuAttributes;
31898
31914
  $container.data().xuData.xuPanelData = ret_panel.data();
@@ -31941,8 +31957,8 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
31941
31957
  const program = val.value?.prog || val.value;
31942
31958
  var $wrapper = $('<div>');
31943
31959
  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, '');
31944
- const param_obj = await get_params_obj_new(SESSION_ID, program, nodeP, paramsP.dsSessionP);
31945
- let ret_init = await func.UI.screen.init(SESSION_ID, program, paramsP.screenId, _ds, $div, null, _ds.currentRecordId, jobNoP, true, param_obj, 'alterXu_panel');
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);
31946
31962
  ret = {
31947
31963
  $new_div: ret_init,
31948
31964
  abort: true,
@@ -36387,7 +36403,7 @@ func.events.execute = async function (
36387
36403
  var params_obj = {};
36388
36404
  if (_prog?.properties?.progParams) {
36389
36405
  for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
36390
- if (val.data.dir !== 'in') continue;
36406
+ if (!val.data.dir === 'in') continue;
36391
36407
  if (typeof args.parameters_obj_inP?.[val.data.parameter] !== 'undefined') {
36392
36408
  if (args.parameters_obj_inP?.[val.data.parameter].fx) {
36393
36409
  let ret = await func.expression.get(SESSION_ID, args.parameters_obj_inP?.[val.data.parameter].fx, dsSession, 'parameters');
@@ -37729,7 +37745,7 @@ func.action.execute = async function (
37729
37745
  func.UI.main = {};
37730
37746
 
37731
37747
  func.UI.main.clear_SYNC_INTERVAL = function () {
37732
- $("body").unbind("mousemove keypress mousedown");
37748
+ $('body').unbind('mousemove keypress mousedown');
37733
37749
  };
37734
37750
  func.UI.main.embed_prog_execute = async function (SESSION_ID, prog) {
37735
37751
  var _session = SESSION_OBJ[SESSION_ID];
@@ -37741,16 +37757,13 @@ func.UI.main.embed_prog_execute = async function (SESSION_ID, prog) {
37741
37757
  var params_obj = {};
37742
37758
  if (_prog?.properties?.progParams) {
37743
37759
  for (const [key, val] of Object.entries(_prog.properties.progParams)) {
37744
- if (!val.data.dir === "in") continue;
37745
- if (typeof _session.url_params?.[val.data.parameter] !== "undefined") {
37746
- params_obj[val.data.parameter] =
37747
- _session.url_params?.[val.data.parameter];
37760
+ if (val.data.dir !== 'in') continue;
37761
+ if (typeof _session.url_params?.[val.data.parameter] !== 'undefined') {
37762
+ params_obj[val.data.parameter] = _session.url_params?.[val.data.parameter];
37748
37763
 
37749
37764
  continue;
37750
37765
  }
37751
- console.warn(
37752
- `Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`
37753
- );
37766
+ console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
37754
37767
  }
37755
37768
  }
37756
37769
  return params_obj;
@@ -37758,50 +37771,33 @@ func.UI.main.embed_prog_execute = async function (SESSION_ID, prog) {
37758
37771
 
37759
37772
  let screen_ret = await func.utils.get_screen_obj(SESSION_ID, prog);
37760
37773
  if (screen_ret) {
37761
- let ret_init = await func.UI.screen.init(
37762
- SESSION_ID,
37763
- prog,
37764
- null,
37765
- null,
37766
- $("#embed_" + SESSION_ID),
37767
- null,
37768
- null,
37769
- null,
37770
- null,
37771
- get_params_obj(),
37772
- "call_embed"
37773
- );
37774
+ let ret_init = await func.UI.screen.init(SESSION_ID, prog, null, null, $('#embed_' + SESSION_ID), null, null, null, null, get_params_obj(), 'call_embed');
37774
37775
  document.title = screen_ret.properties.menuTitle;
37775
37776
 
37776
37777
  return;
37777
37778
  }
37778
37779
 
37779
- console.error("Program not exist", prog);
37780
- func.UI.utils.progressScreen.show(
37781
- SESSION_ID,
37782
- "Program not exist",
37783
- null,
37784
- true
37785
- );
37780
+ console.error('Program not exist', prog);
37781
+ func.UI.utils.progressScreen.show(SESSION_ID, 'Program not exist', null, true);
37786
37782
  // }
37787
37783
  };
37788
37784
 
37789
37785
  func.UI.main.embed_loader = async function (SESSION_ID) {
37790
37786
  var _session = SESSION_OBJ[SESSION_ID];
37791
- var hash = "";
37787
+ var hash = '';
37792
37788
  if (window.location.hash) hash = window.location.hash.substr(1);
37793
37789
  _session.SYS_GLOBAL_STR_BROWSER_HASH_ID = hash;
37794
37790
  _session.SYS_GLOBAL_STR_BROWSER_TITLE = document.title;
37795
37791
 
37796
37792
  const init_system_ds = async function () {
37797
- if (!["main"].includes(_session.opt.app_computing_mode)) {
37798
- await func.index.new_webworker(SESSION_ID, { menuName: "Main" });
37793
+ if (!['main'].includes(_session.opt.app_computing_mode)) {
37794
+ await func.index.new_webworker(SESSION_ID, { menuName: 'Main' });
37799
37795
  // await func.index.call_worker(SESSION_ID, {
37800
37796
  // service: "create_webworker_globals",
37801
37797
  // data: { ds_data: _session.DS_GLB[0], session_id: SESSION_ID },
37802
37798
  // });
37803
37799
  }
37804
- const ret = await func.datasource.create(SESSION_ID, "system");
37800
+ const ret = await func.datasource.create(SESSION_ID, 'system');
37805
37801
 
37806
37802
  /////////// moved to the datasource callback to allow sync on_load events to run at worker
37807
37803
 
@@ -37817,12 +37813,7 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
37817
37813
  };
37818
37814
  const set_SYS_GLOBAL_KEYS_STATE = async function (SESSION_ID, e, state) {
37819
37815
  if (!_session?.DS_GLB?.[0]) return;
37820
- if (
37821
- e.keyCode !== 16 &&
37822
- e.keyCode !== 17 &&
37823
- e.keyCode !== 18 &&
37824
- e.keyCode !== 91
37825
- ) {
37816
+ if (e.keyCode !== 16 && e.keyCode !== 17 && e.keyCode !== 18 && e.keyCode !== 91) {
37826
37817
  return;
37827
37818
  }
37828
37819
 
@@ -37843,7 +37834,7 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
37843
37834
 
37844
37835
  var datasource_changes = {
37845
37836
  [0]: {
37846
- ["data_system"]: data,
37837
+ ['data_system']: data,
37847
37838
  },
37848
37839
  };
37849
37840
  await func.datasource.update(SESSION_ID, datasource_changes);
@@ -37854,38 +37845,32 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
37854
37845
  _session.WORKER_OBJ.fx.init();
37855
37846
  };
37856
37847
  const create_embed_container = async function () {
37857
- $("<div>")
37858
- .attr("id", "embed_" + SESSION_ID)
37848
+ $('<div>')
37849
+ .attr('id', 'embed_' + SESSION_ID)
37859
37850
 
37860
- .addClass("xu_embed_div")
37851
+ .addClass('xu_embed_div')
37861
37852
  .data({ xuData: {} })
37862
37853
  .appendTo($(_session.root_element));
37863
37854
  };
37864
37855
  const execute_PENDING_OPEN_URL_EVENTS = async function () {
37865
- if (
37866
- typeof func.events.execute_PENDING_OPEN_URL_EVENTS !== "undefined" &&
37867
- glb.is_cordova
37868
- ) {
37856
+ if (typeof func.events.execute_PENDING_OPEN_URL_EVENTS !== 'undefined' && glb.is_cordova) {
37869
37857
  func.events.execute_PENDING_OPEN_URL_EVENTS();
37870
37858
  }
37871
37859
  };
37872
37860
 
37873
37861
  const remove_loader = async function () {
37874
- $(".loader").remove();
37875
- $(_session.root_element).removeClass("loader_background_color");
37862
+ $('.loader').remove();
37863
+ $(_session.root_element).removeClass('loader_background_color');
37876
37864
  };
37877
37865
  const perform_callback = async function () {
37878
37866
  if (_session.api_callback) {
37879
- _session.api_callback("xuda_ready", SESSION_ID, SESSION_OBJ);
37867
+ _session.api_callback('xuda_ready', SESSION_ID, SESSION_OBJ);
37880
37868
  }
37881
37869
  };
37882
37870
 
37883
37871
  const call_program = async function () {
37884
37872
  if (_session.route_id) {
37885
- const route_obj = await func.utils.DOCS_OBJ.get(
37886
- SESSION_ID,
37887
- _session.route_id
37888
- );
37873
+ const route_obj = await func.utils.DOCS_OBJ.get(SESSION_ID, _session.route_id);
37889
37874
 
37890
37875
  function flattenMenuItems(menu) {
37891
37876
  let flatMenu = {};
@@ -37928,50 +37913,25 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
37928
37913
  if (!_session.prog_id) return;
37929
37914
 
37930
37915
  await func.utils.TREE_OBJ.get(SESSION_ID, _session.prog_id);
37931
- let screen_ret = await func.utils.get_screen_obj(
37932
- SESSION_ID,
37933
- _session.prog_id
37934
- );
37916
+ let screen_ret = await func.utils.get_screen_obj(SESSION_ID, _session.prog_id);
37935
37917
  if (screen_ret) {
37936
37918
  func.UI.main.embed_prog_execute(SESSION_ID, _session.prog_id);
37937
37919
  } else {
37938
- console.error("Program not exist", _session.prog_id);
37939
- func.UI.utils.progressScreen.show(
37940
- SESSION_ID,
37941
- "Program not exist",
37942
- null,
37943
- true
37944
- );
37920
+ console.error('Program not exist', _session.prog_id);
37921
+ func.UI.utils.progressScreen.show(SESSION_ID, 'Program not exist', null, true);
37945
37922
  }
37946
37923
  };
37947
37924
 
37948
37925
  const register_run_background_plugins = async function () {
37949
- if (typeof glb.SLIM_BUNDLE !== "undefined" || glb.SLIM_BUNDLE) return;
37926
+ if (typeof glb.SLIM_BUNDLE !== 'undefined' || glb.SLIM_BUNDLE) return;
37950
37927
 
37951
- for await (const [plugin_name, val] of Object.entries(
37952
- APP_OBJ[_session.app_id].app_plugins_purchased
37953
- )) {
37954
- if (
37955
- val.installed &&
37956
- val.run_in_background &&
37957
- val.manifest?.["runtime.mjs"]?.exist
37958
- ) {
37928
+ for await (const [plugin_name, val] of Object.entries(APP_OBJ[_session.app_id].app_plugins_purchased)) {
37929
+ if (val.installed && val.run_in_background && val.manifest?.['runtime.mjs']?.exist) {
37959
37930
  try {
37960
- const plugin_runtime_src = await func.utils.get_plugin_npm_cdn(
37961
- SESSION_ID,
37962
- plugin_name,
37963
- `${val.manifest["runtime.mjs"].dist ? "dist/" : ""}runtime.mjs`
37964
- );
37931
+ const plugin_runtime_src = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, `${val.manifest['runtime.mjs'].dist ? 'dist/' : ''}runtime.mjs`);
37965
37932
 
37966
- if (
37967
- val.manifest["runtime.mjs"].dist &&
37968
- val.manifest?.["runtime.mjs"]?.css
37969
- ) {
37970
- const plugin_runtime_css_url = await func.utils.get_plugin_npm_cdn(
37971
- SESSION_ID,
37972
- plugin_name,
37973
- "dist/runtime.css"
37974
- );
37933
+ if (val.manifest['runtime.mjs'].dist && val.manifest?.['runtime.mjs']?.css) {
37934
+ const plugin_runtime_css_url = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, 'dist/runtime.css');
37975
37935
  func.utils.load_css_on_demand(plugin_runtime_css_url);
37976
37936
  }
37977
37937
 
@@ -37979,20 +37939,13 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
37979
37939
  eval(plugin_script);
37980
37940
 
37981
37941
  let plugin_setup_script_ret = null;
37982
- if (val.manifest?.["index.mjs"]?.exist) {
37983
- const plugin_setup_src = await func.utils.get_plugin_npm_cdn(
37984
- SESSION_ID,
37985
- plugin_name,
37986
- `${val.manifest["index.mjs"].dist ? "dist/" : ""}index.mjs`
37987
- );
37942
+ if (val.manifest?.['index.mjs']?.exist) {
37943
+ const plugin_setup_src = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, `${val.manifest['index.mjs'].dist ? 'dist/' : ''}index.mjs`);
37988
37944
 
37989
37945
  let plugin_setup_script = await import(plugin_setup_src);
37990
37946
 
37991
37947
  if (plugin_setup_script) {
37992
- plugin_setup_script_ret = await func.utils.get_plugin_setup(
37993
- SESSION_ID,
37994
- plugin_name
37995
- );
37948
+ plugin_setup_script_ret = await func.utils.get_plugin_setup(SESSION_ID, plugin_name);
37996
37949
  if (plugin_setup_script_ret.code < 0) {
37997
37950
  throw plugin_setup_script_ret;
37998
37951
  }
@@ -38019,7 +37972,7 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
38019
37972
 
38020
37973
  var datasource_changes = {
38021
37974
  [0]: {
38022
- ["data_system"]: data,
37975
+ ['data_system']: data,
38023
37976
  },
38024
37977
  };
38025
37978
  await func.datasource.update(SESSION_ID, datasource_changes);
@@ -38029,20 +37982,20 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
38029
37982
 
38030
37983
  $(_session.root_element).show();
38031
37984
  func.UI.component.create_app_root_component(SESSION_ID);
38032
- await glb.lifecycle.execute(SESSION_ID, "beforeInit");
37985
+ await glb.lifecycle.execute(SESSION_ID, 'beforeInit');
38033
37986
  await start_workers();
38034
37987
  await init_system_ds();
38035
- await glb.lifecycle.execute(SESSION_ID, "initialized");
37988
+ await glb.lifecycle.execute(SESSION_ID, 'initialized');
38036
37989
  await create_embed_container();
38037
37990
  await execute_PENDING_OPEN_URL_EVENTS();
38038
37991
  await remove_loader();
38039
37992
  await func.UI.worker.init(SESSION_ID);
38040
- await glb.lifecycle.execute(SESSION_ID, "beforeMounted");
37993
+ await glb.lifecycle.execute(SESSION_ID, 'beforeMounted');
38041
37994
  await call_program();
38042
- await glb.lifecycle.execute(SESSION_ID, "mounted");
37995
+ await glb.lifecycle.execute(SESSION_ID, 'mounted');
38043
37996
  await perform_callback();
38044
- func.utils.debug.write(SESSION_ID, "Xuda.io started.");
38045
- await glb.lifecycle.execute(SESSION_ID, "systemReady");
37997
+ func.utils.debug.write(SESSION_ID, 'Xuda.io started.');
37998
+ await glb.lifecycle.execute(SESSION_ID, 'systemReady');
38046
37999
  /////////////////////////////
38047
38000
  $(document).keydown(function (e) {
38048
38001
  set_SYS_GLOBAL_KEYS_STATE(SESSION_ID, e, 1);
@@ -38052,23 +38005,14 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
38052
38005
  });
38053
38006
 
38054
38007
  await updateOnlineStatus();
38055
- window.addEventListener("online", updateOnlineStatus);
38056
- window.addEventListener("offline", updateOnlineStatus);
38008
+ window.addEventListener('online', updateOnlineStatus);
38009
+ window.addEventListener('offline', updateOnlineStatus);
38057
38010
 
38058
- console.log("xuda.io system ready.");
38059
- $("body")[0].dispatchEvent(glb.system_ready_event);
38011
+ console.log('xuda.io system ready.');
38012
+ $('body')[0].dispatchEvent(glb.system_ready_event);
38060
38013
  };
38061
38014
  func.UI.main.set_custom_css = function (SESSION_ID, callbackP) {
38062
- if (
38063
- SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system?.["SYS_GLOBAL_STR_SITE_CSS"]
38064
- )
38065
- $(
38066
- "<style type='text/css'> " +
38067
- SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system[
38068
- "SYS_GLOBAL_STR_SITE_CSS"
38069
- ] +
38070
- " </style>"
38071
- ).appendTo("head");
38015
+ if (SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system?.['SYS_GLOBAL_STR_SITE_CSS']) $("<style type='text/css'> " + SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system['SYS_GLOBAL_STR_SITE_CSS'] + ' </style>').appendTo('head');
38072
38016
  callbackP();
38073
38017
  };
38074
38018
  func.index = {};