@xuda.io/runtime-bundle 1.0.1155 → 1.0.1156
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.
|
@@ -7751,7 +7751,1249 @@ func.utils.get_last_datasource_no = function (SESSION_ID) {
|
|
|
7751
7751
|
return filtered?.at?.(-1)?.dsSession;
|
|
7752
7752
|
}
|
|
7753
7753
|
};
|
|
7754
|
-
|
|
7754
|
+
func.UI.utils = {};
|
|
7755
|
+
|
|
7756
|
+
func.UI.utils.indicator = {};
|
|
7757
|
+
func.UI.utils.indicator.worker = {};
|
|
7758
|
+
func.UI.utils.indicator.worker.busy = function () {
|
|
7759
|
+
$('.progressLoader').addClass('progress_busy');
|
|
7760
|
+
};
|
|
7761
|
+
func.UI.utils.indicator.worker.normal = function () {
|
|
7762
|
+
$('.progressLoader').removeClass('progress_busy');
|
|
7763
|
+
};
|
|
7764
|
+
func.UI.utils.indicator.server = {};
|
|
7765
|
+
func.UI.utils.indicator.server.busy = function () {
|
|
7766
|
+
func.UI.utils.indicator.worker.busy();
|
|
7767
|
+
};
|
|
7768
|
+
func.UI.utils.indicator.server.normal = function () {
|
|
7769
|
+
func.UI.utils.indicator.worker.normal();
|
|
7770
|
+
};
|
|
7771
|
+
|
|
7772
|
+
func.UI.utils.indicator.screen = {};
|
|
7773
|
+
func.UI.utils.indicator.screen.busy = function () {
|
|
7774
|
+
$('.progressLoader').addClass('progress_busy2');
|
|
7775
|
+
};
|
|
7776
|
+
func.UI.utils.indicator.screen.normal = function () {
|
|
7777
|
+
$('.progressLoader').removeClass('progress_busy2');
|
|
7778
|
+
};
|
|
7779
|
+
|
|
7780
|
+
func.UI.utils.save = function (SESSION_ID, stateP) {
|
|
7781
|
+
if (stateP) func.UI.utils.indicator.worker.busy();
|
|
7782
|
+
else func.UI.utils.indicator.worker.normal();
|
|
7783
|
+
};
|
|
7784
|
+
|
|
7785
|
+
func.UI.utils.screen_blocker = function (onP, idP, dsP) {
|
|
7786
|
+
if (!idP) {
|
|
7787
|
+
func.utils.debug_report('', 'Worker', 'Missing reference id', 'E');
|
|
7788
|
+
return;
|
|
7789
|
+
}
|
|
7790
|
+
window.oncontextmenu = function () {
|
|
7791
|
+
if (onP) return false;
|
|
7792
|
+
else return true;
|
|
7793
|
+
};
|
|
7794
|
+
if (!onP) {
|
|
7795
|
+
delete SCREEN_BLOCKER_OBJ[idP];
|
|
7796
|
+
|
|
7797
|
+
return;
|
|
7798
|
+
}
|
|
7799
|
+
|
|
7800
|
+
if (idP !== 'Worker') {
|
|
7801
|
+
SCREEN_BLOCKER_OBJ[idP] = Date.now();
|
|
7802
|
+
}
|
|
7803
|
+
};
|
|
7804
|
+
|
|
7805
|
+
func.UI.utils.get_node_elm = function (SESSION_ID, dsSessionP, ui_idP, $container, is_app_panel, ui_type, functionP) {
|
|
7806
|
+
if (!$container) {
|
|
7807
|
+
$container = $('body');
|
|
7808
|
+
}
|
|
7809
|
+
var $elm = func.UI.utils.find_in_element_data(is_app_panel ? 'xuPanelData' : 'xuData', $container, 'ui_id', ui_idP);
|
|
7810
|
+
const _session = SESSION_OBJ[SESSION_ID];
|
|
7811
|
+
var _ds = _session.DS_GLB[dsSessionP];
|
|
7812
|
+
|
|
7813
|
+
if (_ds.tree_obj.renderType === 'form') {
|
|
7814
|
+
return $elm;
|
|
7815
|
+
}
|
|
7816
|
+
var $grid_elm;
|
|
7817
|
+
$.each($elm, function (key, val) {
|
|
7818
|
+
if ($(val.data().xuData.recordid) === _ds.currentRecordId) {
|
|
7819
|
+
$grid_elm = $(val);
|
|
7820
|
+
return false;
|
|
7821
|
+
}
|
|
7822
|
+
});
|
|
7823
|
+
return $grid_elm;
|
|
7824
|
+
|
|
7825
|
+
return $elm;
|
|
7826
|
+
};
|
|
7827
|
+
func.UI.utils.get_nodeId = function (SESSION_ID, dsSessionP, ui_idP, $container, is_app_panel) {
|
|
7828
|
+
var $elm = func.UI.utils.get_node_elm(SESSION_ID, dsSessionP, ui_idP, $container, is_app_panel, null, null);
|
|
7829
|
+
|
|
7830
|
+
if (is_app_panel) {
|
|
7831
|
+
return $elm.data().xuData.panel_info.prop.id;
|
|
7832
|
+
} else {
|
|
7833
|
+
return $elm.attr('nodeId');
|
|
7834
|
+
}
|
|
7835
|
+
};
|
|
7836
|
+
// func.UI.utils.get_element_info = function (SESSION_ID, dsSessionP, ui_idP, $container, is_app_panel, ui_type, functionP) {
|
|
7837
|
+
// var $elm = func.UI.utils.get_node_elm(SESSION_ID, dsSessionP, ui_idP, $container, is_app_panel, ui_type, functionP);
|
|
7838
|
+
// var ret = {};
|
|
7839
|
+
// if ($elm?.length) {
|
|
7840
|
+
// //length added 20210209
|
|
7841
|
+
// // if (is_app_panel) {
|
|
7842
|
+
// // if ($elm?.data()?.xuData.panel_info) {
|
|
7843
|
+
// // ret.nodeId = $elm.data().xuData.panel_info.prop.id;
|
|
7844
|
+
// // } else {
|
|
7845
|
+
// // ret.nodeId = $elm.data().xuData.properties.id;
|
|
7846
|
+
// // }
|
|
7847
|
+
// // } else {
|
|
7848
|
+
// // ret.nodeId = $elm.data().xuData.nodeId;
|
|
7849
|
+
// ret.nodeId = $elm.data().xuData.xu_id;
|
|
7850
|
+
|
|
7851
|
+
// // ret.nodeId = $elm.attr('xu-ui-id');
|
|
7852
|
+
// // }
|
|
7853
|
+
// }
|
|
7854
|
+
// ret.$elm = $elm;
|
|
7855
|
+
// return ret;
|
|
7856
|
+
// };
|
|
7857
|
+
func.UI.utils.get_ui_id_count = function (SESSION_ID, dsSessionP, ui_idP, $container) {
|
|
7858
|
+
return func.UI.utils.get_node_elm(SESSION_ID, dsSessionP, ui_idP, $container, null, null).length;
|
|
7859
|
+
};
|
|
7860
|
+
// func.UI.utils.get_ui_info_tree_scope = function (SESSION_ID, dsP, ui_id, is_app_panel, ui_type, $container, functionP) {
|
|
7861
|
+
// var drill_parent = function () {
|
|
7862
|
+
// if (SESSION_OBJ[SESSION_ID].DS_GLB[dsP].parentDataSourceNo) {
|
|
7863
|
+
// return func.UI.utils.get_ui_info_tree_scope(SESSION_ID, SESSION_OBJ[SESSION_ID].DS_GLB[dsP].parentDataSourceNo, ui_id, is_app_panel, ui_type);
|
|
7864
|
+
// } else if (ui_type === 'xu-app-page') {
|
|
7865
|
+
// if (elm_info.$elm.length) {
|
|
7866
|
+
// return {
|
|
7867
|
+
// ds: dsP,
|
|
7868
|
+
// id: id,
|
|
7869
|
+
// $elm: elm_info.$elm,
|
|
7870
|
+
// };
|
|
7871
|
+
// }
|
|
7872
|
+
// }
|
|
7873
|
+
// };
|
|
7874
|
+
// if (!SESSION_OBJ[SESSION_ID].DS_GLB[dsP]) return;
|
|
7875
|
+
|
|
7876
|
+
// var elm_info = func.UI.utils.get_element_info(SESSION_ID, dsP, ui_id, $container, is_app_panel, ui_type, functionP);
|
|
7877
|
+
// var id = elm_info.nodeId;
|
|
7878
|
+
|
|
7879
|
+
// if (!id) {
|
|
7880
|
+
// return drill_parent();
|
|
7881
|
+
// } else {
|
|
7882
|
+
// if (is_app_panel) {
|
|
7883
|
+
// return {
|
|
7884
|
+
// ds: func.UI.utils.get_node_elm(SESSION_ID, dsP, ui_id, $container, is_app_panel).data().xuData.paramsP.dsSessionP,
|
|
7885
|
+
// id: id,
|
|
7886
|
+
// $elm: elm_info.$elm,
|
|
7887
|
+
// };
|
|
7888
|
+
// } else {
|
|
7889
|
+
// return {
|
|
7890
|
+
// ds: dsP,
|
|
7891
|
+
// id: id,
|
|
7892
|
+
// $elm: elm_info.$elm,
|
|
7893
|
+
// };
|
|
7894
|
+
// }
|
|
7895
|
+
// }
|
|
7896
|
+
// };
|
|
7897
|
+
|
|
7898
|
+
func.UI.utils.clean_node_busy = function (node) {
|
|
7899
|
+
var run_node = function (node) {
|
|
7900
|
+
node.busy = false;
|
|
7901
|
+
$.each(node.children, function (key, val) {
|
|
7902
|
+
run_node(val);
|
|
7903
|
+
});
|
|
7904
|
+
};
|
|
7905
|
+
run_node(node);
|
|
7906
|
+
return node;
|
|
7907
|
+
};
|
|
7908
|
+
|
|
7909
|
+
// func.UI.utils.get_ui_info_tree_scope_sync = function (SESSION_ID, dsP, ui_id, ui_type, callback, $container, functionP) {
|
|
7910
|
+
// var ret;
|
|
7911
|
+
// var is_app_panel = false;
|
|
7912
|
+
// if (ui_type === 'xu-panel') {
|
|
7913
|
+
// is_app_panel = true;
|
|
7914
|
+
// }
|
|
7915
|
+
|
|
7916
|
+
// ret = func.UI.utils.get_ui_info_tree_scope(SESSION_ID, dsP, ui_id, is_app_panel, ui_type, $container, functionP);
|
|
7917
|
+
|
|
7918
|
+
// if (!ret) {
|
|
7919
|
+
// var attempts = 0;
|
|
7920
|
+
// const run = function () {
|
|
7921
|
+
// ret = func.UI.utils.get_ui_info_tree_scope(SESSION_ID, dsP, ui_id, is_app_panel, ui_type, $container, functionP);
|
|
7922
|
+
// if (ret || attempts > 10) {
|
|
7923
|
+
// callback(ret);
|
|
7924
|
+
// } else {
|
|
7925
|
+
// attempts++;
|
|
7926
|
+
// console.log(attempts, dsP, ui_id, is_app_panel);
|
|
7927
|
+
// setTimeout(function () {
|
|
7928
|
+
// run();
|
|
7929
|
+
// }, 100);
|
|
7930
|
+
// }
|
|
7931
|
+
// };
|
|
7932
|
+
// run();
|
|
7933
|
+
// } else {
|
|
7934
|
+
// callback(ret);
|
|
7935
|
+
// }
|
|
7936
|
+
// };
|
|
7937
|
+
|
|
7938
|
+
func.UI.utils.live_preview_element_inspect_on = function (SESSION_ID, service) {
|
|
7939
|
+
$.each($('[xu-ui-id]'), function (key, val) {
|
|
7940
|
+
$(val).on('mouseenter.live_preview_element_inspector', function () {
|
|
7941
|
+
$('body').find('.preview_mark').removeClass('preview_mark').off('click.live_preview_element_inspector');
|
|
7942
|
+
$(this).addClass('preview_mark');
|
|
7943
|
+
$(this).on('click.live_preview_element_inspector', function (e) {
|
|
7944
|
+
const _session = SESSION_OBJ[SESSION_ID];
|
|
7945
|
+
console.log($(this).data());
|
|
7946
|
+
const data = $(this).data();
|
|
7947
|
+
const obj = {
|
|
7948
|
+
service: service + '_result',
|
|
7949
|
+
id: STUDIO_WEBSOCKET_CONNECTION_ID,
|
|
7950
|
+
uid: _session.USR_OBJ._id,
|
|
7951
|
+
source: 'runtime',
|
|
7952
|
+
app_id: _session.app_id,
|
|
7953
|
+
gtp_token: _session.gtp_token,
|
|
7954
|
+
session_id: SESSION_ID,
|
|
7955
|
+
app_token: _session.app_token,
|
|
7956
|
+
};
|
|
7957
|
+
|
|
7958
|
+
switch (service) {
|
|
7959
|
+
case 'live_preview_element_reference':
|
|
7960
|
+
obj.data = { prog_id: data.xuData.prog_id, node: data.xuData.node };
|
|
7961
|
+
break;
|
|
7962
|
+
case 'live_preview_element_info':
|
|
7963
|
+
obj.data = {
|
|
7964
|
+
element_info: data.debug_info,
|
|
7965
|
+
datasource: _session.DS_GLB[data.paramsP.dsSessionP],
|
|
7966
|
+
};
|
|
7967
|
+
break;
|
|
7968
|
+
case 'live_preview_element_dnd':
|
|
7969
|
+
// code block
|
|
7970
|
+
break;
|
|
7971
|
+
default:
|
|
7972
|
+
// code block
|
|
7973
|
+
}
|
|
7974
|
+
|
|
7975
|
+
STUDIO_PEER_CONN_SEND_METHOD(obj);
|
|
7976
|
+
// STUDIO_WEBSOCKET.emit("message", obj);
|
|
7977
|
+
|
|
7978
|
+
func.UI.utils.live_preview_element_inspect_off();
|
|
7979
|
+
|
|
7980
|
+
if (typeof LIVE_PREVIEW_APP_ACTIVE !== 'undefined') {
|
|
7981
|
+
$(`#live_preview_element_reference_btn`).css('color', 'unset');
|
|
7982
|
+
$(`#live_preview_element_info_btn`).css('color', 'unset');
|
|
7983
|
+
}
|
|
7984
|
+
});
|
|
7985
|
+
});
|
|
7986
|
+
|
|
7987
|
+
$(val).on('mouseleave.live_preview_element_inspector', function () {
|
|
7988
|
+
$(this).removeClass('preview_mark');
|
|
7989
|
+
$(this).off('click.live_preview_element_inspector');
|
|
7990
|
+
});
|
|
7991
|
+
});
|
|
7992
|
+
};
|
|
7993
|
+
|
|
7994
|
+
func.UI.utils.live_preview_element_inspect_off = function () {
|
|
7995
|
+
$.each($('[xu-ui-id]'), function (key, val) {
|
|
7996
|
+
$(val).off('mouseenter.live_preview_element_inspector mouseleave.live_preview_element_inspector');
|
|
7997
|
+
});
|
|
7998
|
+
$('body').find('.preview_mark').removeClass('preview_mark').off('click.live_preview_element_inspector');
|
|
7999
|
+
};
|
|
8000
|
+
|
|
8001
|
+
func.UI.utils.live_preview_show_selected_element = function (nodeid) {
|
|
8002
|
+
$('body').find('.preview_mark').removeClass('preview_mark');
|
|
8003
|
+
$(`[nodeid="${nodeid}"]`).addClass('preview_mark');
|
|
8004
|
+
};
|
|
8005
|
+
|
|
8006
|
+
func.UI.utils.get_url_attribute = function (SESSION_ID, key) {
|
|
8007
|
+
var ret = glb.URL_PARAMS.get(key);
|
|
8008
|
+
|
|
8009
|
+
const _session = SESSION_OBJ[SESSION_ID];
|
|
8010
|
+
return glb.URL_PARAMS.get(key) || $(_session.root_element).attr(key) || _session.opt?.params?.[key] || _session.opt[key] || $.cookie(key) || window.localStorage.getItem(key);
|
|
8011
|
+
};
|
|
8012
|
+
|
|
8013
|
+
func.UI.utils.get_root_element_attributes = function (SESSION_ID) {
|
|
8014
|
+
// test2345
|
|
8015
|
+
var ret = {};
|
|
8016
|
+
$(SESSION_OBJ[SESSION_ID].root_element).each(function () {
|
|
8017
|
+
$.each(this.attributes, function () {
|
|
8018
|
+
// this.attributes is not a plain object, but an array
|
|
8019
|
+
// of attribute nodes, which contain both the name and value
|
|
8020
|
+
if (this.specified) {
|
|
8021
|
+
ret[this.name] = this.value;
|
|
8022
|
+
}
|
|
8023
|
+
});
|
|
8024
|
+
});
|
|
8025
|
+
|
|
8026
|
+
return ret;
|
|
8027
|
+
};
|
|
8028
|
+
|
|
8029
|
+
func.UI.utils.prompt_confirm_window = async function (SESSION_ID, messageP, picP, confirmYesFuncP, confirmNoFuncP, confirmCancelFuncP, title, colorP) {
|
|
8030
|
+
if (confirmNoFuncP) {
|
|
8031
|
+
buttons.push({
|
|
8032
|
+
text: 'Disagree',
|
|
8033
|
+
role: 'no',
|
|
8034
|
+
cssClass: 'secondary',
|
|
8035
|
+
handler: () => {
|
|
8036
|
+
confirmNoFuncP();
|
|
8037
|
+
},
|
|
8038
|
+
});
|
|
8039
|
+
}
|
|
8040
|
+
if (confirmYesFuncP) {
|
|
8041
|
+
buttons.push({
|
|
8042
|
+
text: 'Agree',
|
|
8043
|
+
role: 'yes',
|
|
8044
|
+
cssClass: 'secondary',
|
|
8045
|
+
handler: () => {
|
|
8046
|
+
confirmYesFuncP();
|
|
8047
|
+
},
|
|
8048
|
+
});
|
|
8049
|
+
}
|
|
8050
|
+
|
|
8051
|
+
if (confirmCancelFuncP) {
|
|
8052
|
+
buttons.push({
|
|
8053
|
+
text: 'Dismiss',
|
|
8054
|
+
role: 'cancel',
|
|
8055
|
+
cssClass: 'secondary',
|
|
8056
|
+
handler: () => {
|
|
8057
|
+
confirmCancelFuncP();
|
|
8058
|
+
},
|
|
8059
|
+
});
|
|
8060
|
+
}
|
|
8061
|
+
|
|
8062
|
+
UI_FRAMEWORK_PLUGIN.modal(title, messageP, buttons);
|
|
8063
|
+
};
|
|
8064
|
+
|
|
8065
|
+
func.UI.utils.alert = function (msg) {
|
|
8066
|
+
console.error(msg);
|
|
8067
|
+
};
|
|
8068
|
+
|
|
8069
|
+
func.UI.utils.progressScreen = {};
|
|
8070
|
+
func.UI.utils.progressScreen.show = function (SESSION_ID, textP, show_bytesP, error, progress_off, logo_off) {
|
|
8071
|
+
if (glb.IS_WORKER) {
|
|
8072
|
+
return;
|
|
8073
|
+
}
|
|
8074
|
+
const app_obj = APP_OBJ?.[SESSION_OBJ?.[SESSION_ID]?.app_id];
|
|
8075
|
+
|
|
8076
|
+
var background_color = '';
|
|
8077
|
+
var icon = app_obj?._conf?.logo_url || 'https://xuda.io/dist/images/xuda_logo.png';
|
|
8078
|
+
if (app_obj?.app_pic) {
|
|
8079
|
+
icon = app_obj.app_pic;
|
|
8080
|
+
}
|
|
8081
|
+
|
|
8082
|
+
if (app_obj && app_obj.app_icon_prop) {
|
|
8083
|
+
if (app_obj.app_icon_prop.app_icon_background_color) {
|
|
8084
|
+
background_color = app_obj.app_icon_prop.app_icon_background_color;
|
|
8085
|
+
}
|
|
8086
|
+
// if (app_obj.app_type === "master_team" && app_obj.app_pic) {
|
|
8087
|
+
// let app_id = APP_OBJ[SESSION_OBJ[SESSION_ID].app_id];
|
|
8088
|
+
// if (app_obj.app_replicate) {
|
|
8089
|
+
// app_id = app_obj.app_replicate;
|
|
8090
|
+
// }
|
|
8091
|
+
// }
|
|
8092
|
+
}
|
|
8093
|
+
|
|
8094
|
+
IS_PROGRESS_SCREEN_OPEN = true;
|
|
8095
|
+
var $progressScreen = $('#progressScreen2').empty();
|
|
8096
|
+
$('.loader').hide();
|
|
8097
|
+
$progressScreen = $('#progressScreen2').css({});
|
|
8098
|
+
|
|
8099
|
+
if (background_color) {
|
|
8100
|
+
$progressScreen.css({
|
|
8101
|
+
color: func.common.getContrast_color(background_color),
|
|
8102
|
+
'background-color': background_color,
|
|
8103
|
+
});
|
|
8104
|
+
}
|
|
8105
|
+
|
|
8106
|
+
setTimeout(function () {
|
|
8107
|
+
if (IS_PROGRESS_SCREEN_OPEN) {
|
|
8108
|
+
var error_msg = `<h4>${textP}</h4>`;
|
|
8109
|
+
|
|
8110
|
+
// $("#progressScreen2_text").fadeIn(500, function () {
|
|
8111
|
+
// if (!logo_off) {
|
|
8112
|
+
// $(this).prepend(`<img class='progressScreen_logo' src='${icon}'>`);
|
|
8113
|
+
// }
|
|
8114
|
+
// $(this).append(
|
|
8115
|
+
// error
|
|
8116
|
+
// ? error_msg
|
|
8117
|
+
// : typeof textP === "object"
|
|
8118
|
+
// ? textP
|
|
8119
|
+
// : `<p>${textP}</p>`
|
|
8120
|
+
// );
|
|
8121
|
+
// });
|
|
8122
|
+
|
|
8123
|
+
$('#progressScreen2_text').show(500, function () {
|
|
8124
|
+
if (!logo_off) {
|
|
8125
|
+
$(this).prepend(`<img class='progressScreen_logo' src='${icon}'>`);
|
|
8126
|
+
}
|
|
8127
|
+
$(this).append(error ? error_msg : typeof textP === 'object' ? textP : `<p>${textP}</p>`);
|
|
8128
|
+
});
|
|
8129
|
+
}
|
|
8130
|
+
}, 500);
|
|
8131
|
+
|
|
8132
|
+
$('#progressScreen2').show();
|
|
8133
|
+
$('<div>').attr('id', 'progressScreen2_text').hide().appendTo($progressScreen);
|
|
8134
|
+
// .hide()
|
|
8135
|
+
// .fadeIn("slow"); //.append(textP)
|
|
8136
|
+
};
|
|
8137
|
+
func.UI.utils.progressScreen.hide = function () {
|
|
8138
|
+
if (glb.IS_WORKER) {
|
|
8139
|
+
return;
|
|
8140
|
+
}
|
|
8141
|
+
IS_PROGRESS_SCREEN_OPEN = false;
|
|
8142
|
+
// window.clearInterval(PROGRESS_INTERVAL);
|
|
8143
|
+
// setTimeout(function () {
|
|
8144
|
+
$('#progressScreen2').hide(); //fadeOut('fast');
|
|
8145
|
+
$('#progressScreen2_text').empty(); //.fadeOut('fast').empty();
|
|
8146
|
+
// $("#progressScreen2").css({
|
|
8147
|
+
// height: "0px",
|
|
8148
|
+
// top: "-100px",
|
|
8149
|
+
// "background-image": "none"
|
|
8150
|
+
// });
|
|
8151
|
+
};
|
|
8152
|
+
|
|
8153
|
+
func.UI.utils.find_in_element_data = function (folder, $elm, key, val) {
|
|
8154
|
+
return $elm.find('*').filter(function () {
|
|
8155
|
+
if (typeof val === 'undefined') {
|
|
8156
|
+
return $(this).data()?.[folder]?.[key];
|
|
8157
|
+
}
|
|
8158
|
+
|
|
8159
|
+
return $(this).data()?.[folder]?.[key] == val;
|
|
8160
|
+
});
|
|
8161
|
+
};
|
|
8162
|
+
|
|
8163
|
+
func.UI.utils.init_ui_framework = async function (SESSION_ID, prog_id) {
|
|
8164
|
+
if (typeof glb.SLIM_BUNDLE !== 'undefined' || glb.SLIM_BUNDLE) return;
|
|
8165
|
+
|
|
8166
|
+
var _session = SESSION_OBJ[SESSION_ID];
|
|
8167
|
+
var tree_obj = await func.utils.TREE_OBJ.get(SESSION_ID, prog_id);
|
|
8168
|
+
if (_.isEmpty(tree_obj)) {
|
|
8169
|
+
return console.error('Error: prog ' + prog_id + ' not found.');
|
|
8170
|
+
}
|
|
8171
|
+
const report_error = function (descP, warn) {
|
|
8172
|
+
func.utils.debug.log(SESSION_ID, prog_id, {
|
|
8173
|
+
module: 'component',
|
|
8174
|
+
action: 'Init',
|
|
8175
|
+
source: 'install ui framework',
|
|
8176
|
+
prop: descP,
|
|
8177
|
+
details: descP,
|
|
8178
|
+
result: null,
|
|
8179
|
+
error: warn ? false : true,
|
|
8180
|
+
fields: null,
|
|
8181
|
+
type: 'component',
|
|
8182
|
+
prog_id: prog_id,
|
|
8183
|
+
});
|
|
8184
|
+
};
|
|
8185
|
+
const plugin_name = tree_obj.uiFramework;
|
|
8186
|
+
|
|
8187
|
+
if (!plugin_name) {
|
|
8188
|
+
return report_error('no frameworks plugin defined', true);
|
|
8189
|
+
}
|
|
8190
|
+
|
|
8191
|
+
if (plugin_name === UI_FRAMEWORK_INSTALLED) return;
|
|
8192
|
+
|
|
8193
|
+
const _plugin = APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
|
|
8194
|
+
|
|
8195
|
+
if (!_plugin?.installed) {
|
|
8196
|
+
return report_error(`plugin ${plugin_name} not installed`);
|
|
8197
|
+
}
|
|
8198
|
+
|
|
8199
|
+
const get_path = function (plugin_name, resource) {
|
|
8200
|
+
var path = `https://${_session.domain}/plugins/${plugin_name}${resource ? '/' + resource : ''}?app_id=${_session.app_id}`;
|
|
8201
|
+
|
|
8202
|
+
return path;
|
|
8203
|
+
};
|
|
8204
|
+
|
|
8205
|
+
var _ui_framework_index;
|
|
8206
|
+
try {
|
|
8207
|
+
const runtime_mjs = `${_plugin.manifest['runtime.mjs'].dist ? 'dist/' : ''}runtime.mjs`;
|
|
8208
|
+
|
|
8209
|
+
_ui_framework_index = await import(get_path(plugin_name, runtime_mjs));
|
|
8210
|
+
} catch (error) {
|
|
8211
|
+
return report_error(`plugin ${plugin_name} not found`);
|
|
8212
|
+
}
|
|
8213
|
+
|
|
8214
|
+
if (!_ui_framework_index) {
|
|
8215
|
+
return report_error(`plugin ${plugin_name} is empty`);
|
|
8216
|
+
}
|
|
8217
|
+
|
|
8218
|
+
if (!_ui_framework_index.core) {
|
|
8219
|
+
return report_error(`plugin core not found in ${plugin_name} `);
|
|
8220
|
+
}
|
|
8221
|
+
|
|
8222
|
+
// if (!_ui_framework_index.resources) {
|
|
8223
|
+
// return report_error(`plugin resources not found in ${plugin_name} `);
|
|
8224
|
+
// }
|
|
8225
|
+
var _ui_framework_dashboard_setup;
|
|
8226
|
+
var _ui_framework_dashboard_setup_data_ret;
|
|
8227
|
+
const ui_framework_core = new _ui_framework_index.core();
|
|
8228
|
+
if (ui_framework_core.init) {
|
|
8229
|
+
try {
|
|
8230
|
+
const setup_mjs = `${_plugin.manifest['index.mjs'].dist ? 'dist/' : ''}index.mjs`;
|
|
8231
|
+
_ui_framework_dashboard_setup = await import(get_path(plugin_name, setup_mjs));
|
|
8232
|
+
if (_ui_framework_dashboard_setup) {
|
|
8233
|
+
_ui_framework_dashboard_setup_data_ret = await func.utils.get_plugin_setup(SESSION_ID, plugin_name);
|
|
8234
|
+
}
|
|
8235
|
+
} catch (error) {}
|
|
8236
|
+
}
|
|
8237
|
+
|
|
8238
|
+
if (plugin_name !== UI_FRAMEWORK_INSTALLED) {
|
|
8239
|
+
UI_FRAMEWORK_INSTALLED = plugin_name;
|
|
8240
|
+
const _plugin_INSTALLED = APP_OBJ[_session.app_id]?.app_plugins_purchased?.[UI_FRAMEWORK_INSTALLED];
|
|
8241
|
+
UI_FRAMEWORK_PLUGIN = _ui_framework_index;
|
|
8242
|
+
if (UI_FRAMEWORK_INSTALLED) {
|
|
8243
|
+
var _current_ui_framework_runtime;
|
|
8244
|
+
try {
|
|
8245
|
+
const _runtime_mjs = `${_plugin_INSTALLED.manifest['runtime.mjs'].dist ? 'dist/' : ''}runtime.mjs`;
|
|
8246
|
+
_current_ui_framework_runtime = await import(get_path(UI_FRAMEWORK_INSTALLED, _runtime_mjs));
|
|
8247
|
+
} catch (error) {
|
|
8248
|
+
return report_error(`plugin ${UI_FRAMEWORK_INSTALLED} not found`);
|
|
8249
|
+
}
|
|
8250
|
+
|
|
8251
|
+
// remove
|
|
8252
|
+
if (UI_FRAMEWORK_PLUGIN.core.discard && UI_FRAMEWORK_PLUGIN.init_id) {
|
|
8253
|
+
UI_FRAMEWORK_PLUGIN.core.discard(UI_FRAMEWORK_PLUGIN.init_id);
|
|
8254
|
+
}
|
|
8255
|
+
if (_ui_framework_index.resources) {
|
|
8256
|
+
$.each(_current_ui_framework_runtime.resources, function (key, val) {
|
|
8257
|
+
func.utils.remove_js_css_file(val.url, val.type);
|
|
8258
|
+
});
|
|
8259
|
+
}
|
|
8260
|
+
}
|
|
8261
|
+
|
|
8262
|
+
// install
|
|
8263
|
+
var init_id;
|
|
8264
|
+
if (_ui_framework_index.resources) {
|
|
8265
|
+
for await (var val of _ui_framework_index.resources) {
|
|
8266
|
+
var ret = undefined;
|
|
8267
|
+
|
|
8268
|
+
var url = val.url;
|
|
8269
|
+
switch (val.type) {
|
|
8270
|
+
case 'module':
|
|
8271
|
+
try {
|
|
8272
|
+
// ret = await load_module(url);
|
|
8273
|
+
ret = await func.utils.load_js_on_demand(url, 'module');
|
|
8274
|
+
} catch (error) {
|
|
8275
|
+
debugger;
|
|
8276
|
+
}
|
|
8277
|
+
|
|
8278
|
+
break;
|
|
8279
|
+
case 'css':
|
|
8280
|
+
ret = func.utils.load_css_on_demand(url);
|
|
8281
|
+
break;
|
|
8282
|
+
case 'js':
|
|
8283
|
+
ret = await func.utils.load_js_on_demand(url);
|
|
8284
|
+
break;
|
|
8285
|
+
|
|
8286
|
+
default:
|
|
8287
|
+
break;
|
|
8288
|
+
}
|
|
8289
|
+
if (val.callback) {
|
|
8290
|
+
val.callback(ret);
|
|
8291
|
+
}
|
|
8292
|
+
}
|
|
8293
|
+
}
|
|
8294
|
+
if (ui_framework_core.init) {
|
|
8295
|
+
init_id = await ui_framework_core.init(_ui_framework_dashboard_setup_data_ret?.code > -1 && _ui_framework_dashboard_setup_data_ret.data);
|
|
8296
|
+
UI_FRAMEWORK_PLUGIN.init_id = init_id;
|
|
8297
|
+
}
|
|
8298
|
+
}
|
|
8299
|
+
};
|
|
8300
|
+
// old
|
|
8301
|
+
// func.UI.utils.get_panels_from_dom = function (SESSION_ID, ignore_disableAutoRefresh) {
|
|
8302
|
+
// const $elm = func.UI.utils.find_in_element_data('xuPanelData', $(SESSION_OBJ[SESSION_ID].root_element), 'parent_element_ui_id');
|
|
8303
|
+
// var panels_obj = {};
|
|
8304
|
+
|
|
8305
|
+
// // set panels_obj
|
|
8306
|
+
// for (const [elem_key, elem_val] of Object.entries($elm)) {
|
|
8307
|
+
// if (elem_key === 'length') break;
|
|
8308
|
+
// var $div = $(elem_val);
|
|
8309
|
+
// let xuData = $div.data().xuData;
|
|
8310
|
+
|
|
8311
|
+
// if (!$div.data().xuPanelData) continue;
|
|
8312
|
+
|
|
8313
|
+
// let dsSession = xuData.paramsP.dsSessionP;
|
|
8314
|
+
// var _session = SESSION_OBJ[SESSION_ID];
|
|
8315
|
+
// let _ds = _session?.DS_GLB[dsSession];
|
|
8316
|
+
// if (!_ds) continue;
|
|
8317
|
+
|
|
8318
|
+
// if (!ignore_disableAutoRefresh && _ds.tree_obj.disableAutoRefresh) {
|
|
8319
|
+
// continue;
|
|
8320
|
+
// }
|
|
8321
|
+
|
|
8322
|
+
// const parent_element_ui_id = $div.data().xuPanelData.parent_element_ui_id;
|
|
8323
|
+
// if (!panels_obj[parent_element_ui_id]) {
|
|
8324
|
+
// panels_obj[parent_element_ui_id] = {
|
|
8325
|
+
// _ds,
|
|
8326
|
+
// $div,
|
|
8327
|
+
// ids: [],
|
|
8328
|
+
// };
|
|
8329
|
+
// }
|
|
8330
|
+
// panels_obj[parent_element_ui_id].ids.push($div.attr('xu-ui-id'));
|
|
8331
|
+
// }
|
|
8332
|
+
|
|
8333
|
+
// return panels_obj;
|
|
8334
|
+
// };
|
|
8335
|
+
|
|
8336
|
+
func.UI.utils.get_panels_wrapper_from_dom = async function (SESSION_ID, $xu_embed_container, ignore_disableAutoRefresh) {
|
|
8337
|
+
const $elm = func.UI.utils.find_in_element_data('xuPanelWrapper', $(SESSION_OBJ[SESSION_ID].root_element), 'isWrapper');
|
|
8338
|
+
var panels_obj = {};
|
|
8339
|
+
|
|
8340
|
+
// set panels_obj
|
|
8341
|
+
for (const [elem_key, elem_val] of Object.entries($elm)) {
|
|
8342
|
+
if (elem_key === 'length') break;
|
|
8343
|
+
var $panel_div = $(elem_val);
|
|
8344
|
+
|
|
8345
|
+
const panelXuAttributes = $panel_div?.data().xuPanelWrapper?.panelXuAttributes;
|
|
8346
|
+
const panelDivData = $panel_div?.data().xuPanelWrapper?.panelDivData;
|
|
8347
|
+
|
|
8348
|
+
if (!panelXuAttributes) continue; // skip if no longer in dom
|
|
8349
|
+
|
|
8350
|
+
const xu_ui_id = $panel_div.attr('xu-ui-id');
|
|
8351
|
+
|
|
8352
|
+
if (!panels_obj[xu_ui_id]) {
|
|
8353
|
+
var _session = SESSION_OBJ[SESSION_ID];
|
|
8354
|
+
let _ds = _session?.DS_GLB[panelDivData.xuData.paramsP.dsSessionP];
|
|
8355
|
+
|
|
8356
|
+
if (!_ds) continue;
|
|
8357
|
+
|
|
8358
|
+
let prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
8359
|
+
if (!ignore_disableAutoRefresh && prog_doc.properties.disableAutoRefresh) {
|
|
8360
|
+
continue;
|
|
8361
|
+
}
|
|
8362
|
+
|
|
8363
|
+
let ids = [];
|
|
8364
|
+
|
|
8365
|
+
$.each($panel_div.children(), function (key, val) {
|
|
8366
|
+
if ($(val).data().xuPanelData) {
|
|
8367
|
+
ids.push($(val).attr('xu-ui-id'));
|
|
8368
|
+
}
|
|
8369
|
+
});
|
|
8370
|
+
|
|
8371
|
+
panels_obj[xu_ui_id] = {
|
|
8372
|
+
// prog_id,
|
|
8373
|
+
panelXuAttributes,
|
|
8374
|
+
progUi: prog_doc.progUi,
|
|
8375
|
+
prog_doc,
|
|
8376
|
+
$panel_div,
|
|
8377
|
+
_ds,
|
|
8378
|
+
ids,
|
|
8379
|
+
};
|
|
8380
|
+
}
|
|
8381
|
+
}
|
|
8382
|
+
|
|
8383
|
+
return panels_obj;
|
|
8384
|
+
};
|
|
8385
|
+
|
|
8386
|
+
func.UI.worker = {};
|
|
8387
|
+
func.UI.worker.ID = null;
|
|
8388
|
+
func.UI.worker.init = async function (SESSION_ID) {
|
|
8389
|
+
$.fn.isInViewport = function () {
|
|
8390
|
+
var elementTop = $(this).offset().top;
|
|
8391
|
+
var elementBottom = elementTop + $(this).outerHeight();
|
|
8392
|
+
|
|
8393
|
+
var viewportTop = $(window).scrollTop();
|
|
8394
|
+
var viewportBottom = viewportTop + $(window).height();
|
|
8395
|
+
|
|
8396
|
+
return elementBottom > viewportTop && elementTop < viewportBottom;
|
|
8397
|
+
};
|
|
8398
|
+
|
|
8399
|
+
let last_job_in_queue = 0;
|
|
8400
|
+
// let run_stat;
|
|
8401
|
+
const job_iterator2 = async function () {
|
|
8402
|
+
let from_job_num_to_run = last_job_in_queue;
|
|
8403
|
+
last_job_in_queue = UI_WORKER_OBJ.num - from_job_num_to_run;
|
|
8404
|
+
|
|
8405
|
+
if (typeof UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === null) {
|
|
8406
|
+
// idle
|
|
8407
|
+
this.attempt = 0;
|
|
8408
|
+
if (UI_WORKER_OBJ.jobs.length) {
|
|
8409
|
+
// clearInterval(this._interval);
|
|
8410
|
+
for await (const [key, val] of Object.entries(UI_WORKER_OBJ.jobs)) {
|
|
8411
|
+
// if (val.job_num < from_job_num_to_run) continue;
|
|
8412
|
+
try {
|
|
8413
|
+
if (val.stat) {
|
|
8414
|
+
break;
|
|
8415
|
+
}
|
|
8416
|
+
|
|
8417
|
+
await func.UI.worker.execute(val.SESSION_ID, val);
|
|
8418
|
+
// break;
|
|
8419
|
+
} catch (err) {
|
|
8420
|
+
console.error(err);
|
|
8421
|
+
}
|
|
8422
|
+
}
|
|
8423
|
+
}
|
|
8424
|
+
} else {
|
|
8425
|
+
//busy
|
|
8426
|
+
|
|
8427
|
+
this.attempt++;
|
|
8428
|
+
}
|
|
8429
|
+
};
|
|
8430
|
+
|
|
8431
|
+
const job_iterator = async function () {
|
|
8432
|
+
let from_job_num_to_run = last_job_in_queue;
|
|
8433
|
+
last_job_in_queue = UI_WORKER_OBJ.num - from_job_num_to_run;
|
|
8434
|
+
|
|
8435
|
+
// if (typeof UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === null) {
|
|
8436
|
+
// idle
|
|
8437
|
+
this.attempt = 0;
|
|
8438
|
+
if (UI_WORKER_OBJ.jobs.length) {
|
|
8439
|
+
let running_job_children_elements = [];
|
|
8440
|
+
let active_job_children_elements = [];
|
|
8441
|
+
for await (const [key, val] of Object.entries(UI_WORKER_OBJ.jobs)) {
|
|
8442
|
+
try {
|
|
8443
|
+
if (val.stat === 'busy') continue;
|
|
8444
|
+
|
|
8445
|
+
if (!val.elementP) {
|
|
8446
|
+
await func.UI.worker.execute(val.SESSION_ID, val);
|
|
8447
|
+
continue;
|
|
8448
|
+
}
|
|
8449
|
+
|
|
8450
|
+
const active_xu_ui_id = val.elementP.attr('xu-ui-id');
|
|
8451
|
+
if (!active_xu_ui_id) continue;
|
|
8452
|
+
|
|
8453
|
+
const running_job_obj = UI_WORKER_OBJ.jobs[0];
|
|
8454
|
+
if (running_job_obj.job_num !== val.job_num) {
|
|
8455
|
+
const running_xu_ui_id = running_job_obj?.elementP?.attr('xu-ui-id');
|
|
8456
|
+
if (!running_xu_ui_id) continue;
|
|
8457
|
+
|
|
8458
|
+
$.each(running_job_obj.elementP.find('*'), function (key, val) {
|
|
8459
|
+
const xu_ui_id = $(val).attr('xu-ui-id');
|
|
8460
|
+
if (!xu_ui_id) return true;
|
|
8461
|
+
running_job_children_elements.push(xu_ui_id);
|
|
8462
|
+
});
|
|
8463
|
+
|
|
8464
|
+
$.each(val.elementP.find('*'), function (key, val) {
|
|
8465
|
+
const xu_ui_id = $(val).attr('xu-ui-id');
|
|
8466
|
+
if (!xu_ui_id) return true;
|
|
8467
|
+
active_job_children_elements.push(xu_ui_id);
|
|
8468
|
+
});
|
|
8469
|
+
|
|
8470
|
+
// skip - if job element exist in the active job ui as child element
|
|
8471
|
+
if (running_job_children_elements.includes(active_xu_ui_id)) {
|
|
8472
|
+
continue;
|
|
8473
|
+
}
|
|
8474
|
+
|
|
8475
|
+
// abort - if active job element exist in the current job ui (parent element changed)
|
|
8476
|
+
if (active_job_children_elements.includes(running_xu_ui_id)) {
|
|
8477
|
+
if (val.functionP === 'execute_xu_render_attributes') {
|
|
8478
|
+
$.each(active_job_children_elements, function (key, val) {
|
|
8479
|
+
const $elm = $(`[xu-ui-id=${val}]`);
|
|
8480
|
+
if (!$elm.length) return true;
|
|
8481
|
+
if (!$elm.data().xuData) return true;
|
|
8482
|
+
$elm.data().xuData.pending_to_delete = true;
|
|
8483
|
+
});
|
|
8484
|
+
await func.UI.worker.delete_job(SESSION_ID, running_job_obj.job_num);
|
|
8485
|
+
break;
|
|
8486
|
+
}
|
|
8487
|
+
}
|
|
8488
|
+
}
|
|
8489
|
+
|
|
8490
|
+
// execute - if active job element not exist the current job ui and not detected as parent element
|
|
8491
|
+
await func.UI.worker.execute(val.SESSION_ID, val);
|
|
8492
|
+
continue;
|
|
8493
|
+
|
|
8494
|
+
// active_job_children_elements = [];
|
|
8495
|
+
// if (val.elementP) {
|
|
8496
|
+
// // get active_job children elements only if job handle ui job (not update)
|
|
8497
|
+
// $.each(val.elementP.find('*'), function (key, val) {
|
|
8498
|
+
// const xu_ui_id = val.elementP.attr('xu-ui-id');
|
|
8499
|
+
// if (!xu_ui_id) return true;
|
|
8500
|
+
// active_job_children_elements.push(xu_ui_id);
|
|
8501
|
+
// });
|
|
8502
|
+
// func.UI.worker.execute(val.SESSION_ID, val);
|
|
8503
|
+
// continue;
|
|
8504
|
+
// } else {
|
|
8505
|
+
// // non ui job
|
|
8506
|
+
// await func.UI.worker.execute(val.SESSION_ID, val);
|
|
8507
|
+
// break;
|
|
8508
|
+
// }
|
|
8509
|
+
|
|
8510
|
+
// if (UI_WORKER_OBJ.jobs.length > 1 && val.elementP) {
|
|
8511
|
+
// const xu_ui_id = val.elementP.attr('xu-ui-id');
|
|
8512
|
+
// if (!xu_ui_id) continue;
|
|
8513
|
+
// // skip - if job element exist in the active job ui as child element
|
|
8514
|
+
// if (active_job_children_elements.includes(xu_ui_id)) {
|
|
8515
|
+
// continue;
|
|
8516
|
+
// }
|
|
8517
|
+
// // abort - if active job element exist in the current job ui (parent element changed)
|
|
8518
|
+
// $.each(val.elementP.find('*'), function (key, val) {
|
|
8519
|
+
// const xu_ui_id = val.elementP.attr('xu-ui-id');
|
|
8520
|
+
// if (!xu_ui_id) return true;
|
|
8521
|
+
// active_job_children_elements.push(xu_ui_id);
|
|
8522
|
+
// });
|
|
8523
|
+
// // execute - if active job element not exist the current job ui and not detected as parent element
|
|
8524
|
+
// const active_job = UI_WORKER_OBJ.jobs[0];
|
|
8525
|
+
// }
|
|
8526
|
+
|
|
8527
|
+
// break;
|
|
8528
|
+
} catch (err) {
|
|
8529
|
+
console.error(err);
|
|
8530
|
+
}
|
|
8531
|
+
}
|
|
8532
|
+
}
|
|
8533
|
+
// } else {
|
|
8534
|
+
// //busy
|
|
8535
|
+
|
|
8536
|
+
// this.attempt++;
|
|
8537
|
+
// }
|
|
8538
|
+
};
|
|
8539
|
+
|
|
8540
|
+
this._interval = setInterval(job_iterator, 1);
|
|
8541
|
+
|
|
8542
|
+
setInterval(async function () {
|
|
8543
|
+
func.UI.ds_garbage_collector();
|
|
8544
|
+
}, 10000);
|
|
8545
|
+
|
|
8546
|
+
setInterval(async function () {
|
|
8547
|
+
func.UI.refs_garbage_collector();
|
|
8548
|
+
func.UI.teleport_garbage_collector();
|
|
8549
|
+
}, 1000);
|
|
8550
|
+
};
|
|
8551
|
+
func.UI.worker.add_to_queue = async function (SESSION_ID, source, functionP, paramsP, calling_job, elementP, dsSession, calling_trigger_prop) {
|
|
8552
|
+
var obj = {
|
|
8553
|
+
SESSION_ID,
|
|
8554
|
+
source,
|
|
8555
|
+
functionP,
|
|
8556
|
+
paramsP,
|
|
8557
|
+
calling_job,
|
|
8558
|
+
elementP,
|
|
8559
|
+
dsSession,
|
|
8560
|
+
calling_trigger_prop,
|
|
8561
|
+
job_num: UI_WORKER_OBJ.num,
|
|
8562
|
+
};
|
|
8563
|
+
|
|
8564
|
+
if (functionP === 'execute_xu_all_attributes') {
|
|
8565
|
+
const queue_key = source + '_' + functionP + '_' + (elementP?.attr('xu-ui-id') || '') + '_' + (paramsP?.fields_arr?.toString() || '');
|
|
8566
|
+
|
|
8567
|
+
obj.queue_key = queue_key;
|
|
8568
|
+
|
|
8569
|
+
let exist_job = UI_WORKER_OBJ.jobs.find((e) => {
|
|
8570
|
+
if (e.queue_key === queue_key) {
|
|
8571
|
+
return e;
|
|
8572
|
+
}
|
|
8573
|
+
});
|
|
8574
|
+
|
|
8575
|
+
if (exist_job) {
|
|
8576
|
+
// func.UI.worker.delete_job(SESSION_ID, exist_job.job_num);
|
|
8577
|
+
// exist_job = obj;
|
|
8578
|
+
exist_job.paramsP = paramsP;
|
|
8579
|
+
exist_job.calling_trigger_prop = calling_trigger_prop;
|
|
8580
|
+
|
|
8581
|
+
return;
|
|
8582
|
+
}
|
|
8583
|
+
}
|
|
8584
|
+
|
|
8585
|
+
// if (calling_job) {
|
|
8586
|
+
// var job_index = func.UI.worker.find_job_index(SESSION_ID, calling_job);
|
|
8587
|
+
|
|
8588
|
+
// if (job_index === null || typeof job_index === 'undefined') return;
|
|
8589
|
+
|
|
8590
|
+
// try {
|
|
8591
|
+
// if (!UI_WORKER_OBJ.jobs[job_index].splice_count) {
|
|
8592
|
+
// UI_WORKER_OBJ.jobs[job_index].splice_count = 0;
|
|
8593
|
+
// }
|
|
8594
|
+
// UI_WORKER_OBJ.jobs[job_index].splice_count++;
|
|
8595
|
+
// UI_WORKER_OBJ.jobs.splice(job_index + UI_WORKER_OBJ.jobs[job_index].splice_count, 0, obj);
|
|
8596
|
+
// // }
|
|
8597
|
+
// } catch (e) {
|
|
8598
|
+
// console.error('bug');
|
|
8599
|
+
// // UI_WORKER_OBJ.jobs.splice(0, 0, obj);
|
|
8600
|
+
// }
|
|
8601
|
+
// } else {
|
|
8602
|
+
// // check case of xu-render if queue has child node of the element then delete job
|
|
8603
|
+
// // check case of execute attributes that queue not contain the element then add to parallel queue
|
|
8604
|
+
|
|
8605
|
+
// UI_WORKER_OBJ.jobs.push(obj);
|
|
8606
|
+
// }
|
|
8607
|
+
|
|
8608
|
+
UI_WORKER_OBJ.jobs.push(obj);
|
|
8609
|
+
|
|
8610
|
+
UI_WORKER_OBJ.num++;
|
|
8611
|
+
return UI_WORKER_OBJ.num - 1;
|
|
8612
|
+
};
|
|
8613
|
+
func.UI.worker.delete_job = async function (SESSION_ID, jobNoP) {
|
|
8614
|
+
// func.UI.worker.ID.postMessage({
|
|
8615
|
+
// method: "delete_job",
|
|
8616
|
+
// params: {
|
|
8617
|
+
// job_num: jobNoP,
|
|
8618
|
+
// },
|
|
8619
|
+
// });
|
|
8620
|
+
|
|
8621
|
+
// return;
|
|
8622
|
+
|
|
8623
|
+
var _session = SESSION_OBJ[SESSION_ID];
|
|
8624
|
+
var job_index = func.UI.worker.find_job_index(SESSION_ID, jobNoP);
|
|
8625
|
+
|
|
8626
|
+
if (!UI_WORKER_OBJ.jobs[job_index]) {
|
|
8627
|
+
// UI_WORKER_OBJ.stat = null;
|
|
8628
|
+
return;
|
|
8629
|
+
}
|
|
8630
|
+
|
|
8631
|
+
var dsSession = UI_WORKER_OBJ.jobs[job_index].dsSession;
|
|
8632
|
+
let ds_obj = _session?.DS_GLB[dsSession];
|
|
8633
|
+
if (ds_obj) {
|
|
8634
|
+
delete SCREEN_BLOCKER_OBJ[ds_obj.screenId + (ds_obj.callingScreenId ? '_' + ds_obj.callingScreenId : '')];
|
|
8635
|
+
}
|
|
8636
|
+
if (dsSession && ds_obj?.loops_limit && ds_obj?.loops_count < ds_obj?.loops_limit - 1) {
|
|
8637
|
+
return;
|
|
8638
|
+
}
|
|
8639
|
+
// UI_WORKER_OBJ.stat = null;
|
|
8640
|
+
|
|
8641
|
+
UI_WORKER_OBJ.jobs.splice(job_index, 1);
|
|
8642
|
+
};
|
|
8643
|
+
func.UI.worker.execute = async function (SESSION_ID, queue_obj) {
|
|
8644
|
+
var job_index = func.UI.worker.find_job_index(SESSION_ID, queue_obj.job_num);
|
|
8645
|
+
// if (UI_WORKER_OBJ.jobs?.[job_index]?.stat === 'busy') {
|
|
8646
|
+
// if (queue_obj.jobNoP) UI_WORKER_OBJ.stat = job_index;
|
|
8647
|
+
// return;
|
|
8648
|
+
// }
|
|
8649
|
+
// if (queue_obj.jobNoP && !UI_WORKER_OBJ.jobs[job_index]) {
|
|
8650
|
+
// UI_WORKER_OBJ.stat = null;
|
|
8651
|
+
// return;
|
|
8652
|
+
// }
|
|
8653
|
+
|
|
8654
|
+
if (queue_obj.jobNoP) UI_WORKER_OBJ.stat = job_index;
|
|
8655
|
+
if (UI_WORKER_OBJ.jobs[job_index]) {
|
|
8656
|
+
UI_WORKER_OBJ.jobs[job_index].stat = 'busy';
|
|
8657
|
+
}
|
|
8658
|
+
|
|
8659
|
+
const fx = {
|
|
8660
|
+
update_datasource: async function () {
|
|
8661
|
+
if (queue_obj?.paramsP) {
|
|
8662
|
+
var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[queue_obj.dsSession];
|
|
8663
|
+
_ds.currentRecordId = queue_obj.paramsP.currentRecordId;
|
|
8664
|
+
|
|
8665
|
+
var datasource_changes = {
|
|
8666
|
+
[_ds.dsSession]: { [_ds.currentRecordId]: 'set' },
|
|
8667
|
+
};
|
|
8668
|
+
await func.datasource.update(SESSION_ID, datasource_changes);
|
|
8669
|
+
|
|
8670
|
+
if (queue_obj.paramsP.field_id) {
|
|
8671
|
+
datasource_changes = {
|
|
8672
|
+
[_ds.dsSession]: {
|
|
8673
|
+
[_ds.currentRecordId]: {
|
|
8674
|
+
[queue_obj.paramsP.field_id]: queue_obj.paramsP.field_value,
|
|
8675
|
+
},
|
|
8676
|
+
},
|
|
8677
|
+
};
|
|
8678
|
+
await func.datasource.update(SESSION_ID, datasource_changes);
|
|
8679
|
+
}
|
|
8680
|
+
}
|
|
8681
|
+
return func.UI.worker.delete_job(SESSION_ID, queue_obj.job_num);
|
|
8682
|
+
},
|
|
8683
|
+
execute_xu_render_attributes: async function () {
|
|
8684
|
+
const _data = queue_obj.paramsP.elem_val.$elm.data();
|
|
8685
|
+
if (_data?.xuData?.paramsP) {
|
|
8686
|
+
await func.UI.screen.execute_xu_functions(
|
|
8687
|
+
SESSION_ID,
|
|
8688
|
+
null,
|
|
8689
|
+
_data.xuData.$root_container,
|
|
8690
|
+
_data.xuData.node,
|
|
8691
|
+
$(`[xu-ui-id="${_data.xuData.parent_element_ui_id}"`),
|
|
8692
|
+
_data.xuData.paramsP,
|
|
8693
|
+
{},
|
|
8694
|
+
queue_obj.jobNoP,
|
|
8695
|
+
_data.xuData.key,
|
|
8696
|
+
_data.xuData.parent_node,
|
|
8697
|
+
'xu-render',
|
|
8698
|
+
queue_obj.paramsP.elem_val.$elm,
|
|
8699
|
+
{
|
|
8700
|
+
key: 'xu-render',
|
|
8701
|
+
value: queue_obj.paramsP.attr_value, //? "Y" : "N",
|
|
8702
|
+
fields_arr: queue_obj.paramsP.fields_arr,
|
|
8703
|
+
jobNoP: queue_obj.jobNoP,
|
|
8704
|
+
},
|
|
8705
|
+
);
|
|
8706
|
+
}
|
|
8707
|
+
|
|
8708
|
+
return func.UI.worker.delete_job(SESSION_ID, queue_obj.job_num);
|
|
8709
|
+
},
|
|
8710
|
+
execute_xu_all_attributes: async function () {
|
|
8711
|
+
const done = function () {
|
|
8712
|
+
return func.UI.worker.delete_job(SESSION_ID, queue_obj.job_num);
|
|
8713
|
+
};
|
|
8714
|
+
|
|
8715
|
+
// var $elm = func.UI.utils.find_in_element_data('xuData', $(SESSION_OBJ[SESSION_ID].root_element), 'xu_id', queue_obj.paramsP.elem_key);
|
|
8716
|
+
var $elm = $(`[xu-ui-id="${queue_obj.paramsP.elem_key}"]`);
|
|
8717
|
+
|
|
8718
|
+
// if (glb.new_xu_render) {
|
|
8719
|
+
// $elm = $(`[xu-ui-id="${queue_obj.paramsP.elem_key}"]`);
|
|
8720
|
+
// }
|
|
8721
|
+
|
|
8722
|
+
if (!$elm.length) {
|
|
8723
|
+
return done();
|
|
8724
|
+
}
|
|
8725
|
+
for await (const [key, attr] of Object.entries(queue_obj.paramsP.elem_val.attributes)) {
|
|
8726
|
+
if (attr === 'xu-exp:xu-render' || attr === 'xu-exp:xu-for' || attr === 'xu-for' || attr === 'xu-exp:xu-bind') {
|
|
8727
|
+
// if (attr === 'xu-exp:xu-for' || attr === 'xu-for' || attr === 'xu-exp:xu-bind') {
|
|
8728
|
+
continue;
|
|
8729
|
+
}
|
|
8730
|
+
|
|
8731
|
+
var res = {
|
|
8732
|
+
result: queue_obj.paramsP.elem_val.$elm.data().xuAttributes[attr],
|
|
8733
|
+
};
|
|
8734
|
+
if (attr !== 'xu-class' && attr !== 'xu-ui-plugin') {
|
|
8735
|
+
res = await func.expression.get(
|
|
8736
|
+
queue_obj.paramsP.SESSION_ID,
|
|
8737
|
+
queue_obj.paramsP.elem_val.$elm.data().xuAttributes[attr],
|
|
8738
|
+
queue_obj.paramsP.elem_val.$elm.data().xuData.paramsP.dsSessionP,
|
|
8739
|
+
'UI Property EXP',
|
|
8740
|
+
queue_obj.paramsP.elem_val.$elm.data().xuData.recordid,
|
|
8741
|
+
null,
|
|
8742
|
+
null,
|
|
8743
|
+
null,
|
|
8744
|
+
null,
|
|
8745
|
+
null,
|
|
8746
|
+
queue_obj.paramsP.elem_val.$elm.data().xuData.iterate_info,
|
|
8747
|
+
);
|
|
8748
|
+
// console.log(res);
|
|
8749
|
+
}
|
|
8750
|
+
|
|
8751
|
+
const attr_new = attr.split('xu-exp:')[1];
|
|
8752
|
+
// REGULAR ATTRIBUTE
|
|
8753
|
+
if (attr_new && attr_new.substr(0, 2) !== 'xu' && queue_obj.paramsP.ui_type !== 'xu-widget') {
|
|
8754
|
+
queue_obj.paramsP.elem_val.$elm.attr(attr_new !== 'viewBox' ? attr_new.toLowerCase() : attr_new, res.result);
|
|
8755
|
+
} else {
|
|
8756
|
+
try {
|
|
8757
|
+
// XU ATTRIBUTE
|
|
8758
|
+
let _data = queue_obj.paramsP.elem_val.$elm.data();
|
|
8759
|
+
if (!_data || _.isEmpty(_data)) {
|
|
8760
|
+
continue;
|
|
8761
|
+
}
|
|
8762
|
+
await func.UI.screen.execute_xu_functions(SESSION_ID, null, _data.xuData.$root_container, _data.xuData.node, _data.xuData.$container, _data.xuData.paramsP, {}, queue_obj.jobNoP, null, null, attr_new || attr, queue_obj.paramsP.elem_val.$elm, {
|
|
8763
|
+
key: attr_new || attr,
|
|
8764
|
+
value: res.result,
|
|
8765
|
+
});
|
|
8766
|
+
} catch (error) {
|
|
8767
|
+
debugger;
|
|
8768
|
+
}
|
|
8769
|
+
}
|
|
8770
|
+
}
|
|
8771
|
+
|
|
8772
|
+
return done();
|
|
8773
|
+
},
|
|
8774
|
+
execute_xu_for: async function () {
|
|
8775
|
+
try {
|
|
8776
|
+
var $elm = queue_obj?.paramsP?.elem_val?.$elm; // $(SESSION_OBJ[SESSION_ID].root_element).find(`[xu-ui-id=${queue_obj.paramsP.elem_key}]`)
|
|
8777
|
+
|
|
8778
|
+
if (!$elm?.length) {
|
|
8779
|
+
return func.UI.worker.delete_job(SESSION_ID, queue_obj.job_num);
|
|
8780
|
+
}
|
|
8781
|
+
|
|
8782
|
+
// $elm.empty();
|
|
8783
|
+
|
|
8784
|
+
$.each($elm.children(), (key, val) => {
|
|
8785
|
+
if (!$(val)?.data()?.xuData) return true;
|
|
8786
|
+
|
|
8787
|
+
if ($(val).data().xuData.nodeid === queue_obj?.paramsP?.xu_for_item_id) {
|
|
8788
|
+
$(val).remove();
|
|
8789
|
+
}
|
|
8790
|
+
});
|
|
8791
|
+
|
|
8792
|
+
let _data = queue_obj.paramsP.elem_val.$elm.data();
|
|
8793
|
+
const node_to_render = _data.xuData.node_org.children?.find((e) => e.id === queue_obj?.paramsP?.xu_for_item_id);
|
|
8794
|
+
await func.UI.screen.render_ui_tree(queue_obj.paramsP.SESSION_ID, queue_obj.paramsP.elem_val.$elm, node_to_render, null, _data.xuData.paramsP, queue_obj.jobNoP, null, _data.xuData.key, null, _data.xuData.parent_node, null, _data.xuData.$root_container);
|
|
8795
|
+
} catch (error) {}
|
|
8796
|
+
return func.UI.worker.delete_job(SESSION_ID, queue_obj.job_num);
|
|
8797
|
+
},
|
|
8798
|
+
render_viewport: async function () {
|
|
8799
|
+
const { nodeP, $div, parent_infoP, $root_container, jobNoP, is_skeleton, paramsP, $container } = queue_obj?.paramsP || {};
|
|
8800
|
+
if (nodeP?.children?.length && !$div.children().length) {
|
|
8801
|
+
$div.removeClass('skeleton');
|
|
8802
|
+
for await (const [key, val] of Object.entries(nodeP.children)) {
|
|
8803
|
+
const ret = await func.UI.screen.render_ui_tree(SESSION_ID, $div, nodeP.children[key], parent_infoP, paramsP, jobNoP, is_skeleton, Number(key), null, nodeP, null, $root_container);
|
|
8804
|
+
}
|
|
8805
|
+
$div[0].style.removeProperty('height');
|
|
8806
|
+
$div.data().xuData.viewport_height = $div.height();
|
|
8807
|
+
|
|
8808
|
+
// set initial default height for all children
|
|
8809
|
+
const parent_id = $div.parent().attr('xu-ui-id');
|
|
8810
|
+
if (!UI_WORKER_OBJ.viewport_height_set_ids.includes(parent_id)) {
|
|
8811
|
+
UI_WORKER_OBJ.viewport_height_set_ids.push(parent_id);
|
|
8812
|
+
func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'set_viewport_height', { $div, height: $div.height() }, null, null, paramsP.dsSessionP);
|
|
8813
|
+
}
|
|
8814
|
+
}
|
|
8815
|
+
|
|
8816
|
+
return func.UI.worker.delete_job(SESSION_ID, queue_obj.job_num);
|
|
8817
|
+
},
|
|
8818
|
+
set_viewport_height: async function () {
|
|
8819
|
+
const { $div, height } = queue_obj?.paramsP || {};
|
|
8820
|
+
|
|
8821
|
+
$.each($div.parent().children(), function (key, elm) {
|
|
8822
|
+
if (!$(elm)[0].style.height && !$(elm).children().length) {
|
|
8823
|
+
$(elm).css('height', height);
|
|
8824
|
+
}
|
|
8825
|
+
});
|
|
8826
|
+
|
|
8827
|
+
return func.UI.worker.delete_job(SESSION_ID, queue_obj.job_num);
|
|
8828
|
+
},
|
|
8829
|
+
};
|
|
8830
|
+
|
|
8831
|
+
return await fx[queue_obj.functionP]();
|
|
8832
|
+
};
|
|
8833
|
+
func.UI.worker.find_job_index = function (SESSION_ID, jobNoP) {
|
|
8834
|
+
var ret = null;
|
|
8835
|
+
if (!UI_WORKER_OBJ) return ret;
|
|
8836
|
+
for (let [key, val] of Object.entries(UI_WORKER_OBJ.jobs)) {
|
|
8837
|
+
if (val && val.job_num == jobNoP) {
|
|
8838
|
+
ret = Number(key);
|
|
8839
|
+
break;
|
|
8840
|
+
}
|
|
8841
|
+
}
|
|
8842
|
+
return ret;
|
|
8843
|
+
};
|
|
8844
|
+
|
|
8845
|
+
func.UI.ds_garbage_collector = function (SESSION_ID = Object.keys(SESSION_OBJ)[0], re_check) {
|
|
8846
|
+
let _session = SESSION_OBJ[SESSION_ID];
|
|
8847
|
+
|
|
8848
|
+
const _data_system = _session?.DS_GLB?.[0]?.data_system;
|
|
8849
|
+
if (_data_system?.SYS_GLOBAL_BOL_AJAX_BUSY) return;
|
|
8850
|
+
if (!_data_system?.SYS_GLOBAL_BOL_IDLE) return;
|
|
8851
|
+
|
|
8852
|
+
let abort;
|
|
8853
|
+
|
|
8854
|
+
for (const [dsP, _ds] of Object.entries(_session.DS_GLB)) {
|
|
8855
|
+
if (_ds.stat === 'busy') {
|
|
8856
|
+
abort = true;
|
|
8857
|
+
break;
|
|
8858
|
+
}
|
|
8859
|
+
}
|
|
8860
|
+
|
|
8861
|
+
if (abort) {
|
|
8862
|
+
return;
|
|
8863
|
+
}
|
|
8864
|
+
|
|
8865
|
+
let ds_pending_to_delete = [],
|
|
8866
|
+
ds_approve_to_delete = [];
|
|
8867
|
+
const $elm = $('body').find('*');
|
|
8868
|
+
for (const [dsP, _ds] of Object.entries(_session.DS_GLB)) {
|
|
8869
|
+
if (!_ds.screen_params) continue;
|
|
8870
|
+
let found;
|
|
8871
|
+
$.each($elm, (key, val) => {
|
|
8872
|
+
const _xuData = $(val).data().xuData;
|
|
8873
|
+
if (!_xuData || !_xuData.paramsP) return true;
|
|
8874
|
+
if (_xuData.paramsP.dsSessionP == dsP) {
|
|
8875
|
+
found = true;
|
|
8876
|
+
return false;
|
|
8877
|
+
}
|
|
8878
|
+
});
|
|
8879
|
+
if (!found) {
|
|
8880
|
+
ds_pending_to_delete.push(dsP);
|
|
8881
|
+
}
|
|
8882
|
+
}
|
|
8883
|
+
// console.log(ds_pending_to_delete);
|
|
8884
|
+
|
|
8885
|
+
const sortedKeys = Object.keys(_session.DS_GLB).sort((a, b) => b.localeCompare(a));
|
|
8886
|
+
sortedKeys.forEach((key) => {
|
|
8887
|
+
const val = _session.DS_GLB[key];
|
|
8888
|
+
if (!ds_pending_to_delete.includes(key) && typeof val.parentDataSourceNo !== 'undefined' && ds_pending_to_delete.includes(val.parentDataSourceNo.toString())) {
|
|
8889
|
+
ds_pending_to_delete = ds_pending_to_delete.filter((item) => item !== val.parentDataSourceNo.toString());
|
|
8890
|
+
}
|
|
8891
|
+
});
|
|
8892
|
+
|
|
8893
|
+
// console.log(ds_pending_to_delete);
|
|
8894
|
+
for (const val of ds_pending_to_delete) {
|
|
8895
|
+
func.datasource.del(SESSION_ID, val);
|
|
8896
|
+
}
|
|
8897
|
+
};
|
|
8898
|
+
func.UI.refs_garbage_collector = function (SESSION_ID = Object.keys(SESSION_OBJ)[0]) {
|
|
8899
|
+
if (!_.isEmpty(SCREEN_BLOCKER_OBJ)) {
|
|
8900
|
+
// let dom to finish build
|
|
8901
|
+
return;
|
|
8902
|
+
}
|
|
8903
|
+
|
|
8904
|
+
let _session = SESSION_OBJ[SESSION_ID];
|
|
8905
|
+
const _data_system = _session?.DS_GLB?.[0]?.data_system;
|
|
8906
|
+
|
|
8907
|
+
for (const [key, val] of Object.entries(_data_system?.SYS_GLOBAL_OBJ_REFS || {})) {
|
|
8908
|
+
if (!$(`[xu-ui-id='${val.xu_ui_id}`)?.length && !$(`[xu-panel-wrapper-id='${val.xu_ui_id}`)?.length) {
|
|
8909
|
+
delete _data_system.SYS_GLOBAL_OBJ_REFS[key];
|
|
8910
|
+
}
|
|
8911
|
+
}
|
|
8912
|
+
};
|
|
8913
|
+
|
|
8914
|
+
func.UI.teleport_garbage_collector = function (SESSION_ID = Object.keys(SESSION_OBJ)[0]) {
|
|
8915
|
+
if (!_.isEmpty(SCREEN_BLOCKER_OBJ)) {
|
|
8916
|
+
// let dom to finish build
|
|
8917
|
+
return;
|
|
8918
|
+
}
|
|
8919
|
+
|
|
8920
|
+
const $teleport_elements = $(`[xu-teleport-parent-id^='node-`);
|
|
8921
|
+
|
|
8922
|
+
$.each($teleport_elements, (key, val) => {
|
|
8923
|
+
const xu_teleport_parent_id = $(val).attr('xu-teleport-parent-id');
|
|
8924
|
+
if (!$(`[xu-ui-id='${xu_teleport_parent_id}`)?.length) {
|
|
8925
|
+
$(val).remove();
|
|
8926
|
+
}
|
|
8927
|
+
});
|
|
8928
|
+
};
|
|
8929
|
+
|
|
8930
|
+
func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
|
|
8931
|
+
let ret;
|
|
8932
|
+
const _session = SESSION_OBJ[SESSION_ID];
|
|
8933
|
+
let _ds_0 = _session.DS_GLB[0];
|
|
8934
|
+
|
|
8935
|
+
const _ds = func.utils.clean_returned_datasource(SESSION_ID, dsSessionP);
|
|
8936
|
+
|
|
8937
|
+
let obj = { ds: _ds, data: {}, props: _ds.in_parameters || {} };
|
|
8938
|
+
try {
|
|
8939
|
+
const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
|
|
8940
|
+
obj.data = _ds?.data_feed?.rows?.[row_idx];
|
|
8941
|
+
} catch (error) {
|
|
8942
|
+
// error normal if find_ROWID_idx fail
|
|
8943
|
+
}
|
|
8944
|
+
let SYS_GLOBAL_OBJ_REFS = _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'];
|
|
8945
|
+
|
|
8946
|
+
if ($elm) {
|
|
8947
|
+
const attributes = $elm?.data()?.xuData?.xuPanelProps || $elm?.data()?.xuData?.debug_info?.attribute_stat || {};
|
|
8948
|
+
obj.attributes = attributes;
|
|
8949
|
+
obj.xu_ui_id = $elm.attr('xu-ui-id');
|
|
8950
|
+
}
|
|
8951
|
+
|
|
8952
|
+
if (!_.isEqual(SYS_GLOBAL_OBJ_REFS?.[ref_field_id] || {}, obj)) {
|
|
8953
|
+
if (!SYS_GLOBAL_OBJ_REFS[ref_field_id]) {
|
|
8954
|
+
SYS_GLOBAL_OBJ_REFS[ref_field_id] = {};
|
|
8955
|
+
}
|
|
8956
|
+
SYS_GLOBAL_OBJ_REFS[ref_field_id] = obj;
|
|
8957
|
+
ret = true;
|
|
8958
|
+
}
|
|
8959
|
+
|
|
8960
|
+
return ret;
|
|
8961
|
+
};
|
|
8962
|
+
|
|
8963
|
+
func.UI.find_field_in_progUi_attributes = function (progUi, field_id, prop, tag_name) {
|
|
8964
|
+
let elm_nodes = [];
|
|
8965
|
+
const iterate_progUi = function (node) {
|
|
8966
|
+
for (let item of node) {
|
|
8967
|
+
if (!tag_name || item.tagName === tag_name) {
|
|
8968
|
+
if (prop) {
|
|
8969
|
+
if (!_.isEmpty(item.attributes)) {
|
|
8970
|
+
for (const [attr, val] of Object.entries(item.attributes)) {
|
|
8971
|
+
if (attr === `xu-exp:${prop}` || attr === prop) {
|
|
8972
|
+
// found = val.includes('@' + field_id);
|
|
8973
|
+
if (val.includes('@' + field_id)) {
|
|
8974
|
+
elm_nodes.push(item);
|
|
8975
|
+
break;
|
|
8976
|
+
}
|
|
8977
|
+
}
|
|
8978
|
+
}
|
|
8979
|
+
}
|
|
8980
|
+
} else {
|
|
8981
|
+
if (tag_name) {
|
|
8982
|
+
elm_nodes.push(item);
|
|
8983
|
+
}
|
|
8984
|
+
}
|
|
8985
|
+
}
|
|
8986
|
+
// if (elm_node) break;
|
|
8987
|
+
|
|
8988
|
+
if (item.children) {
|
|
8989
|
+
iterate_progUi(item.children);
|
|
8990
|
+
}
|
|
8991
|
+
}
|
|
8992
|
+
};
|
|
8993
|
+
iterate_progUi(progUi);
|
|
8994
|
+
return elm_nodes;
|
|
8995
|
+
};
|
|
8996
|
+
func.UI.screen = {};
|
|
7755
8997
|
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) {
|
|
7756
8998
|
if (!prog_id) return console.error('program is empty');
|
|
7757
8999
|
let screen_ret = await func.utils.get_screen_obj(SESSION_ID, prog_id);
|