@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
package/js/xuda-runtime-slim.js
CHANGED
|
@@ -2899,7 +2899,7 @@ func.datasource.create = async function (
|
|
|
2899
2899
|
rowIdP,
|
|
2900
2900
|
jobNoP,
|
|
2901
2901
|
calling_trigger_prop,
|
|
2902
|
-
|
|
2902
|
+
parameters_raw_obj,
|
|
2903
2903
|
NA_isInitP,
|
|
2904
2904
|
NA_callingSourceP,
|
|
2905
2905
|
calling_jobP,
|
|
@@ -2932,6 +2932,7 @@ func.datasource.create = async function (
|
|
|
2932
2932
|
parameters_obj_inP,
|
|
2933
2933
|
static_refreshP,
|
|
2934
2934
|
worker_id,
|
|
2935
|
+
parameters_raw_obj,
|
|
2935
2936
|
};
|
|
2936
2937
|
|
|
2937
2938
|
var IS_DATASOURCE_REFRESH = null;
|
|
@@ -3067,7 +3068,7 @@ func.datasource.create = async function (
|
|
|
3067
3068
|
args.rowIdP,
|
|
3068
3069
|
args.jobNoP,
|
|
3069
3070
|
args.calling_trigger_prop,
|
|
3070
|
-
|
|
3071
|
+
args.parameters_raw_obj,
|
|
3071
3072
|
null,
|
|
3072
3073
|
null,
|
|
3073
3074
|
args.calling_jobP,
|
|
@@ -3108,7 +3109,7 @@ func.datasource.create = async function (
|
|
|
3108
3109
|
return done(SESSION_ID, jsonP.dsSession, true);
|
|
3109
3110
|
});
|
|
3110
3111
|
};
|
|
3111
|
-
func.datasource.prepare = async function (SESSION_ID, prog_id, dataSourceNoP, parentDataSourceNoP, containerIdP, rowIdP, jobNoP, calling_trigger_prop,
|
|
3112
|
+
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) {
|
|
3112
3113
|
const set_parameters = async function () {
|
|
3113
3114
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
3114
3115
|
const get_Out_parameters = async function (fieldIdP, located_field_param_idxP, param_row_idP) {
|
|
@@ -3237,6 +3238,7 @@ func.datasource.prepare = async function (SESSION_ID, prog_id, dataSourceNoP, pa
|
|
|
3237
3238
|
static_refreshP,
|
|
3238
3239
|
run_atP,
|
|
3239
3240
|
worker_id,
|
|
3241
|
+
parameters_raw_obj,
|
|
3240
3242
|
};
|
|
3241
3243
|
|
|
3242
3244
|
var dataSourceSession = null;
|
|
@@ -4155,7 +4157,7 @@ func.datasource.run_events_functions = async function (SESSION_ID, dataSourceSes
|
|
|
4155
4157
|
clearInterval(interval);
|
|
4156
4158
|
resolve(job_num);
|
|
4157
4159
|
}
|
|
4158
|
-
if (i >
|
|
4160
|
+
if (i > 50) {
|
|
4159
4161
|
console.error('deadlock detected');
|
|
4160
4162
|
clearInterval(interval);
|
|
4161
4163
|
resolve(job_num);
|
|
@@ -4893,6 +4895,18 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
4893
4895
|
|
|
4894
4896
|
if (!fields_changed.includes(field_id)) {
|
|
4895
4897
|
fields_changed.push(field_id);
|
|
4898
|
+
|
|
4899
|
+
///// REFRESH PARAMETERS IN
|
|
4900
|
+
// for (const [_dsSession, _ds] of Object.entries(_session.DS_GLB)) {
|
|
4901
|
+
// if (_ds.args.parameters_raw_obj) {
|
|
4902
|
+
// for (const [key, exp] of Object.entries(_ds.args.parameters_raw_obj)) {
|
|
4903
|
+
// if (exp.includes(field_id)) {
|
|
4904
|
+
// let ret = await func.expression.get(SESSION_ID, exp, _dsSession, 'parameters');
|
|
4905
|
+
// _ds.in_parameters[key].value = ret.result;
|
|
4906
|
+
// }
|
|
4907
|
+
// }
|
|
4908
|
+
// }
|
|
4909
|
+
// }
|
|
4896
4910
|
}
|
|
4897
4911
|
if (!datasource_changed.includes(dataSource)) {
|
|
4898
4912
|
datasource_changed.push(dataSource);
|
|
@@ -4939,6 +4953,19 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
4939
4953
|
datasource_changed[0], // refresh the current datasource only
|
|
4940
4954
|
);
|
|
4941
4955
|
}
|
|
4956
|
+
// ///// REFRESH PARAMETERS IN
|
|
4957
|
+
// if (fields_changed.length) {
|
|
4958
|
+
// for (const [_dsSession, _ds] of Object.entries(_session.DS_GLB)) {
|
|
4959
|
+
// if (_ds.args.parameters_raw_obj) {
|
|
4960
|
+
// for (const [key, val] of Object.entries(_ds.args.parameters_raw_obj)) {
|
|
4961
|
+
// if (fields_changed.includes(val)) {
|
|
4962
|
+
// let ret = await func.expression.get(SESSION_ID, '@' + val, _dsSession, 'parameters');
|
|
4963
|
+
// _ds.in_parameters[val].value = ret.result;
|
|
4964
|
+
// }
|
|
4965
|
+
// }
|
|
4966
|
+
// }
|
|
4967
|
+
// }
|
|
4968
|
+
// }
|
|
4942
4969
|
}
|
|
4943
4970
|
resolve();
|
|
4944
4971
|
});
|
|
@@ -9374,7 +9401,7 @@ func.events.execute = async function (
|
|
|
9374
9401
|
var params_obj = {};
|
|
9375
9402
|
if (_prog?.properties?.progParams) {
|
|
9376
9403
|
for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
|
|
9377
|
-
if (val.data.dir
|
|
9404
|
+
if (!val.data.dir === 'in') continue;
|
|
9378
9405
|
if (typeof args.parameters_obj_inP?.[val.data.parameter] !== 'undefined') {
|
|
9379
9406
|
if (args.parameters_obj_inP?.[val.data.parameter].fx) {
|
|
9380
9407
|
let ret = await func.expression.get(SESSION_ID, args.parameters_obj_inP?.[val.data.parameter].fx, dsSession, 'parameters');
|
|
@@ -11162,7 +11189,7 @@ func.expression.secure_eval = async function (SESSION_ID, sourceP, val, job_id,
|
|
|
11162
11189
|
}
|
|
11163
11190
|
};
|
|
11164
11191
|
func.UI.screen = {};
|
|
11165
|
-
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) {
|
|
11192
|
+
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) {
|
|
11166
11193
|
if (!prog_id) return console.error('program is empty');
|
|
11167
11194
|
let screen_ret = await func.utils.get_screen_obj(SESSION_ID, prog_id);
|
|
11168
11195
|
if (!screen_ret) return console.error('program is not a screen object');
|
|
@@ -11215,6 +11242,7 @@ func.UI.screen.init = async function (SESSION_ID, prog_id, sourceScreenP, callin
|
|
|
11215
11242
|
screenInfo,
|
|
11216
11243
|
call_screen_propertiesP,
|
|
11217
11244
|
parentDataSourceNoP: _session.DS_GLB?.[callingDataSource_objP?.dsSession]?.dsSession || callingDataSource_objP?.parentDataSourceNo || 0,
|
|
11245
|
+
parameters_raw_obj,
|
|
11218
11246
|
};
|
|
11219
11247
|
|
|
11220
11248
|
switch (screen_type) {
|
|
@@ -11381,7 +11409,7 @@ func.UI.screen.init = async function (SESSION_ID, prog_id, sourceScreenP, callin
|
|
|
11381
11409
|
rowIdP,
|
|
11382
11410
|
jobNoP,
|
|
11383
11411
|
null,
|
|
11384
|
-
|
|
11412
|
+
parameters_raw_obj,
|
|
11385
11413
|
null,
|
|
11386
11414
|
null,
|
|
11387
11415
|
null,
|
|
@@ -11988,212 +12016,200 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
|
|
|
11988
12016
|
}
|
|
11989
12017
|
};
|
|
11990
12018
|
|
|
11991
|
-
|
|
11992
|
-
//
|
|
11993
|
-
|
|
11994
|
-
|
|
11995
|
-
|
|
11996
|
-
|
|
11997
|
-
|
|
11998
|
-
|
|
11999
|
-
|
|
12000
|
-
|
|
12001
|
-
// }
|
|
12019
|
+
func.UI.screen.refresh_screen_old = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
|
|
12020
|
+
// check the main program
|
|
12021
|
+
if (fields_changed_datasource) {
|
|
12022
|
+
const _session = SESSION_OBJ[SESSION_ID];
|
|
12023
|
+
const _ds = _session.DS_GLB[fields_changed_datasource];
|
|
12024
|
+
const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
12025
|
+
const progDataSource_str = JSON.stringify(prog_doc.progDataSource);
|
|
12026
|
+
for (const field_id of fields_changed_arr || []) {
|
|
12027
|
+
}
|
|
12028
|
+
}
|
|
12002
12029
|
|
|
12003
|
-
|
|
12030
|
+
const panels_obj = await func.UI.utils.get_panels_wrapper_from_dom(SESSION_ID, $(SESSION_OBJ[SESSION_ID].root_element), false);
|
|
12004
12031
|
|
|
12005
|
-
|
|
12006
|
-
|
|
12032
|
+
for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
|
|
12033
|
+
const progDataSource_str = JSON.stringify(panel_val.prog_doc.progDataSource);
|
|
12007
12034
|
|
|
12008
|
-
|
|
12009
|
-
|
|
12010
|
-
|
|
12011
|
-
|
|
12012
|
-
|
|
12013
|
-
|
|
12014
|
-
//
|
|
12015
|
-
|
|
12035
|
+
var found, refresh_reason, refresh_details;
|
|
12036
|
+
if (fields_changed_arr) {
|
|
12037
|
+
if (fields_changed_datasource && panel_val._ds.dsSession <= Number(fields_changed_datasource)) {
|
|
12038
|
+
continue;
|
|
12039
|
+
}
|
|
12040
|
+
for (const field_id of fields_changed_arr) {
|
|
12041
|
+
// get panel attributes
|
|
12042
|
+
const _attributes = panel_val?.panelXuAttributes || {};
|
|
12016
12043
|
|
|
12017
|
-
//
|
|
12018
|
-
|
|
12044
|
+
// detect if program changed
|
|
12045
|
+
found = _attributes['xu-exp:program']?.includes('@' + field_id);
|
|
12019
12046
|
|
|
12020
|
-
|
|
12021
|
-
|
|
12022
|
-
|
|
12023
|
-
|
|
12024
|
-
|
|
12047
|
+
if (found) {
|
|
12048
|
+
refresh_reason = `program ${_attributes['xu-exp:program']} ${field_id} changed `;
|
|
12049
|
+
refresh_details = _attributes;
|
|
12050
|
+
break;
|
|
12051
|
+
}
|
|
12025
12052
|
|
|
12026
|
-
//
|
|
12027
|
-
//
|
|
12028
|
-
|
|
12029
|
-
|
|
12030
|
-
|
|
12053
|
+
// _attributes holds also info of parameters in code_in: @code
|
|
12054
|
+
// search field changed in panel call send parameters exp
|
|
12055
|
+
for (const [attr, value] of Object.entries(_attributes)) {
|
|
12056
|
+
const pattern = /xu-exp:(\w+)/;
|
|
12057
|
+
const match = attr.match(pattern);
|
|
12031
12058
|
|
|
12032
|
-
|
|
12033
|
-
//
|
|
12034
|
-
|
|
12035
|
-
|
|
12036
|
-
//
|
|
12037
|
-
|
|
12038
|
-
//
|
|
12039
|
-
|
|
12040
|
-
//
|
|
12041
|
-
|
|
12059
|
+
if (!match) {
|
|
12060
|
+
// continue if attribute is not expression
|
|
12061
|
+
continue;
|
|
12062
|
+
}
|
|
12063
|
+
// code_in
|
|
12064
|
+
const parameter_in_field_id = match?.[1];
|
|
12065
|
+
// @code
|
|
12066
|
+
if (value.includes(field_id)) {
|
|
12067
|
+
// search parameter in field in the target program's progDataSource
|
|
12068
|
+
found = progDataSource_str?.includes('@' + parameter_in_field_id);
|
|
12042
12069
|
|
|
12043
|
-
|
|
12044
|
-
|
|
12045
|
-
|
|
12070
|
+
if (found) {
|
|
12071
|
+
refresh_reason = `field ${field_id} in progDataSource parameter_in changed`;
|
|
12072
|
+
refresh_details = panel_val?.prog_doc?.progDataSource;
|
|
12046
12073
|
|
|
12047
|
-
|
|
12048
|
-
|
|
12074
|
+
break;
|
|
12075
|
+
}
|
|
12049
12076
|
|
|
12050
|
-
//
|
|
12051
|
-
|
|
12077
|
+
// found = find_field_in_progUi(prog_doc.progUi, parameter_in_field_id, 'xu-for');
|
|
12078
|
+
found = func.UI.find_field_in_progUi_attributes(panel_val.prog_doc.progUi, parameter_in_field_id, 'xu-for').length;
|
|
12052
12079
|
|
|
12053
|
-
|
|
12054
|
-
|
|
12055
|
-
|
|
12080
|
+
if (found) {
|
|
12081
|
+
refresh_reason = `field ${field_id} in progUi xu-for parameter_in changed`;
|
|
12082
|
+
refresh_details = found;
|
|
12056
12083
|
|
|
12057
|
-
|
|
12058
|
-
|
|
12059
|
-
|
|
12060
|
-
|
|
12084
|
+
break;
|
|
12085
|
+
}
|
|
12086
|
+
}
|
|
12087
|
+
}
|
|
12061
12088
|
|
|
12062
|
-
|
|
12089
|
+
if (found) break;
|
|
12063
12090
|
|
|
12064
|
-
//
|
|
12065
|
-
|
|
12066
|
-
|
|
12067
|
-
|
|
12068
|
-
|
|
12091
|
+
// search field changed in the target program's progDataSource // @code
|
|
12092
|
+
found = progDataSource_str?.includes('@' + field_id);
|
|
12093
|
+
if (found) {
|
|
12094
|
+
refresh_reason = `field ${field_id} in progDataSource changed`;
|
|
12095
|
+
refresh_details = panel_val?.prog_doc?.progDataSource;
|
|
12069
12096
|
|
|
12070
|
-
|
|
12071
|
-
|
|
12097
|
+
break;
|
|
12098
|
+
}
|
|
12072
12099
|
|
|
12073
|
-
|
|
12074
|
-
|
|
12075
|
-
|
|
12076
|
-
|
|
12100
|
+
found = func.UI.find_field_in_progUi_attributes(panel_val.prog_doc.progUi, field_id, 'xu-for').length;
|
|
12101
|
+
if (found) {
|
|
12102
|
+
refresh_reason = `field ${field_id} in progUi xu-for changed`;
|
|
12103
|
+
refresh_details = found;
|
|
12077
12104
|
|
|
12078
|
-
|
|
12079
|
-
|
|
12105
|
+
break;
|
|
12106
|
+
}
|
|
12080
12107
|
|
|
12081
|
-
|
|
12082
|
-
|
|
12083
|
-
|
|
12084
|
-
|
|
12085
|
-
|
|
12108
|
+
if (found) {
|
|
12109
|
+
break;
|
|
12110
|
+
}
|
|
12111
|
+
}
|
|
12112
|
+
}
|
|
12086
12113
|
|
|
12087
|
-
|
|
12088
|
-
|
|
12089
|
-
|
|
12090
|
-
|
|
12114
|
+
if (datasource_changed) {
|
|
12115
|
+
if (panel_val._ds.dsSession == datasource_changed) {
|
|
12116
|
+
refresh_reason = `panel datasource ${datasource_changed} changed`;
|
|
12117
|
+
refresh_details = '';
|
|
12091
12118
|
|
|
12092
|
-
|
|
12093
|
-
|
|
12094
|
-
|
|
12095
|
-
|
|
12096
|
-
|
|
12097
|
-
|
|
12098
|
-
|
|
12099
|
-
|
|
12100
|
-
|
|
12101
|
-
|
|
12102
|
-
|
|
12103
|
-
|
|
12104
|
-
|
|
12105
|
-
|
|
12119
|
+
found = true;
|
|
12120
|
+
}
|
|
12121
|
+
}
|
|
12122
|
+
if (found) {
|
|
12123
|
+
const _session = SESSION_OBJ[SESSION_ID];
|
|
12124
|
+
if (_session.engine_mode === 'live_preview') {
|
|
12125
|
+
console.info('========= refresh info ==============');
|
|
12126
|
+
console.info('reason:', refresh_reason);
|
|
12127
|
+
console.info('details:', refresh_details);
|
|
12128
|
+
console.info('panel:', panel_val);
|
|
12129
|
+
console.info('=====================================');
|
|
12130
|
+
}
|
|
12131
|
+
const $div_elm = panel_val.$panel_div;
|
|
12132
|
+
const wrapper_data = $div_elm.data();
|
|
12106
12133
|
|
|
12107
|
-
|
|
12134
|
+
if (_.isEmpty(wrapper_data)) continue;
|
|
12108
12135
|
|
|
12109
|
-
|
|
12110
|
-
|
|
12111
|
-
//
|
|
12112
|
-
|
|
12113
|
-
|
|
12114
|
-
|
|
12115
|
-
|
|
12116
|
-
|
|
12136
|
+
try {
|
|
12137
|
+
const ts = Date.now();
|
|
12138
|
+
// remove old panel content
|
|
12139
|
+
$.each(panel_val.ids, async function (key, val) {
|
|
12140
|
+
$("[xu-ui-id='" + val + "']")
|
|
12141
|
+
.attr('xu-ui-id', val + ts)
|
|
12142
|
+
.removeData();
|
|
12143
|
+
});
|
|
12117
12144
|
|
|
12118
|
-
|
|
12119
|
-
//
|
|
12145
|
+
let refreshed_ds;
|
|
12146
|
+
// check if ds exist and deleted by garbage collector
|
|
12120
12147
|
|
|
12121
|
-
|
|
12122
|
-
|
|
12123
|
-
|
|
12124
|
-
|
|
12125
|
-
|
|
12148
|
+
if (_session.DS_GLB[panel_val._ds.dsSession]) {
|
|
12149
|
+
refreshed_ds = panel_val._ds.dsSession;
|
|
12150
|
+
}
|
|
12151
|
+
for await (const item of wrapper_data.xuData.node_org.children) {
|
|
12152
|
+
if (item.tagName !== 'xu-panel') continue;
|
|
12126
12153
|
|
|
12127
|
-
|
|
12128
|
-
|
|
12129
|
-
|
|
12130
|
-
|
|
12131
|
-
|
|
12132
|
-
|
|
12133
|
-
|
|
12134
|
-
|
|
12135
|
-
|
|
12136
|
-
|
|
12137
|
-
|
|
12138
|
-
|
|
12139
|
-
|
|
12140
|
-
|
|
12141
|
-
|
|
12154
|
+
const new_$div = await func.UI.screen.render_ui_tree(
|
|
12155
|
+
SESSION_ID,
|
|
12156
|
+
$div_elm, // the wrapper
|
|
12157
|
+
_.cloneDeep(item), // _.cloneDeep(wrapper_data.xuData.node_org.children[0]), // the xu-panel node
|
|
12158
|
+
{},
|
|
12159
|
+
wrapper_data.xuData.paramsP, // the wrapper params
|
|
12160
|
+
null,
|
|
12161
|
+
null,
|
|
12162
|
+
wrapper_data.xuData.key, // the wrapper key
|
|
12163
|
+
refreshed_ds, // the refreshed_ds
|
|
12164
|
+
wrapper_data.xuData.parent_node, // the wrapper parent node
|
|
12165
|
+
null,
|
|
12166
|
+
wrapper_data.xuData.$root_container, // the wrapper root container
|
|
12167
|
+
);
|
|
12168
|
+
}
|
|
12142
12169
|
|
|
12143
|
-
//
|
|
12144
|
-
|
|
12145
|
-
|
|
12146
|
-
|
|
12147
|
-
|
|
12148
|
-
|
|
12149
|
-
|
|
12150
|
-
//
|
|
12151
|
-
|
|
12152
|
-
|
|
12153
|
-
|
|
12170
|
+
// remove old panel content
|
|
12171
|
+
$.each(panel_val.ids, async function (key, val) {
|
|
12172
|
+
$("[xu-ui-id='" + val + ts + "']").remove();
|
|
12173
|
+
});
|
|
12174
|
+
} catch (error) {
|
|
12175
|
+
debugger;
|
|
12176
|
+
}
|
|
12177
|
+
// continue;
|
|
12178
|
+
}
|
|
12179
|
+
}
|
|
12180
|
+
};
|
|
12154
12181
|
|
|
12155
12182
|
const get_params_obj_new = async function (SESSION_ID, prog_id, nodeP, dsSession) {
|
|
12156
12183
|
const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);
|
|
12157
12184
|
if (!_prog) return;
|
|
12158
12185
|
|
|
12159
12186
|
// get in parameters
|
|
12160
|
-
|
|
12187
|
+
let params_res = {},
|
|
12188
|
+
params_raw = {};
|
|
12161
12189
|
if (_prog?.properties?.progParams) {
|
|
12162
12190
|
for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
|
|
12163
12191
|
if (!['in', 'out'].includes(val.data.dir)) continue;
|
|
12164
12192
|
|
|
12165
12193
|
if (nodeP.attributes) {
|
|
12166
12194
|
if (nodeP.attributes[val.data.parameter]) {
|
|
12167
|
-
|
|
12195
|
+
params_res[val.data.parameter] = nodeP.attributes[val.data.parameter];
|
|
12168
12196
|
} else if (nodeP.attributes[`xu-exp:${val.data.parameter}`]) {
|
|
12169
12197
|
if (val.data.dir == 'out') {
|
|
12170
12198
|
// only reference
|
|
12171
|
-
|
|
12199
|
+
params_res[val.data.parameter] = nodeP.attributes[`xu-exp:${val.data.parameter}`].replaceAll('@', '');
|
|
12172
12200
|
} else {
|
|
12173
12201
|
// in parameter
|
|
12174
12202
|
let ret = await func.expression.get(SESSION_ID, nodeP.attributes[`xu-exp:${val.data.parameter}`], dsSession, 'parameters');
|
|
12175
|
-
|
|
12203
|
+
params_res[val.data.parameter] = ret.result;
|
|
12204
|
+
params_raw[val.data.parameter] = nodeP.attributes[`xu-exp:${val.data.parameter}`];
|
|
12176
12205
|
}
|
|
12177
12206
|
}
|
|
12178
|
-
|
|
12179
|
-
// if (parameters_obj_inP?.[val.data.parameter].fx) {
|
|
12180
|
-
// let ret = await func.expression.get(
|
|
12181
|
-
// SESSION_ID,
|
|
12182
|
-
// parameters_obj_inP?.[val.data.parameter].fx,
|
|
12183
|
-
// dsSession,
|
|
12184
|
-
// "parameters"
|
|
12185
|
-
// );
|
|
12186
|
-
// params_obj[val.data.parameter] = ret.result;
|
|
12187
|
-
// } else {
|
|
12188
|
-
// params_obj[val.data.parameter] =
|
|
12189
|
-
// parameters_obj_inP?.[val.data.parameter].value;
|
|
12190
|
-
// }
|
|
12191
12207
|
continue;
|
|
12192
12208
|
}
|
|
12193
12209
|
console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
|
|
12194
12210
|
}
|
|
12195
12211
|
}
|
|
12196
|
-
return
|
|
12212
|
+
return { params_res, params_raw };
|
|
12197
12213
|
};
|
|
12198
12214
|
|
|
12199
12215
|
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) {
|
|
@@ -12210,8 +12226,8 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
|
|
|
12210
12226
|
const init_program = async function () {
|
|
12211
12227
|
async function render_panel() {
|
|
12212
12228
|
const prog_id = val.value?.prog || val.value;
|
|
12213
|
-
const
|
|
12214
|
-
let ret_panel = await func.UI.screen.init(SESSION_ID, prog_id, paramsP.screenId, _ds, $elm, null, _ds.currentRecordId, null, true,
|
|
12229
|
+
const params_obj = await get_params_obj_new(SESSION_ID, prog_id, nodeP, paramsP.dsSessionP);
|
|
12230
|
+
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);
|
|
12215
12231
|
ret = { $new_div: ret_panel };
|
|
12216
12232
|
$container.data().xuData.xuPanelProps = $elm.data().xuAttributes;
|
|
12217
12233
|
$container.data().xuData.xuPanelData = ret_panel.data();
|
|
@@ -12260,8 +12276,8 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
|
|
|
12260
12276
|
const program = val.value?.prog || val.value;
|
|
12261
12277
|
var $wrapper = $('<div>');
|
|
12262
12278
|
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, '');
|
|
12263
|
-
const
|
|
12264
|
-
let ret_init = await func.UI.screen.init(SESSION_ID, program, paramsP.screenId, _ds, $div, null, _ds.currentRecordId, jobNoP, true,
|
|
12279
|
+
const params_obj = await get_params_obj_new(SESSION_ID, program, nodeP, paramsP.dsSessionP);
|
|
12280
|
+
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);
|
|
12265
12281
|
ret = {
|
|
12266
12282
|
$new_div: ret_init,
|
|
12267
12283
|
abort: true,
|
|
@@ -15263,7 +15279,7 @@ func.UI.component.init_xu_nav = function ($container, $nav) {
|
|
|
15263
15279
|
func.UI.main = {};
|
|
15264
15280
|
|
|
15265
15281
|
func.UI.main.clear_SYNC_INTERVAL = function () {
|
|
15266
|
-
$(
|
|
15282
|
+
$('body').unbind('mousemove keypress mousedown');
|
|
15267
15283
|
};
|
|
15268
15284
|
func.UI.main.embed_prog_execute = async function (SESSION_ID, prog) {
|
|
15269
15285
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
@@ -15275,16 +15291,13 @@ func.UI.main.embed_prog_execute = async function (SESSION_ID, prog) {
|
|
|
15275
15291
|
var params_obj = {};
|
|
15276
15292
|
if (_prog?.properties?.progParams) {
|
|
15277
15293
|
for (const [key, val] of Object.entries(_prog.properties.progParams)) {
|
|
15278
|
-
if (
|
|
15279
|
-
if (typeof _session.url_params?.[val.data.parameter] !==
|
|
15280
|
-
params_obj[val.data.parameter] =
|
|
15281
|
-
_session.url_params?.[val.data.parameter];
|
|
15294
|
+
if (val.data.dir !== 'in') continue;
|
|
15295
|
+
if (typeof _session.url_params?.[val.data.parameter] !== 'undefined') {
|
|
15296
|
+
params_obj[val.data.parameter] = _session.url_params?.[val.data.parameter];
|
|
15282
15297
|
|
|
15283
15298
|
continue;
|
|
15284
15299
|
}
|
|
15285
|
-
console.warn(
|
|
15286
|
-
`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`
|
|
15287
|
-
);
|
|
15300
|
+
console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
|
|
15288
15301
|
}
|
|
15289
15302
|
}
|
|
15290
15303
|
return params_obj;
|
|
@@ -15292,50 +15305,33 @@ func.UI.main.embed_prog_execute = async function (SESSION_ID, prog) {
|
|
|
15292
15305
|
|
|
15293
15306
|
let screen_ret = await func.utils.get_screen_obj(SESSION_ID, prog);
|
|
15294
15307
|
if (screen_ret) {
|
|
15295
|
-
let ret_init = await func.UI.screen.init(
|
|
15296
|
-
SESSION_ID,
|
|
15297
|
-
prog,
|
|
15298
|
-
null,
|
|
15299
|
-
null,
|
|
15300
|
-
$("#embed_" + SESSION_ID),
|
|
15301
|
-
null,
|
|
15302
|
-
null,
|
|
15303
|
-
null,
|
|
15304
|
-
null,
|
|
15305
|
-
get_params_obj(),
|
|
15306
|
-
"call_embed"
|
|
15307
|
-
);
|
|
15308
|
+
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');
|
|
15308
15309
|
document.title = screen_ret.properties.menuTitle;
|
|
15309
15310
|
|
|
15310
15311
|
return;
|
|
15311
15312
|
}
|
|
15312
15313
|
|
|
15313
|
-
console.error(
|
|
15314
|
-
func.UI.utils.progressScreen.show(
|
|
15315
|
-
SESSION_ID,
|
|
15316
|
-
"Program not exist",
|
|
15317
|
-
null,
|
|
15318
|
-
true
|
|
15319
|
-
);
|
|
15314
|
+
console.error('Program not exist', prog);
|
|
15315
|
+
func.UI.utils.progressScreen.show(SESSION_ID, 'Program not exist', null, true);
|
|
15320
15316
|
// }
|
|
15321
15317
|
};
|
|
15322
15318
|
|
|
15323
15319
|
func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
15324
15320
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
15325
|
-
var hash =
|
|
15321
|
+
var hash = '';
|
|
15326
15322
|
if (window.location.hash) hash = window.location.hash.substr(1);
|
|
15327
15323
|
_session.SYS_GLOBAL_STR_BROWSER_HASH_ID = hash;
|
|
15328
15324
|
_session.SYS_GLOBAL_STR_BROWSER_TITLE = document.title;
|
|
15329
15325
|
|
|
15330
15326
|
const init_system_ds = async function () {
|
|
15331
|
-
if (![
|
|
15332
|
-
await func.index.new_webworker(SESSION_ID, { menuName:
|
|
15327
|
+
if (!['main'].includes(_session.opt.app_computing_mode)) {
|
|
15328
|
+
await func.index.new_webworker(SESSION_ID, { menuName: 'Main' });
|
|
15333
15329
|
// await func.index.call_worker(SESSION_ID, {
|
|
15334
15330
|
// service: "create_webworker_globals",
|
|
15335
15331
|
// data: { ds_data: _session.DS_GLB[0], session_id: SESSION_ID },
|
|
15336
15332
|
// });
|
|
15337
15333
|
}
|
|
15338
|
-
const ret = await func.datasource.create(SESSION_ID,
|
|
15334
|
+
const ret = await func.datasource.create(SESSION_ID, 'system');
|
|
15339
15335
|
|
|
15340
15336
|
/////////// moved to the datasource callback to allow sync on_load events to run at worker
|
|
15341
15337
|
|
|
@@ -15351,12 +15347,7 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15351
15347
|
};
|
|
15352
15348
|
const set_SYS_GLOBAL_KEYS_STATE = async function (SESSION_ID, e, state) {
|
|
15353
15349
|
if (!_session?.DS_GLB?.[0]) return;
|
|
15354
|
-
if (
|
|
15355
|
-
e.keyCode !== 16 &&
|
|
15356
|
-
e.keyCode !== 17 &&
|
|
15357
|
-
e.keyCode !== 18 &&
|
|
15358
|
-
e.keyCode !== 91
|
|
15359
|
-
) {
|
|
15350
|
+
if (e.keyCode !== 16 && e.keyCode !== 17 && e.keyCode !== 18 && e.keyCode !== 91) {
|
|
15360
15351
|
return;
|
|
15361
15352
|
}
|
|
15362
15353
|
|
|
@@ -15377,7 +15368,7 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15377
15368
|
|
|
15378
15369
|
var datasource_changes = {
|
|
15379
15370
|
[0]: {
|
|
15380
|
-
[
|
|
15371
|
+
['data_system']: data,
|
|
15381
15372
|
},
|
|
15382
15373
|
};
|
|
15383
15374
|
await func.datasource.update(SESSION_ID, datasource_changes);
|
|
@@ -15388,38 +15379,32 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15388
15379
|
_session.WORKER_OBJ.fx.init();
|
|
15389
15380
|
};
|
|
15390
15381
|
const create_embed_container = async function () {
|
|
15391
|
-
$(
|
|
15392
|
-
.attr(
|
|
15382
|
+
$('<div>')
|
|
15383
|
+
.attr('id', 'embed_' + SESSION_ID)
|
|
15393
15384
|
|
|
15394
|
-
.addClass(
|
|
15385
|
+
.addClass('xu_embed_div')
|
|
15395
15386
|
.data({ xuData: {} })
|
|
15396
15387
|
.appendTo($(_session.root_element));
|
|
15397
15388
|
};
|
|
15398
15389
|
const execute_PENDING_OPEN_URL_EVENTS = async function () {
|
|
15399
|
-
if (
|
|
15400
|
-
typeof func.events.execute_PENDING_OPEN_URL_EVENTS !== "undefined" &&
|
|
15401
|
-
glb.is_cordova
|
|
15402
|
-
) {
|
|
15390
|
+
if (typeof func.events.execute_PENDING_OPEN_URL_EVENTS !== 'undefined' && glb.is_cordova) {
|
|
15403
15391
|
func.events.execute_PENDING_OPEN_URL_EVENTS();
|
|
15404
15392
|
}
|
|
15405
15393
|
};
|
|
15406
15394
|
|
|
15407
15395
|
const remove_loader = async function () {
|
|
15408
|
-
$(
|
|
15409
|
-
$(_session.root_element).removeClass(
|
|
15396
|
+
$('.loader').remove();
|
|
15397
|
+
$(_session.root_element).removeClass('loader_background_color');
|
|
15410
15398
|
};
|
|
15411
15399
|
const perform_callback = async function () {
|
|
15412
15400
|
if (_session.api_callback) {
|
|
15413
|
-
_session.api_callback(
|
|
15401
|
+
_session.api_callback('xuda_ready', SESSION_ID, SESSION_OBJ);
|
|
15414
15402
|
}
|
|
15415
15403
|
};
|
|
15416
15404
|
|
|
15417
15405
|
const call_program = async function () {
|
|
15418
15406
|
if (_session.route_id) {
|
|
15419
|
-
const route_obj = await func.utils.DOCS_OBJ.get(
|
|
15420
|
-
SESSION_ID,
|
|
15421
|
-
_session.route_id
|
|
15422
|
-
);
|
|
15407
|
+
const route_obj = await func.utils.DOCS_OBJ.get(SESSION_ID, _session.route_id);
|
|
15423
15408
|
|
|
15424
15409
|
function flattenMenuItems(menu) {
|
|
15425
15410
|
let flatMenu = {};
|
|
@@ -15462,50 +15447,25 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15462
15447
|
if (!_session.prog_id) return;
|
|
15463
15448
|
|
|
15464
15449
|
await func.utils.TREE_OBJ.get(SESSION_ID, _session.prog_id);
|
|
15465
|
-
let screen_ret = await func.utils.get_screen_obj(
|
|
15466
|
-
SESSION_ID,
|
|
15467
|
-
_session.prog_id
|
|
15468
|
-
);
|
|
15450
|
+
let screen_ret = await func.utils.get_screen_obj(SESSION_ID, _session.prog_id);
|
|
15469
15451
|
if (screen_ret) {
|
|
15470
15452
|
func.UI.main.embed_prog_execute(SESSION_ID, _session.prog_id);
|
|
15471
15453
|
} else {
|
|
15472
|
-
console.error(
|
|
15473
|
-
func.UI.utils.progressScreen.show(
|
|
15474
|
-
SESSION_ID,
|
|
15475
|
-
"Program not exist",
|
|
15476
|
-
null,
|
|
15477
|
-
true
|
|
15478
|
-
);
|
|
15454
|
+
console.error('Program not exist', _session.prog_id);
|
|
15455
|
+
func.UI.utils.progressScreen.show(SESSION_ID, 'Program not exist', null, true);
|
|
15479
15456
|
}
|
|
15480
15457
|
};
|
|
15481
15458
|
|
|
15482
15459
|
const register_run_background_plugins = async function () {
|
|
15483
|
-
if (typeof glb.SLIM_BUNDLE !==
|
|
15460
|
+
if (typeof glb.SLIM_BUNDLE !== 'undefined' || glb.SLIM_BUNDLE) return;
|
|
15484
15461
|
|
|
15485
|
-
for await (const [plugin_name, val] of Object.entries(
|
|
15486
|
-
|
|
15487
|
-
)) {
|
|
15488
|
-
if (
|
|
15489
|
-
val.installed &&
|
|
15490
|
-
val.run_in_background &&
|
|
15491
|
-
val.manifest?.["runtime.mjs"]?.exist
|
|
15492
|
-
) {
|
|
15462
|
+
for await (const [plugin_name, val] of Object.entries(APP_OBJ[_session.app_id].app_plugins_purchased)) {
|
|
15463
|
+
if (val.installed && val.run_in_background && val.manifest?.['runtime.mjs']?.exist) {
|
|
15493
15464
|
try {
|
|
15494
|
-
const plugin_runtime_src = await func.utils.get_plugin_npm_cdn(
|
|
15495
|
-
SESSION_ID,
|
|
15496
|
-
plugin_name,
|
|
15497
|
-
`${val.manifest["runtime.mjs"].dist ? "dist/" : ""}runtime.mjs`
|
|
15498
|
-
);
|
|
15465
|
+
const plugin_runtime_src = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, `${val.manifest['runtime.mjs'].dist ? 'dist/' : ''}runtime.mjs`);
|
|
15499
15466
|
|
|
15500
|
-
if (
|
|
15501
|
-
|
|
15502
|
-
val.manifest?.["runtime.mjs"]?.css
|
|
15503
|
-
) {
|
|
15504
|
-
const plugin_runtime_css_url = await func.utils.get_plugin_npm_cdn(
|
|
15505
|
-
SESSION_ID,
|
|
15506
|
-
plugin_name,
|
|
15507
|
-
"dist/runtime.css"
|
|
15508
|
-
);
|
|
15467
|
+
if (val.manifest['runtime.mjs'].dist && val.manifest?.['runtime.mjs']?.css) {
|
|
15468
|
+
const plugin_runtime_css_url = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, 'dist/runtime.css');
|
|
15509
15469
|
func.utils.load_css_on_demand(plugin_runtime_css_url);
|
|
15510
15470
|
}
|
|
15511
15471
|
|
|
@@ -15513,20 +15473,13 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15513
15473
|
eval(plugin_script);
|
|
15514
15474
|
|
|
15515
15475
|
let plugin_setup_script_ret = null;
|
|
15516
|
-
if (val.manifest?.[
|
|
15517
|
-
const plugin_setup_src = await func.utils.get_plugin_npm_cdn(
|
|
15518
|
-
SESSION_ID,
|
|
15519
|
-
plugin_name,
|
|
15520
|
-
`${val.manifest["index.mjs"].dist ? "dist/" : ""}index.mjs`
|
|
15521
|
-
);
|
|
15476
|
+
if (val.manifest?.['index.mjs']?.exist) {
|
|
15477
|
+
const plugin_setup_src = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, `${val.manifest['index.mjs'].dist ? 'dist/' : ''}index.mjs`);
|
|
15522
15478
|
|
|
15523
15479
|
let plugin_setup_script = await import(plugin_setup_src);
|
|
15524
15480
|
|
|
15525
15481
|
if (plugin_setup_script) {
|
|
15526
|
-
plugin_setup_script_ret = await func.utils.get_plugin_setup(
|
|
15527
|
-
SESSION_ID,
|
|
15528
|
-
plugin_name
|
|
15529
|
-
);
|
|
15482
|
+
plugin_setup_script_ret = await func.utils.get_plugin_setup(SESSION_ID, plugin_name);
|
|
15530
15483
|
if (plugin_setup_script_ret.code < 0) {
|
|
15531
15484
|
throw plugin_setup_script_ret;
|
|
15532
15485
|
}
|
|
@@ -15553,7 +15506,7 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15553
15506
|
|
|
15554
15507
|
var datasource_changes = {
|
|
15555
15508
|
[0]: {
|
|
15556
|
-
[
|
|
15509
|
+
['data_system']: data,
|
|
15557
15510
|
},
|
|
15558
15511
|
};
|
|
15559
15512
|
await func.datasource.update(SESSION_ID, datasource_changes);
|
|
@@ -15563,20 +15516,20 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15563
15516
|
|
|
15564
15517
|
$(_session.root_element).show();
|
|
15565
15518
|
func.UI.component.create_app_root_component(SESSION_ID);
|
|
15566
|
-
await glb.lifecycle.execute(SESSION_ID,
|
|
15519
|
+
await glb.lifecycle.execute(SESSION_ID, 'beforeInit');
|
|
15567
15520
|
await start_workers();
|
|
15568
15521
|
await init_system_ds();
|
|
15569
|
-
await glb.lifecycle.execute(SESSION_ID,
|
|
15522
|
+
await glb.lifecycle.execute(SESSION_ID, 'initialized');
|
|
15570
15523
|
await create_embed_container();
|
|
15571
15524
|
await execute_PENDING_OPEN_URL_EVENTS();
|
|
15572
15525
|
await remove_loader();
|
|
15573
15526
|
await func.UI.worker.init(SESSION_ID);
|
|
15574
|
-
await glb.lifecycle.execute(SESSION_ID,
|
|
15527
|
+
await glb.lifecycle.execute(SESSION_ID, 'beforeMounted');
|
|
15575
15528
|
await call_program();
|
|
15576
|
-
await glb.lifecycle.execute(SESSION_ID,
|
|
15529
|
+
await glb.lifecycle.execute(SESSION_ID, 'mounted');
|
|
15577
15530
|
await perform_callback();
|
|
15578
|
-
func.utils.debug.write(SESSION_ID,
|
|
15579
|
-
await glb.lifecycle.execute(SESSION_ID,
|
|
15531
|
+
func.utils.debug.write(SESSION_ID, 'Xuda.io started.');
|
|
15532
|
+
await glb.lifecycle.execute(SESSION_ID, 'systemReady');
|
|
15580
15533
|
/////////////////////////////
|
|
15581
15534
|
$(document).keydown(function (e) {
|
|
15582
15535
|
set_SYS_GLOBAL_KEYS_STATE(SESSION_ID, e, 1);
|
|
@@ -15586,23 +15539,14 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15586
15539
|
});
|
|
15587
15540
|
|
|
15588
15541
|
await updateOnlineStatus();
|
|
15589
|
-
window.addEventListener(
|
|
15590
|
-
window.addEventListener(
|
|
15542
|
+
window.addEventListener('online', updateOnlineStatus);
|
|
15543
|
+
window.addEventListener('offline', updateOnlineStatus);
|
|
15591
15544
|
|
|
15592
|
-
console.log(
|
|
15593
|
-
$(
|
|
15545
|
+
console.log('xuda.io system ready.');
|
|
15546
|
+
$('body')[0].dispatchEvent(glb.system_ready_event);
|
|
15594
15547
|
};
|
|
15595
15548
|
func.UI.main.set_custom_css = function (SESSION_ID, callbackP) {
|
|
15596
|
-
if (
|
|
15597
|
-
SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system?.["SYS_GLOBAL_STR_SITE_CSS"]
|
|
15598
|
-
)
|
|
15599
|
-
$(
|
|
15600
|
-
"<style type='text/css'> " +
|
|
15601
|
-
SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system[
|
|
15602
|
-
"SYS_GLOBAL_STR_SITE_CSS"
|
|
15603
|
-
] +
|
|
15604
|
-
" </style>"
|
|
15605
|
-
).appendTo("head");
|
|
15549
|
+
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');
|
|
15606
15550
|
callbackP();
|
|
15607
15551
|
};
|
|
15608
15552
|
func.index = {};
|