@xuda.io/runtime-bundle 1.0.793 → 1.0.795

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.
@@ -31708,168 +31708,168 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
31708
31708
  }
31709
31709
  };
31710
31710
 
31711
- func.UI.screen.refresh_screen_old = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
31712
- // check the main program
31713
- if (fields_changed_datasource) {
31714
- const _session = SESSION_OBJ[SESSION_ID];
31715
- const _ds = _session.DS_GLB[fields_changed_datasource];
31716
- const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, _ds.prog_id);
31717
- const progDataSource_str = JSON.stringify(prog_doc.progDataSource);
31718
- for (const field_id of fields_changed_arr || []) {
31719
- }
31720
- }
31721
-
31722
- const panels_obj = await func.UI.utils.get_panels_wrapper_from_dom(SESSION_ID, $(SESSION_OBJ[SESSION_ID].root_element), false);
31711
+ // func.UI.screen.refresh_screen_old = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
31712
+ // // check the main program
31713
+ // if (fields_changed_datasource) {
31714
+ // const _session = SESSION_OBJ[SESSION_ID];
31715
+ // const _ds = _session.DS_GLB[fields_changed_datasource];
31716
+ // const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, _ds.prog_id);
31717
+ // const progDataSource_str = JSON.stringify(prog_doc.progDataSource);
31718
+ // for (const field_id of fields_changed_arr || []) {
31719
+ // }
31720
+ // }
31723
31721
 
31724
- for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
31725
- const progDataSource_str = JSON.stringify(panel_val.prog_doc.progDataSource);
31722
+ // const panels_obj = await func.UI.utils.get_panels_wrapper_from_dom(SESSION_ID, $(SESSION_OBJ[SESSION_ID].root_element), false);
31726
31723
 
31727
- var found, refresh_reason, refresh_details;
31728
- if (fields_changed_arr) {
31729
- if (fields_changed_datasource && panel_val._ds.dsSession <= Number(fields_changed_datasource)) {
31730
- continue;
31731
- }
31732
- for (const field_id of fields_changed_arr) {
31733
- // get panel attributes
31734
- const _attributes = panel_val?.panelXuAttributes || {};
31724
+ // for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
31725
+ // const progDataSource_str = JSON.stringify(panel_val.prog_doc.progDataSource);
31735
31726
 
31736
- // detect if program changed
31737
- found = _attributes['xu-exp:program']?.includes('@' + field_id);
31738
-
31739
- if (found) {
31740
- refresh_reason = `program ${_attributes['xu-exp:program']} ${field_id} changed `;
31741
- refresh_details = _attributes;
31742
- break;
31743
- }
31727
+ // var found, refresh_reason, refresh_details;
31728
+ // if (fields_changed_arr) {
31729
+ // if (fields_changed_datasource && panel_val._ds.dsSession <= Number(fields_changed_datasource)) {
31730
+ // continue;
31731
+ // }
31732
+ // for (const field_id of fields_changed_arr) {
31733
+ // // get panel attributes
31734
+ // const _attributes = panel_val?.panelXuAttributes || {};
31744
31735
 
31745
- // _attributes holds also info of parameters in code_in: @code
31746
- // search field changed in panel call send parameters exp
31747
- for (const [attr, value] of Object.entries(_attributes)) {
31748
- const pattern = /xu-exp:(\w+)/;
31749
- const match = attr.match(pattern);
31736
+ // // detect if program changed
31737
+ // found = _attributes['xu-exp:program']?.includes('@' + field_id);
31750
31738
 
31751
- if (!match) {
31752
- // continue if attribute is not expression
31753
- continue;
31754
- }
31755
- // code_in
31756
- const parameter_in_field_id = match?.[1];
31757
- // @code
31758
- if (value.includes(field_id)) {
31759
- // search parameter in field in the target program's progDataSource
31760
- found = progDataSource_str?.includes('@' + parameter_in_field_id);
31739
+ // if (found) {
31740
+ // refresh_reason = `program ${_attributes['xu-exp:program']} ${field_id} changed `;
31741
+ // refresh_details = _attributes;
31742
+ // break;
31743
+ // }
31761
31744
 
31762
- if (found) {
31763
- refresh_reason = `field ${field_id} in progDataSource parameter_in changed`;
31764
- refresh_details = panel_val?.prog_doc?.progDataSource;
31745
+ // // _attributes holds also info of parameters in code_in: @code
31746
+ // // search field changed in panel call send parameters exp
31747
+ // for (const [attr, value] of Object.entries(_attributes)) {
31748
+ // const pattern = /xu-exp:(\w+)/;
31749
+ // const match = attr.match(pattern);
31765
31750
 
31766
- break;
31767
- }
31751
+ // if (!match) {
31752
+ // // continue if attribute is not expression
31753
+ // continue;
31754
+ // }
31755
+ // // code_in
31756
+ // const parameter_in_field_id = match?.[1];
31757
+ // // @code
31758
+ // if (value.includes(field_id)) {
31759
+ // // search parameter in field in the target program's progDataSource
31760
+ // found = progDataSource_str?.includes('@' + parameter_in_field_id);
31761
+
31762
+ // if (found) {
31763
+ // refresh_reason = `field ${field_id} in progDataSource parameter_in changed`;
31764
+ // refresh_details = panel_val?.prog_doc?.progDataSource;
31765
+
31766
+ // break;
31767
+ // }
31768
31768
 
31769
- // found = find_field_in_progUi(prog_doc.progUi, parameter_in_field_id, 'xu-for');
31770
- found = func.UI.find_field_in_progUi_attributes(panel_val.prog_doc.progUi, parameter_in_field_id, 'xu-for').length;
31769
+ // // found = find_field_in_progUi(prog_doc.progUi, parameter_in_field_id, 'xu-for');
31770
+ // found = func.UI.find_field_in_progUi_attributes(panel_val.prog_doc.progUi, parameter_in_field_id, 'xu-for').length;
31771
31771
 
31772
- if (found) {
31773
- refresh_reason = `field ${field_id} in progUi xu-for parameter_in changed`;
31774
- refresh_details = found;
31772
+ // if (found) {
31773
+ // refresh_reason = `field ${field_id} in progUi xu-for parameter_in changed`;
31774
+ // refresh_details = found;
31775
31775
 
31776
- break;
31777
- }
31778
- }
31779
- }
31776
+ // break;
31777
+ // }
31778
+ // }
31779
+ // }
31780
31780
 
31781
- if (found) break;
31781
+ // if (found) break;
31782
31782
 
31783
- // search field changed in the target program's progDataSource // @code
31784
- found = progDataSource_str?.includes('@' + field_id);
31785
- if (found) {
31786
- refresh_reason = `field ${field_id} in progDataSource changed`;
31787
- refresh_details = panel_val?.prog_doc?.progDataSource;
31783
+ // // search field changed in the target program's progDataSource // @code
31784
+ // found = progDataSource_str?.includes('@' + field_id);
31785
+ // if (found) {
31786
+ // refresh_reason = `field ${field_id} in progDataSource changed`;
31787
+ // refresh_details = panel_val?.prog_doc?.progDataSource;
31788
31788
 
31789
- break;
31790
- }
31789
+ // break;
31790
+ // }
31791
31791
 
31792
- found = func.UI.find_field_in_progUi_attributes(panel_val.prog_doc.progUi, field_id, 'xu-for').length;
31793
- if (found) {
31794
- refresh_reason = `field ${field_id} in progUi xu-for changed`;
31795
- refresh_details = found;
31792
+ // found = func.UI.find_field_in_progUi_attributes(panel_val.prog_doc.progUi, field_id, 'xu-for').length;
31793
+ // if (found) {
31794
+ // refresh_reason = `field ${field_id} in progUi xu-for changed`;
31795
+ // refresh_details = found;
31796
31796
 
31797
- break;
31798
- }
31797
+ // break;
31798
+ // }
31799
31799
 
31800
- if (found) {
31801
- break;
31802
- }
31803
- }
31804
- }
31800
+ // if (found) {
31801
+ // break;
31802
+ // }
31803
+ // }
31804
+ // }
31805
31805
 
31806
- if (datasource_changed) {
31807
- if (panel_val._ds.dsSession == datasource_changed) {
31808
- refresh_reason = `panel datasource ${datasource_changed} changed`;
31809
- refresh_details = '';
31806
+ // if (datasource_changed) {
31807
+ // if (panel_val._ds.dsSession == datasource_changed) {
31808
+ // refresh_reason = `panel datasource ${datasource_changed} changed`;
31809
+ // refresh_details = '';
31810
31810
 
31811
- found = true;
31812
- }
31813
- }
31814
- if (found) {
31815
- const _session = SESSION_OBJ[SESSION_ID];
31816
- if (_session.engine_mode === 'live_preview') {
31817
- console.info('========= refresh info ==============');
31818
- console.info('reason:', refresh_reason);
31819
- console.info('details:', refresh_details);
31820
- console.info('panel:', panel_val);
31821
- console.info('=====================================');
31822
- }
31823
- const $div_elm = panel_val.$panel_div;
31824
- const wrapper_data = $div_elm.data();
31811
+ // found = true;
31812
+ // }
31813
+ // }
31814
+ // if (found) {
31815
+ // const _session = SESSION_OBJ[SESSION_ID];
31816
+ // if (_session.engine_mode === 'live_preview') {
31817
+ // console.info('========= refresh info ==============');
31818
+ // console.info('reason:', refresh_reason);
31819
+ // console.info('details:', refresh_details);
31820
+ // console.info('panel:', panel_val);
31821
+ // console.info('=====================================');
31822
+ // }
31823
+ // const $div_elm = panel_val.$panel_div;
31824
+ // const wrapper_data = $div_elm.data();
31825
31825
 
31826
- if (_.isEmpty(wrapper_data)) continue;
31826
+ // if (_.isEmpty(wrapper_data)) continue;
31827
31827
 
31828
- try {
31829
- const ts = Date.now();
31830
- // remove old panel content
31831
- $.each(panel_val.ids, async function (key, val) {
31832
- $("[xu-ui-id='" + val + "']")
31833
- .attr('xu-ui-id', val + ts)
31834
- .removeData();
31835
- });
31828
+ // try {
31829
+ // const ts = Date.now();
31830
+ // // remove old panel content
31831
+ // $.each(panel_val.ids, async function (key, val) {
31832
+ // $("[xu-ui-id='" + val + "']")
31833
+ // .attr('xu-ui-id', val + ts)
31834
+ // .removeData();
31835
+ // });
31836
31836
 
31837
- let refreshed_ds;
31838
- // check if ds exist and deleted by garbage collector
31837
+ // let refreshed_ds;
31838
+ // // check if ds exist and deleted by garbage collector
31839
31839
 
31840
- if (_session.DS_GLB[panel_val._ds.dsSession]) {
31841
- refreshed_ds = panel_val._ds.dsSession;
31842
- }
31843
- for await (const item of wrapper_data.xuData.node_org.children) {
31844
- if (item.tagName !== 'xu-panel') continue;
31840
+ // if (_session.DS_GLB[panel_val._ds.dsSession]) {
31841
+ // refreshed_ds = panel_val._ds.dsSession;
31842
+ // }
31843
+ // for await (const item of wrapper_data.xuData.node_org.children) {
31844
+ // if (item.tagName !== 'xu-panel') continue;
31845
31845
 
31846
- const new_$div = await func.UI.screen.render_ui_tree(
31847
- SESSION_ID,
31848
- $div_elm, // the wrapper
31849
- _.cloneDeep(item), // _.cloneDeep(wrapper_data.xuData.node_org.children[0]), // the xu-panel node
31850
- {},
31851
- wrapper_data.xuData.paramsP, // the wrapper params
31852
- null,
31853
- null,
31854
- wrapper_data.xuData.key, // the wrapper key
31855
- refreshed_ds, // the refreshed_ds
31856
- wrapper_data.xuData.parent_node, // the wrapper parent node
31857
- null,
31858
- wrapper_data.xuData.$root_container, // the wrapper root container
31859
- );
31860
- }
31846
+ // const new_$div = await func.UI.screen.render_ui_tree(
31847
+ // SESSION_ID,
31848
+ // $div_elm, // the wrapper
31849
+ // _.cloneDeep(item), // _.cloneDeep(wrapper_data.xuData.node_org.children[0]), // the xu-panel node
31850
+ // {},
31851
+ // wrapper_data.xuData.paramsP, // the wrapper params
31852
+ // null,
31853
+ // null,
31854
+ // wrapper_data.xuData.key, // the wrapper key
31855
+ // refreshed_ds, // the refreshed_ds
31856
+ // wrapper_data.xuData.parent_node, // the wrapper parent node
31857
+ // null,
31858
+ // wrapper_data.xuData.$root_container, // the wrapper root container
31859
+ // );
31860
+ // }
31861
31861
 
31862
- // remove old panel content
31863
- $.each(panel_val.ids, async function (key, val) {
31864
- $("[xu-ui-id='" + val + ts + "']").remove();
31865
- });
31866
- } catch (error) {
31867
- debugger;
31868
- }
31869
- // continue;
31870
- }
31871
- }
31872
- };
31862
+ // // remove old panel content
31863
+ // $.each(panel_val.ids, async function (key, val) {
31864
+ // $("[xu-ui-id='" + val + ts + "']").remove();
31865
+ // });
31866
+ // } catch (error) {
31867
+ // debugger;
31868
+ // }
31869
+ // // continue;
31870
+ // }
31871
+ // }
31872
+ // };
31873
31873
 
31874
31874
  const get_params_obj_new = async function (SESSION_ID, prog_id, nodeP, dsSession) {
31875
31875
  const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);
@@ -33558,7 +33558,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
33558
33558
 
33559
33559
  var is_mobile = glb.MOBILE_ARR.includes(paramsP.screenInfo.properties?.menuType) ? true : false;
33560
33560
 
33561
- var get_element_info = function () {
33561
+ const get_element_info = function () {
33562
33562
  var ret = {};
33563
33563
  let currentRecordId = _ds?.currentRecordId || '';
33564
33564
 
@@ -34365,7 +34365,40 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
34365
34365
  if (ret.abort || nodeP.tagName === 'svg') return await done();
34366
34366
  // check if iterator made to prevent children render
34367
34367
 
34368
- const ret_iterate_child = await iterate_child($div, nodeP, parent_infoP, null, $root_container);
34368
+ const observer = new IntersectionObserver(
34369
+ function (entries) {
34370
+ entries.forEach((entry) => {
34371
+ if (entry.isIntersecting) {
34372
+ // Element is in viewport - trigger custom event
34373
+ $(entry.target).trigger('inViewport');
34374
+
34375
+ // Optional: stop observing once triggered
34376
+ observer.unobserve(entry.target);
34377
+ }
34378
+ });
34379
+ },
34380
+ {
34381
+ threshold: 0.1, // Trigger when 10% of element is visible
34382
+ },
34383
+ );
34384
+
34385
+ const render_child = async function () {
34386
+ await iterate_child($div, nodeP, parent_infoP, null, $root_container);
34387
+ };
34388
+
34389
+ if (nodeP.id === 'node-e107d5f5-c0a9-4931-9a74-7c13c300f455') {
34390
+ $div.on('inViewport', function () {
34391
+ console.log('Element is in viewport!');
34392
+ render_child();
34393
+ // $(this).addClass('visible');
34394
+ // Your custom code here
34395
+ });
34396
+ observer.observe($div[0]);
34397
+ } else {
34398
+ await render_child();
34399
+ }
34400
+
34401
+ // const ret_iterate_child = await iterate_child($div, nodeP, parent_infoP, null, $root_container);
34369
34402
  return await done();
34370
34403
  };
34371
34404