@xuda.io/runtime-bundle 1.0.607 → 1.0.609

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.
@@ -8501,40 +8501,40 @@ func.UI.utils.init_ui_framework = async function (SESSION_ID, prog_id) {
8501
8501
  }
8502
8502
  };
8503
8503
  // old
8504
- func.UI.utils.get_panels_from_dom = function (SESSION_ID, ignore_disableAutoRefresh) {
8505
- const $elm = func.UI.utils.find_in_element_data('xuPanelData', $(SESSION_OBJ[SESSION_ID].root_element), 'parent_element_ui_id');
8506
- var panels_obj = {};
8504
+ // func.UI.utils.get_panels_from_dom = function (SESSION_ID, ignore_disableAutoRefresh) {
8505
+ // const $elm = func.UI.utils.find_in_element_data('xuPanelData', $(SESSION_OBJ[SESSION_ID].root_element), 'parent_element_ui_id');
8506
+ // var panels_obj = {};
8507
8507
 
8508
- // set panels_obj
8509
- for (const [elem_key, elem_val] of Object.entries($elm)) {
8510
- if (elem_key === 'length') break;
8511
- var $div = $(elem_val);
8512
- let xuData = $div.data().xuData;
8508
+ // // set panels_obj
8509
+ // for (const [elem_key, elem_val] of Object.entries($elm)) {
8510
+ // if (elem_key === 'length') break;
8511
+ // var $div = $(elem_val);
8512
+ // let xuData = $div.data().xuData;
8513
8513
 
8514
- if (!$div.data().xuPanelData) continue;
8514
+ // if (!$div.data().xuPanelData) continue;
8515
8515
 
8516
- let dsSession = xuData.paramsP.dsSessionP;
8517
- var _session = SESSION_OBJ[SESSION_ID];
8518
- let _ds = _session?.DS_GLB[dsSession];
8519
- if (!_ds) continue;
8516
+ // let dsSession = xuData.paramsP.dsSessionP;
8517
+ // var _session = SESSION_OBJ[SESSION_ID];
8518
+ // let _ds = _session?.DS_GLB[dsSession];
8519
+ // if (!_ds) continue;
8520
8520
 
8521
- if (!ignore_disableAutoRefresh && _ds.tree_obj.disableAutoRefresh) {
8522
- continue;
8523
- }
8521
+ // if (!ignore_disableAutoRefresh && _ds.tree_obj.disableAutoRefresh) {
8522
+ // continue;
8523
+ // }
8524
8524
 
8525
- const parent_element_ui_id = $div.data().xuPanelData.parent_element_ui_id;
8526
- if (!panels_obj[parent_element_ui_id]) {
8527
- panels_obj[parent_element_ui_id] = {
8528
- _ds,
8529
- $div,
8530
- ids: [],
8531
- };
8532
- }
8533
- panels_obj[parent_element_ui_id].ids.push($div.attr('xu-ui-id'));
8534
- }
8525
+ // const parent_element_ui_id = $div.data().xuPanelData.parent_element_ui_id;
8526
+ // if (!panels_obj[parent_element_ui_id]) {
8527
+ // panels_obj[parent_element_ui_id] = {
8528
+ // _ds,
8529
+ // $div,
8530
+ // ids: [],
8531
+ // };
8532
+ // }
8533
+ // panels_obj[parent_element_ui_id].ids.push($div.attr('xu-ui-id'));
8534
+ // }
8535
8535
 
8536
- return panels_obj;
8537
- };
8536
+ // return panels_obj;
8537
+ // };
8538
8538
 
8539
8539
  func.UI.utils.get_panels_wrapper_from_dom = async function (SESSION_ID, $xu_embed_container, ignore_disableAutoRefresh) {
8540
8540
  const $elm = func.UI.utils.find_in_element_data('xuPanelWrapper', $(SESSION_OBJ[SESSION_ID].root_element), 'isWrapper');
@@ -9612,7 +9612,7 @@ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, j
9612
9612
  elem_key: _elem_key,
9613
9613
  elem_val: _elem_val,
9614
9614
  fields_arr,
9615
- xu_for_item_id: elem_val?.$elm?.data().nodeid,
9615
+ xu_for_item_id: elem_val?.$elm?.data().xuData.nodeid,
9616
9616
  };
9617
9617
  await func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'execute_xu_for', obj, new_job, _elem_val.$elm, _elem_val.$elm.data().xuData.paramsP.dsSessionP);
9618
9618
 
@@ -9641,31 +9641,6 @@ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, j
9641
9641
  const _elem_val = { attributes: [], $elm: _$elem };
9642
9642
  if (!_$elem?.length) continue;
9643
9643
 
9644
- // if (!_$elem?.length) {
9645
- // // xu-for may exist in the panel root
9646
- // if (!panel_wrapper_element_ui_id) continue;
9647
-
9648
- // $.each(item.attributes, function (key, val) {
9649
- // _elem_val.attributes.push(key);
9650
- // });
9651
- // // _$elem = $(`[xu-ui-id="${panel_wrapper_element}"]`);
9652
- // await func.UI.worker.add_to_queue(
9653
- // SESSION_ID,
9654
- // 'gui event',
9655
- // 'execute_xu_for',
9656
- // {
9657
- // ui_type: _elem_val.$elm.data().xuData.ui_type,
9658
- // SESSION_ID,
9659
- // elem_key: _elem_key,
9660
- // elem_val: _elem_val,
9661
- // fields_arr,
9662
- // },
9663
- // new_job,
9664
- // _elem_val.$elm,
9665
- // _elem_val.$elm.data().xuData.paramsP.dsSessionP,
9666
- // );
9667
- // }
9668
-
9669
9644
  if (refreshed_ids.includes(_$elem.attr('xu-ui-id'))) break;
9670
9645
 
9671
9646
  $.each(_$elem.data()?.xuAttributes, function (key, val) {
@@ -9703,7 +9678,6 @@ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, j
9703
9678
 
9704
9679
  const $xu_embed_container = $('.xu_embed_container');
9705
9680
  const panels_obj = await func.UI.utils.get_panels_wrapper_from_dom(SESSION_ID, $xu_embed_container, true);
9706
- // let inviable_panels_obj = {};
9707
9681
 
9708
9682
  for await (const field_id of fields_arr) {
9709
9683
  // run root
@@ -9711,29 +9685,12 @@ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, j
9711
9685
  const progUi = $xu_embed_container?.data()?.xuData?.screenInfo?.progUi;
9712
9686
  if (progUi) {
9713
9687
  await iterate_field_in_progUi(progUi, field_id);
9714
- // // find invisible panels
9715
- // const inviable_panels_arr = func.UI.find_field_in_progUi_attributes(progUi, field_id, null, 'xu-panel');
9716
- // console.log('inviable_panels_arr', inviable_panels_arr);
9717
- // let prog_id = elm_node?.attributes?.program;
9718
- // const exp = elm_node?.attributes?.['xu-exp:program'];
9719
- // if (exp) {
9720
- // let exp_ret = await func.expression.get(SESSION_ID, exp, $xu_embed_container?.data()?.xuData?.paramsP?.dsSessionP, 'UI Attr EXP');
9721
- // prog_id = func.UI.screen.fix_val_defaults('program', exp_ret.result);
9722
- // inviable_panels_obj[elm_node.id] = { prog_id };
9723
- // }
9724
9688
  }
9725
9689
  }
9726
9690
  // run panels
9727
9691
  for await (const [panel_wrapper_element_ui_id, panel_val] of Object.entries(panels_obj)) {
9728
- // const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, panel_val.prog_id);
9729
9692
  await iterate_field_in_progUi(panel_val.progUi, field_id);
9730
9693
  }
9731
-
9732
- // // run invisible panels
9733
- // for await (const [parent_element_ui_id, panel_val] of Object.entries(inviable_panels_obj)) {
9734
- // const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, panel_val.prog_id);
9735
- // await iterate_field_in_progUi(prog_doc.progUi, field_id);
9736
- // }
9737
9694
  }
9738
9695
 
9739
9696
  func.events.delete_job(SESSION_ID, jobNoP);
@@ -9751,9 +9708,6 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
9751
9708
 
9752
9709
  var found, refresh_reason, refresh_details;
9753
9710
  if (fields_changed_arr) {
9754
- // if (fields_changed_datasource && panel_val._ds.dsSession < fields_changed_datasource) {
9755
- // continue;
9756
- // }
9757
9711
  if (fields_changed_datasource && panel_val._ds.dsSession <= Number(fields_changed_datasource)) {
9758
9712
  continue;
9759
9713
  }
@@ -9854,43 +9808,43 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
9854
9808
  if (_.isEmpty(wrapper_data)) continue;
9855
9809
 
9856
9810
  try {
9857
- // const panelDivData = panel_val.$panel_div.data().xuPanelWrapper.panelDivData;
9858
9811
  const ts = Date.now();
9859
9812
  // remove old panel content
9860
9813
  $.each(panel_val.ids, async function (key, val) {
9861
9814
  $("[xu-ui-id='" + val + "']")
9862
9815
  .attr('xu-ui-id', val + ts)
9863
9816
  .removeData();
9864
- // .css('filter', 'blur(1px)');
9865
9817
  });
9866
9818
 
9867
9819
  let refreshed_ds;
9868
9820
  // check if ds exist and deleted by garbage collector
9869
9821
 
9870
- // const _session = SESSION_OBJ[SESSION_ID];
9871
9822
  if (_session.DS_GLB[panel_val._ds.dsSession]) {
9872
9823
  refreshed_ds = panel_val._ds.dsSession;
9873
9824
  }
9825
+ for await (item of wrapper_data.xuData.node_org.children) {
9826
+ if (item.tagName !== 'xu-render') continue;
9874
9827
 
9875
- const new_$div = await func.UI.screen.render_ui_tree(
9876
- SESSION_ID,
9877
- $div_elm, // the wrapper
9878
- _.cloneDeep(wrapper_data.xuData.node_org.children[0]), // the xu-panel node
9879
- {},
9880
- wrapper_data.xuData.paramsP, // the wrapper params
9881
- null,
9882
- null,
9883
- wrapper_data.xuData.key, // the wrapper key
9884
- refreshed_ds, // the refreshed_ds
9885
- wrapper_data.xuData.parent_node, // the wrapper parent node
9886
- null,
9887
- wrapper_data.xuData.$root_container, // the wrapper root container
9888
- );
9828
+ const new_$div = await func.UI.screen.render_ui_tree(
9829
+ SESSION_ID,
9830
+ $div_elm, // the wrapper
9831
+ _.cloneDeep(item), // _.cloneDeep(wrapper_data.xuData.node_org.children[0]), // the xu-panel node
9832
+ {},
9833
+ wrapper_data.xuData.paramsP, // the wrapper params
9834
+ null,
9835
+ null,
9836
+ wrapper_data.xuData.key, // the wrapper key
9837
+ refreshed_ds, // the refreshed_ds
9838
+ wrapper_data.xuData.parent_node, // the wrapper parent node
9839
+ null,
9840
+ wrapper_data.xuData.$root_container, // the wrapper root container
9841
+ );
9889
9842
 
9890
- // remove old panel content
9891
- $.each(panel_val.ids, async function (key, val) {
9892
- $("[xu-ui-id='" + val + ts + "']").remove();
9893
- });
9843
+ // remove old panel content
9844
+ $.each(panel_val.ids, async function (key, val) {
9845
+ $("[xu-ui-id='" + val + ts + "']").remove();
9846
+ });
9847
+ }
9894
9848
  } catch (error) {
9895
9849
  debugger;
9896
9850
  }
@@ -9899,86 +9853,86 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
9899
9853
  }
9900
9854
  };
9901
9855
 
9902
- func.UI.screen.refresh_screen_old = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
9903
- const panels_obj = func.UI.utils.get_panels_from_dom(SESSION_ID, false);
9904
-
9905
- for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
9906
- const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, panel_val._ds.prog_id);
9907
- const progDataSource_str = JSON.stringify(prog_doc.progDataSource);
9908
-
9909
- var found;
9910
- if (fields_changed_arr) {
9911
- if (fields_changed_datasource && panel_val._ds.dsSession < fields_changed_datasource) {
9912
- continue;
9913
- }
9914
- for (const field_id of fields_changed_arr) {
9915
- // get panel attributes
9916
- const _attributes = panel_val?.$div?.data()?.xuPanelData?.node?.attributes || {};
9917
-
9918
- // detect if program changed
9919
- found = _attributes['xu-exp:program']?.includes('@' + field_id);
9920
- if (found) break;
9921
-
9922
- // _attributes holds also info of parameters in code_in: @code
9923
- // search field changed in panel call send parameters exp
9924
- for (const [attr, value] of Object.entries(_attributes)) {
9925
- const pattern = /xu-exp:(\w+)/;
9926
- const match = attr.match(pattern);
9856
+ // func.UI.screen.refresh_screen_old = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
9857
+ // const panels_obj = func.UI.utils.get_panels_from_dom(SESSION_ID, false);
9927
9858
 
9928
- if (!match) {
9929
- // continue if attribute is not expression
9930
- continue;
9931
- }
9932
- // code_in
9933
- const parameter_in_field_id = match?.[1];
9934
- // @code
9935
- if (value.includes(field_id)) {
9936
- // search parameter in field in the target program's progDataSource
9937
- found = progDataSource_str?.includes('@' + parameter_in_field_id);
9938
- if (found) break;
9859
+ // for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
9860
+ // const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, panel_val._ds.prog_id);
9861
+ // const progDataSource_str = JSON.stringify(prog_doc.progDataSource);
9939
9862
 
9940
- // found = find_field_in_progUi(prog_doc.progUi, parameter_in_field_id, 'xu-for');
9941
- found = func.UI.find_field_in_progUi_attributes(prog_doc.progUi, parameter_in_field_id, 'xu-for').length;
9942
- if (found) break;
9943
- }
9944
- }
9863
+ // var found;
9864
+ // if (fields_changed_arr) {
9865
+ // if (fields_changed_datasource && panel_val._ds.dsSession < fields_changed_datasource) {
9866
+ // continue;
9867
+ // }
9868
+ // for (const field_id of fields_changed_arr) {
9869
+ // // get panel attributes
9870
+ // const _attributes = panel_val?.$div?.data()?.xuPanelData?.node?.attributes || {};
9871
+
9872
+ // // detect if program changed
9873
+ // found = _attributes['xu-exp:program']?.includes('@' + field_id);
9874
+ // if (found) break;
9875
+
9876
+ // // _attributes holds also info of parameters in code_in: @code
9877
+ // // search field changed in panel call send parameters exp
9878
+ // for (const [attr, value] of Object.entries(_attributes)) {
9879
+ // const pattern = /xu-exp:(\w+)/;
9880
+ // const match = attr.match(pattern);
9881
+
9882
+ // if (!match) {
9883
+ // // continue if attribute is not expression
9884
+ // continue;
9885
+ // }
9886
+ // // code_in
9887
+ // const parameter_in_field_id = match?.[1];
9888
+ // // @code
9889
+ // if (value.includes(field_id)) {
9890
+ // // search parameter in field in the target program's progDataSource
9891
+ // found = progDataSource_str?.includes('@' + parameter_in_field_id);
9892
+ // if (found) break;
9893
+
9894
+ // // found = find_field_in_progUi(prog_doc.progUi, parameter_in_field_id, 'xu-for');
9895
+ // found = func.UI.find_field_in_progUi_attributes(prog_doc.progUi, parameter_in_field_id, 'xu-for').length;
9896
+ // if (found) break;
9897
+ // }
9898
+ // }
9945
9899
 
9946
- if (found) break;
9900
+ // if (found) break;
9947
9901
 
9948
- // search field changed in the target program's progDataSource // @code
9949
- found = progDataSource_str?.includes('@' + field_id);
9950
- if (found) break;
9951
- }
9952
- }
9902
+ // // search field changed in the target program's progDataSource // @code
9903
+ // found = progDataSource_str?.includes('@' + field_id);
9904
+ // if (found) break;
9905
+ // }
9906
+ // }
9953
9907
 
9954
- if (datasource_changed) {
9955
- if (panel_val._ds.dsSession == datasource_changed) {
9956
- found = true;
9957
- }
9958
- }
9959
- if (found) {
9960
- var $div_elm = panel_val.$div
9961
- .parent()
9962
- .parent()
9963
- .find("[xu-ui-id='" + parent_element_ui_id + "']");
9908
+ // if (datasource_changed) {
9909
+ // if (panel_val._ds.dsSession == datasource_changed) {
9910
+ // found = true;
9911
+ // }
9912
+ // }
9913
+ // if (found) {
9914
+ // var $div_elm = panel_val.$div
9915
+ // .parent()
9916
+ // .parent()
9917
+ // .find("[xu-ui-id='" + parent_element_ui_id + "']");
9964
9918
 
9965
- // restore original panel
9966
- try {
9967
- // const $org_panel = panel_val.$div.data().xuPanelData.$panel_div;
9919
+ // // restore original panel
9920
+ // try {
9921
+ // // const $org_panel = panel_val.$div.data().xuPanelData.$panel_div;
9968
9922
 
9969
- 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);
9923
+ // 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);
9970
9924
 
9971
- // remove old panel content
9972
- $.each(panel_val.ids, async function (key, val) {
9973
- $("[xu-ui-id='" + val + "']").remove();
9974
- });
9975
- } catch (error) {
9976
- debugger;
9977
- }
9978
- break;
9979
- }
9980
- }
9981
- };
9925
+ // // remove old panel content
9926
+ // $.each(panel_val.ids, async function (key, val) {
9927
+ // $("[xu-ui-id='" + val + "']").remove();
9928
+ // });
9929
+ // } catch (error) {
9930
+ // debugger;
9931
+ // }
9932
+ // break;
9933
+ // }
9934
+ // }
9935
+ // };
9982
9936
 
9983
9937
  // const get_params_obj = async function (SESSION_ID, prog_id, parameters_obj_inP) {
9984
9938
  // const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);