@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
|
@@ -9510,7 +9510,7 @@ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, j
|
|
|
9510
9510
|
}
|
|
9511
9511
|
};
|
|
9512
9512
|
|
|
9513
|
-
func.UI.screen.
|
|
9513
|
+
func.UI.screen.refresh_screen_bad = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
|
|
9514
9514
|
var found, refresh_reason, refresh_details;
|
|
9515
9515
|
const validate_change = function (prog_doc, panelXuAttributes, skip_ui_check) {
|
|
9516
9516
|
found = null;
|
|
@@ -9592,71 +9592,71 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
|
|
|
9592
9592
|
}
|
|
9593
9593
|
};
|
|
9594
9594
|
|
|
9595
|
-
//
|
|
9596
|
-
|
|
9597
|
-
|
|
9598
|
-
|
|
9599
|
-
|
|
9600
|
-
|
|
9601
|
-
|
|
9602
|
-
|
|
9603
|
-
|
|
9604
|
-
|
|
9605
|
-
|
|
9606
|
-
|
|
9607
|
-
|
|
9608
|
-
|
|
9609
|
-
|
|
9610
|
-
|
|
9611
|
-
|
|
9612
|
-
|
|
9613
|
-
|
|
9614
|
-
|
|
9615
|
-
|
|
9616
|
-
|
|
9617
|
-
|
|
9618
|
-
|
|
9619
|
-
|
|
9620
|
-
|
|
9621
|
-
|
|
9622
|
-
|
|
9623
|
-
|
|
9624
|
-
|
|
9625
|
-
|
|
9626
|
-
|
|
9627
|
-
|
|
9628
|
-
|
|
9629
|
-
|
|
9630
|
-
|
|
9631
|
-
|
|
9632
|
-
|
|
9633
|
-
|
|
9634
|
-
|
|
9635
|
-
|
|
9636
|
-
|
|
9637
|
-
|
|
9638
|
-
|
|
9639
|
-
|
|
9640
|
-
|
|
9641
|
-
|
|
9642
|
-
|
|
9643
|
-
|
|
9644
|
-
|
|
9645
|
-
|
|
9646
|
-
|
|
9647
|
-
|
|
9648
|
-
|
|
9649
|
-
|
|
9650
|
-
|
|
9651
|
-
|
|
9652
|
-
|
|
9653
|
-
|
|
9654
|
-
|
|
9655
|
-
|
|
9656
|
-
|
|
9657
|
-
|
|
9658
|
-
|
|
9659
|
-
|
|
9595
|
+
// check the main program
|
|
9596
|
+
if (fields_changed_datasource) {
|
|
9597
|
+
const _session = SESSION_OBJ[SESSION_ID];
|
|
9598
|
+
const _ds = _session.DS_GLB[fields_changed_datasource];
|
|
9599
|
+
const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
9600
|
+
if (prog_doc.progUi) {
|
|
9601
|
+
validate_change(prog_doc, null, true);
|
|
9602
|
+
if (found) {
|
|
9603
|
+
const $elm = $(`#container_${_ds.prog_id}_0`);
|
|
9604
|
+
if ($elm?.length) {
|
|
9605
|
+
const elm_data = $elm.data();
|
|
9606
|
+
const $wrapper = $elm.parent();
|
|
9607
|
+
// const wrapper_data = $wrapper.data();
|
|
9608
|
+
const refreshed_ds = _ds.dsSession;
|
|
9609
|
+
|
|
9610
|
+
// let elm_to_delete = [];
|
|
9611
|
+
// const ts = Date.now();
|
|
9612
|
+
// $.each($elm.find('xu-root-component-' + SESSION_ID).find('*'), function (key, val) {
|
|
9613
|
+
// let xu_ui_id = $(val).attr('xu-ui-id');
|
|
9614
|
+
// if (xu_ui_id) {
|
|
9615
|
+
// let new_id = xu_ui_id + ts;
|
|
9616
|
+
// elm_to_delete.push(new_id);
|
|
9617
|
+
|
|
9618
|
+
// $(val).attr('xu-ui-id', new_id).removeData();
|
|
9619
|
+
// }
|
|
9620
|
+
// // else {
|
|
9621
|
+
// // $(val).remove();
|
|
9622
|
+
// // }
|
|
9623
|
+
// });
|
|
9624
|
+
|
|
9625
|
+
$elm.empty();
|
|
9626
|
+
if ($elm.data()) {
|
|
9627
|
+
const new_$div = await func.UI.screen.render_ui_tree(
|
|
9628
|
+
SESSION_ID,
|
|
9629
|
+
$elm, // the wrapper
|
|
9630
|
+
_.cloneDeep($elm.data().xuData.node), // the xu-panel node
|
|
9631
|
+
{},
|
|
9632
|
+
elm_data.xuData.paramsP, // the wrapper params
|
|
9633
|
+
null,
|
|
9634
|
+
null,
|
|
9635
|
+
elm_data.xuData.key, // the wrapper key
|
|
9636
|
+
refreshed_ds, // the refreshed_ds
|
|
9637
|
+
elm_data.xuData.parent_node, // the wrapper parent node
|
|
9638
|
+
null,
|
|
9639
|
+
elm_data.xuData.$root_container, // the wrapper root container
|
|
9640
|
+
);
|
|
9641
|
+
|
|
9642
|
+
// // remove old screen content
|
|
9643
|
+
// $.each(elm_to_delete, async function (key, val) {
|
|
9644
|
+
// $("[xu-ui-id='" + elm_to_delete + "']").remove();
|
|
9645
|
+
// });
|
|
9646
|
+
|
|
9647
|
+
if (_session.engine_mode === 'live_preview') {
|
|
9648
|
+
console.info('========= refresh main info ==============');
|
|
9649
|
+
console.info('reason:', refresh_reason);
|
|
9650
|
+
console.info('element:', $elm);
|
|
9651
|
+
console.info('==========================================');
|
|
9652
|
+
}
|
|
9653
|
+
|
|
9654
|
+
return;
|
|
9655
|
+
}
|
|
9656
|
+
}
|
|
9657
|
+
}
|
|
9658
|
+
}
|
|
9659
|
+
}
|
|
9660
9660
|
|
|
9661
9661
|
const panels_obj = await func.UI.utils.get_panels_wrapper_from_dom(SESSION_ID, $(SESSION_OBJ[SESSION_ID].root_element), false);
|
|
9662
9662
|
|
|
@@ -9738,169 +9738,168 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
|
|
|
9738
9738
|
}
|
|
9739
9739
|
};
|
|
9740
9740
|
|
|
9741
|
-
|
|
9742
|
-
//
|
|
9743
|
-
|
|
9744
|
-
|
|
9745
|
-
|
|
9746
|
-
|
|
9747
|
-
|
|
9748
|
-
|
|
9749
|
-
|
|
9750
|
-
|
|
9751
|
-
// }
|
|
9741
|
+
func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
|
|
9742
|
+
// check the main program
|
|
9743
|
+
if (fields_changed_datasource) {
|
|
9744
|
+
const _session = SESSION_OBJ[SESSION_ID];
|
|
9745
|
+
const _ds = _session.DS_GLB[fields_changed_datasource];
|
|
9746
|
+
const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
9747
|
+
const progDataSource_str = JSON.stringify(prog_doc.progDataSource);
|
|
9748
|
+
for (const field_id of fields_changed_arr || []) {
|
|
9749
|
+
}
|
|
9750
|
+
}
|
|
9752
9751
|
|
|
9753
|
-
|
|
9752
|
+
const panels_obj = await func.UI.utils.get_panels_wrapper_from_dom(SESSION_ID, $(SESSION_OBJ[SESSION_ID].root_element), false);
|
|
9754
9753
|
|
|
9755
|
-
|
|
9756
|
-
|
|
9754
|
+
for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
|
|
9755
|
+
const progDataSource_str = JSON.stringify(panel_val.prog_doc.progDataSource);
|
|
9757
9756
|
|
|
9758
|
-
|
|
9759
|
-
|
|
9760
|
-
|
|
9761
|
-
|
|
9762
|
-
|
|
9763
|
-
|
|
9764
|
-
//
|
|
9765
|
-
|
|
9757
|
+
var found, refresh_reason, refresh_details;
|
|
9758
|
+
if (fields_changed_arr) {
|
|
9759
|
+
if (fields_changed_datasource && panel_val._ds.dsSession <= Number(fields_changed_datasource)) {
|
|
9760
|
+
continue;
|
|
9761
|
+
}
|
|
9762
|
+
for (const field_id of fields_changed_arr) {
|
|
9763
|
+
// get panel attributes
|
|
9764
|
+
const _attributes = panel_val?.panelXuAttributes || {};
|
|
9766
9765
|
|
|
9767
|
-
//
|
|
9768
|
-
|
|
9766
|
+
// detect if program changed
|
|
9767
|
+
found = _attributes['xu-exp:program']?.includes('@' + field_id);
|
|
9769
9768
|
|
|
9770
|
-
|
|
9771
|
-
|
|
9772
|
-
|
|
9773
|
-
|
|
9774
|
-
|
|
9769
|
+
if (found) {
|
|
9770
|
+
refresh_reason = `program ${_attributes['xu-exp:program']} ${field_id} changed `;
|
|
9771
|
+
refresh_details = _attributes;
|
|
9772
|
+
break;
|
|
9773
|
+
}
|
|
9775
9774
|
|
|
9776
|
-
//
|
|
9777
|
-
//
|
|
9778
|
-
|
|
9779
|
-
|
|
9780
|
-
|
|
9775
|
+
// _attributes holds also info of parameters in code_in: @code
|
|
9776
|
+
// search field changed in panel call send parameters exp
|
|
9777
|
+
for (const [attr, value] of Object.entries(_attributes)) {
|
|
9778
|
+
const pattern = /xu-exp:(\w+)/;
|
|
9779
|
+
const match = attr.match(pattern);
|
|
9781
9780
|
|
|
9782
|
-
|
|
9783
|
-
//
|
|
9784
|
-
|
|
9785
|
-
|
|
9786
|
-
//
|
|
9787
|
-
|
|
9788
|
-
//
|
|
9789
|
-
|
|
9790
|
-
//
|
|
9791
|
-
|
|
9781
|
+
if (!match) {
|
|
9782
|
+
// continue if attribute is not expression
|
|
9783
|
+
continue;
|
|
9784
|
+
}
|
|
9785
|
+
// code_in
|
|
9786
|
+
const parameter_in_field_id = match?.[1];
|
|
9787
|
+
// @code
|
|
9788
|
+
if (value.includes(field_id)) {
|
|
9789
|
+
// search parameter in field in the target program's progDataSource
|
|
9790
|
+
found = progDataSource_str?.includes('@' + parameter_in_field_id);
|
|
9792
9791
|
|
|
9793
|
-
|
|
9794
|
-
|
|
9795
|
-
|
|
9792
|
+
if (found) {
|
|
9793
|
+
refresh_reason = `field ${field_id} in progDataSource parameter_in changed`;
|
|
9794
|
+
refresh_details = panel_val?.prog_doc?.progDataSource;
|
|
9796
9795
|
|
|
9797
|
-
|
|
9798
|
-
|
|
9796
|
+
break;
|
|
9797
|
+
}
|
|
9799
9798
|
|
|
9800
|
-
//
|
|
9801
|
-
|
|
9799
|
+
// found = find_field_in_progUi(prog_doc.progUi, parameter_in_field_id, 'xu-for');
|
|
9800
|
+
found = func.UI.find_field_in_progUi_attributes(panel_val.prog_doc.progUi, parameter_in_field_id, 'xu-for').length;
|
|
9802
9801
|
|
|
9803
|
-
|
|
9804
|
-
|
|
9805
|
-
|
|
9802
|
+
if (found) {
|
|
9803
|
+
refresh_reason = `field ${field_id} in progUi xu-for parameter_in changed`;
|
|
9804
|
+
refresh_details = found;
|
|
9806
9805
|
|
|
9807
|
-
|
|
9808
|
-
|
|
9809
|
-
|
|
9810
|
-
|
|
9806
|
+
break;
|
|
9807
|
+
}
|
|
9808
|
+
}
|
|
9809
|
+
}
|
|
9811
9810
|
|
|
9812
|
-
|
|
9811
|
+
if (found) break;
|
|
9813
9812
|
|
|
9814
|
-
//
|
|
9815
|
-
|
|
9816
|
-
|
|
9817
|
-
|
|
9818
|
-
|
|
9813
|
+
// search field changed in the target program's progDataSource // @code
|
|
9814
|
+
found = progDataSource_str?.includes('@' + field_id);
|
|
9815
|
+
if (found) {
|
|
9816
|
+
refresh_reason = `field ${field_id} in progDataSource changed`;
|
|
9817
|
+
refresh_details = panel_val?.prog_doc?.progDataSource;
|
|
9819
9818
|
|
|
9820
|
-
|
|
9821
|
-
|
|
9819
|
+
break;
|
|
9820
|
+
}
|
|
9822
9821
|
|
|
9823
|
-
|
|
9824
|
-
|
|
9825
|
-
|
|
9826
|
-
|
|
9822
|
+
found = func.UI.find_field_in_progUi_attributes(panel_val.prog_doc.progUi, field_id, 'xu-for').length;
|
|
9823
|
+
if (found) {
|
|
9824
|
+
refresh_reason = `field ${field_id} in progUi xu-for changed`;
|
|
9825
|
+
refresh_details = found;
|
|
9827
9826
|
|
|
9828
|
-
|
|
9829
|
-
|
|
9827
|
+
break;
|
|
9828
|
+
}
|
|
9830
9829
|
|
|
9831
|
-
|
|
9832
|
-
|
|
9833
|
-
|
|
9834
|
-
|
|
9835
|
-
|
|
9830
|
+
if (found) {
|
|
9831
|
+
break;
|
|
9832
|
+
}
|
|
9833
|
+
}
|
|
9834
|
+
}
|
|
9836
9835
|
|
|
9837
|
-
|
|
9838
|
-
|
|
9839
|
-
|
|
9840
|
-
|
|
9836
|
+
if (datasource_changed) {
|
|
9837
|
+
if (panel_val._ds.dsSession == datasource_changed) {
|
|
9838
|
+
refresh_reason = `panel datasource ${datasource_changed} changed`;
|
|
9839
|
+
refresh_details = '';
|
|
9841
9840
|
|
|
9842
|
-
|
|
9843
|
-
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
-
|
|
9852
|
-
|
|
9853
|
-
|
|
9854
|
-
|
|
9855
|
-
|
|
9841
|
+
found = true;
|
|
9842
|
+
}
|
|
9843
|
+
}
|
|
9844
|
+
if (found) {
|
|
9845
|
+
const _session = SESSION_OBJ[SESSION_ID];
|
|
9846
|
+
if (_session.engine_mode === 'live_preview') {
|
|
9847
|
+
console.info('========= refresh info ==============');
|
|
9848
|
+
console.info('reason:', refresh_reason);
|
|
9849
|
+
console.info('details:', refresh_details);
|
|
9850
|
+
console.info('panel:', panel_val);
|
|
9851
|
+
console.info('=====================================');
|
|
9852
|
+
}
|
|
9853
|
+
const $div_elm = panel_val.$panel_div;
|
|
9854
|
+
const wrapper_data = $div_elm.data();
|
|
9856
9855
|
|
|
9857
|
-
|
|
9856
|
+
if (_.isEmpty(wrapper_data)) continue;
|
|
9858
9857
|
|
|
9859
|
-
|
|
9860
|
-
|
|
9861
|
-
//
|
|
9862
|
-
|
|
9863
|
-
|
|
9864
|
-
|
|
9865
|
-
|
|
9866
|
-
|
|
9858
|
+
try {
|
|
9859
|
+
const ts = Date.now();
|
|
9860
|
+
// remove old panel content
|
|
9861
|
+
$.each(panel_val.ids, async function (key, val) {
|
|
9862
|
+
$("[xu-ui-id='" + val + "']")
|
|
9863
|
+
.attr('xu-ui-id', val + ts)
|
|
9864
|
+
.removeData();
|
|
9865
|
+
});
|
|
9867
9866
|
|
|
9868
|
-
|
|
9869
|
-
//
|
|
9867
|
+
let refreshed_ds;
|
|
9868
|
+
// check if ds exist and deleted by garbage collector
|
|
9870
9869
|
|
|
9871
|
-
|
|
9872
|
-
|
|
9873
|
-
|
|
9874
|
-
|
|
9875
|
-
|
|
9870
|
+
if (_session.DS_GLB[panel_val._ds.dsSession]) {
|
|
9871
|
+
refreshed_ds = panel_val._ds.dsSession;
|
|
9872
|
+
}
|
|
9873
|
+
for await (const item of wrapper_data.xuData.node_org.children) {
|
|
9874
|
+
if (item.tagName !== 'xu-panel') continue;
|
|
9876
9875
|
|
|
9877
|
-
|
|
9878
|
-
|
|
9879
|
-
|
|
9880
|
-
|
|
9881
|
-
|
|
9882
|
-
|
|
9883
|
-
|
|
9884
|
-
|
|
9885
|
-
|
|
9886
|
-
|
|
9887
|
-
|
|
9888
|
-
|
|
9889
|
-
|
|
9890
|
-
|
|
9891
|
-
|
|
9876
|
+
const new_$div = await func.UI.screen.render_ui_tree(
|
|
9877
|
+
SESSION_ID,
|
|
9878
|
+
$div_elm, // the wrapper
|
|
9879
|
+
_.cloneDeep(item), // _.cloneDeep(wrapper_data.xuData.node_org.children[0]), // the xu-panel node
|
|
9880
|
+
{},
|
|
9881
|
+
wrapper_data.xuData.paramsP, // the wrapper params
|
|
9882
|
+
null,
|
|
9883
|
+
null,
|
|
9884
|
+
wrapper_data.xuData.key, // the wrapper key
|
|
9885
|
+
refreshed_ds, // the refreshed_ds
|
|
9886
|
+
wrapper_data.xuData.parent_node, // the wrapper parent node
|
|
9887
|
+
null,
|
|
9888
|
+
wrapper_data.xuData.$root_container, // the wrapper root container
|
|
9889
|
+
);
|
|
9890
|
+
}
|
|
9892
9891
|
|
|
9893
|
-
//
|
|
9894
|
-
|
|
9895
|
-
|
|
9896
|
-
|
|
9897
|
-
|
|
9898
|
-
|
|
9899
|
-
|
|
9900
|
-
//
|
|
9901
|
-
|
|
9902
|
-
|
|
9903
|
-
|
|
9892
|
+
// remove old panel content
|
|
9893
|
+
$.each(panel_val.ids, async function (key, val) {
|
|
9894
|
+
$("[xu-ui-id='" + val + ts + "']").remove();
|
|
9895
|
+
});
|
|
9896
|
+
} catch (error) {
|
|
9897
|
+
debugger;
|
|
9898
|
+
}
|
|
9899
|
+
// continue;
|
|
9900
|
+
}
|
|
9901
|
+
}
|
|
9902
|
+
};
|
|
9904
9903
|
|
|
9905
9904
|
const get_params_obj_new = async function (SESSION_ID, prog_id, nodeP, dsSession) {
|
|
9906
9905
|
const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);
|