@xuda.io/runtime-bundle 1.0.792 → 1.0.794

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.
@@ -12041,168 +12041,168 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
12041
12041
  }
12042
12042
  };
12043
12043
 
12044
- func.UI.screen.refresh_screen_old = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
12045
- // check the main program
12046
- if (fields_changed_datasource) {
12047
- const _session = SESSION_OBJ[SESSION_ID];
12048
- const _ds = _session.DS_GLB[fields_changed_datasource];
12049
- const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, _ds.prog_id);
12050
- const progDataSource_str = JSON.stringify(prog_doc.progDataSource);
12051
- for (const field_id of fields_changed_arr || []) {
12052
- }
12053
- }
12054
-
12055
- const panels_obj = await func.UI.utils.get_panels_wrapper_from_dom(SESSION_ID, $(SESSION_OBJ[SESSION_ID].root_element), false);
12044
+ // func.UI.screen.refresh_screen_old = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
12045
+ // // check the main program
12046
+ // if (fields_changed_datasource) {
12047
+ // const _session = SESSION_OBJ[SESSION_ID];
12048
+ // const _ds = _session.DS_GLB[fields_changed_datasource];
12049
+ // const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, _ds.prog_id);
12050
+ // const progDataSource_str = JSON.stringify(prog_doc.progDataSource);
12051
+ // for (const field_id of fields_changed_arr || []) {
12052
+ // }
12053
+ // }
12056
12054
 
12057
- for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
12058
- const progDataSource_str = JSON.stringify(panel_val.prog_doc.progDataSource);
12055
+ // const panels_obj = await func.UI.utils.get_panels_wrapper_from_dom(SESSION_ID, $(SESSION_OBJ[SESSION_ID].root_element), false);
12059
12056
 
12060
- var found, refresh_reason, refresh_details;
12061
- if (fields_changed_arr) {
12062
- if (fields_changed_datasource && panel_val._ds.dsSession <= Number(fields_changed_datasource)) {
12063
- continue;
12064
- }
12065
- for (const field_id of fields_changed_arr) {
12066
- // get panel attributes
12067
- const _attributes = panel_val?.panelXuAttributes || {};
12057
+ // for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
12058
+ // const progDataSource_str = JSON.stringify(panel_val.prog_doc.progDataSource);
12068
12059
 
12069
- // detect if program changed
12070
- found = _attributes['xu-exp:program']?.includes('@' + field_id);
12071
-
12072
- if (found) {
12073
- refresh_reason = `program ${_attributes['xu-exp:program']} ${field_id} changed `;
12074
- refresh_details = _attributes;
12075
- break;
12076
- }
12060
+ // var found, refresh_reason, refresh_details;
12061
+ // if (fields_changed_arr) {
12062
+ // if (fields_changed_datasource && panel_val._ds.dsSession <= Number(fields_changed_datasource)) {
12063
+ // continue;
12064
+ // }
12065
+ // for (const field_id of fields_changed_arr) {
12066
+ // // get panel attributes
12067
+ // const _attributes = panel_val?.panelXuAttributes || {};
12077
12068
 
12078
- // _attributes holds also info of parameters in code_in: @code
12079
- // search field changed in panel call send parameters exp
12080
- for (const [attr, value] of Object.entries(_attributes)) {
12081
- const pattern = /xu-exp:(\w+)/;
12082
- const match = attr.match(pattern);
12069
+ // // detect if program changed
12070
+ // found = _attributes['xu-exp:program']?.includes('@' + field_id);
12083
12071
 
12084
- if (!match) {
12085
- // continue if attribute is not expression
12086
- continue;
12087
- }
12088
- // code_in
12089
- const parameter_in_field_id = match?.[1];
12090
- // @code
12091
- if (value.includes(field_id)) {
12092
- // search parameter in field in the target program's progDataSource
12093
- found = progDataSource_str?.includes('@' + parameter_in_field_id);
12072
+ // if (found) {
12073
+ // refresh_reason = `program ${_attributes['xu-exp:program']} ${field_id} changed `;
12074
+ // refresh_details = _attributes;
12075
+ // break;
12076
+ // }
12094
12077
 
12095
- if (found) {
12096
- refresh_reason = `field ${field_id} in progDataSource parameter_in changed`;
12097
- refresh_details = panel_val?.prog_doc?.progDataSource;
12078
+ // // _attributes holds also info of parameters in code_in: @code
12079
+ // // search field changed in panel call send parameters exp
12080
+ // for (const [attr, value] of Object.entries(_attributes)) {
12081
+ // const pattern = /xu-exp:(\w+)/;
12082
+ // const match = attr.match(pattern);
12098
12083
 
12099
- break;
12100
- }
12084
+ // if (!match) {
12085
+ // // continue if attribute is not expression
12086
+ // continue;
12087
+ // }
12088
+ // // code_in
12089
+ // const parameter_in_field_id = match?.[1];
12090
+ // // @code
12091
+ // if (value.includes(field_id)) {
12092
+ // // search parameter in field in the target program's progDataSource
12093
+ // found = progDataSource_str?.includes('@' + parameter_in_field_id);
12094
+
12095
+ // if (found) {
12096
+ // refresh_reason = `field ${field_id} in progDataSource parameter_in changed`;
12097
+ // refresh_details = panel_val?.prog_doc?.progDataSource;
12098
+
12099
+ // break;
12100
+ // }
12101
12101
 
12102
- // found = find_field_in_progUi(prog_doc.progUi, parameter_in_field_id, 'xu-for');
12103
- found = func.UI.find_field_in_progUi_attributes(panel_val.prog_doc.progUi, parameter_in_field_id, 'xu-for').length;
12102
+ // // found = find_field_in_progUi(prog_doc.progUi, parameter_in_field_id, 'xu-for');
12103
+ // found = func.UI.find_field_in_progUi_attributes(panel_val.prog_doc.progUi, parameter_in_field_id, 'xu-for').length;
12104
12104
 
12105
- if (found) {
12106
- refresh_reason = `field ${field_id} in progUi xu-for parameter_in changed`;
12107
- refresh_details = found;
12105
+ // if (found) {
12106
+ // refresh_reason = `field ${field_id} in progUi xu-for parameter_in changed`;
12107
+ // refresh_details = found;
12108
12108
 
12109
- break;
12110
- }
12111
- }
12112
- }
12109
+ // break;
12110
+ // }
12111
+ // }
12112
+ // }
12113
12113
 
12114
- if (found) break;
12114
+ // if (found) break;
12115
12115
 
12116
- // search field changed in the target program's progDataSource // @code
12117
- found = progDataSource_str?.includes('@' + field_id);
12118
- if (found) {
12119
- refresh_reason = `field ${field_id} in progDataSource changed`;
12120
- refresh_details = panel_val?.prog_doc?.progDataSource;
12116
+ // // search field changed in the target program's progDataSource // @code
12117
+ // found = progDataSource_str?.includes('@' + field_id);
12118
+ // if (found) {
12119
+ // refresh_reason = `field ${field_id} in progDataSource changed`;
12120
+ // refresh_details = panel_val?.prog_doc?.progDataSource;
12121
12121
 
12122
- break;
12123
- }
12122
+ // break;
12123
+ // }
12124
12124
 
12125
- found = func.UI.find_field_in_progUi_attributes(panel_val.prog_doc.progUi, field_id, 'xu-for').length;
12126
- if (found) {
12127
- refresh_reason = `field ${field_id} in progUi xu-for changed`;
12128
- refresh_details = found;
12125
+ // found = func.UI.find_field_in_progUi_attributes(panel_val.prog_doc.progUi, field_id, 'xu-for').length;
12126
+ // if (found) {
12127
+ // refresh_reason = `field ${field_id} in progUi xu-for changed`;
12128
+ // refresh_details = found;
12129
12129
 
12130
- break;
12131
- }
12130
+ // break;
12131
+ // }
12132
12132
 
12133
- if (found) {
12134
- break;
12135
- }
12136
- }
12137
- }
12133
+ // if (found) {
12134
+ // break;
12135
+ // }
12136
+ // }
12137
+ // }
12138
12138
 
12139
- if (datasource_changed) {
12140
- if (panel_val._ds.dsSession == datasource_changed) {
12141
- refresh_reason = `panel datasource ${datasource_changed} changed`;
12142
- refresh_details = '';
12139
+ // if (datasource_changed) {
12140
+ // if (panel_val._ds.dsSession == datasource_changed) {
12141
+ // refresh_reason = `panel datasource ${datasource_changed} changed`;
12142
+ // refresh_details = '';
12143
12143
 
12144
- found = true;
12145
- }
12146
- }
12147
- if (found) {
12148
- const _session = SESSION_OBJ[SESSION_ID];
12149
- if (_session.engine_mode === 'live_preview') {
12150
- console.info('========= refresh info ==============');
12151
- console.info('reason:', refresh_reason);
12152
- console.info('details:', refresh_details);
12153
- console.info('panel:', panel_val);
12154
- console.info('=====================================');
12155
- }
12156
- const $div_elm = panel_val.$panel_div;
12157
- const wrapper_data = $div_elm.data();
12144
+ // found = true;
12145
+ // }
12146
+ // }
12147
+ // if (found) {
12148
+ // const _session = SESSION_OBJ[SESSION_ID];
12149
+ // if (_session.engine_mode === 'live_preview') {
12150
+ // console.info('========= refresh info ==============');
12151
+ // console.info('reason:', refresh_reason);
12152
+ // console.info('details:', refresh_details);
12153
+ // console.info('panel:', panel_val);
12154
+ // console.info('=====================================');
12155
+ // }
12156
+ // const $div_elm = panel_val.$panel_div;
12157
+ // const wrapper_data = $div_elm.data();
12158
12158
 
12159
- if (_.isEmpty(wrapper_data)) continue;
12159
+ // if (_.isEmpty(wrapper_data)) continue;
12160
12160
 
12161
- try {
12162
- const ts = Date.now();
12163
- // remove old panel content
12164
- $.each(panel_val.ids, async function (key, val) {
12165
- $("[xu-ui-id='" + val + "']")
12166
- .attr('xu-ui-id', val + ts)
12167
- .removeData();
12168
- });
12161
+ // try {
12162
+ // const ts = Date.now();
12163
+ // // remove old panel content
12164
+ // $.each(panel_val.ids, async function (key, val) {
12165
+ // $("[xu-ui-id='" + val + "']")
12166
+ // .attr('xu-ui-id', val + ts)
12167
+ // .removeData();
12168
+ // });
12169
12169
 
12170
- let refreshed_ds;
12171
- // check if ds exist and deleted by garbage collector
12170
+ // let refreshed_ds;
12171
+ // // check if ds exist and deleted by garbage collector
12172
12172
 
12173
- if (_session.DS_GLB[panel_val._ds.dsSession]) {
12174
- refreshed_ds = panel_val._ds.dsSession;
12175
- }
12176
- for await (const item of wrapper_data.xuData.node_org.children) {
12177
- if (item.tagName !== 'xu-panel') continue;
12173
+ // if (_session.DS_GLB[panel_val._ds.dsSession]) {
12174
+ // refreshed_ds = panel_val._ds.dsSession;
12175
+ // }
12176
+ // for await (const item of wrapper_data.xuData.node_org.children) {
12177
+ // if (item.tagName !== 'xu-panel') continue;
12178
12178
 
12179
- const new_$div = await func.UI.screen.render_ui_tree(
12180
- SESSION_ID,
12181
- $div_elm, // the wrapper
12182
- _.cloneDeep(item), // _.cloneDeep(wrapper_data.xuData.node_org.children[0]), // the xu-panel node
12183
- {},
12184
- wrapper_data.xuData.paramsP, // the wrapper params
12185
- null,
12186
- null,
12187
- wrapper_data.xuData.key, // the wrapper key
12188
- refreshed_ds, // the refreshed_ds
12189
- wrapper_data.xuData.parent_node, // the wrapper parent node
12190
- null,
12191
- wrapper_data.xuData.$root_container, // the wrapper root container
12192
- );
12193
- }
12179
+ // const new_$div = await func.UI.screen.render_ui_tree(
12180
+ // SESSION_ID,
12181
+ // $div_elm, // the wrapper
12182
+ // _.cloneDeep(item), // _.cloneDeep(wrapper_data.xuData.node_org.children[0]), // the xu-panel node
12183
+ // {},
12184
+ // wrapper_data.xuData.paramsP, // the wrapper params
12185
+ // null,
12186
+ // null,
12187
+ // wrapper_data.xuData.key, // the wrapper key
12188
+ // refreshed_ds, // the refreshed_ds
12189
+ // wrapper_data.xuData.parent_node, // the wrapper parent node
12190
+ // null,
12191
+ // wrapper_data.xuData.$root_container, // the wrapper root container
12192
+ // );
12193
+ // }
12194
12194
 
12195
- // remove old panel content
12196
- $.each(panel_val.ids, async function (key, val) {
12197
- $("[xu-ui-id='" + val + ts + "']").remove();
12198
- });
12199
- } catch (error) {
12200
- debugger;
12201
- }
12202
- // continue;
12203
- }
12204
- }
12205
- };
12195
+ // // remove old panel content
12196
+ // $.each(panel_val.ids, async function (key, val) {
12197
+ // $("[xu-ui-id='" + val + ts + "']").remove();
12198
+ // });
12199
+ // } catch (error) {
12200
+ // debugger;
12201
+ // }
12202
+ // // continue;
12203
+ // }
12204
+ // }
12205
+ // };
12206
12206
 
12207
12207
  const get_params_obj_new = async function (SESSION_ID, prog_id, nodeP, dsSession) {
12208
12208
  const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);
@@ -13891,7 +13891,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
13891
13891
 
13892
13892
  var is_mobile = glb.MOBILE_ARR.includes(paramsP.screenInfo.properties?.menuType) ? true : false;
13893
13893
 
13894
- var get_element_info = function () {
13894
+ const get_element_info = function () {
13895
13895
  var ret = {};
13896
13896
  let currentRecordId = _ds?.currentRecordId || '';
13897
13897
 
@@ -14698,7 +14698,40 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
14698
14698
  if (ret.abort || nodeP.tagName === 'svg') return await done();
14699
14699
  // check if iterator made to prevent children render
14700
14700
 
14701
- const ret_iterate_child = await iterate_child($div, nodeP, parent_infoP, null, $root_container);
14701
+ const observer = new IntersectionObserver(
14702
+ function (entries) {
14703
+ entries.forEach((entry) => {
14704
+ if (entry.isIntersecting) {
14705
+ // Element is in viewport - trigger custom event
14706
+ $(entry.target).trigger('inViewport');
14707
+
14708
+ // Optional: stop observing once triggered
14709
+ observer.unobserve(entry.target);
14710
+ }
14711
+ });
14712
+ },
14713
+ {
14714
+ threshold: 0.1, // Trigger when 10% of element is visible
14715
+ },
14716
+ );
14717
+
14718
+ const render_child = async function () {
14719
+ await iterate_child($div, nodeP, parent_infoP, null, $root_container);
14720
+ };
14721
+
14722
+ if (nodeP.id === 'node-265db6bf-67a0-4e15-9cbf-f0c48f56241e') {
14723
+ $div.on('inViewport', function () {
14724
+ console.log('Element is in viewport!');
14725
+ render_child();
14726
+ // $(this).addClass('visible');
14727
+ // Your custom code here
14728
+ });
14729
+ observer.observe($div[0]);
14730
+ } else {
14731
+ await render_child();
14732
+ }
14733
+
14734
+ // const ret_iterate_child = await iterate_child($div, nodeP, parent_infoP, null, $root_container);
14702
14735
  return await done();
14703
14736
  };
14704
14737