@xuda.io/runtime-bundle 1.0.405 → 1.0.407

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.
@@ -9064,6 +9064,33 @@ func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
9064
9064
  SYS_GLOBAL_OBJ_REFS[ref_field_id].xu_ui_id = $elm.attr('xu-ui-id');
9065
9065
  }
9066
9066
  };
9067
+
9068
+ func.UI.find_field_in_progUi_attributes = function (progUi, field_id, prop) {
9069
+ let elm_node;
9070
+ const iterate_progUi = function (node) {
9071
+ for (let item of node) {
9072
+ // if (item.tagName === "xu-panel") {
9073
+ if (!_.isEmpty(item.attributes)) {
9074
+ for (const [attr, val] of Object.entries(item.attributes)) {
9075
+ if (attr === `xu-exp:${prop}` || attr === prop) {
9076
+ // found = val.includes('@' + field_id);
9077
+ if (val.includes('@' + field_id)) {
9078
+ elm_node = node;
9079
+ break;
9080
+ }
9081
+ }
9082
+ }
9083
+ }
9084
+ if (elm_node) break;
9085
+
9086
+ if (item.children) {
9087
+ iterate_progUi(item.children);
9088
+ }
9089
+ }
9090
+ };
9091
+ iterate_progUi(progUi);
9092
+ return elm_node;
9093
+ };
9067
9094
  func.events = {};
9068
9095
  func.events.validate = async function (SESSION_ID, triggerP, dsSessionP, eventIdP, sourceP, argumentsP, return_validation_onlyP) {
9069
9096
  var _session = SESSION_OBJ[SESSION_ID];
@@ -11578,6 +11605,9 @@ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, j
11578
11605
  const progUi = $xu_embed_div?.data()?.xuData?.screenInfo?.progUi;
11579
11606
  if (progUi) {
11580
11607
  await iterate_field_in_progUi(progUi, field_id);
11608
+ // find invisible panels
11609
+ const elm_node = func.UI.find_field_in_progUi_attributes(progUi, field_id, 'xu-panel');
11610
+ console.log('elm_node', elm_node);
11581
11611
  }
11582
11612
  }
11583
11613
  // run panels
@@ -11588,45 +11618,40 @@ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, j
11588
11618
  }
11589
11619
  }
11590
11620
 
11591
- // }
11592
-
11593
11621
  func.events.delete_job(SESSION_ID, jobNoP);
11594
11622
  };
11595
11623
 
11596
11624
  func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
11597
- const $elm = func.UI.utils.find_in_element_data('xuPanelData', $(SESSION_OBJ[SESSION_ID].root_element), 'parent_element_ui_id');
11598
- // var panels_obj = {};
11625
+ // const $elm = func.UI.utils.find_in_element_data('xuPanelData', $(SESSION_OBJ[SESSION_ID].root_element), 'parent_element_ui_id');
11626
+
11599
11627
  const panels_obj = func.UI.utils.get_panels_from_dom(SESSION_ID, false);
11600
11628
 
11601
- const find_field_in_progUi = function (progUi, field_id, prop) {
11602
- let found;
11603
- const iterate_progUi = function (node) {
11604
- for (let item of node) {
11605
- // if (item.tagName === "xu-panel") {
11606
- if (!_.isEmpty(item.attributes)) {
11607
- for (const [attr, val] of Object.entries(item.attributes)) {
11608
- if (attr === `xu-exp:${prop}`) {
11609
- found = val.includes('@' + field_id);
11610
- }
11611
- }
11612
- }
11613
- if (found) break;
11614
- // }
11615
- if (item.children) {
11616
- iterate_progUi(item.children);
11617
- }
11618
- }
11619
- };
11620
- iterate_progUi(progUi);
11621
- return found;
11622
- };
11629
+ // const find_field_in_progUi = function (progUi, field_id, prop) {
11630
+ // let found;
11631
+ // const iterate_progUi = function (node) {
11632
+ // for (let item of node) {
11633
+ // // if (item.tagName === "xu-panel") {
11634
+ // if (!_.isEmpty(item.attributes)) {
11635
+ // for (const [attr, val] of Object.entries(item.attributes)) {
11636
+ // if (attr === `xu-exp:${prop}`) {
11637
+ // found = val.includes('@' + field_id);
11638
+ // }
11639
+ // }
11640
+ // }
11641
+ // if (found) break;
11642
+ // // }
11643
+ // if (item.children) {
11644
+ // iterate_progUi(item.children);
11645
+ // }
11646
+ // }
11647
+ // };
11648
+ // iterate_progUi(progUi);
11649
+ // return found;
11650
+ // };
11623
11651
 
11624
11652
  for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
11625
11653
  const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, panel_val._ds.prog_id);
11626
11654
  const progDataSource_str = JSON.stringify(prog_doc.progDataSource);
11627
- // const progUi_str = JSON.stringify(prog_doc.progUi);
11628
-
11629
- // console.log("panel_val", panel_val)
11630
11655
 
11631
11656
  var found;
11632
11657
  if (fields_changed_arr) {
@@ -11646,7 +11671,7 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
11646
11671
  for (const [attr, value] of Object.entries(_attributes)) {
11647
11672
  const pattern = /xu-exp:(\w+)/;
11648
11673
  const match = attr.match(pattern);
11649
- // if (!match && value !== "@" + field_id) {
11674
+
11650
11675
  if (!match) {
11651
11676
  // continue if attribute is not expression
11652
11677
  continue;
@@ -11659,10 +11684,8 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
11659
11684
  found = progDataSource_str?.includes('@' + parameter_in_field_id);
11660
11685
  if (found) break;
11661
11686
 
11662
- // found = progUi_str?.includes("@" + parameter_in_field_id);
11663
- // if (found) return false;
11664
-
11665
- found = find_field_in_progUi(prog_doc.progUi, parameter_in_field_id, 'xu-for');
11687
+ // found = find_field_in_progUi(prog_doc.progUi, parameter_in_field_id, 'xu-for');
11688
+ found = func.UI.find_field_in_progUi_attributes(prog_doc.progUi, parameter_in_field_id, 'xu-for');
11666
11689
  if (found) break;
11667
11690
  }
11668
11691
  }
@@ -11672,12 +11695,6 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
11672
11695
  // search field changed in the target program's progDataSource // @code
11673
11696
  found = progDataSource_str?.includes('@' + field_id);
11674
11697
  if (found) break;
11675
-
11676
- // found = progUi_str?.includes("@" + field_id);
11677
- // if (found) return false;
11678
-
11679
- // found = find_field_in_progUi(prog_doc.progUi, field_id)
11680
- // if (found) break
11681
11698
  }
11682
11699
  }
11683
11700
 
@@ -11694,26 +11711,10 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
11694
11711
 
11695
11712
  // restore original panel
11696
11713
  try {
11697
- const $org_panel = panel_val.$div.data().xuPanelData.$panel_div; //panel_val.$div.clone(true);
11698
-
11699
- // const old_ds = $($org_panel).data().xuData.paramsP.dsSessionP;
11700
- // func.datasource.del(SESSION_ID, old_ds);
11714
+ // const $org_panel = panel_val.$div.data().xuPanelData.$panel_div;
11701
11715
 
11702
11716
  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);
11703
- // const new_$div = await func.UI.screen.render_ui_tree(
11704
- // SESSION_ID,
11705
- // $div_elm,
11706
- // _.cloneDeep(panel_val.$div.data().xuPanelData.node),
11707
- // {},
11708
- // $org_panel.data().xuData.paramsP,
11709
- // null,
11710
- // null,
11711
- // $org_panel.data().xuData.key,
11712
- // null,
11713
- // $org_panel.data().xuData.parent_node,
11714
- // null,
11715
- // $org_panel.data().xuData.$root_container
11716
- // );
11717
+
11717
11718
  // remove old panel content
11718
11719
  $.each(panel_val.ids, async function (key, val) {
11719
11720
  $("[xu-ui-id='" + val + "']").remove();
@@ -11963,14 +11964,6 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
11963
11964
  // Callback function to execute when mutations are observed
11964
11965
  const callback = (mutationList, observer) => {
11965
11966
  func.UI.screen.refresh_xu_attributes(SESSION_ID, [val.value]);
11966
- // return;
11967
- // for (const mutation of mutationList) {
11968
- // if (mutation.type === 'childList') {
11969
- // console.log('A child node has been added or removed.');
11970
- // } else if (mutation.type === 'attributes') {
11971
- // console.log(`The ${mutation.attributeName} attribute was modified.`);
11972
- // }
11973
- // }
11974
11967
  };
11975
11968
 
11976
11969
  // Create an observer instance linked to the callback function
@@ -11979,6 +11972,9 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
11979
11972
  // Start observing the target node for configured mutations
11980
11973
  observer.observe(targetNode, config);
11981
11974
 
11975
+ // Later, you can stop observing
11976
+ // observer.disconnect();
11977
+
11982
11978
  return {};
11983
11979
  },
11984
11980
  'xu-bind': async function ($elm, val) {
@@ -9065,6 +9065,33 @@ func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
9065
9065
  SYS_GLOBAL_OBJ_REFS[ref_field_id].xu_ui_id = $elm.attr('xu-ui-id');
9066
9066
  }
9067
9067
  };
9068
+
9069
+ func.UI.find_field_in_progUi_attributes = function (progUi, field_id, prop) {
9070
+ let elm_node;
9071
+ const iterate_progUi = function (node) {
9072
+ for (let item of node) {
9073
+ // if (item.tagName === "xu-panel") {
9074
+ if (!_.isEmpty(item.attributes)) {
9075
+ for (const [attr, val] of Object.entries(item.attributes)) {
9076
+ if (attr === `xu-exp:${prop}` || attr === prop) {
9077
+ // found = val.includes('@' + field_id);
9078
+ if (val.includes('@' + field_id)) {
9079
+ elm_node = node;
9080
+ break;
9081
+ }
9082
+ }
9083
+ }
9084
+ }
9085
+ if (elm_node) break;
9086
+
9087
+ if (item.children) {
9088
+ iterate_progUi(item.children);
9089
+ }
9090
+ }
9091
+ };
9092
+ iterate_progUi(progUi);
9093
+ return elm_node;
9094
+ };
9068
9095
  func.UI.screen = {};
9069
9096
  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) {
9070
9097
  if (!prog_id) return console.error('program is empty');
@@ -9651,6 +9678,9 @@ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, j
9651
9678
  const progUi = $xu_embed_div?.data()?.xuData?.screenInfo?.progUi;
9652
9679
  if (progUi) {
9653
9680
  await iterate_field_in_progUi(progUi, field_id);
9681
+ // find invisible panels
9682
+ const elm_node = func.UI.find_field_in_progUi_attributes(progUi, field_id, 'xu-panel');
9683
+ console.log('elm_node', elm_node);
9654
9684
  }
9655
9685
  }
9656
9686
  // run panels
@@ -9661,45 +9691,40 @@ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, j
9661
9691
  }
9662
9692
  }
9663
9693
 
9664
- // }
9665
-
9666
9694
  func.events.delete_job(SESSION_ID, jobNoP);
9667
9695
  };
9668
9696
 
9669
9697
  func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
9670
- const $elm = func.UI.utils.find_in_element_data('xuPanelData', $(SESSION_OBJ[SESSION_ID].root_element), 'parent_element_ui_id');
9671
- // var panels_obj = {};
9698
+ // const $elm = func.UI.utils.find_in_element_data('xuPanelData', $(SESSION_OBJ[SESSION_ID].root_element), 'parent_element_ui_id');
9699
+
9672
9700
  const panels_obj = func.UI.utils.get_panels_from_dom(SESSION_ID, false);
9673
9701
 
9674
- const find_field_in_progUi = function (progUi, field_id, prop) {
9675
- let found;
9676
- const iterate_progUi = function (node) {
9677
- for (let item of node) {
9678
- // if (item.tagName === "xu-panel") {
9679
- if (!_.isEmpty(item.attributes)) {
9680
- for (const [attr, val] of Object.entries(item.attributes)) {
9681
- if (attr === `xu-exp:${prop}`) {
9682
- found = val.includes('@' + field_id);
9683
- }
9684
- }
9685
- }
9686
- if (found) break;
9687
- // }
9688
- if (item.children) {
9689
- iterate_progUi(item.children);
9690
- }
9691
- }
9692
- };
9693
- iterate_progUi(progUi);
9694
- return found;
9695
- };
9702
+ // const find_field_in_progUi = function (progUi, field_id, prop) {
9703
+ // let found;
9704
+ // const iterate_progUi = function (node) {
9705
+ // for (let item of node) {
9706
+ // // if (item.tagName === "xu-panel") {
9707
+ // if (!_.isEmpty(item.attributes)) {
9708
+ // for (const [attr, val] of Object.entries(item.attributes)) {
9709
+ // if (attr === `xu-exp:${prop}`) {
9710
+ // found = val.includes('@' + field_id);
9711
+ // }
9712
+ // }
9713
+ // }
9714
+ // if (found) break;
9715
+ // // }
9716
+ // if (item.children) {
9717
+ // iterate_progUi(item.children);
9718
+ // }
9719
+ // }
9720
+ // };
9721
+ // iterate_progUi(progUi);
9722
+ // return found;
9723
+ // };
9696
9724
 
9697
9725
  for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
9698
9726
  const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, panel_val._ds.prog_id);
9699
9727
  const progDataSource_str = JSON.stringify(prog_doc.progDataSource);
9700
- // const progUi_str = JSON.stringify(prog_doc.progUi);
9701
-
9702
- // console.log("panel_val", panel_val)
9703
9728
 
9704
9729
  var found;
9705
9730
  if (fields_changed_arr) {
@@ -9719,7 +9744,7 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
9719
9744
  for (const [attr, value] of Object.entries(_attributes)) {
9720
9745
  const pattern = /xu-exp:(\w+)/;
9721
9746
  const match = attr.match(pattern);
9722
- // if (!match && value !== "@" + field_id) {
9747
+
9723
9748
  if (!match) {
9724
9749
  // continue if attribute is not expression
9725
9750
  continue;
@@ -9732,10 +9757,8 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
9732
9757
  found = progDataSource_str?.includes('@' + parameter_in_field_id);
9733
9758
  if (found) break;
9734
9759
 
9735
- // found = progUi_str?.includes("@" + parameter_in_field_id);
9736
- // if (found) return false;
9737
-
9738
- found = find_field_in_progUi(prog_doc.progUi, parameter_in_field_id, 'xu-for');
9760
+ // found = find_field_in_progUi(prog_doc.progUi, parameter_in_field_id, 'xu-for');
9761
+ found = func.UI.find_field_in_progUi_attributes(prog_doc.progUi, parameter_in_field_id, 'xu-for');
9739
9762
  if (found) break;
9740
9763
  }
9741
9764
  }
@@ -9745,12 +9768,6 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
9745
9768
  // search field changed in the target program's progDataSource // @code
9746
9769
  found = progDataSource_str?.includes('@' + field_id);
9747
9770
  if (found) break;
9748
-
9749
- // found = progUi_str?.includes("@" + field_id);
9750
- // if (found) return false;
9751
-
9752
- // found = find_field_in_progUi(prog_doc.progUi, field_id)
9753
- // if (found) break
9754
9771
  }
9755
9772
  }
9756
9773
 
@@ -9767,26 +9784,10 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
9767
9784
 
9768
9785
  // restore original panel
9769
9786
  try {
9770
- const $org_panel = panel_val.$div.data().xuPanelData.$panel_div; //panel_val.$div.clone(true);
9771
-
9772
- // const old_ds = $($org_panel).data().xuData.paramsP.dsSessionP;
9773
- // func.datasource.del(SESSION_ID, old_ds);
9787
+ // const $org_panel = panel_val.$div.data().xuPanelData.$panel_div;
9774
9788
 
9775
9789
  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);
9776
- // const new_$div = await func.UI.screen.render_ui_tree(
9777
- // SESSION_ID,
9778
- // $div_elm,
9779
- // _.cloneDeep(panel_val.$div.data().xuPanelData.node),
9780
- // {},
9781
- // $org_panel.data().xuData.paramsP,
9782
- // null,
9783
- // null,
9784
- // $org_panel.data().xuData.key,
9785
- // null,
9786
- // $org_panel.data().xuData.parent_node,
9787
- // null,
9788
- // $org_panel.data().xuData.$root_container
9789
- // );
9790
+
9790
9791
  // remove old panel content
9791
9792
  $.each(panel_val.ids, async function (key, val) {
9792
9793
  $("[xu-ui-id='" + val + "']").remove();
@@ -10036,14 +10037,6 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
10036
10037
  // Callback function to execute when mutations are observed
10037
10038
  const callback = (mutationList, observer) => {
10038
10039
  func.UI.screen.refresh_xu_attributes(SESSION_ID, [val.value]);
10039
- // return;
10040
- // for (const mutation of mutationList) {
10041
- // if (mutation.type === 'childList') {
10042
- // console.log('A child node has been added or removed.');
10043
- // } else if (mutation.type === 'attributes') {
10044
- // console.log(`The ${mutation.attributeName} attribute was modified.`);
10045
- // }
10046
- // }
10047
10040
  };
10048
10041
 
10049
10042
  // Create an observer instance linked to the callback function
@@ -10052,6 +10045,9 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
10052
10045
  // Start observing the target node for configured mutations
10053
10046
  observer.observe(targetNode, config);
10054
10047
 
10048
+ // Later, you can stop observing
10049
+ // observer.disconnect();
10050
+
10055
10051
  return {};
10056
10052
  },
10057
10053
  'xu-bind': async function ($elm, val) {