@xuda.io/runtime-bundle 1.0.718 → 1.0.720
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 +153 -164
- package/js/xuda-runtime-bundle.min.js +1 -1
- package/js/xuda-runtime-slim.js +150 -161
- package/js/xuda-runtime-slim.min.es.js +150 -161
- package/js/xuda-runtime-slim.min.js +1 -1
- package/package.json +1 -1
|
@@ -30870,7 +30870,7 @@ func.datasource.get_args_property_value = async function (SESSION_ID, dsSession,
|
|
|
30870
30870
|
return _value;
|
|
30871
30871
|
};
|
|
30872
30872
|
func.UI.screen = {};
|
|
30873
|
-
func.UI.screen.init = async function (SESSION_ID, prog_id, sourceScreenP, callingDataSource_objP, $callingContainerP, triggerIdP, rowIdP, jobNoP, is_panelP, parameters_obj_inP, source_functionP, call_screen_propertiesP, refreshed_ds) {
|
|
30873
|
+
func.UI.screen.init = async function (SESSION_ID, prog_id, sourceScreenP, callingDataSource_objP, $callingContainerP, triggerIdP, rowIdP, jobNoP, is_panelP, parameters_obj_inP, source_functionP, call_screen_propertiesP, refreshed_ds, parameters_raw_obj) {
|
|
30874
30874
|
if (!prog_id) return console.error('program is empty');
|
|
30875
30875
|
let screen_ret = await func.utils.get_screen_obj(SESSION_ID, prog_id);
|
|
30876
30876
|
if (!screen_ret) return console.error('program is not a screen object');
|
|
@@ -30923,6 +30923,7 @@ func.UI.screen.init = async function (SESSION_ID, prog_id, sourceScreenP, callin
|
|
|
30923
30923
|
screenInfo,
|
|
30924
30924
|
call_screen_propertiesP,
|
|
30925
30925
|
parentDataSourceNoP: _session.DS_GLB?.[callingDataSource_objP?.dsSession]?.dsSession || callingDataSource_objP?.parentDataSourceNo || 0,
|
|
30926
|
+
parameters_raw_obj,
|
|
30926
30927
|
};
|
|
30927
30928
|
|
|
30928
30929
|
switch (screen_type) {
|
|
@@ -31089,7 +31090,7 @@ func.UI.screen.init = async function (SESSION_ID, prog_id, sourceScreenP, callin
|
|
|
31089
31090
|
rowIdP,
|
|
31090
31091
|
jobNoP,
|
|
31091
31092
|
null,
|
|
31092
|
-
|
|
31093
|
+
parameters_raw_obj,
|
|
31093
31094
|
null,
|
|
31094
31095
|
null,
|
|
31095
31096
|
null,
|
|
@@ -31696,212 +31697,200 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
|
|
|
31696
31697
|
}
|
|
31697
31698
|
};
|
|
31698
31699
|
|
|
31699
|
-
|
|
31700
|
-
//
|
|
31701
|
-
|
|
31702
|
-
|
|
31703
|
-
|
|
31704
|
-
|
|
31705
|
-
|
|
31706
|
-
|
|
31700
|
+
func.UI.screen.refresh_screen_old = 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
|
+
}
|
|
31707
31710
|
|
|
31708
|
-
|
|
31709
|
-
// }
|
|
31711
|
+
const panels_obj = await func.UI.utils.get_panels_wrapper_from_dom(SESSION_ID, $(SESSION_OBJ[SESSION_ID].root_element), false);
|
|
31710
31712
|
|
|
31711
|
-
|
|
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);
|
|
31712
31715
|
|
|
31713
|
-
|
|
31714
|
-
|
|
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 || {};
|
|
31715
31724
|
|
|
31716
|
-
//
|
|
31717
|
-
|
|
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 || {};
|
|
31725
|
+
// detect if program changed
|
|
31726
|
+
found = _attributes['xu-exp:program']?.includes('@' + field_id);
|
|
31724
31727
|
|
|
31725
|
-
|
|
31726
|
-
|
|
31728
|
+
if (found) {
|
|
31729
|
+
refresh_reason = `program ${_attributes['xu-exp:program']} ${field_id} changed `;
|
|
31730
|
+
refresh_details = _attributes;
|
|
31731
|
+
break;
|
|
31732
|
+
}
|
|
31727
31733
|
|
|
31728
|
-
//
|
|
31729
|
-
//
|
|
31730
|
-
|
|
31731
|
-
|
|
31732
|
-
|
|
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);
|
|
31733
31739
|
|
|
31734
|
-
|
|
31735
|
-
//
|
|
31736
|
-
|
|
31737
|
-
|
|
31738
|
-
//
|
|
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);
|
|
31739
31750
|
|
|
31740
|
-
|
|
31741
|
-
|
|
31742
|
-
|
|
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);
|
|
31750
|
-
|
|
31751
|
-
// if (found) {
|
|
31752
|
-
// refresh_reason = `field ${field_id} in progDataSource parameter_in changed`;
|
|
31753
|
-
// refresh_details = panel_val?.prog_doc?.progDataSource;
|
|
31754
|
-
|
|
31755
|
-
// break;
|
|
31756
|
-
// }
|
|
31751
|
+
if (found) {
|
|
31752
|
+
refresh_reason = `field ${field_id} in progDataSource parameter_in changed`;
|
|
31753
|
+
refresh_details = panel_val?.prog_doc?.progDataSource;
|
|
31757
31754
|
|
|
31758
|
-
|
|
31759
|
-
|
|
31755
|
+
break;
|
|
31756
|
+
}
|
|
31760
31757
|
|
|
31761
|
-
//
|
|
31762
|
-
|
|
31763
|
-
// 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;
|
|
31764
31760
|
|
|
31765
|
-
|
|
31766
|
-
|
|
31767
|
-
|
|
31768
|
-
// }
|
|
31761
|
+
if (found) {
|
|
31762
|
+
refresh_reason = `field ${field_id} in progUi xu-for parameter_in changed`;
|
|
31763
|
+
refresh_details = found;
|
|
31769
31764
|
|
|
31770
|
-
|
|
31765
|
+
break;
|
|
31766
|
+
}
|
|
31767
|
+
}
|
|
31768
|
+
}
|
|
31771
31769
|
|
|
31772
|
-
|
|
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;
|
|
31770
|
+
if (found) break;
|
|
31777
31771
|
|
|
31778
|
-
//
|
|
31779
|
-
|
|
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;
|
|
31780
31777
|
|
|
31781
|
-
|
|
31782
|
-
|
|
31783
|
-
// refresh_reason = `field ${field_id} in progUi xu-for changed`;
|
|
31784
|
-
// refresh_details = found;
|
|
31778
|
+
break;
|
|
31779
|
+
}
|
|
31785
31780
|
|
|
31786
|
-
|
|
31787
|
-
|
|
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;
|
|
31788
31785
|
|
|
31789
|
-
|
|
31790
|
-
|
|
31791
|
-
// }
|
|
31792
|
-
// }
|
|
31793
|
-
// }
|
|
31786
|
+
break;
|
|
31787
|
+
}
|
|
31794
31788
|
|
|
31795
|
-
|
|
31796
|
-
|
|
31797
|
-
|
|
31798
|
-
|
|
31789
|
+
if (found) {
|
|
31790
|
+
break;
|
|
31791
|
+
}
|
|
31792
|
+
}
|
|
31793
|
+
}
|
|
31799
31794
|
|
|
31800
|
-
|
|
31801
|
-
|
|
31802
|
-
|
|
31803
|
-
|
|
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();
|
|
31814
|
-
|
|
31815
|
-
// if (_.isEmpty(wrapper_data)) continue;
|
|
31816
|
-
|
|
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
|
-
// });
|
|
31795
|
+
if (datasource_changed) {
|
|
31796
|
+
if (panel_val._ds.dsSession == datasource_changed) {
|
|
31797
|
+
refresh_reason = `panel datasource ${datasource_changed} changed`;
|
|
31798
|
+
refresh_details = '';
|
|
31825
31799
|
|
|
31826
|
-
|
|
31827
|
-
|
|
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();
|
|
31828
31814
|
|
|
31829
|
-
|
|
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;
|
|
31815
|
+
if (_.isEmpty(wrapper_data)) continue;
|
|
31834
31816
|
|
|
31835
|
-
|
|
31836
|
-
|
|
31837
|
-
//
|
|
31838
|
-
|
|
31839
|
-
|
|
31840
|
-
|
|
31841
|
-
|
|
31842
|
-
|
|
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
|
-
// }
|
|
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
|
+
});
|
|
31850
31825
|
|
|
31851
|
-
|
|
31852
|
-
//
|
|
31853
|
-
|
|
31854
|
-
|
|
31855
|
-
|
|
31856
|
-
|
|
31857
|
-
|
|
31858
|
-
|
|
31859
|
-
|
|
31860
|
-
|
|
31861
|
-
|
|
31826
|
+
let refreshed_ds;
|
|
31827
|
+
// check if ds exist and deleted by garbage collector
|
|
31828
|
+
|
|
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
|
+
};
|
|
31862
31862
|
|
|
31863
31863
|
const get_params_obj_new = async function (SESSION_ID, prog_id, nodeP, dsSession) {
|
|
31864
31864
|
const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);
|
|
31865
31865
|
if (!_prog) return;
|
|
31866
31866
|
|
|
31867
31867
|
// get in parameters
|
|
31868
|
-
|
|
31868
|
+
let params_res = {},
|
|
31869
|
+
params_raw = {};
|
|
31869
31870
|
if (_prog?.properties?.progParams) {
|
|
31870
31871
|
for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
|
|
31871
31872
|
if (!['in', 'out'].includes(val.data.dir)) continue;
|
|
31872
31873
|
|
|
31873
31874
|
if (nodeP.attributes) {
|
|
31874
31875
|
if (nodeP.attributes[val.data.parameter]) {
|
|
31875
|
-
|
|
31876
|
+
params_res[val.data.parameter] = nodeP.attributes[val.data.parameter];
|
|
31876
31877
|
} else if (nodeP.attributes[`xu-exp:${val.data.parameter}`]) {
|
|
31877
31878
|
if (val.data.dir == 'out') {
|
|
31878
31879
|
// only reference
|
|
31879
|
-
|
|
31880
|
+
params_res[val.data.parameter] = nodeP.attributes[`xu-exp:${val.data.parameter}`].replaceAll('@', '');
|
|
31880
31881
|
} else {
|
|
31881
31882
|
// in parameter
|
|
31882
31883
|
let ret = await func.expression.get(SESSION_ID, nodeP.attributes[`xu-exp:${val.data.parameter}`], dsSession, 'parameters');
|
|
31883
|
-
|
|
31884
|
+
params_res[val.data.parameter] = ret.result;
|
|
31885
|
+
params_raw[val.data.parameter] = nodeP.attributes[`xu-exp:${val.data.parameter}`];
|
|
31884
31886
|
}
|
|
31885
31887
|
}
|
|
31886
|
-
|
|
31887
|
-
// if (parameters_obj_inP?.[val.data.parameter].fx) {
|
|
31888
|
-
// let ret = await func.expression.get(
|
|
31889
|
-
// SESSION_ID,
|
|
31890
|
-
// parameters_obj_inP?.[val.data.parameter].fx,
|
|
31891
|
-
// dsSession,
|
|
31892
|
-
// "parameters"
|
|
31893
|
-
// );
|
|
31894
|
-
// params_obj[val.data.parameter] = ret.result;
|
|
31895
|
-
// } else {
|
|
31896
|
-
// params_obj[val.data.parameter] =
|
|
31897
|
-
// parameters_obj_inP?.[val.data.parameter].value;
|
|
31898
|
-
// }
|
|
31899
31888
|
continue;
|
|
31900
31889
|
}
|
|
31901
31890
|
console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
|
|
31902
31891
|
}
|
|
31903
31892
|
}
|
|
31904
|
-
return
|
|
31893
|
+
return { params_res, params_raw };
|
|
31905
31894
|
};
|
|
31906
31895
|
|
|
31907
31896
|
func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, xu_func, $elm, val, is_init, refreshed_ds) {
|
|
@@ -31918,8 +31907,8 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
|
|
|
31918
31907
|
const init_program = async function () {
|
|
31919
31908
|
async function render_panel() {
|
|
31920
31909
|
const prog_id = val.value?.prog || val.value;
|
|
31921
|
-
const
|
|
31922
|
-
let ret_panel = await func.UI.screen.init(SESSION_ID, prog_id, paramsP.screenId, _ds, $elm, null, _ds.currentRecordId, null, true,
|
|
31910
|
+
const params_obj = await get_params_obj_new(SESSION_ID, prog_id, nodeP, paramsP.dsSessionP);
|
|
31911
|
+
let ret_panel = await func.UI.screen.init(SESSION_ID, prog_id, paramsP.screenId, _ds, $elm, null, _ds.currentRecordId, null, true, params_obj.params_res, 'initXu_panel', undefined, prog_id !== _ds.prog_id ? null : refreshed_ds, params_obj.params_raw);
|
|
31923
31912
|
ret = { $new_div: ret_panel };
|
|
31924
31913
|
$container.data().xuData.xuPanelProps = $elm.data().xuAttributes;
|
|
31925
31914
|
$container.data().xuData.xuPanelData = ret_panel.data();
|
|
@@ -31968,8 +31957,8 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
|
|
|
31968
31957
|
const program = val.value?.prog || val.value;
|
|
31969
31958
|
var $wrapper = $('<div>');
|
|
31970
31959
|
var $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, nodeP.attributes, null, null, null, $wrapper, '');
|
|
31971
|
-
const
|
|
31972
|
-
let ret_init = await func.UI.screen.init(SESSION_ID, program, paramsP.screenId, _ds, $div, null, _ds.currentRecordId, jobNoP, true,
|
|
31960
|
+
const params_obj = await get_params_obj_new(SESSION_ID, program, nodeP, paramsP.dsSessionP);
|
|
31961
|
+
let ret_init = await func.UI.screen.init(SESSION_ID, program, paramsP.screenId, _ds, $div, null, _ds.currentRecordId, jobNoP, true, params_obj.params_res, 'alterXu_panel', undefined, undefined, params_obj.params_raw);
|
|
31973
31962
|
ret = {
|
|
31974
31963
|
$new_div: ret_init,
|
|
31975
31964
|
abort: true,
|