@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.
@@ -28246,6 +28246,33 @@ func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
28246
28246
  SYS_GLOBAL_OBJ_REFS[ref_field_id].xu_ui_id = $elm.attr('xu-ui-id');
28247
28247
  }
28248
28248
  };
28249
+
28250
+ func.UI.find_field_in_progUi_attributes = function (progUi, field_id, prop) {
28251
+ let elm_node;
28252
+ const iterate_progUi = function (node) {
28253
+ for (let item of node) {
28254
+ // if (item.tagName === "xu-panel") {
28255
+ if (!_.isEmpty(item.attributes)) {
28256
+ for (const [attr, val] of Object.entries(item.attributes)) {
28257
+ if (attr === `xu-exp:${prop}` || attr === prop) {
28258
+ // found = val.includes('@' + field_id);
28259
+ if (val.includes('@' + field_id)) {
28260
+ elm_node = node;
28261
+ break;
28262
+ }
28263
+ }
28264
+ }
28265
+ }
28266
+ if (elm_node) break;
28267
+
28268
+ if (item.children) {
28269
+ iterate_progUi(item.children);
28270
+ }
28271
+ }
28272
+ };
28273
+ iterate_progUi(progUi);
28274
+ return elm_node;
28275
+ };
28249
28276
  func.datasource = {};
28250
28277
  func.datasource.create = async function (
28251
28278
  SESSION_ID,
@@ -31610,6 +31637,9 @@ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, j
31610
31637
  const progUi = $xu_embed_div?.data()?.xuData?.screenInfo?.progUi;
31611
31638
  if (progUi) {
31612
31639
  await iterate_field_in_progUi(progUi, field_id);
31640
+ // find invisible panels
31641
+ const elm_node = func.UI.find_field_in_progUi_attributes(progUi, field_id, 'xu-panel');
31642
+ console.log('elm_node', elm_node);
31613
31643
  }
31614
31644
  }
31615
31645
  // run panels
@@ -31620,45 +31650,40 @@ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, j
31620
31650
  }
31621
31651
  }
31622
31652
 
31623
- // }
31624
-
31625
31653
  func.events.delete_job(SESSION_ID, jobNoP);
31626
31654
  };
31627
31655
 
31628
31656
  func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
31629
- const $elm = func.UI.utils.find_in_element_data('xuPanelData', $(SESSION_OBJ[SESSION_ID].root_element), 'parent_element_ui_id');
31630
- // var panels_obj = {};
31657
+ // const $elm = func.UI.utils.find_in_element_data('xuPanelData', $(SESSION_OBJ[SESSION_ID].root_element), 'parent_element_ui_id');
31658
+
31631
31659
  const panels_obj = func.UI.utils.get_panels_from_dom(SESSION_ID, false);
31632
31660
 
31633
- const find_field_in_progUi = function (progUi, field_id, prop) {
31634
- let found;
31635
- const iterate_progUi = function (node) {
31636
- for (let item of node) {
31637
- // if (item.tagName === "xu-panel") {
31638
- if (!_.isEmpty(item.attributes)) {
31639
- for (const [attr, val] of Object.entries(item.attributes)) {
31640
- if (attr === `xu-exp:${prop}`) {
31641
- found = val.includes('@' + field_id);
31642
- }
31643
- }
31644
- }
31645
- if (found) break;
31646
- // }
31647
- if (item.children) {
31648
- iterate_progUi(item.children);
31649
- }
31650
- }
31651
- };
31652
- iterate_progUi(progUi);
31653
- return found;
31654
- };
31661
+ // const find_field_in_progUi = function (progUi, field_id, prop) {
31662
+ // let found;
31663
+ // const iterate_progUi = function (node) {
31664
+ // for (let item of node) {
31665
+ // // if (item.tagName === "xu-panel") {
31666
+ // if (!_.isEmpty(item.attributes)) {
31667
+ // for (const [attr, val] of Object.entries(item.attributes)) {
31668
+ // if (attr === `xu-exp:${prop}`) {
31669
+ // found = val.includes('@' + field_id);
31670
+ // }
31671
+ // }
31672
+ // }
31673
+ // if (found) break;
31674
+ // // }
31675
+ // if (item.children) {
31676
+ // iterate_progUi(item.children);
31677
+ // }
31678
+ // }
31679
+ // };
31680
+ // iterate_progUi(progUi);
31681
+ // return found;
31682
+ // };
31655
31683
 
31656
31684
  for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
31657
31685
  const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, panel_val._ds.prog_id);
31658
31686
  const progDataSource_str = JSON.stringify(prog_doc.progDataSource);
31659
- // const progUi_str = JSON.stringify(prog_doc.progUi);
31660
-
31661
- // console.log("panel_val", panel_val)
31662
31687
 
31663
31688
  var found;
31664
31689
  if (fields_changed_arr) {
@@ -31678,7 +31703,7 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
31678
31703
  for (const [attr, value] of Object.entries(_attributes)) {
31679
31704
  const pattern = /xu-exp:(\w+)/;
31680
31705
  const match = attr.match(pattern);
31681
- // if (!match && value !== "@" + field_id) {
31706
+
31682
31707
  if (!match) {
31683
31708
  // continue if attribute is not expression
31684
31709
  continue;
@@ -31691,10 +31716,8 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
31691
31716
  found = progDataSource_str?.includes('@' + parameter_in_field_id);
31692
31717
  if (found) break;
31693
31718
 
31694
- // found = progUi_str?.includes("@" + parameter_in_field_id);
31695
- // if (found) return false;
31696
-
31697
- found = find_field_in_progUi(prog_doc.progUi, parameter_in_field_id, 'xu-for');
31719
+ // found = find_field_in_progUi(prog_doc.progUi, parameter_in_field_id, 'xu-for');
31720
+ found = func.UI.find_field_in_progUi_attributes(prog_doc.progUi, parameter_in_field_id, 'xu-for');
31698
31721
  if (found) break;
31699
31722
  }
31700
31723
  }
@@ -31704,12 +31727,6 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
31704
31727
  // search field changed in the target program's progDataSource // @code
31705
31728
  found = progDataSource_str?.includes('@' + field_id);
31706
31729
  if (found) break;
31707
-
31708
- // found = progUi_str?.includes("@" + field_id);
31709
- // if (found) return false;
31710
-
31711
- // found = find_field_in_progUi(prog_doc.progUi, field_id)
31712
- // if (found) break
31713
31730
  }
31714
31731
  }
31715
31732
 
@@ -31726,26 +31743,10 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
31726
31743
 
31727
31744
  // restore original panel
31728
31745
  try {
31729
- const $org_panel = panel_val.$div.data().xuPanelData.$panel_div; //panel_val.$div.clone(true);
31730
-
31731
- // const old_ds = $($org_panel).data().xuData.paramsP.dsSessionP;
31732
- // func.datasource.del(SESSION_ID, old_ds);
31746
+ // const $org_panel = panel_val.$div.data().xuPanelData.$panel_div;
31733
31747
 
31734
31748
  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);
31735
- // const new_$div = await func.UI.screen.render_ui_tree(
31736
- // SESSION_ID,
31737
- // $div_elm,
31738
- // _.cloneDeep(panel_val.$div.data().xuPanelData.node),
31739
- // {},
31740
- // $org_panel.data().xuData.paramsP,
31741
- // null,
31742
- // null,
31743
- // $org_panel.data().xuData.key,
31744
- // null,
31745
- // $org_panel.data().xuData.parent_node,
31746
- // null,
31747
- // $org_panel.data().xuData.$root_container
31748
- // );
31749
+
31749
31750
  // remove old panel content
31750
31751
  $.each(panel_val.ids, async function (key, val) {
31751
31752
  $("[xu-ui-id='" + val + "']").remove();
@@ -31995,14 +31996,6 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
31995
31996
  // Callback function to execute when mutations are observed
31996
31997
  const callback = (mutationList, observer) => {
31997
31998
  func.UI.screen.refresh_xu_attributes(SESSION_ID, [val.value]);
31998
- // return;
31999
- // for (const mutation of mutationList) {
32000
- // if (mutation.type === 'childList') {
32001
- // console.log('A child node has been added or removed.');
32002
- // } else if (mutation.type === 'attributes') {
32003
- // console.log(`The ${mutation.attributeName} attribute was modified.`);
32004
- // }
32005
- // }
32006
31999
  };
32007
32000
 
32008
32001
  // Create an observer instance linked to the callback function
@@ -32011,6 +32004,9 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
32011
32004
  // Start observing the target node for configured mutations
32012
32005
  observer.observe(targetNode, config);
32013
32006
 
32007
+ // Later, you can stop observing
32008
+ // observer.disconnect();
32009
+
32014
32010
  return {};
32015
32011
  },
32016
32012
  'xu-bind': async function ($elm, val) {