@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.
@@ -32508,23 +32508,10 @@ func.datasource.get_args_property_value = async function (SESSION_ID, dsSession,
32508
32508
  return _value;
32509
32509
  };
32510
32510
  func.UI.screen = {};
32511
- func.UI.screen.init = async function (
32512
- SESSION_ID,
32513
- prog_id,
32514
- sourceScreenP,
32515
- callingDataSource_objP,
32516
- $callingContainerP,
32517
- triggerIdP,
32518
- rowIdP,
32519
- jobNoP,
32520
- is_panelP,
32521
- parameters_obj_inP,
32522
- source_functionP,
32523
- call_screen_propertiesP
32524
- ) {
32525
- if (!prog_id) return console.error("program is empty");
32511
+ 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) {
32512
+ if (!prog_id) return console.error('program is empty');
32526
32513
  let screen_ret = await func.utils.get_screen_obj(SESSION_ID, prog_id);
32527
- if (!screen_ret) return console.error("program is not a screen object");
32514
+ if (!screen_ret) return console.error('program is not a screen object');
32528
32515
  await func.UI.utils.init_ui_framework(SESSION_ID, prog_id);
32529
32516
 
32530
32517
  let _session = SESSION_OBJ[SESSION_ID];
@@ -32532,21 +32519,15 @@ func.UI.screen.init = async function (
32532
32519
  const screenInfo = _.cloneDeep(screen_ret);
32533
32520
  const $callingContainerP_data = $callingContainerP.clone(true)?.data();
32534
32521
 
32535
- var screen_type = source_functionP?.split("_")?.[1]; //|| (is_panelP && "panel");
32522
+ var screen_type = source_functionP?.split('_')?.[1]; //|| (is_panelP && "panel");
32536
32523
 
32537
32524
  var screenId = (glb.screen_num++).toString();
32538
32525
 
32539
- if (
32540
- SCREEN_BLOCKER_OBJ[prog_id + (sourceScreenP ? "_" + sourceScreenP : "")]
32541
- ) {
32526
+ if (SCREEN_BLOCKER_OBJ[prog_id + (sourceScreenP ? '_' + sourceScreenP : '')]) {
32542
32527
  const wait_for_SCREEN_BLOCKER_release = () => {
32543
32528
  return new Promise((resolve) => {
32544
32529
  var interval = setInterval(function () {
32545
- if (
32546
- !SCREEN_BLOCKER_OBJ[
32547
- prog_id + (sourceScreenP ? "_" + sourceScreenP : "")
32548
- ]
32549
- ) {
32530
+ if (!SCREEN_BLOCKER_OBJ[prog_id + (sourceScreenP ? '_' + sourceScreenP : '')]) {
32550
32531
  window.clearInterval(interval);
32551
32532
  resolve();
32552
32533
  // run_screen();
@@ -32557,13 +32538,9 @@ func.UI.screen.init = async function (
32557
32538
  await wait_for_SCREEN_BLOCKER_release();
32558
32539
  }
32559
32540
 
32560
- func.UI.utils.screen_blocker(
32561
- true,
32562
- prog_id + (sourceScreenP ? "_" + sourceScreenP : "")
32563
- );
32541
+ func.UI.utils.screen_blocker(true, prog_id + (sourceScreenP ? '_' + sourceScreenP : ''));
32564
32542
 
32565
- if ($callingContainerP && !_.isEmpty($callingContainerP))
32566
- $callingContainerP.data().xuData.screenInfo = screenInfo;
32543
+ if ($callingContainerP && !_.isEmpty($callingContainerP)) $callingContainerP.data().xuData.screenInfo = screenInfo;
32567
32544
 
32568
32545
  var $dialogDiv;
32569
32546
  var $rootFrame;
@@ -32583,20 +32560,17 @@ func.UI.screen.init = async function (
32583
32560
  screen_type,
32584
32561
  screenInfo,
32585
32562
  call_screen_propertiesP,
32586
- parentDataSourceNoP:
32587
- _session.DS_GLB?.[callingDataSource_objP?.dsSession]?.dsSession ||
32588
- callingDataSource_objP?.parentDataSourceNo ||
32589
- 0,
32563
+ parentDataSourceNoP: _session.DS_GLB?.[callingDataSource_objP?.dsSession]?.dsSession || callingDataSource_objP?.parentDataSourceNo || 0,
32590
32564
  };
32591
32565
 
32592
32566
  switch (screen_type) {
32593
- case "embed":
32594
- $dialogDiv = $("<div>")
32567
+ case 'embed':
32568
+ $dialogDiv = $('<div>')
32595
32569
  .attr({
32596
32570
  id: screenId,
32597
32571
  ui_engine: UI_FRAMEWORK_INSTALLED,
32598
32572
  })
32599
- .addClass("xu_embed_div")
32573
+ .addClass('xu_embed_div')
32600
32574
  .data({
32601
32575
  xuData: {
32602
32576
  paramsP: params,
@@ -32604,21 +32578,18 @@ func.UI.screen.init = async function (
32604
32578
  },
32605
32579
  });
32606
32580
 
32607
- let rootTagName = "div";
32608
- if (typeof glb.SLIM_BUNDLE === "undefined" && !glb.SLIM_BUNDLE) {
32581
+ let rootTagName = 'div';
32582
+ if (typeof glb.SLIM_BUNDLE === 'undefined' && !glb.SLIM_BUNDLE) {
32609
32583
  const ui_plugin_core = new UI_FRAMEWORK_PLUGIN.core();
32610
32584
  rootTagName = ui_plugin_core?.rootTagName();
32611
32585
  }
32612
32586
 
32613
- $rootFrame = $(`<${rootTagName}>`)
32614
- .data("xuData", {})
32615
- .data("xuAttributes", {})
32616
- .appendTo($dialogDiv);
32587
+ $rootFrame = $(`<${rootTagName}>`).data('xuData', {}).data('xuAttributes', {}).appendTo($dialogDiv);
32617
32588
 
32618
32589
  $dialogDiv.appendTo($callingContainerP);
32619
32590
  break;
32620
32591
 
32621
- case "panel":
32592
+ case 'panel':
32622
32593
  $dialogDiv = $callingContainerP;
32623
32594
  $dialogDiv.data({
32624
32595
  xuData: {
@@ -32629,31 +32600,30 @@ func.UI.screen.init = async function (
32629
32600
  $rootFrame = $dialogDiv;
32630
32601
  break;
32631
32602
 
32632
- case "page":
32633
- case "modal":
32634
- case "popover":
32635
- $dialogDiv = $("<div>");
32636
- $rootFrame = $("<div>").appendTo($dialogDiv);
32637
- $dialogDiv.appendTo("body");
32603
+ case 'page':
32604
+ case 'modal':
32605
+ case 'popover':
32606
+ $dialogDiv = $('<div>');
32607
+ $rootFrame = $('<div>').appendTo($dialogDiv);
32608
+ $dialogDiv.appendTo('body');
32638
32609
  break;
32639
32610
 
32640
32611
  default:
32641
32612
  }
32642
32613
 
32643
- params.containerIdP = $rootFrame.attr("id");
32614
+ params.containerIdP = $rootFrame.attr('id');
32644
32615
  params.$container = $rootFrame;
32645
32616
 
32646
- containerId =
32647
- "container_" + params.screenInfo.properties?.id + "_" + screenId;
32617
+ containerId = 'container_' + params.screenInfo.properties?.id + '_' + screenId;
32648
32618
 
32649
32619
  var data = {
32650
- note: " ROOT container",
32620
+ note: ' ROOT container',
32651
32621
  root: true,
32652
32622
  screenId,
32653
32623
  is_panelP,
32654
32624
  prog_id,
32655
32625
  screen_type,
32656
- container: "#" + containerId, // initiate container that hold the element
32626
+ container: '#' + containerId, // initiate container that hold the element
32657
32627
  };
32658
32628
  if (is_panelP) {
32659
32629
  $rootFrame.data().xuData.rootFrame = data;
@@ -32661,8 +32631,8 @@ func.UI.screen.init = async function (
32661
32631
  if (!$rootFrame.data().xuData) {
32662
32632
  $rootFrame.data().xuData = {};
32663
32633
  }
32664
- $rootFrame.attr("id", containerId).data().xuData.rootFrame = data;
32665
- $rootFrame.css("display", "contents");
32634
+ $rootFrame.attr('id', containerId).data().xuData.rootFrame = data;
32635
+ $rootFrame.css('display', 'contents');
32666
32636
  }
32667
32637
 
32668
32638
  // ////////// skeleton
@@ -32748,23 +32718,7 @@ func.UI.screen.init = async function (
32748
32718
  // console.log("***");
32749
32719
  func.UI.utils.indicator.screen.busy();
32750
32720
 
32751
- const ret = await func.datasource.create(
32752
- SESSION_ID,
32753
- prog_id,
32754
- null,
32755
- params.parentDataSourceNoP,
32756
- $rootFrame.attr("id"),
32757
- rowIdP,
32758
- jobNoP,
32759
- null,
32760
- null,
32761
- null,
32762
- null,
32763
- null,
32764
- null,
32765
- null,
32766
- parameters_obj_inP
32767
- );
32721
+ 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);
32768
32722
 
32769
32723
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[ret.dsSessionP];
32770
32724
  _ds.screen_params = params;
@@ -32781,46 +32735,24 @@ func.UI.screen.init = async function (
32781
32735
  if (ret.dsSessionP >= 0) {
32782
32736
  // Call from contact info screen
32783
32737
  var viewDoc;
32784
- let view_ret = await func.utils.VIEWS_OBJ.get(
32785
- SESSION_ID,
32786
- SESSION_OBJ[SESSION_ID].DS_GLB[ret.dsSessionP].prog_id
32787
- );
32738
+ let view_ret = await func.utils.VIEWS_OBJ.get(SESSION_ID, SESSION_OBJ[SESSION_ID].DS_GLB[ret.dsSessionP].prog_id);
32788
32739
  if (view_ret) {
32789
32740
  viewDoc = view_ret;
32790
32741
  }
32791
32742
  if (!viewDoc?.progUi) {
32792
- return func.utils.alerts.invoke(
32793
- SESSION_ID,
32794
- "system_msg",
32795
- "SYS_MSG_0780",
32796
- params.renderType,
32797
- ret.dsSessionP
32798
- );
32743
+ return func.utils.alerts.invoke(SESSION_ID, 'system_msg', 'SYS_MSG_0780', params.renderType, ret.dsSessionP);
32799
32744
  }
32800
32745
  var node;
32801
32746
  node = _.cloneDeep(viewDoc.progUi);
32802
- if (!node.length) return console.warn("ui node empty");
32803
- const ret_render_$container = await func.UI.screen.render_ui_tree(
32804
- SESSION_ID,
32805
- $rootFrame,
32806
- node[0],
32807
- null,
32808
- params,
32809
- jobNoP,
32810
- null,
32811
- null,
32812
- null,
32813
- null,
32814
- null,
32815
- $rootFrame
32816
- );
32747
+ if (!node.length) return console.warn('ui node empty');
32748
+ 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);
32817
32749
 
32818
32750
  // $(".skeleton_wrapper").remove();
32819
32751
 
32820
32752
  // fix for svg
32821
32753
 
32822
32754
  const fix_svg = function () {
32823
- let $svg = $("svg");
32755
+ let $svg = $('svg');
32824
32756
  $.each($svg, function (key, elm) {
32825
32757
  elm.outerHTML = elm.outerHTML;
32826
32758
  });
@@ -32830,12 +32762,7 @@ func.UI.screen.init = async function (
32830
32762
  }, 200);
32831
32763
  func.UI.utils.indicator.screen.normal();
32832
32764
 
32833
- let ret_screen_loading = await func.UI.screen.screen_loading_done(
32834
- SESSION_ID,
32835
- params,
32836
- ret_render_$container,
32837
- jobNoP
32838
- );
32765
+ let ret_screen_loading = await func.UI.screen.screen_loading_done(SESSION_ID, params, ret_render_$container, jobNoP);
32839
32766
  return ret_screen_loading;
32840
32767
  }
32841
32768
  };
@@ -32847,11 +32774,10 @@ func.UI.screen.update_SYS_OBJ_WIN_INFO = function (SESSION_ID, dsNoP) {
32847
32774
  _ds.data_system = {};
32848
32775
  }
32849
32776
 
32850
- _ds.data_system["SYS_STR_WIN_ID"] = _ds.tree_obj?.id;
32851
- _ds.data_system["SYS_STR_WIN_NAME"] = _ds.tree_obj?.menuName;
32777
+ _ds.data_system['SYS_STR_WIN_ID'] = _ds.tree_obj?.id;
32778
+ _ds.data_system['SYS_STR_WIN_NAME'] = _ds.tree_obj?.menuName;
32852
32779
  if (SESSION_OBJ[SESSION_ID].DS_GLB[dsNoP].mode) {
32853
- _ds.data_system["SYS_STR_WIN_MODE"] =
32854
- SESSION_OBJ[SESSION_ID].DS_GLB[dsNoP].mode;
32780
+ _ds.data_system['SYS_STR_WIN_MODE'] = SESSION_OBJ[SESSION_ID].DS_GLB[dsNoP].mode;
32855
32781
  }
32856
32782
  // _ds.data_system["SYS_OBJ_WIN_INFO"] = func.UI.screen.get_info(
32857
32783
  // SESSION_ID,
@@ -32860,19 +32786,9 @@ func.UI.screen.update_SYS_OBJ_WIN_INFO = function (SESSION_ID, dsNoP) {
32860
32786
  // get all top fields into json
32861
32787
  };
32862
32788
 
32863
- func.UI.screen.validate_exit_events = async function (
32864
- SESSION_ID,
32865
- div_data_paramsP,
32866
- forceP
32867
- ) {
32789
+ func.UI.screen.validate_exit_events = async function (SESSION_ID, div_data_paramsP, forceP) {
32868
32790
  return new Promise(async (resolve) => {
32869
- await func.events.validate(
32870
- SESSION_ID,
32871
- "on_exit",
32872
- div_data_paramsP.dsSessionP,
32873
- null,
32874
- "screen"
32875
- );
32791
+ await func.events.validate(SESSION_ID, 'on_exit', div_data_paramsP.dsSessionP, null, 'screen');
32876
32792
 
32877
32793
  var interval = setInterval(function () {
32878
32794
  if (!SESSION_OBJ[SESSION_ID].WORKER_OBJ.jobs.length || forceP) {
@@ -32884,7 +32800,7 @@ func.UI.screen.validate_exit_events = async function (
32884
32800
  };
32885
32801
 
32886
32802
  func.UI.screen.call_embed = function (SESSION_ID, prog) {
32887
- $("#embed_" + SESSION_ID)
32803
+ $('#embed_' + SESSION_ID)
32888
32804
  .empty()
32889
32805
  .data().xuData.screenInfo = null;
32890
32806
 
@@ -32893,24 +32809,18 @@ func.UI.screen.call_embed = function (SESSION_ID, prog) {
32893
32809
  });
32894
32810
  func.UI.main.embed_prog_execute(SESSION_ID, prog);
32895
32811
  };
32896
- func.UI.screen.refresh_xu_attributes = async function (
32897
- SESSION_ID,
32898
- fields_arr,
32899
- jobNoP,
32900
- $elm_to_search,
32901
- dsSession
32902
- ) {
32812
+ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, jobNoP, $elm_to_search, dsSession) {
32903
32813
  var selectors = {};
32904
- var search_from = "body";
32814
+ var search_from = 'body';
32905
32815
  var new_job = jobNoP;
32906
32816
 
32907
32817
  if ($elm_to_search) {
32908
- search_from = "#" + $elm_to_search.attr("id");
32818
+ search_from = '#' + $elm_to_search.attr('id');
32909
32819
  }
32910
32820
  const get_selectors = function () {
32911
32821
  $.each(fields_arr, function (key_field, val_field) {
32912
32822
  $(search_from)
32913
- .find("*")
32823
+ .find('*')
32914
32824
  .filter(function () {
32915
32825
  var attr = [];
32916
32826
 
@@ -32920,41 +32830,33 @@ func.UI.screen.refresh_xu_attributes = async function (
32920
32830
  // )
32921
32831
  // return;
32922
32832
 
32923
-
32924
-
32925
32833
  $.each($(this).data()?.xuAttributes, function (key, val) {
32926
-
32927
- if (key === "xu-for") { // match static value for xu-for
32834
+ if (key === 'xu-for') {
32835
+ // match static value for xu-for
32928
32836
  if (val?.includes?.(val_field)) {
32929
32837
  attr.push(key);
32930
-
32931
32838
  }
32932
32839
  }
32933
32840
 
32934
-
32935
- if (!key.substr(0, 2) === "xu") return;
32936
- if (key.substr(0, 6) === "xu-exp" && key.substr(6, 1) === ":") {
32841
+ if (!key.substr(0, 2) === 'xu') return;
32842
+ if (key.substr(0, 6) === 'xu-exp' && key.substr(6, 1) === ':') {
32937
32843
  if (val?.includes?.(val_field)) {
32938
32844
  attr.push(key);
32939
-
32940
32845
  }
32941
-
32942
32846
  }
32943
32847
 
32944
-
32945
-
32946
- if (key.substr(0, 8) === "xu-class") {
32848
+ if (key.substr(0, 8) === 'xu-class') {
32947
32849
  try {
32948
32850
  let obj = JSON.parse(val);
32949
32851
  $.each(obj, function (cla, cond) {
32950
32852
  if (cond.includes(val_field)) {
32951
32853
  // attr.push("xuClass");
32952
- attr.push("xu-class");
32854
+ attr.push('xu-class');
32953
32855
  return false;
32954
32856
  }
32955
32857
  });
32956
32858
  } catch (e) {
32957
- console.warn("parse error:" + val);
32859
+ console.warn('parse error:' + val);
32958
32860
  }
32959
32861
  }
32960
32862
  // return attr;
@@ -32969,8 +32871,7 @@ func.UI.screen.refresh_xu_attributes = async function (
32969
32871
  selectors[selector_id] = { attributes: [], $elm: $(this) };
32970
32872
  }
32971
32873
  attr.forEach(function (value) {
32972
- if (!selectors[selector_id].attributes.includes(value))
32973
- selectors[selector_id].attributes.push(value);
32874
+ if (!selectors[selector_id].attributes.includes(value)) selectors[selector_id].attributes.push(value);
32974
32875
  });
32975
32876
  }
32976
32877
  });
@@ -32980,14 +32881,14 @@ func.UI.screen.refresh_xu_attributes = async function (
32980
32881
  get_selectors();
32981
32882
 
32982
32883
  for await (let [elem_key, elem_val] of Object.entries(selectors)) {
32983
- if (elem_key === "length") break;
32884
+ if (elem_key === 'length') break;
32984
32885
 
32985
32886
  const add_execute_queue = async function (type) {
32986
32887
  if (!elem_val.$elm?.data?.()?.xuData) return;
32987
32888
 
32988
32889
  new_job = await func.UI.worker.add_to_queue(
32989
32890
  SESSION_ID,
32990
- "gui event",
32891
+ 'gui event',
32991
32892
  type,
32992
32893
  {
32993
32894
  ui_type: elem_val.$elm.data().xuData.ui_type,
@@ -32997,7 +32898,7 @@ func.UI.screen.refresh_xu_attributes = async function (
32997
32898
  elem_val,
32998
32899
  },
32999
32900
  new_job,
33000
- elem_val.$elm
32901
+ elem_val.$elm,
33001
32902
  );
33002
32903
  };
33003
32904
  //////////// process render first ///////////////
@@ -33006,27 +32907,15 @@ func.UI.screen.refresh_xu_attributes = async function (
33006
32907
 
33007
32908
  if (!elem_val?.$elm?.data()?.xuAttributes) continue;
33008
32909
 
33009
- if (elem_val.attributes.includes("xu-exp:xu-render")) {
33010
- var res = await func.expression.get(
33011
- SESSION_ID,
33012
- elem_val.$elm.data().xuAttributes["xu-exp:xu-render"],
33013
- elem_val.$elm.data().xuData.paramsP.dsSessionP,
33014
- "UI Property EXP",
33015
- elem_val.$elm.data().xuData.recordid
33016
- );
32910
+ if (elem_val.attributes.includes('xu-exp:xu-render')) {
32911
+ 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);
33017
32912
 
33018
- var attr_value = await func.common.get_cast_val(
33019
- SESSION_ID,
33020
- "refresh xu-attributes",
33021
- "xu-render",
33022
- "bool",
33023
- res.result
33024
- );
32913
+ var attr_value = await func.common.get_cast_val(SESSION_ID, 'refresh xu-attributes', 'xu-render', 'bool', res.result);
33025
32914
 
33026
- if (!attr_value & (elem_val.$elm[0].tagName === "XURENDER")) continue; // bypass job
32915
+ if (!attr_value & (elem_val.$elm[0].tagName === 'XURENDER')) continue; // bypass job
33027
32916
 
33028
- if (attr_value & (elem_val.$elm[0].tagName !== "XURENDER")) {
33029
- await add_execute_queue("execute_xu_all_attributes");
32917
+ if (attr_value & (elem_val.$elm[0].tagName !== 'XURENDER')) {
32918
+ await add_execute_queue('execute_xu_all_attributes');
33030
32919
  continue; // bypass render job
33031
32920
  }
33032
32921
 
@@ -33034,8 +32923,8 @@ func.UI.screen.refresh_xu_attributes = async function (
33034
32923
 
33035
32924
  new_job = await func.UI.worker.add_to_queue(
33036
32925
  SESSION_ID,
33037
- "gui event",
33038
- "execute_xu_render_attributes",
32926
+ 'gui event',
32927
+ 'execute_xu_render_attributes',
33039
32928
  {
33040
32929
  ui_type: elem_val.$elm.data().xuData.ui_type,
33041
32930
  SESSION_ID,
@@ -33046,50 +32935,47 @@ func.UI.screen.refresh_xu_attributes = async function (
33046
32935
  },
33047
32936
  new_job,
33048
32937
  elem_val.$elm,
33049
- elem_val.$elm.data().xuData.paramsP.dsSessionP
32938
+ elem_val.$elm.data().xuData.paramsP.dsSessionP,
33050
32939
  );
33051
32940
  performed_render = true;
33052
32941
  }
33053
32942
 
33054
- if (performed_render || elem_val.$elm[0].tagName === "XURENDER") continue; // bypass job
32943
+ if (performed_render || elem_val.$elm[0].tagName === 'XURENDER') continue; // bypass job
33055
32944
 
33056
- if (elem_val.attributes.includes("xu-exp:xu-for") || elem_val.attributes.includes("xu-for")) continue;
33057
- add_execute_queue("execute_xu_all_attributes");
32945
+ if (elem_val.attributes.includes('xu-exp:xu-for') || elem_val.attributes.includes('xu-for')) continue;
32946
+ add_execute_queue('execute_xu_all_attributes');
33058
32947
  }
33059
32948
 
33060
32949
  // xu-for
33061
32950
  selectors = {};
33062
32951
  get_selectors();
33063
- let refreshed_ids = []
32952
+ let refreshed_ids = [];
33064
32953
  // handle xu-for
33065
- let parent_element_ui_id
32954
+ let parent_element_ui_id;
33066
32955
  for await (let [elem_key, elem_val] of Object.entries(selectors)) {
33067
- if (elem_key === "length") break;
32956
+ if (elem_key === 'length') break;
33068
32957
 
33069
- if (!elem_val.attributes.includes("xu-exp:xu-for") && !elem_val.attributes.includes("xu-for")) continue;
32958
+ if (!elem_val.attributes.includes('xu-exp:xu-for') && !elem_val.attributes.includes('xu-for')) continue;
33070
32959
 
33071
-
33072
- let _parent_element_ui_id
32960
+ let _parent_element_ui_id;
33073
32961
  if (elem_val?.$elm?.data()?.xuPanelData) {
33074
32962
  // handle li panel
33075
- _parent_element_ui_id = elem_val?.$elm?.data()?.xuPanelData?.parent_element_ui_id
32963
+ _parent_element_ui_id = elem_val?.$elm?.data()?.xuPanelData?.parent_element_ui_id;
33076
32964
  } else {
33077
- // handle regular li
32965
+ // handle regular li
33078
32966
  _parent_element_ui_id = elem_val?.$elm?.data()?.xuData?.parent_element_ui_id;
33079
32967
  }
33080
32968
 
33081
32969
  if (!parent_element_ui_id || _parent_element_ui_id != parent_element_ui_id) {
33082
32970
  parent_element_ui_id = _parent_element_ui_id;
33083
32971
 
33084
- const _$elem = $(`[xu-ui-id=${parent_element_ui_id}]`)
33085
- const _elem_key = parent_element_ui_id
33086
- const _elem_val = { attributes: [], $elm: _$elem }
32972
+ const _$elem = $(`[xu-ui-id=${parent_element_ui_id}]`);
32973
+ const _elem_key = parent_element_ui_id;
32974
+ const _elem_val = { attributes: [], $elm: _$elem };
33087
32975
 
33088
32976
  $.each(_$elem.data()?.xuAttributes, function (key, val) {
33089
32977
  _elem_val.attributes.push(key);
33090
- })
33091
-
33092
-
32978
+ });
33093
32979
 
33094
32980
  // await func.UI.worker.add_to_queue(
33095
32981
  // SESSION_ID,
@@ -33109,8 +32995,8 @@ func.UI.screen.refresh_xu_attributes = async function (
33109
32995
 
33110
32996
  await func.UI.worker.add_to_queue(
33111
32997
  SESSION_ID,
33112
- "gui event",
33113
- "execute_xu_for",
32998
+ 'gui event',
32999
+ 'execute_xu_for',
33114
33000
  {
33115
33001
  ui_type: _elem_val.$elm.data().xuData.ui_type,
33116
33002
  SESSION_ID,
@@ -33120,45 +33006,40 @@ func.UI.screen.refresh_xu_attributes = async function (
33120
33006
  },
33121
33007
  new_job,
33122
33008
  _elem_val.$elm,
33123
- _elem_val.$elm.data().xuData.paramsP.dsSessionP
33009
+ _elem_val.$elm.data().xuData.paramsP.dsSessionP,
33124
33010
  );
33125
33011
 
33126
- refreshed_ids.push(parent_element_ui_id)
33012
+ refreshed_ids.push(parent_element_ui_id);
33127
33013
  }
33128
33014
  }
33129
33015
 
33130
- /////////// xu-for for non displayed elements ////////////
33016
+ /////////// xu-for for non displayed elements ////////////
33131
33017
  const iterate_field_in_progUi = async function (progUi, field_id) {
33132
- let found
33018
+ let found;
33133
33019
  const iterate_progUi = async function (node, node_id) {
33134
33020
  for (let item of node) {
33135
-
33136
33021
  if (!_.isEmpty(item.attributes)) {
33137
33022
  for await (const [attr, val] of Object.entries(item.attributes)) {
33138
-
33139
- if (attr === "xu-exp:xu-for" || attr === "xu-for") {
33023
+ if (attr === 'xu-exp:xu-for' || attr === 'xu-for') {
33140
33024
  if (val?.includes(field_id)) {
33025
+ const parent_element_ui_id = node_id;
33141
33026
 
33142
- const parent_element_ui_id = node_id
33027
+ const _$elem = $(`[xu-ui-id^=${parent_element_ui_id}]`);
33143
33028
 
33029
+ if (refreshed_ids.includes(_$elem.attr('xu-ui-id'))) break;
33144
33030
 
33145
-
33146
- const _$elem = $(`[xu-ui-id^=${parent_element_ui_id}]`)
33147
-
33148
- if (refreshed_ids.includes(_$elem.attr("xu-ui-id"))) break
33149
-
33150
- if (!_$elem?.length) continue
33151
- const _elem_key = parent_element_ui_id
33152
- const _elem_val = { attributes: [], $elm: _$elem }
33031
+ if (!_$elem?.length) continue;
33032
+ const _elem_key = parent_element_ui_id;
33033
+ const _elem_val = { attributes: [], $elm: _$elem };
33153
33034
 
33154
33035
  $.each(_$elem.data()?.xuAttributes, function (key, val) {
33155
33036
  _elem_val.attributes.push(key);
33156
- })
33037
+ });
33157
33038
 
33158
33039
  await func.UI.worker.add_to_queue(
33159
33040
  SESSION_ID,
33160
- "gui event",
33161
- "execute_xu_for",
33041
+ 'gui event',
33042
+ 'execute_xu_for',
33162
33043
  {
33163
33044
  ui_type: _elem_val.$elm.data().xuData.ui_type,
33164
33045
  SESSION_ID,
@@ -33168,98 +33049,77 @@ func.UI.screen.refresh_xu_attributes = async function (
33168
33049
  },
33169
33050
  new_job,
33170
33051
  _elem_val.$elm,
33171
- _elem_val.$elm.data().xuData.paramsP.dsSessionP
33052
+ _elem_val.$elm.data().xuData.paramsP.dsSessionP,
33172
33053
  );
33173
33054
 
33174
- break
33175
-
33055
+ break;
33176
33056
  }
33177
33057
  }
33178
33058
  }
33179
33059
  }
33180
- if (found) break
33060
+ if (found) break;
33181
33061
 
33182
33062
  if (item.children) {
33183
33063
  await iterate_progUi(item.children, item.id);
33184
33064
  }
33185
33065
  }
33186
- }
33187
- await iterate_progUi(progUi)
33188
- return found
33189
- }
33190
-
33191
- const $xu_embed_div = $(".xu_embed_div");
33192
- const panels_obj = func.UI.utils.get_panels_from_dom(SESSION_ID, true)
33066
+ };
33067
+ await iterate_progUi(progUi);
33068
+ return found;
33069
+ };
33193
33070
 
33071
+ const $xu_embed_div = $('.xu_embed_div');
33072
+ const panels_obj = func.UI.utils.get_panels_from_dom(SESSION_ID, true);
33194
33073
 
33195
33074
  for await (const field_id of fields_arr) {
33196
33075
  // run root
33197
33076
  if ($xu_embed_div.length) {
33198
- const progUi = $xu_embed_div?.data()?.xuData?.screenInfo?.progUi
33077
+ const progUi = $xu_embed_div?.data()?.xuData?.screenInfo?.progUi;
33199
33078
  if (progUi) {
33200
- await iterate_field_in_progUi(progUi, field_id)
33079
+ await iterate_field_in_progUi(progUi, field_id);
33201
33080
  }
33202
33081
  }
33203
33082
  // run panels
33204
- for await (const [parent_element_ui_id, panel_val] of Object.entries(
33205
- panels_obj
33206
- )) {
33207
-
33208
- const prog_doc = await func.utils.DOCS_OBJ.get(
33209
- SESSION_ID,
33210
- panel_val._ds.prog_id
33211
- );
33083
+ for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
33084
+ const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, panel_val._ds.prog_id);
33212
33085
 
33213
- await iterate_field_in_progUi(prog_doc.progUi, field_id)
33086
+ await iterate_field_in_progUi(prog_doc.progUi, field_id);
33214
33087
  }
33215
33088
  }
33216
33089
 
33217
33090
  // }
33218
33091
 
33219
-
33220
-
33221
33092
  func.events.delete_job(SESSION_ID, jobNoP);
33222
-
33223
33093
  };
33224
33094
 
33225
-
33226
- func.UI.screen.refresh_screen = async function (
33227
- SESSION_ID,
33228
- fields_changed_arr,
33229
- datasource_changed,
33230
- fields_changed_datasource
33231
- ) {
33232
- const $elm = func.UI.utils.find_in_element_data(
33233
- "xuPanelData",
33234
- $(SESSION_OBJ[SESSION_ID].root_element),
33235
- "parent_element_ui_id"
33236
- );
33095
+ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
33096
+ const $elm = func.UI.utils.find_in_element_data('xuPanelData', $(SESSION_OBJ[SESSION_ID].root_element), 'parent_element_ui_id');
33237
33097
  // var panels_obj = {};
33238
- const panels_obj = func.UI.utils.get_panels_from_dom(SESSION_ID, false)
33098
+ const panels_obj = func.UI.utils.get_panels_from_dom(SESSION_ID, false);
33239
33099
 
33240
33100
  const find_field_in_progUi = function (progUi, field_id) {
33241
- let found
33101
+ let found;
33242
33102
  const iterate_progUi = function (node) {
33243
33103
  for (let item of node) {
33244
33104
  // if (item.tagName === "xu-panel") {
33245
33105
  if (!_.isEmpty(item.attributes)) {
33246
33106
  for (const [attr, val] of Object.entries(item.attributes)) {
33247
33107
  // if (attr === "xu-exp:program" || attr === "xu-exp:xu-for") {
33248
- if (attr === "xu-exp:program") {
33249
- found = val.includes("@" + field_id)
33108
+ if (attr === 'xu-exp:program') {
33109
+ found = val.includes('@' + field_id);
33250
33110
  }
33251
33111
  }
33252
33112
  }
33253
- if (found) break
33113
+ if (found) break;
33254
33114
  // }
33255
33115
  if (item.children) {
33256
33116
  iterate_progUi(item.children);
33257
33117
  }
33258
33118
  }
33259
- }
33260
- iterate_progUi(progUi)
33261
- return found
33262
- }
33119
+ };
33120
+ iterate_progUi(progUi);
33121
+ return found;
33122
+ };
33263
33123
 
33264
33124
  // // set panels_obj
33265
33125
  // for await (const [elem_key, elem_val] of Object.entries($elm)) {
@@ -33289,13 +33149,8 @@ func.UI.screen.refresh_screen = async function (
33289
33149
  // panels_obj[parent_element_ui_id].ids.push($div.attr("xu-ui-id"));
33290
33150
  // }
33291
33151
 
33292
- for await (const [parent_element_ui_id, panel_val] of Object.entries(
33293
- panels_obj
33294
- )) {
33295
- const prog_doc = await func.utils.DOCS_OBJ.get(
33296
- SESSION_ID,
33297
- panel_val._ds.prog_id
33298
- );
33152
+ for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
33153
+ const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, panel_val._ds.prog_id);
33299
33154
  const progDataSource_str = JSON.stringify(prog_doc.progDataSource);
33300
33155
  // const progUi_str = JSON.stringify(prog_doc.progUi);
33301
33156
 
@@ -33303,58 +33158,48 @@ func.UI.screen.refresh_screen = async function (
33303
33158
 
33304
33159
  var found;
33305
33160
  if (fields_changed_arr) {
33306
- if (
33307
- fields_changed_datasource &&
33308
- panel_val._ds.dsSession < fields_changed_datasource
33309
- ) {
33161
+ if (fields_changed_datasource && panel_val._ds.dsSession < fields_changed_datasource) {
33310
33162
  continue;
33311
33163
  }
33312
33164
  for (const field_id of fields_changed_arr) {
33313
-
33314
33165
  // get panel attributes
33315
- const _attributes =
33316
- panel_val?.$div?.data()?.xuPanelData?.node?.attributes || {};
33166
+ const _attributes = panel_val?.$div?.data()?.xuPanelData?.node?.attributes || {};
33317
33167
 
33318
33168
  // detect if program changed
33319
- found = _attributes["xu-exp:program"]?.includes("@" + field_id);
33169
+ found = _attributes['xu-exp:program']?.includes('@' + field_id);
33320
33170
  if (found) break;
33321
33171
 
33322
-
33323
-
33324
-
33325
33172
  // _attributes holds also info of parameters in code_in: @code
33326
33173
  // search field changed in panel call send parameters exp
33327
33174
  for (const [attr, value] of Object.entries(_attributes)) {
33328
-
33329
33175
  const pattern = /xu-exp:(\w+)/;
33330
33176
  const match = attr.match(pattern);
33331
33177
  // if (!match && value !== "@" + field_id) {
33332
33178
  if (!match) {
33333
33179
  // continue if attribute is not expression
33334
- continue
33180
+ continue;
33335
33181
  }
33336
33182
  // code_in
33337
33183
  const parameter_in_field_id = match?.[1];
33338
33184
  // @code
33339
33185
  if (value.includes(field_id)) {
33340
- // search parameter in field in the target program's progDataSource
33341
- found = progDataSource_str?.includes("@" + parameter_in_field_id);
33342
- if (found) break
33186
+ // search parameter in field in the target program's progDataSource
33187
+ found = progDataSource_str?.includes('@' + parameter_in_field_id);
33188
+ if (found) break;
33343
33189
 
33344
33190
  // found = progUi_str?.includes("@" + parameter_in_field_id);
33345
33191
  // if (found) return false;
33346
33192
 
33347
33193
  // found = find_field_in_progUi(prog_doc.progUi, parameter_in_field_id)
33348
33194
  // if (found) break
33349
-
33350
33195
  }
33351
33196
  }
33352
33197
 
33353
- if (found) break
33198
+ if (found) break;
33354
33199
 
33355
33200
  // search field changed in the target program's progDataSource // @code
33356
- found = progDataSource_str?.includes("@" + field_id);
33357
- if (found) break
33201
+ found = progDataSource_str?.includes('@' + field_id);
33202
+ if (found) break;
33358
33203
 
33359
33204
  // found = progUi_str?.includes("@" + field_id);
33360
33205
  // if (found) return false;
@@ -33382,20 +33227,7 @@ func.UI.screen.refresh_screen = async function (
33382
33227
  // const old_ds = $($org_panel).data().xuData.paramsP.dsSessionP;
33383
33228
  // func.datasource.del(SESSION_ID, old_ds);
33384
33229
 
33385
- const new_$div = await func.UI.screen.render_ui_tree(
33386
- SESSION_ID,
33387
- $div_elm,
33388
- _.cloneDeep(panel_val.$div.data().xuPanelData.node),
33389
- {},
33390
- $div_elm.data().xuData.paramsP,
33391
- null,
33392
- null,
33393
- $div_elm.data().xuData.key,
33394
- null,
33395
- $div_elm.data().xuData.parent_node,
33396
- null,
33397
- $div_elm.data().xuData.$root_container
33398
- );
33230
+ 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);
33399
33231
  // const new_$div = await func.UI.screen.render_ui_tree(
33400
33232
  // SESSION_ID,
33401
33233
  // $div_elm,
@@ -33422,11 +33254,7 @@ func.UI.screen.refresh_screen = async function (
33422
33254
  }
33423
33255
  };
33424
33256
 
33425
- const get_params_obj = async function (
33426
- SESSION_ID,
33427
- prog_id,
33428
- parameters_obj_inP
33429
- ) {
33257
+ const get_params_obj = async function (SESSION_ID, prog_id, parameters_obj_inP) {
33430
33258
  const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);
33431
33259
  if (!_prog) {
33432
33260
  return;
@@ -33435,66 +33263,42 @@ const get_params_obj = async function (
33435
33263
  // get in parameters
33436
33264
  var params_obj = {};
33437
33265
  if (_prog?.properties?.progParams) {
33438
- for await (const [key, val] of Object.entries(
33439
- _prog.properties.progParams
33440
- )) {
33441
- if (!val.data.dir === "in") continue;
33442
- if (typeof parameters_obj_inP?.[val.data.parameter] !== "undefined") {
33266
+ for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
33267
+ if (!val.data.dir === 'in') continue;
33268
+ if (typeof parameters_obj_inP?.[val.data.parameter] !== 'undefined') {
33443
33269
  if (parameters_obj_inP?.[val.data.parameter].fx) {
33444
- let ret = await func.expression.get(
33445
- SESSION_ID,
33446
- parameters_obj_inP?.[val.data.parameter].fx,
33447
- dsSession,
33448
- "parameters"
33449
- );
33270
+ let ret = await func.expression.get(SESSION_ID, parameters_obj_inP?.[val.data.parameter].fx, dsSession, 'parameters');
33450
33271
  params_obj[val.data.parameter] = ret.result;
33451
33272
  } else {
33452
- params_obj[val.data.parameter] =
33453
- parameters_obj_inP?.[val.data.parameter].value;
33273
+ params_obj[val.data.parameter] = parameters_obj_inP?.[val.data.parameter].value;
33454
33274
  }
33455
33275
  continue;
33456
33276
  }
33457
- console.warn(
33458
- `Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`
33459
- );
33277
+ console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
33460
33278
  }
33461
33279
  }
33462
33280
  return params_obj;
33463
33281
  };
33464
- const get_params_obj_new = async function (
33465
- SESSION_ID,
33466
- prog_id,
33467
- nodeP,
33468
- dsSession
33469
- ) {
33282
+ const get_params_obj_new = async function (SESSION_ID, prog_id, nodeP, dsSession) {
33470
33283
  const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);
33471
33284
  if (!_prog) return;
33472
33285
 
33473
33286
  // get in parameters
33474
33287
  var params_obj = {};
33475
33288
  if (_prog?.properties?.progParams) {
33476
- for await (const [key, val] of Object.entries(
33477
- _prog.properties.progParams
33478
- )) {
33479
- if (!["in", "out"].includes(val.data.dir)) continue;
33289
+ for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
33290
+ if (!['in', 'out'].includes(val.data.dir)) continue;
33480
33291
 
33481
33292
  if (nodeP.attributes) {
33482
33293
  if (nodeP.attributes[val.data.parameter]) {
33483
33294
  params_obj[val.data.parameter] = nodeP.attributes[val.data.parameter];
33484
33295
  } else if (nodeP.attributes[`xu-exp:${val.data.parameter}`]) {
33485
- if (val.data.dir == "out") {
33296
+ if (val.data.dir == 'out') {
33486
33297
  // only reference
33487
- params_obj[val.data.parameter] = nodeP.attributes[
33488
- `xu-exp:${val.data.parameter}`
33489
- ].replaceAll("@", "");
33298
+ params_obj[val.data.parameter] = nodeP.attributes[`xu-exp:${val.data.parameter}`].replaceAll('@', '');
33490
33299
  } else {
33491
33300
  // in parameter
33492
- let ret = await func.expression.get(
33493
- SESSION_ID,
33494
- nodeP.attributes[`xu-exp:${val.data.parameter}`],
33495
- dsSession,
33496
- "parameters"
33497
- );
33301
+ let ret = await func.expression.get(SESSION_ID, nodeP.attributes[`xu-exp:${val.data.parameter}`], dsSession, 'parameters');
33498
33302
  params_obj[val.data.parameter] = ret.result;
33499
33303
  }
33500
33304
  }
@@ -33513,30 +33317,13 @@ const get_params_obj_new = async function (
33513
33317
  // }
33514
33318
  continue;
33515
33319
  }
33516
- console.warn(
33517
- `Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`
33518
- );
33320
+ console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
33519
33321
  }
33520
33322
  }
33521
33323
  return params_obj;
33522
33324
  };
33523
33325
 
33524
- func.UI.screen.execute_xu_functions = async function (
33525
- SESSION_ID,
33526
- is_skeleton,
33527
- $root_container,
33528
- nodeP,
33529
- $container,
33530
- paramsP,
33531
- parent_infoP,
33532
- jobNoP,
33533
- keyP,
33534
- parent_nodeP,
33535
- xu_func,
33536
- $elm,
33537
- val,
33538
- is_init
33539
- ) {
33326
+ 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) {
33540
33327
  if (is_skeleton) return;
33541
33328
 
33542
33329
  // console.log(nodeP.id, xu_func, val);
@@ -33550,25 +33337,8 @@ func.UI.screen.execute_xu_functions = async function (
33550
33337
  const init_program = async function () {
33551
33338
  async function render_panel() {
33552
33339
  const prog_id = val.value?.prog || val.value;
33553
- const param_obj = await get_params_obj_new(
33554
- SESSION_ID,
33555
- prog_id,
33556
- nodeP,
33557
- paramsP.dsSessionP
33558
- );
33559
- let ret_panel = await func.UI.screen.init(
33560
- SESSION_ID,
33561
- prog_id,
33562
- paramsP.screenId,
33563
- _ds,
33564
- $elm,
33565
- null,
33566
- _ds.currentRecordId,
33567
- null,
33568
- true,
33569
- param_obj,
33570
- "initXu_panel"
33571
- );
33340
+ const param_obj = await get_params_obj_new(SESSION_ID, prog_id, nodeP, paramsP.dsSessionP);
33341
+ 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');
33572
33342
  ret = { $new_div: ret_panel };
33573
33343
  return ret;
33574
33344
  }
@@ -33579,7 +33349,7 @@ func.UI.screen.execute_xu_functions = async function (
33579
33349
  // }
33580
33350
  if (!val.value) {
33581
33351
  // return render_empty_panel();
33582
- val.value = "_empty_panel_program";
33352
+ val.value = '_empty_panel_program';
33583
33353
  // return { abort: true, program_null: true };
33584
33354
  }
33585
33355
 
@@ -33622,55 +33392,15 @@ func.UI.screen.execute_xu_functions = async function (
33622
33392
  // // func.events.delete_job(SESSION_ID, jobNo);
33623
33393
  // };
33624
33394
  const program = val.value?.prog || val.value;
33625
- var $wrapper = $("<div>");
33626
- var $div = func.UI.screen.create_container(
33627
- SESSION_ID,
33628
- $root_container,
33629
- nodeP,
33630
- $container,
33631
- paramsP,
33632
- parent_infoP,
33633
- jobNoP,
33634
- keyP,
33635
- parent_nodeP,
33636
- nodeP.attributes,
33637
- null,
33638
- null,
33639
- null,
33640
- $wrapper,
33641
- ""
33642
- );
33643
- const param_obj = await get_params_obj_new(
33644
- SESSION_ID,
33645
- program,
33646
- nodeP,
33647
- paramsP.dsSessionP
33648
- );
33649
- let ret_init = await func.UI.screen.init(
33650
- SESSION_ID,
33651
- program,
33652
- paramsP.screenId,
33653
- _ds,
33654
- $div,
33655
- null,
33656
- _ds.currentRecordId,
33657
- jobNoP,
33658
- true,
33659
- param_obj,
33660
- "alterXu_panel"
33661
- );
33395
+ var $wrapper = $('<div>');
33396
+ 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, '');
33397
+ const param_obj = await get_params_obj_new(SESSION_ID, program, nodeP, paramsP.dsSessionP);
33398
+ let ret_init = await func.UI.screen.init(SESSION_ID, program, paramsP.screenId, _ds, $div, null, _ds.currentRecordId, jobNoP, true, param_obj, 'alterXu_panel');
33662
33399
  ret = {
33663
33400
  $new_div: ret_init,
33664
33401
  abort: true,
33665
33402
  };
33666
- await func.UI.screen.panel_post_render_handler(
33667
- SESSION_ID,
33668
- $elm,
33669
- $new_div,
33670
- nodeP,
33671
- $div.clone(true),
33672
- jobNoP
33673
- );
33403
+ await func.UI.screen.panel_post_render_handler(SESSION_ID, $elm, $new_div, nodeP, $div.clone(true), jobNoP);
33674
33404
 
33675
33405
  return ret;
33676
33406
  }
@@ -33688,8 +33418,8 @@ func.UI.screen.execute_xu_functions = async function (
33688
33418
  return alter_program();
33689
33419
  },
33690
33420
  // programParameters: async function ($elm, val) {},
33691
- "xu-render": async function ($elm, val) {
33692
- let ret = await common_fx["xu-render"]($elm, val);
33421
+ 'xu-render': async function ($elm, val) {
33422
+ let ret = await common_fx['xu-render']($elm, val);
33693
33423
  return ret;
33694
33424
  },
33695
33425
  },
@@ -33698,22 +33428,22 @@ func.UI.screen.execute_xu_functions = async function (
33698
33428
  const load_cdn = async function (resource) {
33699
33429
  // console.log("loading cdn", resource);
33700
33430
  if (!_.isObject(resource) && _.isString(resource)) {
33701
- resource = { src: resource, type: "js" };
33431
+ resource = { src: resource, type: 'js' };
33702
33432
  }
33703
33433
  if (!_.isObject(resource)) {
33704
- throw new Error("cdn resource in wrong format");
33434
+ throw new Error('cdn resource in wrong format');
33705
33435
  }
33706
33436
  return new Promise(async (resolve) => {
33707
33437
  try {
33708
33438
  switch (resource.type) {
33709
- case "js":
33439
+ case 'js':
33710
33440
  await func.utils.load_js_on_demand(resource.src);
33711
33441
  break;
33712
- case "css":
33442
+ case 'css':
33713
33443
  await func.utils.load_js_on_demand(resource.src);
33714
33444
  break;
33715
- case "module":
33716
- func.utils.load_js_on_demand(resource.src, "module");
33445
+ case 'module':
33446
+ func.utils.load_js_on_demand(resource.src, 'module');
33717
33447
  break;
33718
33448
 
33719
33449
  default:
@@ -33722,12 +33452,7 @@ func.UI.screen.execute_xu_functions = async function (
33722
33452
  }
33723
33453
  resolve();
33724
33454
  } catch (error) {
33725
- func.utils.debug_report(
33726
- SESSION_ID,
33727
- "xu-cdn",
33728
- "Fail to load: " + resource,
33729
- "W"
33730
- );
33455
+ func.utils.debug_report(SESSION_ID, 'xu-cdn', 'Fail to load: ' + resource, 'W');
33731
33456
  resolve();
33732
33457
  }
33733
33458
 
@@ -33754,38 +33479,34 @@ func.UI.screen.execute_xu_functions = async function (
33754
33479
  };
33755
33480
 
33756
33481
  const common_fx = {
33757
- "xu-bind": async function ($elm, val) {
33482
+ 'xu-bind': async function ($elm, val) {
33758
33483
  if (is_skeleton) return;
33759
33484
 
33760
33485
  // let view_field_id = val.value;
33761
- let val_is_reference_field = false
33486
+ let val_is_reference_field = false;
33762
33487
 
33763
33488
  let _prog_id = $elm.data().xuData.paramsP.prog_id;
33764
33489
  let _dsP = $elm.data().xuData.paramsP.dsSessionP;
33765
33490
  const view_ret = await func.utils.VIEWS_OBJ.get(SESSION_ID, _prog_id);
33766
33491
  if (!view_ret) return {};
33767
33492
 
33768
- let is_dynamic_field = false
33493
+ let is_dynamic_field = false;
33769
33494
  let field_prop;
33770
33495
  let bind_field_id;
33771
- let bind_field_exp
33496
+ let bind_field_exp;
33772
33497
 
33773
33498
  const get_bind_field = async function (field_id) {
33774
- if (["_FOR_VAL", "_FOR_KEY"].includes(field_id)) {
33775
- is_dynamic_field = true
33776
- field_prop = _ds.dynamic_fields[field_id]
33499
+ if (['_FOR_VAL', '_FOR_KEY'].includes(field_id)) {
33500
+ is_dynamic_field = true;
33501
+ field_prop = _ds.dynamic_fields[field_id];
33777
33502
  } else {
33778
- field_prop = func.common.find_item_by_key(
33779
- view_ret.progFields,
33780
- "field_id",
33781
- field_id
33782
- );
33503
+ field_prop = func.common.find_item_by_key(view_ret.progFields, 'field_id', field_id);
33783
33504
  if (!field_prop) {
33784
33505
  /// find the field everywhere in the chain Aug 30 2024
33785
33506
  const ret_get_value = await func.datasource.get_value(
33786
33507
  SESSION_ID,
33787
33508
  field_id,
33788
- _dsP // $elm.data().xuData.paramsP.dsSessionP
33509
+ _dsP, // $elm.data().xuData.paramsP.dsSessionP
33789
33510
  );
33790
33511
 
33791
33512
  if (ret_get_value.found) {
@@ -33794,44 +33515,33 @@ func.UI.screen.execute_xu_functions = async function (
33794
33515
  _prog_id = _ds.prog_id;
33795
33516
  const view_ret = await func.utils.VIEWS_OBJ.get(SESSION_ID, _prog_id);
33796
33517
  if (!view_ret) return {};
33797
- field_prop = func.common.find_item_by_key(
33798
- view_ret.progFields,
33799
- "field_id",
33800
- field_id
33801
- );
33518
+ field_prop = func.common.find_item_by_key(view_ret.progFields, 'field_id', field_id);
33802
33519
  }
33803
33520
  if (!field_prop) {
33804
- throw (`field ${field_id} not found in the program scope`)
33521
+ throw `field ${field_id} not found in the program scope`;
33805
33522
  }
33806
33523
  }
33807
33524
  }
33808
- return field_id
33809
- }
33525
+ return field_id;
33526
+ };
33810
33527
 
33811
33528
  try {
33812
- bind_field_id = await get_bind_field(val.value)
33813
- val_is_reference_field = true
33529
+ bind_field_id = await get_bind_field(val.value);
33530
+ val_is_reference_field = true;
33814
33531
  } catch (err) {
33815
33532
  try {
33816
- if (!_.isEmpty($elm?.data()?.xuAttributes?.["xu-exp:xu-bind"])) {
33817
- bind_field_exp = $elm.data().xuAttributes["xu-exp:xu-bind"]
33818
- const res = (
33819
- await func.expression.get(
33820
- SESSION_ID,
33821
- bind_field_exp,
33822
- paramsP.dsSessionP,
33823
- "UI Attr EXP"
33824
- )
33825
- )
33533
+ if (!_.isEmpty($elm?.data()?.xuAttributes?.['xu-exp:xu-bind'])) {
33534
+ bind_field_exp = $elm.data().xuAttributes['xu-exp:xu-bind'];
33535
+ const res = await func.expression.get(SESSION_ID, bind_field_exp, paramsP.dsSessionP, 'UI Attr EXP');
33826
33536
 
33827
33537
  if (Object.keys(res.fields).length) {
33828
- const field_id_from_exp = Object.keys(res.fields)[0]
33829
- bind_field_id = await get_bind_field(field_id_from_exp)
33538
+ const field_id_from_exp = Object.keys(res.fields)[0];
33539
+ bind_field_id = await get_bind_field(field_id_from_exp);
33830
33540
  } else {
33831
- throw (err.message)
33541
+ throw err.message;
33832
33542
  }
33833
33543
  } else {
33834
- throw (err.message)
33544
+ throw err.message;
33835
33545
  }
33836
33546
  } catch (err) {
33837
33547
  console.error(err.message);
@@ -33840,20 +33550,12 @@ func.UI.screen.execute_xu_functions = async function (
33840
33550
  // return {};
33841
33551
  }
33842
33552
 
33843
-
33844
33553
  const field_changed = async function (e) {
33845
-
33846
33554
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_dsP];
33847
- var value = await func.common.get_cast_val(
33848
- SESSION_ID,
33849
- "xu-bind",
33850
- "value",
33851
- field_prop.props.fieldType,
33852
- bind.getter($elm[0])
33853
- );
33555
+ var value = await func.common.get_cast_val(SESSION_ID, 'xu-bind', 'value', field_prop.props.fieldType, bind.getter($elm[0]));
33854
33556
 
33855
- if (field_prop.props.fieldType === "object" && !val_is_reference_field) {
33856
- value = bind.getter($elm[0])
33557
+ if (field_prop.props.fieldType === 'object' && !val_is_reference_field) {
33558
+ value = bind.getter($elm[0]);
33857
33559
  }
33858
33560
 
33859
33561
  if (!_ds.currentRecordId) return;
@@ -33867,22 +33569,22 @@ func.UI.screen.execute_xu_functions = async function (
33867
33569
  };
33868
33570
 
33869
33571
  await func.datasource.update(SESSION_ID, datasource_changes);
33870
- const iterate_info = $elm?.data()?.xuData?.iterate_info
33871
- const reference_source_obj = iterate_info?.reference_source_obj
33572
+ const iterate_info = $elm?.data()?.xuData?.iterate_info;
33573
+ const reference_source_obj = iterate_info?.reference_source_obj;
33872
33574
  if (reference_source_obj) {
33873
- if (reference_source_obj.ret.type === "array") {
33575
+ if (reference_source_obj.ret.type === 'array') {
33874
33576
  if (iterate_info.iterator_val === bind_field_id) {
33875
- const arr_idx = Number($elm?.data()?.xuData?.iterate_info._key)
33876
- let new_arr = reference_source_obj.ret.value
33877
- if (field_prop.props.fieldType === "object" && !val_is_reference_field) {
33878
- let obj_item = new_arr[arr_idx]
33879
- let e_exp = bind_field_exp.replace("@_FOR_VAL", "obj_item");
33880
- let new_val = eval(e_exp + `=${value}`)
33881
- new_arr[arr_idx] = obj_item
33577
+ const arr_idx = Number($elm?.data()?.xuData?.iterate_info._key);
33578
+ let new_arr = reference_source_obj.ret.value;
33579
+ if (field_prop.props.fieldType === 'object' && !val_is_reference_field) {
33580
+ let obj_item = new_arr[arr_idx];
33581
+ let e_exp = bind_field_exp.replace('@_FOR_VAL', 'obj_item');
33582
+ let new_val = eval(e_exp + `="${value}"`);
33583
+ new_arr[arr_idx] = obj_item;
33882
33584
  } else {
33883
- new_arr[arr_idx] = value
33585
+ new_arr[arr_idx] = value;
33884
33586
  }
33885
- datasource_changes[_dsP][_ds.currentRecordId][reference_source_obj.fieldIdP] = new_arr
33587
+ datasource_changes[_dsP][_ds.currentRecordId][reference_source_obj.fieldIdP] = new_arr;
33886
33588
 
33887
33589
  datasource_changes = {
33888
33590
  [_dsP]: {
@@ -33890,18 +33592,13 @@ func.UI.screen.execute_xu_functions = async function (
33890
33592
  [reference_source_obj.fieldIdP]: new_arr,
33891
33593
  },
33892
33594
  },
33893
- }
33595
+ };
33894
33596
  await func.datasource.update(SESSION_ID, datasource_changes, null, true);
33895
33597
  }
33896
33598
  }
33897
33599
  }
33898
33600
 
33899
-
33900
- await func.datasource.update_changes_for_out_parameter(
33901
- SESSION_ID,
33902
- _dsP,
33903
- _ds.parentDataSourceNo
33904
- );
33601
+ await func.datasource.update_changes_for_out_parameter(SESSION_ID, _dsP, _ds.parentDataSourceNo);
33905
33602
  };
33906
33603
 
33907
33604
  const bind = new UI_FRAMEWORK_PLUGIN.bind();
@@ -33909,10 +33606,9 @@ func.UI.screen.execute_xu_functions = async function (
33909
33606
  bind.listener($elm[0], field_changed);
33910
33607
 
33911
33608
  const set_value = function () {
33912
-
33913
33609
  let _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
33914
33610
  if (!_ds.currentRecordId) return;
33915
- let value
33611
+ let value;
33916
33612
  try {
33917
33613
  if (val_is_reference_field) {
33918
33614
  if (is_dynamic_field) {
@@ -33922,36 +33618,29 @@ func.UI.screen.execute_xu_functions = async function (
33922
33618
  value = _ds.data_feed.rows?.[row_idx]?.[val.value];
33923
33619
  }
33924
33620
  } else {
33925
- value = val.value
33621
+ value = val.value;
33926
33622
  }
33927
- if (typeof value === "undefined") return;
33623
+ if (typeof value === 'undefined') return;
33928
33624
  bind.setter($elm[0], value);
33929
33625
  } catch (err) {
33930
33626
  console.error(err);
33931
33627
  }
33932
-
33933
- }
33628
+ };
33934
33629
  /// init value from ds
33935
- $("body").on("xu-bind-refresh." + _ds.dsSession.toString(), () => {
33936
- set_value()
33630
+ $('body').on('xu-bind-refresh.' + _ds.dsSession.toString(), () => {
33631
+ set_value();
33937
33632
  });
33938
33633
  // $("body").trigger("xu-bind-refresh." + _ds.dsSession.toString());
33939
- set_value()
33634
+ set_value();
33940
33635
  return {};
33941
33636
  },
33942
- "xu-render": async function ($elm, val) {
33943
- var value = await func.common.get_cast_val(
33944
- SESSION_ID,
33945
- "common fx",
33946
- "xu-render",
33947
- "bool",
33948
- val.value
33949
- );
33637
+ 'xu-render': async function ($elm, val) {
33638
+ var value = await func.common.get_cast_val(SESSION_ID, 'common fx', 'xu-render', 'bool', val.value);
33950
33639
  const init_render = function () {
33951
33640
  if (!value) {
33952
33641
  var cloned_$div = $elm.clone(true);
33953
33642
 
33954
- let $xurender = $("<xurender>").appendTo($container).hide();
33643
+ let $xurender = $('<xurender>').appendTo($container).hide();
33955
33644
  let original_data_obj = {
33956
33645
  $container: cloned_$div,
33957
33646
  nodeP: _.cloneDeep(nodeP),
@@ -33961,7 +33650,7 @@ func.UI.screen.execute_xu_functions = async function (
33961
33650
  parent_nodeP,
33962
33651
  $root_container,
33963
33652
  };
33964
- $xurender.data("xuData", cloned_$div.data().xuData);
33653
+ $xurender.data('xuData', cloned_$div.data().xuData);
33965
33654
  $xurender.data().xuData.original_data_obj = original_data_obj;
33966
33655
  $xurender.data().xuData.xurender_node = cloned_$div;
33967
33656
  $xurender.data().xuAttributes = nodeP.attributes;
@@ -33993,7 +33682,7 @@ func.UI.screen.execute_xu_functions = async function (
33993
33682
  null,
33994
33683
  original_data_obj.parent_nodeP,
33995
33684
  null,
33996
- original_data_obj.$root_container
33685
+ original_data_obj.$root_container,
33997
33686
  );
33998
33687
 
33999
33688
  new_$div.data().xuData.original_data_obj = original_data_obj;
@@ -34004,25 +33693,12 @@ func.UI.screen.execute_xu_functions = async function (
34004
33693
  $elm.replaceWith(new_$div);
34005
33694
 
34006
33695
  if (val.fields_arr) {
34007
- return await func.UI.screen.refresh_xu_attributes(
34008
- SESSION_ID,
34009
- val.fields_arr,
34010
- val.jobNoP,
34011
- new_$div
34012
- );
33696
+ return await func.UI.screen.refresh_xu_attributes(SESSION_ID, val.fields_arr, val.jobNoP, new_$div);
34013
33697
  }
34014
33698
  func.events.delete_job(SESSION_ID, jobNoP);
34015
33699
  };
34016
33700
 
34017
- if (
34018
- $elm &&
34019
- func.UI.utils.find_in_element_data(
34020
- "xuData",
34021
- $(SESSION_OBJ[SESSION_ID].root_element),
34022
- "xu_id",
34023
- $elm.data().xuData.xu_id
34024
- ).length
34025
- ) {
33701
+ if ($elm && func.UI.utils.find_in_element_data('xuData', $(SESSION_OBJ[SESSION_ID].root_element), 'xu_id', $elm.data().xuData.xu_id).length) {
34026
33702
  if (new_$div.data().xuData.paramsP) {
34027
33703
  return await replace();
34028
33704
  }
@@ -34032,14 +33708,14 @@ func.UI.screen.execute_xu_functions = async function (
34032
33708
  return;
34033
33709
  }
34034
33710
  // if (!value) {
34035
- if ($elm.prop("tagName") === "XURENDER") {
33711
+ if ($elm.prop('tagName') === 'XURENDER') {
34036
33712
  func.events.delete_job(SESSION_ID, jobNoP);
34037
33713
  return;
34038
33714
  }
34039
33715
 
34040
- let tmp_$div = $("<div>");
33716
+ let tmp_$div = $('<div>');
34041
33717
 
34042
- let $xurender = $("<xurender>").appendTo(tmp_$div).hide();
33718
+ let $xurender = $('<xurender>').appendTo(tmp_$div).hide();
34043
33719
  // was true before
34044
33720
  if ($elm.data().xuData.xurender_node) {
34045
33721
  $xurender.data({
@@ -34069,14 +33745,8 @@ func.UI.screen.execute_xu_functions = async function (
34069
33745
  }
34070
33746
  return await post_render();
34071
33747
  },
34072
- "xu-show": async function ($elm, val) {
34073
- var value = await func.common.get_cast_val(
34074
- SESSION_ID,
34075
- "common fx",
34076
- "xu-show",
34077
- "bool",
34078
- val.value
34079
- );
33748
+ 'xu-show': async function ($elm, val) {
33749
+ var value = await func.common.get_cast_val(SESSION_ID, 'common fx', 'xu-show', 'bool', val.value);
34080
33750
  if (value) {
34081
33751
  $elm.show();
34082
33752
  }
@@ -34085,7 +33755,7 @@ func.UI.screen.execute_xu_functions = async function (
34085
33755
  }
34086
33756
  return {};
34087
33757
  },
34088
- "xu-content": async function ($elm, val) {
33758
+ 'xu-content': async function ($elm, val) {
34089
33759
  try {
34090
33760
  $elm.html(val.value);
34091
33761
  } catch (error) {
@@ -34094,7 +33764,7 @@ func.UI.screen.execute_xu_functions = async function (
34094
33764
 
34095
33765
  return {};
34096
33766
  },
34097
- "xu-for": async function ($elm, data) {
33767
+ 'xu-for': async function ($elm, data) {
34098
33768
  // exit if call from rendered xu-for item to prevent infante loop (parent_infoP?.iterate_info indicate call from rendered item)
34099
33769
  if (parent_infoP?.iterate_info) return {};
34100
33770
  if (!data.value) return {};
@@ -34103,107 +33773,76 @@ func.UI.screen.execute_xu_functions = async function (
34103
33773
  let arr = data.value;
34104
33774
 
34105
33775
  // find reference source field
34106
- let reference_source_obj
33776
+ let reference_source_obj;
34107
33777
 
34108
- const _progFields = await func.datasource.get_progFields(
34109
- SESSION_ID,
34110
- paramsP.dsSessionP
34111
- );
33778
+ const _progFields = await func.datasource.get_progFields(SESSION_ID, paramsP.dsSessionP);
34112
33779
 
34113
- let view_field_obj = func.common.find_item_by_key(
34114
- _progFields,
34115
- "field_id",
34116
- data.value
34117
- );
34118
- // detect if data.value (xu-for) is reference field_id by checking if exist in the dataset
33780
+ let view_field_obj = func.common.find_item_by_key(_progFields, 'field_id', data.value);
33781
+ // detect if data.value (xu-for) is reference field_id by checking if exist in the dataset
34119
33782
  if (view_field_obj) {
34120
33783
  // xu-for is reference field_id
34121
- reference_source_obj = await func.datasource.get_value(SESSION_ID, data.value, paramsP.dsSessionP)
34122
- arr = reference_source_obj?.ret?.value
33784
+ reference_source_obj = await func.datasource.get_value(SESSION_ID, data.value, paramsP.dsSessionP);
33785
+ arr = reference_source_obj?.ret?.value;
34123
33786
  } else {
34124
- // xu-for is actual data
34125
- if (typeof data.value === "string") {
34126
- arr = eval(data.value.replaceAll("\\", ""));
33787
+ // xu-for is actual data
33788
+ if (typeof data.value === 'string') {
33789
+ arr = eval(data.value.replaceAll('\\', ''));
34127
33790
  }
34128
- if (typeof arr === "number") {
33791
+ if (typeof arr === 'number') {
34129
33792
  arr = Array.from(Array(arr).keys());
34130
33793
  }
34131
33794
  }
34132
33795
 
34133
- const custom_iterator_key = $elm.data().xuData.iterator_key
34134
- const custom_iterator_val = $elm.data().xuData.iterator_val
33796
+ const custom_iterator_key = $elm.data().xuData.iterator_key;
33797
+ const custom_iterator_val = $elm.data().xuData.iterator_val;
34135
33798
 
34136
- let iterator_key = custom_iterator_key
34137
- let iterator_val = custom_iterator_val
34138
- let is_key_dynamic_field, is_val_dynamic_field
33799
+ let iterator_key = custom_iterator_key;
33800
+ let iterator_val = custom_iterator_val;
33801
+ let is_key_dynamic_field, is_val_dynamic_field;
34139
33802
 
34140
- // custom FOR_VAL name or namespaced default name
33803
+ // custom FOR_VAL name or namespaced default name
34141
33804
  if (!custom_iterator_key) {
34142
- is_key_dynamic_field = true
33805
+ is_key_dynamic_field = true;
34143
33806
 
34144
33807
  // iterator_key = $elm.data().xuData.node_org.id.replaceAll("-", "_") + "_FOR_KEY";
34145
- iterator_key = "_FOR_KEY";
33808
+ iterator_key = '_FOR_KEY';
34146
33809
  }
34147
33810
 
34148
33811
  if (!custom_iterator_val) {
34149
- is_val_dynamic_field = true
33812
+ is_val_dynamic_field = true;
34150
33813
 
34151
33814
  // iterator_val = $elm.data().xuData.node_org.id.replaceAll("-", "_") + "_FOR_VAL";
34152
- iterator_val = "_FOR_VAL";
33815
+ iterator_val = '_FOR_VAL';
34153
33816
  }
34154
33817
 
34155
33818
  var i = 0;
34156
33819
  for await (let [_key, _val] of Object.entries(arr)) {
34157
-
34158
- if (_.isArray(arr)) { _key = Number(_key) }
33820
+ if (_.isArray(arr)) {
33821
+ _key = Number(_key);
33822
+ }
34159
33823
 
34160
33824
  const set_value = async function (is_dynamic_field, currentRecordId, field_id, value) {
34161
-
34162
-
34163
33825
  if (is_dynamic_field) {
34164
-
34165
- func.datasource.add_dynamic_field_to_ds(
34166
- SESSION_ID,
34167
- paramsP.dsSessionP,
34168
- field_id,
34169
- value
34170
- );
34171
-
33826
+ func.datasource.add_dynamic_field_to_ds(SESSION_ID, paramsP.dsSessionP, field_id, value);
34172
33827
  } else {
33828
+ const _progFields = await func.datasource.get_progFields(SESSION_ID, paramsP.dsSessionP);
34173
33829
 
34174
- const _progFields = await func.datasource.get_progFields(
34175
- SESSION_ID,
34176
- paramsP.dsSessionP
34177
- );
34178
-
34179
- let view_field_obj = func.common.find_item_by_key(
34180
- _progFields,
34181
- "field_id",
34182
- field_id
34183
- );
33830
+ let view_field_obj = func.common.find_item_by_key(_progFields, 'field_id', field_id);
34184
33831
  if (view_field_obj) {
34185
33832
  let _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
34186
33833
  try {
34187
- const row_idx = func.common.find_ROWID_idx(
34188
- _ds,
34189
- currentRecordId
34190
- );
33834
+ const row_idx = func.common.find_ROWID_idx(_ds, currentRecordId);
34191
33835
  _ds.data_feed.rows[row_idx][field_id] = value;
34192
33836
  } catch (err) {
34193
33837
  console.error(err);
34194
33838
  }
34195
33839
  } else {
34196
- console.error("field not exist in dataset for xu-for method")
33840
+ console.error('field not exist in dataset for xu-for method');
34197
33841
  }
34198
33842
  }
34199
-
34200
-
34201
33843
  };
34202
33844
 
34203
- var currentRecordId =
34204
- SESSION_OBJ[SESSION_ID].DS_GLB[
34205
- paramsP.dsSessionP
34206
- ].currentRecordId.toString();
33845
+ var currentRecordId = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP].currentRecordId.toString();
34207
33846
 
34208
33847
  await set_value(is_key_dynamic_field, currentRecordId, iterator_key, _key);
34209
33848
  await set_value(is_val_dynamic_field, currentRecordId, iterator_val, _val);
@@ -34215,10 +33854,10 @@ func.UI.screen.execute_xu_functions = async function (
34215
33854
  iterator_val,
34216
33855
  is_key_dynamic_field,
34217
33856
  is_val_dynamic_field,
34218
- reference_source_obj
33857
+ reference_source_obj,
34219
33858
  };
34220
- let _parent_info = _.cloneDeep(parent_infoP) || {}
34221
- _parent_info.iterate_info = iterate_info
33859
+ let _parent_info = _.cloneDeep(parent_infoP) || {};
33860
+ _parent_info.iterate_info = iterate_info;
34222
33861
  // if (parent_infoP) {
34223
33862
  // _parent_info = iterate_info;
34224
33863
  // } else {
@@ -34230,7 +33869,7 @@ func.UI.screen.execute_xu_functions = async function (
34230
33869
  SESSION_ID,
34231
33870
  $container,
34232
33871
  nodeP,
34233
- _parent_info,//parent_infoP ? _.cloneDeep(_parent_info) : null,
33872
+ _parent_info, //parent_infoP ? _.cloneDeep(_parent_info) : null,
34234
33873
  paramsP,
34235
33874
  jobNoP,
34236
33875
  null,
@@ -34238,7 +33877,7 @@ func.UI.screen.execute_xu_functions = async function (
34238
33877
  null,
34239
33878
  nodeP,
34240
33879
  null,
34241
- $root_container
33880
+ $root_container,
34242
33881
  );
34243
33882
 
34244
33883
  $.each($divP.children(), function (key, val) {
@@ -34252,19 +33891,19 @@ func.UI.screen.execute_xu_functions = async function (
34252
33891
  $elm.remove();
34253
33892
  return { abort: true };
34254
33893
  } catch (e) {
34255
- console.error(" Iterator Arr parse error");
33894
+ console.error(' Iterator Arr parse error');
34256
33895
  return { abort: true };
34257
33896
  }
34258
33897
  },
34259
- "xu-for-key": async function ($elm, val) {
33898
+ 'xu-for-key': async function ($elm, val) {
34260
33899
  $elm.data().xuData.iterator_key = val.value;
34261
33900
  return {};
34262
33901
  },
34263
- "xu-for-val": async function ($elm, val) {
33902
+ 'xu-for-val': async function ($elm, val) {
34264
33903
  $elm.data().xuData.iterator_val = val.value;
34265
33904
  return {};
34266
33905
  },
34267
- "xu-class": async function ($elm, val) {
33906
+ 'xu-class': async function ($elm, val) {
34268
33907
  try {
34269
33908
  let obj = JSON.parse(val.value);
34270
33909
  for await (const [cla, cond] of Object.entries(obj)) {
@@ -34273,8 +33912,8 @@ func.UI.screen.execute_xu_functions = async function (
34273
33912
  SESSION_ID,
34274
33913
  cond,
34275
33914
  paramsP.dsSessionP,
34276
- "UI Attr EXP",
34277
- $elm.data().xuData.currentRecordId // SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP].currentRecordId
33915
+ 'UI Attr EXP',
33916
+ $elm.data().xuData.currentRecordId, // SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP].currentRecordId
34278
33917
  )
34279
33918
  ).result;
34280
33919
  if (res) {
@@ -34285,12 +33924,12 @@ func.UI.screen.execute_xu_functions = async function (
34285
33924
  }
34286
33925
  return {};
34287
33926
  } catch (e) {
34288
- console.warn("parse error:" + val.value);
33927
+ console.warn('parse error:' + val.value);
34289
33928
  return { abort: true };
34290
33929
  }
34291
33930
  },
34292
- "xu-exp": async function ($elm, val) {
34293
- let exp = val.value === null ? true : val.value
33931
+ 'xu-exp': async function ($elm, val) {
33932
+ let exp = val.value === null ? true : val.value;
34294
33933
  // if (val.value.includes("@_FOR_KEY")) {
34295
33934
  // exp = exp.replaceAll("@_FOR_KEY", "@" + $elm.data().xuData.iterate_info.iterator_key);
34296
33935
  // }
@@ -34299,15 +33938,7 @@ func.UI.screen.execute_xu_functions = async function (
34299
33938
  // exp = exp.replaceAll("@_FOR_VAL", "@" + $elm.data().xuData.iterate_info.iterator_val);
34300
33939
  // }
34301
33940
 
34302
-
34303
-
34304
- let exp_ret = await func.expression.get(
34305
- SESSION_ID,
34306
- exp,
34307
- paramsP.dsSessionP,
34308
- "UI Attr EXP",
34309
- SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP].currentRecordId
34310
- );
33941
+ let exp_ret = await func.expression.get(SESSION_ID, exp, paramsP.dsSessionP, 'UI Attr EXP', SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP].currentRecordId);
34311
33942
 
34312
33943
  let value = func.UI.screen.fix_val_defaults(val.key, exp_ret.result);
34313
33944
 
@@ -34316,7 +33947,7 @@ func.UI.screen.execute_xu_functions = async function (
34316
33947
  value,
34317
33948
  };
34318
33949
 
34319
- if (nodeP.tagName.substr(0, 3) === "xu-") {
33950
+ if (nodeP.tagName.substr(0, 3) === 'xu-') {
34320
33951
  if (tag_fx[nodeP.tagName][new_val.key]) {
34321
33952
  return await tag_fx[nodeP.tagName][new_val.key]($elm, new_val);
34322
33953
  }
@@ -34326,7 +33957,7 @@ func.UI.screen.execute_xu_functions = async function (
34326
33957
  $elm.data().xuData.debug_info.attribute_stat[new_val.key] = new_val.value;
34327
33958
 
34328
33959
  // IGNORE UNDEFINED or NULL ATTRIBUTES
34329
- if (typeof new_val.value === "undefined" || new_val.value === null) {
33960
+ if (typeof new_val.value === 'undefined' || new_val.value === null) {
34330
33961
  return {};
34331
33962
  }
34332
33963
 
@@ -34335,77 +33966,40 @@ func.UI.screen.execute_xu_functions = async function (
34335
33966
  return {};
34336
33967
  }
34337
33968
 
34338
- if (new_val.key.substr(0, 2) === "xu") {
33969
+ if (new_val.key.substr(0, 2) === 'xu') {
34339
33970
  return await common_fx[new_val.key]($elm, new_val);
34340
33971
  }
34341
33972
 
34342
- $elm.attr(new_val.key, ($elm.attr(new_val.key) || "") + new_val.value);
33973
+ $elm.attr(new_val.key, ($elm.attr(new_val.key) || '') + new_val.value);
34343
33974
  return {};
34344
33975
  },
34345
- "xu-on": async function ($elm, val) {
33976
+ 'xu-on': async function ($elm, val) {
34346
33977
  CLIENT_ACTIVITY_TS = Date.now();
34347
- const trigger = val.key.split("xu-on:")[1].toLowerCase();
33978
+ const trigger = val.key.split('xu-on:')[1].toLowerCase();
34348
33979
  $elm.on(trigger, async function (e) {
34349
- for await (const [key, val] of Object.entries(
34350
- $elm.data().xuAttributes["xu-on:" + e.type]
34351
- )) {
34352
- if (val.handler === "custom") {
33980
+ for await (const [key, val] of Object.entries($elm.data().xuAttributes['xu-on:' + e.type])) {
33981
+ if (val.handler === 'custom') {
34353
33982
  // do BL
34354
33983
  for await (const [key2, val2] of Object.entries(val.event)) {
34355
33984
  var cond = val2.data.enabled;
34356
33985
  if (val2.data.enabled && val2.props.condition) {
34357
- expCond = await func.expression.get(
34358
- SESSION_ID,
34359
- val2.props.condition,
34360
- paramsP.dsSessionP,
34361
- "condition",
34362
- paramsP.recordid
34363
- ); // execute expression
33986
+ expCond = await func.expression.get(SESSION_ID, val2.props.condition, paramsP.dsSessionP, 'condition', paramsP.recordid); // execute expression
34364
33987
  cond = expCond.result;
34365
33988
  }
34366
33989
  if (!cond) continue;
34367
- func.events.add_to_queue(
34368
- SESSION_ID,
34369
- "element event",
34370
- val2.id,
34371
- e.type,
34372
- val2.data.action,
34373
- val2.data.name,
34374
- null,
34375
- $elm.attr("xu-ui-id"),
34376
- null,
34377
- null,
34378
- null,
34379
- null,
34380
- null,
34381
- paramsP.dsSessionP,
34382
- null,
34383
- null,
34384
- null,
34385
- e.type,
34386
- val2.data.name,
34387
- null,
34388
- null,
34389
- val2,
34390
- null,
34391
- null,
34392
- null,
34393
- null,
34394
- null,
34395
- null
34396
- );
33990
+ 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);
34397
33991
  }
34398
33992
  }
34399
33993
  }
34400
33994
  });
34401
33995
  return {};
34402
33996
  },
34403
- "xu-script": async function ($elm, val) {
33997
+ 'xu-script': async function ($elm, val) {
34404
33998
  var checkExist = setInterval(function () {
34405
- if ($elm.is(":visible")) {
33999
+ if ($elm.is(':visible')) {
34406
34000
  try {
34407
- var res = eval("(" + val.value + ")");
34408
- if (typeof res === "function") {
34001
+ var res = eval('(' + val.value + ')');
34002
+ if (typeof res === 'function') {
34409
34003
  res($elm[0]);
34410
34004
  }
34411
34005
  } catch (e) {
@@ -34418,71 +34012,54 @@ func.UI.screen.execute_xu_functions = async function (
34418
34012
 
34419
34013
  return {};
34420
34014
  },
34421
- "xu-style-global": async function ($elm, val) {
34422
- $("head").append(`<style>${val.value}</style>`);
34015
+ 'xu-style-global': async function ($elm, val) {
34016
+ $('head').append(`<style>${val.value}</style>`);
34423
34017
  return {};
34424
34018
  },
34425
- "xu-style": async function ($elm, val) {
34019
+ 'xu-style': async function ($elm, val) {
34426
34020
  var cssString = val.value;
34427
34021
 
34428
34022
  var parser = new cssjs();
34429
34023
 
34430
34024
  var parsed = parser.parseCSS(cssString);
34431
- var xuUiId = `[xu-ui-id="${$elm.attr("xu-ui-id")}"]`;
34025
+ var xuUiId = `[xu-ui-id="${$elm.attr('xu-ui-id')}"]`;
34432
34026
 
34433
34027
  $.each(parsed, function (key, val) {
34434
- var selectors_arr = val.selector.split(",");
34028
+ var selectors_arr = val.selector.split(',');
34435
34029
 
34436
34030
  $.each(selectors_arr, function (key2, val2) {
34437
34031
  selectors_arr[key2] = `${xuUiId} ${val2}, ${xuUiId}${val2}`;
34438
34032
  // console.log(new_selector);
34439
34033
  });
34440
34034
 
34441
- val.selector = selectors_arr.join(",");
34035
+ val.selector = selectors_arr.join(',');
34442
34036
  // console.log(parsed);
34443
34037
  });
34444
34038
 
34445
34039
  var newCSSString = parser.getCSSForEditor(parsed);
34446
34040
 
34447
- $("head").append(`<style>${newCSSString}</style>`);
34041
+ $('head').append(`<style>${newCSSString}</style>`);
34448
34042
  return {};
34449
34043
  },
34450
- "xu-cdn": async function ($elm, val) {
34044
+ 'xu-cdn': async function ($elm, val) {
34451
34045
  for await (const [key, resource] of Object.entries(val.value)) {
34452
34046
  await load_cdn(resource);
34453
34047
  }
34454
34048
 
34455
34049
  return {};
34456
34050
  },
34457
- "xu-ui-plugin": async function ($elm, val) {
34051
+ 'xu-ui-plugin': async function ($elm, val) {
34458
34052
  var _session = SESSION_OBJ[SESSION_ID];
34459
34053
 
34460
34054
  for await (const [plugin_name, value] of Object.entries(val.value)) {
34461
- const _plugin =
34462
- APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
34463
- if (
34464
- _plugin?.installed &&
34465
- _plugin?.manifest?.["runtime.mjs"]?.exist &&
34466
- _plugin?.manifest?.["index.mjs"]?.exist &&
34467
- value.enabled
34468
- ) {
34469
- if (
34470
- _plugin?.manifest?.["runtime.mjs"].dist &&
34471
- _plugin?.manifest?.["runtime.mjs"]?.css
34472
- ) {
34473
- const plugin_runtime_css_url = await func.utils.get_plugin_npm_cdn(
34474
- SESSION_ID,
34475
- plugin_name,
34476
- "dist/runtime.css"
34477
- );
34055
+ const _plugin = APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
34056
+ if (_plugin?.installed && _plugin?.manifest?.['runtime.mjs']?.exist && _plugin?.manifest?.['index.mjs']?.exist && value.enabled) {
34057
+ if (_plugin?.manifest?.['runtime.mjs'].dist && _plugin?.manifest?.['runtime.mjs']?.css) {
34058
+ const plugin_runtime_css_url = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, 'dist/runtime.css');
34478
34059
  func.utils.load_css_on_demand(plugin_runtime_css_url);
34479
34060
  }
34480
34061
 
34481
- const plugin_index_src = await func.utils.get_plugin_npm_cdn(
34482
- SESSION_ID,
34483
- plugin_name,
34484
- `${_plugin.manifest["index.mjs"].dist ? "dist/" : ""}index.mjs`
34485
- );
34062
+ const plugin_index_src = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, `${_plugin.manifest['index.mjs'].dist ? 'dist/' : ''}index.mjs`);
34486
34063
 
34487
34064
  const plugin_index_resources = await import(plugin_index_src);
34488
34065
 
@@ -34491,45 +34068,29 @@ func.UI.screen.execute_xu_functions = async function (
34491
34068
  prop_val.value = value?.attributes?.[prop_name];
34492
34069
  }
34493
34070
 
34494
- const plugin_runtime_src = await func.utils.get_plugin_npm_cdn(
34495
- SESSION_ID,
34496
- plugin_name,
34497
- `${_plugin.manifest["runtime.mjs"].dist ? "dist/" : ""}runtime.mjs`
34498
- );
34071
+ const plugin_runtime_src = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, `${_plugin.manifest['runtime.mjs'].dist ? 'dist/' : ''}runtime.mjs`);
34499
34072
 
34500
34073
  const plugin_runtime_resources = await import(plugin_runtime_src);
34501
34074
 
34502
- if (
34503
- plugin_runtime_resources.cdn &&
34504
- typeof _.isArray(plugin_runtime_resources.cdn)
34505
- ) {
34075
+ if (plugin_runtime_resources.cdn && typeof _.isArray(plugin_runtime_resources.cdn)) {
34506
34076
  for await (const resource of plugin_runtime_resources.cdn) {
34507
34077
  await load_cdn(resource);
34508
34078
  }
34509
34079
  }
34510
34080
 
34511
34081
  if (plugin_runtime_resources.fn) {
34512
- await plugin_runtime_resources.fn(
34513
- plugin_name,
34514
- $elm?.[0],
34515
- properties
34516
- );
34082
+ await plugin_runtime_resources.fn(plugin_name, $elm?.[0], properties);
34517
34083
  }
34518
34084
  }
34519
34085
  }
34520
34086
 
34521
34087
  return {};
34522
34088
  },
34523
- "xu-store": async function ($elm, val) {
34089
+ 'xu-store': async function ($elm, val) {
34524
34090
  try {
34525
34091
  const fields_obj = JSON5.parse(val.value);
34526
34092
  for (const [field_id, value] of Object.entries(fields_obj)) {
34527
- func.datasource.add_dynamic_field_to_ds(
34528
- SESSION_ID,
34529
- paramsP.dsSessionP,
34530
- field_id,
34531
- value
34532
- );
34093
+ func.datasource.add_dynamic_field_to_ds(SESSION_ID, paramsP.dsSessionP, field_id, value);
34533
34094
  }
34534
34095
  } catch (err) {
34535
34096
  console.error(err);
@@ -34538,8 +34099,8 @@ func.UI.screen.execute_xu_functions = async function (
34538
34099
  },
34539
34100
  };
34540
34101
 
34541
- if (nodeP.tagName.substr(0, 3) === "xu-") {
34542
- if (xu_func === "xu-exp") {
34102
+ if (nodeP.tagName.substr(0, 3) === 'xu-') {
34103
+ if (xu_func === 'xu-exp') {
34543
34104
  return common_fx[xu_func]($elm, val);
34544
34105
  }
34545
34106
 
@@ -34557,7 +34118,7 @@ func.UI.screen.execute_xu_functions = async function (
34557
34118
  if (!$elm.data().xuData.debug_info.attribute_stat) {
34558
34119
  $elm.data().xuData.debug_info.attribute_stat = {};
34559
34120
  }
34560
- if (xu_func !== "xu-exp") {
34121
+ if (xu_func !== 'xu-exp') {
34561
34122
  $elm.data().xuData.debug_info.attribute_stat[xu_func] = val.value;
34562
34123
  }
34563
34124
  try {
@@ -34570,35 +34131,21 @@ func.UI.screen.execute_xu_functions = async function (
34570
34131
  func.UI.screen.fix_val_defaults = function (key, val) {
34571
34132
  var ret = val;
34572
34133
  if (
34573
- key === "xu-render" &&
34574
- (typeof val === "undefined" || val === null) //|| val === ""
34134
+ key === 'xu-render' &&
34135
+ (typeof val === 'undefined' || val === null) //|| val === ""
34575
34136
  ) {
34576
- ret = "Y"; // was ret = "N";
34137
+ ret = 'Y'; // was ret = "N";
34577
34138
  }
34578
34139
  if (
34579
- key === "xu-show" &&
34580
- (typeof val === "undefined" || val === null) //|| val === ""
34140
+ key === 'xu-show' &&
34141
+ (typeof val === 'undefined' || val === null) //|| val === ""
34581
34142
  ) {
34582
- ret = "Y";
34143
+ ret = 'Y';
34583
34144
  }
34584
34145
  return ret;
34585
34146
  };
34586
34147
 
34587
- func.UI.screen.set_attributes_new = async function (
34588
- SESSION_ID,
34589
- is_skeleton,
34590
- $root_container,
34591
- nodeP,
34592
- $container,
34593
- paramsP,
34594
- parent_infoP,
34595
- jobNoP,
34596
- keyP,
34597
- parent_nodeP,
34598
- $elm,
34599
- is_init,
34600
- execute_attributes = []
34601
- ) {
34148
+ 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 = []) {
34602
34149
  var done_exp = [];
34603
34150
 
34604
34151
  const _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
@@ -34609,36 +34156,26 @@ func.UI.screen.set_attributes_new = async function (
34609
34156
  const attr = `xu-exp:${attrib}`;
34610
34157
  // const attr = `xu-exp-${attrib}`;
34611
34158
  var value = nodeP.attributes[attr];
34612
- if (!value)
34613
- return func.UI.screen.fix_val_defaults(
34614
- attrib,
34615
- value || nodeP.attributes[attrib]
34616
- );
34159
+ if (!value) return func.UI.screen.fix_val_defaults(attrib, value || nodeP.attributes[attrib]);
34617
34160
 
34618
- var res = await func.expression.get(
34619
- SESSION_ID,
34620
- value,
34621
- paramsP.dsSessionP,
34622
- "UI Attr EXP",
34623
- _ds.currentRecordId
34624
- );
34161
+ var res = await func.expression.get(SESSION_ID, value, paramsP.dsSessionP, 'UI Attr EXP', _ds.currentRecordId);
34625
34162
  nodeP.attributes[attr] = value; //{ value: value, res: res };
34626
34163
  done_exp.push(attr);
34627
34164
  return func.UI.screen.fix_val_defaults(attrib, res.result);
34628
34165
  };
34629
34166
 
34630
34167
  var _ret = {};
34631
- if (nodeP.type !== "element" || !nodeP.attributes) return _ret;
34168
+ if (nodeP.type !== 'element' || !nodeP.attributes) return _ret;
34632
34169
 
34633
34170
  for (let [key, val] of Object.entries(nodeP.attributes)) {
34634
34171
  // REMOVE STATIC ATTRIBUTES IF EXP EXISTS to avoid dup
34635
- if (key.substring(0, 6) === "xu-exp") {
34172
+ if (key.substring(0, 6) === 'xu-exp') {
34636
34173
  if (_.isEmpty(val)) {
34637
34174
  delete nodeP.attributes[key];
34638
- continue
34175
+ continue;
34639
34176
  }
34640
- const clean_key = key.split(":")[1];
34641
- if (typeof nodeP.attributes[clean_key] !== "undefined") {
34177
+ const clean_key = key.split(':')[1];
34178
+ if (typeof nodeP.attributes[clean_key] !== 'undefined') {
34642
34179
  delete nodeP.attributes[clean_key];
34643
34180
  }
34644
34181
  }
@@ -34646,13 +34183,13 @@ func.UI.screen.set_attributes_new = async function (
34646
34183
  if (glb.attr_abbreviations_arr.includes(key)) {
34647
34184
  nodeP.attributes[`xu-on:${key.substring(3)}`] = [
34648
34185
  {
34649
- handler: "custom",
34186
+ handler: 'custom',
34650
34187
  props: {},
34651
34188
  event: [
34652
34189
  {
34653
34190
  id: Date.now(),
34654
34191
  data: {
34655
- action: "update",
34192
+ action: 'update',
34656
34193
  name: { value: val },
34657
34194
  enabled: true,
34658
34195
  },
@@ -34670,7 +34207,7 @@ func.UI.screen.set_attributes_new = async function (
34670
34207
  val = func.UI.screen.fix_val_defaults(key, val);
34671
34208
 
34672
34209
  // REMOVE UNDEFINED or NULL ATTRIBUTES
34673
- if (typeof val === "undefined" || val === null) {
34210
+ if (typeof val === 'undefined' || val === null) {
34674
34211
  delete nodeP.attributes[key];
34675
34212
  }
34676
34213
 
@@ -34684,17 +34221,11 @@ func.UI.screen.set_attributes_new = async function (
34684
34221
 
34685
34222
  for await (const [key, attr] of Object.entries(glb.run_xu_before)) {
34686
34223
  if (_ret.abort) break;
34687
- if (
34688
- glb.html5_events_handler.includes(attr) ||
34689
- execute_attributes.includes(attr)
34690
- ) {
34224
+ if (glb.html5_events_handler.includes(attr) || execute_attributes.includes(attr)) {
34691
34225
  continue;
34692
34226
  }
34693
34227
 
34694
- if (
34695
- !nodeP.attributes ||
34696
- !nodeP.attributes[attr] & !nodeP.attributes[`xu-exp:${attr}`]
34697
- ) {
34228
+ if (!nodeP.attributes || !nodeP.attributes[attr] & !nodeP.attributes[`xu-exp:${attr}`]) {
34698
34229
  continue;
34699
34230
  }
34700
34231
 
@@ -34716,7 +34247,7 @@ func.UI.screen.set_attributes_new = async function (
34716
34247
  // value: _value,
34717
34248
  value: (await get_xuExp(attr)) || nodeP.attributes[attr],
34718
34249
  },
34719
- is_init
34250
+ is_init,
34720
34251
  );
34721
34252
  _ret = _.assignIn(_ret, ret);
34722
34253
  }
@@ -34726,17 +34257,14 @@ func.UI.screen.set_attributes_new = async function (
34726
34257
  // let svg_attributes_str = ""
34727
34258
  for await (const [key, val] of Object.entries(nodeP.attributes)) {
34728
34259
  if (_ret.abort) break;
34729
- if (
34730
- glb.html5_events_handler.includes(key) ||
34731
- execute_attributes.includes(key)
34732
- ) {
34260
+ if (glb.html5_events_handler.includes(key) || execute_attributes.includes(key)) {
34733
34261
  continue;
34734
34262
  }
34735
34263
 
34736
- const new_key = key.split(":")[0]; // break expression
34264
+ const new_key = key.split(':')[0]; // break expression
34737
34265
  if (
34738
- nodeP.tagName !== "xu-panel" && // nodeP.tagName.substr(0, 3) !== "xu-" &&
34739
- (new_key.substr(0, 2) !== "xu" || new_key.substr(2, 1) !== "-")
34266
+ nodeP.tagName !== 'xu-panel' && // nodeP.tagName.substr(0, 3) !== "xu-" &&
34267
+ (new_key.substr(0, 2) !== 'xu' || new_key.substr(2, 1) !== '-')
34740
34268
  ) {
34741
34269
  // handle common html attributes
34742
34270
  try {
@@ -34744,7 +34272,7 @@ func.UI.screen.set_attributes_new = async function (
34744
34272
  // if (nodeP.tagName === "svg") {
34745
34273
  // svg_attributes_str += `${key}="${val}" `
34746
34274
  // } else {
34747
- $elm.get(0).setAttribute(key, val)
34275
+ $elm.get(0).setAttribute(key, val);
34748
34276
  // }
34749
34277
  } catch (err) {
34750
34278
  console.error(err.message);
@@ -34761,16 +34289,11 @@ func.UI.screen.set_attributes_new = async function (
34761
34289
  console.error(error);
34762
34290
  }
34763
34291
 
34764
- if (
34765
- new_key === "xu-exp" ||
34766
- nodeP.attributes["xu-exp:" + new_key] ||
34767
- glb.run_xu_before.includes(new_key) ||
34768
- glb.run_xu_after.includes(new_key)
34769
- ) {
34292
+ 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)) {
34770
34293
  continue;
34771
34294
  }
34772
34295
 
34773
- if (new_key === "xu-on") {
34296
+ if (new_key === 'xu-on') {
34774
34297
  let ret = await func.UI.screen.execute_xu_functions(
34775
34298
  SESSION_ID,
34776
34299
  is_skeleton,
@@ -34782,13 +34305,13 @@ func.UI.screen.set_attributes_new = async function (
34782
34305
  jobNoP,
34783
34306
  keyP,
34784
34307
  parent_nodeP,
34785
- "xu-on",
34308
+ 'xu-on',
34786
34309
  $elm,
34787
34310
  {
34788
34311
  key: key,
34789
34312
  value: (await get_xuExp(new_key)) || val,
34790
34313
  },
34791
- is_init
34314
+ is_init,
34792
34315
  );
34793
34316
  _ret = _.assignIn(_ret, ret);
34794
34317
  continue;
@@ -34811,7 +34334,7 @@ func.UI.screen.set_attributes_new = async function (
34811
34334
  key: key,
34812
34335
  value: (await get_xuExp(new_key)) || val,
34813
34336
  },
34814
- is_init
34337
+ is_init,
34815
34338
  );
34816
34339
 
34817
34340
  _ret = _.assignIn(_ret, ret);
@@ -34821,23 +34344,18 @@ func.UI.screen.set_attributes_new = async function (
34821
34344
  // console.log(svg_attributes_str);
34822
34345
  // }
34823
34346
 
34824
-
34825
34347
  // EXP for
34826
34348
 
34827
34349
  for await (const [key, val] of Object.entries(nodeP.attributes)) {
34828
34350
  if (_ret.abort) break;
34829
34351
 
34830
- const attr = key.split("xu-exp:")[1];
34352
+ const attr = key.split('xu-exp:')[1];
34831
34353
 
34832
34354
  if (!attr) {
34833
34355
  continue;
34834
34356
  }
34835
34357
 
34836
- if (
34837
- glb.html5_events_handler.includes(attr) ||
34838
- execute_attributes.includes(attr)
34839
- )
34840
- continue;
34358
+ if (glb.html5_events_handler.includes(attr) || execute_attributes.includes(attr)) continue;
34841
34359
 
34842
34360
  if (done_exp.includes(key)) {
34843
34361
  continue;
@@ -34853,13 +34371,13 @@ func.UI.screen.set_attributes_new = async function (
34853
34371
  jobNoP,
34854
34372
  keyP,
34855
34373
  parent_nodeP,
34856
- "xu-exp",
34374
+ 'xu-exp',
34857
34375
  $elm,
34858
34376
  {
34859
34377
  key: attr,
34860
34378
  value: val,
34861
34379
  },
34862
- true
34380
+ true,
34863
34381
  );
34864
34382
  _ret = _.assignIn(_ret, ret);
34865
34383
  }
@@ -34867,17 +34385,9 @@ func.UI.screen.set_attributes_new = async function (
34867
34385
  // AFTER
34868
34386
 
34869
34387
  for await (const [key, attr] of Object.entries(glb.run_xu_after)) {
34870
- if (
34871
- glb.html5_events_handler.includes(attr) ||
34872
- execute_attributes.includes(attr)
34873
- )
34874
- continue;
34388
+ if (glb.html5_events_handler.includes(attr) || execute_attributes.includes(attr)) continue;
34875
34389
 
34876
- if (
34877
- !nodeP.attributes ||
34878
- !nodeP.attributes[attr] & !nodeP.attributes[`xu-exp:${attr}`]
34879
- )
34880
- continue;
34390
+ if (!nodeP.attributes || !nodeP.attributes[attr] & !nodeP.attributes[`xu-exp:${attr}`]) continue;
34881
34391
 
34882
34392
  let ret = await func.UI.screen.execute_xu_functions(
34883
34393
  SESSION_ID,
@@ -34896,7 +34406,7 @@ func.UI.screen.set_attributes_new = async function (
34896
34406
  key: attr,
34897
34407
  value: (await get_xuExp(attr)) || nodeP.attributes[attr],
34898
34408
  },
34899
- is_init
34409
+ is_init,
34900
34410
  );
34901
34411
  _ret = _.assignIn(_ret, ret);
34902
34412
  }
@@ -34917,19 +34427,12 @@ func.UI.screen.panel_post_render_handler = async function (
34917
34427
  $wrapper, // the wrapper element contains the rendered panel elements e.g: xu-single-view
34918
34428
  nodeP, // the xu-panel node
34919
34429
  $panel_div, // the panel div
34920
- jobNoP
34430
+ jobNoP,
34921
34431
  ) {
34922
- const _container_ds =
34923
- SESSION_OBJ[SESSION_ID].DS_GLB[$container.data().xuData.paramsP.dsSessionP];
34924
- const _ds =
34925
- SESSION_OBJ[SESSION_ID].DS_GLB[$wrapper.data().xuData.paramsP.dsSessionP];
34432
+ const _container_ds = SESSION_OBJ[SESSION_ID].DS_GLB[$container.data().xuData.paramsP.dsSessionP];
34433
+ const _ds = SESSION_OBJ[SESSION_ID].DS_GLB[$wrapper.data().xuData.paramsP.dsSessionP];
34926
34434
  const find_old_panels_elements = function () {
34927
- return func.UI.utils.find_in_element_data(
34928
- "xuPanelData",
34929
- $container.parent(),
34930
- "xu-ui-id",
34931
- $container.data()?.xuPanelData?.xu_panel_xu_ui_id
34932
- );
34435
+ return func.UI.utils.find_in_element_data('xuPanelData', $container.parent(), 'xu-ui-id', $container.data()?.xuPanelData?.xu_panel_xu_ui_id);
34933
34436
  };
34934
34437
  var $old_panel_div = find_old_panels_elements();
34935
34438
  const set_xuPanelData_to_the_new_rendered_items = (_) => {
@@ -34937,12 +34440,9 @@ func.UI.screen.panel_post_render_handler = async function (
34937
34440
  if (!$(val).data().xuPanelData) {
34938
34441
  $(val).data().xuPanelData = {};
34939
34442
  }
34940
- $(val).data().xuPanelData.parent_element_ui_id = $old_panel_div?.length
34941
- ? $container.parent().data().xuData.ui_id
34942
- : $container.data().xuData.ui_id;
34443
+ $(val).data().xuPanelData.parent_element_ui_id = $old_panel_div?.length ? $container.parent().data().xuData.ui_id : $container.data().xuData.ui_id;
34943
34444
 
34944
- $(val).data().xuPanelData.xu_panel_xu_ui_id =
34945
- (nodeP.xu_tree_id || nodeP.id) + "-" + _container_ds?.currentRecordId;
34445
+ $(val).data().xuPanelData.xu_panel_xu_ui_id = (nodeP.xu_tree_id || nodeP.id) + '-' + _container_ds?.currentRecordId;
34946
34446
  $(val).data().xuPanelData.node = nodeP;
34947
34447
  $(val).data().xuPanelData.$panel_div = $panel_div.clone(true);
34948
34448
  });
@@ -34979,8 +34479,7 @@ func.UI.screen.panel_post_render_handler = async function (
34979
34479
  if (!$wrapper.data()?.xuData?.dsSession) return;
34980
34480
 
34981
34481
  if ($old_panel_div?.length) {
34982
- $container.parent().data().xuData.paramsP.dsSessionP =
34983
- _ds.parentDataSourceNo; // set the new ds when panel replaced
34482
+ $container.parent().data().xuData.paramsP.dsSessionP = _ds.parentDataSourceNo; // set the new ds when panel replaced
34984
34483
  } else {
34985
34484
  $container.data().xuData.paramsP.dsSessionP = _ds.parentDataSourceNo; // set the new ds when panel replaced
34986
34485
  }
@@ -34991,66 +34490,45 @@ func.UI.screen.panel_post_render_handler = async function (
34991
34490
  return jobNoP;
34992
34491
  };
34993
34492
 
34994
- func.UI.screen.create_container = function (
34995
- SESSION_ID,
34996
- $root_container,
34997
- nodeP,
34998
- $container,
34999
- paramsP,
35000
- parent_infoP,
35001
- jobNoP,
35002
- keyP,
35003
- parent_nodeP,
35004
- prop,
35005
- classP,
35006
- elem_propP,
35007
- div_typeP,
35008
- $appendToP,
35009
- attr_str
35010
- ) {
34493
+ 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) {
35011
34494
  const _paramsP = _.cloneDeep(paramsP);
35012
34495
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_paramsP.dsSessionP];
35013
34496
  var $appendTo = $container;
35014
34497
  if ($appendToP) $appendTo = $appendToP;
35015
34498
  if (!$appendTo || !$appendTo.length) return null; // screen closed or not exist abort build
35016
- var div = "div";
34499
+ var div = 'div';
35017
34500
  if (div_typeP) div = div_typeP;
35018
34501
  var items = [];
35019
34502
  if (nodeP.children)
35020
34503
  items = nodeP.children.map(function (val) {
35021
34504
  return val.xu_tree_id || val.id;
35022
34505
  });
35023
- var currentRecordId = _ds ? _ds.currentRecordId : "";
34506
+ var currentRecordId = _ds ? _ds.currentRecordId : '';
35024
34507
  var xu_id = (glb.screen_num++).toString();
35025
- xu_id = xu_id += "_" + currentRecordId;
34508
+ xu_id = xu_id += '_' + currentRecordId;
35026
34509
 
35027
34510
  try {
35028
-
35029
- const key_path = `${$container?.data()?.xuData?.key_path || "0"}-${keyP || "0"
35030
- }`;
35031
- const elem_key = `${nodeP.xu_tree_id || nodeP.id
35032
- }-${key_path}-${currentRecordId}`;
35033
- let ui_id = `${nodeP.xu_tree_id || nodeP.id}-${elem_key}-${_paramsP?.dsSessionP?.toString() || ""
35034
- }`;
34511
+ const key_path = `${$container?.data()?.xuData?.key_path || '0'}-${keyP || '0'}`;
34512
+ const elem_key = `${nodeP.xu_tree_id || nodeP.id}-${key_path}-${currentRecordId}`;
34513
+ let ui_id = `${nodeP.xu_tree_id || nodeP.id}-${elem_key}-${_paramsP?.dsSessionP?.toString() || ''}`;
35035
34514
 
35036
34515
  /////////////////////////////////
35037
34516
 
35038
- var $div
35039
- if (div === "svg") {
35040
-
34517
+ var $div;
34518
+ if (div === 'svg') {
35041
34519
  const draw_svg = function (element) {
35042
34520
  const get_tag_str = function (element, prop, val) {
35043
- let class_str = "";
35044
- let attr_str = "";
34521
+ let class_str = '';
34522
+ let attr_str = '';
35045
34523
  for (const [key, val] of Object.entries(prop)) {
35046
- if (key.substr(0, 2) !== "xu") {
34524
+ if (key.substr(0, 2) !== 'xu') {
35047
34525
  attr_str += ` ${key}="${val}" `;
35048
34526
  }
35049
34527
  }
35050
- if (element === "svg") {
34528
+ if (element === 'svg') {
35051
34529
  return `<${element} ${attr_str} > `;
35052
34530
  }
35053
- let ret = "";
34531
+ let ret = '';
35054
34532
  if (val?.children?.length) {
35055
34533
  ret = iterate_svg(val);
35056
34534
  }
@@ -35058,9 +34536,9 @@ func.UI.screen.create_container = function (
35058
34536
  return `<${element} ${class_str} ${attr_str} > ${ret} </${element}>`;
35059
34537
  };
35060
34538
  let svg_str = get_tag_str(element, prop);
35061
- let inner_str = "";
34539
+ let inner_str = '';
35062
34540
  const iterate_svg = function (node) {
35063
- let ret = "";
34541
+ let ret = '';
35064
34542
  if (node.children) {
35065
34543
  for (let val of node.children) {
35066
34544
  let prop = val.attributes;
@@ -35071,52 +34549,50 @@ func.UI.screen.create_container = function (
35071
34549
  };
35072
34550
  inner_str = iterate_svg(nodeP);
35073
34551
 
35074
- $div = $(svg_str + inner_str + "</svg>").appendTo($appendTo);
34552
+ $div = $(svg_str + inner_str + '</svg>').appendTo($appendTo);
35075
34553
  };
35076
34554
 
35077
34555
  draw_svg(div_typeP);
35078
34556
  } else {
35079
- $div = $(`<${div} ${attr_str ? attr_str : ""}>`)
34557
+ $div = $(`<${div} ${attr_str ? attr_str : ''}>`);
35080
34558
  }
35081
34559
  // const svgNS = "http://www.w3.org/2000/svg";
35082
34560
  // // $div = $(document.createElementNS(svgNS, "svg"));
35083
34561
  // $div = $(`<${div} ${attr_str ? attr_str : ""} ${svg_attributes_str}>`);
35084
34562
  // } else {
35085
34563
  // $div = $(`<${div} ${attr_str ? attr_str : ""}>`);
35086
- $div
35087
- .attr("xu-ui-id", ui_id)
35088
- .data({
35089
- xuData: {
35090
- prog_id: _paramsP.prog_id,
35091
- nodeid: nodeP.id,
35092
- ui_type: nodeP.tagName,
35093
- xu_id: xu_id,
35094
- recordid: currentRecordId,
35095
- paramsP: _paramsP,
35096
- key: keyP,
35097
- key_path, //:($container?.data()?.xuData?.key || "0") + "-" + (keyP || "0"),
35098
- screenId: _paramsP.screenId,
35099
- parent_container: $container?.attr("id"),
35100
- elem_key,
35101
- ui_id,
35102
- properties: prop,
35103
- node: nodeP,
35104
- node_org: _.cloneDeep(nodeP),
35105
- is_panelP: _paramsP.is_panelP,
35106
-
35107
- elem_prop: elem_propP,
35108
- debug_info: {
35109
- id: nodeP.id,
35110
- parent_id: $container?.data()?.xuData?.ui_id,
35111
- items: items,
35112
- },
35113
- parent_node: parent_nodeP,
35114
- currentRecordId: currentRecordId,
35115
- $root_container: $root_container,
35116
- parent_element_ui_id: $container?.data()?.xuData?.ui_id,
34564
+ $div.attr('xu-ui-id', ui_id).data({
34565
+ xuData: {
34566
+ prog_id: _paramsP.prog_id,
34567
+ nodeid: nodeP.id,
34568
+ ui_type: nodeP.tagName,
34569
+ xu_id: xu_id,
34570
+ recordid: currentRecordId,
34571
+ paramsP: _paramsP,
34572
+ key: keyP,
34573
+ key_path, //:($container?.data()?.xuData?.key || "0") + "-" + (keyP || "0"),
34574
+ screenId: _paramsP.screenId,
34575
+ parent_container: $container?.attr('id'),
34576
+ elem_key,
34577
+ ui_id,
34578
+ properties: prop,
34579
+ node: nodeP,
34580
+ node_org: _.cloneDeep(nodeP),
34581
+ is_panelP: _paramsP.is_panelP,
34582
+
34583
+ elem_prop: elem_propP,
34584
+ debug_info: {
34585
+ id: nodeP.id,
34586
+ parent_id: $container?.data()?.xuData?.ui_id,
34587
+ items: items,
35117
34588
  },
35118
- xuAttributes: {},
35119
- })
34589
+ parent_node: parent_nodeP,
34590
+ currentRecordId: currentRecordId,
34591
+ $root_container: $root_container,
34592
+ parent_element_ui_id: $container?.data()?.xuData?.ui_id,
34593
+ },
34594
+ xuAttributes: {},
34595
+ });
35120
34596
  // }
35121
34597
 
35122
34598
  // $div.appendTo($appendTo);
@@ -35170,10 +34646,9 @@ func.UI.screen.create_container = function (
35170
34646
  // if (div_typeP === "svg") {
35171
34647
  // $div.removeAttr("xu-ui-id")
35172
34648
  // }
35173
- if (div_typeP !== "svg") {
34649
+ if (div_typeP !== 'svg') {
35174
34650
  $div.appendTo($appendTo);
35175
34651
  }
35176
-
35177
34652
  } catch (e) {
35178
34653
  console.error(e);
35179
34654
  }
@@ -35186,14 +34661,7 @@ func.UI.screen.create_container = function (
35186
34661
 
35187
34662
  return $div;
35188
34663
  };
35189
- func.UI.screen.execute_screen_ready_events = async function (
35190
- SESSION_ID,
35191
- paramsP,
35192
- sourceP,
35193
- $div,
35194
- jobNoP,
35195
- $div_objP
35196
- ) {
34664
+ func.UI.screen.execute_screen_ready_events = async function (SESSION_ID, paramsP, sourceP, $div, jobNoP, $div_objP) {
35197
34665
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
35198
34666
  if (!_ds) return;
35199
34667
  var viewEventExec_arr = [];
@@ -35201,13 +34669,7 @@ func.UI.screen.execute_screen_ready_events = async function (
35201
34669
  for await (const val of viewEventExec_arr) {
35202
34670
  cond = val.eventInfo.data.enabled;
35203
34671
  if (val.expression) {
35204
- expCond = await func.expression.get(
35205
- SESSION_ID,
35206
- val.expression,
35207
- paramsP.dsSessionP,
35208
- "condition",
35209
- paramsP.rowIdP
35210
- ); // execute expression
34672
+ expCond = await func.expression.get(SESSION_ID, val.expression, paramsP.dsSessionP, 'condition', paramsP.rowIdP); // execute expression
35211
34673
  cond = expCond.result;
35212
34674
  }
35213
34675
  if (cond) {
@@ -35226,7 +34688,7 @@ func.UI.screen.execute_screen_ready_events = async function (
35226
34688
  null,
35227
34689
  paramsP.dsSessionP,
35228
34690
  val.eventId,
35229
- sourceP + " event",
34691
+ sourceP + ' event',
35230
34692
  true,
35231
34693
  null,
35232
34694
  null,
@@ -35240,7 +34702,7 @@ func.UI.screen.execute_screen_ready_events = async function (
35240
34702
  _ds.prog_id,
35241
34703
  _ds.nodeId,
35242
34704
  _ds.parentDataSourceNo,
35243
- $div
34705
+ $div,
35244
34706
  );
35245
34707
 
35246
34708
  // update changed values to screen added 18/09/13
@@ -35252,43 +34714,20 @@ func.UI.screen.execute_screen_ready_events = async function (
35252
34714
  }
35253
34715
 
35254
34716
  if (_ds?.data_feed?.form_fields_changed?.[current_record_id]) {
35255
- $.each(
35256
- _ds.data_feed.form_fields_changed[current_record_id],
35257
- function (key, val) {
35258
- fields_to_refresh.push(key);
35259
- }
35260
- );
34717
+ $.each(_ds.data_feed.form_fields_changed[current_record_id], function (key, val) {
34718
+ fields_to_refresh.push(key);
34719
+ });
35261
34720
 
35262
34721
  var containerId = _ds.containerId;
35263
- var $container = $("#" + containerId);
35264
- if (
35265
- $container?.data()?.xuData?.is_mobile_modal ||
35266
- $container?.data()?.xuData?.params?.is_mobile_page
35267
- ) {
35268
- await func.UI.screen.refresh_container(
35269
- SESSION_ID,
35270
- "init",
35271
- fields_to_refresh,
35272
- $container,
35273
- paramsP.dsSessionP,
35274
- null
35275
- );
34722
+ var $container = $('#' + containerId);
34723
+ if ($container?.data()?.xuData?.is_mobile_modal || $container?.data()?.xuData?.params?.is_mobile_page) {
34724
+ await func.UI.screen.refresh_container(SESSION_ID, 'init', fields_to_refresh, $container, paramsP.dsSessionP, null);
35276
34725
  } else {
35277
- $container.trigger(containerId + ".refresh", [
35278
- "init",
35279
- fields_to_refresh,
35280
- ]);
34726
+ $container.trigger(containerId + '.refresh', ['init', fields_to_refresh]);
35281
34727
  }
35282
34728
 
35283
34729
  if ($div_objP) {
35284
- await func.UI.screen.refresh_container(
35285
- SESSION_ID,
35286
- "init",
35287
- fields_to_refresh,
35288
- $div_objP,
35289
- paramsP.dsSessionP,
35290
- null
35291
- );
34730
+ await func.UI.screen.refresh_container(SESSION_ID, 'init', fields_to_refresh, $div_objP, paramsP.dsSessionP, null);
35292
34731
  }
35293
34732
  }
35294
34733
  }
@@ -35308,18 +34747,7 @@ func.UI.screen.execute_screen_ready_events = async function (
35308
34747
  if (_.isEmpty(event_obj.triggers)) continue;
35309
34748
 
35310
34749
  if (event_obj.data.condition) {
35311
- let res = await func.expression.get(
35312
- SESSION_ID,
35313
- event_obj.data.condition,
35314
- paramsP.dsSessionP,
35315
- "condition",
35316
- paramsP.rowIdP,
35317
- null,
35318
- null,
35319
- null,
35320
- null,
35321
- event_obj
35322
- );
34750
+ let res = await func.expression.get(SESSION_ID, event_obj.data.condition, paramsP.dsSessionP, 'condition', paramsP.rowIdP, null, null, null, null, event_obj);
35323
34751
  if (!res.result) {
35324
34752
  continue;
35325
34753
  }
@@ -35332,41 +34760,20 @@ func.UI.screen.execute_screen_ready_events = async function (
35332
34760
  continue;
35333
34761
  }
35334
34762
  cond = true;
35335
- if (trigger_obj.props.condition)
35336
- expression = trigger_obj.props.condition;
34763
+ if (trigger_obj.props.condition) expression = trigger_obj.props.condition;
35337
34764
  var expCond = {};
35338
34765
  if (expression) {
35339
- expCond = await func.expression.get(
35340
- SESSION_ID,
35341
- expression,
35342
- paramsP.dsSessionP,
35343
- "condition",
35344
- paramsP.rowIdP,
35345
- trigger_obj.data.type
35346
- ); // execute expression
34766
+ expCond = await func.expression.get(SESSION_ID, expression, paramsP.dsSessionP, 'condition', paramsP.rowIdP, trigger_obj.data.type); // execute expression
35347
34767
  cond = expCond.result;
35348
34768
  expCond.conditional = true;
35349
34769
  }
35350
34770
 
35351
34771
  if (!trigger_obj.data.action) {
35352
- func.utils.debug_report(
35353
- SESSION_ID,
35354
- "get_view_events_count",
35355
- `Error initiating ${typeP} prog: ${_ds.viewSourceDesc} reason: missing action`,
35356
- "E"
35357
- );
34772
+ func.utils.debug_report(SESSION_ID, 'get_view_events_count', `Error initiating ${typeP} prog: ${_ds.viewSourceDesc} reason: missing action`, 'E');
35358
34773
  break;
35359
34774
  }
35360
- if (
35361
- !glb.REFERENCE_LESS_FUNCTIONS.includes(trigger_obj.data.action) &&
35362
- !trigger_obj.data.name?.prog
35363
- ) {
35364
- func.utils.debug_report(
35365
- SESSION_ID,
35366
- "get_view_events_count",
35367
- `Error initiating ${typeP} prog: ${_ds.viewSourceDesc} reason: missing reference`,
35368
- "E"
35369
- );
34775
+ if (!glb.REFERENCE_LESS_FUNCTIONS.includes(trigger_obj.data.action) && !trigger_obj.data.name?.prog) {
34776
+ func.utils.debug_report(SESSION_ID, 'get_view_events_count', `Error initiating ${typeP} prog: ${_ds.viewSourceDesc} reason: missing reference`, 'E');
35370
34777
  break;
35371
34778
  }
35372
34779
 
@@ -35381,41 +34788,24 @@ func.UI.screen.execute_screen_ready_events = async function (
35381
34788
  return viewEventExec_arr.length;
35382
34789
  };
35383
34790
 
35384
- let count = await get_view_events_count("screen_ready");
34791
+ let count = await get_view_events_count('screen_ready');
35385
34792
  if (!count) return;
35386
34793
  return await execute_view_events(sourceP);
35387
34794
  };
35388
- func.UI.screen.screen_loading_done = async function (
35389
- SESSION_ID,
35390
- paramsP,
35391
- $div,
35392
- jobNoP
35393
- ) {
34795
+ func.UI.screen.screen_loading_done = async function (SESSION_ID, paramsP, $div, jobNoP) {
35394
34796
  // await
35395
- func.UI.screen.execute_screen_ready_events(
35396
- SESSION_ID,
35397
- paramsP,
35398
- paramsP.screenInfo.properties?.renderType,
35399
- $div,
35400
- jobNoP
35401
- );
34797
+ func.UI.screen.execute_screen_ready_events(SESSION_ID, paramsP, paramsP.screenInfo.properties?.renderType, $div, jobNoP);
35402
34798
  var _session = SESSION_OBJ[SESSION_ID];
35403
34799
  func.events.delete_job(SESSION_ID, jobNoP);
35404
- func.UI.utils.screen_blocker(
35405
- false,
35406
- paramsP.prog_id + (paramsP.sourceScreenP ? "_" + paramsP.sourceScreenP : "")
35407
- );
34800
+ func.UI.utils.screen_blocker(false, paramsP.prog_id + (paramsP.sourceScreenP ? '_' + paramsP.sourceScreenP : ''));
35408
34801
  if (_session.prog_id === paramsP.prog_id) {
35409
34802
  _session.system_ready = true;
35410
- if (
35411
- _session.engine_mode === "live_preview" &&
35412
- STUDIO_PEER_CONN_SEND_METHOD
35413
- ) {
34803
+ if (_session.engine_mode === 'live_preview' && STUDIO_PEER_CONN_SEND_METHOD) {
35414
34804
  STUDIO_PEER_CONN_SEND_METHOD({
35415
- service: "system_ready",
34805
+ service: 'system_ready',
35416
34806
  data: {},
35417
34807
  id: STUDIO_PEER.id,
35418
- source: "runtime",
34808
+ source: 'runtime',
35419
34809
  session_id: SESSION_ID,
35420
34810
  app_id: _session.app_id,
35421
34811
  gtp_token: _session.gtp_token,
@@ -35428,20 +34818,7 @@ func.UI.screen.screen_loading_done = async function (
35428
34818
  return $div;
35429
34819
  };
35430
34820
 
35431
- func.UI.screen.render_ui_tree = async function (
35432
- SESSION_ID,
35433
- $container,
35434
- nodeP,
35435
- parent_infoP,
35436
- paramsP,
35437
- jobNoP,
35438
- is_skeleton,
35439
- keyP,
35440
- is_mainP,
35441
- parent_nodeP,
35442
- check_existP,
35443
- $root_container
35444
- ) {
34821
+ 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) {
35445
34822
  if (!is_skeleton) {
35446
34823
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
35447
34824
  }
@@ -35452,29 +34829,16 @@ func.UI.screen.render_ui_tree = async function (
35452
34829
  // debugger;
35453
34830
  }
35454
34831
 
35455
- var is_mobile = glb.MOBILE_ARR.includes(
35456
- paramsP.screenInfo.properties?.menuType
35457
- )
35458
- ? true
35459
- : false;
34832
+ var is_mobile = glb.MOBILE_ARR.includes(paramsP.screenInfo.properties?.menuType) ? true : false;
35460
34833
 
35461
34834
  var get_element_info = function () {
35462
34835
  var ret = {};
35463
- let currentRecordId = _ds?.currentRecordId || "";
34836
+ let currentRecordId = _ds?.currentRecordId || '';
35464
34837
 
35465
- let $div = func.UI.utils.find_in_element_data(
35466
- "xuData",
35467
- $container.parent(),
35468
- "nodeid",
35469
- nodeP.id
35470
- );
34838
+ let $div = func.UI.utils.find_in_element_data('xuData', $container.parent(), 'nodeid', nodeP.id);
35471
34839
 
35472
34840
  $.each($div, function (key, val) {
35473
- if (
35474
- $(val)?.data().xuData?.recordid === currentRecordId &&
35475
- $(val)?.data().xuData?.key === keyP &&
35476
- $(val)?.prop("tagName") !== "XURENDER"
35477
- ) {
34841
+ if ($(val)?.data().xuData?.recordid === currentRecordId && $(val)?.data().xuData?.key === keyP && $(val)?.prop('tagName') !== 'XURENDER') {
35478
34842
  ret = {
35479
34843
  div: $div,
35480
34844
  };
@@ -35490,34 +34854,30 @@ func.UI.screen.render_ui_tree = async function (
35490
34854
  return ret;
35491
34855
  };
35492
34856
  const debug = function (is_errorP, error_descP) {
35493
- func.utils.debug.log(
35494
- SESSION_ID,
35495
- paramsP.prog_id + "_" + nodeP.id_org + "_ui_prop",
35496
- {
35497
- module: "gui",
35498
- action: "init",
35499
- prop: nodeP.id,
35500
- details: error_descP,
35501
- result: null,
35502
- error: is_errorP,
35503
- source: _ds?.tree_obj?.menuName || "",
35504
- fields: null,
35505
- type: null,
35506
- prog_id: paramsP.prog_id,
35507
- dsSession: null,
35508
- }
35509
- );
34857
+ func.utils.debug.log(SESSION_ID, paramsP.prog_id + '_' + nodeP.id_org + '_ui_prop', {
34858
+ module: 'gui',
34859
+ action: 'init',
34860
+ prop: nodeP.id,
34861
+ details: error_descP,
34862
+ result: null,
34863
+ error: is_errorP,
34864
+ source: _ds?.tree_obj?.menuName || '',
34865
+ fields: null,
34866
+ type: null,
34867
+ prog_id: paramsP.prog_id,
34868
+ dsSession: null,
34869
+ });
35510
34870
  };
35511
34871
 
35512
34872
  const open_modal = async function ($div) {
35513
- const modal_id = "app_modal-" + paramsP.dsSessionP.toString();
35514
- var xu_modal_controller = document.querySelector("xu-modal-controller");
34873
+ const modal_id = 'app_modal-' + paramsP.dsSessionP.toString();
34874
+ var xu_modal_controller = document.querySelector('xu-modal-controller');
35515
34875
  if (!xu_modal_controller) {
35516
34876
  func.UI.component.create_app_modal_component(SESSION_ID, modal_id);
35517
- xu_modal_controller = document.querySelector("xu-modal-controller");
34877
+ xu_modal_controller = document.querySelector('xu-modal-controller');
35518
34878
  }
35519
34879
 
35520
- var controller_params = $(xu_modal_controller).data("xuControllerParams");
34880
+ var controller_params = $(xu_modal_controller).data('xuControllerParams');
35521
34881
 
35522
34882
  if (!controller_params) {
35523
34883
  controller_params = {};
@@ -35533,16 +34893,11 @@ func.UI.screen.render_ui_tree = async function (
35533
34893
 
35534
34894
  controller_params[modal_id] = params;
35535
34895
 
35536
- $(xu_modal_controller).data("xuControllerParams", controller_params);
34896
+ $(xu_modal_controller).data('xuControllerParams', controller_params);
35537
34897
  const modalController = await new UI_FRAMEWORK_PLUGIN.modal();
35538
34898
 
35539
34899
  if (!APP_MODAL_OBJ[modal_id]) {
35540
- const modal = await modalController.create(
35541
- SESSION_ID,
35542
- modal_id,
35543
- paramsP.screenInfo,
35544
- close_modal
35545
- );
34900
+ const modal = await modalController.create(SESSION_ID, modal_id, paramsP.screenInfo, close_modal);
35546
34901
  APP_MODAL_OBJ[modal_id] = modal;
35547
34902
  } else {
35548
34903
  $(modal_id).empty();
@@ -35554,14 +34909,10 @@ func.UI.screen.render_ui_tree = async function (
35554
34909
 
35555
34910
  const close_modal = async function (modal_id) {
35556
34911
  delete APP_MODAL_OBJ[modal_id];
35557
- const xu_modal_controller = document.querySelector("xu-modal-controller");
34912
+ const xu_modal_controller = document.querySelector('xu-modal-controller');
35558
34913
  var params = $(xu_modal_controller).data().xuControllerParams[modal_id];
35559
34914
  if (params && params.$container) {
35560
- await func.UI.screen.validate_exit_events(
35561
- SESSION_ID,
35562
- params.$container.data().xuData.paramsP,
35563
- null
35564
- );
34915
+ await func.UI.screen.validate_exit_events(SESSION_ID, params.$container.data().xuData.paramsP, null);
35565
34916
  func.datasource.clean_all(SESSION_ID, params.dsSession);
35566
34917
  }
35567
34918
  };
@@ -35576,17 +34927,16 @@ func.UI.screen.render_ui_tree = async function (
35576
34927
  };
35577
34928
 
35578
34929
  const open_popover = async function ($div) {
35579
- const xu_popover_controller =
35580
- func.UI.component.create_app_popover_component(SESSION_ID);
34930
+ const xu_popover_controller = func.UI.component.create_app_popover_component(SESSION_ID);
35581
34931
 
35582
- $(xu_popover_controller).data("xuControllerParams", {
34932
+ $(xu_popover_controller).data('xuControllerParams', {
35583
34933
  menuTitle: paramsP.screenInfo.properties?.menuTitle,
35584
34934
  screenId: paramsP.screenId,
35585
34935
  $dialogDiv: $div.children(),
35586
34936
  $container: $container,
35587
34937
  });
35588
34938
  const popover = new UI_FRAMEWORK_PLUGIN.popover(
35589
- SESSION_ID
34939
+ SESSION_ID,
35590
34940
  // ELEMENT_CLICK_EVENT,
35591
34941
  // props
35592
34942
  );
@@ -35596,7 +34946,7 @@ func.UI.screen.render_ui_tree = async function (
35596
34946
  return;
35597
34947
  popoverController
35598
34948
  .create({
35599
- component: "xu-popover-content-" + SESSION_ID,
34949
+ component: 'xu-popover-content-' + SESSION_ID,
35600
34950
  event: ELEMENT_CLICK_EVENT,
35601
34951
  translucent: true,
35602
34952
  })
@@ -35608,14 +34958,7 @@ func.UI.screen.render_ui_tree = async function (
35608
34958
  });
35609
34959
  });
35610
34960
  };
35611
- const iterate_child = async function (
35612
- $divP,
35613
- nodeP,
35614
- parent_infoP,
35615
- countP,
35616
- $root_container,
35617
- before_record_function
35618
- ) {
34961
+ const iterate_child = async function ($divP, nodeP, parent_infoP, countP, $root_container, before_record_function) {
35619
34962
  if (!is_mobile && nodeP.busy) return;
35620
34963
  nodeP.busy = true;
35621
34964
  const done = async function ($divP) {
@@ -35629,26 +34972,12 @@ func.UI.screen.render_ui_tree = async function (
35629
34972
  return await done($divP);
35630
34973
  }
35631
34974
 
35632
-
35633
34975
  if (before_record_function) {
35634
34976
  await before_record_function();
35635
34977
  }
35636
34978
  if (nodeP?.children?.length) {
35637
34979
  for await (const [key, val] of Object.entries(nodeP.children)) {
35638
- const ret = await func.UI.screen.render_ui_tree(
35639
- SESSION_ID,
35640
- $divP,
35641
- nodeP.children[key],
35642
- parent_infoP,
35643
- paramsP,
35644
- jobNoP,
35645
- is_skeleton,
35646
- Number(key),
35647
- null,
35648
- nodeP,
35649
- null,
35650
- $root_container
35651
- );
34980
+ 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);
35652
34981
  }
35653
34982
  }
35654
34983
  return await done($divP);
@@ -35656,12 +34985,12 @@ func.UI.screen.render_ui_tree = async function (
35656
34985
 
35657
34986
  const _$ = function ($elm) {
35658
34987
  try {
35659
- const id = $elm.attr("xu-ui-id");
34988
+ const id = $elm.attr('xu-ui-id');
35660
34989
  if (!id) return $elm;
35661
34990
  const $el = $(`[xu-ui-id="${id}"]`); // $("#" + id);
35662
34991
 
35663
34992
  if ($el.length > 1) {
35664
- console.warn("Multiple elements for xu-ui-id: " + id, $el);
34993
+ console.warn('Multiple elements for xu-ui-id: ' + id, $el);
35665
34994
  }
35666
34995
 
35667
34996
  return $($el[0]);
@@ -35673,9 +35002,7 @@ func.UI.screen.render_ui_tree = async function (
35673
35002
  const hover_in = function ($div) {
35674
35003
  if (is_skeleton) return;
35675
35004
  CLIENT_ACTIVITY_TS = Date.now();
35676
- if (_$($container)?.data()?.xuData?.debug_info)
35677
- _$($container).data().xuData.debug_info.hover_item =
35678
- $div.attr("xu-ui-id");
35005
+ if (_$($container)?.data()?.xuData?.debug_info) _$($container).data().xuData.debug_info.hover_item = $div.attr('xu-ui-id');
35679
35006
  if (!_ds) return;
35680
35007
  ///////// SET Attributes///////////
35681
35008
  let attributes = {};
@@ -35683,9 +35010,7 @@ func.UI.screen.render_ui_tree = async function (
35683
35010
  attributes[attr.name] = attr.value;
35684
35011
  });
35685
35012
 
35686
- SESSION_OBJ[
35687
- SESSION_ID
35688
- ].DS_GLB[0].data_system.SYS_OBJ_WIN_ELEMENT_HOVERED_ATTRIBUTES = attributes;
35013
+ SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system.SYS_OBJ_WIN_ELEMENT_HOVERED_ATTRIBUTES = attributes;
35689
35014
  //////////////////////////////////
35690
35015
  const _iterate_info = $div.data().xuData.iterate_info;
35691
35016
  if (_iterate_info) {
@@ -35694,8 +35019,7 @@ func.UI.screen.render_ui_tree = async function (
35694
35019
  } else {
35695
35020
  try {
35696
35021
  const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
35697
- _ds.data_feed.rows[row_idx][_iterate_info.iterator_key] =
35698
- _iterate_info._key;
35022
+ _ds.data_feed.rows[row_idx][_iterate_info.iterator_key] = _iterate_info._key;
35699
35023
  } catch (err) {
35700
35024
  console.error(err);
35701
35025
  }
@@ -35706,24 +35030,15 @@ func.UI.screen.render_ui_tree = async function (
35706
35030
  } else {
35707
35031
  try {
35708
35032
  const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
35709
- _ds.data_feed.rows[row_idx][_iterate_info.iterator_val] =
35710
- _iterate_info._val;
35033
+ _ds.data_feed.rows[row_idx][_iterate_info.iterator_val] = _iterate_info._val;
35711
35034
  } catch (err) {
35712
35035
  console.error(err);
35713
35036
  }
35714
35037
  }
35715
35038
  }
35716
35039
 
35717
- if ($div && _$($div) && _ds && paramsP.renderType === "grid") {
35718
- func.UI.worker.add_to_queue(
35719
- SESSION_ID,
35720
- "gui event",
35721
- "update_datasource",
35722
- { currentRecordId: _$($div).data().xuData.currentRecordId },
35723
- null,
35724
- null,
35725
- paramsP.dsSessionP
35726
- );
35040
+ if ($div && _$($div) && _ds && paramsP.renderType === 'grid') {
35041
+ func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'update_datasource', { currentRecordId: _$($div).data().xuData.currentRecordId }, null, null, paramsP.dsSessionP);
35727
35042
  }
35728
35043
 
35729
35044
  const set_value = function (field_id, value) {
@@ -35731,8 +35046,8 @@ func.UI.screen.render_ui_tree = async function (
35731
35046
 
35732
35047
  func.UI.worker.add_to_queue(
35733
35048
  SESSION_ID,
35734
- "gui event",
35735
- "update_datasource",
35049
+ 'gui event',
35050
+ 'update_datasource',
35736
35051
  {
35737
35052
  currentRecordId,
35738
35053
  field_id,
@@ -35740,7 +35055,7 @@ func.UI.screen.render_ui_tree = async function (
35740
35055
  },
35741
35056
  null,
35742
35057
  null,
35743
- paramsP.dsSessionP
35058
+ paramsP.dsSessionP,
35744
35059
  );
35745
35060
  };
35746
35061
 
@@ -35761,40 +35076,27 @@ func.UI.screen.render_ui_tree = async function (
35761
35076
  _$($container).data().xuData.debug_info.hover_item = null;
35762
35077
  }
35763
35078
  if (_ds?.data_system) {
35764
- SESSION_OBJ[
35765
- SESSION_ID
35766
- ].DS_GLB[0].data_system.SYS_OBJ_WIN_ELEMENT_HOVERED_ATTRIBUTES = {};
35079
+ SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system.SYS_OBJ_WIN_ELEMENT_HOVERED_ATTRIBUTES = {};
35767
35080
  }
35768
35081
  };
35769
35082
  const render_screen_type = async function ($div) {
35770
35083
  const set_call_screen_properties_values = async function (ui_framework) {
35771
35084
  params.properties = {};
35772
35085
  const get_values = async function (property) {
35773
- var property_value =
35774
- paramsP?.screenInfo?.properties?.[property] ||
35775
- paramsP?.screenInfo?.properties?.frameworkProperties?.[property];
35086
+ var property_value = paramsP?.screenInfo?.properties?.[property] || paramsP?.screenInfo?.properties?.frameworkProperties?.[property];
35776
35087
  if (paramsP?.call_screen_propertiesP) {
35777
35088
  if (paramsP.call_screen_propertiesP?.[property]) {
35778
35089
  property_value = paramsP.call_screen_propertiesP[property];
35779
35090
  }
35780
35091
  if (paramsP.call_screen_propertiesP[`xu-exp:${property}`]) {
35781
- property_value = (
35782
- await func.expression.get(
35783
- SESSION_ID,
35784
- paramsP.call_screen_propertiesP[`xu-exp:${property}`],
35785
- paramsP.dsSessionP,
35786
- property
35787
- )
35788
- ).result;
35092
+ property_value = (await func.expression.get(SESSION_ID, paramsP.call_screen_propertiesP[`xu-exp:${property}`], paramsP.dsSessionP, property)).result;
35789
35093
  }
35790
35094
  }
35791
35095
  return property_value;
35792
35096
  };
35793
- params.properties["name"] = await get_values("menuTitle");
35097
+ params.properties['name'] = await get_values('menuTitle');
35794
35098
  if (await ui_framework?.properties()) {
35795
- for await (const [key, val] of Object.entries(
35796
- await ui_framework.properties()
35797
- )) {
35099
+ for await (const [key, val] of Object.entries(await ui_framework.properties())) {
35798
35100
  params.properties[key] = await get_values(key);
35799
35101
  }
35800
35102
  }
@@ -35806,24 +35108,22 @@ func.UI.screen.render_ui_tree = async function (
35806
35108
  if (!$(val)?.data()?.xuData?.parent_container) {
35807
35109
  return true;
35808
35110
  }
35809
- $(val).data().xuData.parent_container =
35810
- $div.data().xuData.parent_container;
35111
+ $(val).data().xuData.parent_container = $div.data().xuData.parent_container;
35811
35112
  });
35812
35113
 
35813
35114
  let $ret = $div;
35814
- var $nav = $(SESSION_OBJ[SESSION_ID].root_element).find("xu-nav");
35115
+ var $nav = $(SESSION_OBJ[SESSION_ID].root_element).find('xu-nav');
35815
35116
  var params;
35816
35117
  switch (paramsP.screen_type) {
35817
- case "modal":
35818
- const modal_id = "app_modal-" + paramsP.dsSessionP.toString();
35819
- var xu_modal_controller = document.querySelector("xu-modal-controller");
35118
+ case 'modal':
35119
+ const modal_id = 'app_modal-' + paramsP.dsSessionP.toString();
35120
+ var xu_modal_controller = document.querySelector('xu-modal-controller');
35820
35121
  if (!xu_modal_controller) {
35821
35122
  func.UI.component.create_app_modal_component(SESSION_ID, modal_id);
35822
- xu_modal_controller = document.querySelector("xu-modal-controller");
35123
+ xu_modal_controller = document.querySelector('xu-modal-controller');
35823
35124
  }
35824
35125
 
35825
- var controller_params =
35826
- $(xu_modal_controller).data("xuControllerParams");
35126
+ var controller_params = $(xu_modal_controller).data('xuControllerParams');
35827
35127
 
35828
35128
  if (!controller_params) {
35829
35129
  controller_params = {};
@@ -35842,7 +35142,7 @@ func.UI.screen.render_ui_tree = async function (
35842
35142
 
35843
35143
  controller_params[modal_id] = params;
35844
35144
 
35845
- $(xu_modal_controller).data("xuControllerParams", controller_params);
35145
+ $(xu_modal_controller).data('xuControllerParams', controller_params);
35846
35146
  const modalController = await new UI_FRAMEWORK_PLUGIN.modal();
35847
35147
  await set_call_screen_properties_values(modalController);
35848
35148
  if (!APP_MODAL_OBJ[modal_id]) {
@@ -35857,11 +35157,10 @@ func.UI.screen.render_ui_tree = async function (
35857
35157
 
35858
35158
  break;
35859
35159
 
35860
- case "popover":
35160
+ case 'popover':
35861
35161
  // open_popover($div);
35862
35162
 
35863
- const xu_popover_controller =
35864
- func.UI.component.create_app_popover_component(SESSION_ID);
35163
+ const xu_popover_controller = func.UI.component.create_app_popover_component(SESSION_ID);
35865
35164
  params = {
35866
35165
  menuTitle: paramsP.screenInfo.properties?.menuTitle,
35867
35166
  screenId: paramsP.screenId,
@@ -35869,19 +35168,16 @@ func.UI.screen.render_ui_tree = async function (
35869
35168
  $container: $container,
35870
35169
  };
35871
35170
 
35872
- $(xu_popover_controller).data("xuControllerParams", params);
35171
+ $(xu_popover_controller).data('xuControllerParams', params);
35873
35172
  const popover = new UI_FRAMEWORK_PLUGIN.popover(SESSION_ID);
35874
35173
  await set_call_screen_properties_values(popover);
35875
35174
  await popover.open(params);
35876
35175
  CURRENT_APP_POPOVER = popover;
35877
35176
 
35878
- func.UI.utils.screen_blocker(
35879
- false,
35880
- paramsP.prog_id + "_" + paramsP.sourceScreenP
35881
- );
35177
+ func.UI.utils.screen_blocker(false, paramsP.prog_id + '_' + paramsP.sourceScreenP);
35882
35178
  break;
35883
35179
 
35884
- case "page":
35180
+ case 'page':
35885
35181
  const nav = $nav[0];
35886
35182
 
35887
35183
  params = {
@@ -35895,38 +35191,31 @@ func.UI.screen.render_ui_tree = async function (
35895
35191
  paramsP,
35896
35192
  };
35897
35193
 
35898
- var component_name = "xu-page-component-" + paramsP.dsSessionP;
35194
+ var component_name = 'xu-page-component-' + paramsP.dsSessionP;
35899
35195
  if (!$(nav).data().xuData.nav_params) {
35900
35196
  $(nav).data().xuData.nav_params = {};
35901
35197
  }
35902
35198
 
35903
35199
  //restore validate
35904
35200
  if ($(nav)?.data()?.xuData?.params?.[paramsP.dsSessionP]) {
35905
- params.$container.data().xuData.validate_screen_ready = $(nav)
35906
- .data()
35907
- .xuData.params[
35908
- paramsP.dsSessionP
35909
- ].$container.data().xuData.validate_screen_ready;
35201
+ params.$container.data().xuData.validate_screen_ready = $(nav).data().xuData.params[paramsP.dsSessionP].$container.data().xuData.validate_screen_ready;
35910
35202
  }
35911
35203
 
35912
35204
  if (!$(nav)?.data()?.xuData) return;
35913
35205
  $(nav).data().xuData.nav_params[paramsP.dsSessionP] = params;
35914
35206
  if (!$(component_name).length) {
35915
- await func.UI.component.create_app_page_component(
35916
- SESSION_ID,
35917
- paramsP.dsSessionP
35918
- );
35207
+ await func.UI.component.create_app_page_component(SESSION_ID, paramsP.dsSessionP);
35919
35208
  const page = new UI_FRAMEWORK_PLUGIN.page();
35920
35209
  await set_call_screen_properties_values(page);
35921
35210
  await page.create(
35922
- params
35211
+ params,
35923
35212
  // SESSION_ID,
35924
35213
  // paramsP.dsSessionP,
35925
35214
  // nav,
35926
35215
  // $nav.data().xuData.nav_params[paramsP.dsSessionP]
35927
35216
  );
35928
35217
  await page.init(
35929
- params
35218
+ params,
35930
35219
  // SESSION_ID,
35931
35220
  // paramsP.dsSessionP,
35932
35221
  // nav,
@@ -35942,7 +35231,7 @@ func.UI.screen.render_ui_tree = async function (
35942
35231
  $div.data().xuData.paramsP = $container.data().xuData.paramsP;
35943
35232
  break;
35944
35233
 
35945
- case "panel":
35234
+ case 'panel':
35946
35235
  $container.append($div_content);
35947
35236
  $ret = $container;
35948
35237
  break;
@@ -35951,14 +35240,14 @@ func.UI.screen.render_ui_tree = async function (
35951
35240
  if ($nav && $nav.length) {
35952
35241
  // refresh made
35953
35242
  } else {
35954
- $nav = $("<xu-nav>");
35243
+ $nav = $('<xu-nav>');
35955
35244
  $container.append($nav);
35956
35245
  func.UI.component.init_xu_nav($container, $nav);
35957
35246
  }
35958
35247
 
35959
35248
  $nav.data().xuData.$div = $div_content;
35960
35249
 
35961
- await $nav[0].setRoot("xu-root-component-" + SESSION_ID);
35250
+ await $nav[0].setRoot('xu-root-component-' + SESSION_ID);
35962
35251
  $ret = $container;
35963
35252
  break;
35964
35253
  }
@@ -35974,31 +35263,15 @@ func.UI.screen.render_ui_tree = async function (
35974
35263
  var exist_elm_obj = get_element_info();
35975
35264
  var $div = exist_elm_obj.div;
35976
35265
  if (!exist_elm_obj.div) {
35977
- $div = func.UI.screen.create_container(
35978
- SESSION_ID,
35979
- $root_container,
35980
- nodeP,
35981
- $container,
35982
- paramsP,
35983
- parent_infoP,
35984
- jobNoP,
35985
- keyP,
35986
- parent_nodeP,
35987
- prop,
35988
- "widget_wrapper",
35989
- null,
35990
- null,
35991
- null,
35992
- null
35993
- );
35266
+ $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);
35994
35267
 
35995
35268
  //////////////////////////
35996
35269
 
35997
- let plugin_name = prop["xu-widget"],
35998
- method = prop["xu-method"],
35270
+ let plugin_name = prop['xu-widget'],
35271
+ method = prop['xu-method'],
35999
35272
  dsP = paramsP.dsSessionP,
36000
35273
  propsP = prop,
36001
- sourceP = "widgets";
35274
+ sourceP = 'widgets';
36002
35275
 
36003
35276
  // const set_SYS_GLOBAL_OBJ_WIDGET_INFO = async function (docP) {
36004
35277
  // var obj = _.clone(docP);
@@ -36023,82 +35296,55 @@ func.UI.screen.render_ui_tree = async function (
36023
35296
  // await func.datasource.update(SESSION_ID, datasource_changes);
36024
35297
  // };
36025
35298
  const call_plugin_api = async function (plugin_nameP, dataP) {
36026
- return await func.utils.call_plugin_api(
36027
- SESSION_ID,
36028
- plugin_nameP,
36029
- dataP
36030
- );
35299
+ return await func.utils.call_plugin_api(SESSION_ID, plugin_nameP, dataP);
36031
35300
  };
36032
35301
  const report_error = function (descP, warn) {
36033
- func.utils.debug.log(
36034
- SESSION_ID,
36035
- _session.DS_GLB[dsP].prog_id +
36036
- "_" +
36037
- _session.DS_GLB[dsP].callingMenuId,
36038
- {
36039
- module: "widgets",
36040
- action: "Init",
35302
+ func.utils.debug.log(SESSION_ID, _session.DS_GLB[dsP].prog_id + '_' + _session.DS_GLB[dsP].callingMenuId, {
35303
+ module: 'widgets',
35304
+ action: 'Init',
35305
+ source: sourceP,
35306
+ prop: descP,
35307
+ details: descP,
35308
+ result: null,
35309
+ error: warn ? false : true,
35310
+ fields: null,
35311
+ type: 'widgets',
35312
+ prog_id: _session.DS_GLB[dsP].prog_id,
35313
+ });
35314
+ };
35315
+ const get_fields_data = async function (fields, props) {
35316
+ const report_error = function (descP, warn) {
35317
+ func.utils.debug.log(SESSION_ID, _session.DS_GLB[dsP].prog_id + '_' + _session.DS_GLB[dsP].callingMenuId, {
35318
+ module: 'widgets',
35319
+ action: 'Init',
36041
35320
  source: sourceP,
36042
35321
  prop: descP,
36043
35322
  details: descP,
36044
35323
  result: null,
36045
35324
  error: warn ? false : true,
36046
35325
  fields: null,
36047
- type: "widgets",
35326
+ type: 'widgets',
36048
35327
  prog_id: _session.DS_GLB[dsP].prog_id,
36049
- }
36050
- );
36051
- };
36052
- const get_fields_data = async function (fields, props) {
36053
- const report_error = function (descP, warn) {
36054
- func.utils.debug.log(
36055
- SESSION_ID,
36056
- _session.DS_GLB[dsP].prog_id +
36057
- "_" +
36058
- _session.DS_GLB[dsP].callingMenuId,
36059
- {
36060
- module: "widgets",
36061
- action: "Init",
36062
- source: sourceP,
36063
- prop: descP,
36064
- details: descP,
36065
- result: null,
36066
- error: warn ? false : true,
36067
- fields: null,
36068
- type: "widgets",
36069
- prog_id: _session.DS_GLB[dsP].prog_id,
36070
- }
36071
- );
35328
+ });
36072
35329
  };
36073
35330
  const get_property_value = async function (fieldIdP, val) {
36074
35331
  if (!val) return;
36075
- var value =
36076
- props[fieldIdP] ||
36077
- (typeof val.defaultValue === "function"
36078
- ? val?.defaultValue?.()
36079
- : val?.defaultValue);
36080
- if (val.render === "eventId") {
35332
+ var value = props[fieldIdP] || (typeof val.defaultValue === 'function' ? val?.defaultValue?.() : val?.defaultValue);
35333
+ if (val.render === 'eventId') {
36081
35334
  value = props?.[fieldIdP]?.event;
36082
35335
  }
36083
35336
 
36084
35337
  if (props[`xu-exp:${fieldIdP}`]) {
36085
- value = (
36086
- await func.expression.get(
36087
- SESSION_ID,
36088
- props[`xu-exp:${fieldIdP}`],
36089
- dsP,
36090
- "widget property"
36091
- )
36092
- ).result;
35338
+ value = (await func.expression.get(SESSION_ID, props[`xu-exp:${fieldIdP}`], dsP, 'widget property')).result;
36093
35339
  }
36094
35340
 
36095
35341
  return func.common.get_cast_val(
36096
35342
  SESSION_ID,
36097
- "widgets",
35343
+ 'widgets',
36098
35344
  fieldIdP,
36099
35345
  val.type, //val.type !== "string" || val.type !== "number" ? "string" : val.type,
36100
35346
  value,
36101
- null
35347
+ null,
36102
35348
  );
36103
35349
  };
36104
35350
  var data_obj = {};
@@ -36113,7 +35359,7 @@ func.UI.screen.render_ui_tree = async function (
36113
35359
  }
36114
35360
  // console.log(val);
36115
35361
  }
36116
- for await (const key of ["xu-bind"]) {
35362
+ for await (const key of ['xu-bind']) {
36117
35363
  data_obj[key] = await get_property_value(key, props[key]);
36118
35364
  }
36119
35365
 
@@ -36121,32 +35367,24 @@ func.UI.screen.render_ui_tree = async function (
36121
35367
  };
36122
35368
 
36123
35369
  const load_css_style = function () {
36124
- let path = get_path("style.css");
35370
+ let path = get_path('style.css');
36125
35371
  func.utils.load_css_on_demand(path);
36126
35372
  };
36127
35373
 
36128
35374
  const get_path = function (resource) {
36129
- if (_session.worker_type === "Dev") {
35375
+ if (_session.worker_type === 'Dev') {
36130
35376
  return `../../plugins/${plugin_name}/${resource}`;
36131
35377
  }
36132
35378
  return `https://${_session.domain}/plugins/${plugin_name}/${resource}?gtp_token=${_session.gtp_token}&app_id=${_session.app_id}`;
36133
35379
  };
36134
- const _plugin =
36135
- APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
36136
- const index = await func.utils.get_plugin_resource(
36137
- SESSION_ID,
36138
- plugin_name,
36139
- `${_plugin.manifest["index.mjs"].dist ? "dist/" : ""}index.mjs`
36140
- );
35380
+ const _plugin = APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
35381
+ const index = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${_plugin.manifest['index.mjs'].dist ? 'dist/' : ''}index.mjs`);
36141
35382
  const methods = index.methods;
36142
35383
  if (methods && !methods[method]) {
36143
- return report_error("method not found");
35384
+ return report_error('method not found');
36144
35385
  }
36145
35386
 
36146
- const fields_ret = await get_fields_data(
36147
- methods[method].fields,
36148
- propsP
36149
- );
35387
+ const fields_ret = await get_fields_data(methods[method].fields, propsP);
36150
35388
  if (fields_ret.code < 0) {
36151
35389
  return report_error(fields_ret.data);
36152
35390
  }
@@ -36154,65 +35392,37 @@ func.UI.screen.render_ui_tree = async function (
36154
35392
 
36155
35393
  let exclude_attributes = [];
36156
35394
  for await (const [key, val] of Object.entries(propsP)) {
36157
- if (
36158
- typeof fields[key] !== "undefined" ||
36159
- typeof fields[`xu-exp:${key}`] !== "undefined"
36160
- ) {
35395
+ if (typeof fields[key] !== 'undefined' || typeof fields[`xu-exp:${key}`] !== 'undefined') {
36161
35396
  exclude_attributes.push(key);
36162
35397
  }
36163
35398
  }
36164
35399
 
36165
- let ret = await func.UI.screen.set_attributes_new(
36166
- SESSION_ID,
36167
- is_skeleton,
36168
- $root_container,
36169
- nodeP,
36170
- $container,
36171
- paramsP,
36172
- parent_infoP,
36173
- jobNoP,
36174
- keyP,
36175
- parent_nodeP,
36176
- $div,
36177
- true,
36178
- exclude_attributes
36179
- );
35400
+ 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);
36180
35401
 
36181
- $div.addClass("widget_wrapper"); // class get override in set_attributes_new
35402
+ $div.addClass('widget_wrapper'); // class get override in set_attributes_new
36182
35403
 
36183
35404
  if (!APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name]) {
36184
35405
  return report_error(`plugin ${plugin_name} not found`);
36185
35406
  }
36186
35407
 
36187
- if (
36188
- APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name].manifest[
36189
- "style.css"
36190
- ].exist
36191
- ) {
35408
+ if (APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name].manifest['style.css'].exist) {
36192
35409
  load_css_style();
36193
35410
  }
36194
35411
 
36195
- const plugin_setup_ret = await func.utils.get_plugin_setup(
36196
- SESSION_ID,
36197
- plugin_name
36198
- );
35412
+ const plugin_setup_ret = await func.utils.get_plugin_setup(SESSION_ID, plugin_name);
36199
35413
  if (plugin_setup_ret.code < 0) {
36200
35414
  return report_error(plugin_setup_ret);
36201
35415
  }
36202
35416
 
36203
- const api_utils = await func.common.get_module(
35417
+ const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
35418
+ func,
35419
+ glb,
35420
+ SESSION_OBJ,
36204
35421
  SESSION_ID,
36205
- "xuda-api-library.mjs",
36206
- {
36207
- func,
36208
- glb,
36209
- SESSION_OBJ,
36210
- SESSION_ID,
36211
- APP_OBJ,
36212
- dsSession: paramsP.dsSessionP,
36213
- job_id: jobNoP,
36214
- }
36215
- );
35422
+ APP_OBJ,
35423
+ dsSession: paramsP.dsSessionP,
35424
+ job_id: jobNoP,
35425
+ });
36216
35426
 
36217
35427
  const params = {
36218
35428
  SESSION_ID,
@@ -36231,21 +35441,10 @@ func.UI.screen.render_ui_tree = async function (
36231
35441
  api_utils,
36232
35442
  };
36233
35443
 
36234
- const fx = await func.utils.get_plugin_resource(
36235
- SESSION_ID,
36236
- plugin_name,
36237
- `${_plugin.manifest["runtime.mjs"].dist ? "dist/" : ""}runtime.mjs`
36238
- );
35444
+ const fx = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${_plugin.manifest['runtime.mjs'].dist ? 'dist/' : ''}runtime.mjs`);
36239
35445
 
36240
- if (
36241
- _plugin?.manifest?.["runtime.mjs"].dist &&
36242
- _plugin?.manifest?.["runtime.mjs"]?.css
36243
- ) {
36244
- const plugin_runtime_css_url = await func.utils.get_plugin_npm_cdn(
36245
- SESSION_ID,
36246
- plugin_name,
36247
- "dist/runtime.css"
36248
- );
35446
+ if (_plugin?.manifest?.['runtime.mjs'].dist && _plugin?.manifest?.['runtime.mjs']?.css) {
35447
+ const plugin_runtime_css_url = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, 'dist/runtime.css');
36249
35448
  func.utils.load_css_on_demand(plugin_runtime_css_url);
36250
35449
  }
36251
35450
 
@@ -36255,12 +35454,7 @@ func.UI.screen.render_ui_tree = async function (
36255
35454
  try {
36256
35455
  await fx[method](fields, params);
36257
35456
  } catch (err) {
36258
- func.utils.debug_report(
36259
- SESSION_ID,
36260
- `${plugin_name} widget`,
36261
- err.message,
36262
- "E"
36263
- );
35457
+ func.utils.debug_report(SESSION_ID, `${plugin_name} widget`, err.message, 'E');
36264
35458
  }
36265
35459
 
36266
35460
  // glb.lifecycle.plugins[plugin_name] = {
@@ -36283,35 +35477,16 @@ func.UI.screen.render_ui_tree = async function (
36283
35477
  var exist_elm_obj = get_element_info();
36284
35478
  var $div = exist_elm_obj.div;
36285
35479
  if (!exist_elm_obj.div) {
36286
- var $wrapper = $("<div>");
36287
- $div = func.UI.screen.create_container(
36288
- SESSION_ID,
36289
- $root_container,
36290
- nodeP,
36291
- $container,
36292
- paramsP,
36293
- parent_infoP,
36294
- jobNoP,
36295
- keyP,
36296
- parent_nodeP,
36297
- prop,
36298
- null,
36299
- null,
36300
- "div",
36301
- $wrapper,
36302
- ""
36303
- );
35480
+ var $wrapper = $('<div>');
35481
+ $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, 'div', $wrapper, '');
36304
35482
 
36305
35483
  if (paramsP.is_panelP) {
36306
- var id = $div.attr("id");
35484
+ var id = $div.attr('id');
36307
35485
  }
36308
35486
 
36309
35487
  if (!$div) return;
36310
35488
 
36311
- if (
36312
- !REFRESHER_IN_PROGRESS &&
36313
- (paramsP.is_mobile_popover || paramsP.is_mobile_page)
36314
- ) {
35489
+ if (!REFRESHER_IN_PROGRESS && (paramsP.is_mobile_popover || paramsP.is_mobile_page)) {
36315
35490
  close_all_modals();
36316
35491
  }
36317
35492
 
@@ -36321,26 +35496,13 @@ func.UI.screen.render_ui_tree = async function (
36321
35496
  },
36322
35497
  function (e) {
36323
35498
  hover_out();
36324
- }
35499
+ },
36325
35500
  );
36326
35501
  }
36327
35502
 
36328
35503
  const ret = await iterate_child($div, nodeP, null, null, $div);
36329
35504
  if ($container.data().xuAttributes) {
36330
- await func.UI.screen.set_attributes_new(
36331
- SESSION_ID,
36332
- is_skeleton,
36333
- $root_container,
36334
- nodeP,
36335
- $container,
36336
- paramsP,
36337
- parent_infoP,
36338
- jobNoP,
36339
- keyP,
36340
- parent_nodeP,
36341
- $container,
36342
- true
36343
- );
35505
+ await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
36344
35506
  }
36345
35507
 
36346
35508
  $.each($div.data().xuData, function (key, val) {
@@ -36480,25 +35642,12 @@ func.UI.screen.render_ui_tree = async function (
36480
35642
  // }
36481
35643
 
36482
35644
  if (paramsP.screenInfo.properties?.rtl) {
36483
- $div_content.attr("dir", "rtl");
35645
+ $div_content.attr('dir', 'rtl');
36484
35646
  }
36485
35647
 
36486
35648
  return $div;
36487
35649
  };
36488
- await func.UI.screen.set_attributes_new(
36489
- SESSION_ID,
36490
- is_skeleton,
36491
- $root_container,
36492
- nodeP,
36493
- $container,
36494
- paramsP,
36495
- parent_infoP,
36496
- jobNoP,
36497
- keyP,
36498
- parent_nodeP,
36499
- $container,
36500
- true
36501
- );
35650
+ await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
36502
35651
  // var $div_content = $div.children();
36503
35652
 
36504
35653
  // if (continuous_idx !== null || !prop.app_items_per_page) {
@@ -36537,55 +35686,35 @@ func.UI.screen.render_ui_tree = async function (
36537
35686
  return await render_screen_type($div);
36538
35687
  };
36539
35688
 
36540
- if (
36541
- !REFRESHER_IN_PROGRESS &&
36542
- (paramsP.is_mobile_popover || paramsP.is_mobile_page)
36543
- ) {
35689
+ if (!REFRESHER_IN_PROGRESS && (paramsP.is_mobile_popover || paramsP.is_mobile_page)) {
36544
35690
  close_all_modals();
36545
35691
  }
36546
35692
 
36547
35693
  const empty_result = async function () {
36548
- var content = prop.empty_result_content || "";
35694
+ var content = prop.empty_result_content || '';
36549
35695
 
36550
35696
  var res = await func.expression.get(
36551
35697
  SESSION_ID,
36552
35698
  content, // prop["xu-exp:empty_result_content"],
36553
35699
  paramsP.dsSessionP,
36554
- "empty_result_content_EXP",
36555
- _ds.currentRecordId
35700
+ 'empty_result_content_EXP',
35701
+ _ds.currentRecordId,
36556
35702
  );
36557
35703
  content = res.result;
36558
35704
  // }
36559
35705
 
36560
35706
  let empty_result_node = {
36561
- type: "element",
35707
+ type: 'element',
36562
35708
  id: crypto.randomUUID(),
36563
35709
  content,
36564
35710
  // : content || (typeof content === "undefined" && "Empty results"),
36565
- tagName: "div",
35711
+ tagName: 'div',
36566
35712
  attributes: {},
36567
35713
  children: [],
36568
35714
  };
36569
35715
 
36570
- const ret = await func.UI.screen.render_ui_tree(
36571
- SESSION_ID,
36572
- $container,
36573
- empty_result_node,
36574
- parent_infoP,
36575
- paramsP,
36576
- jobNoP,
36577
- null,
36578
- 0,
36579
- null,
36580
- nodeP,
36581
- null,
36582
- $root_container
36583
- );
36584
- await func.events.validate(
36585
- SESSION_ID,
36586
- "record_not_found",
36587
- paramsP.dsSessionP
36588
- );
35716
+ 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);
35717
+ await func.events.validate(SESSION_ID, 'record_not_found', paramsP.dsSessionP);
36589
35718
  return await done(null);
36590
35719
 
36591
35720
  // var text = "";
@@ -36651,29 +35780,10 @@ func.UI.screen.render_ui_tree = async function (
36651
35780
  // }
36652
35781
  ////////
36653
35782
  _ds.currentRecordId = val._ROWID;
36654
- const ret = await iterate_child(
36655
- $div,
36656
- node,
36657
- { continuous_idx },
36658
- null,
36659
- $root_container
36660
- );
35783
+ const ret = await iterate_child($div, node, { continuous_idx }, null, $root_container);
36661
35784
 
36662
35785
  if ($container.data().xuAttributes) {
36663
- await func.UI.screen.set_attributes_new(
36664
- SESSION_ID,
36665
- is_skeleton,
36666
- $root_container,
36667
- nodeP,
36668
- $container,
36669
- paramsP,
36670
- parent_infoP,
36671
- jobNoP,
36672
- keyP,
36673
- parent_nodeP,
36674
- $container,
36675
- true
36676
- );
35786
+ await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
36677
35787
  }
36678
35788
  }
36679
35789
 
@@ -36686,14 +35796,7 @@ func.UI.screen.render_ui_tree = async function (
36686
35796
  }
36687
35797
  var $div_items = $div.data().xuData.node.children;
36688
35798
 
36689
- await func.UI.screen.panel_post_render_handler(
36690
- SESSION_ID,
36691
- $container,
36692
- $new_div,
36693
- nodeP,
36694
- $div,
36695
- jobNoP
36696
- );
35799
+ await func.UI.screen.panel_post_render_handler(SESSION_ID, $container, $new_div, nodeP, $div, jobNoP);
36697
35800
 
36698
35801
  // TO FIX should be timeout
36699
35802
  $container.data().xuData.node.children = $div_items;
@@ -36701,39 +35804,10 @@ func.UI.screen.render_ui_tree = async function (
36701
35804
  return $container;
36702
35805
  };
36703
35806
 
36704
- var $wrapper = $("<div>");
36705
- $div = func.UI.screen.create_container(
36706
- SESSION_ID,
36707
- $root_container,
36708
- nodeP,
36709
- $container,
36710
- paramsP,
36711
- parent_infoP,
36712
- jobNoP,
36713
- keyP,
36714
- parent_nodeP,
36715
- prop,
36716
- null,
36717
- null,
36718
- null,
36719
- $wrapper,
36720
- ""
36721
- );
35807
+ var $wrapper = $('<div>');
35808
+ $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, null, $wrapper, '');
36722
35809
 
36723
- let ret = await func.UI.screen.set_attributes_new(
36724
- SESSION_ID,
36725
- is_skeleton,
36726
- $root_container,
36727
- nodeP,
36728
- $container,
36729
- paramsP,
36730
- parent_infoP,
36731
- jobNoP,
36732
- keyP,
36733
- parent_nodeP,
36734
- $div.clone(true),
36735
- true
36736
- );
35810
+ 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);
36737
35811
  if (ret.abort) {
36738
35812
  // // program null
36739
35813
  // if (ret.program_null) {
@@ -36741,7 +35815,7 @@ func.UI.screen.render_ui_tree = async function (
36741
35815
  // }
36742
35816
 
36743
35817
  // render N
36744
- return (ret.$new_div = $("<template>").append($div));
35818
+ return (ret.$new_div = $('<template>').append($div));
36745
35819
 
36746
35820
  // ret.$new_div = $("<template>").append($div);
36747
35821
  }
@@ -36754,8 +35828,8 @@ func.UI.screen.render_ui_tree = async function (
36754
35828
  const done = async function () {
36755
35829
  return $div;
36756
35830
  };
36757
- if (!element || element === "script") return await done();
36758
- let str = "";
35831
+ if (!element || element === 'script') return await done();
35832
+ let str = '';
36759
35833
  // var $div
36760
35834
  // const draw_svg = function () {
36761
35835
  // const get_tag_str = function (element, prop, val) {
@@ -36797,23 +35871,7 @@ func.UI.screen.render_ui_tree = async function (
36797
35871
  // // return await done();
36798
35872
  // }
36799
35873
 
36800
- var $div = func.UI.screen.create_container(
36801
- SESSION_ID,
36802
- $root_container,
36803
- nodeP,
36804
- $container,
36805
- paramsP,
36806
- parent_infoP,
36807
- jobNoP,
36808
- keyP,
36809
- parent_nodeP,
36810
- prop,
36811
- null,
36812
- null,
36813
- element,
36814
- null,
36815
- str
36816
- );
35874
+ 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);
36817
35875
 
36818
35876
  $div.hover(
36819
35877
  function (e) {
@@ -36821,42 +35879,23 @@ func.UI.screen.render_ui_tree = async function (
36821
35879
  },
36822
35880
  function (e) {
36823
35881
  hover_out();
36824
- }
35882
+ },
36825
35883
  );
36826
35884
 
36827
- let ret = await func.UI.screen.set_attributes_new(
36828
- SESSION_ID,
36829
- is_skeleton,
36830
- $root_container,
36831
- nodeP,
36832
- $container,
36833
- paramsP,
36834
- parent_infoP,
36835
- jobNoP,
36836
- keyP,
36837
- parent_nodeP,
36838
- $div,
36839
- true
36840
- );
35885
+ 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);
36841
35886
  if (ret.abort) return await done();
36842
35887
  // check if iterator made to prevent children render
36843
35888
 
36844
- const ret_iterate_child = await iterate_child(
36845
- $div,
36846
- nodeP,
36847
- parent_infoP,
36848
- null,
36849
- $root_container
36850
- );
35889
+ const ret_iterate_child = await iterate_child($div, nodeP, parent_infoP, null, $root_container);
36851
35890
  return await done();
36852
35891
  };
36853
35892
 
36854
35893
  if (nodeP.content && nodeP.attributes) {
36855
- nodeP.attributes["xu-content"] = nodeP.content;
35894
+ nodeP.attributes['xu-content'] = nodeP.content;
36856
35895
  }
36857
- if (nodeP.tagName === "xu-widget") {
35896
+ if (nodeP.tagName === 'xu-widget') {
36858
35897
  if (is_skeleton) return;
36859
- return await fx["widget"]();
35898
+ return await fx['widget']();
36860
35899
  }
36861
35900
  if (fx[nodeP.tagName]) {
36862
35901
  return await fx[nodeP.tagName]();
@@ -36865,17 +35904,11 @@ func.UI.screen.render_ui_tree = async function (
36865
35904
  return await draw_html_element(nodeP.tagName);
36866
35905
  };
36867
35906
 
36868
- func.UI.screen.refresh_document_changes_for_realtime_update = async function (
36869
- SESSION_ID,
36870
- doc_change
36871
- ) {
35907
+ func.UI.screen.refresh_document_changes_for_realtime_update = async function (SESSION_ID, doc_change) {
36872
35908
  let _session = SESSION_OBJ[SESSION_ID];
36873
35909
  for (const [key, _ds] of Object.entries(_session.DS_GLB)) {
36874
35910
  let prog_obj = await func.utils.VIEWS_OBJ.get(SESSION_ID, _ds.prog_id);
36875
- if (
36876
- prog_obj?.progDataSource?.dataSourceRealtime &&
36877
- prog_obj?.progDataSource?.dataSourceTableId === doc_change.table_id
36878
- ) {
35911
+ if (prog_obj?.progDataSource?.dataSourceRealtime && prog_obj?.progDataSource?.dataSourceTableId === doc_change.table_id) {
36879
35912
  try {
36880
35913
  // disabled in purpose to support create row
36881
35914
 
@@ -36890,7 +35923,7 @@ func.UI.screen.refresh_document_changes_for_realtime_update = async function (
36890
35923
  if (_ds.screen_params.is_panelP) {
36891
35924
  func.UI.screen.refresh_screen(SESSION_ID, null, key);
36892
35925
  } else {
36893
- func.action.execute(SESSION_ID, "act_refresh", _ds, null, null);
35926
+ func.action.execute(SESSION_ID, 'act_refresh', _ds, null, null);
36894
35927
  }
36895
35928
  } catch (err) {
36896
35929
  // console.error(err);