@xuda.io/runtime-bundle 1.0.715 → 1.0.716
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.
- package/js/xuda-runtime-bundle.js +205 -206
- package/js/xuda-runtime-bundle.min.js +1 -1
- package/js/xuda-runtime-slim.js +202 -203
- package/js/xuda-runtime-slim.min.es.js +202 -203
- package/js/xuda-runtime-slim.min.js +1 -1
- package/package.json +1 -1
|
@@ -31469,7 +31469,7 @@ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, j
|
|
|
31469
31469
|
}
|
|
31470
31470
|
};
|
|
31471
31471
|
|
|
31472
|
-
func.UI.screen.
|
|
31472
|
+
func.UI.screen.refresh_screen_bad = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
|
|
31473
31473
|
var found, refresh_reason, refresh_details;
|
|
31474
31474
|
const validate_change = function (prog_doc, panelXuAttributes, skip_ui_check) {
|
|
31475
31475
|
found = null;
|
|
@@ -31551,71 +31551,71 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
|
|
|
31551
31551
|
}
|
|
31552
31552
|
};
|
|
31553
31553
|
|
|
31554
|
-
//
|
|
31555
|
-
|
|
31556
|
-
|
|
31557
|
-
|
|
31558
|
-
|
|
31559
|
-
|
|
31560
|
-
|
|
31561
|
-
|
|
31562
|
-
|
|
31563
|
-
|
|
31564
|
-
|
|
31565
|
-
|
|
31566
|
-
|
|
31567
|
-
|
|
31568
|
-
|
|
31569
|
-
|
|
31570
|
-
|
|
31571
|
-
|
|
31572
|
-
|
|
31573
|
-
|
|
31574
|
-
|
|
31575
|
-
|
|
31576
|
-
|
|
31577
|
-
|
|
31578
|
-
|
|
31579
|
-
|
|
31580
|
-
|
|
31581
|
-
|
|
31582
|
-
|
|
31583
|
-
|
|
31584
|
-
|
|
31585
|
-
|
|
31586
|
-
|
|
31587
|
-
|
|
31588
|
-
|
|
31589
|
-
|
|
31590
|
-
|
|
31591
|
-
|
|
31592
|
-
|
|
31593
|
-
|
|
31594
|
-
|
|
31595
|
-
|
|
31596
|
-
|
|
31597
|
-
|
|
31598
|
-
|
|
31599
|
-
|
|
31600
|
-
|
|
31601
|
-
|
|
31602
|
-
|
|
31603
|
-
|
|
31604
|
-
|
|
31605
|
-
|
|
31606
|
-
|
|
31607
|
-
|
|
31608
|
-
|
|
31609
|
-
|
|
31610
|
-
|
|
31611
|
-
|
|
31612
|
-
|
|
31613
|
-
|
|
31614
|
-
|
|
31615
|
-
|
|
31616
|
-
|
|
31617
|
-
|
|
31618
|
-
|
|
31554
|
+
// check the main program
|
|
31555
|
+
if (fields_changed_datasource) {
|
|
31556
|
+
const _session = SESSION_OBJ[SESSION_ID];
|
|
31557
|
+
const _ds = _session.DS_GLB[fields_changed_datasource];
|
|
31558
|
+
const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
31559
|
+
if (prog_doc.progUi) {
|
|
31560
|
+
validate_change(prog_doc, null, true);
|
|
31561
|
+
if (found) {
|
|
31562
|
+
const $elm = $(`#container_${_ds.prog_id}_0`);
|
|
31563
|
+
if ($elm?.length) {
|
|
31564
|
+
const elm_data = $elm.data();
|
|
31565
|
+
const $wrapper = $elm.parent();
|
|
31566
|
+
// const wrapper_data = $wrapper.data();
|
|
31567
|
+
const refreshed_ds = _ds.dsSession;
|
|
31568
|
+
|
|
31569
|
+
// let elm_to_delete = [];
|
|
31570
|
+
// const ts = Date.now();
|
|
31571
|
+
// $.each($elm.find('xu-root-component-' + SESSION_ID).find('*'), function (key, val) {
|
|
31572
|
+
// let xu_ui_id = $(val).attr('xu-ui-id');
|
|
31573
|
+
// if (xu_ui_id) {
|
|
31574
|
+
// let new_id = xu_ui_id + ts;
|
|
31575
|
+
// elm_to_delete.push(new_id);
|
|
31576
|
+
|
|
31577
|
+
// $(val).attr('xu-ui-id', new_id).removeData();
|
|
31578
|
+
// }
|
|
31579
|
+
// // else {
|
|
31580
|
+
// // $(val).remove();
|
|
31581
|
+
// // }
|
|
31582
|
+
// });
|
|
31583
|
+
|
|
31584
|
+
$elm.empty();
|
|
31585
|
+
if ($elm.data()) {
|
|
31586
|
+
const new_$div = await func.UI.screen.render_ui_tree(
|
|
31587
|
+
SESSION_ID,
|
|
31588
|
+
$elm, // the wrapper
|
|
31589
|
+
_.cloneDeep($elm.data().xuData.node), // the xu-panel node
|
|
31590
|
+
{},
|
|
31591
|
+
elm_data.xuData.paramsP, // the wrapper params
|
|
31592
|
+
null,
|
|
31593
|
+
null,
|
|
31594
|
+
elm_data.xuData.key, // the wrapper key
|
|
31595
|
+
refreshed_ds, // the refreshed_ds
|
|
31596
|
+
elm_data.xuData.parent_node, // the wrapper parent node
|
|
31597
|
+
null,
|
|
31598
|
+
elm_data.xuData.$root_container, // the wrapper root container
|
|
31599
|
+
);
|
|
31600
|
+
|
|
31601
|
+
// // remove old screen content
|
|
31602
|
+
// $.each(elm_to_delete, async function (key, val) {
|
|
31603
|
+
// $("[xu-ui-id='" + elm_to_delete + "']").remove();
|
|
31604
|
+
// });
|
|
31605
|
+
|
|
31606
|
+
if (_session.engine_mode === 'live_preview') {
|
|
31607
|
+
console.info('========= refresh main info ==============');
|
|
31608
|
+
console.info('reason:', refresh_reason);
|
|
31609
|
+
console.info('element:', $elm);
|
|
31610
|
+
console.info('==========================================');
|
|
31611
|
+
}
|
|
31612
|
+
|
|
31613
|
+
return;
|
|
31614
|
+
}
|
|
31615
|
+
}
|
|
31616
|
+
}
|
|
31617
|
+
}
|
|
31618
|
+
}
|
|
31619
31619
|
|
|
31620
31620
|
const panels_obj = await func.UI.utils.get_panels_wrapper_from_dom(SESSION_ID, $(SESSION_OBJ[SESSION_ID].root_element), false);
|
|
31621
31621
|
|
|
@@ -31697,169 +31697,168 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
|
|
|
31697
31697
|
}
|
|
31698
31698
|
};
|
|
31699
31699
|
|
|
31700
|
-
|
|
31701
|
-
//
|
|
31702
|
-
|
|
31703
|
-
|
|
31704
|
-
|
|
31705
|
-
|
|
31706
|
-
|
|
31707
|
-
|
|
31700
|
+
func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
|
|
31701
|
+
// check the main program
|
|
31702
|
+
if (fields_changed_datasource) {
|
|
31703
|
+
const _session = SESSION_OBJ[SESSION_ID];
|
|
31704
|
+
const _ds = _session.DS_GLB[fields_changed_datasource];
|
|
31705
|
+
const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
31706
|
+
const progDataSource_str = JSON.stringify(prog_doc.progDataSource);
|
|
31707
|
+
for (const field_id of fields_changed_arr || []) {
|
|
31708
|
+
}
|
|
31709
|
+
}
|
|
31708
31710
|
|
|
31709
|
-
|
|
31710
|
-
// }
|
|
31711
|
+
const panels_obj = await func.UI.utils.get_panels_wrapper_from_dom(SESSION_ID, $(SESSION_OBJ[SESSION_ID].root_element), false);
|
|
31711
31712
|
|
|
31712
|
-
|
|
31713
|
+
for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
|
|
31714
|
+
const progDataSource_str = JSON.stringify(panel_val.prog_doc.progDataSource);
|
|
31713
31715
|
|
|
31714
|
-
|
|
31715
|
-
|
|
31716
|
+
var found, refresh_reason, refresh_details;
|
|
31717
|
+
if (fields_changed_arr) {
|
|
31718
|
+
if (fields_changed_datasource && panel_val._ds.dsSession <= Number(fields_changed_datasource)) {
|
|
31719
|
+
continue;
|
|
31720
|
+
}
|
|
31721
|
+
for (const field_id of fields_changed_arr) {
|
|
31722
|
+
// get panel attributes
|
|
31723
|
+
const _attributes = panel_val?.panelXuAttributes || {};
|
|
31716
31724
|
|
|
31717
|
-
//
|
|
31718
|
-
|
|
31719
|
-
// if (fields_changed_datasource && panel_val._ds.dsSession <= Number(fields_changed_datasource)) {
|
|
31720
|
-
// continue;
|
|
31721
|
-
// }
|
|
31722
|
-
// for (const field_id of fields_changed_arr) {
|
|
31723
|
-
// // get panel attributes
|
|
31724
|
-
// const _attributes = panel_val?.panelXuAttributes || {};
|
|
31725
|
+
// detect if program changed
|
|
31726
|
+
found = _attributes['xu-exp:program']?.includes('@' + field_id);
|
|
31725
31727
|
|
|
31726
|
-
|
|
31727
|
-
|
|
31728
|
+
if (found) {
|
|
31729
|
+
refresh_reason = `program ${_attributes['xu-exp:program']} ${field_id} changed `;
|
|
31730
|
+
refresh_details = _attributes;
|
|
31731
|
+
break;
|
|
31732
|
+
}
|
|
31728
31733
|
|
|
31729
|
-
//
|
|
31730
|
-
//
|
|
31731
|
-
|
|
31732
|
-
|
|
31733
|
-
|
|
31734
|
+
// _attributes holds also info of parameters in code_in: @code
|
|
31735
|
+
// search field changed in panel call send parameters exp
|
|
31736
|
+
for (const [attr, value] of Object.entries(_attributes)) {
|
|
31737
|
+
const pattern = /xu-exp:(\w+)/;
|
|
31738
|
+
const match = attr.match(pattern);
|
|
31734
31739
|
|
|
31735
|
-
|
|
31736
|
-
//
|
|
31737
|
-
|
|
31738
|
-
|
|
31739
|
-
//
|
|
31740
|
+
if (!match) {
|
|
31741
|
+
// continue if attribute is not expression
|
|
31742
|
+
continue;
|
|
31743
|
+
}
|
|
31744
|
+
// code_in
|
|
31745
|
+
const parameter_in_field_id = match?.[1];
|
|
31746
|
+
// @code
|
|
31747
|
+
if (value.includes(field_id)) {
|
|
31748
|
+
// search parameter in field in the target program's progDataSource
|
|
31749
|
+
found = progDataSource_str?.includes('@' + parameter_in_field_id);
|
|
31740
31750
|
|
|
31741
|
-
|
|
31742
|
-
|
|
31743
|
-
|
|
31744
|
-
// }
|
|
31745
|
-
// // code_in
|
|
31746
|
-
// const parameter_in_field_id = match?.[1];
|
|
31747
|
-
// // @code
|
|
31748
|
-
// if (value.includes(field_id)) {
|
|
31749
|
-
// // search parameter in field in the target program's progDataSource
|
|
31750
|
-
// found = progDataSource_str?.includes('@' + parameter_in_field_id);
|
|
31751
|
-
|
|
31752
|
-
// if (found) {
|
|
31753
|
-
// refresh_reason = `field ${field_id} in progDataSource parameter_in changed`;
|
|
31754
|
-
// refresh_details = panel_val?.prog_doc?.progDataSource;
|
|
31755
|
-
|
|
31756
|
-
// break;
|
|
31757
|
-
// }
|
|
31751
|
+
if (found) {
|
|
31752
|
+
refresh_reason = `field ${field_id} in progDataSource parameter_in changed`;
|
|
31753
|
+
refresh_details = panel_val?.prog_doc?.progDataSource;
|
|
31758
31754
|
|
|
31759
|
-
|
|
31760
|
-
|
|
31755
|
+
break;
|
|
31756
|
+
}
|
|
31761
31757
|
|
|
31762
|
-
//
|
|
31763
|
-
|
|
31764
|
-
// refresh_details = found;
|
|
31758
|
+
// found = find_field_in_progUi(prog_doc.progUi, parameter_in_field_id, 'xu-for');
|
|
31759
|
+
found = func.UI.find_field_in_progUi_attributes(panel_val.prog_doc.progUi, parameter_in_field_id, 'xu-for').length;
|
|
31765
31760
|
|
|
31766
|
-
|
|
31767
|
-
|
|
31768
|
-
|
|
31769
|
-
|
|
31761
|
+
if (found) {
|
|
31762
|
+
refresh_reason = `field ${field_id} in progUi xu-for parameter_in changed`;
|
|
31763
|
+
refresh_details = found;
|
|
31764
|
+
|
|
31765
|
+
break;
|
|
31766
|
+
}
|
|
31767
|
+
}
|
|
31768
|
+
}
|
|
31770
31769
|
|
|
31771
|
-
|
|
31770
|
+
if (found) break;
|
|
31772
31771
|
|
|
31773
|
-
//
|
|
31774
|
-
|
|
31775
|
-
|
|
31776
|
-
|
|
31777
|
-
|
|
31772
|
+
// search field changed in the target program's progDataSource // @code
|
|
31773
|
+
found = progDataSource_str?.includes('@' + field_id);
|
|
31774
|
+
if (found) {
|
|
31775
|
+
refresh_reason = `field ${field_id} in progDataSource changed`;
|
|
31776
|
+
refresh_details = panel_val?.prog_doc?.progDataSource;
|
|
31778
31777
|
|
|
31779
|
-
|
|
31780
|
-
|
|
31778
|
+
break;
|
|
31779
|
+
}
|
|
31781
31780
|
|
|
31782
|
-
|
|
31783
|
-
|
|
31784
|
-
|
|
31785
|
-
|
|
31781
|
+
found = func.UI.find_field_in_progUi_attributes(panel_val.prog_doc.progUi, field_id, 'xu-for').length;
|
|
31782
|
+
if (found) {
|
|
31783
|
+
refresh_reason = `field ${field_id} in progUi xu-for changed`;
|
|
31784
|
+
refresh_details = found;
|
|
31786
31785
|
|
|
31787
|
-
|
|
31788
|
-
|
|
31786
|
+
break;
|
|
31787
|
+
}
|
|
31789
31788
|
|
|
31790
|
-
|
|
31791
|
-
|
|
31792
|
-
|
|
31793
|
-
|
|
31794
|
-
|
|
31789
|
+
if (found) {
|
|
31790
|
+
break;
|
|
31791
|
+
}
|
|
31792
|
+
}
|
|
31793
|
+
}
|
|
31795
31794
|
|
|
31796
|
-
|
|
31797
|
-
|
|
31798
|
-
|
|
31799
|
-
|
|
31795
|
+
if (datasource_changed) {
|
|
31796
|
+
if (panel_val._ds.dsSession == datasource_changed) {
|
|
31797
|
+
refresh_reason = `panel datasource ${datasource_changed} changed`;
|
|
31798
|
+
refresh_details = '';
|
|
31800
31799
|
|
|
31801
|
-
|
|
31802
|
-
|
|
31803
|
-
|
|
31804
|
-
|
|
31805
|
-
|
|
31806
|
-
|
|
31807
|
-
|
|
31808
|
-
|
|
31809
|
-
|
|
31810
|
-
|
|
31811
|
-
|
|
31812
|
-
|
|
31813
|
-
|
|
31814
|
-
|
|
31815
|
-
|
|
31816
|
-
// if (_.isEmpty(wrapper_data)) continue;
|
|
31817
|
-
|
|
31818
|
-
// try {
|
|
31819
|
-
// const ts = Date.now();
|
|
31820
|
-
// // remove old panel content
|
|
31821
|
-
// $.each(panel_val.ids, async function (key, val) {
|
|
31822
|
-
// $("[xu-ui-id='" + val + "']")
|
|
31823
|
-
// .attr('xu-ui-id', val + ts)
|
|
31824
|
-
// .removeData();
|
|
31825
|
-
// });
|
|
31800
|
+
found = true;
|
|
31801
|
+
}
|
|
31802
|
+
}
|
|
31803
|
+
if (found) {
|
|
31804
|
+
const _session = SESSION_OBJ[SESSION_ID];
|
|
31805
|
+
if (_session.engine_mode === 'live_preview') {
|
|
31806
|
+
console.info('========= refresh info ==============');
|
|
31807
|
+
console.info('reason:', refresh_reason);
|
|
31808
|
+
console.info('details:', refresh_details);
|
|
31809
|
+
console.info('panel:', panel_val);
|
|
31810
|
+
console.info('=====================================');
|
|
31811
|
+
}
|
|
31812
|
+
const $div_elm = panel_val.$panel_div;
|
|
31813
|
+
const wrapper_data = $div_elm.data();
|
|
31826
31814
|
|
|
31827
|
-
|
|
31828
|
-
// // check if ds exist and deleted by garbage collector
|
|
31815
|
+
if (_.isEmpty(wrapper_data)) continue;
|
|
31829
31816
|
|
|
31830
|
-
|
|
31831
|
-
|
|
31832
|
-
//
|
|
31833
|
-
|
|
31834
|
-
|
|
31817
|
+
try {
|
|
31818
|
+
const ts = Date.now();
|
|
31819
|
+
// remove old panel content
|
|
31820
|
+
$.each(panel_val.ids, async function (key, val) {
|
|
31821
|
+
$("[xu-ui-id='" + val + "']")
|
|
31822
|
+
.attr('xu-ui-id', val + ts)
|
|
31823
|
+
.removeData();
|
|
31824
|
+
});
|
|
31835
31825
|
|
|
31836
|
-
|
|
31837
|
-
//
|
|
31838
|
-
// $div_elm, // the wrapper
|
|
31839
|
-
// _.cloneDeep(item), // _.cloneDeep(wrapper_data.xuData.node_org.children[0]), // the xu-panel node
|
|
31840
|
-
// {},
|
|
31841
|
-
// wrapper_data.xuData.paramsP, // the wrapper params
|
|
31842
|
-
// null,
|
|
31843
|
-
// null,
|
|
31844
|
-
// wrapper_data.xuData.key, // the wrapper key
|
|
31845
|
-
// refreshed_ds, // the refreshed_ds
|
|
31846
|
-
// wrapper_data.xuData.parent_node, // the wrapper parent node
|
|
31847
|
-
// null,
|
|
31848
|
-
// wrapper_data.xuData.$root_container, // the wrapper root container
|
|
31849
|
-
// );
|
|
31850
|
-
// }
|
|
31826
|
+
let refreshed_ds;
|
|
31827
|
+
// check if ds exist and deleted by garbage collector
|
|
31851
31828
|
|
|
31852
|
-
|
|
31853
|
-
|
|
31854
|
-
|
|
31855
|
-
|
|
31856
|
-
|
|
31857
|
-
|
|
31858
|
-
|
|
31859
|
-
|
|
31860
|
-
//
|
|
31861
|
-
//
|
|
31862
|
-
|
|
31829
|
+
if (_session.DS_GLB[panel_val._ds.dsSession]) {
|
|
31830
|
+
refreshed_ds = panel_val._ds.dsSession;
|
|
31831
|
+
}
|
|
31832
|
+
for await (const item of wrapper_data.xuData.node_org.children) {
|
|
31833
|
+
if (item.tagName !== 'xu-panel') continue;
|
|
31834
|
+
|
|
31835
|
+
const new_$div = await func.UI.screen.render_ui_tree(
|
|
31836
|
+
SESSION_ID,
|
|
31837
|
+
$div_elm, // the wrapper
|
|
31838
|
+
_.cloneDeep(item), // _.cloneDeep(wrapper_data.xuData.node_org.children[0]), // the xu-panel node
|
|
31839
|
+
{},
|
|
31840
|
+
wrapper_data.xuData.paramsP, // the wrapper params
|
|
31841
|
+
null,
|
|
31842
|
+
null,
|
|
31843
|
+
wrapper_data.xuData.key, // the wrapper key
|
|
31844
|
+
refreshed_ds, // the refreshed_ds
|
|
31845
|
+
wrapper_data.xuData.parent_node, // the wrapper parent node
|
|
31846
|
+
null,
|
|
31847
|
+
wrapper_data.xuData.$root_container, // the wrapper root container
|
|
31848
|
+
);
|
|
31849
|
+
}
|
|
31850
|
+
|
|
31851
|
+
// remove old panel content
|
|
31852
|
+
$.each(panel_val.ids, async function (key, val) {
|
|
31853
|
+
$("[xu-ui-id='" + val + ts + "']").remove();
|
|
31854
|
+
});
|
|
31855
|
+
} catch (error) {
|
|
31856
|
+
debugger;
|
|
31857
|
+
}
|
|
31858
|
+
// continue;
|
|
31859
|
+
}
|
|
31860
|
+
}
|
|
31861
|
+
};
|
|
31863
31862
|
|
|
31864
31863
|
const get_params_obj_new = async function (SESSION_ID, prog_id, nodeP, dsSession) {
|
|
31865
31864
|
const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);
|