@xuda.io/runtime-bundle 1.0.608 → 1.0.610
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 +122 -1583
- package/js/xuda-runtime-bundle.min.js +1 -1
- package/js/xuda-runtime-slim.js +122 -1583
- package/js/xuda-runtime-slim.min.es.js +121 -167
- package/js/xuda-runtime-slim.min.js +1 -1
- package/package.json +1 -1
package/js/xuda-runtime-slim.js
CHANGED
|
@@ -8500,40 +8500,40 @@ func.UI.utils.init_ui_framework = async function (SESSION_ID, prog_id) {
|
|
|
8500
8500
|
}
|
|
8501
8501
|
};
|
|
8502
8502
|
// old
|
|
8503
|
-
func.UI.utils.get_panels_from_dom = function (SESSION_ID, ignore_disableAutoRefresh) {
|
|
8504
|
-
|
|
8505
|
-
|
|
8503
|
+
// func.UI.utils.get_panels_from_dom = function (SESSION_ID, ignore_disableAutoRefresh) {
|
|
8504
|
+
// const $elm = func.UI.utils.find_in_element_data('xuPanelData', $(SESSION_OBJ[SESSION_ID].root_element), 'parent_element_ui_id');
|
|
8505
|
+
// var panels_obj = {};
|
|
8506
8506
|
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8507
|
+
// // set panels_obj
|
|
8508
|
+
// for (const [elem_key, elem_val] of Object.entries($elm)) {
|
|
8509
|
+
// if (elem_key === 'length') break;
|
|
8510
|
+
// var $div = $(elem_val);
|
|
8511
|
+
// let xuData = $div.data().xuData;
|
|
8512
8512
|
|
|
8513
|
-
|
|
8513
|
+
// if (!$div.data().xuPanelData) continue;
|
|
8514
8514
|
|
|
8515
|
-
|
|
8516
|
-
|
|
8517
|
-
|
|
8518
|
-
|
|
8515
|
+
// let dsSession = xuData.paramsP.dsSessionP;
|
|
8516
|
+
// var _session = SESSION_OBJ[SESSION_ID];
|
|
8517
|
+
// let _ds = _session?.DS_GLB[dsSession];
|
|
8518
|
+
// if (!_ds) continue;
|
|
8519
8519
|
|
|
8520
|
-
|
|
8521
|
-
|
|
8522
|
-
|
|
8520
|
+
// if (!ignore_disableAutoRefresh && _ds.tree_obj.disableAutoRefresh) {
|
|
8521
|
+
// continue;
|
|
8522
|
+
// }
|
|
8523
8523
|
|
|
8524
|
-
|
|
8525
|
-
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
|
|
8529
|
-
|
|
8530
|
-
|
|
8531
|
-
|
|
8532
|
-
|
|
8533
|
-
|
|
8524
|
+
// const parent_element_ui_id = $div.data().xuPanelData.parent_element_ui_id;
|
|
8525
|
+
// if (!panels_obj[parent_element_ui_id]) {
|
|
8526
|
+
// panels_obj[parent_element_ui_id] = {
|
|
8527
|
+
// _ds,
|
|
8528
|
+
// $div,
|
|
8529
|
+
// ids: [],
|
|
8530
|
+
// };
|
|
8531
|
+
// }
|
|
8532
|
+
// panels_obj[parent_element_ui_id].ids.push($div.attr('xu-ui-id'));
|
|
8533
|
+
// }
|
|
8534
8534
|
|
|
8535
|
-
|
|
8536
|
-
};
|
|
8535
|
+
// return panels_obj;
|
|
8536
|
+
// };
|
|
8537
8537
|
|
|
8538
8538
|
func.UI.utils.get_panels_wrapper_from_dom = async function (SESSION_ID, $xu_embed_container, ignore_disableAutoRefresh) {
|
|
8539
8539
|
const $elm = func.UI.utils.find_in_element_data('xuPanelWrapper', $(SESSION_OBJ[SESSION_ID].root_element), 'isWrapper');
|
|
@@ -11910,31 +11910,6 @@ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, j
|
|
|
11910
11910
|
const _elem_val = { attributes: [], $elm: _$elem };
|
|
11911
11911
|
if (!_$elem?.length) continue;
|
|
11912
11912
|
|
|
11913
|
-
// if (!_$elem?.length) {
|
|
11914
|
-
// // xu-for may exist in the panel root
|
|
11915
|
-
// if (!panel_wrapper_element_ui_id) continue;
|
|
11916
|
-
|
|
11917
|
-
// $.each(item.attributes, function (key, val) {
|
|
11918
|
-
// _elem_val.attributes.push(key);
|
|
11919
|
-
// });
|
|
11920
|
-
// // _$elem = $(`[xu-ui-id="${panel_wrapper_element}"]`);
|
|
11921
|
-
// await func.UI.worker.add_to_queue(
|
|
11922
|
-
// SESSION_ID,
|
|
11923
|
-
// 'gui event',
|
|
11924
|
-
// 'execute_xu_for',
|
|
11925
|
-
// {
|
|
11926
|
-
// ui_type: _elem_val.$elm.data().xuData.ui_type,
|
|
11927
|
-
// SESSION_ID,
|
|
11928
|
-
// elem_key: _elem_key,
|
|
11929
|
-
// elem_val: _elem_val,
|
|
11930
|
-
// fields_arr,
|
|
11931
|
-
// },
|
|
11932
|
-
// new_job,
|
|
11933
|
-
// _elem_val.$elm,
|
|
11934
|
-
// _elem_val.$elm.data().xuData.paramsP.dsSessionP,
|
|
11935
|
-
// );
|
|
11936
|
-
// }
|
|
11937
|
-
|
|
11938
11913
|
if (refreshed_ids.includes(_$elem.attr('xu-ui-id'))) break;
|
|
11939
11914
|
|
|
11940
11915
|
$.each(_$elem.data()?.xuAttributes, function (key, val) {
|
|
@@ -11972,7 +11947,6 @@ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, j
|
|
|
11972
11947
|
|
|
11973
11948
|
const $xu_embed_container = $('.xu_embed_container');
|
|
11974
11949
|
const panels_obj = await func.UI.utils.get_panels_wrapper_from_dom(SESSION_ID, $xu_embed_container, true);
|
|
11975
|
-
// let inviable_panels_obj = {};
|
|
11976
11950
|
|
|
11977
11951
|
for await (const field_id of fields_arr) {
|
|
11978
11952
|
// run root
|
|
@@ -11980,29 +11954,12 @@ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, j
|
|
|
11980
11954
|
const progUi = $xu_embed_container?.data()?.xuData?.screenInfo?.progUi;
|
|
11981
11955
|
if (progUi) {
|
|
11982
11956
|
await iterate_field_in_progUi(progUi, field_id);
|
|
11983
|
-
// // find invisible panels
|
|
11984
|
-
// const inviable_panels_arr = func.UI.find_field_in_progUi_attributes(progUi, field_id, null, 'xu-panel');
|
|
11985
|
-
// console.log('inviable_panels_arr', inviable_panels_arr);
|
|
11986
|
-
// let prog_id = elm_node?.attributes?.program;
|
|
11987
|
-
// const exp = elm_node?.attributes?.['xu-exp:program'];
|
|
11988
|
-
// if (exp) {
|
|
11989
|
-
// let exp_ret = await func.expression.get(SESSION_ID, exp, $xu_embed_container?.data()?.xuData?.paramsP?.dsSessionP, 'UI Attr EXP');
|
|
11990
|
-
// prog_id = func.UI.screen.fix_val_defaults('program', exp_ret.result);
|
|
11991
|
-
// inviable_panels_obj[elm_node.id] = { prog_id };
|
|
11992
|
-
// }
|
|
11993
11957
|
}
|
|
11994
11958
|
}
|
|
11995
11959
|
// run panels
|
|
11996
11960
|
for await (const [panel_wrapper_element_ui_id, panel_val] of Object.entries(panels_obj)) {
|
|
11997
|
-
// const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, panel_val.prog_id);
|
|
11998
11961
|
await iterate_field_in_progUi(panel_val.progUi, field_id);
|
|
11999
11962
|
}
|
|
12000
|
-
|
|
12001
|
-
// // run invisible panels
|
|
12002
|
-
// for await (const [parent_element_ui_id, panel_val] of Object.entries(inviable_panels_obj)) {
|
|
12003
|
-
// const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, panel_val.prog_id);
|
|
12004
|
-
// await iterate_field_in_progUi(prog_doc.progUi, field_id);
|
|
12005
|
-
// }
|
|
12006
11963
|
}
|
|
12007
11964
|
|
|
12008
11965
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
@@ -12020,9 +11977,6 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
|
|
|
12020
11977
|
|
|
12021
11978
|
var found, refresh_reason, refresh_details;
|
|
12022
11979
|
if (fields_changed_arr) {
|
|
12023
|
-
// if (fields_changed_datasource && panel_val._ds.dsSession < fields_changed_datasource) {
|
|
12024
|
-
// continue;
|
|
12025
|
-
// }
|
|
12026
11980
|
if (fields_changed_datasource && panel_val._ds.dsSession <= Number(fields_changed_datasource)) {
|
|
12027
11981
|
continue;
|
|
12028
11982
|
}
|
|
@@ -12123,43 +12077,43 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
|
|
|
12123
12077
|
if (_.isEmpty(wrapper_data)) continue;
|
|
12124
12078
|
|
|
12125
12079
|
try {
|
|
12126
|
-
// const panelDivData = panel_val.$panel_div.data().xuPanelWrapper.panelDivData;
|
|
12127
12080
|
const ts = Date.now();
|
|
12128
12081
|
// remove old panel content
|
|
12129
12082
|
$.each(panel_val.ids, async function (key, val) {
|
|
12130
12083
|
$("[xu-ui-id='" + val + "']")
|
|
12131
12084
|
.attr('xu-ui-id', val + ts)
|
|
12132
12085
|
.removeData();
|
|
12133
|
-
// .css('filter', 'blur(1px)');
|
|
12134
12086
|
});
|
|
12135
12087
|
|
|
12136
12088
|
let refreshed_ds;
|
|
12137
12089
|
// check if ds exist and deleted by garbage collector
|
|
12138
12090
|
|
|
12139
|
-
// const _session = SESSION_OBJ[SESSION_ID];
|
|
12140
12091
|
if (_session.DS_GLB[panel_val._ds.dsSession]) {
|
|
12141
12092
|
refreshed_ds = panel_val._ds.dsSession;
|
|
12142
12093
|
}
|
|
12094
|
+
for await (const item of wrapper_data.xuData.node_org.children) {
|
|
12095
|
+
if (item.tagName !== 'xu-panel') continue;
|
|
12143
12096
|
|
|
12144
|
-
|
|
12145
|
-
|
|
12146
|
-
|
|
12147
|
-
|
|
12148
|
-
|
|
12149
|
-
|
|
12150
|
-
|
|
12151
|
-
|
|
12152
|
-
|
|
12153
|
-
|
|
12154
|
-
|
|
12155
|
-
|
|
12156
|
-
|
|
12157
|
-
|
|
12097
|
+
const new_$div = await func.UI.screen.render_ui_tree(
|
|
12098
|
+
SESSION_ID,
|
|
12099
|
+
$div_elm, // the wrapper
|
|
12100
|
+
_.cloneDeep(item), // _.cloneDeep(wrapper_data.xuData.node_org.children[0]), // the xu-panel node
|
|
12101
|
+
{},
|
|
12102
|
+
wrapper_data.xuData.paramsP, // the wrapper params
|
|
12103
|
+
null,
|
|
12104
|
+
null,
|
|
12105
|
+
wrapper_data.xuData.key, // the wrapper key
|
|
12106
|
+
refreshed_ds, // the refreshed_ds
|
|
12107
|
+
wrapper_data.xuData.parent_node, // the wrapper parent node
|
|
12108
|
+
null,
|
|
12109
|
+
wrapper_data.xuData.$root_container, // the wrapper root container
|
|
12110
|
+
);
|
|
12158
12111
|
|
|
12159
|
-
|
|
12160
|
-
|
|
12161
|
-
|
|
12162
|
-
|
|
12112
|
+
// remove old panel content
|
|
12113
|
+
$.each(panel_val.ids, async function (key, val) {
|
|
12114
|
+
$("[xu-ui-id='" + val + ts + "']").remove();
|
|
12115
|
+
});
|
|
12116
|
+
}
|
|
12163
12117
|
} catch (error) {
|
|
12164
12118
|
debugger;
|
|
12165
12119
|
}
|
|
@@ -12168,86 +12122,86 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
|
|
|
12168
12122
|
}
|
|
12169
12123
|
};
|
|
12170
12124
|
|
|
12171
|
-
func.UI.screen.refresh_screen_old = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
|
|
12172
|
-
|
|
12173
|
-
|
|
12174
|
-
for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
|
|
12175
|
-
const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, panel_val._ds.prog_id);
|
|
12176
|
-
const progDataSource_str = JSON.stringify(prog_doc.progDataSource);
|
|
12177
|
-
|
|
12178
|
-
var found;
|
|
12179
|
-
if (fields_changed_arr) {
|
|
12180
|
-
if (fields_changed_datasource && panel_val._ds.dsSession < fields_changed_datasource) {
|
|
12181
|
-
continue;
|
|
12182
|
-
}
|
|
12183
|
-
for (const field_id of fields_changed_arr) {
|
|
12184
|
-
// get panel attributes
|
|
12185
|
-
const _attributes = panel_val?.$div?.data()?.xuPanelData?.node?.attributes || {};
|
|
12186
|
-
|
|
12187
|
-
// detect if program changed
|
|
12188
|
-
found = _attributes['xu-exp:program']?.includes('@' + field_id);
|
|
12189
|
-
if (found) break;
|
|
12190
|
-
|
|
12191
|
-
// _attributes holds also info of parameters in code_in: @code
|
|
12192
|
-
// search field changed in panel call send parameters exp
|
|
12193
|
-
for (const [attr, value] of Object.entries(_attributes)) {
|
|
12194
|
-
const pattern = /xu-exp:(\w+)/;
|
|
12195
|
-
const match = attr.match(pattern);
|
|
12125
|
+
// func.UI.screen.refresh_screen_old = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
|
|
12126
|
+
// const panels_obj = func.UI.utils.get_panels_from_dom(SESSION_ID, false);
|
|
12196
12127
|
|
|
12197
|
-
|
|
12198
|
-
|
|
12199
|
-
|
|
12200
|
-
}
|
|
12201
|
-
// code_in
|
|
12202
|
-
const parameter_in_field_id = match?.[1];
|
|
12203
|
-
// @code
|
|
12204
|
-
if (value.includes(field_id)) {
|
|
12205
|
-
// search parameter in field in the target program's progDataSource
|
|
12206
|
-
found = progDataSource_str?.includes('@' + parameter_in_field_id);
|
|
12207
|
-
if (found) break;
|
|
12128
|
+
// for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
|
|
12129
|
+
// const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, panel_val._ds.prog_id);
|
|
12130
|
+
// const progDataSource_str = JSON.stringify(prog_doc.progDataSource);
|
|
12208
12131
|
|
|
12209
|
-
|
|
12210
|
-
|
|
12211
|
-
|
|
12212
|
-
|
|
12213
|
-
|
|
12132
|
+
// var found;
|
|
12133
|
+
// if (fields_changed_arr) {
|
|
12134
|
+
// if (fields_changed_datasource && panel_val._ds.dsSession < fields_changed_datasource) {
|
|
12135
|
+
// continue;
|
|
12136
|
+
// }
|
|
12137
|
+
// for (const field_id of fields_changed_arr) {
|
|
12138
|
+
// // get panel attributes
|
|
12139
|
+
// const _attributes = panel_val?.$div?.data()?.xuPanelData?.node?.attributes || {};
|
|
12140
|
+
|
|
12141
|
+
// // detect if program changed
|
|
12142
|
+
// found = _attributes['xu-exp:program']?.includes('@' + field_id);
|
|
12143
|
+
// if (found) break;
|
|
12144
|
+
|
|
12145
|
+
// // _attributes holds also info of parameters in code_in: @code
|
|
12146
|
+
// // search field changed in panel call send parameters exp
|
|
12147
|
+
// for (const [attr, value] of Object.entries(_attributes)) {
|
|
12148
|
+
// const pattern = /xu-exp:(\w+)/;
|
|
12149
|
+
// const match = attr.match(pattern);
|
|
12150
|
+
|
|
12151
|
+
// if (!match) {
|
|
12152
|
+
// // continue if attribute is not expression
|
|
12153
|
+
// continue;
|
|
12154
|
+
// }
|
|
12155
|
+
// // code_in
|
|
12156
|
+
// const parameter_in_field_id = match?.[1];
|
|
12157
|
+
// // @code
|
|
12158
|
+
// if (value.includes(field_id)) {
|
|
12159
|
+
// // search parameter in field in the target program's progDataSource
|
|
12160
|
+
// found = progDataSource_str?.includes('@' + parameter_in_field_id);
|
|
12161
|
+
// if (found) break;
|
|
12162
|
+
|
|
12163
|
+
// // found = find_field_in_progUi(prog_doc.progUi, parameter_in_field_id, 'xu-for');
|
|
12164
|
+
// found = func.UI.find_field_in_progUi_attributes(prog_doc.progUi, parameter_in_field_id, 'xu-for').length;
|
|
12165
|
+
// if (found) break;
|
|
12166
|
+
// }
|
|
12167
|
+
// }
|
|
12214
12168
|
|
|
12215
|
-
|
|
12169
|
+
// if (found) break;
|
|
12216
12170
|
|
|
12217
|
-
|
|
12218
|
-
|
|
12219
|
-
|
|
12220
|
-
|
|
12221
|
-
|
|
12171
|
+
// // search field changed in the target program's progDataSource // @code
|
|
12172
|
+
// found = progDataSource_str?.includes('@' + field_id);
|
|
12173
|
+
// if (found) break;
|
|
12174
|
+
// }
|
|
12175
|
+
// }
|
|
12222
12176
|
|
|
12223
|
-
|
|
12224
|
-
|
|
12225
|
-
|
|
12226
|
-
|
|
12227
|
-
|
|
12228
|
-
|
|
12229
|
-
|
|
12230
|
-
|
|
12231
|
-
|
|
12232
|
-
|
|
12177
|
+
// if (datasource_changed) {
|
|
12178
|
+
// if (panel_val._ds.dsSession == datasource_changed) {
|
|
12179
|
+
// found = true;
|
|
12180
|
+
// }
|
|
12181
|
+
// }
|
|
12182
|
+
// if (found) {
|
|
12183
|
+
// var $div_elm = panel_val.$div
|
|
12184
|
+
// .parent()
|
|
12185
|
+
// .parent()
|
|
12186
|
+
// .find("[xu-ui-id='" + parent_element_ui_id + "']");
|
|
12233
12187
|
|
|
12234
|
-
|
|
12235
|
-
|
|
12236
|
-
|
|
12188
|
+
// // restore original panel
|
|
12189
|
+
// try {
|
|
12190
|
+
// // const $org_panel = panel_val.$div.data().xuPanelData.$panel_div;
|
|
12237
12191
|
|
|
12238
|
-
|
|
12192
|
+
// const new_$div = await func.UI.screen.render_ui_tree(SESSION_ID, $div_elm, _.cloneDeep(panel_val.$div.data().xuPanelData.node), {}, $div_elm.data().xuData.paramsP, null, null, $div_elm.data().xuData.key, null, $div_elm.data().xuData.parent_node, null, $div_elm.data().xuData.$root_container);
|
|
12239
12193
|
|
|
12240
|
-
|
|
12241
|
-
|
|
12242
|
-
|
|
12243
|
-
|
|
12244
|
-
|
|
12245
|
-
|
|
12246
|
-
|
|
12247
|
-
|
|
12248
|
-
|
|
12249
|
-
|
|
12250
|
-
};
|
|
12194
|
+
// // remove old panel content
|
|
12195
|
+
// $.each(panel_val.ids, async function (key, val) {
|
|
12196
|
+
// $("[xu-ui-id='" + val + "']").remove();
|
|
12197
|
+
// });
|
|
12198
|
+
// } catch (error) {
|
|
12199
|
+
// debugger;
|
|
12200
|
+
// }
|
|
12201
|
+
// break;
|
|
12202
|
+
// }
|
|
12203
|
+
// }
|
|
12204
|
+
// };
|
|
12251
12205
|
|
|
12252
12206
|
// const get_params_obj = async function (SESSION_ID, prog_id, parameters_obj_inP) {
|
|
12253
12207
|
// const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);
|
|
@@ -13258,1422 +13212,7 @@ func.UI.screen.set_attributes_new = async function (SESSION_ID, is_skeleton, $ro
|
|
|
13258
13212
|
},
|
|
13259
13213
|
props: {},
|
|
13260
13214
|
},
|
|
13261
|
-
|
|
13262
|
-
},
|
|
13263
|
-
];
|
|
13264
|
-
delete nodeP.attributes[key];
|
|
13265
|
-
}
|
|
13266
|
-
}
|
|
13267
|
-
|
|
13268
|
-
for (let [key, val] of Object.entries(nodeP.attributes)) {
|
|
13269
|
-
// FIX STATIC DEFAULTS
|
|
13270
|
-
val = func.UI.screen.fix_val_defaults(key, val);
|
|
13271
|
-
|
|
13272
|
-
// REMOVE UNDEFINED or NULL ATTRIBUTES
|
|
13273
|
-
if (typeof val === 'undefined' || val === null) {
|
|
13274
|
-
delete nodeP.attributes[key];
|
|
13275
|
-
}
|
|
13276
|
-
|
|
13277
|
-
// REMOVE ATTRIBUTES WITH EMPTY VALUES
|
|
13278
|
-
if (glb.solid_attributes.includes(key) && !val) {
|
|
13279
|
-
delete nodeP.attributes[key];
|
|
13280
|
-
}
|
|
13281
|
-
}
|
|
13282
|
-
|
|
13283
|
-
// BEFORE
|
|
13284
|
-
|
|
13285
|
-
for await (const [key, attr] of Object.entries(glb.run_xu_before)) {
|
|
13286
|
-
if (_ret.abort) break;
|
|
13287
|
-
if (glb.html5_events_handler.includes(attr) || execute_attributes.includes(attr)) {
|
|
13288
|
-
continue;
|
|
13289
|
-
}
|
|
13290
|
-
|
|
13291
|
-
if (!nodeP.attributes || !nodeP.attributes[attr] & !nodeP.attributes[`xu-exp:${attr}`]) {
|
|
13292
|
-
continue;
|
|
13293
|
-
}
|
|
13294
|
-
|
|
13295
|
-
let ret = await func.UI.screen.execute_xu_functions(
|
|
13296
|
-
SESSION_ID,
|
|
13297
|
-
is_skeleton,
|
|
13298
|
-
$root_container,
|
|
13299
|
-
nodeP,
|
|
13300
|
-
$container,
|
|
13301
|
-
paramsP,
|
|
13302
|
-
parent_infoP,
|
|
13303
|
-
jobNoP,
|
|
13304
|
-
keyP,
|
|
13305
|
-
parent_nodeP,
|
|
13306
|
-
attr,
|
|
13307
|
-
$elm,
|
|
13308
|
-
{
|
|
13309
|
-
key: attr,
|
|
13310
|
-
// value: _value,
|
|
13311
|
-
value: (await get_xuExp(attr)) || nodeP.attributes[attr],
|
|
13312
|
-
},
|
|
13313
|
-
is_init,
|
|
13314
|
-
);
|
|
13315
|
-
_ret = _.assignIn(_ret, ret);
|
|
13316
|
-
}
|
|
13317
|
-
|
|
13318
|
-
// ALL
|
|
13319
|
-
|
|
13320
|
-
for await (const [key, val] of Object.entries(nodeP.attributes)) {
|
|
13321
|
-
if (_ret.abort) break;
|
|
13322
|
-
if (glb.html5_events_handler.includes(key) || execute_attributes.includes(key)) {
|
|
13323
|
-
continue;
|
|
13324
|
-
}
|
|
13325
|
-
|
|
13326
|
-
const new_key = key.split(':')[0]; // break expression
|
|
13327
|
-
if (
|
|
13328
|
-
nodeP.tagName !== 'xu-panel' &&
|
|
13329
|
-
nodeP.tagName !== 'xu-teleport' && // nodeP.tagName.substr(0, 3) !== "xu-" &&
|
|
13330
|
-
(new_key.substr(0, 2) !== 'xu' || new_key.substr(2, 1) !== '-')
|
|
13331
|
-
) {
|
|
13332
|
-
// handle common html attributes
|
|
13333
|
-
try {
|
|
13334
|
-
$elm.get(0).setAttribute(key, val);
|
|
13335
|
-
} catch (err) {
|
|
13336
|
-
console.error(err.message);
|
|
13337
|
-
}
|
|
13338
|
-
|
|
13339
|
-
continue;
|
|
13340
|
-
}
|
|
13341
|
-
// handle xu attributes
|
|
13342
|
-
try {
|
|
13343
|
-
$elm.data().xuAttributes[key] = val;
|
|
13344
|
-
} catch (error) {
|
|
13345
|
-
debugger;
|
|
13346
|
-
console.error(error);
|
|
13347
|
-
}
|
|
13348
|
-
|
|
13349
|
-
if (new_key === 'xu-exp' || nodeP.attributes['xu-exp:' + new_key] || glb.run_xu_before.includes(new_key) || glb.run_xu_after.includes(new_key)) {
|
|
13350
|
-
continue;
|
|
13351
|
-
}
|
|
13352
|
-
|
|
13353
|
-
if (new_key === 'xu-on') {
|
|
13354
|
-
let ret = await func.UI.screen.execute_xu_functions(
|
|
13355
|
-
SESSION_ID,
|
|
13356
|
-
is_skeleton,
|
|
13357
|
-
$root_container,
|
|
13358
|
-
nodeP,
|
|
13359
|
-
$container,
|
|
13360
|
-
paramsP,
|
|
13361
|
-
parent_infoP,
|
|
13362
|
-
jobNoP,
|
|
13363
|
-
keyP,
|
|
13364
|
-
parent_nodeP,
|
|
13365
|
-
'xu-on',
|
|
13366
|
-
$elm,
|
|
13367
|
-
{
|
|
13368
|
-
key: key,
|
|
13369
|
-
value: (await get_xuExp(new_key)) || val,
|
|
13370
|
-
},
|
|
13371
|
-
is_init,
|
|
13372
|
-
refreshed_ds,
|
|
13373
|
-
);
|
|
13374
|
-
_ret = _.assignIn(_ret, ret);
|
|
13375
|
-
continue;
|
|
13376
|
-
}
|
|
13377
|
-
|
|
13378
|
-
let ret = await func.UI.screen.execute_xu_functions(
|
|
13379
|
-
SESSION_ID,
|
|
13380
|
-
is_skeleton,
|
|
13381
|
-
$root_container,
|
|
13382
|
-
nodeP,
|
|
13383
|
-
$container,
|
|
13384
|
-
paramsP,
|
|
13385
|
-
parent_infoP,
|
|
13386
|
-
jobNoP,
|
|
13387
|
-
keyP,
|
|
13388
|
-
parent_nodeP,
|
|
13389
|
-
new_key,
|
|
13390
|
-
$elm,
|
|
13391
|
-
{
|
|
13392
|
-
key: key,
|
|
13393
|
-
value: (await get_xuExp(new_key)) || val,
|
|
13394
|
-
},
|
|
13395
|
-
is_init,
|
|
13396
|
-
refreshed_ds,
|
|
13397
|
-
);
|
|
13398
|
-
|
|
13399
|
-
_ret = _.assignIn(_ret, ret);
|
|
13400
|
-
}
|
|
13401
|
-
|
|
13402
|
-
// EXP for
|
|
13403
|
-
|
|
13404
|
-
for await (const [key, val] of Object.entries(nodeP.attributes)) {
|
|
13405
|
-
if (_ret.abort) break;
|
|
13406
|
-
|
|
13407
|
-
const attr = key.split('xu-exp:')[1];
|
|
13408
|
-
|
|
13409
|
-
if (!attr) {
|
|
13410
|
-
continue;
|
|
13411
|
-
}
|
|
13412
|
-
|
|
13413
|
-
if (glb.html5_events_handler.includes(attr) || execute_attributes.includes(attr)) continue;
|
|
13414
|
-
|
|
13415
|
-
if (done_exp.includes(key)) {
|
|
13416
|
-
continue;
|
|
13417
|
-
}
|
|
13418
|
-
let ret = await func.UI.screen.execute_xu_functions(
|
|
13419
|
-
SESSION_ID,
|
|
13420
|
-
is_skeleton,
|
|
13421
|
-
$root_container,
|
|
13422
|
-
nodeP,
|
|
13423
|
-
$container,
|
|
13424
|
-
paramsP,
|
|
13425
|
-
parent_infoP,
|
|
13426
|
-
jobNoP,
|
|
13427
|
-
keyP,
|
|
13428
|
-
parent_nodeP,
|
|
13429
|
-
'xu-exp',
|
|
13430
|
-
$elm,
|
|
13431
|
-
{
|
|
13432
|
-
key: attr,
|
|
13433
|
-
value: val,
|
|
13434
|
-
},
|
|
13435
|
-
true,
|
|
13436
|
-
refreshed_ds,
|
|
13437
|
-
);
|
|
13438
|
-
_ret = _.assignIn(_ret, ret);
|
|
13439
|
-
}
|
|
13440
|
-
|
|
13441
|
-
// AFTER
|
|
13442
|
-
|
|
13443
|
-
for await (const [key, attr] of Object.entries(glb.run_xu_after)) {
|
|
13444
|
-
if (glb.html5_events_handler.includes(attr) || execute_attributes.includes(attr)) continue;
|
|
13445
|
-
|
|
13446
|
-
if (!nodeP.attributes || !nodeP.attributes[attr] & !nodeP.attributes[`xu-exp:${attr}`]) continue;
|
|
13447
|
-
|
|
13448
|
-
let ret = await func.UI.screen.execute_xu_functions(
|
|
13449
|
-
SESSION_ID,
|
|
13450
|
-
is_skeleton,
|
|
13451
|
-
$root_container,
|
|
13452
|
-
nodeP,
|
|
13453
|
-
$container,
|
|
13454
|
-
paramsP,
|
|
13455
|
-
parent_infoP,
|
|
13456
|
-
jobNoP,
|
|
13457
|
-
keyP,
|
|
13458
|
-
parent_nodeP,
|
|
13459
|
-
attr,
|
|
13460
|
-
$elm,
|
|
13461
|
-
{
|
|
13462
|
-
key: attr,
|
|
13463
|
-
value: (await get_xuExp(attr)) || nodeP.attributes[attr],
|
|
13464
|
-
},
|
|
13465
|
-
is_init,
|
|
13466
|
-
refreshed_ds,
|
|
13467
|
-
);
|
|
13468
|
-
_ret = _.assignIn(_ret, ret);
|
|
13469
|
-
}
|
|
13470
|
-
|
|
13471
|
-
// REGISTER EVENTS ATTRIBUTES
|
|
13472
|
-
|
|
13473
|
-
for await (const [key, val] of Object.entries(nodeP.attributes)) {
|
|
13474
|
-
if (!glb.html5_events_handler.includes(key)) break;
|
|
13475
|
-
$elm.attr(key, await get_xuExp(key)) || val;
|
|
13476
|
-
}
|
|
13477
|
-
|
|
13478
|
-
return _ret;
|
|
13479
|
-
};
|
|
13480
|
-
|
|
13481
|
-
func.UI.screen.panel_post_render_handler = async function (
|
|
13482
|
-
SESSION_ID,
|
|
13483
|
-
$container, // the parent program container
|
|
13484
|
-
$wrapper, // the wrapper element contains the rendered panel elements e.g: xu-single-view
|
|
13485
|
-
nodeP, // the xu-panel node
|
|
13486
|
-
$panel_div, // the panel div
|
|
13487
|
-
jobNoP,
|
|
13488
|
-
) {
|
|
13489
|
-
const _container_ds = SESSION_OBJ[SESSION_ID].DS_GLB[$container.data().xuData.paramsP.dsSessionP];
|
|
13490
|
-
const _ds = SESSION_OBJ[SESSION_ID].DS_GLB[$wrapper.data().xuData.paramsP.dsSessionP];
|
|
13491
|
-
const find_old_panels_elements = function () {
|
|
13492
|
-
return func.UI.utils.find_in_element_data('xuPanelData', $container.parent(), 'xu-ui-id', $container.data()?.xuPanelData?.xu_panel_xu_ui_id);
|
|
13493
|
-
};
|
|
13494
|
-
var $old_panel_div = find_old_panels_elements();
|
|
13495
|
-
const set_xuPanelData_to_the_new_rendered_items = () => {
|
|
13496
|
-
$container.data().xuPanelWrapper = { isWrapper: true, panelXuAttributes: _.clone($wrapper.data().xuAttributes), panelDivData: _.clone($wrapper.data()) };
|
|
13497
|
-
$container.attr('xu-panel-wrapper-id', $wrapper.attr('xu-ui-id'));
|
|
13498
|
-
$.each($wrapper.children(), function (key, val) {
|
|
13499
|
-
if (!$(val).data().xuPanelData) {
|
|
13500
|
-
$(val).data().xuPanelData = {};
|
|
13501
|
-
}
|
|
13502
|
-
$(val).data().xuPanelData.parent_element_ui_id = $old_panel_div?.length ? $container.parent().data().xuData.ui_id : $container.data().xuData.ui_id;
|
|
13503
|
-
|
|
13504
|
-
$(val).data().xuPanelData.xu_panel_xu_ui_id = (nodeP.xu_tree_id || nodeP.id) + '-' + _container_ds?.currentRecordId;
|
|
13505
|
-
$(val).data().xuPanelData.node = nodeP;
|
|
13506
|
-
$(val).data().xuPanelData.$panel_div = $panel_div.clone(true);
|
|
13507
|
-
});
|
|
13508
|
-
};
|
|
13509
|
-
set_xuPanelData_to_the_new_rendered_items();
|
|
13510
|
-
|
|
13511
|
-
if ($old_panel_div?.length) {
|
|
13512
|
-
$($old_panel_div[0]).after($wrapper.children());
|
|
13513
|
-
} else {
|
|
13514
|
-
$.each($wrapper.children(), function (key, child) {
|
|
13515
|
-
$.each($container.children(), function (key, elm) {
|
|
13516
|
-
if ($(elm)?.data()?.xuData && $(elm)?.data()?.xuData?.elem_key === $(child)?.data()?.xuData?.elem_key) {
|
|
13517
|
-
$(elm).remove();
|
|
13518
|
-
}
|
|
13519
|
-
});
|
|
13520
|
-
$container.append($(child));
|
|
13521
|
-
});
|
|
13522
|
-
}
|
|
13523
|
-
|
|
13524
|
-
if (!$wrapper.data()?.xuData?.dsSession) return;
|
|
13525
|
-
|
|
13526
|
-
if ($old_panel_div?.length) {
|
|
13527
|
-
$container.parent().data().xuData.paramsP.dsSessionP = _ds.parentDataSourceNo; // set the new ds when panel replaced
|
|
13528
|
-
} else {
|
|
13529
|
-
$container.data().xuData.paramsP.dsSessionP = _ds.parentDataSourceNo; // set the new ds when panel replaced
|
|
13530
|
-
}
|
|
13531
|
-
|
|
13532
|
-
if ($old_panel_div?.length) {
|
|
13533
|
-
$old_panel_div.remove();
|
|
13534
|
-
}
|
|
13535
|
-
return jobNoP;
|
|
13536
|
-
};
|
|
13537
|
-
|
|
13538
|
-
func.UI.screen.create_container = function (SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, classP, elem_propP, div_typeP, $appendToP, attr_str) {
|
|
13539
|
-
const _paramsP = _.cloneDeep(paramsP);
|
|
13540
|
-
var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_paramsP.dsSessionP];
|
|
13541
|
-
var $appendTo = $container;
|
|
13542
|
-
if ($appendToP) $appendTo = $appendToP;
|
|
13543
|
-
if (!$appendTo || !$appendTo.length) return null; // screen closed or not exist abort build
|
|
13544
|
-
var div = 'div';
|
|
13545
|
-
if (div_typeP) div = div_typeP;
|
|
13546
|
-
var items = [];
|
|
13547
|
-
if (nodeP.children)
|
|
13548
|
-
items = nodeP.children.map(function (val) {
|
|
13549
|
-
return val.xu_tree_id || val.id;
|
|
13550
|
-
});
|
|
13551
|
-
var currentRecordId = _ds ? _ds.currentRecordId : '';
|
|
13552
|
-
var xu_id = (glb.screen_num++).toString();
|
|
13553
|
-
xu_id = xu_id += '_' + currentRecordId;
|
|
13554
|
-
|
|
13555
|
-
try {
|
|
13556
|
-
const key_path = `${$container?.data()?.xuData?.key_path || '0'}-${keyP || '0'}`;
|
|
13557
|
-
const elem_key = `${nodeP.xu_tree_id || nodeP.id}-${key_path}-${currentRecordId}`;
|
|
13558
|
-
let ui_id = `${nodeP.id}-${elem_key}-${_paramsP?.dsSessionP?.toString() || ''}`; //nodeP.xu_tree_id ||
|
|
13559
|
-
|
|
13560
|
-
/////////////////////////////////
|
|
13561
|
-
|
|
13562
|
-
var $div;
|
|
13563
|
-
if (div === 'svg') {
|
|
13564
|
-
const draw_svg = function (element) {
|
|
13565
|
-
const get_tag_str = function (element, prop, val) {
|
|
13566
|
-
let class_str = '';
|
|
13567
|
-
let attr_str = '';
|
|
13568
|
-
for (const [key, val] of Object.entries(prop)) {
|
|
13569
|
-
if (key.substr(0, 2) !== 'xu') {
|
|
13570
|
-
attr_str += ` ${key}="${val}" `;
|
|
13571
|
-
}
|
|
13572
|
-
}
|
|
13573
|
-
if (element === 'svg') {
|
|
13574
|
-
return `<${element} ${attr_str} > `;
|
|
13575
|
-
}
|
|
13576
|
-
let ret = '';
|
|
13577
|
-
if (val?.children?.length) {
|
|
13578
|
-
ret = iterate_svg(val);
|
|
13579
|
-
}
|
|
13580
|
-
|
|
13581
|
-
return `<${element} ${class_str} ${attr_str} > ${ret} </${element}>`;
|
|
13582
|
-
};
|
|
13583
|
-
let svg_str = get_tag_str(element, prop);
|
|
13584
|
-
let inner_str = '';
|
|
13585
|
-
const iterate_svg = function (node) {
|
|
13586
|
-
let ret = '';
|
|
13587
|
-
if (node.children) {
|
|
13588
|
-
for (let val of node.children) {
|
|
13589
|
-
let prop = val.attributes;
|
|
13590
|
-
ret += get_tag_str(val.tagName, prop, val);
|
|
13591
|
-
}
|
|
13592
|
-
}
|
|
13593
|
-
return ret;
|
|
13594
|
-
};
|
|
13595
|
-
inner_str = iterate_svg(nodeP);
|
|
13596
|
-
|
|
13597
|
-
$div = $(svg_str + inner_str + '</svg>').appendTo($appendTo);
|
|
13598
|
-
};
|
|
13599
|
-
|
|
13600
|
-
draw_svg(div_typeP);
|
|
13601
|
-
} else {
|
|
13602
|
-
$div = $(`<${div} ${attr_str ? attr_str : ''}>`);
|
|
13603
|
-
}
|
|
13604
|
-
// const svgNS = "http://www.w3.org/2000/svg";
|
|
13605
|
-
// // $div = $(document.createElementNS(svgNS, "svg"));
|
|
13606
|
-
// $div = $(`<${div} ${attr_str ? attr_str : ""} ${svg_attributes_str}>`);
|
|
13607
|
-
// } else {
|
|
13608
|
-
// $div = $(`<${div} ${attr_str ? attr_str : ""}>`);
|
|
13609
|
-
$div.attr('xu-ui-id', ui_id).data({
|
|
13610
|
-
xuData: {
|
|
13611
|
-
prog_id: _paramsP.prog_id,
|
|
13612
|
-
nodeid: nodeP.id,
|
|
13613
|
-
ui_type: nodeP.tagName,
|
|
13614
|
-
xu_id,
|
|
13615
|
-
recordid: currentRecordId,
|
|
13616
|
-
paramsP: _paramsP,
|
|
13617
|
-
key: keyP,
|
|
13618
|
-
key_path, //:($container?.data()?.xuData?.key || "0") + "-" + (keyP || "0"),
|
|
13619
|
-
screenId: _paramsP.screenId,
|
|
13620
|
-
parent_container: $container?.attr('id'),
|
|
13621
|
-
elem_key,
|
|
13622
|
-
properties: prop,
|
|
13623
|
-
node: nodeP,
|
|
13624
|
-
node_org: _.cloneDeep(nodeP),
|
|
13625
|
-
is_panelP: _paramsP.is_panelP,
|
|
13626
|
-
ui_id,
|
|
13627
|
-
elem_prop: elem_propP,
|
|
13628
|
-
debug_info: {
|
|
13629
|
-
id: nodeP.id,
|
|
13630
|
-
parent_id: $container?.data()?.xuData?.ui_id,
|
|
13631
|
-
items: items,
|
|
13632
|
-
},
|
|
13633
|
-
parent_node: parent_nodeP,
|
|
13634
|
-
currentRecordId: currentRecordId,
|
|
13635
|
-
$root_container: $root_container,
|
|
13636
|
-
parent_element_ui_id: $container?.data()?.xuData?.ui_id,
|
|
13637
|
-
},
|
|
13638
|
-
xuAttributes: {},
|
|
13639
|
-
});
|
|
13640
|
-
|
|
13641
|
-
if (div_typeP !== 'svg') {
|
|
13642
|
-
$div.appendTo($appendTo);
|
|
13643
|
-
}
|
|
13644
|
-
} catch (e) {
|
|
13645
|
-
console.error(e);
|
|
13646
|
-
}
|
|
13647
|
-
|
|
13648
|
-
if (parent_infoP?.iterate_info) {
|
|
13649
|
-
$div.data().xuData.iterate_info = parent_infoP.iterate_info;
|
|
13650
|
-
}
|
|
13651
|
-
|
|
13652
|
-
if (classP) $div.addClass(classP);
|
|
13653
|
-
|
|
13654
|
-
return $div;
|
|
13655
|
-
};
|
|
13656
|
-
func.UI.screen.execute_screen_ready_events = async function (SESSION_ID, paramsP, sourceP, $div, jobNoP, $div_objP) {
|
|
13657
|
-
var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
|
|
13658
|
-
if (!_ds) return;
|
|
13659
|
-
var viewEventExec_arr = [];
|
|
13660
|
-
const execute_view_events = async function (sourceP) {
|
|
13661
|
-
for await (const val of viewEventExec_arr) {
|
|
13662
|
-
cond = val.eventInfo.data.enabled;
|
|
13663
|
-
if (val.expression) {
|
|
13664
|
-
expCond = await func.expression.get(SESSION_ID, val.expression, paramsP.dsSessionP, 'condition', paramsP.rowIdP); // execute expression
|
|
13665
|
-
cond = expCond.result;
|
|
13666
|
-
}
|
|
13667
|
-
if (cond) {
|
|
13668
|
-
await func.events.execute(
|
|
13669
|
-
SESSION_ID,
|
|
13670
|
-
null,
|
|
13671
|
-
val.eventId,
|
|
13672
|
-
val.triggerId,
|
|
13673
|
-
val.eventInfo.data.action,
|
|
13674
|
-
val.eventInfo.data.name,
|
|
13675
|
-
null,
|
|
13676
|
-
null,
|
|
13677
|
-
null,
|
|
13678
|
-
null,
|
|
13679
|
-
val.eventInfo.data.action, //val.eventInfo[4]
|
|
13680
|
-
null,
|
|
13681
|
-
paramsP.dsSessionP,
|
|
13682
|
-
val.eventId,
|
|
13683
|
-
sourceP + ' event',
|
|
13684
|
-
true,
|
|
13685
|
-
null,
|
|
13686
|
-
null,
|
|
13687
|
-
paramsP.dsSessionP,
|
|
13688
|
-
null,
|
|
13689
|
-
null,
|
|
13690
|
-
val.eventInfo, // val.eventInfo[8],
|
|
13691
|
-
null,
|
|
13692
|
-
null,
|
|
13693
|
-
null,
|
|
13694
|
-
_ds.prog_id,
|
|
13695
|
-
_ds.nodeId,
|
|
13696
|
-
_ds.parentDataSourceNo,
|
|
13697
|
-
$div,
|
|
13698
|
-
);
|
|
13699
|
-
|
|
13700
|
-
// update changed values to screen added 18/09/13
|
|
13701
|
-
var fields_to_refresh = [];
|
|
13702
|
-
try {
|
|
13703
|
-
var current_record_id = _ds.currentRecordId;
|
|
13704
|
-
} catch (e) {
|
|
13705
|
-
console.error(e);
|
|
13706
|
-
}
|
|
13707
|
-
|
|
13708
|
-
if (_ds?.data_feed?.form_fields_changed?.[current_record_id]) {
|
|
13709
|
-
$.each(_ds.data_feed.form_fields_changed[current_record_id], function (key, val) {
|
|
13710
|
-
fields_to_refresh.push(key);
|
|
13711
|
-
});
|
|
13712
|
-
|
|
13713
|
-
var containerId = _ds.containerId;
|
|
13714
|
-
var $container = $('#' + containerId);
|
|
13715
|
-
if ($container?.data()?.xuData?.is_mobile_modal || $container?.data()?.xuData?.params?.is_mobile_page) {
|
|
13716
|
-
await func.UI.screen.refresh_container(SESSION_ID, 'init', fields_to_refresh, $container, paramsP.dsSessionP, null);
|
|
13717
|
-
} else {
|
|
13718
|
-
$container.trigger(containerId + '.refresh', ['init', fields_to_refresh]);
|
|
13719
|
-
}
|
|
13720
|
-
|
|
13721
|
-
if ($div_objP) {
|
|
13722
|
-
await func.UI.screen.refresh_container(SESSION_ID, 'init', fields_to_refresh, $div_objP, paramsP.dsSessionP, null);
|
|
13723
|
-
}
|
|
13724
|
-
}
|
|
13725
|
-
}
|
|
13726
|
-
continue;
|
|
13727
|
-
}
|
|
13728
|
-
};
|
|
13729
|
-
const get_view_events_count = async function (typeP) {
|
|
13730
|
-
const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
13731
|
-
viewEventExec_arr = [];
|
|
13732
|
-
|
|
13733
|
-
if (!_prog.progEvents || _.isEmpty(_prog.progEvents)) {
|
|
13734
|
-
return 0;
|
|
13735
|
-
}
|
|
13736
|
-
for await (const event_obj of _prog.progEvents) {
|
|
13737
|
-
if (event_obj.data.type !== typeP) continue;
|
|
13738
|
-
|
|
13739
|
-
if (_.isEmpty(event_obj.triggers)) continue;
|
|
13740
|
-
|
|
13741
|
-
if (event_obj.data.condition) {
|
|
13742
|
-
let res = await func.expression.get(SESSION_ID, event_obj.data.condition, paramsP.dsSessionP, 'condition', paramsP.rowIdP, null, null, null, null, event_obj);
|
|
13743
|
-
if (!res.result) {
|
|
13744
|
-
continue;
|
|
13745
|
-
}
|
|
13746
|
-
}
|
|
13747
|
-
|
|
13748
|
-
for await (const trigger_obj of event_obj.triggers) {
|
|
13749
|
-
var expression = undefined;
|
|
13750
|
-
var cond = undefined;
|
|
13751
|
-
if (!trigger_obj.data.enabled) {
|
|
13752
|
-
continue;
|
|
13753
|
-
}
|
|
13754
|
-
cond = true;
|
|
13755
|
-
if (trigger_obj.props.condition) expression = trigger_obj.props.condition;
|
|
13756
|
-
var expCond = {};
|
|
13757
|
-
if (expression) {
|
|
13758
|
-
expCond = await func.expression.get(SESSION_ID, expression, paramsP.dsSessionP, 'condition', paramsP.rowIdP, trigger_obj.data.type); // execute expression
|
|
13759
|
-
cond = expCond.result;
|
|
13760
|
-
expCond.conditional = true;
|
|
13761
|
-
}
|
|
13762
|
-
|
|
13763
|
-
if (!trigger_obj.data.action) {
|
|
13764
|
-
func.utils.debug_report(SESSION_ID, 'get_view_events_count', `Error initiating ${typeP} prog: ${_ds.viewSourceDesc} reason: missing action`, 'E');
|
|
13765
|
-
break;
|
|
13766
|
-
}
|
|
13767
|
-
if (!glb.REFERENCE_LESS_FUNCTIONS.includes(trigger_obj.data.action) && !trigger_obj.data.name?.prog) {
|
|
13768
|
-
func.utils.debug_report(SESSION_ID, 'get_view_events_count', `Error initiating ${typeP} prog: ${_ds.viewSourceDesc} reason: missing reference`, 'E');
|
|
13769
|
-
break;
|
|
13770
|
-
}
|
|
13771
|
-
|
|
13772
|
-
viewEventExec_arr.push({
|
|
13773
|
-
eventInfo: trigger_obj,
|
|
13774
|
-
eventId: event_obj.id,
|
|
13775
|
-
triggerId: trigger_obj.id,
|
|
13776
|
-
expression: expression,
|
|
13777
|
-
});
|
|
13778
|
-
}
|
|
13779
|
-
}
|
|
13780
|
-
return viewEventExec_arr.length;
|
|
13781
|
-
};
|
|
13782
|
-
|
|
13783
|
-
let count = await get_view_events_count('screen_ready');
|
|
13784
|
-
if (!count) return;
|
|
13785
|
-
return await execute_view_events(sourceP);
|
|
13786
|
-
};
|
|
13787
|
-
func.UI.screen.screen_loading_done = async function (SESSION_ID, paramsP, $div, jobNoP) {
|
|
13788
|
-
// await
|
|
13789
|
-
func.UI.screen.execute_screen_ready_events(SESSION_ID, paramsP, paramsP.screenInfo.properties?.renderType, $div, jobNoP);
|
|
13790
|
-
var _session = SESSION_OBJ[SESSION_ID];
|
|
13791
|
-
func.events.delete_job(SESSION_ID, jobNoP);
|
|
13792
|
-
func.UI.utils.screen_blocker(false, paramsP.prog_id + (paramsP.sourceScreenP ? '_' + paramsP.sourceScreenP : ''));
|
|
13793
|
-
if (_session.prog_id === paramsP.prog_id) {
|
|
13794
|
-
_session.system_ready = true;
|
|
13795
|
-
if (_session.engine_mode === 'live_preview' && STUDIO_PEER_CONN_SEND_METHOD) {
|
|
13796
|
-
STUDIO_PEER_CONN_SEND_METHOD({
|
|
13797
|
-
service: 'system_ready',
|
|
13798
|
-
data: {},
|
|
13799
|
-
id: STUDIO_PEER.id,
|
|
13800
|
-
source: 'runtime',
|
|
13801
|
-
session_id: SESSION_ID,
|
|
13802
|
-
app_id: _session.app_id,
|
|
13803
|
-
gtp_token: _session.gtp_token,
|
|
13804
|
-
app_token: _session.app_token,
|
|
13805
|
-
});
|
|
13806
|
-
// }
|
|
13807
|
-
}
|
|
13808
|
-
}
|
|
13809
|
-
|
|
13810
|
-
return $div;
|
|
13811
|
-
};
|
|
13812
|
-
|
|
13813
|
-
func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, parent_infoP, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, $root_container) {
|
|
13814
|
-
if (!is_skeleton) {
|
|
13815
|
-
var _session = SESSION_OBJ[SESSION_ID];
|
|
13816
|
-
var _ds = _session.DS_GLB[paramsP.dsSessionP];
|
|
13817
|
-
}
|
|
13818
|
-
var prop;
|
|
13819
|
-
try {
|
|
13820
|
-
prop = nodeP.attributes;
|
|
13821
|
-
} catch (error) {
|
|
13822
|
-
// debugger;
|
|
13823
|
-
}
|
|
13824
|
-
|
|
13825
|
-
var is_mobile = glb.MOBILE_ARR.includes(paramsP.screenInfo.properties?.menuType) ? true : false;
|
|
13826
|
-
|
|
13827
|
-
var get_element_info = function () {
|
|
13828
|
-
var ret = {};
|
|
13829
|
-
let currentRecordId = _ds?.currentRecordId || '';
|
|
13830
|
-
|
|
13831
|
-
let $div = func.UI.utils.find_in_element_data('xuData', $container.parent(), 'nodeid', nodeP.id);
|
|
13832
|
-
|
|
13833
|
-
$.each($div, function (key, val) {
|
|
13834
|
-
if ($(val)?.data().xuData?.recordid === currentRecordId && $(val)?.data().xuData?.key === keyP && $(val)?.prop('tagName') !== 'XURENDER') {
|
|
13835
|
-
ret = {
|
|
13836
|
-
div: $div,
|
|
13837
|
-
};
|
|
13838
|
-
}
|
|
13839
|
-
});
|
|
13840
|
-
|
|
13841
|
-
return ret;
|
|
13842
|
-
};
|
|
13843
|
-
|
|
13844
|
-
const init = async function () {
|
|
13845
|
-
var ret = true;
|
|
13846
|
-
if (!nodeP) ret = false;
|
|
13847
|
-
return ret;
|
|
13848
|
-
};
|
|
13849
|
-
const debug = function (is_errorP, error_descP) {
|
|
13850
|
-
func.utils.debug.log(SESSION_ID, paramsP.prog_id + '_' + nodeP.id_org + '_ui_prop', {
|
|
13851
|
-
module: 'gui',
|
|
13852
|
-
action: 'init',
|
|
13853
|
-
prop: nodeP.id,
|
|
13854
|
-
details: error_descP,
|
|
13855
|
-
result: null,
|
|
13856
|
-
error: is_errorP,
|
|
13857
|
-
source: _ds?.tree_obj?.menuName || '',
|
|
13858
|
-
fields: null,
|
|
13859
|
-
type: null,
|
|
13860
|
-
prog_id: paramsP.prog_id,
|
|
13861
|
-
dsSession: null,
|
|
13862
|
-
});
|
|
13863
|
-
};
|
|
13864
|
-
|
|
13865
|
-
const open_modal = async function ($div) {
|
|
13866
|
-
const modal_id = 'app_modal-' + paramsP.dsSessionP.toString();
|
|
13867
|
-
var xu_modal_controller = document.querySelector('xu-modal-controller');
|
|
13868
|
-
if (!xu_modal_controller) {
|
|
13869
|
-
func.UI.component.create_app_modal_component(SESSION_ID, modal_id);
|
|
13870
|
-
xu_modal_controller = document.querySelector('xu-modal-controller');
|
|
13871
|
-
}
|
|
13872
|
-
|
|
13873
|
-
var controller_params = $(xu_modal_controller).data('xuControllerParams');
|
|
13874
|
-
|
|
13875
|
-
if (!controller_params) {
|
|
13876
|
-
controller_params = {};
|
|
13877
|
-
}
|
|
13878
|
-
|
|
13879
|
-
var params = {
|
|
13880
|
-
menuTitle: paramsP.screenInfo.properties?.menuTitle,
|
|
13881
|
-
screenId: paramsP.screenId,
|
|
13882
|
-
$dialogDiv: $div.children(),
|
|
13883
|
-
$container: $container,
|
|
13884
|
-
dsSession: paramsP.dsSessionP,
|
|
13885
|
-
};
|
|
13886
|
-
|
|
13887
|
-
controller_params[modal_id] = params;
|
|
13888
|
-
|
|
13889
|
-
$(xu_modal_controller).data('xuControllerParams', controller_params);
|
|
13890
|
-
const modalController = await new UI_FRAMEWORK_PLUGIN.modal();
|
|
13891
|
-
|
|
13892
|
-
if (!APP_MODAL_OBJ[modal_id]) {
|
|
13893
|
-
const modal = await modalController.create(SESSION_ID, modal_id, paramsP.screenInfo, close_modal);
|
|
13894
|
-
APP_MODAL_OBJ[modal_id] = modal;
|
|
13895
|
-
} else {
|
|
13896
|
-
$(modal_id).empty();
|
|
13897
|
-
}
|
|
13898
|
-
await modalController.init(SESSION_ID, modal_id);
|
|
13899
|
-
|
|
13900
|
-
return $div;
|
|
13901
|
-
};
|
|
13902
|
-
|
|
13903
|
-
const close_modal = async function (modal_id) {
|
|
13904
|
-
delete APP_MODAL_OBJ[modal_id];
|
|
13905
|
-
const xu_modal_controller = document.querySelector('xu-modal-controller');
|
|
13906
|
-
var params = $(xu_modal_controller).data().xuControllerParams[modal_id];
|
|
13907
|
-
if (params && params.$container) {
|
|
13908
|
-
await func.UI.screen.validate_exit_events(SESSION_ID, params.$container.data().xuData.paramsP, null);
|
|
13909
|
-
func.datasource.clean_all(SESSION_ID, params.dsSession);
|
|
13910
|
-
}
|
|
13911
|
-
};
|
|
13912
|
-
|
|
13913
|
-
const close_all_modals = function () {
|
|
13914
|
-
$.each(APP_MODAL_OBJ, function (key, val) {
|
|
13915
|
-
if (val) {
|
|
13916
|
-
// close_modal(key);
|
|
13917
|
-
UI_FRAMEWORK_PLUGIN.modal.close(key);
|
|
13918
|
-
}
|
|
13919
|
-
});
|
|
13920
|
-
};
|
|
13921
|
-
|
|
13922
|
-
const open_popover = async function ($div) {
|
|
13923
|
-
const xu_popover_controller = func.UI.component.create_app_popover_component(SESSION_ID);
|
|
13924
|
-
|
|
13925
|
-
$(xu_popover_controller).data('xuControllerParams', {
|
|
13926
|
-
menuTitle: paramsP.screenInfo.properties?.menuTitle,
|
|
13927
|
-
screenId: paramsP.screenId,
|
|
13928
|
-
$dialogDiv: $div.children(),
|
|
13929
|
-
$container: $container,
|
|
13930
|
-
});
|
|
13931
|
-
const popover = new UI_FRAMEWORK_PLUGIN.popover(
|
|
13932
|
-
SESSION_ID,
|
|
13933
|
-
// ELEMENT_CLICK_EVENT,
|
|
13934
|
-
// props
|
|
13935
|
-
);
|
|
13936
|
-
await popover.open(SESSION_ID);
|
|
13937
|
-
CURRENT_APP_POPOVER = popover;
|
|
13938
|
-
|
|
13939
|
-
return;
|
|
13940
|
-
popoverController
|
|
13941
|
-
.create({
|
|
13942
|
-
component: 'xu-popover-content-' + SESSION_ID,
|
|
13943
|
-
event: ELEMENT_CLICK_EVENT,
|
|
13944
|
-
translucent: true,
|
|
13945
|
-
})
|
|
13946
|
-
.then((modal) => {
|
|
13947
|
-
modal.present().then(() => {
|
|
13948
|
-
CURRENT_APP_POPOVER = modal;
|
|
13949
|
-
|
|
13950
|
-
if (callbackP) callbackP($div);
|
|
13951
|
-
});
|
|
13952
|
-
});
|
|
13953
|
-
};
|
|
13954
|
-
const iterate_child = async function ($divP, nodeP, parent_infoP, countP, $root_container, before_record_function) {
|
|
13955
|
-
if (!is_mobile && nodeP.busy) return;
|
|
13956
|
-
nodeP.busy = true;
|
|
13957
|
-
const done = async function ($divP) {
|
|
13958
|
-
setTimeout(function () {
|
|
13959
|
-
nodeP.busy = false;
|
|
13960
|
-
}, 1000);
|
|
13961
|
-
|
|
13962
|
-
return $divP;
|
|
13963
|
-
};
|
|
13964
|
-
if (!nodeP || !nodeP.children) {
|
|
13965
|
-
return await done($divP);
|
|
13966
|
-
}
|
|
13967
|
-
|
|
13968
|
-
if (before_record_function) {
|
|
13969
|
-
await before_record_function();
|
|
13970
|
-
}
|
|
13971
|
-
if (nodeP?.children?.length) {
|
|
13972
|
-
for await (const [key, val] of Object.entries(nodeP.children)) {
|
|
13973
|
-
const ret = await func.UI.screen.render_ui_tree(SESSION_ID, $divP, nodeP.children[key], parent_infoP, paramsP, jobNoP, is_skeleton, Number(key), null, nodeP, null, $root_container);
|
|
13974
|
-
}
|
|
13975
|
-
}
|
|
13976
|
-
return await done($divP);
|
|
13977
|
-
};
|
|
13978
|
-
|
|
13979
|
-
const _$ = function ($elm) {
|
|
13980
|
-
try {
|
|
13981
|
-
const id = $elm.attr('xu-ui-id');
|
|
13982
|
-
if (!id) return $elm;
|
|
13983
|
-
const $el = $(`[xu-ui-id="${id}"]`); // $("#" + id);
|
|
13984
|
-
|
|
13985
|
-
if ($el.length > 1) {
|
|
13986
|
-
console.warn('Multiple elements for xu-ui-id: ' + id, $el);
|
|
13987
|
-
}
|
|
13988
|
-
|
|
13989
|
-
return $($el[0]);
|
|
13990
|
-
} catch (e) {
|
|
13991
|
-
console.error(e);
|
|
13992
|
-
}
|
|
13993
|
-
};
|
|
13994
|
-
|
|
13995
|
-
const hover_in = function ($div) {
|
|
13996
|
-
if (is_skeleton) return;
|
|
13997
|
-
CLIENT_ACTIVITY_TS = Date.now();
|
|
13998
|
-
if (_$($container)?.data()?.xuData?.debug_info) _$($container).data().xuData.debug_info.hover_item = $div.attr('xu-ui-id');
|
|
13999
|
-
if (!_ds) return;
|
|
14000
|
-
///////// SET Attributes///////////
|
|
14001
|
-
let attributes = {};
|
|
14002
|
-
$.each($div[0].attributes, function (index, attr) {
|
|
14003
|
-
attributes[attr.name] = attr.value;
|
|
14004
|
-
});
|
|
14005
|
-
|
|
14006
|
-
SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system.SYS_OBJ_WIN_ELEMENT_HOVERED_ATTRIBUTES = attributes;
|
|
14007
|
-
//////////////////////////////////
|
|
14008
|
-
if (!$div.data()?.xuData) return;
|
|
14009
|
-
const _iterate_info = $div.data().xuData.iterate_info;
|
|
14010
|
-
if (_iterate_info) {
|
|
14011
|
-
if (_iterate_info.is_key_dynamic_field) {
|
|
14012
|
-
_ds.dynamic_fields[_iterate_info.iterator_key].value = _iterate_info._key;
|
|
14013
|
-
} else {
|
|
14014
|
-
try {
|
|
14015
|
-
const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
|
|
14016
|
-
_ds.data_feed.rows[row_idx][_iterate_info.iterator_key] = _iterate_info._key;
|
|
14017
|
-
} catch (err) {
|
|
14018
|
-
console.error(err);
|
|
14019
|
-
}
|
|
14020
|
-
}
|
|
14021
|
-
|
|
14022
|
-
if (_iterate_info.is_val_dynamic_field) {
|
|
14023
|
-
_ds.dynamic_fields[_iterate_info.iterator_val].value = _iterate_info._val;
|
|
14024
|
-
} else {
|
|
14025
|
-
try {
|
|
14026
|
-
const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
|
|
14027
|
-
_ds.data_feed.rows[row_idx][_iterate_info.iterator_val] = _iterate_info._val;
|
|
14028
|
-
} catch (err) {
|
|
14029
|
-
console.error(err);
|
|
14030
|
-
}
|
|
14031
|
-
}
|
|
14032
|
-
}
|
|
14033
|
-
|
|
14034
|
-
if ($div && _$($div) && _ds && paramsP.renderType === 'grid') {
|
|
14035
|
-
func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'update_datasource', { currentRecordId: _$($div).data().xuData.currentRecordId }, null, null, paramsP.dsSessionP);
|
|
14036
|
-
}
|
|
14037
|
-
|
|
14038
|
-
const set_value = function (field_id, value) {
|
|
14039
|
-
var currentRecordId = _$($div).data().xuData.currentRecordId;
|
|
14040
|
-
|
|
14041
|
-
func.UI.worker.add_to_queue(
|
|
14042
|
-
SESSION_ID,
|
|
14043
|
-
'gui event',
|
|
14044
|
-
'update_datasource',
|
|
14045
|
-
{
|
|
14046
|
-
currentRecordId,
|
|
14047
|
-
field_id,
|
|
14048
|
-
field_value: value,
|
|
14049
|
-
},
|
|
14050
|
-
null,
|
|
14051
|
-
null,
|
|
14052
|
-
paramsP.dsSessionP,
|
|
14053
|
-
);
|
|
14054
|
-
};
|
|
14055
|
-
|
|
14056
|
-
if ($div?.data()?.iterate_info) {
|
|
14057
|
-
var data = $div.data().xuData.iterate_info;
|
|
14058
|
-
if (data.iterator_key) {
|
|
14059
|
-
set_value(data.iterator_key, data._key);
|
|
14060
|
-
}
|
|
14061
|
-
if (data.iterator_val) {
|
|
14062
|
-
set_value(data.iterator_val, data._val);
|
|
14063
|
-
}
|
|
14064
|
-
}
|
|
14065
|
-
};
|
|
14066
|
-
const hover_out = function () {
|
|
14067
|
-
if (is_skeleton) return;
|
|
14068
|
-
|
|
14069
|
-
CLIENT_ACTIVITY_TS = Date.now();
|
|
14070
|
-
if (_$($container)?.data()?.xuData?.debug_info) {
|
|
14071
|
-
_$($container).data().xuData.debug_info.hover_item = null;
|
|
14072
|
-
}
|
|
14073
|
-
if (_ds?.data_system) {
|
|
14074
|
-
SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system.SYS_OBJ_WIN_ELEMENT_HOVERED_ATTRIBUTES = {};
|
|
14075
|
-
}
|
|
14076
|
-
};
|
|
14077
|
-
const render_screen_type = async function ($div) {
|
|
14078
|
-
const set_call_screen_properties_values = async function (ui_framework) {
|
|
14079
|
-
params.properties = {};
|
|
14080
|
-
const get_values = async function (property) {
|
|
14081
|
-
var property_value = paramsP?.screenInfo?.properties?.[property] || paramsP?.screenInfo?.properties?.frameworkProperties?.[property];
|
|
14082
|
-
if (paramsP?.call_screen_propertiesP) {
|
|
14083
|
-
if (paramsP.call_screen_propertiesP?.[property]) {
|
|
14084
|
-
property_value = paramsP.call_screen_propertiesP[property];
|
|
14085
|
-
}
|
|
14086
|
-
if (paramsP.call_screen_propertiesP[`xu-exp:${property}`]) {
|
|
14087
|
-
property_value = (await func.expression.get(SESSION_ID, paramsP.call_screen_propertiesP[`xu-exp:${property}`], paramsP.dsSessionP, property)).result;
|
|
14088
|
-
}
|
|
14089
|
-
}
|
|
14090
|
-
return property_value;
|
|
14091
|
-
};
|
|
14092
|
-
params.properties['name'] = await get_values('menuTitle');
|
|
14093
|
-
if (await ui_framework?.properties()) {
|
|
14094
|
-
for await (const [key, val] of Object.entries(await ui_framework.properties())) {
|
|
14095
|
-
params.properties[key] = await get_values(key);
|
|
14096
|
-
}
|
|
14097
|
-
}
|
|
14098
|
-
};
|
|
14099
|
-
|
|
14100
|
-
var $div_content = $div.children();
|
|
14101
|
-
|
|
14102
|
-
$.each($div_content, function (key, val) {
|
|
14103
|
-
if (!$(val)?.data()?.xuData?.parent_container) {
|
|
14104
|
-
return true;
|
|
14105
|
-
}
|
|
14106
|
-
$(val).data().xuData.parent_container = $div.data().xuData.parent_container;
|
|
14107
|
-
});
|
|
14108
|
-
|
|
14109
|
-
let $ret = $div;
|
|
14110
|
-
var $nav = $(SESSION_OBJ[SESSION_ID].root_element).find('xu-nav');
|
|
14111
|
-
var params;
|
|
14112
|
-
switch (paramsP.screen_type) {
|
|
14113
|
-
case 'modal':
|
|
14114
|
-
const modal_id = 'app_modal-' + paramsP.dsSessionP.toString();
|
|
14115
|
-
var xu_modal_controller = document.querySelector('xu-modal-controller');
|
|
14116
|
-
if (!xu_modal_controller) {
|
|
14117
|
-
func.UI.component.create_app_modal_component(SESSION_ID, modal_id);
|
|
14118
|
-
xu_modal_controller = document.querySelector('xu-modal-controller');
|
|
14119
|
-
}
|
|
14120
|
-
|
|
14121
|
-
var controller_params = $(xu_modal_controller).data('xuControllerParams');
|
|
14122
|
-
|
|
14123
|
-
if (!controller_params) {
|
|
14124
|
-
controller_params = {};
|
|
14125
|
-
}
|
|
14126
|
-
|
|
14127
|
-
params = {
|
|
14128
|
-
screenId: paramsP.screenId,
|
|
14129
|
-
$dialogDiv: $div.children(),
|
|
14130
|
-
$container: $container,
|
|
14131
|
-
dsSession: paramsP.dsSessionP,
|
|
14132
|
-
modal_id,
|
|
14133
|
-
screenInfo: paramsP.screenInfo,
|
|
14134
|
-
close_callback: close_modal,
|
|
14135
|
-
paramsP,
|
|
14136
|
-
};
|
|
14137
|
-
|
|
14138
|
-
controller_params[modal_id] = params;
|
|
14139
|
-
|
|
14140
|
-
$(xu_modal_controller).data('xuControllerParams', controller_params);
|
|
14141
|
-
const modalController = await new UI_FRAMEWORK_PLUGIN.modal();
|
|
14142
|
-
await set_call_screen_properties_values(modalController);
|
|
14143
|
-
if (!APP_MODAL_OBJ[modal_id]) {
|
|
14144
|
-
const modal = await modalController.create(params);
|
|
14145
|
-
|
|
14146
|
-
APP_MODAL_OBJ[modal_id] = modal;
|
|
14147
|
-
} else {
|
|
14148
|
-
$(modal_id).empty();
|
|
14149
|
-
}
|
|
14150
|
-
|
|
14151
|
-
await modalController.init(params);
|
|
14152
|
-
|
|
14153
|
-
break;
|
|
14154
|
-
|
|
14155
|
-
case 'popover':
|
|
14156
|
-
// open_popover($div);
|
|
14157
|
-
|
|
14158
|
-
const xu_popover_controller = func.UI.component.create_app_popover_component(SESSION_ID);
|
|
14159
|
-
params = {
|
|
14160
|
-
menuTitle: paramsP.screenInfo.properties?.menuTitle,
|
|
14161
|
-
screenId: paramsP.screenId,
|
|
14162
|
-
$dialogDiv: $div.children(),
|
|
14163
|
-
$container: $container,
|
|
14164
|
-
};
|
|
14165
|
-
|
|
14166
|
-
$(xu_popover_controller).data('xuControllerParams', params);
|
|
14167
|
-
const popover = new UI_FRAMEWORK_PLUGIN.popover(SESSION_ID);
|
|
14168
|
-
await set_call_screen_properties_values(popover);
|
|
14169
|
-
await popover.open(params);
|
|
14170
|
-
CURRENT_APP_POPOVER = popover;
|
|
14171
|
-
|
|
14172
|
-
func.UI.utils.screen_blocker(false, paramsP.prog_id + '_' + paramsP.sourceScreenP);
|
|
14173
|
-
break;
|
|
14174
|
-
|
|
14175
|
-
case 'page':
|
|
14176
|
-
const nav = $nav[0];
|
|
14177
|
-
|
|
14178
|
-
params = {
|
|
14179
|
-
div: $div_content,
|
|
14180
|
-
name: paramsP.screenInfo.properties?.menuTitle,
|
|
14181
|
-
screenId: paramsP.screenId,
|
|
14182
|
-
$container: $container,
|
|
14183
|
-
dsSession: paramsP.dsSessionP,
|
|
14184
|
-
SESSION_ID,
|
|
14185
|
-
nav,
|
|
14186
|
-
paramsP,
|
|
14187
|
-
};
|
|
14188
|
-
|
|
14189
|
-
var component_name = 'xu-page-component-' + paramsP.dsSessionP;
|
|
14190
|
-
if (!$(nav).data().xuData.nav_params) {
|
|
14191
|
-
$(nav).data().xuData.nav_params = {};
|
|
14192
|
-
}
|
|
14193
|
-
|
|
14194
|
-
//restore validate
|
|
14195
|
-
if ($(nav)?.data()?.xuData?.params?.[paramsP.dsSessionP]) {
|
|
14196
|
-
params.$container.data().xuData.validate_screen_ready = $(nav).data().xuData.params[paramsP.dsSessionP].$container.data().xuData.validate_screen_ready;
|
|
14197
|
-
}
|
|
14198
|
-
|
|
14199
|
-
if (!$(nav)?.data()?.xuData) return;
|
|
14200
|
-
$(nav).data().xuData.nav_params[paramsP.dsSessionP] = params;
|
|
14201
|
-
if (!$(component_name).length) {
|
|
14202
|
-
await func.UI.component.create_app_page_component(SESSION_ID, paramsP.dsSessionP);
|
|
14203
|
-
const page = new UI_FRAMEWORK_PLUGIN.page();
|
|
14204
|
-
await set_call_screen_properties_values(page);
|
|
14205
|
-
await page.create(params);
|
|
14206
|
-
await page.init(params);
|
|
14207
|
-
nav.push(component_name, { params });
|
|
14208
|
-
} else {
|
|
14209
|
-
debugger;
|
|
14210
|
-
$(component_name).empty();
|
|
14211
|
-
|
|
14212
|
-
await UI_FRAMEWORK_PLUGIN.page(SESSION_ID, paramsP.dsSessionP);
|
|
14213
|
-
}
|
|
14214
|
-
$div.data().xuData.paramsP = $container.data().xuData.paramsP;
|
|
14215
|
-
break;
|
|
14216
|
-
|
|
14217
|
-
case 'panel':
|
|
14218
|
-
$container.append($div_content);
|
|
14219
|
-
$ret = $container;
|
|
14220
|
-
break;
|
|
14221
|
-
|
|
14222
|
-
default: // set data to nav to use in the component
|
|
14223
|
-
if ($nav && $nav.length) {
|
|
14224
|
-
// refresh made
|
|
14225
|
-
} else {
|
|
14226
|
-
$nav = $('<xu-nav>');
|
|
14227
|
-
$container.append($nav);
|
|
14228
|
-
func.UI.component.init_xu_nav($container, $nav);
|
|
14229
|
-
}
|
|
14230
|
-
|
|
14231
|
-
$nav.data().xuData.$div = $div_content;
|
|
14232
|
-
|
|
14233
|
-
await $nav[0].setRoot('xu-root-component-' + SESSION_ID);
|
|
14234
|
-
$ret = $container;
|
|
14235
|
-
break;
|
|
14236
|
-
}
|
|
14237
|
-
return $ret;
|
|
14238
|
-
};
|
|
14239
|
-
|
|
14240
|
-
if (!(await init())) return;
|
|
14241
|
-
debug();
|
|
14242
|
-
const fx = {
|
|
14243
|
-
widget: async function () {
|
|
14244
|
-
var _session = SESSION_OBJ[SESSION_ID];
|
|
14245
|
-
|
|
14246
|
-
var exist_elm_obj = get_element_info();
|
|
14247
|
-
var $div = exist_elm_obj.div;
|
|
14248
|
-
if (!exist_elm_obj.div) {
|
|
14249
|
-
$div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, 'widget_wrapper', null, null, null, null);
|
|
14250
|
-
|
|
14251
|
-
//////////////////////////
|
|
14252
|
-
|
|
14253
|
-
let plugin_name = prop['xu-widget'],
|
|
14254
|
-
method = prop['xu-method'],
|
|
14255
|
-
dsP = paramsP.dsSessionP,
|
|
14256
|
-
propsP = prop,
|
|
14257
|
-
sourceP = 'widgets';
|
|
14258
|
-
|
|
14259
|
-
// const set_SYS_GLOBAL_OBJ_WIDGET_INFO = async function (docP) {
|
|
14260
|
-
// var obj = _.clone(docP);
|
|
14261
|
-
// obj.date = await func.utils.get_dateTime(
|
|
14262
|
-
// SESSION_ID,
|
|
14263
|
-
// "SYS_DATE",
|
|
14264
|
-
// docP.date
|
|
14265
|
-
// );
|
|
14266
|
-
// obj.time = await func.utils.get_dateTime(
|
|
14267
|
-
// SESSION_ID,
|
|
14268
|
-
// "SYS_TIME",
|
|
14269
|
-
// docP.date
|
|
14270
|
-
// );
|
|
14271
|
-
|
|
14272
|
-
// var datasource_changes = {
|
|
14273
|
-
// [0]: {
|
|
14274
|
-
// ["data_system"]: {
|
|
14275
|
-
// ["SYS_GLOBAL_OBJ_WIDGET_INFO"]: obj,
|
|
14276
|
-
// },
|
|
14277
|
-
// },
|
|
14278
|
-
// };
|
|
14279
|
-
// await func.datasource.update(SESSION_ID, datasource_changes);
|
|
14280
|
-
// };
|
|
14281
|
-
const call_plugin_api = async function (plugin_nameP, dataP) {
|
|
14282
|
-
return await func.utils.call_plugin_api(SESSION_ID, plugin_nameP, dataP);
|
|
14283
|
-
};
|
|
14284
|
-
const report_error = function (descP, warn) {
|
|
14285
|
-
func.utils.debug.log(SESSION_ID, _session.DS_GLB[dsP].prog_id + '_' + _session.DS_GLB[dsP].callingMenuId, {
|
|
14286
|
-
module: 'widgets',
|
|
14287
|
-
action: 'Init',
|
|
14288
|
-
source: sourceP,
|
|
14289
|
-
prop: descP,
|
|
14290
|
-
details: descP,
|
|
14291
|
-
result: null,
|
|
14292
|
-
error: warn ? false : true,
|
|
14293
|
-
fields: null,
|
|
14294
|
-
type: 'widgets',
|
|
14295
|
-
prog_id: _session.DS_GLB[dsP].prog_id,
|
|
14296
|
-
});
|
|
14297
|
-
};
|
|
14298
|
-
const get_fields_data = async function (fields, props) {
|
|
14299
|
-
const report_error = function (descP, warn) {
|
|
14300
|
-
func.utils.debug.log(SESSION_ID, _session.DS_GLB[dsP].prog_id + '_' + _session.DS_GLB[dsP].callingMenuId, {
|
|
14301
|
-
module: 'widgets',
|
|
14302
|
-
action: 'Init',
|
|
14303
|
-
source: sourceP,
|
|
14304
|
-
prop: descP,
|
|
14305
|
-
details: descP,
|
|
14306
|
-
result: null,
|
|
14307
|
-
error: warn ? false : true,
|
|
14308
|
-
fields: null,
|
|
14309
|
-
type: 'widgets',
|
|
14310
|
-
prog_id: _session.DS_GLB[dsP].prog_id,
|
|
14311
|
-
});
|
|
14312
|
-
};
|
|
14313
|
-
const get_property_value = async function (fieldIdP, val) {
|
|
14314
|
-
if (!val) return;
|
|
14315
|
-
var value = props[fieldIdP] || (typeof val.defaultValue === 'function' ? val?.defaultValue?.() : val?.defaultValue);
|
|
14316
|
-
if (val.render === 'eventId') {
|
|
14317
|
-
value = props?.[fieldIdP]?.event;
|
|
14318
|
-
}
|
|
14319
|
-
|
|
14320
|
-
if (props[`xu-exp:${fieldIdP}`]) {
|
|
14321
|
-
value = (await func.expression.get(SESSION_ID, props[`xu-exp:${fieldIdP}`], dsP, 'widget property')).result;
|
|
14322
|
-
}
|
|
14323
|
-
|
|
14324
|
-
return func.common.get_cast_val(
|
|
14325
|
-
SESSION_ID,
|
|
14326
|
-
'widgets',
|
|
14327
|
-
fieldIdP,
|
|
14328
|
-
val.type, //val.type !== "string" || val.type !== "number" ? "string" : val.type,
|
|
14329
|
-
value,
|
|
14330
|
-
null,
|
|
14331
|
-
);
|
|
14332
|
-
};
|
|
14333
|
-
var data_obj = {};
|
|
14334
|
-
var return_code = 1;
|
|
14335
|
-
// $.each(fields, function (key, val) {
|
|
14336
|
-
for await (const [key, val] of Object.entries(fields)) {
|
|
14337
|
-
data_obj[key] = await get_property_value(key, val);
|
|
14338
|
-
if (!data_obj[key] && val.mandatory) {
|
|
14339
|
-
return_code = -1;
|
|
14340
|
-
report_error(`${key} is a mandatory field.`);
|
|
14341
|
-
break;
|
|
14342
|
-
}
|
|
14343
|
-
// console.log(val);
|
|
14344
|
-
}
|
|
14345
|
-
for await (const key of ['xu-bind']) {
|
|
14346
|
-
data_obj[key] = await get_property_value(key, props[key]);
|
|
14347
|
-
}
|
|
14348
|
-
|
|
14349
|
-
return { code: return_code, data: data_obj };
|
|
14350
|
-
};
|
|
14351
|
-
|
|
14352
|
-
const load_css_style = function () {
|
|
14353
|
-
let path = get_path('style.css');
|
|
14354
|
-
func.utils.load_css_on_demand(path);
|
|
14355
|
-
};
|
|
14356
|
-
|
|
14357
|
-
const get_path = function (resource) {
|
|
14358
|
-
if (_session.worker_type === 'Dev') {
|
|
14359
|
-
return `../../plugins/${plugin_name}/${resource}`;
|
|
14360
|
-
}
|
|
14361
|
-
return `https://${_session.domain}/plugins/${plugin_name}/${resource}?gtp_token=${_session.gtp_token}&app_id=${_session.app_id}`;
|
|
14362
|
-
};
|
|
14363
|
-
const _plugin = APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
|
|
14364
|
-
const index = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${_plugin.manifest['index.mjs'].dist ? 'dist/' : ''}index.mjs`);
|
|
14365
|
-
const methods = index.methods;
|
|
14366
|
-
if (methods && !methods[method]) {
|
|
14367
|
-
return report_error('method not found');
|
|
14368
|
-
}
|
|
14369
|
-
|
|
14370
|
-
const fields_ret = await get_fields_data(methods[method].fields, propsP);
|
|
14371
|
-
if (fields_ret.code < 0) {
|
|
14372
|
-
return report_error(fields_ret.data);
|
|
14373
|
-
}
|
|
14374
|
-
const fields = fields_ret.data;
|
|
14375
|
-
|
|
14376
|
-
let exclude_attributes = [];
|
|
14377
|
-
for await (const [key, val] of Object.entries(propsP)) {
|
|
14378
|
-
if (typeof fields[key] !== 'undefined' || typeof fields[`xu-exp:${key}`] !== 'undefined') {
|
|
14379
|
-
exclude_attributes.push(key);
|
|
14380
|
-
}
|
|
14381
|
-
}
|
|
14382
|
-
|
|
14383
|
-
let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div, true, exclude_attributes);
|
|
14384
|
-
|
|
14385
|
-
$div.addClass('widget_wrapper'); // class get override in set_attributes_new
|
|
14386
|
-
|
|
14387
|
-
if (!APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name]) {
|
|
14388
|
-
return report_error(`plugin ${plugin_name} not found`);
|
|
14389
|
-
}
|
|
14390
|
-
|
|
14391
|
-
if (APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name].manifest['style.css'].exist) {
|
|
14392
|
-
load_css_style();
|
|
14393
|
-
}
|
|
14394
|
-
|
|
14395
|
-
const plugin_setup_ret = await func.utils.get_plugin_setup(SESSION_ID, plugin_name);
|
|
14396
|
-
if (plugin_setup_ret.code < 0) {
|
|
14397
|
-
return report_error(plugin_setup_ret);
|
|
14398
|
-
}
|
|
14399
|
-
|
|
14400
|
-
const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
|
|
14401
|
-
func,
|
|
14402
|
-
glb,
|
|
14403
|
-
SESSION_OBJ,
|
|
14404
|
-
SESSION_ID,
|
|
14405
|
-
APP_OBJ,
|
|
14406
|
-
dsSession: paramsP.dsSessionP,
|
|
14407
|
-
job_id: jobNoP,
|
|
14408
|
-
});
|
|
14409
|
-
|
|
14410
|
-
const params = {
|
|
14411
|
-
SESSION_ID,
|
|
14412
|
-
method,
|
|
14413
|
-
_session,
|
|
14414
|
-
dsP,
|
|
14415
|
-
sourceP,
|
|
14416
|
-
propsP,
|
|
14417
|
-
plugin_name,
|
|
14418
|
-
$containerP: $div,
|
|
14419
|
-
plugin_setup: plugin_setup_ret.data,
|
|
14420
|
-
|
|
14421
|
-
report_error,
|
|
14422
|
-
call_plugin_api,
|
|
14423
|
-
// set_SYS_GLOBAL_OBJ_WIDGET_INFO,
|
|
14424
|
-
api_utils,
|
|
14425
|
-
};
|
|
14426
|
-
|
|
14427
|
-
const fx = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${_plugin.manifest['runtime.mjs'].dist ? 'dist/' : ''}runtime.mjs`);
|
|
14428
|
-
|
|
14429
|
-
if (_plugin?.manifest?.['runtime.mjs'].dist && _plugin?.manifest?.['runtime.mjs']?.css) {
|
|
14430
|
-
const plugin_runtime_css_url = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, 'dist/runtime.css');
|
|
14431
|
-
func.utils.load_css_on_demand(plugin_runtime_css_url);
|
|
14432
|
-
}
|
|
14433
|
-
|
|
14434
|
-
if (!fx[method]) {
|
|
14435
|
-
throw `Method: ${method} does not exist`;
|
|
14436
|
-
}
|
|
14437
|
-
try {
|
|
14438
|
-
await fx[method](fields, params);
|
|
14439
|
-
} catch (err) {
|
|
14440
|
-
func.utils.debug_report(SESSION_ID, `${plugin_name} widget`, err.message, 'E');
|
|
14441
|
-
}
|
|
14442
|
-
}
|
|
14443
|
-
return $div;
|
|
14444
|
-
},
|
|
14445
|
-
[`xu-single-view`]: async function () {
|
|
14446
|
-
var exist_elm_obj = get_element_info();
|
|
14447
|
-
var $div = exist_elm_obj.div;
|
|
14448
|
-
|
|
14449
|
-
if (!exist_elm_obj.div) {
|
|
14450
|
-
var $wrapper = $('<div>');
|
|
14451
|
-
$div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, 'div', $wrapper, '');
|
|
14452
|
-
|
|
14453
|
-
if (!$div) return;
|
|
14454
|
-
|
|
14455
|
-
if (!REFRESHER_IN_PROGRESS && (paramsP.is_mobile_popover || paramsP.is_mobile_page)) {
|
|
14456
|
-
close_all_modals();
|
|
14457
|
-
}
|
|
14458
|
-
|
|
14459
|
-
$div.hover(
|
|
14460
|
-
function (e) {
|
|
14461
|
-
hover_in();
|
|
14462
|
-
},
|
|
14463
|
-
function (e) {
|
|
14464
|
-
hover_out();
|
|
14465
|
-
},
|
|
14466
|
-
);
|
|
14467
|
-
}
|
|
14468
|
-
|
|
14469
|
-
const ret = await iterate_child($div, nodeP, null, null, $div);
|
|
14470
|
-
if (_.isEmpty($container.data().xuAttributes)) {
|
|
14471
|
-
await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
|
|
14472
|
-
}
|
|
14473
|
-
|
|
14474
|
-
$.each($div.data().xuData, function (key, val) {
|
|
14475
|
-
$container.data().xuData[key] = _.cloneDeep(val);
|
|
14476
|
-
});
|
|
14477
|
-
$.each($div.data().xuAttributes, function (key, val) {
|
|
14478
|
-
$container.data().xuAttributes[key] = _.cloneDeep(val);
|
|
14479
|
-
});
|
|
14480
|
-
|
|
14481
|
-
return await render_screen_type($div);
|
|
14482
|
-
},
|
|
14483
|
-
[`xu-multi-view`]: async function () {
|
|
14484
|
-
var $div = $container;
|
|
14485
|
-
|
|
14486
|
-
if (!$div.data().xuData.node || !$div.data().xuData.node.children) {
|
|
14487
|
-
$div.data().xuData.node = nodeP;
|
|
14488
|
-
}
|
|
14489
|
-
|
|
14490
|
-
if (!$div.data().xuData.debug_info) {
|
|
14491
|
-
$div.data().xuData.debug_info = {
|
|
14492
|
-
id: nodeP.id,
|
|
14493
|
-
parent_id: $container.data().xuData.ui_id,
|
|
14494
|
-
};
|
|
14495
|
-
}
|
|
14496
|
-
|
|
14497
|
-
const done = async function (continuous_idx) {
|
|
14498
|
-
// const do_callback = async function ($div) {
|
|
14499
|
-
// // if ($root_container.data().xuData.progress_bar_circle) {
|
|
14500
|
-
// // setTimeout(function () {
|
|
14501
|
-
// // $.each(
|
|
14502
|
-
// // $root_container.data().xuData.progress_bar_circle,
|
|
14503
|
-
// // function (key, val) {
|
|
14504
|
-
// // val.bar.set(parseFloat(val.value)); // Number from 0.0 to 1.0
|
|
14505
|
-
// // }
|
|
14506
|
-
// // );
|
|
14507
|
-
// // }, 2000);
|
|
14508
|
-
// // }
|
|
14509
|
-
|
|
14510
|
-
// if (paramsP.screenInfo.properties?.rtl) {
|
|
14511
|
-
// $div_content.attr('dir', 'rtl');
|
|
14512
|
-
// }
|
|
14513
|
-
|
|
14514
|
-
// return $div;
|
|
14515
|
-
// };
|
|
14516
|
-
await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
|
|
14517
|
-
|
|
14518
|
-
return await render_screen_type($div);
|
|
14519
|
-
};
|
|
14520
|
-
|
|
14521
|
-
if (!REFRESHER_IN_PROGRESS && (paramsP.is_mobile_popover || paramsP.is_mobile_page)) {
|
|
14522
|
-
close_all_modals();
|
|
14523
|
-
}
|
|
14524
|
-
|
|
14525
|
-
const empty_result = async function () {
|
|
14526
|
-
var content = prop.empty_result_content || '';
|
|
14527
|
-
|
|
14528
|
-
var res = await func.expression.get(
|
|
14529
|
-
SESSION_ID,
|
|
14530
|
-
content, // prop["xu-exp:empty_result_content"],
|
|
14531
|
-
paramsP.dsSessionP,
|
|
14532
|
-
'empty_result_content_EXP',
|
|
14533
|
-
_ds.currentRecordId,
|
|
14534
|
-
);
|
|
14535
|
-
content = res.result;
|
|
14536
|
-
// }
|
|
14537
|
-
|
|
14538
|
-
let empty_result_node = {
|
|
14539
|
-
type: 'element',
|
|
14540
|
-
id: crypto.randomUUID(),
|
|
14541
|
-
content,
|
|
14542
|
-
// : content || (typeof content === "undefined" && "Empty results"),
|
|
14543
|
-
tagName: 'div',
|
|
14544
|
-
attributes: {},
|
|
14545
|
-
children: [],
|
|
14546
|
-
};
|
|
14547
|
-
|
|
14548
|
-
const ret = await func.UI.screen.render_ui_tree(SESSION_ID, $container, empty_result_node, parent_infoP, paramsP, jobNoP, null, 0, null, nodeP, null, $root_container);
|
|
14549
|
-
await func.events.validate(SESSION_ID, 'record_not_found', paramsP.dsSessionP);
|
|
14550
|
-
return await done(null);
|
|
14551
|
-
};
|
|
14552
|
-
var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
|
|
14553
|
-
|
|
14554
|
-
var continuous_idx = null;
|
|
14555
|
-
|
|
14556
|
-
if (!_ds.data_feed || _.isEmpty(_ds.data_feed.rows)) {
|
|
14557
|
-
return await empty_result();
|
|
14558
|
-
}
|
|
14559
|
-
|
|
14560
|
-
var i = 0;
|
|
14561
|
-
for await (const [key, val] of Object.entries(_ds.data_feed.rows)) {
|
|
14562
|
-
var node = JSON.parse(JSON.stringify(nodeP));
|
|
14563
|
-
|
|
14564
|
-
_ds.currentRecordId = val._ROWID;
|
|
14565
|
-
const ret = await iterate_child($div, node, { continuous_idx }, null, $root_container);
|
|
14566
|
-
|
|
14567
|
-
if (_.isEmpty($container.data().xuAttributes)) {
|
|
14568
|
-
await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
|
|
14569
|
-
}
|
|
14570
|
-
}
|
|
14571
|
-
|
|
14572
|
-
return await done(continuous_idx);
|
|
14573
|
-
},
|
|
14574
|
-
[`xu-panel`]: async function () {
|
|
14575
|
-
const done = async function ($new_div) {
|
|
14576
|
-
if (!$container.data()?.xuData?.paramsP) {
|
|
14577
|
-
return $container;
|
|
14578
|
-
}
|
|
14579
|
-
var $div_items = $div.data().xuData.node.children;
|
|
14580
|
-
|
|
14581
|
-
await func.UI.screen.panel_post_render_handler(SESSION_ID, $container, $new_div, nodeP, $div, jobNoP);
|
|
14582
|
-
|
|
14583
|
-
// TO FIX should be timeout
|
|
14584
|
-
$container.data().xuData.node.children = $div_items;
|
|
14585
|
-
|
|
14586
|
-
return $container;
|
|
14587
|
-
};
|
|
14588
|
-
|
|
14589
|
-
var $wrapper = $('<div>');
|
|
14590
|
-
$div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, null, $wrapper, '');
|
|
14591
|
-
|
|
14592
|
-
let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div.clone(true), true, undefined, refreshed_ds);
|
|
14593
|
-
if (ret.abort) {
|
|
14594
|
-
// // program null
|
|
14595
|
-
// if (ret.program_null) {
|
|
14596
|
-
// return render_screen_type($div);
|
|
14597
|
-
// }
|
|
14598
|
-
|
|
14599
|
-
// render N
|
|
14600
|
-
return (ret.$new_div = $('<template>').append($div));
|
|
14601
|
-
|
|
14602
|
-
// ret.$new_div = $("<template>").append($div);
|
|
14603
|
-
}
|
|
14604
|
-
let ret_done = await done(ret.$new_div);
|
|
14605
|
-
return ret_done;
|
|
14606
|
-
},
|
|
14607
|
-
};
|
|
14608
|
-
|
|
14609
|
-
const draw_html_element = async function (element) {
|
|
14610
|
-
const done = async function () {
|
|
14611
|
-
return $div;
|
|
14612
|
-
};
|
|
14613
|
-
if (!element || element === 'script') return await done();
|
|
14614
|
-
let str = '';
|
|
14615
|
-
|
|
14616
|
-
var $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, element, null, str);
|
|
14617
|
-
|
|
14618
|
-
$div.hover(
|
|
14619
|
-
function (e) {
|
|
14620
|
-
hover_in($div);
|
|
14621
|
-
},
|
|
14622
|
-
function (e) {
|
|
14623
|
-
hover_out();
|
|
14624
|
-
},
|
|
14625
|
-
);
|
|
14626
|
-
|
|
14627
|
-
let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div, true);
|
|
14628
|
-
if (ret.abort) return await done();
|
|
14629
|
-
// check if iterator made to prevent children render
|
|
14630
|
-
|
|
14631
|
-
const ret_iterate_child = await iterate_child($div, nodeP, parent_infoP, null, $root_container);
|
|
14632
|
-
return await done();
|
|
14633
|
-
};
|
|
14634
|
-
|
|
14635
|
-
if (nodeP.content && nodeP.attributes) {
|
|
14636
|
-
nodeP.attributes['xu-content'] = nodeP.content;
|
|
14637
|
-
}
|
|
14638
|
-
if (nodeP.tagName === 'xu-widget') {
|
|
14639
|
-
if (is_skeleton) return;
|
|
14640
|
-
return await fx['widget']();
|
|
14641
|
-
}
|
|
14642
|
-
if (fx[nodeP.tagName]) {
|
|
14643
|
-
return await fx[nodeP.tagName]();
|
|
14644
|
-
}
|
|
14645
|
-
|
|
14646
|
-
return await draw_html_element(nodeP.tagName);
|
|
14647
|
-
};
|
|
14648
|
-
|
|
14649
|
-
func.UI.screen.refresh_document_changes_for_realtime_update = async function (SESSION_ID, doc_change) {
|
|
14650
|
-
let _session = SESSION_OBJ[SESSION_ID];
|
|
14651
|
-
for (const [key, _ds] of Object.entries(_session.DS_GLB)) {
|
|
14652
|
-
let prog_obj = await func.utils.VIEWS_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
14653
|
-
if (prog_obj?.progDataSource?.dataSourceRealtime && prog_obj?.progDataSource?.dataSourceTableId === doc_change.table_id) {
|
|
14654
|
-
try {
|
|
14655
|
-
// disabled in purpose to support create row
|
|
14656
|
-
|
|
14657
|
-
// const row_idx = func.common.find_ROWID_idx(_ds, doc_change.row_id);
|
|
14658
|
-
|
|
14659
|
-
// console.log(
|
|
14660
|
-
// "refresh_document_changes_for_realtime_update",
|
|
14661
|
-
// _ds.data_feed.rows[row_idx]
|
|
14662
|
-
// );
|
|
14663
|
-
|
|
14664
|
-
if (!_ds.screen_params) continue;
|
|
14665
|
-
if (_ds.screen_params.is_panelP) {
|
|
14666
|
-
func.UI.screen.refresh_screen(SESSION_ID, null, key);
|
|
14667
|
-
} else {
|
|
14668
|
-
func.action.execute(SESSION_ID, 'act_refresh', _ds, null, null);
|
|
14669
|
-
}
|
|
14670
|
-
} catch (err) {
|
|
14671
|
-
// console.error(err);
|
|
14672
|
-
}
|
|
14673
|
-
}
|
|
14674
|
-
}
|
|
14675
|
-
};
|
|
14676
|
-
func.UI.component = {};
|
|
13215
|
+
func.UI.component = {};
|
|
14677
13216
|
|
|
14678
13217
|
func.UI.component.create_app_modal_component = function (
|
|
14679
13218
|
SESSION_ID,
|