@xuda.io/runtime-bundle 1.0.719 → 1.0.721
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 +231 -287
- package/js/xuda-runtime-bundle.min.js +2 -2
- package/js/xuda-runtime-slim.js +228 -284
- package/js/xuda-runtime-slim.min.es.js +228 -284
- package/js/xuda-runtime-slim.min.js +2 -2
- package/js/xuda-server-bundle.min.mjs +1 -1
- package/js/xuda-server-bundle.mjs +32 -5
- package/js/xuda-worker-bundle.js +32 -5
- package/js/xuda-worker-bundle.min.js +1 -1
- package/package.json +1 -1
|
@@ -2900,7 +2900,7 @@ func.datasource.create = async function (
|
|
|
2900
2900
|
rowIdP,
|
|
2901
2901
|
jobNoP,
|
|
2902
2902
|
calling_trigger_prop,
|
|
2903
|
-
|
|
2903
|
+
parameters_raw_obj,
|
|
2904
2904
|
NA_isInitP,
|
|
2905
2905
|
NA_callingSourceP,
|
|
2906
2906
|
calling_jobP,
|
|
@@ -2933,6 +2933,7 @@ func.datasource.create = async function (
|
|
|
2933
2933
|
parameters_obj_inP,
|
|
2934
2934
|
static_refreshP,
|
|
2935
2935
|
worker_id,
|
|
2936
|
+
parameters_raw_obj,
|
|
2936
2937
|
};
|
|
2937
2938
|
|
|
2938
2939
|
var IS_DATASOURCE_REFRESH = null;
|
|
@@ -3068,7 +3069,7 @@ func.datasource.create = async function (
|
|
|
3068
3069
|
args.rowIdP,
|
|
3069
3070
|
args.jobNoP,
|
|
3070
3071
|
args.calling_trigger_prop,
|
|
3071
|
-
|
|
3072
|
+
args.parameters_raw_obj,
|
|
3072
3073
|
null,
|
|
3073
3074
|
null,
|
|
3074
3075
|
args.calling_jobP,
|
|
@@ -3109,7 +3110,7 @@ func.datasource.create = async function (
|
|
|
3109
3110
|
return done(SESSION_ID, jsonP.dsSession, true);
|
|
3110
3111
|
});
|
|
3111
3112
|
};
|
|
3112
|
-
func.datasource.prepare = async function (SESSION_ID, prog_id, dataSourceNoP, parentDataSourceNoP, containerIdP, rowIdP, jobNoP, calling_trigger_prop,
|
|
3113
|
+
func.datasource.prepare = async function (SESSION_ID, prog_id, dataSourceNoP, parentDataSourceNoP, containerIdP, rowIdP, jobNoP, calling_trigger_prop, parameters_raw_obj, NA_isInitP, callingSourceP, calling_jobP, NA_screen_dsP, is_panelP, parameters_obj_inP, static_refreshP, run_atP, worker_id) {
|
|
3113
3114
|
const set_parameters = async function () {
|
|
3114
3115
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
3115
3116
|
const get_Out_parameters = async function (fieldIdP, located_field_param_idxP, param_row_idP) {
|
|
@@ -3238,6 +3239,7 @@ func.datasource.prepare = async function (SESSION_ID, prog_id, dataSourceNoP, pa
|
|
|
3238
3239
|
static_refreshP,
|
|
3239
3240
|
run_atP,
|
|
3240
3241
|
worker_id,
|
|
3242
|
+
parameters_raw_obj,
|
|
3241
3243
|
};
|
|
3242
3244
|
|
|
3243
3245
|
var dataSourceSession = null;
|
|
@@ -4156,7 +4158,7 @@ func.datasource.run_events_functions = async function (SESSION_ID, dataSourceSes
|
|
|
4156
4158
|
clearInterval(interval);
|
|
4157
4159
|
resolve(job_num);
|
|
4158
4160
|
}
|
|
4159
|
-
if (i >
|
|
4161
|
+
if (i > 50) {
|
|
4160
4162
|
console.error('deadlock detected');
|
|
4161
4163
|
clearInterval(interval);
|
|
4162
4164
|
resolve(job_num);
|
|
@@ -4894,6 +4896,18 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
4894
4896
|
|
|
4895
4897
|
if (!fields_changed.includes(field_id)) {
|
|
4896
4898
|
fields_changed.push(field_id);
|
|
4899
|
+
|
|
4900
|
+
///// REFRESH PARAMETERS IN
|
|
4901
|
+
// for (const [_dsSession, _ds] of Object.entries(_session.DS_GLB)) {
|
|
4902
|
+
// if (_ds.args.parameters_raw_obj) {
|
|
4903
|
+
// for (const [key, exp] of Object.entries(_ds.args.parameters_raw_obj)) {
|
|
4904
|
+
// if (exp.includes(field_id)) {
|
|
4905
|
+
// let ret = await func.expression.get(SESSION_ID, exp, _dsSession, 'parameters');
|
|
4906
|
+
// _ds.in_parameters[key].value = ret.result;
|
|
4907
|
+
// }
|
|
4908
|
+
// }
|
|
4909
|
+
// }
|
|
4910
|
+
// }
|
|
4897
4911
|
}
|
|
4898
4912
|
if (!datasource_changed.includes(dataSource)) {
|
|
4899
4913
|
datasource_changed.push(dataSource);
|
|
@@ -4940,6 +4954,19 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
4940
4954
|
datasource_changed[0], // refresh the current datasource only
|
|
4941
4955
|
);
|
|
4942
4956
|
}
|
|
4957
|
+
// ///// REFRESH PARAMETERS IN
|
|
4958
|
+
// if (fields_changed.length) {
|
|
4959
|
+
// for (const [_dsSession, _ds] of Object.entries(_session.DS_GLB)) {
|
|
4960
|
+
// if (_ds.args.parameters_raw_obj) {
|
|
4961
|
+
// for (const [key, val] of Object.entries(_ds.args.parameters_raw_obj)) {
|
|
4962
|
+
// if (fields_changed.includes(val)) {
|
|
4963
|
+
// let ret = await func.expression.get(SESSION_ID, '@' + val, _dsSession, 'parameters');
|
|
4964
|
+
// _ds.in_parameters[val].value = ret.result;
|
|
4965
|
+
// }
|
|
4966
|
+
// }
|
|
4967
|
+
// }
|
|
4968
|
+
// }
|
|
4969
|
+
// }
|
|
4943
4970
|
}
|
|
4944
4971
|
resolve();
|
|
4945
4972
|
});
|
|
@@ -8884,7 +8911,7 @@ func.UI.find_field_in_progUi_attributes = function (progUi, field_id, prop, tag_
|
|
|
8884
8911
|
return elm_nodes;
|
|
8885
8912
|
};
|
|
8886
8913
|
func.UI.screen = {};
|
|
8887
|
-
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) {
|
|
8914
|
+
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) {
|
|
8888
8915
|
if (!prog_id) return console.error('program is empty');
|
|
8889
8916
|
let screen_ret = await func.utils.get_screen_obj(SESSION_ID, prog_id);
|
|
8890
8917
|
if (!screen_ret) return console.error('program is not a screen object');
|
|
@@ -8937,6 +8964,7 @@ func.UI.screen.init = async function (SESSION_ID, prog_id, sourceScreenP, callin
|
|
|
8937
8964
|
screenInfo,
|
|
8938
8965
|
call_screen_propertiesP,
|
|
8939
8966
|
parentDataSourceNoP: _session.DS_GLB?.[callingDataSource_objP?.dsSession]?.dsSession || callingDataSource_objP?.parentDataSourceNo || 0,
|
|
8967
|
+
parameters_raw_obj,
|
|
8940
8968
|
};
|
|
8941
8969
|
|
|
8942
8970
|
switch (screen_type) {
|
|
@@ -9103,7 +9131,7 @@ func.UI.screen.init = async function (SESSION_ID, prog_id, sourceScreenP, callin
|
|
|
9103
9131
|
rowIdP,
|
|
9104
9132
|
jobNoP,
|
|
9105
9133
|
null,
|
|
9106
|
-
|
|
9134
|
+
parameters_raw_obj,
|
|
9107
9135
|
null,
|
|
9108
9136
|
null,
|
|
9109
9137
|
null,
|
|
@@ -9710,212 +9738,200 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
|
|
|
9710
9738
|
}
|
|
9711
9739
|
};
|
|
9712
9740
|
|
|
9713
|
-
|
|
9714
|
-
//
|
|
9715
|
-
|
|
9716
|
-
|
|
9717
|
-
|
|
9718
|
-
|
|
9719
|
-
|
|
9720
|
-
|
|
9721
|
-
|
|
9722
|
-
|
|
9723
|
-
// }
|
|
9741
|
+
func.UI.screen.refresh_screen_old = 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
|
+
}
|
|
9724
9751
|
|
|
9725
|
-
|
|
9752
|
+
const panels_obj = await func.UI.utils.get_panels_wrapper_from_dom(SESSION_ID, $(SESSION_OBJ[SESSION_ID].root_element), false);
|
|
9726
9753
|
|
|
9727
|
-
|
|
9728
|
-
|
|
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);
|
|
9729
9756
|
|
|
9730
|
-
|
|
9731
|
-
|
|
9732
|
-
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
//
|
|
9737
|
-
|
|
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 || {};
|
|
9738
9765
|
|
|
9739
|
-
//
|
|
9740
|
-
|
|
9766
|
+
// detect if program changed
|
|
9767
|
+
found = _attributes['xu-exp:program']?.includes('@' + field_id);
|
|
9741
9768
|
|
|
9742
|
-
|
|
9743
|
-
|
|
9744
|
-
|
|
9745
|
-
|
|
9746
|
-
|
|
9769
|
+
if (found) {
|
|
9770
|
+
refresh_reason = `program ${_attributes['xu-exp:program']} ${field_id} changed `;
|
|
9771
|
+
refresh_details = _attributes;
|
|
9772
|
+
break;
|
|
9773
|
+
}
|
|
9747
9774
|
|
|
9748
|
-
//
|
|
9749
|
-
//
|
|
9750
|
-
|
|
9751
|
-
|
|
9752
|
-
|
|
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);
|
|
9753
9780
|
|
|
9754
|
-
|
|
9755
|
-
//
|
|
9756
|
-
|
|
9757
|
-
|
|
9758
|
-
//
|
|
9759
|
-
|
|
9760
|
-
//
|
|
9761
|
-
|
|
9762
|
-
//
|
|
9763
|
-
|
|
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);
|
|
9764
9791
|
|
|
9765
|
-
|
|
9766
|
-
|
|
9767
|
-
|
|
9792
|
+
if (found) {
|
|
9793
|
+
refresh_reason = `field ${field_id} in progDataSource parameter_in changed`;
|
|
9794
|
+
refresh_details = panel_val?.prog_doc?.progDataSource;
|
|
9768
9795
|
|
|
9769
|
-
|
|
9770
|
-
|
|
9796
|
+
break;
|
|
9797
|
+
}
|
|
9771
9798
|
|
|
9772
|
-
//
|
|
9773
|
-
|
|
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;
|
|
9774
9801
|
|
|
9775
|
-
|
|
9776
|
-
|
|
9777
|
-
|
|
9802
|
+
if (found) {
|
|
9803
|
+
refresh_reason = `field ${field_id} in progUi xu-for parameter_in changed`;
|
|
9804
|
+
refresh_details = found;
|
|
9778
9805
|
|
|
9779
|
-
|
|
9780
|
-
|
|
9781
|
-
|
|
9782
|
-
|
|
9806
|
+
break;
|
|
9807
|
+
}
|
|
9808
|
+
}
|
|
9809
|
+
}
|
|
9783
9810
|
|
|
9784
|
-
|
|
9811
|
+
if (found) break;
|
|
9785
9812
|
|
|
9786
|
-
//
|
|
9787
|
-
|
|
9788
|
-
|
|
9789
|
-
|
|
9790
|
-
|
|
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;
|
|
9791
9818
|
|
|
9792
|
-
|
|
9793
|
-
|
|
9819
|
+
break;
|
|
9820
|
+
}
|
|
9794
9821
|
|
|
9795
|
-
|
|
9796
|
-
|
|
9797
|
-
|
|
9798
|
-
|
|
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;
|
|
9799
9826
|
|
|
9800
|
-
|
|
9801
|
-
|
|
9827
|
+
break;
|
|
9828
|
+
}
|
|
9802
9829
|
|
|
9803
|
-
|
|
9804
|
-
|
|
9805
|
-
|
|
9806
|
-
|
|
9807
|
-
|
|
9830
|
+
if (found) {
|
|
9831
|
+
break;
|
|
9832
|
+
}
|
|
9833
|
+
}
|
|
9834
|
+
}
|
|
9808
9835
|
|
|
9809
|
-
|
|
9810
|
-
|
|
9811
|
-
|
|
9812
|
-
|
|
9836
|
+
if (datasource_changed) {
|
|
9837
|
+
if (panel_val._ds.dsSession == datasource_changed) {
|
|
9838
|
+
refresh_reason = `panel datasource ${datasource_changed} changed`;
|
|
9839
|
+
refresh_details = '';
|
|
9813
9840
|
|
|
9814
|
-
|
|
9815
|
-
|
|
9816
|
-
|
|
9817
|
-
|
|
9818
|
-
|
|
9819
|
-
|
|
9820
|
-
|
|
9821
|
-
|
|
9822
|
-
|
|
9823
|
-
|
|
9824
|
-
|
|
9825
|
-
|
|
9826
|
-
|
|
9827
|
-
|
|
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();
|
|
9828
9855
|
|
|
9829
|
-
|
|
9856
|
+
if (_.isEmpty(wrapper_data)) continue;
|
|
9830
9857
|
|
|
9831
|
-
|
|
9832
|
-
|
|
9833
|
-
//
|
|
9834
|
-
|
|
9835
|
-
|
|
9836
|
-
|
|
9837
|
-
|
|
9838
|
-
|
|
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
|
+
});
|
|
9839
9866
|
|
|
9840
|
-
|
|
9841
|
-
//
|
|
9867
|
+
let refreshed_ds;
|
|
9868
|
+
// check if ds exist and deleted by garbage collector
|
|
9842
9869
|
|
|
9843
|
-
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
|
|
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;
|
|
9848
9875
|
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
-
|
|
9852
|
-
|
|
9853
|
-
|
|
9854
|
-
|
|
9855
|
-
|
|
9856
|
-
|
|
9857
|
-
|
|
9858
|
-
|
|
9859
|
-
|
|
9860
|
-
|
|
9861
|
-
|
|
9862
|
-
|
|
9863
|
-
|
|
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
|
+
}
|
|
9864
9891
|
|
|
9865
|
-
//
|
|
9866
|
-
|
|
9867
|
-
|
|
9868
|
-
|
|
9869
|
-
|
|
9870
|
-
|
|
9871
|
-
|
|
9872
|
-
//
|
|
9873
|
-
|
|
9874
|
-
|
|
9875
|
-
|
|
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
|
+
};
|
|
9876
9903
|
|
|
9877
9904
|
const get_params_obj_new = async function (SESSION_ID, prog_id, nodeP, dsSession) {
|
|
9878
9905
|
const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);
|
|
9879
9906
|
if (!_prog) return;
|
|
9880
9907
|
|
|
9881
9908
|
// get in parameters
|
|
9882
|
-
|
|
9909
|
+
let params_res = {},
|
|
9910
|
+
params_raw = {};
|
|
9883
9911
|
if (_prog?.properties?.progParams) {
|
|
9884
9912
|
for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
|
|
9885
9913
|
if (!['in', 'out'].includes(val.data.dir)) continue;
|
|
9886
9914
|
|
|
9887
9915
|
if (nodeP.attributes) {
|
|
9888
9916
|
if (nodeP.attributes[val.data.parameter]) {
|
|
9889
|
-
|
|
9917
|
+
params_res[val.data.parameter] = nodeP.attributes[val.data.parameter];
|
|
9890
9918
|
} else if (nodeP.attributes[`xu-exp:${val.data.parameter}`]) {
|
|
9891
9919
|
if (val.data.dir == 'out') {
|
|
9892
9920
|
// only reference
|
|
9893
|
-
|
|
9921
|
+
params_res[val.data.parameter] = nodeP.attributes[`xu-exp:${val.data.parameter}`].replaceAll('@', '');
|
|
9894
9922
|
} else {
|
|
9895
9923
|
// in parameter
|
|
9896
9924
|
let ret = await func.expression.get(SESSION_ID, nodeP.attributes[`xu-exp:${val.data.parameter}`], dsSession, 'parameters');
|
|
9897
|
-
|
|
9925
|
+
params_res[val.data.parameter] = ret.result;
|
|
9926
|
+
params_raw[val.data.parameter] = nodeP.attributes[`xu-exp:${val.data.parameter}`];
|
|
9898
9927
|
}
|
|
9899
9928
|
}
|
|
9900
|
-
|
|
9901
|
-
// if (parameters_obj_inP?.[val.data.parameter].fx) {
|
|
9902
|
-
// let ret = await func.expression.get(
|
|
9903
|
-
// SESSION_ID,
|
|
9904
|
-
// parameters_obj_inP?.[val.data.parameter].fx,
|
|
9905
|
-
// dsSession,
|
|
9906
|
-
// "parameters"
|
|
9907
|
-
// );
|
|
9908
|
-
// params_obj[val.data.parameter] = ret.result;
|
|
9909
|
-
// } else {
|
|
9910
|
-
// params_obj[val.data.parameter] =
|
|
9911
|
-
// parameters_obj_inP?.[val.data.parameter].value;
|
|
9912
|
-
// }
|
|
9913
9929
|
continue;
|
|
9914
9930
|
}
|
|
9915
9931
|
console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
|
|
9916
9932
|
}
|
|
9917
9933
|
}
|
|
9918
|
-
return
|
|
9934
|
+
return { params_res, params_raw };
|
|
9919
9935
|
};
|
|
9920
9936
|
|
|
9921
9937
|
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) {
|
|
@@ -9932,8 +9948,8 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
|
|
|
9932
9948
|
const init_program = async function () {
|
|
9933
9949
|
async function render_panel() {
|
|
9934
9950
|
const prog_id = val.value?.prog || val.value;
|
|
9935
|
-
const
|
|
9936
|
-
let ret_panel = await func.UI.screen.init(SESSION_ID, prog_id, paramsP.screenId, _ds, $elm, null, _ds.currentRecordId, null, true,
|
|
9951
|
+
const params_obj = await get_params_obj_new(SESSION_ID, prog_id, nodeP, paramsP.dsSessionP);
|
|
9952
|
+
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);
|
|
9937
9953
|
ret = { $new_div: ret_panel };
|
|
9938
9954
|
$container.data().xuData.xuPanelProps = $elm.data().xuAttributes;
|
|
9939
9955
|
$container.data().xuData.xuPanelData = ret_panel.data();
|
|
@@ -9982,8 +9998,8 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
|
|
|
9982
9998
|
const program = val.value?.prog || val.value;
|
|
9983
9999
|
var $wrapper = $('<div>');
|
|
9984
10000
|
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, '');
|
|
9985
|
-
const
|
|
9986
|
-
let ret_init = await func.UI.screen.init(SESSION_ID, program, paramsP.screenId, _ds, $div, null, _ds.currentRecordId, jobNoP, true,
|
|
10001
|
+
const params_obj = await get_params_obj_new(SESSION_ID, program, nodeP, paramsP.dsSessionP);
|
|
10002
|
+
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);
|
|
9987
10003
|
ret = {
|
|
9988
10004
|
$new_div: ret_init,
|
|
9989
10005
|
abort: true,
|
|
@@ -13474,7 +13490,7 @@ func.events.execute = async function (
|
|
|
13474
13490
|
var params_obj = {};
|
|
13475
13491
|
if (_prog?.properties?.progParams) {
|
|
13476
13492
|
for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
|
|
13477
|
-
if (val.data.dir
|
|
13493
|
+
if (!val.data.dir === 'in') continue;
|
|
13478
13494
|
if (typeof args.parameters_obj_inP?.[val.data.parameter] !== 'undefined') {
|
|
13479
13495
|
if (args.parameters_obj_inP?.[val.data.parameter].fx) {
|
|
13480
13496
|
let ret = await func.expression.get(SESSION_ID, args.parameters_obj_inP?.[val.data.parameter].fx, dsSession, 'parameters');
|
|
@@ -15264,7 +15280,7 @@ func.expression.secure_eval = async function (SESSION_ID, sourceP, val, job_id,
|
|
|
15264
15280
|
func.UI.main = {};
|
|
15265
15281
|
|
|
15266
15282
|
func.UI.main.clear_SYNC_INTERVAL = function () {
|
|
15267
|
-
$(
|
|
15283
|
+
$('body').unbind('mousemove keypress mousedown');
|
|
15268
15284
|
};
|
|
15269
15285
|
func.UI.main.embed_prog_execute = async function (SESSION_ID, prog) {
|
|
15270
15286
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
@@ -15276,16 +15292,13 @@ func.UI.main.embed_prog_execute = async function (SESSION_ID, prog) {
|
|
|
15276
15292
|
var params_obj = {};
|
|
15277
15293
|
if (_prog?.properties?.progParams) {
|
|
15278
15294
|
for (const [key, val] of Object.entries(_prog.properties.progParams)) {
|
|
15279
|
-
if (
|
|
15280
|
-
if (typeof _session.url_params?.[val.data.parameter] !==
|
|
15281
|
-
params_obj[val.data.parameter] =
|
|
15282
|
-
_session.url_params?.[val.data.parameter];
|
|
15295
|
+
if (val.data.dir !== 'in') continue;
|
|
15296
|
+
if (typeof _session.url_params?.[val.data.parameter] !== 'undefined') {
|
|
15297
|
+
params_obj[val.data.parameter] = _session.url_params?.[val.data.parameter];
|
|
15283
15298
|
|
|
15284
15299
|
continue;
|
|
15285
15300
|
}
|
|
15286
|
-
console.warn(
|
|
15287
|
-
`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`
|
|
15288
|
-
);
|
|
15301
|
+
console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
|
|
15289
15302
|
}
|
|
15290
15303
|
}
|
|
15291
15304
|
return params_obj;
|
|
@@ -15293,50 +15306,33 @@ func.UI.main.embed_prog_execute = async function (SESSION_ID, prog) {
|
|
|
15293
15306
|
|
|
15294
15307
|
let screen_ret = await func.utils.get_screen_obj(SESSION_ID, prog);
|
|
15295
15308
|
if (screen_ret) {
|
|
15296
|
-
let ret_init = await func.UI.screen.init(
|
|
15297
|
-
SESSION_ID,
|
|
15298
|
-
prog,
|
|
15299
|
-
null,
|
|
15300
|
-
null,
|
|
15301
|
-
$("#embed_" + SESSION_ID),
|
|
15302
|
-
null,
|
|
15303
|
-
null,
|
|
15304
|
-
null,
|
|
15305
|
-
null,
|
|
15306
|
-
get_params_obj(),
|
|
15307
|
-
"call_embed"
|
|
15308
|
-
);
|
|
15309
|
+
let ret_init = await func.UI.screen.init(SESSION_ID, prog, null, null, $('#embed_' + SESSION_ID), null, null, null, null, get_params_obj(), 'call_embed');
|
|
15309
15310
|
document.title = screen_ret.properties.menuTitle;
|
|
15310
15311
|
|
|
15311
15312
|
return;
|
|
15312
15313
|
}
|
|
15313
15314
|
|
|
15314
|
-
console.error(
|
|
15315
|
-
func.UI.utils.progressScreen.show(
|
|
15316
|
-
SESSION_ID,
|
|
15317
|
-
"Program not exist",
|
|
15318
|
-
null,
|
|
15319
|
-
true
|
|
15320
|
-
);
|
|
15315
|
+
console.error('Program not exist', prog);
|
|
15316
|
+
func.UI.utils.progressScreen.show(SESSION_ID, 'Program not exist', null, true);
|
|
15321
15317
|
// }
|
|
15322
15318
|
};
|
|
15323
15319
|
|
|
15324
15320
|
func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
15325
15321
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
15326
|
-
var hash =
|
|
15322
|
+
var hash = '';
|
|
15327
15323
|
if (window.location.hash) hash = window.location.hash.substr(1);
|
|
15328
15324
|
_session.SYS_GLOBAL_STR_BROWSER_HASH_ID = hash;
|
|
15329
15325
|
_session.SYS_GLOBAL_STR_BROWSER_TITLE = document.title;
|
|
15330
15326
|
|
|
15331
15327
|
const init_system_ds = async function () {
|
|
15332
|
-
if (![
|
|
15333
|
-
await func.index.new_webworker(SESSION_ID, { menuName:
|
|
15328
|
+
if (!['main'].includes(_session.opt.app_computing_mode)) {
|
|
15329
|
+
await func.index.new_webworker(SESSION_ID, { menuName: 'Main' });
|
|
15334
15330
|
// await func.index.call_worker(SESSION_ID, {
|
|
15335
15331
|
// service: "create_webworker_globals",
|
|
15336
15332
|
// data: { ds_data: _session.DS_GLB[0], session_id: SESSION_ID },
|
|
15337
15333
|
// });
|
|
15338
15334
|
}
|
|
15339
|
-
const ret = await func.datasource.create(SESSION_ID,
|
|
15335
|
+
const ret = await func.datasource.create(SESSION_ID, 'system');
|
|
15340
15336
|
|
|
15341
15337
|
/////////// moved to the datasource callback to allow sync on_load events to run at worker
|
|
15342
15338
|
|
|
@@ -15352,12 +15348,7 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15352
15348
|
};
|
|
15353
15349
|
const set_SYS_GLOBAL_KEYS_STATE = async function (SESSION_ID, e, state) {
|
|
15354
15350
|
if (!_session?.DS_GLB?.[0]) return;
|
|
15355
|
-
if (
|
|
15356
|
-
e.keyCode !== 16 &&
|
|
15357
|
-
e.keyCode !== 17 &&
|
|
15358
|
-
e.keyCode !== 18 &&
|
|
15359
|
-
e.keyCode !== 91
|
|
15360
|
-
) {
|
|
15351
|
+
if (e.keyCode !== 16 && e.keyCode !== 17 && e.keyCode !== 18 && e.keyCode !== 91) {
|
|
15361
15352
|
return;
|
|
15362
15353
|
}
|
|
15363
15354
|
|
|
@@ -15378,7 +15369,7 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15378
15369
|
|
|
15379
15370
|
var datasource_changes = {
|
|
15380
15371
|
[0]: {
|
|
15381
|
-
[
|
|
15372
|
+
['data_system']: data,
|
|
15382
15373
|
},
|
|
15383
15374
|
};
|
|
15384
15375
|
await func.datasource.update(SESSION_ID, datasource_changes);
|
|
@@ -15389,38 +15380,32 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15389
15380
|
_session.WORKER_OBJ.fx.init();
|
|
15390
15381
|
};
|
|
15391
15382
|
const create_embed_container = async function () {
|
|
15392
|
-
$(
|
|
15393
|
-
.attr(
|
|
15383
|
+
$('<div>')
|
|
15384
|
+
.attr('id', 'embed_' + SESSION_ID)
|
|
15394
15385
|
|
|
15395
|
-
.addClass(
|
|
15386
|
+
.addClass('xu_embed_div')
|
|
15396
15387
|
.data({ xuData: {} })
|
|
15397
15388
|
.appendTo($(_session.root_element));
|
|
15398
15389
|
};
|
|
15399
15390
|
const execute_PENDING_OPEN_URL_EVENTS = async function () {
|
|
15400
|
-
if (
|
|
15401
|
-
typeof func.events.execute_PENDING_OPEN_URL_EVENTS !== "undefined" &&
|
|
15402
|
-
glb.is_cordova
|
|
15403
|
-
) {
|
|
15391
|
+
if (typeof func.events.execute_PENDING_OPEN_URL_EVENTS !== 'undefined' && glb.is_cordova) {
|
|
15404
15392
|
func.events.execute_PENDING_OPEN_URL_EVENTS();
|
|
15405
15393
|
}
|
|
15406
15394
|
};
|
|
15407
15395
|
|
|
15408
15396
|
const remove_loader = async function () {
|
|
15409
|
-
$(
|
|
15410
|
-
$(_session.root_element).removeClass(
|
|
15397
|
+
$('.loader').remove();
|
|
15398
|
+
$(_session.root_element).removeClass('loader_background_color');
|
|
15411
15399
|
};
|
|
15412
15400
|
const perform_callback = async function () {
|
|
15413
15401
|
if (_session.api_callback) {
|
|
15414
|
-
_session.api_callback(
|
|
15402
|
+
_session.api_callback('xuda_ready', SESSION_ID, SESSION_OBJ);
|
|
15415
15403
|
}
|
|
15416
15404
|
};
|
|
15417
15405
|
|
|
15418
15406
|
const call_program = async function () {
|
|
15419
15407
|
if (_session.route_id) {
|
|
15420
|
-
const route_obj = await func.utils.DOCS_OBJ.get(
|
|
15421
|
-
SESSION_ID,
|
|
15422
|
-
_session.route_id
|
|
15423
|
-
);
|
|
15408
|
+
const route_obj = await func.utils.DOCS_OBJ.get(SESSION_ID, _session.route_id);
|
|
15424
15409
|
|
|
15425
15410
|
function flattenMenuItems(menu) {
|
|
15426
15411
|
let flatMenu = {};
|
|
@@ -15463,50 +15448,25 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15463
15448
|
if (!_session.prog_id) return;
|
|
15464
15449
|
|
|
15465
15450
|
await func.utils.TREE_OBJ.get(SESSION_ID, _session.prog_id);
|
|
15466
|
-
let screen_ret = await func.utils.get_screen_obj(
|
|
15467
|
-
SESSION_ID,
|
|
15468
|
-
_session.prog_id
|
|
15469
|
-
);
|
|
15451
|
+
let screen_ret = await func.utils.get_screen_obj(SESSION_ID, _session.prog_id);
|
|
15470
15452
|
if (screen_ret) {
|
|
15471
15453
|
func.UI.main.embed_prog_execute(SESSION_ID, _session.prog_id);
|
|
15472
15454
|
} else {
|
|
15473
|
-
console.error(
|
|
15474
|
-
func.UI.utils.progressScreen.show(
|
|
15475
|
-
SESSION_ID,
|
|
15476
|
-
"Program not exist",
|
|
15477
|
-
null,
|
|
15478
|
-
true
|
|
15479
|
-
);
|
|
15455
|
+
console.error('Program not exist', _session.prog_id);
|
|
15456
|
+
func.UI.utils.progressScreen.show(SESSION_ID, 'Program not exist', null, true);
|
|
15480
15457
|
}
|
|
15481
15458
|
};
|
|
15482
15459
|
|
|
15483
15460
|
const register_run_background_plugins = async function () {
|
|
15484
|
-
if (typeof glb.SLIM_BUNDLE !==
|
|
15461
|
+
if (typeof glb.SLIM_BUNDLE !== 'undefined' || glb.SLIM_BUNDLE) return;
|
|
15485
15462
|
|
|
15486
|
-
for await (const [plugin_name, val] of Object.entries(
|
|
15487
|
-
|
|
15488
|
-
)) {
|
|
15489
|
-
if (
|
|
15490
|
-
val.installed &&
|
|
15491
|
-
val.run_in_background &&
|
|
15492
|
-
val.manifest?.["runtime.mjs"]?.exist
|
|
15493
|
-
) {
|
|
15463
|
+
for await (const [plugin_name, val] of Object.entries(APP_OBJ[_session.app_id].app_plugins_purchased)) {
|
|
15464
|
+
if (val.installed && val.run_in_background && val.manifest?.['runtime.mjs']?.exist) {
|
|
15494
15465
|
try {
|
|
15495
|
-
const plugin_runtime_src = await func.utils.get_plugin_npm_cdn(
|
|
15496
|
-
SESSION_ID,
|
|
15497
|
-
plugin_name,
|
|
15498
|
-
`${val.manifest["runtime.mjs"].dist ? "dist/" : ""}runtime.mjs`
|
|
15499
|
-
);
|
|
15466
|
+
const plugin_runtime_src = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, `${val.manifest['runtime.mjs'].dist ? 'dist/' : ''}runtime.mjs`);
|
|
15500
15467
|
|
|
15501
|
-
if (
|
|
15502
|
-
|
|
15503
|
-
val.manifest?.["runtime.mjs"]?.css
|
|
15504
|
-
) {
|
|
15505
|
-
const plugin_runtime_css_url = await func.utils.get_plugin_npm_cdn(
|
|
15506
|
-
SESSION_ID,
|
|
15507
|
-
plugin_name,
|
|
15508
|
-
"dist/runtime.css"
|
|
15509
|
-
);
|
|
15468
|
+
if (val.manifest['runtime.mjs'].dist && val.manifest?.['runtime.mjs']?.css) {
|
|
15469
|
+
const plugin_runtime_css_url = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, 'dist/runtime.css');
|
|
15510
15470
|
func.utils.load_css_on_demand(plugin_runtime_css_url);
|
|
15511
15471
|
}
|
|
15512
15472
|
|
|
@@ -15514,20 +15474,13 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15514
15474
|
eval(plugin_script);
|
|
15515
15475
|
|
|
15516
15476
|
let plugin_setup_script_ret = null;
|
|
15517
|
-
if (val.manifest?.[
|
|
15518
|
-
const plugin_setup_src = await func.utils.get_plugin_npm_cdn(
|
|
15519
|
-
SESSION_ID,
|
|
15520
|
-
plugin_name,
|
|
15521
|
-
`${val.manifest["index.mjs"].dist ? "dist/" : ""}index.mjs`
|
|
15522
|
-
);
|
|
15477
|
+
if (val.manifest?.['index.mjs']?.exist) {
|
|
15478
|
+
const plugin_setup_src = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, `${val.manifest['index.mjs'].dist ? 'dist/' : ''}index.mjs`);
|
|
15523
15479
|
|
|
15524
15480
|
let plugin_setup_script = await import(plugin_setup_src);
|
|
15525
15481
|
|
|
15526
15482
|
if (plugin_setup_script) {
|
|
15527
|
-
plugin_setup_script_ret = await func.utils.get_plugin_setup(
|
|
15528
|
-
SESSION_ID,
|
|
15529
|
-
plugin_name
|
|
15530
|
-
);
|
|
15483
|
+
plugin_setup_script_ret = await func.utils.get_plugin_setup(SESSION_ID, plugin_name);
|
|
15531
15484
|
if (plugin_setup_script_ret.code < 0) {
|
|
15532
15485
|
throw plugin_setup_script_ret;
|
|
15533
15486
|
}
|
|
@@ -15554,7 +15507,7 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15554
15507
|
|
|
15555
15508
|
var datasource_changes = {
|
|
15556
15509
|
[0]: {
|
|
15557
|
-
[
|
|
15510
|
+
['data_system']: data,
|
|
15558
15511
|
},
|
|
15559
15512
|
};
|
|
15560
15513
|
await func.datasource.update(SESSION_ID, datasource_changes);
|
|
@@ -15564,20 +15517,20 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15564
15517
|
|
|
15565
15518
|
$(_session.root_element).show();
|
|
15566
15519
|
func.UI.component.create_app_root_component(SESSION_ID);
|
|
15567
|
-
await glb.lifecycle.execute(SESSION_ID,
|
|
15520
|
+
await glb.lifecycle.execute(SESSION_ID, 'beforeInit');
|
|
15568
15521
|
await start_workers();
|
|
15569
15522
|
await init_system_ds();
|
|
15570
|
-
await glb.lifecycle.execute(SESSION_ID,
|
|
15523
|
+
await glb.lifecycle.execute(SESSION_ID, 'initialized');
|
|
15571
15524
|
await create_embed_container();
|
|
15572
15525
|
await execute_PENDING_OPEN_URL_EVENTS();
|
|
15573
15526
|
await remove_loader();
|
|
15574
15527
|
await func.UI.worker.init(SESSION_ID);
|
|
15575
|
-
await glb.lifecycle.execute(SESSION_ID,
|
|
15528
|
+
await glb.lifecycle.execute(SESSION_ID, 'beforeMounted');
|
|
15576
15529
|
await call_program();
|
|
15577
|
-
await glb.lifecycle.execute(SESSION_ID,
|
|
15530
|
+
await glb.lifecycle.execute(SESSION_ID, 'mounted');
|
|
15578
15531
|
await perform_callback();
|
|
15579
|
-
func.utils.debug.write(SESSION_ID,
|
|
15580
|
-
await glb.lifecycle.execute(SESSION_ID,
|
|
15532
|
+
func.utils.debug.write(SESSION_ID, 'Xuda.io started.');
|
|
15533
|
+
await glb.lifecycle.execute(SESSION_ID, 'systemReady');
|
|
15581
15534
|
/////////////////////////////
|
|
15582
15535
|
$(document).keydown(function (e) {
|
|
15583
15536
|
set_SYS_GLOBAL_KEYS_STATE(SESSION_ID, e, 1);
|
|
@@ -15587,23 +15540,14 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15587
15540
|
});
|
|
15588
15541
|
|
|
15589
15542
|
await updateOnlineStatus();
|
|
15590
|
-
window.addEventListener(
|
|
15591
|
-
window.addEventListener(
|
|
15543
|
+
window.addEventListener('online', updateOnlineStatus);
|
|
15544
|
+
window.addEventListener('offline', updateOnlineStatus);
|
|
15592
15545
|
|
|
15593
|
-
console.log(
|
|
15594
|
-
$(
|
|
15546
|
+
console.log('xuda.io system ready.');
|
|
15547
|
+
$('body')[0].dispatchEvent(glb.system_ready_event);
|
|
15595
15548
|
};
|
|
15596
15549
|
func.UI.main.set_custom_css = function (SESSION_ID, callbackP) {
|
|
15597
|
-
if (
|
|
15598
|
-
SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system?.["SYS_GLOBAL_STR_SITE_CSS"]
|
|
15599
|
-
)
|
|
15600
|
-
$(
|
|
15601
|
-
"<style type='text/css'> " +
|
|
15602
|
-
SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system[
|
|
15603
|
-
"SYS_GLOBAL_STR_SITE_CSS"
|
|
15604
|
-
] +
|
|
15605
|
-
" </style>"
|
|
15606
|
-
).appendTo("head");
|
|
15550
|
+
if (SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system?.['SYS_GLOBAL_STR_SITE_CSS']) $("<style type='text/css'> " + SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system['SYS_GLOBAL_STR_SITE_CSS'] + ' </style>').appendTo('head');
|
|
15607
15551
|
callbackP();
|
|
15608
15552
|
};
|
|
15609
15553
|
func.index = {};
|