@xuda.io/runtime-bundle 1.0.279 → 1.0.281

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.
@@ -10549,23 +10549,10 @@ func.UI.garbage_collector = function (
10549
10549
  };
10550
10550
 
10551
10551
  func.UI.screen = {};
10552
- func.UI.screen.init = async function (
10553
- SESSION_ID,
10554
- prog_id,
10555
- sourceScreenP,
10556
- callingDataSource_objP,
10557
- $callingContainerP,
10558
- triggerIdP,
10559
- rowIdP,
10560
- jobNoP,
10561
- is_panelP,
10562
- parameters_obj_inP,
10563
- source_functionP,
10564
- call_screen_propertiesP
10565
- ) {
10566
- if (!prog_id) return console.error("program is empty");
10552
+ 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) {
10553
+ if (!prog_id) return console.error('program is empty');
10567
10554
  let screen_ret = await func.utils.get_screen_obj(SESSION_ID, prog_id);
10568
- if (!screen_ret) return console.error("program is not a screen object");
10555
+ if (!screen_ret) return console.error('program is not a screen object');
10569
10556
  await func.UI.utils.init_ui_framework(SESSION_ID, prog_id);
10570
10557
 
10571
10558
  let _session = SESSION_OBJ[SESSION_ID];
@@ -10573,21 +10560,15 @@ func.UI.screen.init = async function (
10573
10560
  const screenInfo = _.cloneDeep(screen_ret);
10574
10561
  const $callingContainerP_data = $callingContainerP.clone(true)?.data();
10575
10562
 
10576
- var screen_type = source_functionP?.split("_")?.[1]; //|| (is_panelP && "panel");
10563
+ var screen_type = source_functionP?.split('_')?.[1]; //|| (is_panelP && "panel");
10577
10564
 
10578
10565
  var screenId = (glb.screen_num++).toString();
10579
10566
 
10580
- if (
10581
- SCREEN_BLOCKER_OBJ[prog_id + (sourceScreenP ? "_" + sourceScreenP : "")]
10582
- ) {
10567
+ if (SCREEN_BLOCKER_OBJ[prog_id + (sourceScreenP ? '_' + sourceScreenP : '')]) {
10583
10568
  const wait_for_SCREEN_BLOCKER_release = () => {
10584
10569
  return new Promise((resolve) => {
10585
10570
  var interval = setInterval(function () {
10586
- if (
10587
- !SCREEN_BLOCKER_OBJ[
10588
- prog_id + (sourceScreenP ? "_" + sourceScreenP : "")
10589
- ]
10590
- ) {
10571
+ if (!SCREEN_BLOCKER_OBJ[prog_id + (sourceScreenP ? '_' + sourceScreenP : '')]) {
10591
10572
  window.clearInterval(interval);
10592
10573
  resolve();
10593
10574
  // run_screen();
@@ -10598,13 +10579,9 @@ func.UI.screen.init = async function (
10598
10579
  await wait_for_SCREEN_BLOCKER_release();
10599
10580
  }
10600
10581
 
10601
- func.UI.utils.screen_blocker(
10602
- true,
10603
- prog_id + (sourceScreenP ? "_" + sourceScreenP : "")
10604
- );
10582
+ func.UI.utils.screen_blocker(true, prog_id + (sourceScreenP ? '_' + sourceScreenP : ''));
10605
10583
 
10606
- if ($callingContainerP && !_.isEmpty($callingContainerP))
10607
- $callingContainerP.data().xuData.screenInfo = screenInfo;
10584
+ if ($callingContainerP && !_.isEmpty($callingContainerP)) $callingContainerP.data().xuData.screenInfo = screenInfo;
10608
10585
 
10609
10586
  var $dialogDiv;
10610
10587
  var $rootFrame;
@@ -10624,20 +10601,17 @@ func.UI.screen.init = async function (
10624
10601
  screen_type,
10625
10602
  screenInfo,
10626
10603
  call_screen_propertiesP,
10627
- parentDataSourceNoP:
10628
- _session.DS_GLB?.[callingDataSource_objP?.dsSession]?.dsSession ||
10629
- callingDataSource_objP?.parentDataSourceNo ||
10630
- 0,
10604
+ parentDataSourceNoP: _session.DS_GLB?.[callingDataSource_objP?.dsSession]?.dsSession || callingDataSource_objP?.parentDataSourceNo || 0,
10631
10605
  };
10632
10606
 
10633
10607
  switch (screen_type) {
10634
- case "embed":
10635
- $dialogDiv = $("<div>")
10608
+ case 'embed':
10609
+ $dialogDiv = $('<div>')
10636
10610
  .attr({
10637
10611
  id: screenId,
10638
10612
  ui_engine: UI_FRAMEWORK_INSTALLED,
10639
10613
  })
10640
- .addClass("xu_embed_div")
10614
+ .addClass('xu_embed_div')
10641
10615
  .data({
10642
10616
  xuData: {
10643
10617
  paramsP: params,
@@ -10645,21 +10619,18 @@ func.UI.screen.init = async function (
10645
10619
  },
10646
10620
  });
10647
10621
 
10648
- let rootTagName = "div";
10649
- if (typeof glb.SLIM_BUNDLE === "undefined" && !glb.SLIM_BUNDLE) {
10622
+ let rootTagName = 'div';
10623
+ if (typeof glb.SLIM_BUNDLE === 'undefined' && !glb.SLIM_BUNDLE) {
10650
10624
  const ui_plugin_core = new UI_FRAMEWORK_PLUGIN.core();
10651
10625
  rootTagName = ui_plugin_core?.rootTagName();
10652
10626
  }
10653
10627
 
10654
- $rootFrame = $(`<${rootTagName}>`)
10655
- .data("xuData", {})
10656
- .data("xuAttributes", {})
10657
- .appendTo($dialogDiv);
10628
+ $rootFrame = $(`<${rootTagName}>`).data('xuData', {}).data('xuAttributes', {}).appendTo($dialogDiv);
10658
10629
 
10659
10630
  $dialogDiv.appendTo($callingContainerP);
10660
10631
  break;
10661
10632
 
10662
- case "panel":
10633
+ case 'panel':
10663
10634
  $dialogDiv = $callingContainerP;
10664
10635
  $dialogDiv.data({
10665
10636
  xuData: {
@@ -10670,31 +10641,30 @@ func.UI.screen.init = async function (
10670
10641
  $rootFrame = $dialogDiv;
10671
10642
  break;
10672
10643
 
10673
- case "page":
10674
- case "modal":
10675
- case "popover":
10676
- $dialogDiv = $("<div>");
10677
- $rootFrame = $("<div>").appendTo($dialogDiv);
10678
- $dialogDiv.appendTo("body");
10644
+ case 'page':
10645
+ case 'modal':
10646
+ case 'popover':
10647
+ $dialogDiv = $('<div>');
10648
+ $rootFrame = $('<div>').appendTo($dialogDiv);
10649
+ $dialogDiv.appendTo('body');
10679
10650
  break;
10680
10651
 
10681
10652
  default:
10682
10653
  }
10683
10654
 
10684
- params.containerIdP = $rootFrame.attr("id");
10655
+ params.containerIdP = $rootFrame.attr('id');
10685
10656
  params.$container = $rootFrame;
10686
10657
 
10687
- containerId =
10688
- "container_" + params.screenInfo.properties?.id + "_" + screenId;
10658
+ containerId = 'container_' + params.screenInfo.properties?.id + '_' + screenId;
10689
10659
 
10690
10660
  var data = {
10691
- note: " ROOT container",
10661
+ note: ' ROOT container',
10692
10662
  root: true,
10693
10663
  screenId,
10694
10664
  is_panelP,
10695
10665
  prog_id,
10696
10666
  screen_type,
10697
- container: "#" + containerId, // initiate container that hold the element
10667
+ container: '#' + containerId, // initiate container that hold the element
10698
10668
  };
10699
10669
  if (is_panelP) {
10700
10670
  $rootFrame.data().xuData.rootFrame = data;
@@ -10702,8 +10672,8 @@ func.UI.screen.init = async function (
10702
10672
  if (!$rootFrame.data().xuData) {
10703
10673
  $rootFrame.data().xuData = {};
10704
10674
  }
10705
- $rootFrame.attr("id", containerId).data().xuData.rootFrame = data;
10706
- $rootFrame.css("display", "contents");
10675
+ $rootFrame.attr('id', containerId).data().xuData.rootFrame = data;
10676
+ $rootFrame.css('display', 'contents');
10707
10677
  }
10708
10678
 
10709
10679
  // ////////// skeleton
@@ -10789,23 +10759,7 @@ func.UI.screen.init = async function (
10789
10759
  // console.log("***");
10790
10760
  func.UI.utils.indicator.screen.busy();
10791
10761
 
10792
- const ret = await func.datasource.create(
10793
- SESSION_ID,
10794
- prog_id,
10795
- null,
10796
- params.parentDataSourceNoP,
10797
- $rootFrame.attr("id"),
10798
- rowIdP,
10799
- jobNoP,
10800
- null,
10801
- null,
10802
- null,
10803
- null,
10804
- null,
10805
- null,
10806
- null,
10807
- parameters_obj_inP
10808
- );
10762
+ const ret = await func.datasource.create(SESSION_ID, prog_id, null, params.parentDataSourceNoP, $rootFrame.attr('id'), rowIdP, jobNoP, null, null, null, null, null, null, null, parameters_obj_inP);
10809
10763
 
10810
10764
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[ret.dsSessionP];
10811
10765
  _ds.screen_params = params;
@@ -10822,46 +10776,24 @@ func.UI.screen.init = async function (
10822
10776
  if (ret.dsSessionP >= 0) {
10823
10777
  // Call from contact info screen
10824
10778
  var viewDoc;
10825
- let view_ret = await func.utils.VIEWS_OBJ.get(
10826
- SESSION_ID,
10827
- SESSION_OBJ[SESSION_ID].DS_GLB[ret.dsSessionP].prog_id
10828
- );
10779
+ let view_ret = await func.utils.VIEWS_OBJ.get(SESSION_ID, SESSION_OBJ[SESSION_ID].DS_GLB[ret.dsSessionP].prog_id);
10829
10780
  if (view_ret) {
10830
10781
  viewDoc = view_ret;
10831
10782
  }
10832
10783
  if (!viewDoc?.progUi) {
10833
- return func.utils.alerts.invoke(
10834
- SESSION_ID,
10835
- "system_msg",
10836
- "SYS_MSG_0780",
10837
- params.renderType,
10838
- ret.dsSessionP
10839
- );
10784
+ return func.utils.alerts.invoke(SESSION_ID, 'system_msg', 'SYS_MSG_0780', params.renderType, ret.dsSessionP);
10840
10785
  }
10841
10786
  var node;
10842
10787
  node = _.cloneDeep(viewDoc.progUi);
10843
- if (!node.length) return console.warn("ui node empty");
10844
- const ret_render_$container = await func.UI.screen.render_ui_tree(
10845
- SESSION_ID,
10846
- $rootFrame,
10847
- node[0],
10848
- null,
10849
- params,
10850
- jobNoP,
10851
- null,
10852
- null,
10853
- null,
10854
- null,
10855
- null,
10856
- $rootFrame
10857
- );
10788
+ if (!node.length) return console.warn('ui node empty');
10789
+ const ret_render_$container = await func.UI.screen.render_ui_tree(SESSION_ID, $rootFrame, node[0], null, params, jobNoP, null, null, null, null, null, $rootFrame);
10858
10790
 
10859
10791
  // $(".skeleton_wrapper").remove();
10860
10792
 
10861
10793
  // fix for svg
10862
10794
 
10863
10795
  const fix_svg = function () {
10864
- let $svg = $("svg");
10796
+ let $svg = $('svg');
10865
10797
  $.each($svg, function (key, elm) {
10866
10798
  elm.outerHTML = elm.outerHTML;
10867
10799
  });
@@ -10871,12 +10803,7 @@ func.UI.screen.init = async function (
10871
10803
  }, 200);
10872
10804
  func.UI.utils.indicator.screen.normal();
10873
10805
 
10874
- let ret_screen_loading = await func.UI.screen.screen_loading_done(
10875
- SESSION_ID,
10876
- params,
10877
- ret_render_$container,
10878
- jobNoP
10879
- );
10806
+ let ret_screen_loading = await func.UI.screen.screen_loading_done(SESSION_ID, params, ret_render_$container, jobNoP);
10880
10807
  return ret_screen_loading;
10881
10808
  }
10882
10809
  };
@@ -10888,11 +10815,10 @@ func.UI.screen.update_SYS_OBJ_WIN_INFO = function (SESSION_ID, dsNoP) {
10888
10815
  _ds.data_system = {};
10889
10816
  }
10890
10817
 
10891
- _ds.data_system["SYS_STR_WIN_ID"] = _ds.tree_obj?.id;
10892
- _ds.data_system["SYS_STR_WIN_NAME"] = _ds.tree_obj?.menuName;
10818
+ _ds.data_system['SYS_STR_WIN_ID'] = _ds.tree_obj?.id;
10819
+ _ds.data_system['SYS_STR_WIN_NAME'] = _ds.tree_obj?.menuName;
10893
10820
  if (SESSION_OBJ[SESSION_ID].DS_GLB[dsNoP].mode) {
10894
- _ds.data_system["SYS_STR_WIN_MODE"] =
10895
- SESSION_OBJ[SESSION_ID].DS_GLB[dsNoP].mode;
10821
+ _ds.data_system['SYS_STR_WIN_MODE'] = SESSION_OBJ[SESSION_ID].DS_GLB[dsNoP].mode;
10896
10822
  }
10897
10823
  // _ds.data_system["SYS_OBJ_WIN_INFO"] = func.UI.screen.get_info(
10898
10824
  // SESSION_ID,
@@ -10901,19 +10827,9 @@ func.UI.screen.update_SYS_OBJ_WIN_INFO = function (SESSION_ID, dsNoP) {
10901
10827
  // get all top fields into json
10902
10828
  };
10903
10829
 
10904
- func.UI.screen.validate_exit_events = async function (
10905
- SESSION_ID,
10906
- div_data_paramsP,
10907
- forceP
10908
- ) {
10830
+ func.UI.screen.validate_exit_events = async function (SESSION_ID, div_data_paramsP, forceP) {
10909
10831
  return new Promise(async (resolve) => {
10910
- await func.events.validate(
10911
- SESSION_ID,
10912
- "on_exit",
10913
- div_data_paramsP.dsSessionP,
10914
- null,
10915
- "screen"
10916
- );
10832
+ await func.events.validate(SESSION_ID, 'on_exit', div_data_paramsP.dsSessionP, null, 'screen');
10917
10833
 
10918
10834
  var interval = setInterval(function () {
10919
10835
  if (!SESSION_OBJ[SESSION_ID].WORKER_OBJ.jobs.length || forceP) {
@@ -10925,7 +10841,7 @@ func.UI.screen.validate_exit_events = async function (
10925
10841
  };
10926
10842
 
10927
10843
  func.UI.screen.call_embed = function (SESSION_ID, prog) {
10928
- $("#embed_" + SESSION_ID)
10844
+ $('#embed_' + SESSION_ID)
10929
10845
  .empty()
10930
10846
  .data().xuData.screenInfo = null;
10931
10847
 
@@ -10934,24 +10850,18 @@ func.UI.screen.call_embed = function (SESSION_ID, prog) {
10934
10850
  });
10935
10851
  func.UI.main.embed_prog_execute(SESSION_ID, prog);
10936
10852
  };
10937
- func.UI.screen.refresh_xu_attributes = async function (
10938
- SESSION_ID,
10939
- fields_arr,
10940
- jobNoP,
10941
- $elm_to_search,
10942
- dsSession
10943
- ) {
10853
+ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, jobNoP, $elm_to_search, dsSession) {
10944
10854
  var selectors = {};
10945
- var search_from = "body";
10855
+ var search_from = 'body';
10946
10856
  var new_job = jobNoP;
10947
10857
 
10948
10858
  if ($elm_to_search) {
10949
- search_from = "#" + $elm_to_search.attr("id");
10859
+ search_from = '#' + $elm_to_search.attr('id');
10950
10860
  }
10951
10861
  const get_selectors = function () {
10952
10862
  $.each(fields_arr, function (key_field, val_field) {
10953
10863
  $(search_from)
10954
- .find("*")
10864
+ .find('*')
10955
10865
  .filter(function () {
10956
10866
  var attr = [];
10957
10867
 
@@ -10961,41 +10871,33 @@ func.UI.screen.refresh_xu_attributes = async function (
10961
10871
  // )
10962
10872
  // return;
10963
10873
 
10964
-
10965
-
10966
10874
  $.each($(this).data()?.xuAttributes, function (key, val) {
10967
-
10968
- if (key === "xu-for") { // match static value for xu-for
10875
+ if (key === 'xu-for') {
10876
+ // match static value for xu-for
10969
10877
  if (val?.includes?.(val_field)) {
10970
10878
  attr.push(key);
10971
-
10972
10879
  }
10973
10880
  }
10974
10881
 
10975
-
10976
- if (!key.substr(0, 2) === "xu") return;
10977
- if (key.substr(0, 6) === "xu-exp" && key.substr(6, 1) === ":") {
10882
+ if (!key.substr(0, 2) === 'xu') return;
10883
+ if (key.substr(0, 6) === 'xu-exp' && key.substr(6, 1) === ':') {
10978
10884
  if (val?.includes?.(val_field)) {
10979
10885
  attr.push(key);
10980
-
10981
10886
  }
10982
-
10983
10887
  }
10984
10888
 
10985
-
10986
-
10987
- if (key.substr(0, 8) === "xu-class") {
10889
+ if (key.substr(0, 8) === 'xu-class') {
10988
10890
  try {
10989
10891
  let obj = JSON.parse(val);
10990
10892
  $.each(obj, function (cla, cond) {
10991
10893
  if (cond.includes(val_field)) {
10992
10894
  // attr.push("xuClass");
10993
- attr.push("xu-class");
10895
+ attr.push('xu-class');
10994
10896
  return false;
10995
10897
  }
10996
10898
  });
10997
10899
  } catch (e) {
10998
- console.warn("parse error:" + val);
10900
+ console.warn('parse error:' + val);
10999
10901
  }
11000
10902
  }
11001
10903
  // return attr;
@@ -11010,8 +10912,7 @@ func.UI.screen.refresh_xu_attributes = async function (
11010
10912
  selectors[selector_id] = { attributes: [], $elm: $(this) };
11011
10913
  }
11012
10914
  attr.forEach(function (value) {
11013
- if (!selectors[selector_id].attributes.includes(value))
11014
- selectors[selector_id].attributes.push(value);
10915
+ if (!selectors[selector_id].attributes.includes(value)) selectors[selector_id].attributes.push(value);
11015
10916
  });
11016
10917
  }
11017
10918
  });
@@ -11021,14 +10922,14 @@ func.UI.screen.refresh_xu_attributes = async function (
11021
10922
  get_selectors();
11022
10923
 
11023
10924
  for await (let [elem_key, elem_val] of Object.entries(selectors)) {
11024
- if (elem_key === "length") break;
10925
+ if (elem_key === 'length') break;
11025
10926
 
11026
10927
  const add_execute_queue = async function (type) {
11027
10928
  if (!elem_val.$elm?.data?.()?.xuData) return;
11028
10929
 
11029
10930
  new_job = await func.UI.worker.add_to_queue(
11030
10931
  SESSION_ID,
11031
- "gui event",
10932
+ 'gui event',
11032
10933
  type,
11033
10934
  {
11034
10935
  ui_type: elem_val.$elm.data().xuData.ui_type,
@@ -11038,7 +10939,7 @@ func.UI.screen.refresh_xu_attributes = async function (
11038
10939
  elem_val,
11039
10940
  },
11040
10941
  new_job,
11041
- elem_val.$elm
10942
+ elem_val.$elm,
11042
10943
  );
11043
10944
  };
11044
10945
  //////////// process render first ///////////////
@@ -11047,27 +10948,15 @@ func.UI.screen.refresh_xu_attributes = async function (
11047
10948
 
11048
10949
  if (!elem_val?.$elm?.data()?.xuAttributes) continue;
11049
10950
 
11050
- if (elem_val.attributes.includes("xu-exp:xu-render")) {
11051
- var res = await func.expression.get(
11052
- SESSION_ID,
11053
- elem_val.$elm.data().xuAttributes["xu-exp:xu-render"],
11054
- elem_val.$elm.data().xuData.paramsP.dsSessionP,
11055
- "UI Property EXP",
11056
- elem_val.$elm.data().xuData.recordid
11057
- );
10951
+ if (elem_val.attributes.includes('xu-exp:xu-render')) {
10952
+ var res = await func.expression.get(SESSION_ID, elem_val.$elm.data().xuAttributes['xu-exp:xu-render'], elem_val.$elm.data().xuData.paramsP.dsSessionP, 'UI Property EXP', elem_val.$elm.data().xuData.recordid);
11058
10953
 
11059
- var attr_value = await func.common.get_cast_val(
11060
- SESSION_ID,
11061
- "refresh xu-attributes",
11062
- "xu-render",
11063
- "bool",
11064
- res.result
11065
- );
10954
+ var attr_value = await func.common.get_cast_val(SESSION_ID, 'refresh xu-attributes', 'xu-render', 'bool', res.result);
11066
10955
 
11067
- if (!attr_value & (elem_val.$elm[0].tagName === "XURENDER")) continue; // bypass job
10956
+ if (!attr_value & (elem_val.$elm[0].tagName === 'XURENDER')) continue; // bypass job
11068
10957
 
11069
- if (attr_value & (elem_val.$elm[0].tagName !== "XURENDER")) {
11070
- await add_execute_queue("execute_xu_all_attributes");
10958
+ if (attr_value & (elem_val.$elm[0].tagName !== 'XURENDER')) {
10959
+ await add_execute_queue('execute_xu_all_attributes');
11071
10960
  continue; // bypass render job
11072
10961
  }
11073
10962
 
@@ -11075,8 +10964,8 @@ func.UI.screen.refresh_xu_attributes = async function (
11075
10964
 
11076
10965
  new_job = await func.UI.worker.add_to_queue(
11077
10966
  SESSION_ID,
11078
- "gui event",
11079
- "execute_xu_render_attributes",
10967
+ 'gui event',
10968
+ 'execute_xu_render_attributes',
11080
10969
  {
11081
10970
  ui_type: elem_val.$elm.data().xuData.ui_type,
11082
10971
  SESSION_ID,
@@ -11087,50 +10976,47 @@ func.UI.screen.refresh_xu_attributes = async function (
11087
10976
  },
11088
10977
  new_job,
11089
10978
  elem_val.$elm,
11090
- elem_val.$elm.data().xuData.paramsP.dsSessionP
10979
+ elem_val.$elm.data().xuData.paramsP.dsSessionP,
11091
10980
  );
11092
10981
  performed_render = true;
11093
10982
  }
11094
10983
 
11095
- if (performed_render || elem_val.$elm[0].tagName === "XURENDER") continue; // bypass job
10984
+ if (performed_render || elem_val.$elm[0].tagName === 'XURENDER') continue; // bypass job
11096
10985
 
11097
- if (elem_val.attributes.includes("xu-exp:xu-for") || elem_val.attributes.includes("xu-for")) continue;
11098
- add_execute_queue("execute_xu_all_attributes");
10986
+ if (elem_val.attributes.includes('xu-exp:xu-for') || elem_val.attributes.includes('xu-for')) continue;
10987
+ add_execute_queue('execute_xu_all_attributes');
11099
10988
  }
11100
10989
 
11101
10990
  // xu-for
11102
10991
  selectors = {};
11103
10992
  get_selectors();
11104
- let refreshed_ids = []
10993
+ let refreshed_ids = [];
11105
10994
  // handle xu-for
11106
- let parent_element_ui_id
10995
+ let parent_element_ui_id;
11107
10996
  for await (let [elem_key, elem_val] of Object.entries(selectors)) {
11108
- if (elem_key === "length") break;
10997
+ if (elem_key === 'length') break;
11109
10998
 
11110
- if (!elem_val.attributes.includes("xu-exp:xu-for") && !elem_val.attributes.includes("xu-for")) continue;
10999
+ if (!elem_val.attributes.includes('xu-exp:xu-for') && !elem_val.attributes.includes('xu-for')) continue;
11111
11000
 
11112
-
11113
- let _parent_element_ui_id
11001
+ let _parent_element_ui_id;
11114
11002
  if (elem_val?.$elm?.data()?.xuPanelData) {
11115
11003
  // handle li panel
11116
- _parent_element_ui_id = elem_val?.$elm?.data()?.xuPanelData?.parent_element_ui_id
11004
+ _parent_element_ui_id = elem_val?.$elm?.data()?.xuPanelData?.parent_element_ui_id;
11117
11005
  } else {
11118
- // handle regular li
11006
+ // handle regular li
11119
11007
  _parent_element_ui_id = elem_val?.$elm?.data()?.xuData?.parent_element_ui_id;
11120
11008
  }
11121
11009
 
11122
11010
  if (!parent_element_ui_id || _parent_element_ui_id != parent_element_ui_id) {
11123
11011
  parent_element_ui_id = _parent_element_ui_id;
11124
11012
 
11125
- const _$elem = $(`[xu-ui-id=${parent_element_ui_id}]`)
11126
- const _elem_key = parent_element_ui_id
11127
- const _elem_val = { attributes: [], $elm: _$elem }
11013
+ const _$elem = $(`[xu-ui-id=${parent_element_ui_id}]`);
11014
+ const _elem_key = parent_element_ui_id;
11015
+ const _elem_val = { attributes: [], $elm: _$elem };
11128
11016
 
11129
11017
  $.each(_$elem.data()?.xuAttributes, function (key, val) {
11130
11018
  _elem_val.attributes.push(key);
11131
- })
11132
-
11133
-
11019
+ });
11134
11020
 
11135
11021
  // await func.UI.worker.add_to_queue(
11136
11022
  // SESSION_ID,
@@ -11150,8 +11036,8 @@ func.UI.screen.refresh_xu_attributes = async function (
11150
11036
 
11151
11037
  await func.UI.worker.add_to_queue(
11152
11038
  SESSION_ID,
11153
- "gui event",
11154
- "execute_xu_for",
11039
+ 'gui event',
11040
+ 'execute_xu_for',
11155
11041
  {
11156
11042
  ui_type: _elem_val.$elm.data().xuData.ui_type,
11157
11043
  SESSION_ID,
@@ -11161,45 +11047,40 @@ func.UI.screen.refresh_xu_attributes = async function (
11161
11047
  },
11162
11048
  new_job,
11163
11049
  _elem_val.$elm,
11164
- _elem_val.$elm.data().xuData.paramsP.dsSessionP
11050
+ _elem_val.$elm.data().xuData.paramsP.dsSessionP,
11165
11051
  );
11166
11052
 
11167
- refreshed_ids.push(parent_element_ui_id)
11053
+ refreshed_ids.push(parent_element_ui_id);
11168
11054
  }
11169
11055
  }
11170
11056
 
11171
- /////////// xu-for for non displayed elements ////////////
11057
+ /////////// xu-for for non displayed elements ////////////
11172
11058
  const iterate_field_in_progUi = async function (progUi, field_id) {
11173
- let found
11059
+ let found;
11174
11060
  const iterate_progUi = async function (node, node_id) {
11175
11061
  for (let item of node) {
11176
-
11177
11062
  if (!_.isEmpty(item.attributes)) {
11178
11063
  for await (const [attr, val] of Object.entries(item.attributes)) {
11179
-
11180
- if (attr === "xu-exp:xu-for" || attr === "xu-for") {
11064
+ if (attr === 'xu-exp:xu-for' || attr === 'xu-for') {
11181
11065
  if (val?.includes(field_id)) {
11066
+ const parent_element_ui_id = node_id;
11182
11067
 
11183
- const parent_element_ui_id = node_id
11068
+ const _$elem = $(`[xu-ui-id^=${parent_element_ui_id}]`);
11184
11069
 
11070
+ if (refreshed_ids.includes(_$elem.attr('xu-ui-id'))) break;
11185
11071
 
11186
-
11187
- const _$elem = $(`[xu-ui-id^=${parent_element_ui_id}]`)
11188
-
11189
- if (refreshed_ids.includes(_$elem.attr("xu-ui-id"))) break
11190
-
11191
- if (!_$elem?.length) continue
11192
- const _elem_key = parent_element_ui_id
11193
- const _elem_val = { attributes: [], $elm: _$elem }
11072
+ if (!_$elem?.length) continue;
11073
+ const _elem_key = parent_element_ui_id;
11074
+ const _elem_val = { attributes: [], $elm: _$elem };
11194
11075
 
11195
11076
  $.each(_$elem.data()?.xuAttributes, function (key, val) {
11196
11077
  _elem_val.attributes.push(key);
11197
- })
11078
+ });
11198
11079
 
11199
11080
  await func.UI.worker.add_to_queue(
11200
11081
  SESSION_ID,
11201
- "gui event",
11202
- "execute_xu_for",
11082
+ 'gui event',
11083
+ 'execute_xu_for',
11203
11084
  {
11204
11085
  ui_type: _elem_val.$elm.data().xuData.ui_type,
11205
11086
  SESSION_ID,
@@ -11209,98 +11090,77 @@ func.UI.screen.refresh_xu_attributes = async function (
11209
11090
  },
11210
11091
  new_job,
11211
11092
  _elem_val.$elm,
11212
- _elem_val.$elm.data().xuData.paramsP.dsSessionP
11093
+ _elem_val.$elm.data().xuData.paramsP.dsSessionP,
11213
11094
  );
11214
11095
 
11215
- break
11216
-
11096
+ break;
11217
11097
  }
11218
11098
  }
11219
11099
  }
11220
11100
  }
11221
- if (found) break
11101
+ if (found) break;
11222
11102
 
11223
11103
  if (item.children) {
11224
11104
  await iterate_progUi(item.children, item.id);
11225
11105
  }
11226
11106
  }
11227
- }
11228
- await iterate_progUi(progUi)
11229
- return found
11230
- }
11231
-
11232
- const $xu_embed_div = $(".xu_embed_div");
11233
- const panels_obj = func.UI.utils.get_panels_from_dom(SESSION_ID, true)
11107
+ };
11108
+ await iterate_progUi(progUi);
11109
+ return found;
11110
+ };
11234
11111
 
11112
+ const $xu_embed_div = $('.xu_embed_div');
11113
+ const panels_obj = func.UI.utils.get_panels_from_dom(SESSION_ID, true);
11235
11114
 
11236
11115
  for await (const field_id of fields_arr) {
11237
11116
  // run root
11238
11117
  if ($xu_embed_div.length) {
11239
- const progUi = $xu_embed_div?.data()?.xuData?.screenInfo?.progUi
11118
+ const progUi = $xu_embed_div?.data()?.xuData?.screenInfo?.progUi;
11240
11119
  if (progUi) {
11241
- await iterate_field_in_progUi(progUi, field_id)
11120
+ await iterate_field_in_progUi(progUi, field_id);
11242
11121
  }
11243
11122
  }
11244
11123
  // run panels
11245
- for await (const [parent_element_ui_id, panel_val] of Object.entries(
11246
- panels_obj
11247
- )) {
11248
-
11249
- const prog_doc = await func.utils.DOCS_OBJ.get(
11250
- SESSION_ID,
11251
- panel_val._ds.prog_id
11252
- );
11124
+ for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
11125
+ const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, panel_val._ds.prog_id);
11253
11126
 
11254
- await iterate_field_in_progUi(prog_doc.progUi, field_id)
11127
+ await iterate_field_in_progUi(prog_doc.progUi, field_id);
11255
11128
  }
11256
11129
  }
11257
11130
 
11258
11131
  // }
11259
11132
 
11260
-
11261
-
11262
11133
  func.events.delete_job(SESSION_ID, jobNoP);
11263
-
11264
11134
  };
11265
11135
 
11266
-
11267
- func.UI.screen.refresh_screen = async function (
11268
- SESSION_ID,
11269
- fields_changed_arr,
11270
- datasource_changed,
11271
- fields_changed_datasource
11272
- ) {
11273
- const $elm = func.UI.utils.find_in_element_data(
11274
- "xuPanelData",
11275
- $(SESSION_OBJ[SESSION_ID].root_element),
11276
- "parent_element_ui_id"
11277
- );
11136
+ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
11137
+ const $elm = func.UI.utils.find_in_element_data('xuPanelData', $(SESSION_OBJ[SESSION_ID].root_element), 'parent_element_ui_id');
11278
11138
  // var panels_obj = {};
11279
- const panels_obj = func.UI.utils.get_panels_from_dom(SESSION_ID, false)
11139
+ const panels_obj = func.UI.utils.get_panels_from_dom(SESSION_ID, false);
11280
11140
 
11281
11141
  const find_field_in_progUi = function (progUi, field_id) {
11282
- let found
11142
+ let found;
11283
11143
  const iterate_progUi = function (node) {
11284
11144
  for (let item of node) {
11285
11145
  // if (item.tagName === "xu-panel") {
11286
11146
  if (!_.isEmpty(item.attributes)) {
11287
11147
  for (const [attr, val] of Object.entries(item.attributes)) {
11288
11148
  // if (attr === "xu-exp:program" || attr === "xu-exp:xu-for") {
11289
- if (attr === "xu-exp:program") {
11290
- found = val.includes("@" + field_id)
11149
+ if (attr === 'xu-exp:program') {
11150
+ found = val.includes('@' + field_id);
11291
11151
  }
11292
11152
  }
11293
11153
  }
11294
- if (found) break
11154
+ if (found) break;
11295
11155
  // }
11296
11156
  if (item.children) {
11297
11157
  iterate_progUi(item.children);
11298
11158
  }
11299
11159
  }
11300
- }
11301
- iterate_progUi(progUi)
11302
- return found
11303
- }
11160
+ };
11161
+ iterate_progUi(progUi);
11162
+ return found;
11163
+ };
11304
11164
 
11305
11165
  // // set panels_obj
11306
11166
  // for await (const [elem_key, elem_val] of Object.entries($elm)) {
@@ -11330,13 +11190,8 @@ func.UI.screen.refresh_screen = async function (
11330
11190
  // panels_obj[parent_element_ui_id].ids.push($div.attr("xu-ui-id"));
11331
11191
  // }
11332
11192
 
11333
- for await (const [parent_element_ui_id, panel_val] of Object.entries(
11334
- panels_obj
11335
- )) {
11336
- const prog_doc = await func.utils.DOCS_OBJ.get(
11337
- SESSION_ID,
11338
- panel_val._ds.prog_id
11339
- );
11193
+ for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
11194
+ const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, panel_val._ds.prog_id);
11340
11195
  const progDataSource_str = JSON.stringify(prog_doc.progDataSource);
11341
11196
  // const progUi_str = JSON.stringify(prog_doc.progUi);
11342
11197
 
@@ -11344,58 +11199,48 @@ func.UI.screen.refresh_screen = async function (
11344
11199
 
11345
11200
  var found;
11346
11201
  if (fields_changed_arr) {
11347
- if (
11348
- fields_changed_datasource &&
11349
- panel_val._ds.dsSession < fields_changed_datasource
11350
- ) {
11202
+ if (fields_changed_datasource && panel_val._ds.dsSession < fields_changed_datasource) {
11351
11203
  continue;
11352
11204
  }
11353
11205
  for (const field_id of fields_changed_arr) {
11354
-
11355
11206
  // get panel attributes
11356
- const _attributes =
11357
- panel_val?.$div?.data()?.xuPanelData?.node?.attributes || {};
11207
+ const _attributes = panel_val?.$div?.data()?.xuPanelData?.node?.attributes || {};
11358
11208
 
11359
11209
  // detect if program changed
11360
- found = _attributes["xu-exp:program"]?.includes("@" + field_id);
11210
+ found = _attributes['xu-exp:program']?.includes('@' + field_id);
11361
11211
  if (found) break;
11362
11212
 
11363
-
11364
-
11365
-
11366
11213
  // _attributes holds also info of parameters in code_in: @code
11367
11214
  // search field changed in panel call send parameters exp
11368
11215
  for (const [attr, value] of Object.entries(_attributes)) {
11369
-
11370
11216
  const pattern = /xu-exp:(\w+)/;
11371
11217
  const match = attr.match(pattern);
11372
11218
  // if (!match && value !== "@" + field_id) {
11373
11219
  if (!match) {
11374
11220
  // continue if attribute is not expression
11375
- continue
11221
+ continue;
11376
11222
  }
11377
11223
  // code_in
11378
11224
  const parameter_in_field_id = match?.[1];
11379
11225
  // @code
11380
11226
  if (value.includes(field_id)) {
11381
- // search parameter in field in the target program's progDataSource
11382
- found = progDataSource_str?.includes("@" + parameter_in_field_id);
11383
- if (found) break
11227
+ // search parameter in field in the target program's progDataSource
11228
+ found = progDataSource_str?.includes('@' + parameter_in_field_id);
11229
+ if (found) break;
11384
11230
 
11385
11231
  // found = progUi_str?.includes("@" + parameter_in_field_id);
11386
11232
  // if (found) return false;
11387
11233
 
11388
11234
  // found = find_field_in_progUi(prog_doc.progUi, parameter_in_field_id)
11389
11235
  // if (found) break
11390
-
11391
11236
  }
11392
11237
  }
11393
11238
 
11394
- if (found) break
11239
+ if (found) break;
11395
11240
 
11396
11241
  // search field changed in the target program's progDataSource // @code
11397
- found = progDataSource_str?.includes("@" + field_id);
11398
- if (found) break
11242
+ found = progDataSource_str?.includes('@' + field_id);
11243
+ if (found) break;
11399
11244
 
11400
11245
  // found = progUi_str?.includes("@" + field_id);
11401
11246
  // if (found) return false;
@@ -11423,20 +11268,7 @@ func.UI.screen.refresh_screen = async function (
11423
11268
  // const old_ds = $($org_panel).data().xuData.paramsP.dsSessionP;
11424
11269
  // func.datasource.del(SESSION_ID, old_ds);
11425
11270
 
11426
- const new_$div = await func.UI.screen.render_ui_tree(
11427
- SESSION_ID,
11428
- $div_elm,
11429
- _.cloneDeep(panel_val.$div.data().xuPanelData.node),
11430
- {},
11431
- $div_elm.data().xuData.paramsP,
11432
- null,
11433
- null,
11434
- $div_elm.data().xuData.key,
11435
- null,
11436
- $div_elm.data().xuData.parent_node,
11437
- null,
11438
- $div_elm.data().xuData.$root_container
11439
- );
11271
+ const new_$div = await func.UI.screen.render_ui_tree(SESSION_ID, $div_elm, _.cloneDeep(panel_val.$div.data().xuPanelData.node), {}, $div_elm.data().xuData.paramsP, null, null, $div_elm.data().xuData.key, null, $div_elm.data().xuData.parent_node, null, $div_elm.data().xuData.$root_container);
11440
11272
  // const new_$div = await func.UI.screen.render_ui_tree(
11441
11273
  // SESSION_ID,
11442
11274
  // $div_elm,
@@ -11463,11 +11295,7 @@ func.UI.screen.refresh_screen = async function (
11463
11295
  }
11464
11296
  };
11465
11297
 
11466
- const get_params_obj = async function (
11467
- SESSION_ID,
11468
- prog_id,
11469
- parameters_obj_inP
11470
- ) {
11298
+ const get_params_obj = async function (SESSION_ID, prog_id, parameters_obj_inP) {
11471
11299
  const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);
11472
11300
  if (!_prog) {
11473
11301
  return;
@@ -11476,66 +11304,42 @@ const get_params_obj = async function (
11476
11304
  // get in parameters
11477
11305
  var params_obj = {};
11478
11306
  if (_prog?.properties?.progParams) {
11479
- for await (const [key, val] of Object.entries(
11480
- _prog.properties.progParams
11481
- )) {
11482
- if (!val.data.dir === "in") continue;
11483
- if (typeof parameters_obj_inP?.[val.data.parameter] !== "undefined") {
11307
+ for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
11308
+ if (!val.data.dir === 'in') continue;
11309
+ if (typeof parameters_obj_inP?.[val.data.parameter] !== 'undefined') {
11484
11310
  if (parameters_obj_inP?.[val.data.parameter].fx) {
11485
- let ret = await func.expression.get(
11486
- SESSION_ID,
11487
- parameters_obj_inP?.[val.data.parameter].fx,
11488
- dsSession,
11489
- "parameters"
11490
- );
11311
+ let ret = await func.expression.get(SESSION_ID, parameters_obj_inP?.[val.data.parameter].fx, dsSession, 'parameters');
11491
11312
  params_obj[val.data.parameter] = ret.result;
11492
11313
  } else {
11493
- params_obj[val.data.parameter] =
11494
- parameters_obj_inP?.[val.data.parameter].value;
11314
+ params_obj[val.data.parameter] = parameters_obj_inP?.[val.data.parameter].value;
11495
11315
  }
11496
11316
  continue;
11497
11317
  }
11498
- console.warn(
11499
- `Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`
11500
- );
11318
+ console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
11501
11319
  }
11502
11320
  }
11503
11321
  return params_obj;
11504
11322
  };
11505
- const get_params_obj_new = async function (
11506
- SESSION_ID,
11507
- prog_id,
11508
- nodeP,
11509
- dsSession
11510
- ) {
11323
+ const get_params_obj_new = async function (SESSION_ID, prog_id, nodeP, dsSession) {
11511
11324
  const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);
11512
11325
  if (!_prog) return;
11513
11326
 
11514
11327
  // get in parameters
11515
11328
  var params_obj = {};
11516
11329
  if (_prog?.properties?.progParams) {
11517
- for await (const [key, val] of Object.entries(
11518
- _prog.properties.progParams
11519
- )) {
11520
- if (!["in", "out"].includes(val.data.dir)) continue;
11330
+ for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
11331
+ if (!['in', 'out'].includes(val.data.dir)) continue;
11521
11332
 
11522
11333
  if (nodeP.attributes) {
11523
11334
  if (nodeP.attributes[val.data.parameter]) {
11524
11335
  params_obj[val.data.parameter] = nodeP.attributes[val.data.parameter];
11525
11336
  } else if (nodeP.attributes[`xu-exp:${val.data.parameter}`]) {
11526
- if (val.data.dir == "out") {
11337
+ if (val.data.dir == 'out') {
11527
11338
  // only reference
11528
- params_obj[val.data.parameter] = nodeP.attributes[
11529
- `xu-exp:${val.data.parameter}`
11530
- ].replaceAll("@", "");
11339
+ params_obj[val.data.parameter] = nodeP.attributes[`xu-exp:${val.data.parameter}`].replaceAll('@', '');
11531
11340
  } else {
11532
11341
  // in parameter
11533
- let ret = await func.expression.get(
11534
- SESSION_ID,
11535
- nodeP.attributes[`xu-exp:${val.data.parameter}`],
11536
- dsSession,
11537
- "parameters"
11538
- );
11342
+ let ret = await func.expression.get(SESSION_ID, nodeP.attributes[`xu-exp:${val.data.parameter}`], dsSession, 'parameters');
11539
11343
  params_obj[val.data.parameter] = ret.result;
11540
11344
  }
11541
11345
  }
@@ -11554,30 +11358,13 @@ const get_params_obj_new = async function (
11554
11358
  // }
11555
11359
  continue;
11556
11360
  }
11557
- console.warn(
11558
- `Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`
11559
- );
11361
+ console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
11560
11362
  }
11561
11363
  }
11562
11364
  return params_obj;
11563
11365
  };
11564
11366
 
11565
- func.UI.screen.execute_xu_functions = async function (
11566
- SESSION_ID,
11567
- is_skeleton,
11568
- $root_container,
11569
- nodeP,
11570
- $container,
11571
- paramsP,
11572
- parent_infoP,
11573
- jobNoP,
11574
- keyP,
11575
- parent_nodeP,
11576
- xu_func,
11577
- $elm,
11578
- val,
11579
- is_init
11580
- ) {
11367
+ 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) {
11581
11368
  if (is_skeleton) return;
11582
11369
 
11583
11370
  // console.log(nodeP.id, xu_func, val);
@@ -11591,25 +11378,8 @@ func.UI.screen.execute_xu_functions = async function (
11591
11378
  const init_program = async function () {
11592
11379
  async function render_panel() {
11593
11380
  const prog_id = val.value?.prog || val.value;
11594
- const param_obj = await get_params_obj_new(
11595
- SESSION_ID,
11596
- prog_id,
11597
- nodeP,
11598
- paramsP.dsSessionP
11599
- );
11600
- let ret_panel = await func.UI.screen.init(
11601
- SESSION_ID,
11602
- prog_id,
11603
- paramsP.screenId,
11604
- _ds,
11605
- $elm,
11606
- null,
11607
- _ds.currentRecordId,
11608
- null,
11609
- true,
11610
- param_obj,
11611
- "initXu_panel"
11612
- );
11381
+ const param_obj = await get_params_obj_new(SESSION_ID, prog_id, nodeP, paramsP.dsSessionP);
11382
+ 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');
11613
11383
  ret = { $new_div: ret_panel };
11614
11384
  return ret;
11615
11385
  }
@@ -11620,7 +11390,7 @@ func.UI.screen.execute_xu_functions = async function (
11620
11390
  // }
11621
11391
  if (!val.value) {
11622
11392
  // return render_empty_panel();
11623
- val.value = "_empty_panel_program";
11393
+ val.value = '_empty_panel_program';
11624
11394
  // return { abort: true, program_null: true };
11625
11395
  }
11626
11396
 
@@ -11663,55 +11433,15 @@ func.UI.screen.execute_xu_functions = async function (
11663
11433
  // // func.events.delete_job(SESSION_ID, jobNo);
11664
11434
  // };
11665
11435
  const program = val.value?.prog || val.value;
11666
- var $wrapper = $("<div>");
11667
- var $div = func.UI.screen.create_container(
11668
- SESSION_ID,
11669
- $root_container,
11670
- nodeP,
11671
- $container,
11672
- paramsP,
11673
- parent_infoP,
11674
- jobNoP,
11675
- keyP,
11676
- parent_nodeP,
11677
- nodeP.attributes,
11678
- null,
11679
- null,
11680
- null,
11681
- $wrapper,
11682
- ""
11683
- );
11684
- const param_obj = await get_params_obj_new(
11685
- SESSION_ID,
11686
- program,
11687
- nodeP,
11688
- paramsP.dsSessionP
11689
- );
11690
- let ret_init = await func.UI.screen.init(
11691
- SESSION_ID,
11692
- program,
11693
- paramsP.screenId,
11694
- _ds,
11695
- $div,
11696
- null,
11697
- _ds.currentRecordId,
11698
- jobNoP,
11699
- true,
11700
- param_obj,
11701
- "alterXu_panel"
11702
- );
11436
+ var $wrapper = $('<div>');
11437
+ 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, '');
11438
+ const param_obj = await get_params_obj_new(SESSION_ID, program, nodeP, paramsP.dsSessionP);
11439
+ let ret_init = await func.UI.screen.init(SESSION_ID, program, paramsP.screenId, _ds, $div, null, _ds.currentRecordId, jobNoP, true, param_obj, 'alterXu_panel');
11703
11440
  ret = {
11704
11441
  $new_div: ret_init,
11705
11442
  abort: true,
11706
11443
  };
11707
- await func.UI.screen.panel_post_render_handler(
11708
- SESSION_ID,
11709
- $elm,
11710
- $new_div,
11711
- nodeP,
11712
- $div.clone(true),
11713
- jobNoP
11714
- );
11444
+ await func.UI.screen.panel_post_render_handler(SESSION_ID, $elm, $new_div, nodeP, $div.clone(true), jobNoP);
11715
11445
 
11716
11446
  return ret;
11717
11447
  }
@@ -11729,8 +11459,8 @@ func.UI.screen.execute_xu_functions = async function (
11729
11459
  return alter_program();
11730
11460
  },
11731
11461
  // programParameters: async function ($elm, val) {},
11732
- "xu-render": async function ($elm, val) {
11733
- let ret = await common_fx["xu-render"]($elm, val);
11462
+ 'xu-render': async function ($elm, val) {
11463
+ let ret = await common_fx['xu-render']($elm, val);
11734
11464
  return ret;
11735
11465
  },
11736
11466
  },
@@ -11739,22 +11469,22 @@ func.UI.screen.execute_xu_functions = async function (
11739
11469
  const load_cdn = async function (resource) {
11740
11470
  // console.log("loading cdn", resource);
11741
11471
  if (!_.isObject(resource) && _.isString(resource)) {
11742
- resource = { src: resource, type: "js" };
11472
+ resource = { src: resource, type: 'js' };
11743
11473
  }
11744
11474
  if (!_.isObject(resource)) {
11745
- throw new Error("cdn resource in wrong format");
11475
+ throw new Error('cdn resource in wrong format');
11746
11476
  }
11747
11477
  return new Promise(async (resolve) => {
11748
11478
  try {
11749
11479
  switch (resource.type) {
11750
- case "js":
11480
+ case 'js':
11751
11481
  await func.utils.load_js_on_demand(resource.src);
11752
11482
  break;
11753
- case "css":
11483
+ case 'css':
11754
11484
  await func.utils.load_js_on_demand(resource.src);
11755
11485
  break;
11756
- case "module":
11757
- func.utils.load_js_on_demand(resource.src, "module");
11486
+ case 'module':
11487
+ func.utils.load_js_on_demand(resource.src, 'module');
11758
11488
  break;
11759
11489
 
11760
11490
  default:
@@ -11763,12 +11493,7 @@ func.UI.screen.execute_xu_functions = async function (
11763
11493
  }
11764
11494
  resolve();
11765
11495
  } catch (error) {
11766
- func.utils.debug_report(
11767
- SESSION_ID,
11768
- "xu-cdn",
11769
- "Fail to load: " + resource,
11770
- "W"
11771
- );
11496
+ func.utils.debug_report(SESSION_ID, 'xu-cdn', 'Fail to load: ' + resource, 'W');
11772
11497
  resolve();
11773
11498
  }
11774
11499
 
@@ -11795,38 +11520,34 @@ func.UI.screen.execute_xu_functions = async function (
11795
11520
  };
11796
11521
 
11797
11522
  const common_fx = {
11798
- "xu-bind": async function ($elm, val) {
11523
+ 'xu-bind': async function ($elm, val) {
11799
11524
  if (is_skeleton) return;
11800
11525
 
11801
11526
  // let view_field_id = val.value;
11802
- let val_is_reference_field = false
11527
+ let val_is_reference_field = false;
11803
11528
 
11804
11529
  let _prog_id = $elm.data().xuData.paramsP.prog_id;
11805
11530
  let _dsP = $elm.data().xuData.paramsP.dsSessionP;
11806
11531
  const view_ret = await func.utils.VIEWS_OBJ.get(SESSION_ID, _prog_id);
11807
11532
  if (!view_ret) return {};
11808
11533
 
11809
- let is_dynamic_field = false
11534
+ let is_dynamic_field = false;
11810
11535
  let field_prop;
11811
11536
  let bind_field_id;
11812
- let bind_field_exp
11537
+ let bind_field_exp;
11813
11538
 
11814
11539
  const get_bind_field = async function (field_id) {
11815
- if (["_FOR_VAL", "_FOR_KEY"].includes(field_id)) {
11816
- is_dynamic_field = true
11817
- field_prop = _ds.dynamic_fields[field_id]
11540
+ if (['_FOR_VAL', '_FOR_KEY'].includes(field_id)) {
11541
+ is_dynamic_field = true;
11542
+ field_prop = _ds.dynamic_fields[field_id];
11818
11543
  } else {
11819
- field_prop = func.common.find_item_by_key(
11820
- view_ret.progFields,
11821
- "field_id",
11822
- field_id
11823
- );
11544
+ field_prop = func.common.find_item_by_key(view_ret.progFields, 'field_id', field_id);
11824
11545
  if (!field_prop) {
11825
11546
  /// find the field everywhere in the chain Aug 30 2024
11826
11547
  const ret_get_value = await func.datasource.get_value(
11827
11548
  SESSION_ID,
11828
11549
  field_id,
11829
- _dsP // $elm.data().xuData.paramsP.dsSessionP
11550
+ _dsP, // $elm.data().xuData.paramsP.dsSessionP
11830
11551
  );
11831
11552
 
11832
11553
  if (ret_get_value.found) {
@@ -11835,44 +11556,33 @@ func.UI.screen.execute_xu_functions = async function (
11835
11556
  _prog_id = _ds.prog_id;
11836
11557
  const view_ret = await func.utils.VIEWS_OBJ.get(SESSION_ID, _prog_id);
11837
11558
  if (!view_ret) return {};
11838
- field_prop = func.common.find_item_by_key(
11839
- view_ret.progFields,
11840
- "field_id",
11841
- field_id
11842
- );
11559
+ field_prop = func.common.find_item_by_key(view_ret.progFields, 'field_id', field_id);
11843
11560
  }
11844
11561
  if (!field_prop) {
11845
- throw (`field ${field_id} not found in the program scope`)
11562
+ throw `field ${field_id} not found in the program scope`;
11846
11563
  }
11847
11564
  }
11848
11565
  }
11849
- return field_id
11850
- }
11566
+ return field_id;
11567
+ };
11851
11568
 
11852
11569
  try {
11853
- bind_field_id = await get_bind_field(val.value)
11854
- val_is_reference_field = true
11570
+ bind_field_id = await get_bind_field(val.value);
11571
+ val_is_reference_field = true;
11855
11572
  } catch (err) {
11856
11573
  try {
11857
- if (!_.isEmpty($elm?.data()?.xuAttributes?.["xu-exp:xu-bind"])) {
11858
- bind_field_exp = $elm.data().xuAttributes["xu-exp:xu-bind"]
11859
- const res = (
11860
- await func.expression.get(
11861
- SESSION_ID,
11862
- bind_field_exp,
11863
- paramsP.dsSessionP,
11864
- "UI Attr EXP"
11865
- )
11866
- )
11574
+ if (!_.isEmpty($elm?.data()?.xuAttributes?.['xu-exp:xu-bind'])) {
11575
+ bind_field_exp = $elm.data().xuAttributes['xu-exp:xu-bind'];
11576
+ const res = await func.expression.get(SESSION_ID, bind_field_exp, paramsP.dsSessionP, 'UI Attr EXP');
11867
11577
 
11868
11578
  if (Object.keys(res.fields).length) {
11869
- const field_id_from_exp = Object.keys(res.fields)[0]
11870
- bind_field_id = await get_bind_field(field_id_from_exp)
11579
+ const field_id_from_exp = Object.keys(res.fields)[0];
11580
+ bind_field_id = await get_bind_field(field_id_from_exp);
11871
11581
  } else {
11872
- throw (err.message)
11582
+ throw err.message;
11873
11583
  }
11874
11584
  } else {
11875
- throw (err.message)
11585
+ throw err.message;
11876
11586
  }
11877
11587
  } catch (err) {
11878
11588
  console.error(err.message);
@@ -11881,20 +11591,12 @@ func.UI.screen.execute_xu_functions = async function (
11881
11591
  // return {};
11882
11592
  }
11883
11593
 
11884
-
11885
11594
  const field_changed = async function (e) {
11886
-
11887
11595
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_dsP];
11888
- var value = await func.common.get_cast_val(
11889
- SESSION_ID,
11890
- "xu-bind",
11891
- "value",
11892
- field_prop.props.fieldType,
11893
- bind.getter($elm[0])
11894
- );
11596
+ var value = await func.common.get_cast_val(SESSION_ID, 'xu-bind', 'value', field_prop.props.fieldType, bind.getter($elm[0]));
11895
11597
 
11896
- if (field_prop.props.fieldType === "object" && !val_is_reference_field) {
11897
- value = bind.getter($elm[0])
11598
+ if (field_prop.props.fieldType === 'object' && !val_is_reference_field) {
11599
+ value = bind.getter($elm[0]);
11898
11600
  }
11899
11601
 
11900
11602
  if (!_ds.currentRecordId) return;
@@ -11908,22 +11610,22 @@ func.UI.screen.execute_xu_functions = async function (
11908
11610
  };
11909
11611
 
11910
11612
  await func.datasource.update(SESSION_ID, datasource_changes);
11911
- const iterate_info = $elm?.data()?.xuData?.iterate_info
11912
- const reference_source_obj = iterate_info?.reference_source_obj
11613
+ const iterate_info = $elm?.data()?.xuData?.iterate_info;
11614
+ const reference_source_obj = iterate_info?.reference_source_obj;
11913
11615
  if (reference_source_obj) {
11914
- if (reference_source_obj.ret.type === "array") {
11616
+ if (reference_source_obj.ret.type === 'array') {
11915
11617
  if (iterate_info.iterator_val === bind_field_id) {
11916
- const arr_idx = Number($elm?.data()?.xuData?.iterate_info._key)
11917
- let new_arr = reference_source_obj.ret.value
11918
- if (field_prop.props.fieldType === "object" && !val_is_reference_field) {
11919
- let obj_item = new_arr[arr_idx]
11920
- let e_exp = bind_field_exp.replace("@_FOR_VAL", "obj_item");
11921
- let new_val = eval(e_exp + `=${value}`)
11922
- new_arr[arr_idx] = obj_item
11618
+ const arr_idx = Number($elm?.data()?.xuData?.iterate_info._key);
11619
+ let new_arr = reference_source_obj.ret.value;
11620
+ if (field_prop.props.fieldType === 'object' && !val_is_reference_field) {
11621
+ let obj_item = new_arr[arr_idx];
11622
+ let e_exp = bind_field_exp.replace('@_FOR_VAL', 'obj_item');
11623
+ let new_val = eval(e_exp + `="${value}"`);
11624
+ new_arr[arr_idx] = obj_item;
11923
11625
  } else {
11924
- new_arr[arr_idx] = value
11626
+ new_arr[arr_idx] = value;
11925
11627
  }
11926
- datasource_changes[_dsP][_ds.currentRecordId][reference_source_obj.fieldIdP] = new_arr
11628
+ datasource_changes[_dsP][_ds.currentRecordId][reference_source_obj.fieldIdP] = new_arr;
11927
11629
 
11928
11630
  datasource_changes = {
11929
11631
  [_dsP]: {
@@ -11931,18 +11633,13 @@ func.UI.screen.execute_xu_functions = async function (
11931
11633
  [reference_source_obj.fieldIdP]: new_arr,
11932
11634
  },
11933
11635
  },
11934
- }
11636
+ };
11935
11637
  await func.datasource.update(SESSION_ID, datasource_changes, null, true);
11936
11638
  }
11937
11639
  }
11938
11640
  }
11939
11641
 
11940
-
11941
- await func.datasource.update_changes_for_out_parameter(
11942
- SESSION_ID,
11943
- _dsP,
11944
- _ds.parentDataSourceNo
11945
- );
11642
+ await func.datasource.update_changes_for_out_parameter(SESSION_ID, _dsP, _ds.parentDataSourceNo);
11946
11643
  };
11947
11644
 
11948
11645
  const bind = new UI_FRAMEWORK_PLUGIN.bind();
@@ -11950,10 +11647,9 @@ func.UI.screen.execute_xu_functions = async function (
11950
11647
  bind.listener($elm[0], field_changed);
11951
11648
 
11952
11649
  const set_value = function () {
11953
-
11954
11650
  let _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
11955
11651
  if (!_ds.currentRecordId) return;
11956
- let value
11652
+ let value;
11957
11653
  try {
11958
11654
  if (val_is_reference_field) {
11959
11655
  if (is_dynamic_field) {
@@ -11963,36 +11659,29 @@ func.UI.screen.execute_xu_functions = async function (
11963
11659
  value = _ds.data_feed.rows?.[row_idx]?.[val.value];
11964
11660
  }
11965
11661
  } else {
11966
- value = val.value
11662
+ value = val.value;
11967
11663
  }
11968
- if (typeof value === "undefined") return;
11664
+ if (typeof value === 'undefined') return;
11969
11665
  bind.setter($elm[0], value);
11970
11666
  } catch (err) {
11971
11667
  console.error(err);
11972
11668
  }
11973
-
11974
- }
11669
+ };
11975
11670
  /// init value from ds
11976
- $("body").on("xu-bind-refresh." + _ds.dsSession.toString(), () => {
11977
- set_value()
11671
+ $('body').on('xu-bind-refresh.' + _ds.dsSession.toString(), () => {
11672
+ set_value();
11978
11673
  });
11979
11674
  // $("body").trigger("xu-bind-refresh." + _ds.dsSession.toString());
11980
- set_value()
11675
+ set_value();
11981
11676
  return {};
11982
11677
  },
11983
- "xu-render": async function ($elm, val) {
11984
- var value = await func.common.get_cast_val(
11985
- SESSION_ID,
11986
- "common fx",
11987
- "xu-render",
11988
- "bool",
11989
- val.value
11990
- );
11678
+ 'xu-render': async function ($elm, val) {
11679
+ var value = await func.common.get_cast_val(SESSION_ID, 'common fx', 'xu-render', 'bool', val.value);
11991
11680
  const init_render = function () {
11992
11681
  if (!value) {
11993
11682
  var cloned_$div = $elm.clone(true);
11994
11683
 
11995
- let $xurender = $("<xurender>").appendTo($container).hide();
11684
+ let $xurender = $('<xurender>').appendTo($container).hide();
11996
11685
  let original_data_obj = {
11997
11686
  $container: cloned_$div,
11998
11687
  nodeP: _.cloneDeep(nodeP),
@@ -12002,7 +11691,7 @@ func.UI.screen.execute_xu_functions = async function (
12002
11691
  parent_nodeP,
12003
11692
  $root_container,
12004
11693
  };
12005
- $xurender.data("xuData", cloned_$div.data().xuData);
11694
+ $xurender.data('xuData', cloned_$div.data().xuData);
12006
11695
  $xurender.data().xuData.original_data_obj = original_data_obj;
12007
11696
  $xurender.data().xuData.xurender_node = cloned_$div;
12008
11697
  $xurender.data().xuAttributes = nodeP.attributes;
@@ -12034,7 +11723,7 @@ func.UI.screen.execute_xu_functions = async function (
12034
11723
  null,
12035
11724
  original_data_obj.parent_nodeP,
12036
11725
  null,
12037
- original_data_obj.$root_container
11726
+ original_data_obj.$root_container,
12038
11727
  );
12039
11728
 
12040
11729
  new_$div.data().xuData.original_data_obj = original_data_obj;
@@ -12045,25 +11734,12 @@ func.UI.screen.execute_xu_functions = async function (
12045
11734
  $elm.replaceWith(new_$div);
12046
11735
 
12047
11736
  if (val.fields_arr) {
12048
- return await func.UI.screen.refresh_xu_attributes(
12049
- SESSION_ID,
12050
- val.fields_arr,
12051
- val.jobNoP,
12052
- new_$div
12053
- );
11737
+ return await func.UI.screen.refresh_xu_attributes(SESSION_ID, val.fields_arr, val.jobNoP, new_$div);
12054
11738
  }
12055
11739
  func.events.delete_job(SESSION_ID, jobNoP);
12056
11740
  };
12057
11741
 
12058
- if (
12059
- $elm &&
12060
- func.UI.utils.find_in_element_data(
12061
- "xuData",
12062
- $(SESSION_OBJ[SESSION_ID].root_element),
12063
- "xu_id",
12064
- $elm.data().xuData.xu_id
12065
- ).length
12066
- ) {
11742
+ if ($elm && func.UI.utils.find_in_element_data('xuData', $(SESSION_OBJ[SESSION_ID].root_element), 'xu_id', $elm.data().xuData.xu_id).length) {
12067
11743
  if (new_$div.data().xuData.paramsP) {
12068
11744
  return await replace();
12069
11745
  }
@@ -12073,14 +11749,14 @@ func.UI.screen.execute_xu_functions = async function (
12073
11749
  return;
12074
11750
  }
12075
11751
  // if (!value) {
12076
- if ($elm.prop("tagName") === "XURENDER") {
11752
+ if ($elm.prop('tagName') === 'XURENDER') {
12077
11753
  func.events.delete_job(SESSION_ID, jobNoP);
12078
11754
  return;
12079
11755
  }
12080
11756
 
12081
- let tmp_$div = $("<div>");
11757
+ let tmp_$div = $('<div>');
12082
11758
 
12083
- let $xurender = $("<xurender>").appendTo(tmp_$div).hide();
11759
+ let $xurender = $('<xurender>').appendTo(tmp_$div).hide();
12084
11760
  // was true before
12085
11761
  if ($elm.data().xuData.xurender_node) {
12086
11762
  $xurender.data({
@@ -12110,14 +11786,8 @@ func.UI.screen.execute_xu_functions = async function (
12110
11786
  }
12111
11787
  return await post_render();
12112
11788
  },
12113
- "xu-show": async function ($elm, val) {
12114
- var value = await func.common.get_cast_val(
12115
- SESSION_ID,
12116
- "common fx",
12117
- "xu-show",
12118
- "bool",
12119
- val.value
12120
- );
11789
+ 'xu-show': async function ($elm, val) {
11790
+ var value = await func.common.get_cast_val(SESSION_ID, 'common fx', 'xu-show', 'bool', val.value);
12121
11791
  if (value) {
12122
11792
  $elm.show();
12123
11793
  }
@@ -12126,7 +11796,7 @@ func.UI.screen.execute_xu_functions = async function (
12126
11796
  }
12127
11797
  return {};
12128
11798
  },
12129
- "xu-content": async function ($elm, val) {
11799
+ 'xu-content': async function ($elm, val) {
12130
11800
  try {
12131
11801
  $elm.html(val.value);
12132
11802
  } catch (error) {
@@ -12135,7 +11805,7 @@ func.UI.screen.execute_xu_functions = async function (
12135
11805
 
12136
11806
  return {};
12137
11807
  },
12138
- "xu-for": async function ($elm, data) {
11808
+ 'xu-for': async function ($elm, data) {
12139
11809
  // exit if call from rendered xu-for item to prevent infante loop (parent_infoP?.iterate_info indicate call from rendered item)
12140
11810
  if (parent_infoP?.iterate_info) return {};
12141
11811
  if (!data.value) return {};
@@ -12144,107 +11814,76 @@ func.UI.screen.execute_xu_functions = async function (
12144
11814
  let arr = data.value;
12145
11815
 
12146
11816
  // find reference source field
12147
- let reference_source_obj
11817
+ let reference_source_obj;
12148
11818
 
12149
- const _progFields = await func.datasource.get_progFields(
12150
- SESSION_ID,
12151
- paramsP.dsSessionP
12152
- );
11819
+ const _progFields = await func.datasource.get_progFields(SESSION_ID, paramsP.dsSessionP);
12153
11820
 
12154
- let view_field_obj = func.common.find_item_by_key(
12155
- _progFields,
12156
- "field_id",
12157
- data.value
12158
- );
12159
- // detect if data.value (xu-for) is reference field_id by checking if exist in the dataset
11821
+ let view_field_obj = func.common.find_item_by_key(_progFields, 'field_id', data.value);
11822
+ // detect if data.value (xu-for) is reference field_id by checking if exist in the dataset
12160
11823
  if (view_field_obj) {
12161
11824
  // xu-for is reference field_id
12162
- reference_source_obj = await func.datasource.get_value(SESSION_ID, data.value, paramsP.dsSessionP)
12163
- arr = reference_source_obj?.ret?.value
11825
+ reference_source_obj = await func.datasource.get_value(SESSION_ID, data.value, paramsP.dsSessionP);
11826
+ arr = reference_source_obj?.ret?.value;
12164
11827
  } else {
12165
- // xu-for is actual data
12166
- if (typeof data.value === "string") {
12167
- arr = eval(data.value.replaceAll("\\", ""));
11828
+ // xu-for is actual data
11829
+ if (typeof data.value === 'string') {
11830
+ arr = eval(data.value.replaceAll('\\', ''));
12168
11831
  }
12169
- if (typeof arr === "number") {
11832
+ if (typeof arr === 'number') {
12170
11833
  arr = Array.from(Array(arr).keys());
12171
11834
  }
12172
11835
  }
12173
11836
 
12174
- const custom_iterator_key = $elm.data().xuData.iterator_key
12175
- const custom_iterator_val = $elm.data().xuData.iterator_val
11837
+ const custom_iterator_key = $elm.data().xuData.iterator_key;
11838
+ const custom_iterator_val = $elm.data().xuData.iterator_val;
12176
11839
 
12177
- let iterator_key = custom_iterator_key
12178
- let iterator_val = custom_iterator_val
12179
- let is_key_dynamic_field, is_val_dynamic_field
11840
+ let iterator_key = custom_iterator_key;
11841
+ let iterator_val = custom_iterator_val;
11842
+ let is_key_dynamic_field, is_val_dynamic_field;
12180
11843
 
12181
- // custom FOR_VAL name or namespaced default name
11844
+ // custom FOR_VAL name or namespaced default name
12182
11845
  if (!custom_iterator_key) {
12183
- is_key_dynamic_field = true
11846
+ is_key_dynamic_field = true;
12184
11847
 
12185
11848
  // iterator_key = $elm.data().xuData.node_org.id.replaceAll("-", "_") + "_FOR_KEY";
12186
- iterator_key = "_FOR_KEY";
11849
+ iterator_key = '_FOR_KEY';
12187
11850
  }
12188
11851
 
12189
11852
  if (!custom_iterator_val) {
12190
- is_val_dynamic_field = true
11853
+ is_val_dynamic_field = true;
12191
11854
 
12192
11855
  // iterator_val = $elm.data().xuData.node_org.id.replaceAll("-", "_") + "_FOR_VAL";
12193
- iterator_val = "_FOR_VAL";
11856
+ iterator_val = '_FOR_VAL';
12194
11857
  }
12195
11858
 
12196
11859
  var i = 0;
12197
11860
  for await (let [_key, _val] of Object.entries(arr)) {
12198
-
12199
- if (_.isArray(arr)) { _key = Number(_key) }
11861
+ if (_.isArray(arr)) {
11862
+ _key = Number(_key);
11863
+ }
12200
11864
 
12201
11865
  const set_value = async function (is_dynamic_field, currentRecordId, field_id, value) {
12202
-
12203
-
12204
11866
  if (is_dynamic_field) {
12205
-
12206
- func.datasource.add_dynamic_field_to_ds(
12207
- SESSION_ID,
12208
- paramsP.dsSessionP,
12209
- field_id,
12210
- value
12211
- );
12212
-
11867
+ func.datasource.add_dynamic_field_to_ds(SESSION_ID, paramsP.dsSessionP, field_id, value);
12213
11868
  } else {
11869
+ const _progFields = await func.datasource.get_progFields(SESSION_ID, paramsP.dsSessionP);
12214
11870
 
12215
- const _progFields = await func.datasource.get_progFields(
12216
- SESSION_ID,
12217
- paramsP.dsSessionP
12218
- );
12219
-
12220
- let view_field_obj = func.common.find_item_by_key(
12221
- _progFields,
12222
- "field_id",
12223
- field_id
12224
- );
11871
+ let view_field_obj = func.common.find_item_by_key(_progFields, 'field_id', field_id);
12225
11872
  if (view_field_obj) {
12226
11873
  let _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
12227
11874
  try {
12228
- const row_idx = func.common.find_ROWID_idx(
12229
- _ds,
12230
- currentRecordId
12231
- );
11875
+ const row_idx = func.common.find_ROWID_idx(_ds, currentRecordId);
12232
11876
  _ds.data_feed.rows[row_idx][field_id] = value;
12233
11877
  } catch (err) {
12234
11878
  console.error(err);
12235
11879
  }
12236
11880
  } else {
12237
- console.error("field not exist in dataset for xu-for method")
11881
+ console.error('field not exist in dataset for xu-for method');
12238
11882
  }
12239
11883
  }
12240
-
12241
-
12242
11884
  };
12243
11885
 
12244
- var currentRecordId =
12245
- SESSION_OBJ[SESSION_ID].DS_GLB[
12246
- paramsP.dsSessionP
12247
- ].currentRecordId.toString();
11886
+ var currentRecordId = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP].currentRecordId.toString();
12248
11887
 
12249
11888
  await set_value(is_key_dynamic_field, currentRecordId, iterator_key, _key);
12250
11889
  await set_value(is_val_dynamic_field, currentRecordId, iterator_val, _val);
@@ -12256,10 +11895,10 @@ func.UI.screen.execute_xu_functions = async function (
12256
11895
  iterator_val,
12257
11896
  is_key_dynamic_field,
12258
11897
  is_val_dynamic_field,
12259
- reference_source_obj
11898
+ reference_source_obj,
12260
11899
  };
12261
- let _parent_info = _.cloneDeep(parent_infoP) || {}
12262
- _parent_info.iterate_info = iterate_info
11900
+ let _parent_info = _.cloneDeep(parent_infoP) || {};
11901
+ _parent_info.iterate_info = iterate_info;
12263
11902
  // if (parent_infoP) {
12264
11903
  // _parent_info = iterate_info;
12265
11904
  // } else {
@@ -12271,7 +11910,7 @@ func.UI.screen.execute_xu_functions = async function (
12271
11910
  SESSION_ID,
12272
11911
  $container,
12273
11912
  nodeP,
12274
- _parent_info,//parent_infoP ? _.cloneDeep(_parent_info) : null,
11913
+ _parent_info, //parent_infoP ? _.cloneDeep(_parent_info) : null,
12275
11914
  paramsP,
12276
11915
  jobNoP,
12277
11916
  null,
@@ -12279,7 +11918,7 @@ func.UI.screen.execute_xu_functions = async function (
12279
11918
  null,
12280
11919
  nodeP,
12281
11920
  null,
12282
- $root_container
11921
+ $root_container,
12283
11922
  );
12284
11923
 
12285
11924
  $.each($divP.children(), function (key, val) {
@@ -12293,19 +11932,19 @@ func.UI.screen.execute_xu_functions = async function (
12293
11932
  $elm.remove();
12294
11933
  return { abort: true };
12295
11934
  } catch (e) {
12296
- console.error(" Iterator Arr parse error");
11935
+ console.error(' Iterator Arr parse error');
12297
11936
  return { abort: true };
12298
11937
  }
12299
11938
  },
12300
- "xu-for-key": async function ($elm, val) {
11939
+ 'xu-for-key': async function ($elm, val) {
12301
11940
  $elm.data().xuData.iterator_key = val.value;
12302
11941
  return {};
12303
11942
  },
12304
- "xu-for-val": async function ($elm, val) {
11943
+ 'xu-for-val': async function ($elm, val) {
12305
11944
  $elm.data().xuData.iterator_val = val.value;
12306
11945
  return {};
12307
11946
  },
12308
- "xu-class": async function ($elm, val) {
11947
+ 'xu-class': async function ($elm, val) {
12309
11948
  try {
12310
11949
  let obj = JSON.parse(val.value);
12311
11950
  for await (const [cla, cond] of Object.entries(obj)) {
@@ -12314,8 +11953,8 @@ func.UI.screen.execute_xu_functions = async function (
12314
11953
  SESSION_ID,
12315
11954
  cond,
12316
11955
  paramsP.dsSessionP,
12317
- "UI Attr EXP",
12318
- $elm.data().xuData.currentRecordId // SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP].currentRecordId
11956
+ 'UI Attr EXP',
11957
+ $elm.data().xuData.currentRecordId, // SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP].currentRecordId
12319
11958
  )
12320
11959
  ).result;
12321
11960
  if (res) {
@@ -12326,12 +11965,12 @@ func.UI.screen.execute_xu_functions = async function (
12326
11965
  }
12327
11966
  return {};
12328
11967
  } catch (e) {
12329
- console.warn("parse error:" + val.value);
11968
+ console.warn('parse error:' + val.value);
12330
11969
  return { abort: true };
12331
11970
  }
12332
11971
  },
12333
- "xu-exp": async function ($elm, val) {
12334
- let exp = val.value === null ? true : val.value
11972
+ 'xu-exp': async function ($elm, val) {
11973
+ let exp = val.value === null ? true : val.value;
12335
11974
  // if (val.value.includes("@_FOR_KEY")) {
12336
11975
  // exp = exp.replaceAll("@_FOR_KEY", "@" + $elm.data().xuData.iterate_info.iterator_key);
12337
11976
  // }
@@ -12340,15 +11979,7 @@ func.UI.screen.execute_xu_functions = async function (
12340
11979
  // exp = exp.replaceAll("@_FOR_VAL", "@" + $elm.data().xuData.iterate_info.iterator_val);
12341
11980
  // }
12342
11981
 
12343
-
12344
-
12345
- let exp_ret = await func.expression.get(
12346
- SESSION_ID,
12347
- exp,
12348
- paramsP.dsSessionP,
12349
- "UI Attr EXP",
12350
- SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP].currentRecordId
12351
- );
11982
+ let exp_ret = await func.expression.get(SESSION_ID, exp, paramsP.dsSessionP, 'UI Attr EXP', SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP].currentRecordId);
12352
11983
 
12353
11984
  let value = func.UI.screen.fix_val_defaults(val.key, exp_ret.result);
12354
11985
 
@@ -12357,7 +11988,7 @@ func.UI.screen.execute_xu_functions = async function (
12357
11988
  value,
12358
11989
  };
12359
11990
 
12360
- if (nodeP.tagName.substr(0, 3) === "xu-") {
11991
+ if (nodeP.tagName.substr(0, 3) === 'xu-') {
12361
11992
  if (tag_fx[nodeP.tagName][new_val.key]) {
12362
11993
  return await tag_fx[nodeP.tagName][new_val.key]($elm, new_val);
12363
11994
  }
@@ -12367,7 +11998,7 @@ func.UI.screen.execute_xu_functions = async function (
12367
11998
  $elm.data().xuData.debug_info.attribute_stat[new_val.key] = new_val.value;
12368
11999
 
12369
12000
  // IGNORE UNDEFINED or NULL ATTRIBUTES
12370
- if (typeof new_val.value === "undefined" || new_val.value === null) {
12001
+ if (typeof new_val.value === 'undefined' || new_val.value === null) {
12371
12002
  return {};
12372
12003
  }
12373
12004
 
@@ -12376,77 +12007,40 @@ func.UI.screen.execute_xu_functions = async function (
12376
12007
  return {};
12377
12008
  }
12378
12009
 
12379
- if (new_val.key.substr(0, 2) === "xu") {
12010
+ if (new_val.key.substr(0, 2) === 'xu') {
12380
12011
  return await common_fx[new_val.key]($elm, new_val);
12381
12012
  }
12382
12013
 
12383
- $elm.attr(new_val.key, ($elm.attr(new_val.key) || "") + new_val.value);
12014
+ $elm.attr(new_val.key, ($elm.attr(new_val.key) || '') + new_val.value);
12384
12015
  return {};
12385
12016
  },
12386
- "xu-on": async function ($elm, val) {
12017
+ 'xu-on': async function ($elm, val) {
12387
12018
  CLIENT_ACTIVITY_TS = Date.now();
12388
- const trigger = val.key.split("xu-on:")[1].toLowerCase();
12019
+ const trigger = val.key.split('xu-on:')[1].toLowerCase();
12389
12020
  $elm.on(trigger, async function (e) {
12390
- for await (const [key, val] of Object.entries(
12391
- $elm.data().xuAttributes["xu-on:" + e.type]
12392
- )) {
12393
- if (val.handler === "custom") {
12021
+ for await (const [key, val] of Object.entries($elm.data().xuAttributes['xu-on:' + e.type])) {
12022
+ if (val.handler === 'custom') {
12394
12023
  // do BL
12395
12024
  for await (const [key2, val2] of Object.entries(val.event)) {
12396
12025
  var cond = val2.data.enabled;
12397
12026
  if (val2.data.enabled && val2.props.condition) {
12398
- expCond = await func.expression.get(
12399
- SESSION_ID,
12400
- val2.props.condition,
12401
- paramsP.dsSessionP,
12402
- "condition",
12403
- paramsP.recordid
12404
- ); // execute expression
12027
+ expCond = await func.expression.get(SESSION_ID, val2.props.condition, paramsP.dsSessionP, 'condition', paramsP.recordid); // execute expression
12405
12028
  cond = expCond.result;
12406
12029
  }
12407
12030
  if (!cond) continue;
12408
- func.events.add_to_queue(
12409
- SESSION_ID,
12410
- "element event",
12411
- val2.id,
12412
- e.type,
12413
- val2.data.action,
12414
- val2.data.name,
12415
- null,
12416
- $elm.attr("xu-ui-id"),
12417
- null,
12418
- null,
12419
- null,
12420
- null,
12421
- null,
12422
- paramsP.dsSessionP,
12423
- null,
12424
- null,
12425
- null,
12426
- e.type,
12427
- val2.data.name,
12428
- null,
12429
- null,
12430
- val2,
12431
- null,
12432
- null,
12433
- null,
12434
- null,
12435
- null,
12436
- null
12437
- );
12031
+ func.events.add_to_queue(SESSION_ID, 'element event', val2.id, e.type, val2.data.action, val2.data.name, null, $elm.attr('xu-ui-id'), null, null, null, null, null, paramsP.dsSessionP, null, null, null, e.type, val2.data.name, null, null, val2, null, null, null, null, null, null);
12438
12032
  }
12439
12033
  }
12440
12034
  }
12441
12035
  });
12442
12036
  return {};
12443
12037
  },
12444
- "xu-script": async function ($elm, val) {
12038
+ 'xu-script': async function ($elm, val) {
12445
12039
  var checkExist = setInterval(function () {
12446
- if ($elm.is(":visible")) {
12040
+ if ($elm.is(':visible')) {
12447
12041
  try {
12448
- var res = eval("(" + val.value + ")");
12449
- if (typeof res === "function") {
12042
+ var res = eval('(' + val.value + ')');
12043
+ if (typeof res === 'function') {
12450
12044
  res($elm[0]);
12451
12045
  }
12452
12046
  } catch (e) {
@@ -12459,71 +12053,54 @@ func.UI.screen.execute_xu_functions = async function (
12459
12053
 
12460
12054
  return {};
12461
12055
  },
12462
- "xu-style-global": async function ($elm, val) {
12463
- $("head").append(`<style>${val.value}</style>`);
12056
+ 'xu-style-global': async function ($elm, val) {
12057
+ $('head').append(`<style>${val.value}</style>`);
12464
12058
  return {};
12465
12059
  },
12466
- "xu-style": async function ($elm, val) {
12060
+ 'xu-style': async function ($elm, val) {
12467
12061
  var cssString = val.value;
12468
12062
 
12469
12063
  var parser = new cssjs();
12470
12064
 
12471
12065
  var parsed = parser.parseCSS(cssString);
12472
- var xuUiId = `[xu-ui-id="${$elm.attr("xu-ui-id")}"]`;
12066
+ var xuUiId = `[xu-ui-id="${$elm.attr('xu-ui-id')}"]`;
12473
12067
 
12474
12068
  $.each(parsed, function (key, val) {
12475
- var selectors_arr = val.selector.split(",");
12069
+ var selectors_arr = val.selector.split(',');
12476
12070
 
12477
12071
  $.each(selectors_arr, function (key2, val2) {
12478
12072
  selectors_arr[key2] = `${xuUiId} ${val2}, ${xuUiId}${val2}`;
12479
12073
  // console.log(new_selector);
12480
12074
  });
12481
12075
 
12482
- val.selector = selectors_arr.join(",");
12076
+ val.selector = selectors_arr.join(',');
12483
12077
  // console.log(parsed);
12484
12078
  });
12485
12079
 
12486
12080
  var newCSSString = parser.getCSSForEditor(parsed);
12487
12081
 
12488
- $("head").append(`<style>${newCSSString}</style>`);
12082
+ $('head').append(`<style>${newCSSString}</style>`);
12489
12083
  return {};
12490
12084
  },
12491
- "xu-cdn": async function ($elm, val) {
12085
+ 'xu-cdn': async function ($elm, val) {
12492
12086
  for await (const [key, resource] of Object.entries(val.value)) {
12493
12087
  await load_cdn(resource);
12494
12088
  }
12495
12089
 
12496
12090
  return {};
12497
12091
  },
12498
- "xu-ui-plugin": async function ($elm, val) {
12092
+ 'xu-ui-plugin': async function ($elm, val) {
12499
12093
  var _session = SESSION_OBJ[SESSION_ID];
12500
12094
 
12501
12095
  for await (const [plugin_name, value] of Object.entries(val.value)) {
12502
- const _plugin =
12503
- APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
12504
- if (
12505
- _plugin?.installed &&
12506
- _plugin?.manifest?.["runtime.mjs"]?.exist &&
12507
- _plugin?.manifest?.["index.mjs"]?.exist &&
12508
- value.enabled
12509
- ) {
12510
- if (
12511
- _plugin?.manifest?.["runtime.mjs"].dist &&
12512
- _plugin?.manifest?.["runtime.mjs"]?.css
12513
- ) {
12514
- const plugin_runtime_css_url = await func.utils.get_plugin_npm_cdn(
12515
- SESSION_ID,
12516
- plugin_name,
12517
- "dist/runtime.css"
12518
- );
12096
+ const _plugin = APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
12097
+ if (_plugin?.installed && _plugin?.manifest?.['runtime.mjs']?.exist && _plugin?.manifest?.['index.mjs']?.exist && value.enabled) {
12098
+ if (_plugin?.manifest?.['runtime.mjs'].dist && _plugin?.manifest?.['runtime.mjs']?.css) {
12099
+ const plugin_runtime_css_url = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, 'dist/runtime.css');
12519
12100
  func.utils.load_css_on_demand(plugin_runtime_css_url);
12520
12101
  }
12521
12102
 
12522
- const plugin_index_src = await func.utils.get_plugin_npm_cdn(
12523
- SESSION_ID,
12524
- plugin_name,
12525
- `${_plugin.manifest["index.mjs"].dist ? "dist/" : ""}index.mjs`
12526
- );
12103
+ const plugin_index_src = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, `${_plugin.manifest['index.mjs'].dist ? 'dist/' : ''}index.mjs`);
12527
12104
 
12528
12105
  const plugin_index_resources = await import(plugin_index_src);
12529
12106
 
@@ -12532,45 +12109,29 @@ func.UI.screen.execute_xu_functions = async function (
12532
12109
  prop_val.value = value?.attributes?.[prop_name];
12533
12110
  }
12534
12111
 
12535
- const plugin_runtime_src = await func.utils.get_plugin_npm_cdn(
12536
- SESSION_ID,
12537
- plugin_name,
12538
- `${_plugin.manifest["runtime.mjs"].dist ? "dist/" : ""}runtime.mjs`
12539
- );
12112
+ const plugin_runtime_src = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, `${_plugin.manifest['runtime.mjs'].dist ? 'dist/' : ''}runtime.mjs`);
12540
12113
 
12541
12114
  const plugin_runtime_resources = await import(plugin_runtime_src);
12542
12115
 
12543
- if (
12544
- plugin_runtime_resources.cdn &&
12545
- typeof _.isArray(plugin_runtime_resources.cdn)
12546
- ) {
12116
+ if (plugin_runtime_resources.cdn && typeof _.isArray(plugin_runtime_resources.cdn)) {
12547
12117
  for await (const resource of plugin_runtime_resources.cdn) {
12548
12118
  await load_cdn(resource);
12549
12119
  }
12550
12120
  }
12551
12121
 
12552
12122
  if (plugin_runtime_resources.fn) {
12553
- await plugin_runtime_resources.fn(
12554
- plugin_name,
12555
- $elm?.[0],
12556
- properties
12557
- );
12123
+ await plugin_runtime_resources.fn(plugin_name, $elm?.[0], properties);
12558
12124
  }
12559
12125
  }
12560
12126
  }
12561
12127
 
12562
12128
  return {};
12563
12129
  },
12564
- "xu-store": async function ($elm, val) {
12130
+ 'xu-store': async function ($elm, val) {
12565
12131
  try {
12566
12132
  const fields_obj = JSON5.parse(val.value);
12567
12133
  for (const [field_id, value] of Object.entries(fields_obj)) {
12568
- func.datasource.add_dynamic_field_to_ds(
12569
- SESSION_ID,
12570
- paramsP.dsSessionP,
12571
- field_id,
12572
- value
12573
- );
12134
+ func.datasource.add_dynamic_field_to_ds(SESSION_ID, paramsP.dsSessionP, field_id, value);
12574
12135
  }
12575
12136
  } catch (err) {
12576
12137
  console.error(err);
@@ -12579,8 +12140,8 @@ func.UI.screen.execute_xu_functions = async function (
12579
12140
  },
12580
12141
  };
12581
12142
 
12582
- if (nodeP.tagName.substr(0, 3) === "xu-") {
12583
- if (xu_func === "xu-exp") {
12143
+ if (nodeP.tagName.substr(0, 3) === 'xu-') {
12144
+ if (xu_func === 'xu-exp') {
12584
12145
  return common_fx[xu_func]($elm, val);
12585
12146
  }
12586
12147
 
@@ -12598,7 +12159,7 @@ func.UI.screen.execute_xu_functions = async function (
12598
12159
  if (!$elm.data().xuData.debug_info.attribute_stat) {
12599
12160
  $elm.data().xuData.debug_info.attribute_stat = {};
12600
12161
  }
12601
- if (xu_func !== "xu-exp") {
12162
+ if (xu_func !== 'xu-exp') {
12602
12163
  $elm.data().xuData.debug_info.attribute_stat[xu_func] = val.value;
12603
12164
  }
12604
12165
  try {
@@ -12611,35 +12172,21 @@ func.UI.screen.execute_xu_functions = async function (
12611
12172
  func.UI.screen.fix_val_defaults = function (key, val) {
12612
12173
  var ret = val;
12613
12174
  if (
12614
- key === "xu-render" &&
12615
- (typeof val === "undefined" || val === null) //|| val === ""
12175
+ key === 'xu-render' &&
12176
+ (typeof val === 'undefined' || val === null) //|| val === ""
12616
12177
  ) {
12617
- ret = "Y"; // was ret = "N";
12178
+ ret = 'Y'; // was ret = "N";
12618
12179
  }
12619
12180
  if (
12620
- key === "xu-show" &&
12621
- (typeof val === "undefined" || val === null) //|| val === ""
12181
+ key === 'xu-show' &&
12182
+ (typeof val === 'undefined' || val === null) //|| val === ""
12622
12183
  ) {
12623
- ret = "Y";
12184
+ ret = 'Y';
12624
12185
  }
12625
12186
  return ret;
12626
12187
  };
12627
12188
 
12628
- func.UI.screen.set_attributes_new = async function (
12629
- SESSION_ID,
12630
- is_skeleton,
12631
- $root_container,
12632
- nodeP,
12633
- $container,
12634
- paramsP,
12635
- parent_infoP,
12636
- jobNoP,
12637
- keyP,
12638
- parent_nodeP,
12639
- $elm,
12640
- is_init,
12641
- execute_attributes = []
12642
- ) {
12189
+ func.UI.screen.set_attributes_new = async function (SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $elm, is_init, execute_attributes = []) {
12643
12190
  var done_exp = [];
12644
12191
 
12645
12192
  const _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
@@ -12650,36 +12197,26 @@ func.UI.screen.set_attributes_new = async function (
12650
12197
  const attr = `xu-exp:${attrib}`;
12651
12198
  // const attr = `xu-exp-${attrib}`;
12652
12199
  var value = nodeP.attributes[attr];
12653
- if (!value)
12654
- return func.UI.screen.fix_val_defaults(
12655
- attrib,
12656
- value || nodeP.attributes[attrib]
12657
- );
12200
+ if (!value) return func.UI.screen.fix_val_defaults(attrib, value || nodeP.attributes[attrib]);
12658
12201
 
12659
- var res = await func.expression.get(
12660
- SESSION_ID,
12661
- value,
12662
- paramsP.dsSessionP,
12663
- "UI Attr EXP",
12664
- _ds.currentRecordId
12665
- );
12202
+ var res = await func.expression.get(SESSION_ID, value, paramsP.dsSessionP, 'UI Attr EXP', _ds.currentRecordId);
12666
12203
  nodeP.attributes[attr] = value; //{ value: value, res: res };
12667
12204
  done_exp.push(attr);
12668
12205
  return func.UI.screen.fix_val_defaults(attrib, res.result);
12669
12206
  };
12670
12207
 
12671
12208
  var _ret = {};
12672
- if (nodeP.type !== "element" || !nodeP.attributes) return _ret;
12209
+ if (nodeP.type !== 'element' || !nodeP.attributes) return _ret;
12673
12210
 
12674
12211
  for (let [key, val] of Object.entries(nodeP.attributes)) {
12675
12212
  // REMOVE STATIC ATTRIBUTES IF EXP EXISTS to avoid dup
12676
- if (key.substring(0, 6) === "xu-exp") {
12213
+ if (key.substring(0, 6) === 'xu-exp') {
12677
12214
  if (_.isEmpty(val)) {
12678
12215
  delete nodeP.attributes[key];
12679
- continue
12216
+ continue;
12680
12217
  }
12681
- const clean_key = key.split(":")[1];
12682
- if (typeof nodeP.attributes[clean_key] !== "undefined") {
12218
+ const clean_key = key.split(':')[1];
12219
+ if (typeof nodeP.attributes[clean_key] !== 'undefined') {
12683
12220
  delete nodeP.attributes[clean_key];
12684
12221
  }
12685
12222
  }
@@ -12687,13 +12224,13 @@ func.UI.screen.set_attributes_new = async function (
12687
12224
  if (glb.attr_abbreviations_arr.includes(key)) {
12688
12225
  nodeP.attributes[`xu-on:${key.substring(3)}`] = [
12689
12226
  {
12690
- handler: "custom",
12227
+ handler: 'custom',
12691
12228
  props: {},
12692
12229
  event: [
12693
12230
  {
12694
12231
  id: Date.now(),
12695
12232
  data: {
12696
- action: "update",
12233
+ action: 'update',
12697
12234
  name: { value: val },
12698
12235
  enabled: true,
12699
12236
  },
@@ -12711,7 +12248,7 @@ func.UI.screen.set_attributes_new = async function (
12711
12248
  val = func.UI.screen.fix_val_defaults(key, val);
12712
12249
 
12713
12250
  // REMOVE UNDEFINED or NULL ATTRIBUTES
12714
- if (typeof val === "undefined" || val === null) {
12251
+ if (typeof val === 'undefined' || val === null) {
12715
12252
  delete nodeP.attributes[key];
12716
12253
  }
12717
12254
 
@@ -12725,17 +12262,11 @@ func.UI.screen.set_attributes_new = async function (
12725
12262
 
12726
12263
  for await (const [key, attr] of Object.entries(glb.run_xu_before)) {
12727
12264
  if (_ret.abort) break;
12728
- if (
12729
- glb.html5_events_handler.includes(attr) ||
12730
- execute_attributes.includes(attr)
12731
- ) {
12265
+ if (glb.html5_events_handler.includes(attr) || execute_attributes.includes(attr)) {
12732
12266
  continue;
12733
12267
  }
12734
12268
 
12735
- if (
12736
- !nodeP.attributes ||
12737
- !nodeP.attributes[attr] & !nodeP.attributes[`xu-exp:${attr}`]
12738
- ) {
12269
+ if (!nodeP.attributes || !nodeP.attributes[attr] & !nodeP.attributes[`xu-exp:${attr}`]) {
12739
12270
  continue;
12740
12271
  }
12741
12272
 
@@ -12757,7 +12288,7 @@ func.UI.screen.set_attributes_new = async function (
12757
12288
  // value: _value,
12758
12289
  value: (await get_xuExp(attr)) || nodeP.attributes[attr],
12759
12290
  },
12760
- is_init
12291
+ is_init,
12761
12292
  );
12762
12293
  _ret = _.assignIn(_ret, ret);
12763
12294
  }
@@ -12767,17 +12298,14 @@ func.UI.screen.set_attributes_new = async function (
12767
12298
  // let svg_attributes_str = ""
12768
12299
  for await (const [key, val] of Object.entries(nodeP.attributes)) {
12769
12300
  if (_ret.abort) break;
12770
- if (
12771
- glb.html5_events_handler.includes(key) ||
12772
- execute_attributes.includes(key)
12773
- ) {
12301
+ if (glb.html5_events_handler.includes(key) || execute_attributes.includes(key)) {
12774
12302
  continue;
12775
12303
  }
12776
12304
 
12777
- const new_key = key.split(":")[0]; // break expression
12305
+ const new_key = key.split(':')[0]; // break expression
12778
12306
  if (
12779
- nodeP.tagName !== "xu-panel" && // nodeP.tagName.substr(0, 3) !== "xu-" &&
12780
- (new_key.substr(0, 2) !== "xu" || new_key.substr(2, 1) !== "-")
12307
+ nodeP.tagName !== 'xu-panel' && // nodeP.tagName.substr(0, 3) !== "xu-" &&
12308
+ (new_key.substr(0, 2) !== 'xu' || new_key.substr(2, 1) !== '-')
12781
12309
  ) {
12782
12310
  // handle common html attributes
12783
12311
  try {
@@ -12785,7 +12313,7 @@ func.UI.screen.set_attributes_new = async function (
12785
12313
  // if (nodeP.tagName === "svg") {
12786
12314
  // svg_attributes_str += `${key}="${val}" `
12787
12315
  // } else {
12788
- $elm.get(0).setAttribute(key, val)
12316
+ $elm.get(0).setAttribute(key, val);
12789
12317
  // }
12790
12318
  } catch (err) {
12791
12319
  console.error(err.message);
@@ -12802,16 +12330,11 @@ func.UI.screen.set_attributes_new = async function (
12802
12330
  console.error(error);
12803
12331
  }
12804
12332
 
12805
- if (
12806
- new_key === "xu-exp" ||
12807
- nodeP.attributes["xu-exp:" + new_key] ||
12808
- glb.run_xu_before.includes(new_key) ||
12809
- glb.run_xu_after.includes(new_key)
12810
- ) {
12333
+ if (new_key === 'xu-exp' || nodeP.attributes['xu-exp:' + new_key] || glb.run_xu_before.includes(new_key) || glb.run_xu_after.includes(new_key)) {
12811
12334
  continue;
12812
12335
  }
12813
12336
 
12814
- if (new_key === "xu-on") {
12337
+ if (new_key === 'xu-on') {
12815
12338
  let ret = await func.UI.screen.execute_xu_functions(
12816
12339
  SESSION_ID,
12817
12340
  is_skeleton,
@@ -12823,13 +12346,13 @@ func.UI.screen.set_attributes_new = async function (
12823
12346
  jobNoP,
12824
12347
  keyP,
12825
12348
  parent_nodeP,
12826
- "xu-on",
12349
+ 'xu-on',
12827
12350
  $elm,
12828
12351
  {
12829
12352
  key: key,
12830
12353
  value: (await get_xuExp(new_key)) || val,
12831
12354
  },
12832
- is_init
12355
+ is_init,
12833
12356
  );
12834
12357
  _ret = _.assignIn(_ret, ret);
12835
12358
  continue;
@@ -12852,7 +12375,7 @@ func.UI.screen.set_attributes_new = async function (
12852
12375
  key: key,
12853
12376
  value: (await get_xuExp(new_key)) || val,
12854
12377
  },
12855
- is_init
12378
+ is_init,
12856
12379
  );
12857
12380
 
12858
12381
  _ret = _.assignIn(_ret, ret);
@@ -12862,23 +12385,18 @@ func.UI.screen.set_attributes_new = async function (
12862
12385
  // console.log(svg_attributes_str);
12863
12386
  // }
12864
12387
 
12865
-
12866
12388
  // EXP for
12867
12389
 
12868
12390
  for await (const [key, val] of Object.entries(nodeP.attributes)) {
12869
12391
  if (_ret.abort) break;
12870
12392
 
12871
- const attr = key.split("xu-exp:")[1];
12393
+ const attr = key.split('xu-exp:')[1];
12872
12394
 
12873
12395
  if (!attr) {
12874
12396
  continue;
12875
12397
  }
12876
12398
 
12877
- if (
12878
- glb.html5_events_handler.includes(attr) ||
12879
- execute_attributes.includes(attr)
12880
- )
12881
- continue;
12399
+ if (glb.html5_events_handler.includes(attr) || execute_attributes.includes(attr)) continue;
12882
12400
 
12883
12401
  if (done_exp.includes(key)) {
12884
12402
  continue;
@@ -12894,13 +12412,13 @@ func.UI.screen.set_attributes_new = async function (
12894
12412
  jobNoP,
12895
12413
  keyP,
12896
12414
  parent_nodeP,
12897
- "xu-exp",
12415
+ 'xu-exp',
12898
12416
  $elm,
12899
12417
  {
12900
12418
  key: attr,
12901
12419
  value: val,
12902
12420
  },
12903
- true
12421
+ true,
12904
12422
  );
12905
12423
  _ret = _.assignIn(_ret, ret);
12906
12424
  }
@@ -12908,17 +12426,9 @@ func.UI.screen.set_attributes_new = async function (
12908
12426
  // AFTER
12909
12427
 
12910
12428
  for await (const [key, attr] of Object.entries(glb.run_xu_after)) {
12911
- if (
12912
- glb.html5_events_handler.includes(attr) ||
12913
- execute_attributes.includes(attr)
12914
- )
12915
- continue;
12429
+ if (glb.html5_events_handler.includes(attr) || execute_attributes.includes(attr)) continue;
12916
12430
 
12917
- if (
12918
- !nodeP.attributes ||
12919
- !nodeP.attributes[attr] & !nodeP.attributes[`xu-exp:${attr}`]
12920
- )
12921
- continue;
12431
+ if (!nodeP.attributes || !nodeP.attributes[attr] & !nodeP.attributes[`xu-exp:${attr}`]) continue;
12922
12432
 
12923
12433
  let ret = await func.UI.screen.execute_xu_functions(
12924
12434
  SESSION_ID,
@@ -12937,7 +12447,7 @@ func.UI.screen.set_attributes_new = async function (
12937
12447
  key: attr,
12938
12448
  value: (await get_xuExp(attr)) || nodeP.attributes[attr],
12939
12449
  },
12940
- is_init
12450
+ is_init,
12941
12451
  );
12942
12452
  _ret = _.assignIn(_ret, ret);
12943
12453
  }
@@ -12958,19 +12468,12 @@ func.UI.screen.panel_post_render_handler = async function (
12958
12468
  $wrapper, // the wrapper element contains the rendered panel elements e.g: xu-single-view
12959
12469
  nodeP, // the xu-panel node
12960
12470
  $panel_div, // the panel div
12961
- jobNoP
12471
+ jobNoP,
12962
12472
  ) {
12963
- const _container_ds =
12964
- SESSION_OBJ[SESSION_ID].DS_GLB[$container.data().xuData.paramsP.dsSessionP];
12965
- const _ds =
12966
- SESSION_OBJ[SESSION_ID].DS_GLB[$wrapper.data().xuData.paramsP.dsSessionP];
12473
+ const _container_ds = SESSION_OBJ[SESSION_ID].DS_GLB[$container.data().xuData.paramsP.dsSessionP];
12474
+ const _ds = SESSION_OBJ[SESSION_ID].DS_GLB[$wrapper.data().xuData.paramsP.dsSessionP];
12967
12475
  const find_old_panels_elements = function () {
12968
- return func.UI.utils.find_in_element_data(
12969
- "xuPanelData",
12970
- $container.parent(),
12971
- "xu-ui-id",
12972
- $container.data()?.xuPanelData?.xu_panel_xu_ui_id
12973
- );
12476
+ return func.UI.utils.find_in_element_data('xuPanelData', $container.parent(), 'xu-ui-id', $container.data()?.xuPanelData?.xu_panel_xu_ui_id);
12974
12477
  };
12975
12478
  var $old_panel_div = find_old_panels_elements();
12976
12479
  const set_xuPanelData_to_the_new_rendered_items = (_) => {
@@ -12978,12 +12481,9 @@ func.UI.screen.panel_post_render_handler = async function (
12978
12481
  if (!$(val).data().xuPanelData) {
12979
12482
  $(val).data().xuPanelData = {};
12980
12483
  }
12981
- $(val).data().xuPanelData.parent_element_ui_id = $old_panel_div?.length
12982
- ? $container.parent().data().xuData.ui_id
12983
- : $container.data().xuData.ui_id;
12484
+ $(val).data().xuPanelData.parent_element_ui_id = $old_panel_div?.length ? $container.parent().data().xuData.ui_id : $container.data().xuData.ui_id;
12984
12485
 
12985
- $(val).data().xuPanelData.xu_panel_xu_ui_id =
12986
- (nodeP.xu_tree_id || nodeP.id) + "-" + _container_ds?.currentRecordId;
12486
+ $(val).data().xuPanelData.xu_panel_xu_ui_id = (nodeP.xu_tree_id || nodeP.id) + '-' + _container_ds?.currentRecordId;
12987
12487
  $(val).data().xuPanelData.node = nodeP;
12988
12488
  $(val).data().xuPanelData.$panel_div = $panel_div.clone(true);
12989
12489
  });
@@ -13020,8 +12520,7 @@ func.UI.screen.panel_post_render_handler = async function (
13020
12520
  if (!$wrapper.data()?.xuData?.dsSession) return;
13021
12521
 
13022
12522
  if ($old_panel_div?.length) {
13023
- $container.parent().data().xuData.paramsP.dsSessionP =
13024
- _ds.parentDataSourceNo; // set the new ds when panel replaced
12523
+ $container.parent().data().xuData.paramsP.dsSessionP = _ds.parentDataSourceNo; // set the new ds when panel replaced
13025
12524
  } else {
13026
12525
  $container.data().xuData.paramsP.dsSessionP = _ds.parentDataSourceNo; // set the new ds when panel replaced
13027
12526
  }
@@ -13032,66 +12531,45 @@ func.UI.screen.panel_post_render_handler = async function (
13032
12531
  return jobNoP;
13033
12532
  };
13034
12533
 
13035
- func.UI.screen.create_container = function (
13036
- SESSION_ID,
13037
- $root_container,
13038
- nodeP,
13039
- $container,
13040
- paramsP,
13041
- parent_infoP,
13042
- jobNoP,
13043
- keyP,
13044
- parent_nodeP,
13045
- prop,
13046
- classP,
13047
- elem_propP,
13048
- div_typeP,
13049
- $appendToP,
13050
- attr_str
13051
- ) {
12534
+ func.UI.screen.create_container = function (SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, classP, elem_propP, div_typeP, $appendToP, attr_str) {
13052
12535
  const _paramsP = _.cloneDeep(paramsP);
13053
12536
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_paramsP.dsSessionP];
13054
12537
  var $appendTo = $container;
13055
12538
  if ($appendToP) $appendTo = $appendToP;
13056
12539
  if (!$appendTo || !$appendTo.length) return null; // screen closed or not exist abort build
13057
- var div = "div";
12540
+ var div = 'div';
13058
12541
  if (div_typeP) div = div_typeP;
13059
12542
  var items = [];
13060
12543
  if (nodeP.children)
13061
12544
  items = nodeP.children.map(function (val) {
13062
12545
  return val.xu_tree_id || val.id;
13063
12546
  });
13064
- var currentRecordId = _ds ? _ds.currentRecordId : "";
12547
+ var currentRecordId = _ds ? _ds.currentRecordId : '';
13065
12548
  var xu_id = (glb.screen_num++).toString();
13066
- xu_id = xu_id += "_" + currentRecordId;
12549
+ xu_id = xu_id += '_' + currentRecordId;
13067
12550
 
13068
12551
  try {
13069
-
13070
- const key_path = `${$container?.data()?.xuData?.key_path || "0"}-${keyP || "0"
13071
- }`;
13072
- const elem_key = `${nodeP.xu_tree_id || nodeP.id
13073
- }-${key_path}-${currentRecordId}`;
13074
- let ui_id = `${nodeP.xu_tree_id || nodeP.id}-${elem_key}-${_paramsP?.dsSessionP?.toString() || ""
13075
- }`;
12552
+ const key_path = `${$container?.data()?.xuData?.key_path || '0'}-${keyP || '0'}`;
12553
+ const elem_key = `${nodeP.xu_tree_id || nodeP.id}-${key_path}-${currentRecordId}`;
12554
+ let ui_id = `${nodeP.xu_tree_id || nodeP.id}-${elem_key}-${_paramsP?.dsSessionP?.toString() || ''}`;
13076
12555
 
13077
12556
  /////////////////////////////////
13078
12557
 
13079
- var $div
13080
- if (div === "svg") {
13081
-
12558
+ var $div;
12559
+ if (div === 'svg') {
13082
12560
  const draw_svg = function (element) {
13083
12561
  const get_tag_str = function (element, prop, val) {
13084
- let class_str = "";
13085
- let attr_str = "";
12562
+ let class_str = '';
12563
+ let attr_str = '';
13086
12564
  for (const [key, val] of Object.entries(prop)) {
13087
- if (key.substr(0, 2) !== "xu") {
12565
+ if (key.substr(0, 2) !== 'xu') {
13088
12566
  attr_str += ` ${key}="${val}" `;
13089
12567
  }
13090
12568
  }
13091
- if (element === "svg") {
12569
+ if (element === 'svg') {
13092
12570
  return `<${element} ${attr_str} > `;
13093
12571
  }
13094
- let ret = "";
12572
+ let ret = '';
13095
12573
  if (val?.children?.length) {
13096
12574
  ret = iterate_svg(val);
13097
12575
  }
@@ -13099,9 +12577,9 @@ func.UI.screen.create_container = function (
13099
12577
  return `<${element} ${class_str} ${attr_str} > ${ret} </${element}>`;
13100
12578
  };
13101
12579
  let svg_str = get_tag_str(element, prop);
13102
- let inner_str = "";
12580
+ let inner_str = '';
13103
12581
  const iterate_svg = function (node) {
13104
- let ret = "";
12582
+ let ret = '';
13105
12583
  if (node.children) {
13106
12584
  for (let val of node.children) {
13107
12585
  let prop = val.attributes;
@@ -13112,52 +12590,50 @@ func.UI.screen.create_container = function (
13112
12590
  };
13113
12591
  inner_str = iterate_svg(nodeP);
13114
12592
 
13115
- $div = $(svg_str + inner_str + "</svg>").appendTo($appendTo);
12593
+ $div = $(svg_str + inner_str + '</svg>').appendTo($appendTo);
13116
12594
  };
13117
12595
 
13118
12596
  draw_svg(div_typeP);
13119
12597
  } else {
13120
- $div = $(`<${div} ${attr_str ? attr_str : ""}>`)
12598
+ $div = $(`<${div} ${attr_str ? attr_str : ''}>`);
13121
12599
  }
13122
12600
  // const svgNS = "http://www.w3.org/2000/svg";
13123
12601
  // // $div = $(document.createElementNS(svgNS, "svg"));
13124
12602
  // $div = $(`<${div} ${attr_str ? attr_str : ""} ${svg_attributes_str}>`);
13125
12603
  // } else {
13126
12604
  // $div = $(`<${div} ${attr_str ? attr_str : ""}>`);
13127
- $div
13128
- .attr("xu-ui-id", ui_id)
13129
- .data({
13130
- xuData: {
13131
- prog_id: _paramsP.prog_id,
13132
- nodeid: nodeP.id,
13133
- ui_type: nodeP.tagName,
13134
- xu_id: xu_id,
13135
- recordid: currentRecordId,
13136
- paramsP: _paramsP,
13137
- key: keyP,
13138
- key_path, //:($container?.data()?.xuData?.key || "0") + "-" + (keyP || "0"),
13139
- screenId: _paramsP.screenId,
13140
- parent_container: $container?.attr("id"),
13141
- elem_key,
13142
- ui_id,
13143
- properties: prop,
13144
- node: nodeP,
13145
- node_org: _.cloneDeep(nodeP),
13146
- is_panelP: _paramsP.is_panelP,
13147
-
13148
- elem_prop: elem_propP,
13149
- debug_info: {
13150
- id: nodeP.id,
13151
- parent_id: $container?.data()?.xuData?.ui_id,
13152
- items: items,
13153
- },
13154
- parent_node: parent_nodeP,
13155
- currentRecordId: currentRecordId,
13156
- $root_container: $root_container,
13157
- parent_element_ui_id: $container?.data()?.xuData?.ui_id,
12605
+ $div.attr('xu-ui-id', ui_id).data({
12606
+ xuData: {
12607
+ prog_id: _paramsP.prog_id,
12608
+ nodeid: nodeP.id,
12609
+ ui_type: nodeP.tagName,
12610
+ xu_id: xu_id,
12611
+ recordid: currentRecordId,
12612
+ paramsP: _paramsP,
12613
+ key: keyP,
12614
+ key_path, //:($container?.data()?.xuData?.key || "0") + "-" + (keyP || "0"),
12615
+ screenId: _paramsP.screenId,
12616
+ parent_container: $container?.attr('id'),
12617
+ elem_key,
12618
+ ui_id,
12619
+ properties: prop,
12620
+ node: nodeP,
12621
+ node_org: _.cloneDeep(nodeP),
12622
+ is_panelP: _paramsP.is_panelP,
12623
+
12624
+ elem_prop: elem_propP,
12625
+ debug_info: {
12626
+ id: nodeP.id,
12627
+ parent_id: $container?.data()?.xuData?.ui_id,
12628
+ items: items,
13158
12629
  },
13159
- xuAttributes: {},
13160
- })
12630
+ parent_node: parent_nodeP,
12631
+ currentRecordId: currentRecordId,
12632
+ $root_container: $root_container,
12633
+ parent_element_ui_id: $container?.data()?.xuData?.ui_id,
12634
+ },
12635
+ xuAttributes: {},
12636
+ });
13161
12637
  // }
13162
12638
 
13163
12639
  // $div.appendTo($appendTo);
@@ -13211,10 +12687,9 @@ func.UI.screen.create_container = function (
13211
12687
  // if (div_typeP === "svg") {
13212
12688
  // $div.removeAttr("xu-ui-id")
13213
12689
  // }
13214
- if (div_typeP !== "svg") {
12690
+ if (div_typeP !== 'svg') {
13215
12691
  $div.appendTo($appendTo);
13216
12692
  }
13217
-
13218
12693
  } catch (e) {
13219
12694
  console.error(e);
13220
12695
  }
@@ -13227,14 +12702,7 @@ func.UI.screen.create_container = function (
13227
12702
 
13228
12703
  return $div;
13229
12704
  };
13230
- func.UI.screen.execute_screen_ready_events = async function (
13231
- SESSION_ID,
13232
- paramsP,
13233
- sourceP,
13234
- $div,
13235
- jobNoP,
13236
- $div_objP
13237
- ) {
12705
+ func.UI.screen.execute_screen_ready_events = async function (SESSION_ID, paramsP, sourceP, $div, jobNoP, $div_objP) {
13238
12706
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
13239
12707
  if (!_ds) return;
13240
12708
  var viewEventExec_arr = [];
@@ -13242,13 +12710,7 @@ func.UI.screen.execute_screen_ready_events = async function (
13242
12710
  for await (const val of viewEventExec_arr) {
13243
12711
  cond = val.eventInfo.data.enabled;
13244
12712
  if (val.expression) {
13245
- expCond = await func.expression.get(
13246
- SESSION_ID,
13247
- val.expression,
13248
- paramsP.dsSessionP,
13249
- "condition",
13250
- paramsP.rowIdP
13251
- ); // execute expression
12713
+ expCond = await func.expression.get(SESSION_ID, val.expression, paramsP.dsSessionP, 'condition', paramsP.rowIdP); // execute expression
13252
12714
  cond = expCond.result;
13253
12715
  }
13254
12716
  if (cond) {
@@ -13267,7 +12729,7 @@ func.UI.screen.execute_screen_ready_events = async function (
13267
12729
  null,
13268
12730
  paramsP.dsSessionP,
13269
12731
  val.eventId,
13270
- sourceP + " event",
12732
+ sourceP + ' event',
13271
12733
  true,
13272
12734
  null,
13273
12735
  null,
@@ -13281,7 +12743,7 @@ func.UI.screen.execute_screen_ready_events = async function (
13281
12743
  _ds.prog_id,
13282
12744
  _ds.nodeId,
13283
12745
  _ds.parentDataSourceNo,
13284
- $div
12746
+ $div,
13285
12747
  );
13286
12748
 
13287
12749
  // update changed values to screen added 18/09/13
@@ -13293,43 +12755,20 @@ func.UI.screen.execute_screen_ready_events = async function (
13293
12755
  }
13294
12756
 
13295
12757
  if (_ds?.data_feed?.form_fields_changed?.[current_record_id]) {
13296
- $.each(
13297
- _ds.data_feed.form_fields_changed[current_record_id],
13298
- function (key, val) {
13299
- fields_to_refresh.push(key);
13300
- }
13301
- );
12758
+ $.each(_ds.data_feed.form_fields_changed[current_record_id], function (key, val) {
12759
+ fields_to_refresh.push(key);
12760
+ });
13302
12761
 
13303
12762
  var containerId = _ds.containerId;
13304
- var $container = $("#" + containerId);
13305
- if (
13306
- $container?.data()?.xuData?.is_mobile_modal ||
13307
- $container?.data()?.xuData?.params?.is_mobile_page
13308
- ) {
13309
- await func.UI.screen.refresh_container(
13310
- SESSION_ID,
13311
- "init",
13312
- fields_to_refresh,
13313
- $container,
13314
- paramsP.dsSessionP,
13315
- null
13316
- );
12763
+ var $container = $('#' + containerId);
12764
+ if ($container?.data()?.xuData?.is_mobile_modal || $container?.data()?.xuData?.params?.is_mobile_page) {
12765
+ await func.UI.screen.refresh_container(SESSION_ID, 'init', fields_to_refresh, $container, paramsP.dsSessionP, null);
13317
12766
  } else {
13318
- $container.trigger(containerId + ".refresh", [
13319
- "init",
13320
- fields_to_refresh,
13321
- ]);
12767
+ $container.trigger(containerId + '.refresh', ['init', fields_to_refresh]);
13322
12768
  }
13323
12769
 
13324
12770
  if ($div_objP) {
13325
- await func.UI.screen.refresh_container(
13326
- SESSION_ID,
13327
- "init",
13328
- fields_to_refresh,
13329
- $div_objP,
13330
- paramsP.dsSessionP,
13331
- null
13332
- );
12771
+ await func.UI.screen.refresh_container(SESSION_ID, 'init', fields_to_refresh, $div_objP, paramsP.dsSessionP, null);
13333
12772
  }
13334
12773
  }
13335
12774
  }
@@ -13349,18 +12788,7 @@ func.UI.screen.execute_screen_ready_events = async function (
13349
12788
  if (_.isEmpty(event_obj.triggers)) continue;
13350
12789
 
13351
12790
  if (event_obj.data.condition) {
13352
- let res = await func.expression.get(
13353
- SESSION_ID,
13354
- event_obj.data.condition,
13355
- paramsP.dsSessionP,
13356
- "condition",
13357
- paramsP.rowIdP,
13358
- null,
13359
- null,
13360
- null,
13361
- null,
13362
- event_obj
13363
- );
12791
+ let res = await func.expression.get(SESSION_ID, event_obj.data.condition, paramsP.dsSessionP, 'condition', paramsP.rowIdP, null, null, null, null, event_obj);
13364
12792
  if (!res.result) {
13365
12793
  continue;
13366
12794
  }
@@ -13373,41 +12801,20 @@ func.UI.screen.execute_screen_ready_events = async function (
13373
12801
  continue;
13374
12802
  }
13375
12803
  cond = true;
13376
- if (trigger_obj.props.condition)
13377
- expression = trigger_obj.props.condition;
12804
+ if (trigger_obj.props.condition) expression = trigger_obj.props.condition;
13378
12805
  var expCond = {};
13379
12806
  if (expression) {
13380
- expCond = await func.expression.get(
13381
- SESSION_ID,
13382
- expression,
13383
- paramsP.dsSessionP,
13384
- "condition",
13385
- paramsP.rowIdP,
13386
- trigger_obj.data.type
13387
- ); // execute expression
12807
+ expCond = await func.expression.get(SESSION_ID, expression, paramsP.dsSessionP, 'condition', paramsP.rowIdP, trigger_obj.data.type); // execute expression
13388
12808
  cond = expCond.result;
13389
12809
  expCond.conditional = true;
13390
12810
  }
13391
12811
 
13392
12812
  if (!trigger_obj.data.action) {
13393
- func.utils.debug_report(
13394
- SESSION_ID,
13395
- "get_view_events_count",
13396
- `Error initiating ${typeP} prog: ${_ds.viewSourceDesc} reason: missing action`,
13397
- "E"
13398
- );
12813
+ func.utils.debug_report(SESSION_ID, 'get_view_events_count', `Error initiating ${typeP} prog: ${_ds.viewSourceDesc} reason: missing action`, 'E');
13399
12814
  break;
13400
12815
  }
13401
- if (
13402
- !glb.REFERENCE_LESS_FUNCTIONS.includes(trigger_obj.data.action) &&
13403
- !trigger_obj.data.name?.prog
13404
- ) {
13405
- func.utils.debug_report(
13406
- SESSION_ID,
13407
- "get_view_events_count",
13408
- `Error initiating ${typeP} prog: ${_ds.viewSourceDesc} reason: missing reference`,
13409
- "E"
13410
- );
12816
+ if (!glb.REFERENCE_LESS_FUNCTIONS.includes(trigger_obj.data.action) && !trigger_obj.data.name?.prog) {
12817
+ func.utils.debug_report(SESSION_ID, 'get_view_events_count', `Error initiating ${typeP} prog: ${_ds.viewSourceDesc} reason: missing reference`, 'E');
13411
12818
  break;
13412
12819
  }
13413
12820
 
@@ -13422,41 +12829,24 @@ func.UI.screen.execute_screen_ready_events = async function (
13422
12829
  return viewEventExec_arr.length;
13423
12830
  };
13424
12831
 
13425
- let count = await get_view_events_count("screen_ready");
12832
+ let count = await get_view_events_count('screen_ready');
13426
12833
  if (!count) return;
13427
12834
  return await execute_view_events(sourceP);
13428
12835
  };
13429
- func.UI.screen.screen_loading_done = async function (
13430
- SESSION_ID,
13431
- paramsP,
13432
- $div,
13433
- jobNoP
13434
- ) {
12836
+ func.UI.screen.screen_loading_done = async function (SESSION_ID, paramsP, $div, jobNoP) {
13435
12837
  // await
13436
- func.UI.screen.execute_screen_ready_events(
13437
- SESSION_ID,
13438
- paramsP,
13439
- paramsP.screenInfo.properties?.renderType,
13440
- $div,
13441
- jobNoP
13442
- );
12838
+ func.UI.screen.execute_screen_ready_events(SESSION_ID, paramsP, paramsP.screenInfo.properties?.renderType, $div, jobNoP);
13443
12839
  var _session = SESSION_OBJ[SESSION_ID];
13444
12840
  func.events.delete_job(SESSION_ID, jobNoP);
13445
- func.UI.utils.screen_blocker(
13446
- false,
13447
- paramsP.prog_id + (paramsP.sourceScreenP ? "_" + paramsP.sourceScreenP : "")
13448
- );
12841
+ func.UI.utils.screen_blocker(false, paramsP.prog_id + (paramsP.sourceScreenP ? '_' + paramsP.sourceScreenP : ''));
13449
12842
  if (_session.prog_id === paramsP.prog_id) {
13450
12843
  _session.system_ready = true;
13451
- if (
13452
- _session.engine_mode === "live_preview" &&
13453
- STUDIO_PEER_CONN_SEND_METHOD
13454
- ) {
12844
+ if (_session.engine_mode === 'live_preview' && STUDIO_PEER_CONN_SEND_METHOD) {
13455
12845
  STUDIO_PEER_CONN_SEND_METHOD({
13456
- service: "system_ready",
12846
+ service: 'system_ready',
13457
12847
  data: {},
13458
12848
  id: STUDIO_PEER.id,
13459
- source: "runtime",
12849
+ source: 'runtime',
13460
12850
  session_id: SESSION_ID,
13461
12851
  app_id: _session.app_id,
13462
12852
  gtp_token: _session.gtp_token,
@@ -13469,20 +12859,7 @@ func.UI.screen.screen_loading_done = async function (
13469
12859
  return $div;
13470
12860
  };
13471
12861
 
13472
- func.UI.screen.render_ui_tree = async function (
13473
- SESSION_ID,
13474
- $container,
13475
- nodeP,
13476
- parent_infoP,
13477
- paramsP,
13478
- jobNoP,
13479
- is_skeleton,
13480
- keyP,
13481
- is_mainP,
13482
- parent_nodeP,
13483
- check_existP,
13484
- $root_container
13485
- ) {
12862
+ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, parent_infoP, paramsP, jobNoP, is_skeleton, keyP, is_mainP, parent_nodeP, check_existP, $root_container) {
13486
12863
  if (!is_skeleton) {
13487
12864
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
13488
12865
  }
@@ -13493,29 +12870,16 @@ func.UI.screen.render_ui_tree = async function (
13493
12870
  // debugger;
13494
12871
  }
13495
12872
 
13496
- var is_mobile = glb.MOBILE_ARR.includes(
13497
- paramsP.screenInfo.properties?.menuType
13498
- )
13499
- ? true
13500
- : false;
12873
+ var is_mobile = glb.MOBILE_ARR.includes(paramsP.screenInfo.properties?.menuType) ? true : false;
13501
12874
 
13502
12875
  var get_element_info = function () {
13503
12876
  var ret = {};
13504
- let currentRecordId = _ds?.currentRecordId || "";
12877
+ let currentRecordId = _ds?.currentRecordId || '';
13505
12878
 
13506
- let $div = func.UI.utils.find_in_element_data(
13507
- "xuData",
13508
- $container.parent(),
13509
- "nodeid",
13510
- nodeP.id
13511
- );
12879
+ let $div = func.UI.utils.find_in_element_data('xuData', $container.parent(), 'nodeid', nodeP.id);
13512
12880
 
13513
12881
  $.each($div, function (key, val) {
13514
- if (
13515
- $(val)?.data().xuData?.recordid === currentRecordId &&
13516
- $(val)?.data().xuData?.key === keyP &&
13517
- $(val)?.prop("tagName") !== "XURENDER"
13518
- ) {
12882
+ if ($(val)?.data().xuData?.recordid === currentRecordId && $(val)?.data().xuData?.key === keyP && $(val)?.prop('tagName') !== 'XURENDER') {
13519
12883
  ret = {
13520
12884
  div: $div,
13521
12885
  };
@@ -13531,34 +12895,30 @@ func.UI.screen.render_ui_tree = async function (
13531
12895
  return ret;
13532
12896
  };
13533
12897
  const debug = function (is_errorP, error_descP) {
13534
- func.utils.debug.log(
13535
- SESSION_ID,
13536
- paramsP.prog_id + "_" + nodeP.id_org + "_ui_prop",
13537
- {
13538
- module: "gui",
13539
- action: "init",
13540
- prop: nodeP.id,
13541
- details: error_descP,
13542
- result: null,
13543
- error: is_errorP,
13544
- source: _ds?.tree_obj?.menuName || "",
13545
- fields: null,
13546
- type: null,
13547
- prog_id: paramsP.prog_id,
13548
- dsSession: null,
13549
- }
13550
- );
12898
+ func.utils.debug.log(SESSION_ID, paramsP.prog_id + '_' + nodeP.id_org + '_ui_prop', {
12899
+ module: 'gui',
12900
+ action: 'init',
12901
+ prop: nodeP.id,
12902
+ details: error_descP,
12903
+ result: null,
12904
+ error: is_errorP,
12905
+ source: _ds?.tree_obj?.menuName || '',
12906
+ fields: null,
12907
+ type: null,
12908
+ prog_id: paramsP.prog_id,
12909
+ dsSession: null,
12910
+ });
13551
12911
  };
13552
12912
 
13553
12913
  const open_modal = async function ($div) {
13554
- const modal_id = "app_modal-" + paramsP.dsSessionP.toString();
13555
- var xu_modal_controller = document.querySelector("xu-modal-controller");
12914
+ const modal_id = 'app_modal-' + paramsP.dsSessionP.toString();
12915
+ var xu_modal_controller = document.querySelector('xu-modal-controller');
13556
12916
  if (!xu_modal_controller) {
13557
12917
  func.UI.component.create_app_modal_component(SESSION_ID, modal_id);
13558
- xu_modal_controller = document.querySelector("xu-modal-controller");
12918
+ xu_modal_controller = document.querySelector('xu-modal-controller');
13559
12919
  }
13560
12920
 
13561
- var controller_params = $(xu_modal_controller).data("xuControllerParams");
12921
+ var controller_params = $(xu_modal_controller).data('xuControllerParams');
13562
12922
 
13563
12923
  if (!controller_params) {
13564
12924
  controller_params = {};
@@ -13574,16 +12934,11 @@ func.UI.screen.render_ui_tree = async function (
13574
12934
 
13575
12935
  controller_params[modal_id] = params;
13576
12936
 
13577
- $(xu_modal_controller).data("xuControllerParams", controller_params);
12937
+ $(xu_modal_controller).data('xuControllerParams', controller_params);
13578
12938
  const modalController = await new UI_FRAMEWORK_PLUGIN.modal();
13579
12939
 
13580
12940
  if (!APP_MODAL_OBJ[modal_id]) {
13581
- const modal = await modalController.create(
13582
- SESSION_ID,
13583
- modal_id,
13584
- paramsP.screenInfo,
13585
- close_modal
13586
- );
12941
+ const modal = await modalController.create(SESSION_ID, modal_id, paramsP.screenInfo, close_modal);
13587
12942
  APP_MODAL_OBJ[modal_id] = modal;
13588
12943
  } else {
13589
12944
  $(modal_id).empty();
@@ -13595,14 +12950,10 @@ func.UI.screen.render_ui_tree = async function (
13595
12950
 
13596
12951
  const close_modal = async function (modal_id) {
13597
12952
  delete APP_MODAL_OBJ[modal_id];
13598
- const xu_modal_controller = document.querySelector("xu-modal-controller");
12953
+ const xu_modal_controller = document.querySelector('xu-modal-controller');
13599
12954
  var params = $(xu_modal_controller).data().xuControllerParams[modal_id];
13600
12955
  if (params && params.$container) {
13601
- await func.UI.screen.validate_exit_events(
13602
- SESSION_ID,
13603
- params.$container.data().xuData.paramsP,
13604
- null
13605
- );
12956
+ await func.UI.screen.validate_exit_events(SESSION_ID, params.$container.data().xuData.paramsP, null);
13606
12957
  func.datasource.clean_all(SESSION_ID, params.dsSession);
13607
12958
  }
13608
12959
  };
@@ -13617,17 +12968,16 @@ func.UI.screen.render_ui_tree = async function (
13617
12968
  };
13618
12969
 
13619
12970
  const open_popover = async function ($div) {
13620
- const xu_popover_controller =
13621
- func.UI.component.create_app_popover_component(SESSION_ID);
12971
+ const xu_popover_controller = func.UI.component.create_app_popover_component(SESSION_ID);
13622
12972
 
13623
- $(xu_popover_controller).data("xuControllerParams", {
12973
+ $(xu_popover_controller).data('xuControllerParams', {
13624
12974
  menuTitle: paramsP.screenInfo.properties?.menuTitle,
13625
12975
  screenId: paramsP.screenId,
13626
12976
  $dialogDiv: $div.children(),
13627
12977
  $container: $container,
13628
12978
  });
13629
12979
  const popover = new UI_FRAMEWORK_PLUGIN.popover(
13630
- SESSION_ID
12980
+ SESSION_ID,
13631
12981
  // ELEMENT_CLICK_EVENT,
13632
12982
  // props
13633
12983
  );
@@ -13637,7 +12987,7 @@ func.UI.screen.render_ui_tree = async function (
13637
12987
  return;
13638
12988
  popoverController
13639
12989
  .create({
13640
- component: "xu-popover-content-" + SESSION_ID,
12990
+ component: 'xu-popover-content-' + SESSION_ID,
13641
12991
  event: ELEMENT_CLICK_EVENT,
13642
12992
  translucent: true,
13643
12993
  })
@@ -13649,14 +12999,7 @@ func.UI.screen.render_ui_tree = async function (
13649
12999
  });
13650
13000
  });
13651
13001
  };
13652
- const iterate_child = async function (
13653
- $divP,
13654
- nodeP,
13655
- parent_infoP,
13656
- countP,
13657
- $root_container,
13658
- before_record_function
13659
- ) {
13002
+ const iterate_child = async function ($divP, nodeP, parent_infoP, countP, $root_container, before_record_function) {
13660
13003
  if (!is_mobile && nodeP.busy) return;
13661
13004
  nodeP.busy = true;
13662
13005
  const done = async function ($divP) {
@@ -13670,26 +13013,12 @@ func.UI.screen.render_ui_tree = async function (
13670
13013
  return await done($divP);
13671
13014
  }
13672
13015
 
13673
-
13674
13016
  if (before_record_function) {
13675
13017
  await before_record_function();
13676
13018
  }
13677
13019
  if (nodeP?.children?.length) {
13678
13020
  for await (const [key, val] of Object.entries(nodeP.children)) {
13679
- const ret = await func.UI.screen.render_ui_tree(
13680
- SESSION_ID,
13681
- $divP,
13682
- nodeP.children[key],
13683
- parent_infoP,
13684
- paramsP,
13685
- jobNoP,
13686
- is_skeleton,
13687
- Number(key),
13688
- null,
13689
- nodeP,
13690
- null,
13691
- $root_container
13692
- );
13021
+ const ret = await func.UI.screen.render_ui_tree(SESSION_ID, $divP, nodeP.children[key], parent_infoP, paramsP, jobNoP, is_skeleton, Number(key), null, nodeP, null, $root_container);
13693
13022
  }
13694
13023
  }
13695
13024
  return await done($divP);
@@ -13697,12 +13026,12 @@ func.UI.screen.render_ui_tree = async function (
13697
13026
 
13698
13027
  const _$ = function ($elm) {
13699
13028
  try {
13700
- const id = $elm.attr("xu-ui-id");
13029
+ const id = $elm.attr('xu-ui-id');
13701
13030
  if (!id) return $elm;
13702
13031
  const $el = $(`[xu-ui-id="${id}"]`); // $("#" + id);
13703
13032
 
13704
13033
  if ($el.length > 1) {
13705
- console.warn("Multiple elements for xu-ui-id: " + id, $el);
13034
+ console.warn('Multiple elements for xu-ui-id: ' + id, $el);
13706
13035
  }
13707
13036
 
13708
13037
  return $($el[0]);
@@ -13714,9 +13043,7 @@ func.UI.screen.render_ui_tree = async function (
13714
13043
  const hover_in = function ($div) {
13715
13044
  if (is_skeleton) return;
13716
13045
  CLIENT_ACTIVITY_TS = Date.now();
13717
- if (_$($container)?.data()?.xuData?.debug_info)
13718
- _$($container).data().xuData.debug_info.hover_item =
13719
- $div.attr("xu-ui-id");
13046
+ if (_$($container)?.data()?.xuData?.debug_info) _$($container).data().xuData.debug_info.hover_item = $div.attr('xu-ui-id');
13720
13047
  if (!_ds) return;
13721
13048
  ///////// SET Attributes///////////
13722
13049
  let attributes = {};
@@ -13724,9 +13051,7 @@ func.UI.screen.render_ui_tree = async function (
13724
13051
  attributes[attr.name] = attr.value;
13725
13052
  });
13726
13053
 
13727
- SESSION_OBJ[
13728
- SESSION_ID
13729
- ].DS_GLB[0].data_system.SYS_OBJ_WIN_ELEMENT_HOVERED_ATTRIBUTES = attributes;
13054
+ SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system.SYS_OBJ_WIN_ELEMENT_HOVERED_ATTRIBUTES = attributes;
13730
13055
  //////////////////////////////////
13731
13056
  const _iterate_info = $div.data().xuData.iterate_info;
13732
13057
  if (_iterate_info) {
@@ -13735,8 +13060,7 @@ func.UI.screen.render_ui_tree = async function (
13735
13060
  } else {
13736
13061
  try {
13737
13062
  const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
13738
- _ds.data_feed.rows[row_idx][_iterate_info.iterator_key] =
13739
- _iterate_info._key;
13063
+ _ds.data_feed.rows[row_idx][_iterate_info.iterator_key] = _iterate_info._key;
13740
13064
  } catch (err) {
13741
13065
  console.error(err);
13742
13066
  }
@@ -13747,24 +13071,15 @@ func.UI.screen.render_ui_tree = async function (
13747
13071
  } else {
13748
13072
  try {
13749
13073
  const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
13750
- _ds.data_feed.rows[row_idx][_iterate_info.iterator_val] =
13751
- _iterate_info._val;
13074
+ _ds.data_feed.rows[row_idx][_iterate_info.iterator_val] = _iterate_info._val;
13752
13075
  } catch (err) {
13753
13076
  console.error(err);
13754
13077
  }
13755
13078
  }
13756
13079
  }
13757
13080
 
13758
- if ($div && _$($div) && _ds && paramsP.renderType === "grid") {
13759
- func.UI.worker.add_to_queue(
13760
- SESSION_ID,
13761
- "gui event",
13762
- "update_datasource",
13763
- { currentRecordId: _$($div).data().xuData.currentRecordId },
13764
- null,
13765
- null,
13766
- paramsP.dsSessionP
13767
- );
13081
+ if ($div && _$($div) && _ds && paramsP.renderType === 'grid') {
13082
+ func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'update_datasource', { currentRecordId: _$($div).data().xuData.currentRecordId }, null, null, paramsP.dsSessionP);
13768
13083
  }
13769
13084
 
13770
13085
  const set_value = function (field_id, value) {
@@ -13772,8 +13087,8 @@ func.UI.screen.render_ui_tree = async function (
13772
13087
 
13773
13088
  func.UI.worker.add_to_queue(
13774
13089
  SESSION_ID,
13775
- "gui event",
13776
- "update_datasource",
13090
+ 'gui event',
13091
+ 'update_datasource',
13777
13092
  {
13778
13093
  currentRecordId,
13779
13094
  field_id,
@@ -13781,7 +13096,7 @@ func.UI.screen.render_ui_tree = async function (
13781
13096
  },
13782
13097
  null,
13783
13098
  null,
13784
- paramsP.dsSessionP
13099
+ paramsP.dsSessionP,
13785
13100
  );
13786
13101
  };
13787
13102
 
@@ -13802,40 +13117,27 @@ func.UI.screen.render_ui_tree = async function (
13802
13117
  _$($container).data().xuData.debug_info.hover_item = null;
13803
13118
  }
13804
13119
  if (_ds?.data_system) {
13805
- SESSION_OBJ[
13806
- SESSION_ID
13807
- ].DS_GLB[0].data_system.SYS_OBJ_WIN_ELEMENT_HOVERED_ATTRIBUTES = {};
13120
+ SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system.SYS_OBJ_WIN_ELEMENT_HOVERED_ATTRIBUTES = {};
13808
13121
  }
13809
13122
  };
13810
13123
  const render_screen_type = async function ($div) {
13811
13124
  const set_call_screen_properties_values = async function (ui_framework) {
13812
13125
  params.properties = {};
13813
13126
  const get_values = async function (property) {
13814
- var property_value =
13815
- paramsP?.screenInfo?.properties?.[property] ||
13816
- paramsP?.screenInfo?.properties?.frameworkProperties?.[property];
13127
+ var property_value = paramsP?.screenInfo?.properties?.[property] || paramsP?.screenInfo?.properties?.frameworkProperties?.[property];
13817
13128
  if (paramsP?.call_screen_propertiesP) {
13818
13129
  if (paramsP.call_screen_propertiesP?.[property]) {
13819
13130
  property_value = paramsP.call_screen_propertiesP[property];
13820
13131
  }
13821
13132
  if (paramsP.call_screen_propertiesP[`xu-exp:${property}`]) {
13822
- property_value = (
13823
- await func.expression.get(
13824
- SESSION_ID,
13825
- paramsP.call_screen_propertiesP[`xu-exp:${property}`],
13826
- paramsP.dsSessionP,
13827
- property
13828
- )
13829
- ).result;
13133
+ property_value = (await func.expression.get(SESSION_ID, paramsP.call_screen_propertiesP[`xu-exp:${property}`], paramsP.dsSessionP, property)).result;
13830
13134
  }
13831
13135
  }
13832
13136
  return property_value;
13833
13137
  };
13834
- params.properties["name"] = await get_values("menuTitle");
13138
+ params.properties['name'] = await get_values('menuTitle');
13835
13139
  if (await ui_framework?.properties()) {
13836
- for await (const [key, val] of Object.entries(
13837
- await ui_framework.properties()
13838
- )) {
13140
+ for await (const [key, val] of Object.entries(await ui_framework.properties())) {
13839
13141
  params.properties[key] = await get_values(key);
13840
13142
  }
13841
13143
  }
@@ -13847,24 +13149,22 @@ func.UI.screen.render_ui_tree = async function (
13847
13149
  if (!$(val)?.data()?.xuData?.parent_container) {
13848
13150
  return true;
13849
13151
  }
13850
- $(val).data().xuData.parent_container =
13851
- $div.data().xuData.parent_container;
13152
+ $(val).data().xuData.parent_container = $div.data().xuData.parent_container;
13852
13153
  });
13853
13154
 
13854
13155
  let $ret = $div;
13855
- var $nav = $(SESSION_OBJ[SESSION_ID].root_element).find("xu-nav");
13156
+ var $nav = $(SESSION_OBJ[SESSION_ID].root_element).find('xu-nav');
13856
13157
  var params;
13857
13158
  switch (paramsP.screen_type) {
13858
- case "modal":
13859
- const modal_id = "app_modal-" + paramsP.dsSessionP.toString();
13860
- var xu_modal_controller = document.querySelector("xu-modal-controller");
13159
+ case 'modal':
13160
+ const modal_id = 'app_modal-' + paramsP.dsSessionP.toString();
13161
+ var xu_modal_controller = document.querySelector('xu-modal-controller');
13861
13162
  if (!xu_modal_controller) {
13862
13163
  func.UI.component.create_app_modal_component(SESSION_ID, modal_id);
13863
- xu_modal_controller = document.querySelector("xu-modal-controller");
13164
+ xu_modal_controller = document.querySelector('xu-modal-controller');
13864
13165
  }
13865
13166
 
13866
- var controller_params =
13867
- $(xu_modal_controller).data("xuControllerParams");
13167
+ var controller_params = $(xu_modal_controller).data('xuControllerParams');
13868
13168
 
13869
13169
  if (!controller_params) {
13870
13170
  controller_params = {};
@@ -13883,7 +13183,7 @@ func.UI.screen.render_ui_tree = async function (
13883
13183
 
13884
13184
  controller_params[modal_id] = params;
13885
13185
 
13886
- $(xu_modal_controller).data("xuControllerParams", controller_params);
13186
+ $(xu_modal_controller).data('xuControllerParams', controller_params);
13887
13187
  const modalController = await new UI_FRAMEWORK_PLUGIN.modal();
13888
13188
  await set_call_screen_properties_values(modalController);
13889
13189
  if (!APP_MODAL_OBJ[modal_id]) {
@@ -13898,11 +13198,10 @@ func.UI.screen.render_ui_tree = async function (
13898
13198
 
13899
13199
  break;
13900
13200
 
13901
- case "popover":
13201
+ case 'popover':
13902
13202
  // open_popover($div);
13903
13203
 
13904
- const xu_popover_controller =
13905
- func.UI.component.create_app_popover_component(SESSION_ID);
13204
+ const xu_popover_controller = func.UI.component.create_app_popover_component(SESSION_ID);
13906
13205
  params = {
13907
13206
  menuTitle: paramsP.screenInfo.properties?.menuTitle,
13908
13207
  screenId: paramsP.screenId,
@@ -13910,19 +13209,16 @@ func.UI.screen.render_ui_tree = async function (
13910
13209
  $container: $container,
13911
13210
  };
13912
13211
 
13913
- $(xu_popover_controller).data("xuControllerParams", params);
13212
+ $(xu_popover_controller).data('xuControllerParams', params);
13914
13213
  const popover = new UI_FRAMEWORK_PLUGIN.popover(SESSION_ID);
13915
13214
  await set_call_screen_properties_values(popover);
13916
13215
  await popover.open(params);
13917
13216
  CURRENT_APP_POPOVER = popover;
13918
13217
 
13919
- func.UI.utils.screen_blocker(
13920
- false,
13921
- paramsP.prog_id + "_" + paramsP.sourceScreenP
13922
- );
13218
+ func.UI.utils.screen_blocker(false, paramsP.prog_id + '_' + paramsP.sourceScreenP);
13923
13219
  break;
13924
13220
 
13925
- case "page":
13221
+ case 'page':
13926
13222
  const nav = $nav[0];
13927
13223
 
13928
13224
  params = {
@@ -13936,38 +13232,31 @@ func.UI.screen.render_ui_tree = async function (
13936
13232
  paramsP,
13937
13233
  };
13938
13234
 
13939
- var component_name = "xu-page-component-" + paramsP.dsSessionP;
13235
+ var component_name = 'xu-page-component-' + paramsP.dsSessionP;
13940
13236
  if (!$(nav).data().xuData.nav_params) {
13941
13237
  $(nav).data().xuData.nav_params = {};
13942
13238
  }
13943
13239
 
13944
13240
  //restore validate
13945
13241
  if ($(nav)?.data()?.xuData?.params?.[paramsP.dsSessionP]) {
13946
- params.$container.data().xuData.validate_screen_ready = $(nav)
13947
- .data()
13948
- .xuData.params[
13949
- paramsP.dsSessionP
13950
- ].$container.data().xuData.validate_screen_ready;
13242
+ params.$container.data().xuData.validate_screen_ready = $(nav).data().xuData.params[paramsP.dsSessionP].$container.data().xuData.validate_screen_ready;
13951
13243
  }
13952
13244
 
13953
13245
  if (!$(nav)?.data()?.xuData) return;
13954
13246
  $(nav).data().xuData.nav_params[paramsP.dsSessionP] = params;
13955
13247
  if (!$(component_name).length) {
13956
- await func.UI.component.create_app_page_component(
13957
- SESSION_ID,
13958
- paramsP.dsSessionP
13959
- );
13248
+ await func.UI.component.create_app_page_component(SESSION_ID, paramsP.dsSessionP);
13960
13249
  const page = new UI_FRAMEWORK_PLUGIN.page();
13961
13250
  await set_call_screen_properties_values(page);
13962
13251
  await page.create(
13963
- params
13252
+ params,
13964
13253
  // SESSION_ID,
13965
13254
  // paramsP.dsSessionP,
13966
13255
  // nav,
13967
13256
  // $nav.data().xuData.nav_params[paramsP.dsSessionP]
13968
13257
  );
13969
13258
  await page.init(
13970
- params
13259
+ params,
13971
13260
  // SESSION_ID,
13972
13261
  // paramsP.dsSessionP,
13973
13262
  // nav,
@@ -13983,7 +13272,7 @@ func.UI.screen.render_ui_tree = async function (
13983
13272
  $div.data().xuData.paramsP = $container.data().xuData.paramsP;
13984
13273
  break;
13985
13274
 
13986
- case "panel":
13275
+ case 'panel':
13987
13276
  $container.append($div_content);
13988
13277
  $ret = $container;
13989
13278
  break;
@@ -13992,14 +13281,14 @@ func.UI.screen.render_ui_tree = async function (
13992
13281
  if ($nav && $nav.length) {
13993
13282
  // refresh made
13994
13283
  } else {
13995
- $nav = $("<xu-nav>");
13284
+ $nav = $('<xu-nav>');
13996
13285
  $container.append($nav);
13997
13286
  func.UI.component.init_xu_nav($container, $nav);
13998
13287
  }
13999
13288
 
14000
13289
  $nav.data().xuData.$div = $div_content;
14001
13290
 
14002
- await $nav[0].setRoot("xu-root-component-" + SESSION_ID);
13291
+ await $nav[0].setRoot('xu-root-component-' + SESSION_ID);
14003
13292
  $ret = $container;
14004
13293
  break;
14005
13294
  }
@@ -14015,31 +13304,15 @@ func.UI.screen.render_ui_tree = async function (
14015
13304
  var exist_elm_obj = get_element_info();
14016
13305
  var $div = exist_elm_obj.div;
14017
13306
  if (!exist_elm_obj.div) {
14018
- $div = func.UI.screen.create_container(
14019
- SESSION_ID,
14020
- $root_container,
14021
- nodeP,
14022
- $container,
14023
- paramsP,
14024
- parent_infoP,
14025
- jobNoP,
14026
- keyP,
14027
- parent_nodeP,
14028
- prop,
14029
- "widget_wrapper",
14030
- null,
14031
- null,
14032
- null,
14033
- null
14034
- );
13307
+ $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, 'widget_wrapper', null, null, null, null);
14035
13308
 
14036
13309
  //////////////////////////
14037
13310
 
14038
- let plugin_name = prop["xu-widget"],
14039
- method = prop["xu-method"],
13311
+ let plugin_name = prop['xu-widget'],
13312
+ method = prop['xu-method'],
14040
13313
  dsP = paramsP.dsSessionP,
14041
13314
  propsP = prop,
14042
- sourceP = "widgets";
13315
+ sourceP = 'widgets';
14043
13316
 
14044
13317
  // const set_SYS_GLOBAL_OBJ_WIDGET_INFO = async function (docP) {
14045
13318
  // var obj = _.clone(docP);
@@ -14064,82 +13337,55 @@ func.UI.screen.render_ui_tree = async function (
14064
13337
  // await func.datasource.update(SESSION_ID, datasource_changes);
14065
13338
  // };
14066
13339
  const call_plugin_api = async function (plugin_nameP, dataP) {
14067
- return await func.utils.call_plugin_api(
14068
- SESSION_ID,
14069
- plugin_nameP,
14070
- dataP
14071
- );
13340
+ return await func.utils.call_plugin_api(SESSION_ID, plugin_nameP, dataP);
14072
13341
  };
14073
13342
  const report_error = function (descP, warn) {
14074
- func.utils.debug.log(
14075
- SESSION_ID,
14076
- _session.DS_GLB[dsP].prog_id +
14077
- "_" +
14078
- _session.DS_GLB[dsP].callingMenuId,
14079
- {
14080
- module: "widgets",
14081
- action: "Init",
13343
+ func.utils.debug.log(SESSION_ID, _session.DS_GLB[dsP].prog_id + '_' + _session.DS_GLB[dsP].callingMenuId, {
13344
+ module: 'widgets',
13345
+ action: 'Init',
13346
+ source: sourceP,
13347
+ prop: descP,
13348
+ details: descP,
13349
+ result: null,
13350
+ error: warn ? false : true,
13351
+ fields: null,
13352
+ type: 'widgets',
13353
+ prog_id: _session.DS_GLB[dsP].prog_id,
13354
+ });
13355
+ };
13356
+ const get_fields_data = async function (fields, props) {
13357
+ const report_error = function (descP, warn) {
13358
+ func.utils.debug.log(SESSION_ID, _session.DS_GLB[dsP].prog_id + '_' + _session.DS_GLB[dsP].callingMenuId, {
13359
+ module: 'widgets',
13360
+ action: 'Init',
14082
13361
  source: sourceP,
14083
13362
  prop: descP,
14084
13363
  details: descP,
14085
13364
  result: null,
14086
13365
  error: warn ? false : true,
14087
13366
  fields: null,
14088
- type: "widgets",
13367
+ type: 'widgets',
14089
13368
  prog_id: _session.DS_GLB[dsP].prog_id,
14090
- }
14091
- );
14092
- };
14093
- const get_fields_data = async function (fields, props) {
14094
- const report_error = function (descP, warn) {
14095
- func.utils.debug.log(
14096
- SESSION_ID,
14097
- _session.DS_GLB[dsP].prog_id +
14098
- "_" +
14099
- _session.DS_GLB[dsP].callingMenuId,
14100
- {
14101
- module: "widgets",
14102
- action: "Init",
14103
- source: sourceP,
14104
- prop: descP,
14105
- details: descP,
14106
- result: null,
14107
- error: warn ? false : true,
14108
- fields: null,
14109
- type: "widgets",
14110
- prog_id: _session.DS_GLB[dsP].prog_id,
14111
- }
14112
- );
13369
+ });
14113
13370
  };
14114
13371
  const get_property_value = async function (fieldIdP, val) {
14115
13372
  if (!val) return;
14116
- var value =
14117
- props[fieldIdP] ||
14118
- (typeof val.defaultValue === "function"
14119
- ? val?.defaultValue?.()
14120
- : val?.defaultValue);
14121
- if (val.render === "eventId") {
13373
+ var value = props[fieldIdP] || (typeof val.defaultValue === 'function' ? val?.defaultValue?.() : val?.defaultValue);
13374
+ if (val.render === 'eventId') {
14122
13375
  value = props?.[fieldIdP]?.event;
14123
13376
  }
14124
13377
 
14125
13378
  if (props[`xu-exp:${fieldIdP}`]) {
14126
- value = (
14127
- await func.expression.get(
14128
- SESSION_ID,
14129
- props[`xu-exp:${fieldIdP}`],
14130
- dsP,
14131
- "widget property"
14132
- )
14133
- ).result;
13379
+ value = (await func.expression.get(SESSION_ID, props[`xu-exp:${fieldIdP}`], dsP, 'widget property')).result;
14134
13380
  }
14135
13381
 
14136
13382
  return func.common.get_cast_val(
14137
13383
  SESSION_ID,
14138
- "widgets",
13384
+ 'widgets',
14139
13385
  fieldIdP,
14140
13386
  val.type, //val.type !== "string" || val.type !== "number" ? "string" : val.type,
14141
13387
  value,
14142
- null
13388
+ null,
14143
13389
  );
14144
13390
  };
14145
13391
  var data_obj = {};
@@ -14154,7 +13400,7 @@ func.UI.screen.render_ui_tree = async function (
14154
13400
  }
14155
13401
  // console.log(val);
14156
13402
  }
14157
- for await (const key of ["xu-bind"]) {
13403
+ for await (const key of ['xu-bind']) {
14158
13404
  data_obj[key] = await get_property_value(key, props[key]);
14159
13405
  }
14160
13406
 
@@ -14162,32 +13408,24 @@ func.UI.screen.render_ui_tree = async function (
14162
13408
  };
14163
13409
 
14164
13410
  const load_css_style = function () {
14165
- let path = get_path("style.css");
13411
+ let path = get_path('style.css');
14166
13412
  func.utils.load_css_on_demand(path);
14167
13413
  };
14168
13414
 
14169
13415
  const get_path = function (resource) {
14170
- if (_session.worker_type === "Dev") {
13416
+ if (_session.worker_type === 'Dev') {
14171
13417
  return `../../plugins/${plugin_name}/${resource}`;
14172
13418
  }
14173
13419
  return `https://${_session.domain}/plugins/${plugin_name}/${resource}?gtp_token=${_session.gtp_token}&app_id=${_session.app_id}`;
14174
13420
  };
14175
- const _plugin =
14176
- APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
14177
- const index = await func.utils.get_plugin_resource(
14178
- SESSION_ID,
14179
- plugin_name,
14180
- `${_plugin.manifest["index.mjs"].dist ? "dist/" : ""}index.mjs`
14181
- );
13421
+ const _plugin = APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
13422
+ const index = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${_plugin.manifest['index.mjs'].dist ? 'dist/' : ''}index.mjs`);
14182
13423
  const methods = index.methods;
14183
13424
  if (methods && !methods[method]) {
14184
- return report_error("method not found");
13425
+ return report_error('method not found');
14185
13426
  }
14186
13427
 
14187
- const fields_ret = await get_fields_data(
14188
- methods[method].fields,
14189
- propsP
14190
- );
13428
+ const fields_ret = await get_fields_data(methods[method].fields, propsP);
14191
13429
  if (fields_ret.code < 0) {
14192
13430
  return report_error(fields_ret.data);
14193
13431
  }
@@ -14195,65 +13433,37 @@ func.UI.screen.render_ui_tree = async function (
14195
13433
 
14196
13434
  let exclude_attributes = [];
14197
13435
  for await (const [key, val] of Object.entries(propsP)) {
14198
- if (
14199
- typeof fields[key] !== "undefined" ||
14200
- typeof fields[`xu-exp:${key}`] !== "undefined"
14201
- ) {
13436
+ if (typeof fields[key] !== 'undefined' || typeof fields[`xu-exp:${key}`] !== 'undefined') {
14202
13437
  exclude_attributes.push(key);
14203
13438
  }
14204
13439
  }
14205
13440
 
14206
- let ret = await func.UI.screen.set_attributes_new(
14207
- SESSION_ID,
14208
- is_skeleton,
14209
- $root_container,
14210
- nodeP,
14211
- $container,
14212
- paramsP,
14213
- parent_infoP,
14214
- jobNoP,
14215
- keyP,
14216
- parent_nodeP,
14217
- $div,
14218
- true,
14219
- exclude_attributes
14220
- );
13441
+ let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div, true, exclude_attributes);
14221
13442
 
14222
- $div.addClass("widget_wrapper"); // class get override in set_attributes_new
13443
+ $div.addClass('widget_wrapper'); // class get override in set_attributes_new
14223
13444
 
14224
13445
  if (!APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name]) {
14225
13446
  return report_error(`plugin ${plugin_name} not found`);
14226
13447
  }
14227
13448
 
14228
- if (
14229
- APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name].manifest[
14230
- "style.css"
14231
- ].exist
14232
- ) {
13449
+ if (APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name].manifest['style.css'].exist) {
14233
13450
  load_css_style();
14234
13451
  }
14235
13452
 
14236
- const plugin_setup_ret = await func.utils.get_plugin_setup(
14237
- SESSION_ID,
14238
- plugin_name
14239
- );
13453
+ const plugin_setup_ret = await func.utils.get_plugin_setup(SESSION_ID, plugin_name);
14240
13454
  if (plugin_setup_ret.code < 0) {
14241
13455
  return report_error(plugin_setup_ret);
14242
13456
  }
14243
13457
 
14244
- const api_utils = await func.common.get_module(
13458
+ const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
13459
+ func,
13460
+ glb,
13461
+ SESSION_OBJ,
14245
13462
  SESSION_ID,
14246
- "xuda-api-library.mjs",
14247
- {
14248
- func,
14249
- glb,
14250
- SESSION_OBJ,
14251
- SESSION_ID,
14252
- APP_OBJ,
14253
- dsSession: paramsP.dsSessionP,
14254
- job_id: jobNoP,
14255
- }
14256
- );
13463
+ APP_OBJ,
13464
+ dsSession: paramsP.dsSessionP,
13465
+ job_id: jobNoP,
13466
+ });
14257
13467
 
14258
13468
  const params = {
14259
13469
  SESSION_ID,
@@ -14272,21 +13482,10 @@ func.UI.screen.render_ui_tree = async function (
14272
13482
  api_utils,
14273
13483
  };
14274
13484
 
14275
- const fx = await func.utils.get_plugin_resource(
14276
- SESSION_ID,
14277
- plugin_name,
14278
- `${_plugin.manifest["runtime.mjs"].dist ? "dist/" : ""}runtime.mjs`
14279
- );
13485
+ const fx = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${_plugin.manifest['runtime.mjs'].dist ? 'dist/' : ''}runtime.mjs`);
14280
13486
 
14281
- if (
14282
- _plugin?.manifest?.["runtime.mjs"].dist &&
14283
- _plugin?.manifest?.["runtime.mjs"]?.css
14284
- ) {
14285
- const plugin_runtime_css_url = await func.utils.get_plugin_npm_cdn(
14286
- SESSION_ID,
14287
- plugin_name,
14288
- "dist/runtime.css"
14289
- );
13487
+ if (_plugin?.manifest?.['runtime.mjs'].dist && _plugin?.manifest?.['runtime.mjs']?.css) {
13488
+ const plugin_runtime_css_url = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, 'dist/runtime.css');
14290
13489
  func.utils.load_css_on_demand(plugin_runtime_css_url);
14291
13490
  }
14292
13491
 
@@ -14296,12 +13495,7 @@ func.UI.screen.render_ui_tree = async function (
14296
13495
  try {
14297
13496
  await fx[method](fields, params);
14298
13497
  } catch (err) {
14299
- func.utils.debug_report(
14300
- SESSION_ID,
14301
- `${plugin_name} widget`,
14302
- err.message,
14303
- "E"
14304
- );
13498
+ func.utils.debug_report(SESSION_ID, `${plugin_name} widget`, err.message, 'E');
14305
13499
  }
14306
13500
 
14307
13501
  // glb.lifecycle.plugins[plugin_name] = {
@@ -14324,35 +13518,16 @@ func.UI.screen.render_ui_tree = async function (
14324
13518
  var exist_elm_obj = get_element_info();
14325
13519
  var $div = exist_elm_obj.div;
14326
13520
  if (!exist_elm_obj.div) {
14327
- var $wrapper = $("<div>");
14328
- $div = func.UI.screen.create_container(
14329
- SESSION_ID,
14330
- $root_container,
14331
- nodeP,
14332
- $container,
14333
- paramsP,
14334
- parent_infoP,
14335
- jobNoP,
14336
- keyP,
14337
- parent_nodeP,
14338
- prop,
14339
- null,
14340
- null,
14341
- "div",
14342
- $wrapper,
14343
- ""
14344
- );
13521
+ var $wrapper = $('<div>');
13522
+ $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, 'div', $wrapper, '');
14345
13523
 
14346
13524
  if (paramsP.is_panelP) {
14347
- var id = $div.attr("id");
13525
+ var id = $div.attr('id');
14348
13526
  }
14349
13527
 
14350
13528
  if (!$div) return;
14351
13529
 
14352
- if (
14353
- !REFRESHER_IN_PROGRESS &&
14354
- (paramsP.is_mobile_popover || paramsP.is_mobile_page)
14355
- ) {
13530
+ if (!REFRESHER_IN_PROGRESS && (paramsP.is_mobile_popover || paramsP.is_mobile_page)) {
14356
13531
  close_all_modals();
14357
13532
  }
14358
13533
 
@@ -14362,26 +13537,13 @@ func.UI.screen.render_ui_tree = async function (
14362
13537
  },
14363
13538
  function (e) {
14364
13539
  hover_out();
14365
- }
13540
+ },
14366
13541
  );
14367
13542
  }
14368
13543
 
14369
13544
  const ret = await iterate_child($div, nodeP, null, null, $div);
14370
13545
  if ($container.data().xuAttributes) {
14371
- await func.UI.screen.set_attributes_new(
14372
- SESSION_ID,
14373
- is_skeleton,
14374
- $root_container,
14375
- nodeP,
14376
- $container,
14377
- paramsP,
14378
- parent_infoP,
14379
- jobNoP,
14380
- keyP,
14381
- parent_nodeP,
14382
- $container,
14383
- true
14384
- );
13546
+ await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
14385
13547
  }
14386
13548
 
14387
13549
  $.each($div.data().xuData, function (key, val) {
@@ -14521,25 +13683,12 @@ func.UI.screen.render_ui_tree = async function (
14521
13683
  // }
14522
13684
 
14523
13685
  if (paramsP.screenInfo.properties?.rtl) {
14524
- $div_content.attr("dir", "rtl");
13686
+ $div_content.attr('dir', 'rtl');
14525
13687
  }
14526
13688
 
14527
13689
  return $div;
14528
13690
  };
14529
- await func.UI.screen.set_attributes_new(
14530
- SESSION_ID,
14531
- is_skeleton,
14532
- $root_container,
14533
- nodeP,
14534
- $container,
14535
- paramsP,
14536
- parent_infoP,
14537
- jobNoP,
14538
- keyP,
14539
- parent_nodeP,
14540
- $container,
14541
- true
14542
- );
13691
+ await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
14543
13692
  // var $div_content = $div.children();
14544
13693
 
14545
13694
  // if (continuous_idx !== null || !prop.app_items_per_page) {
@@ -14578,55 +13727,35 @@ func.UI.screen.render_ui_tree = async function (
14578
13727
  return await render_screen_type($div);
14579
13728
  };
14580
13729
 
14581
- if (
14582
- !REFRESHER_IN_PROGRESS &&
14583
- (paramsP.is_mobile_popover || paramsP.is_mobile_page)
14584
- ) {
13730
+ if (!REFRESHER_IN_PROGRESS && (paramsP.is_mobile_popover || paramsP.is_mobile_page)) {
14585
13731
  close_all_modals();
14586
13732
  }
14587
13733
 
14588
13734
  const empty_result = async function () {
14589
- var content = prop.empty_result_content || "";
13735
+ var content = prop.empty_result_content || '';
14590
13736
 
14591
13737
  var res = await func.expression.get(
14592
13738
  SESSION_ID,
14593
13739
  content, // prop["xu-exp:empty_result_content"],
14594
13740
  paramsP.dsSessionP,
14595
- "empty_result_content_EXP",
14596
- _ds.currentRecordId
13741
+ 'empty_result_content_EXP',
13742
+ _ds.currentRecordId,
14597
13743
  );
14598
13744
  content = res.result;
14599
13745
  // }
14600
13746
 
14601
13747
  let empty_result_node = {
14602
- type: "element",
13748
+ type: 'element',
14603
13749
  id: crypto.randomUUID(),
14604
13750
  content,
14605
13751
  // : content || (typeof content === "undefined" && "Empty results"),
14606
- tagName: "div",
13752
+ tagName: 'div',
14607
13753
  attributes: {},
14608
13754
  children: [],
14609
13755
  };
14610
13756
 
14611
- const ret = await func.UI.screen.render_ui_tree(
14612
- SESSION_ID,
14613
- $container,
14614
- empty_result_node,
14615
- parent_infoP,
14616
- paramsP,
14617
- jobNoP,
14618
- null,
14619
- 0,
14620
- null,
14621
- nodeP,
14622
- null,
14623
- $root_container
14624
- );
14625
- await func.events.validate(
14626
- SESSION_ID,
14627
- "record_not_found",
14628
- paramsP.dsSessionP
14629
- );
13757
+ const ret = await func.UI.screen.render_ui_tree(SESSION_ID, $container, empty_result_node, parent_infoP, paramsP, jobNoP, null, 0, null, nodeP, null, $root_container);
13758
+ await func.events.validate(SESSION_ID, 'record_not_found', paramsP.dsSessionP);
14630
13759
  return await done(null);
14631
13760
 
14632
13761
  // var text = "";
@@ -14692,29 +13821,10 @@ func.UI.screen.render_ui_tree = async function (
14692
13821
  // }
14693
13822
  ////////
14694
13823
  _ds.currentRecordId = val._ROWID;
14695
- const ret = await iterate_child(
14696
- $div,
14697
- node,
14698
- { continuous_idx },
14699
- null,
14700
- $root_container
14701
- );
13824
+ const ret = await iterate_child($div, node, { continuous_idx }, null, $root_container);
14702
13825
 
14703
13826
  if ($container.data().xuAttributes) {
14704
- await func.UI.screen.set_attributes_new(
14705
- SESSION_ID,
14706
- is_skeleton,
14707
- $root_container,
14708
- nodeP,
14709
- $container,
14710
- paramsP,
14711
- parent_infoP,
14712
- jobNoP,
14713
- keyP,
14714
- parent_nodeP,
14715
- $container,
14716
- true
14717
- );
13827
+ await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
14718
13828
  }
14719
13829
  }
14720
13830
 
@@ -14727,14 +13837,7 @@ func.UI.screen.render_ui_tree = async function (
14727
13837
  }
14728
13838
  var $div_items = $div.data().xuData.node.children;
14729
13839
 
14730
- await func.UI.screen.panel_post_render_handler(
14731
- SESSION_ID,
14732
- $container,
14733
- $new_div,
14734
- nodeP,
14735
- $div,
14736
- jobNoP
14737
- );
13840
+ await func.UI.screen.panel_post_render_handler(SESSION_ID, $container, $new_div, nodeP, $div, jobNoP);
14738
13841
 
14739
13842
  // TO FIX should be timeout
14740
13843
  $container.data().xuData.node.children = $div_items;
@@ -14742,39 +13845,10 @@ func.UI.screen.render_ui_tree = async function (
14742
13845
  return $container;
14743
13846
  };
14744
13847
 
14745
- var $wrapper = $("<div>");
14746
- $div = func.UI.screen.create_container(
14747
- SESSION_ID,
14748
- $root_container,
14749
- nodeP,
14750
- $container,
14751
- paramsP,
14752
- parent_infoP,
14753
- jobNoP,
14754
- keyP,
14755
- parent_nodeP,
14756
- prop,
14757
- null,
14758
- null,
14759
- null,
14760
- $wrapper,
14761
- ""
14762
- );
13848
+ var $wrapper = $('<div>');
13849
+ $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, null, $wrapper, '');
14763
13850
 
14764
- let ret = await func.UI.screen.set_attributes_new(
14765
- SESSION_ID,
14766
- is_skeleton,
14767
- $root_container,
14768
- nodeP,
14769
- $container,
14770
- paramsP,
14771
- parent_infoP,
14772
- jobNoP,
14773
- keyP,
14774
- parent_nodeP,
14775
- $div.clone(true),
14776
- true
14777
- );
13851
+ let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div.clone(true), true);
14778
13852
  if (ret.abort) {
14779
13853
  // // program null
14780
13854
  // if (ret.program_null) {
@@ -14782,7 +13856,7 @@ func.UI.screen.render_ui_tree = async function (
14782
13856
  // }
14783
13857
 
14784
13858
  // render N
14785
- return (ret.$new_div = $("<template>").append($div));
13859
+ return (ret.$new_div = $('<template>').append($div));
14786
13860
 
14787
13861
  // ret.$new_div = $("<template>").append($div);
14788
13862
  }
@@ -14795,8 +13869,8 @@ func.UI.screen.render_ui_tree = async function (
14795
13869
  const done = async function () {
14796
13870
  return $div;
14797
13871
  };
14798
- if (!element || element === "script") return await done();
14799
- let str = "";
13872
+ if (!element || element === 'script') return await done();
13873
+ let str = '';
14800
13874
  // var $div
14801
13875
  // const draw_svg = function () {
14802
13876
  // const get_tag_str = function (element, prop, val) {
@@ -14838,23 +13912,7 @@ func.UI.screen.render_ui_tree = async function (
14838
13912
  // // return await done();
14839
13913
  // }
14840
13914
 
14841
- var $div = func.UI.screen.create_container(
14842
- SESSION_ID,
14843
- $root_container,
14844
- nodeP,
14845
- $container,
14846
- paramsP,
14847
- parent_infoP,
14848
- jobNoP,
14849
- keyP,
14850
- parent_nodeP,
14851
- prop,
14852
- null,
14853
- null,
14854
- element,
14855
- null,
14856
- str
14857
- );
13915
+ var $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, element, null, str);
14858
13916
 
14859
13917
  $div.hover(
14860
13918
  function (e) {
@@ -14862,42 +13920,23 @@ func.UI.screen.render_ui_tree = async function (
14862
13920
  },
14863
13921
  function (e) {
14864
13922
  hover_out();
14865
- }
13923
+ },
14866
13924
  );
14867
13925
 
14868
- let ret = await func.UI.screen.set_attributes_new(
14869
- SESSION_ID,
14870
- is_skeleton,
14871
- $root_container,
14872
- nodeP,
14873
- $container,
14874
- paramsP,
14875
- parent_infoP,
14876
- jobNoP,
14877
- keyP,
14878
- parent_nodeP,
14879
- $div,
14880
- true
14881
- );
13926
+ let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div, true);
14882
13927
  if (ret.abort) return await done();
14883
13928
  // check if iterator made to prevent children render
14884
13929
 
14885
- const ret_iterate_child = await iterate_child(
14886
- $div,
14887
- nodeP,
14888
- parent_infoP,
14889
- null,
14890
- $root_container
14891
- );
13930
+ const ret_iterate_child = await iterate_child($div, nodeP, parent_infoP, null, $root_container);
14892
13931
  return await done();
14893
13932
  };
14894
13933
 
14895
13934
  if (nodeP.content && nodeP.attributes) {
14896
- nodeP.attributes["xu-content"] = nodeP.content;
13935
+ nodeP.attributes['xu-content'] = nodeP.content;
14897
13936
  }
14898
- if (nodeP.tagName === "xu-widget") {
13937
+ if (nodeP.tagName === 'xu-widget') {
14899
13938
  if (is_skeleton) return;
14900
- return await fx["widget"]();
13939
+ return await fx['widget']();
14901
13940
  }
14902
13941
  if (fx[nodeP.tagName]) {
14903
13942
  return await fx[nodeP.tagName]();
@@ -14906,17 +13945,11 @@ func.UI.screen.render_ui_tree = async function (
14906
13945
  return await draw_html_element(nodeP.tagName);
14907
13946
  };
14908
13947
 
14909
- func.UI.screen.refresh_document_changes_for_realtime_update = async function (
14910
- SESSION_ID,
14911
- doc_change
14912
- ) {
13948
+ func.UI.screen.refresh_document_changes_for_realtime_update = async function (SESSION_ID, doc_change) {
14913
13949
  let _session = SESSION_OBJ[SESSION_ID];
14914
13950
  for (const [key, _ds] of Object.entries(_session.DS_GLB)) {
14915
13951
  let prog_obj = await func.utils.VIEWS_OBJ.get(SESSION_ID, _ds.prog_id);
14916
- if (
14917
- prog_obj?.progDataSource?.dataSourceRealtime &&
14918
- prog_obj?.progDataSource?.dataSourceTableId === doc_change.table_id
14919
- ) {
13952
+ if (prog_obj?.progDataSource?.dataSourceRealtime && prog_obj?.progDataSource?.dataSourceTableId === doc_change.table_id) {
14920
13953
  try {
14921
13954
  // disabled in purpose to support create row
14922
13955
 
@@ -14931,7 +13964,7 @@ func.UI.screen.refresh_document_changes_for_realtime_update = async function (
14931
13964
  if (_ds.screen_params.is_panelP) {
14932
13965
  func.UI.screen.refresh_screen(SESSION_ID, null, key);
14933
13966
  } else {
14934
- func.action.execute(SESSION_ID, "act_refresh", _ds, null, null);
13967
+ func.action.execute(SESSION_ID, 'act_refresh', _ds, null, null);
14935
13968
  }
14936
13969
  } catch (err) {
14937
13970
  // console.error(err);