@xuda.io/runtime-bundle 1.0.1258 → 1.0.1259
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 +1169 -1169
- package/js/xuda-runtime-bundle.min.js +1 -1
- package/js/xuda-runtime-slim.js +1172 -1172
- package/js/xuda-runtime-slim.min.es.js +1172 -1172
- package/js/xuda-runtime-slim.min.js +1 -1
- package/package.json +1 -1
|
@@ -34529,150 +34529,150 @@ const generate_xu_ui_id = async function (SESSION_ID, nodeP, $container, paramsP
|
|
|
34529
34529
|
return await func.common.fastHash(ui_id);
|
|
34530
34530
|
};
|
|
34531
34531
|
|
|
34532
|
-
|
|
34533
|
-
//
|
|
34534
|
-
|
|
34535
|
-
|
|
34536
|
-
|
|
34537
|
-
|
|
34538
|
-
|
|
34539
|
-
|
|
34540
|
-
|
|
34541
|
-
|
|
34542
|
-
|
|
34543
|
-
|
|
34544
|
-
|
|
34545
|
-
|
|
34546
|
-
|
|
34547
|
-
//
|
|
34548
|
-
//
|
|
34532
|
+
func.UI.screen.create_container = async function (SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, classP, elem_propP, div_typeP, $appendToP, attr_str, is_placeholder) {
|
|
34533
|
+
// const _paramsP = _.cloneDeep(paramsP);
|
|
34534
|
+
const _paramsP = klona.klona(paramsP);
|
|
34535
|
+
var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_paramsP.dsSessionP];
|
|
34536
|
+
var $appendTo = $container;
|
|
34537
|
+
if ($appendToP) $appendTo = $appendToP;
|
|
34538
|
+
if (!$appendTo || !$appendTo.length) return null; // screen closed or not exist abort build
|
|
34539
|
+
var div = 'div';
|
|
34540
|
+
if (div_typeP) div = div_typeP;
|
|
34541
|
+
var items = [];
|
|
34542
|
+
if (nodeP.children)
|
|
34543
|
+
items = nodeP.children.map(function (val) {
|
|
34544
|
+
return val.xu_tree_id || val.id;
|
|
34545
|
+
});
|
|
34546
|
+
var currentRecordId = $container?.data?.()?.xuData?.recordid || (_ds ? _ds.currentRecordId : '');
|
|
34547
|
+
// var xu_id = (glb.screen_num++).toString();
|
|
34548
|
+
// xu_id = xu_id += '_' + currentRecordId;
|
|
34549
34549
|
|
|
34550
|
-
|
|
34551
|
-
|
|
34552
|
-
|
|
34553
|
-
//
|
|
34554
|
-
|
|
34555
|
-
// /////////////////////////////////
|
|
34556
|
-
|
|
34557
|
-
// var $div;
|
|
34558
|
-
|
|
34559
|
-
// if (div === 'svg') {
|
|
34560
|
-
// const draw_svg = function (element) {
|
|
34561
|
-
// const get_tag_str = function (element, prop, val) {
|
|
34562
|
-
// let class_str = '';
|
|
34563
|
-
// let attr_str = '';
|
|
34564
|
-
// for (const [key, val] of Object.entries(prop)) {
|
|
34565
|
-
// if (key.substr(0, 2) !== 'xu') {
|
|
34566
|
-
// attr_str += ` ${key}="${val}" `;
|
|
34567
|
-
// }
|
|
34568
|
-
// }
|
|
34569
|
-
// if (element === 'svg') {
|
|
34570
|
-
// return `<${element} ${attr_str} > `;
|
|
34571
|
-
// }
|
|
34572
|
-
// let ret = '';
|
|
34573
|
-
// if (val?.children?.length) {
|
|
34574
|
-
// ret = iterate_svg(val);
|
|
34575
|
-
// }
|
|
34550
|
+
try {
|
|
34551
|
+
const key_path = `${$container?.data()?.xuData?.key_path || '0'}-${keyP || '0'}`;
|
|
34552
|
+
const elem_key = `${nodeP.xu_tree_id || nodeP.id}-${key_path}-${currentRecordId}`;
|
|
34553
|
+
// let ui_id = `${nodeP.id}-${elem_key}-${_paramsP?.dsSessionP?.toString() || ''}`; //nodeP.xu_tree_id ||
|
|
34576
34554
|
|
|
34577
|
-
|
|
34578
|
-
// };
|
|
34579
|
-
// let svg_str = get_tag_str(element, prop);
|
|
34580
|
-
// let inner_str = '';
|
|
34581
|
-
// const iterate_svg = function (node) {
|
|
34582
|
-
// let ret = '';
|
|
34583
|
-
// if (node.children) {
|
|
34584
|
-
// for (let val of node.children) {
|
|
34585
|
-
// let prop = val.attributes;
|
|
34586
|
-
// ret += get_tag_str(val.tagName, prop, val);
|
|
34587
|
-
// }
|
|
34588
|
-
// }
|
|
34589
|
-
// return ret;
|
|
34590
|
-
// };
|
|
34591
|
-
// inner_str = iterate_svg(nodeP);
|
|
34555
|
+
/////////////////////////////////
|
|
34592
34556
|
|
|
34593
|
-
|
|
34594
|
-
// };
|
|
34557
|
+
var $div;
|
|
34595
34558
|
|
|
34596
|
-
|
|
34597
|
-
|
|
34598
|
-
|
|
34599
|
-
|
|
34559
|
+
if (div === 'svg') {
|
|
34560
|
+
const draw_svg = function (element) {
|
|
34561
|
+
const get_tag_str = function (element, prop, val) {
|
|
34562
|
+
let class_str = '';
|
|
34563
|
+
let attr_str = '';
|
|
34564
|
+
for (const [key, val] of Object.entries(prop)) {
|
|
34565
|
+
if (key.substr(0, 2) !== 'xu') {
|
|
34566
|
+
attr_str += ` ${key}="${val}" `;
|
|
34567
|
+
}
|
|
34568
|
+
}
|
|
34569
|
+
if (element === 'svg') {
|
|
34570
|
+
return `<${element} ${attr_str} > `;
|
|
34571
|
+
}
|
|
34572
|
+
let ret = '';
|
|
34573
|
+
if (val?.children?.length) {
|
|
34574
|
+
ret = iterate_svg(val);
|
|
34575
|
+
}
|
|
34600
34576
|
|
|
34601
|
-
|
|
34602
|
-
|
|
34603
|
-
|
|
34604
|
-
|
|
34605
|
-
|
|
34606
|
-
|
|
34607
|
-
|
|
34608
|
-
|
|
34609
|
-
|
|
34610
|
-
|
|
34611
|
-
|
|
34577
|
+
return `<${element} ${class_str} ${attr_str} > ${ret} </${element}>`;
|
|
34578
|
+
};
|
|
34579
|
+
let svg_str = get_tag_str(element, prop);
|
|
34580
|
+
let inner_str = '';
|
|
34581
|
+
const iterate_svg = function (node) {
|
|
34582
|
+
let ret = '';
|
|
34583
|
+
if (node.children) {
|
|
34584
|
+
for (let val of node.children) {
|
|
34585
|
+
let prop = val.attributes;
|
|
34586
|
+
ret += get_tag_str(val.tagName, prop, val);
|
|
34587
|
+
}
|
|
34588
|
+
}
|
|
34589
|
+
return ret;
|
|
34590
|
+
};
|
|
34591
|
+
inner_str = iterate_svg(nodeP);
|
|
34612
34592
|
|
|
34613
|
-
|
|
34614
|
-
|
|
34615
|
-
// // }
|
|
34593
|
+
$div = $(svg_str + inner_str + '</svg>').appendTo($appendTo);
|
|
34594
|
+
};
|
|
34616
34595
|
|
|
34617
|
-
|
|
34618
|
-
|
|
34619
|
-
|
|
34620
|
-
|
|
34621
|
-
// $div
|
|
34622
|
-
// .attr('xu-ui-id', new_ui_id)
|
|
34623
|
-
// // .attr('xu-node-id', nodeP.id)
|
|
34624
|
-
// .data({
|
|
34625
|
-
// xuData: {
|
|
34626
|
-
// prog_id: _paramsP.prog_id,
|
|
34627
|
-
// nodeid: nodeP.id,
|
|
34628
|
-
// ui_type: nodeP.tagName,
|
|
34629
|
-
// // xu_id,
|
|
34630
|
-
// recordid: currentRecordId,
|
|
34631
|
-
// paramsP: _paramsP,
|
|
34632
|
-
// key: keyP,
|
|
34633
|
-
// key_path, //:($container?.data()?.xuData?.key || "0") + "-" + (keyP || "0"),
|
|
34634
|
-
// screenId: _paramsP.screenId,
|
|
34635
|
-
// parent_container: $container?.attr('id'),
|
|
34636
|
-
// elem_key,
|
|
34637
|
-
// properties: prop,
|
|
34638
|
-
// node: nodeP,
|
|
34639
|
-
// node_org: _.cloneDeep(nodeP),
|
|
34640
|
-
// is_panelP: _paramsP.is_panelP,
|
|
34641
|
-
// ui_id: new_ui_id,
|
|
34642
|
-
// elem_prop: elem_propP,
|
|
34643
|
-
// debug_info: {
|
|
34644
|
-
// id: nodeP.id,
|
|
34645
|
-
// parent_id: $container?.data()?.xuData?.ui_id,
|
|
34646
|
-
// items: items,
|
|
34647
|
-
// },
|
|
34648
|
-
// parent_node: parent_nodeP,
|
|
34649
|
-
// currentRecordId: currentRecordId,
|
|
34650
|
-
// $root_container: $root_container,
|
|
34651
|
-
// parent_element_ui_id: $container?.data()?.xuData?.ui_id,
|
|
34652
|
-
// },
|
|
34653
|
-
// xuAttributes: {},
|
|
34654
|
-
// });
|
|
34655
|
-
// if (is_placeholder) {
|
|
34656
|
-
// $div.addClass('display_none');
|
|
34657
|
-
// }
|
|
34596
|
+
draw_svg(div_typeP);
|
|
34597
|
+
} else {
|
|
34598
|
+
$div = $(`<${div} ${attr_str ? attr_str : ''}>`);
|
|
34599
|
+
}
|
|
34658
34600
|
|
|
34659
|
-
//
|
|
34660
|
-
//
|
|
34661
|
-
//
|
|
34662
|
-
//
|
|
34663
|
-
//
|
|
34664
|
-
//
|
|
34601
|
+
// // Returns a 32-bit unsigned integer hash of a string (FNV-1a)
|
|
34602
|
+
// function hash32(str) {
|
|
34603
|
+
// let h = 0x811c9dc5; // FNV offset basis
|
|
34604
|
+
// for (let i = 0; i < str.length; i++) {
|
|
34605
|
+
// h ^= str.charCodeAt(i);
|
|
34606
|
+
// // multiply by FNV prime (2^24 + 2^8 + 0x93) with 32-bit overflow
|
|
34607
|
+
// h += (h << 1) + (h << 4) + (h << 7) + (h << 8) + (h << 24);
|
|
34608
|
+
// }
|
|
34609
|
+
// // Convert to unsigned 32-bit
|
|
34610
|
+
// return h >>> 0;
|
|
34611
|
+
// }
|
|
34665
34612
|
|
|
34666
|
-
//
|
|
34667
|
-
//
|
|
34668
|
-
//
|
|
34613
|
+
// function hash32hex(str) {
|
|
34614
|
+
// return (hash32(str) >>> 0).toString(16).padStart(8, '0');
|
|
34615
|
+
// }
|
|
34669
34616
|
|
|
34670
|
-
//
|
|
34617
|
+
// const new_ui_id = hash32hex(ui_id);
|
|
34618
|
+
// const new_ui_id = await func.common.sha256(ui_id);
|
|
34619
|
+
const new_ui_id = await generate_xu_ui_id(SESSION_ID, nodeP, $container, paramsP, keyP);
|
|
34671
34620
|
|
|
34672
|
-
|
|
34673
|
-
|
|
34621
|
+
$div
|
|
34622
|
+
.attr('xu-ui-id', new_ui_id)
|
|
34623
|
+
// .attr('xu-node-id', nodeP.id)
|
|
34624
|
+
.data({
|
|
34625
|
+
xuData: {
|
|
34626
|
+
prog_id: _paramsP.prog_id,
|
|
34627
|
+
nodeid: nodeP.id,
|
|
34628
|
+
ui_type: nodeP.tagName,
|
|
34629
|
+
// xu_id,
|
|
34630
|
+
recordid: currentRecordId,
|
|
34631
|
+
paramsP: _paramsP,
|
|
34632
|
+
key: keyP,
|
|
34633
|
+
key_path, //:($container?.data()?.xuData?.key || "0") + "-" + (keyP || "0"),
|
|
34634
|
+
screenId: _paramsP.screenId,
|
|
34635
|
+
parent_container: $container?.attr('id'),
|
|
34636
|
+
elem_key,
|
|
34637
|
+
properties: prop,
|
|
34638
|
+
node: nodeP,
|
|
34639
|
+
node_org: _.cloneDeep(nodeP),
|
|
34640
|
+
is_panelP: _paramsP.is_panelP,
|
|
34641
|
+
ui_id: new_ui_id,
|
|
34642
|
+
elem_prop: elem_propP,
|
|
34643
|
+
debug_info: {
|
|
34644
|
+
id: nodeP.id,
|
|
34645
|
+
parent_id: $container?.data()?.xuData?.ui_id,
|
|
34646
|
+
items: items,
|
|
34647
|
+
},
|
|
34648
|
+
parent_node: parent_nodeP,
|
|
34649
|
+
currentRecordId: currentRecordId,
|
|
34650
|
+
$root_container: $root_container,
|
|
34651
|
+
parent_element_ui_id: $container?.data()?.xuData?.ui_id,
|
|
34652
|
+
},
|
|
34653
|
+
xuAttributes: {},
|
|
34654
|
+
});
|
|
34655
|
+
if (is_placeholder) {
|
|
34656
|
+
$div.addClass('display_none');
|
|
34657
|
+
}
|
|
34674
34658
|
|
|
34675
|
-
|
|
34659
|
+
if (div_typeP !== 'svg') {
|
|
34660
|
+
$div.appendTo($appendTo);
|
|
34661
|
+
}
|
|
34662
|
+
} catch (e) {
|
|
34663
|
+
console.error(e);
|
|
34664
|
+
}
|
|
34665
|
+
|
|
34666
|
+
if (parent_infoP?.iterate_info) {
|
|
34667
|
+
$div.data().xuData.iterate_info = parent_infoP.iterate_info;
|
|
34668
|
+
}
|
|
34669
|
+
|
|
34670
|
+
if (classP) $div.addClass(classP);
|
|
34671
|
+
|
|
34672
|
+
return $div;
|
|
34673
|
+
};
|
|
34674
|
+
|
|
34675
|
+
func.UI.screen.create_container_bad = async function (SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, classP, elem_propP, div_typeP, $appendToP, attr_str, is_placeholder) {
|
|
34676
34676
|
const _paramsP = klona.klona(paramsP);
|
|
34677
34677
|
const _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_paramsP.dsSessionP];
|
|
34678
34678
|
const $appendTo = $appendToP || $container;
|
|
@@ -34979,1171 +34979,1171 @@ func.UI.screen.screen_loading_done = async function (SESSION_ID, paramsP, $div,
|
|
|
34979
34979
|
return $div;
|
|
34980
34980
|
};
|
|
34981
34981
|
|
|
34982
|
-
|
|
34983
|
-
|
|
34984
|
-
|
|
34985
|
-
|
|
34986
|
-
|
|
34987
|
-
|
|
34988
|
-
|
|
34989
|
-
|
|
34990
|
-
|
|
34991
|
-
//
|
|
34992
|
-
|
|
34993
|
-
|
|
34994
|
-
// ///////////
|
|
34995
|
-
// var is_mobile = glb.MOBILE_ARR.includes(paramsP.screenInfo.properties?.menuType) ? true : false;
|
|
34982
|
+
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) {
|
|
34983
|
+
if (!is_skeleton) {
|
|
34984
|
+
var _session = SESSION_OBJ[SESSION_ID];
|
|
34985
|
+
var _ds = _session.DS_GLB[paramsP.dsSessionP];
|
|
34986
|
+
}
|
|
34987
|
+
var prop;
|
|
34988
|
+
try {
|
|
34989
|
+
prop = nodeP.attributes;
|
|
34990
|
+
} catch (error) {
|
|
34991
|
+
// debugger;
|
|
34992
|
+
}
|
|
34996
34993
|
|
|
34997
|
-
|
|
34998
|
-
|
|
34999
|
-
// let currentRecordId = _ds?.currentRecordId || '';
|
|
34994
|
+
///////////
|
|
34995
|
+
var is_mobile = glb.MOBILE_ARR.includes(paramsP.screenInfo.properties?.menuType) ? true : false;
|
|
35000
34996
|
|
|
35001
|
-
|
|
34997
|
+
const get_element_info = function () {
|
|
34998
|
+
var ret = {};
|
|
34999
|
+
let currentRecordId = _ds?.currentRecordId || '';
|
|
35002
35000
|
|
|
35003
|
-
|
|
35004
|
-
// if ($(val)?.data().xuData?.recordid === currentRecordId && $(val)?.data().xuData?.key === keyP && $(val)?.prop('tagName') !== 'XURENDER') {
|
|
35005
|
-
// ret = {
|
|
35006
|
-
// div: $div,
|
|
35007
|
-
// };
|
|
35008
|
-
// }
|
|
35009
|
-
// });
|
|
35001
|
+
let $div = func.UI.utils.find_in_element_data('xuData', $container.parent(), 'nodeid', nodeP.id);
|
|
35010
35002
|
|
|
35011
|
-
|
|
35012
|
-
|
|
35003
|
+
$.each($div, function (key, val) {
|
|
35004
|
+
if ($(val)?.data().xuData?.recordid === currentRecordId && $(val)?.data().xuData?.key === keyP && $(val)?.prop('tagName') !== 'XURENDER') {
|
|
35005
|
+
ret = {
|
|
35006
|
+
div: $div,
|
|
35007
|
+
};
|
|
35008
|
+
}
|
|
35009
|
+
});
|
|
35013
35010
|
|
|
35014
|
-
|
|
35015
|
-
|
|
35016
|
-
// if (!nodeP) ret = false;
|
|
35017
|
-
// return ret;
|
|
35018
|
-
// };
|
|
35019
|
-
// const debug = function (is_errorP, error_descP) {
|
|
35020
|
-
// func.utils.debug.log(SESSION_ID, paramsP.prog_id + '_' + nodeP.id_org + '_ui_prop', {
|
|
35021
|
-
// module: 'gui',
|
|
35022
|
-
// action: 'init',
|
|
35023
|
-
// prop: nodeP.id,
|
|
35024
|
-
// details: error_descP,
|
|
35025
|
-
// result: null,
|
|
35026
|
-
// error: is_errorP,
|
|
35027
|
-
// source: _ds?.tree_obj?.menuName || '',
|
|
35028
|
-
// fields: null,
|
|
35029
|
-
// type: null,
|
|
35030
|
-
// prog_id: paramsP.prog_id,
|
|
35031
|
-
// dsSession: null,
|
|
35032
|
-
// });
|
|
35033
|
-
// };
|
|
35011
|
+
return ret;
|
|
35012
|
+
};
|
|
35034
35013
|
|
|
35035
|
-
|
|
35036
|
-
|
|
35037
|
-
|
|
35038
|
-
|
|
35039
|
-
|
|
35040
|
-
|
|
35041
|
-
|
|
35014
|
+
const init = async function () {
|
|
35015
|
+
var ret = true;
|
|
35016
|
+
if (!nodeP) ret = false;
|
|
35017
|
+
return ret;
|
|
35018
|
+
};
|
|
35019
|
+
const debug = function (is_errorP, error_descP) {
|
|
35020
|
+
func.utils.debug.log(SESSION_ID, paramsP.prog_id + '_' + nodeP.id_org + '_ui_prop', {
|
|
35021
|
+
module: 'gui',
|
|
35022
|
+
action: 'init',
|
|
35023
|
+
prop: nodeP.id,
|
|
35024
|
+
details: error_descP,
|
|
35025
|
+
result: null,
|
|
35026
|
+
error: is_errorP,
|
|
35027
|
+
source: _ds?.tree_obj?.menuName || '',
|
|
35028
|
+
fields: null,
|
|
35029
|
+
type: null,
|
|
35030
|
+
prog_id: paramsP.prog_id,
|
|
35031
|
+
dsSession: null,
|
|
35032
|
+
});
|
|
35033
|
+
};
|
|
35042
35034
|
|
|
35043
|
-
|
|
35035
|
+
const open_modal = async function ($div) {
|
|
35036
|
+
const modal_id = 'app_modal-' + paramsP.dsSessionP.toString();
|
|
35037
|
+
var xu_modal_controller = document.querySelector('xu-modal-controller');
|
|
35038
|
+
if (!xu_modal_controller) {
|
|
35039
|
+
func.UI.component.create_app_modal_component(SESSION_ID, modal_id);
|
|
35040
|
+
xu_modal_controller = document.querySelector('xu-modal-controller');
|
|
35041
|
+
}
|
|
35044
35042
|
|
|
35045
|
-
|
|
35046
|
-
// controller_params = {};
|
|
35047
|
-
// }
|
|
35043
|
+
var controller_params = $(xu_modal_controller).data('xuControllerParams');
|
|
35048
35044
|
|
|
35049
|
-
|
|
35050
|
-
|
|
35051
|
-
|
|
35052
|
-
// $dialogDiv: $div.children(),
|
|
35053
|
-
// $container: $container,
|
|
35054
|
-
// dsSession: paramsP.dsSessionP,
|
|
35055
|
-
// };
|
|
35045
|
+
if (!controller_params) {
|
|
35046
|
+
controller_params = {};
|
|
35047
|
+
}
|
|
35056
35048
|
|
|
35057
|
-
|
|
35049
|
+
var params = {
|
|
35050
|
+
menuTitle: paramsP.screenInfo.properties?.menuTitle,
|
|
35051
|
+
screenId: paramsP.screenId,
|
|
35052
|
+
$dialogDiv: $div.children(),
|
|
35053
|
+
$container: $container,
|
|
35054
|
+
dsSession: paramsP.dsSessionP,
|
|
35055
|
+
};
|
|
35058
35056
|
|
|
35059
|
-
|
|
35060
|
-
// const modalController = await new UI_FRAMEWORK_PLUGIN.modal();
|
|
35057
|
+
controller_params[modal_id] = params;
|
|
35061
35058
|
|
|
35062
|
-
|
|
35063
|
-
|
|
35064
|
-
// APP_MODAL_OBJ[modal_id] = modal;
|
|
35065
|
-
// } else {
|
|
35066
|
-
// $(modal_id).empty();
|
|
35067
|
-
// }
|
|
35068
|
-
// await modalController.init(SESSION_ID, modal_id);
|
|
35059
|
+
$(xu_modal_controller).data('xuControllerParams', controller_params);
|
|
35060
|
+
const modalController = await new UI_FRAMEWORK_PLUGIN.modal();
|
|
35069
35061
|
|
|
35070
|
-
|
|
35071
|
-
|
|
35062
|
+
if (!APP_MODAL_OBJ[modal_id]) {
|
|
35063
|
+
const modal = await modalController.create(SESSION_ID, modal_id, paramsP.screenInfo, close_modal);
|
|
35064
|
+
APP_MODAL_OBJ[modal_id] = modal;
|
|
35065
|
+
} else {
|
|
35066
|
+
$(modal_id).empty();
|
|
35067
|
+
}
|
|
35068
|
+
await modalController.init(SESSION_ID, modal_id);
|
|
35072
35069
|
|
|
35073
|
-
|
|
35074
|
-
|
|
35075
|
-
// const xu_modal_controller = document.querySelector('xu-modal-controller');
|
|
35076
|
-
// var params = $(xu_modal_controller).data().xuControllerParams[modal_id];
|
|
35077
|
-
// if (params && params.$container) {
|
|
35078
|
-
// await func.UI.screen.validate_exit_events(SESSION_ID, params.$container.data().xuData.paramsP, null);
|
|
35079
|
-
// func.datasource.clean_all(SESSION_ID, params.dsSession);
|
|
35080
|
-
// }
|
|
35081
|
-
// };
|
|
35070
|
+
return $div;
|
|
35071
|
+
};
|
|
35082
35072
|
|
|
35083
|
-
|
|
35084
|
-
|
|
35085
|
-
|
|
35086
|
-
|
|
35087
|
-
|
|
35088
|
-
|
|
35089
|
-
|
|
35090
|
-
|
|
35073
|
+
const close_modal = async function (modal_id) {
|
|
35074
|
+
delete APP_MODAL_OBJ[modal_id];
|
|
35075
|
+
const xu_modal_controller = document.querySelector('xu-modal-controller');
|
|
35076
|
+
var params = $(xu_modal_controller).data().xuControllerParams[modal_id];
|
|
35077
|
+
if (params && params.$container) {
|
|
35078
|
+
await func.UI.screen.validate_exit_events(SESSION_ID, params.$container.data().xuData.paramsP, null);
|
|
35079
|
+
func.datasource.clean_all(SESSION_ID, params.dsSession);
|
|
35080
|
+
}
|
|
35081
|
+
};
|
|
35091
35082
|
|
|
35092
|
-
|
|
35093
|
-
|
|
35083
|
+
const close_all_modals = function () {
|
|
35084
|
+
$.each(APP_MODAL_OBJ, function (key, val) {
|
|
35085
|
+
if (val) {
|
|
35086
|
+
// close_modal(key);
|
|
35087
|
+
UI_FRAMEWORK_PLUGIN.modal.close(key);
|
|
35088
|
+
}
|
|
35089
|
+
});
|
|
35090
|
+
};
|
|
35094
35091
|
|
|
35095
|
-
|
|
35096
|
-
|
|
35097
|
-
// screenId: paramsP.screenId,
|
|
35098
|
-
// $dialogDiv: $div.children(),
|
|
35099
|
-
// $container: $container,
|
|
35100
|
-
// });
|
|
35101
|
-
// const popover = new UI_FRAMEWORK_PLUGIN.popover(
|
|
35102
|
-
// SESSION_ID,
|
|
35103
|
-
// // ELEMENT_CLICK_EVENT,
|
|
35104
|
-
// // props
|
|
35105
|
-
// );
|
|
35106
|
-
// await popover.open(SESSION_ID);
|
|
35107
|
-
// CURRENT_APP_POPOVER = popover;
|
|
35108
|
-
|
|
35109
|
-
// return;
|
|
35110
|
-
// popoverController
|
|
35111
|
-
// .create({
|
|
35112
|
-
// component: 'xu-popover-content-' + SESSION_ID,
|
|
35113
|
-
// event: ELEMENT_CLICK_EVENT,
|
|
35114
|
-
// translucent: true,
|
|
35115
|
-
// })
|
|
35116
|
-
// .then((modal) => {
|
|
35117
|
-
// modal.present().then(() => {
|
|
35118
|
-
// CURRENT_APP_POPOVER = modal;
|
|
35092
|
+
const open_popover = async function ($div) {
|
|
35093
|
+
const xu_popover_controller = func.UI.component.create_app_popover_component(SESSION_ID);
|
|
35119
35094
|
|
|
35120
|
-
|
|
35121
|
-
|
|
35122
|
-
|
|
35123
|
-
|
|
35124
|
-
|
|
35125
|
-
|
|
35126
|
-
|
|
35127
|
-
|
|
35128
|
-
//
|
|
35129
|
-
//
|
|
35130
|
-
|
|
35131
|
-
|
|
35132
|
-
|
|
35133
|
-
// };
|
|
35134
|
-
// if (!nodeP || !nodeP.children) {
|
|
35135
|
-
// return await done($divP);
|
|
35136
|
-
// }
|
|
35095
|
+
$(xu_popover_controller).data('xuControllerParams', {
|
|
35096
|
+
menuTitle: paramsP.screenInfo.properties?.menuTitle,
|
|
35097
|
+
screenId: paramsP.screenId,
|
|
35098
|
+
$dialogDiv: $div.children(),
|
|
35099
|
+
$container: $container,
|
|
35100
|
+
});
|
|
35101
|
+
const popover = new UI_FRAMEWORK_PLUGIN.popover(
|
|
35102
|
+
SESSION_ID,
|
|
35103
|
+
// ELEMENT_CLICK_EVENT,
|
|
35104
|
+
// props
|
|
35105
|
+
);
|
|
35106
|
+
await popover.open(SESSION_ID);
|
|
35107
|
+
CURRENT_APP_POPOVER = popover;
|
|
35137
35108
|
|
|
35138
|
-
|
|
35139
|
-
|
|
35140
|
-
|
|
35141
|
-
|
|
35142
|
-
|
|
35143
|
-
|
|
35144
|
-
|
|
35145
|
-
|
|
35146
|
-
|
|
35147
|
-
|
|
35148
|
-
// resolve();
|
|
35149
|
-
// }),
|
|
35150
|
-
// );
|
|
35151
|
-
// }
|
|
35152
|
-
// await Promise.all(node_promises);
|
|
35153
|
-
// }
|
|
35154
|
-
// return await done($divP);
|
|
35155
|
-
// };
|
|
35109
|
+
return;
|
|
35110
|
+
popoverController
|
|
35111
|
+
.create({
|
|
35112
|
+
component: 'xu-popover-content-' + SESSION_ID,
|
|
35113
|
+
event: ELEMENT_CLICK_EVENT,
|
|
35114
|
+
translucent: true,
|
|
35115
|
+
})
|
|
35116
|
+
.then((modal) => {
|
|
35117
|
+
modal.present().then(() => {
|
|
35118
|
+
CURRENT_APP_POPOVER = modal;
|
|
35156
35119
|
|
|
35157
|
-
|
|
35158
|
-
|
|
35159
|
-
|
|
35160
|
-
|
|
35161
|
-
|
|
35162
|
-
|
|
35163
|
-
|
|
35120
|
+
if (callbackP) callbackP($div);
|
|
35121
|
+
});
|
|
35122
|
+
});
|
|
35123
|
+
};
|
|
35124
|
+
const iterate_child = async function ($divP, nodeP, parent_infoP, $root_container, before_record_function) {
|
|
35125
|
+
if (!is_mobile && nodeP.busy) return;
|
|
35126
|
+
nodeP.busy = true;
|
|
35127
|
+
const done = async function ($divP) {
|
|
35128
|
+
setTimeout(function () {
|
|
35129
|
+
nodeP.busy = false;
|
|
35130
|
+
}, 1000);
|
|
35164
35131
|
|
|
35165
|
-
|
|
35166
|
-
|
|
35167
|
-
|
|
35168
|
-
|
|
35169
|
-
|
|
35170
|
-
|
|
35171
|
-
// // if (before_record_function) {
|
|
35172
|
-
// // await before_record_function();
|
|
35173
|
-
// // }
|
|
35174
|
-
// // if (nodeP?.children?.length) {
|
|
35175
|
-
// // for await (const [key, val] of Object.entries(nodeP.children)) {
|
|
35176
|
-
// // 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);
|
|
35177
|
-
// // }
|
|
35178
|
-
// // }
|
|
35179
|
-
// // return await done($divP);
|
|
35180
|
-
// // };
|
|
35132
|
+
return $divP;
|
|
35133
|
+
};
|
|
35134
|
+
if (!nodeP || !nodeP.children) {
|
|
35135
|
+
return await done($divP);
|
|
35136
|
+
}
|
|
35181
35137
|
|
|
35182
|
-
|
|
35183
|
-
|
|
35184
|
-
|
|
35185
|
-
|
|
35186
|
-
|
|
35138
|
+
if (before_record_function) {
|
|
35139
|
+
await before_record_function();
|
|
35140
|
+
}
|
|
35141
|
+
if (nodeP?.children?.length) {
|
|
35142
|
+
let node_promises = [];
|
|
35143
|
+
for (const [key, val] of Object.entries(nodeP.children)) {
|
|
35144
|
+
node_promises.push(
|
|
35145
|
+
new Promise(async (resolve, reject) => {
|
|
35146
|
+
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);
|
|
35187
35147
|
|
|
35188
|
-
|
|
35189
|
-
|
|
35190
|
-
|
|
35148
|
+
resolve();
|
|
35149
|
+
}),
|
|
35150
|
+
);
|
|
35151
|
+
}
|
|
35152
|
+
await Promise.all(node_promises);
|
|
35153
|
+
}
|
|
35154
|
+
return await done($divP);
|
|
35155
|
+
};
|
|
35191
35156
|
|
|
35192
|
-
//
|
|
35193
|
-
//
|
|
35194
|
-
//
|
|
35195
|
-
//
|
|
35196
|
-
//
|
|
35157
|
+
// const iterate_child = async function ($divP, nodeP, parent_infoP, $root_container, before_record_function) {
|
|
35158
|
+
// if (!is_mobile && nodeP.busy) return;
|
|
35159
|
+
// nodeP.busy = true;
|
|
35160
|
+
// const done = async function ($divP) {
|
|
35161
|
+
// setTimeout(function () {
|
|
35162
|
+
// nodeP.busy = false;
|
|
35163
|
+
// }, 1000);
|
|
35164
|
+
|
|
35165
|
+
// return $divP;
|
|
35166
|
+
// };
|
|
35167
|
+
// if (!nodeP || !nodeP.children) {
|
|
35168
|
+
// return await done($divP);
|
|
35169
|
+
// }
|
|
35197
35170
|
|
|
35198
|
-
//
|
|
35199
|
-
//
|
|
35200
|
-
//
|
|
35201
|
-
//
|
|
35202
|
-
//
|
|
35203
|
-
//
|
|
35204
|
-
//
|
|
35205
|
-
//
|
|
35206
|
-
//
|
|
35207
|
-
//
|
|
35171
|
+
// if (before_record_function) {
|
|
35172
|
+
// await before_record_function();
|
|
35173
|
+
// }
|
|
35174
|
+
// if (nodeP?.children?.length) {
|
|
35175
|
+
// for await (const [key, val] of Object.entries(nodeP.children)) {
|
|
35176
|
+
// 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);
|
|
35177
|
+
// }
|
|
35178
|
+
// }
|
|
35179
|
+
// return await done($divP);
|
|
35180
|
+
// };
|
|
35208
35181
|
|
|
35209
|
-
|
|
35210
|
-
|
|
35211
|
-
|
|
35212
|
-
|
|
35213
|
-
|
|
35214
|
-
// if (_iterate_info.is_key_dynamic_field) {
|
|
35215
|
-
// _ds.dynamic_fields[_iterate_info.iterator_key].value = _iterate_info._key;
|
|
35216
|
-
// } else {
|
|
35217
|
-
// try {
|
|
35218
|
-
// const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
|
|
35219
|
-
// _ds.data_feed.rows[row_idx][_iterate_info.iterator_key] = _iterate_info._key;
|
|
35220
|
-
// } catch (err) {
|
|
35221
|
-
// console.error(err);
|
|
35222
|
-
// }
|
|
35223
|
-
// }
|
|
35182
|
+
const _$ = function ($elm) {
|
|
35183
|
+
try {
|
|
35184
|
+
const id = $elm.attr('xu-ui-id');
|
|
35185
|
+
if (!id || !glb.DEBUG_MODE) return $elm;
|
|
35186
|
+
const $el = $(`[xu-ui-id="${id}"]`);
|
|
35224
35187
|
|
|
35225
|
-
|
|
35226
|
-
|
|
35227
|
-
|
|
35228
|
-
// try {
|
|
35229
|
-
// const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
|
|
35230
|
-
// _ds.data_feed.rows[row_idx][_iterate_info.iterator_val] = _iterate_info._val;
|
|
35231
|
-
// } catch (err) {
|
|
35232
|
-
// console.error(err);
|
|
35233
|
-
// }
|
|
35234
|
-
// }
|
|
35235
|
-
// }
|
|
35188
|
+
if ($el.length > 1) {
|
|
35189
|
+
console.warn('Multiple elements for xu-ui-id: ' + id, $el);
|
|
35190
|
+
}
|
|
35236
35191
|
|
|
35237
|
-
|
|
35238
|
-
|
|
35239
|
-
|
|
35192
|
+
return $($el[0]);
|
|
35193
|
+
} catch (e) {
|
|
35194
|
+
console.error(e);
|
|
35195
|
+
}
|
|
35196
|
+
};
|
|
35240
35197
|
|
|
35241
|
-
|
|
35242
|
-
|
|
35198
|
+
const hover_in = function ($div, e) {
|
|
35199
|
+
if (is_skeleton || (e && (EXP_BUSY || UI_WORKER_OBJ.jobs.length))) return;
|
|
35200
|
+
CLIENT_ACTIVITY_TS = Date.now();
|
|
35201
|
+
if (_$($container)?.data()?.xuData?.debug_info) _$($container).data().xuData.debug_info.hover_item = $div.attr('xu-ui-id');
|
|
35202
|
+
if (!_ds) return;
|
|
35203
|
+
///////// SET Attributes///////////
|
|
35204
|
+
let attributes = {};
|
|
35205
|
+
$.each($div[0].attributes, function (index, attr) {
|
|
35206
|
+
attributes[attr.name] = attr.value;
|
|
35207
|
+
});
|
|
35243
35208
|
|
|
35244
|
-
|
|
35245
|
-
|
|
35246
|
-
|
|
35247
|
-
|
|
35248
|
-
|
|
35249
|
-
|
|
35250
|
-
|
|
35251
|
-
|
|
35252
|
-
|
|
35253
|
-
|
|
35254
|
-
|
|
35255
|
-
|
|
35256
|
-
|
|
35257
|
-
|
|
35209
|
+
_session.DS_GLB[0].data_system.SYS_OBJ_WIN_ELEMENT_HOVERED_ATTRIBUTES = attributes;
|
|
35210
|
+
//////////////////////////////////
|
|
35211
|
+
if (!$div.data()?.xuData) return;
|
|
35212
|
+
const _iterate_info = $div.data().xuData.iterate_info;
|
|
35213
|
+
if (_iterate_info) {
|
|
35214
|
+
if (_iterate_info.is_key_dynamic_field) {
|
|
35215
|
+
_ds.dynamic_fields[_iterate_info.iterator_key].value = _iterate_info._key;
|
|
35216
|
+
} else {
|
|
35217
|
+
try {
|
|
35218
|
+
const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
|
|
35219
|
+
_ds.data_feed.rows[row_idx][_iterate_info.iterator_key] = _iterate_info._key;
|
|
35220
|
+
} catch (err) {
|
|
35221
|
+
console.error(err);
|
|
35222
|
+
}
|
|
35223
|
+
}
|
|
35258
35224
|
|
|
35259
|
-
|
|
35260
|
-
|
|
35261
|
-
|
|
35262
|
-
|
|
35263
|
-
|
|
35264
|
-
|
|
35265
|
-
|
|
35266
|
-
|
|
35267
|
-
|
|
35268
|
-
|
|
35269
|
-
|
|
35270
|
-
// if (is_skeleton) return;
|
|
35225
|
+
if (_iterate_info.is_val_dynamic_field) {
|
|
35226
|
+
_ds.dynamic_fields[_iterate_info.iterator_val].value = _iterate_info._val;
|
|
35227
|
+
} else {
|
|
35228
|
+
try {
|
|
35229
|
+
const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
|
|
35230
|
+
_ds.data_feed.rows[row_idx][_iterate_info.iterator_val] = _iterate_info._val;
|
|
35231
|
+
} catch (err) {
|
|
35232
|
+
console.error(err);
|
|
35233
|
+
}
|
|
35234
|
+
}
|
|
35235
|
+
}
|
|
35271
35236
|
|
|
35272
|
-
|
|
35273
|
-
|
|
35274
|
-
|
|
35275
|
-
// }
|
|
35276
|
-
// if (_ds?.data_system) {
|
|
35277
|
-
// SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system.SYS_OBJ_WIN_ELEMENT_HOVERED_ATTRIBUTES = {};
|
|
35278
|
-
// }
|
|
35279
|
-
// };
|
|
35280
|
-
// const render_screen_type = async function ($div) {
|
|
35281
|
-
// const set_call_screen_properties_values = async function (ui_framework) {
|
|
35282
|
-
// params.properties = {};
|
|
35283
|
-
// const get_values = async function (property) {
|
|
35284
|
-
// var property_value = paramsP?.screenInfo?.properties?.[property] || paramsP?.screenInfo?.properties?.frameworkProperties?.[property];
|
|
35285
|
-
// if (paramsP?.call_screen_propertiesP) {
|
|
35286
|
-
// if (paramsP.call_screen_propertiesP?.[property]) {
|
|
35287
|
-
// property_value = paramsP.call_screen_propertiesP[property];
|
|
35288
|
-
// }
|
|
35289
|
-
// if (paramsP.call_screen_propertiesP[`xu-exp:${property}`]) {
|
|
35290
|
-
// property_value = (await func.expression.get(SESSION_ID, paramsP.call_screen_propertiesP[`xu-exp:${property}`], paramsP.dsSessionP, property)).result;
|
|
35291
|
-
// }
|
|
35292
|
-
// }
|
|
35293
|
-
// return property_value;
|
|
35294
|
-
// };
|
|
35295
|
-
// params.properties['name'] = await get_values('menuTitle');
|
|
35296
|
-
// if (await ui_framework?.properties()) {
|
|
35297
|
-
// for await (const [key, val] of Object.entries(await ui_framework.properties())) {
|
|
35298
|
-
// params.properties[key] = await get_values(key);
|
|
35299
|
-
// }
|
|
35300
|
-
// }
|
|
35301
|
-
// };
|
|
35237
|
+
if ($div && _$($div) && _ds && paramsP.renderType === 'grid') {
|
|
35238
|
+
func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'update_datasource', { currentRecordId: _$($div).data().xuData.currentRecordId }, null, null, paramsP.dsSessionP);
|
|
35239
|
+
}
|
|
35302
35240
|
|
|
35303
|
-
|
|
35241
|
+
const set_value = function (field_id, value) {
|
|
35242
|
+
var currentRecordId = _$($div).data().xuData.currentRecordId;
|
|
35304
35243
|
|
|
35305
|
-
|
|
35306
|
-
|
|
35307
|
-
|
|
35308
|
-
|
|
35309
|
-
|
|
35310
|
-
|
|
35244
|
+
func.UI.worker.add_to_queue(
|
|
35245
|
+
SESSION_ID,
|
|
35246
|
+
'gui event',
|
|
35247
|
+
'update_datasource',
|
|
35248
|
+
{
|
|
35249
|
+
currentRecordId,
|
|
35250
|
+
field_id,
|
|
35251
|
+
field_value: value,
|
|
35252
|
+
},
|
|
35253
|
+
null,
|
|
35254
|
+
null,
|
|
35255
|
+
paramsP.dsSessionP,
|
|
35256
|
+
);
|
|
35257
|
+
};
|
|
35311
35258
|
|
|
35312
|
-
|
|
35313
|
-
|
|
35314
|
-
|
|
35315
|
-
|
|
35316
|
-
|
|
35317
|
-
|
|
35318
|
-
|
|
35319
|
-
|
|
35320
|
-
|
|
35321
|
-
|
|
35322
|
-
|
|
35259
|
+
if ($div?.data()?.iterate_info) {
|
|
35260
|
+
var data = $div.data().xuData.iterate_info;
|
|
35261
|
+
if (data.iterator_key) {
|
|
35262
|
+
set_value(data.iterator_key, data._key);
|
|
35263
|
+
}
|
|
35264
|
+
if (data.iterator_val) {
|
|
35265
|
+
set_value(data.iterator_val, data._val);
|
|
35266
|
+
}
|
|
35267
|
+
}
|
|
35268
|
+
};
|
|
35269
|
+
const hover_out = function () {
|
|
35270
|
+
if (is_skeleton) return;
|
|
35323
35271
|
|
|
35324
|
-
|
|
35272
|
+
CLIENT_ACTIVITY_TS = Date.now();
|
|
35273
|
+
if (_$($container)?.data()?.xuData?.debug_info) {
|
|
35274
|
+
_$($container).data().xuData.debug_info.hover_item = null;
|
|
35275
|
+
}
|
|
35276
|
+
if (_ds?.data_system) {
|
|
35277
|
+
SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system.SYS_OBJ_WIN_ELEMENT_HOVERED_ATTRIBUTES = {};
|
|
35278
|
+
}
|
|
35279
|
+
};
|
|
35280
|
+
const render_screen_type = async function ($div) {
|
|
35281
|
+
const set_call_screen_properties_values = async function (ui_framework) {
|
|
35282
|
+
params.properties = {};
|
|
35283
|
+
const get_values = async function (property) {
|
|
35284
|
+
var property_value = paramsP?.screenInfo?.properties?.[property] || paramsP?.screenInfo?.properties?.frameworkProperties?.[property];
|
|
35285
|
+
if (paramsP?.call_screen_propertiesP) {
|
|
35286
|
+
if (paramsP.call_screen_propertiesP?.[property]) {
|
|
35287
|
+
property_value = paramsP.call_screen_propertiesP[property];
|
|
35288
|
+
}
|
|
35289
|
+
if (paramsP.call_screen_propertiesP[`xu-exp:${property}`]) {
|
|
35290
|
+
property_value = (await func.expression.get(SESSION_ID, paramsP.call_screen_propertiesP[`xu-exp:${property}`], paramsP.dsSessionP, property)).result;
|
|
35291
|
+
}
|
|
35292
|
+
}
|
|
35293
|
+
return property_value;
|
|
35294
|
+
};
|
|
35295
|
+
params.properties['name'] = await get_values('menuTitle');
|
|
35296
|
+
if (await ui_framework?.properties()) {
|
|
35297
|
+
for await (const [key, val] of Object.entries(await ui_framework.properties())) {
|
|
35298
|
+
params.properties[key] = await get_values(key);
|
|
35299
|
+
}
|
|
35300
|
+
}
|
|
35301
|
+
};
|
|
35325
35302
|
|
|
35326
|
-
|
|
35327
|
-
// controller_params = {};
|
|
35328
|
-
// }
|
|
35303
|
+
var $div_content = $div.children();
|
|
35329
35304
|
|
|
35330
|
-
|
|
35331
|
-
|
|
35332
|
-
|
|
35333
|
-
|
|
35334
|
-
|
|
35335
|
-
|
|
35336
|
-
// screenInfo: paramsP.screenInfo,
|
|
35337
|
-
// close_callback: close_modal,
|
|
35338
|
-
// paramsP,
|
|
35339
|
-
// };
|
|
35305
|
+
$.each($div_content, function (key, val) {
|
|
35306
|
+
if (!$(val)?.data()?.xuData?.parent_container) {
|
|
35307
|
+
return true;
|
|
35308
|
+
}
|
|
35309
|
+
$(val).data().xuData.parent_container = $div.data().xuData.parent_container;
|
|
35310
|
+
});
|
|
35340
35311
|
|
|
35341
|
-
|
|
35312
|
+
let $ret = $div;
|
|
35313
|
+
var $nav = $(SESSION_OBJ[SESSION_ID].root_element).find('xu-nav');
|
|
35314
|
+
var params;
|
|
35315
|
+
switch (paramsP.screen_type) {
|
|
35316
|
+
case 'modal':
|
|
35317
|
+
const modal_id = 'app_modal-' + paramsP.dsSessionP.toString();
|
|
35318
|
+
var xu_modal_controller = document.querySelector('xu-modal-controller');
|
|
35319
|
+
if (!xu_modal_controller) {
|
|
35320
|
+
func.UI.component.create_app_modal_component(SESSION_ID, modal_id);
|
|
35321
|
+
xu_modal_controller = document.querySelector('xu-modal-controller');
|
|
35322
|
+
}
|
|
35342
35323
|
|
|
35343
|
-
|
|
35344
|
-
// const modalController = await new UI_FRAMEWORK_PLUGIN.modal();
|
|
35345
|
-
// await set_call_screen_properties_values(modalController);
|
|
35346
|
-
// if (!APP_MODAL_OBJ[modal_id]) {
|
|
35347
|
-
// const modal = await modalController.create(params);
|
|
35324
|
+
var controller_params = $(xu_modal_controller).data('xuControllerParams');
|
|
35348
35325
|
|
|
35349
|
-
|
|
35350
|
-
|
|
35351
|
-
|
|
35352
|
-
// }
|
|
35326
|
+
if (!controller_params) {
|
|
35327
|
+
controller_params = {};
|
|
35328
|
+
}
|
|
35353
35329
|
|
|
35354
|
-
|
|
35330
|
+
params = {
|
|
35331
|
+
screenId: paramsP.screenId,
|
|
35332
|
+
$dialogDiv: $div.children(),
|
|
35333
|
+
$container: $container,
|
|
35334
|
+
dsSession: paramsP.dsSessionP,
|
|
35335
|
+
modal_id,
|
|
35336
|
+
screenInfo: paramsP.screenInfo,
|
|
35337
|
+
close_callback: close_modal,
|
|
35338
|
+
paramsP,
|
|
35339
|
+
};
|
|
35355
35340
|
|
|
35356
|
-
|
|
35341
|
+
controller_params[modal_id] = params;
|
|
35357
35342
|
|
|
35358
|
-
|
|
35359
|
-
|
|
35343
|
+
$(xu_modal_controller).data('xuControllerParams', controller_params);
|
|
35344
|
+
const modalController = await new UI_FRAMEWORK_PLUGIN.modal();
|
|
35345
|
+
await set_call_screen_properties_values(modalController);
|
|
35346
|
+
if (!APP_MODAL_OBJ[modal_id]) {
|
|
35347
|
+
const modal = await modalController.create(params);
|
|
35360
35348
|
|
|
35361
|
-
|
|
35362
|
-
|
|
35363
|
-
|
|
35364
|
-
|
|
35365
|
-
// $dialogDiv: $div.children(),
|
|
35366
|
-
// $container: $container,
|
|
35367
|
-
// };
|
|
35349
|
+
APP_MODAL_OBJ[modal_id] = modal;
|
|
35350
|
+
} else {
|
|
35351
|
+
$(modal_id).empty();
|
|
35352
|
+
}
|
|
35368
35353
|
|
|
35369
|
-
|
|
35370
|
-
// const popover = new UI_FRAMEWORK_PLUGIN.popover(SESSION_ID);
|
|
35371
|
-
// await set_call_screen_properties_values(popover);
|
|
35372
|
-
// await popover.open(params);
|
|
35373
|
-
// CURRENT_APP_POPOVER = popover;
|
|
35354
|
+
await modalController.init(params);
|
|
35374
35355
|
|
|
35375
|
-
|
|
35376
|
-
// break;
|
|
35356
|
+
break;
|
|
35377
35357
|
|
|
35378
|
-
|
|
35379
|
-
//
|
|
35358
|
+
case 'popover':
|
|
35359
|
+
// open_popover($div);
|
|
35380
35360
|
|
|
35381
|
-
|
|
35382
|
-
|
|
35383
|
-
|
|
35384
|
-
|
|
35385
|
-
|
|
35386
|
-
|
|
35387
|
-
|
|
35388
|
-
// nav,
|
|
35389
|
-
// paramsP,
|
|
35390
|
-
// };
|
|
35361
|
+
const xu_popover_controller = func.UI.component.create_app_popover_component(SESSION_ID);
|
|
35362
|
+
params = {
|
|
35363
|
+
menuTitle: paramsP.screenInfo.properties?.menuTitle,
|
|
35364
|
+
screenId: paramsP.screenId,
|
|
35365
|
+
$dialogDiv: $div.children(),
|
|
35366
|
+
$container: $container,
|
|
35367
|
+
};
|
|
35391
35368
|
|
|
35392
|
-
|
|
35393
|
-
|
|
35394
|
-
|
|
35395
|
-
|
|
35369
|
+
$(xu_popover_controller).data('xuControllerParams', params);
|
|
35370
|
+
const popover = new UI_FRAMEWORK_PLUGIN.popover(SESSION_ID);
|
|
35371
|
+
await set_call_screen_properties_values(popover);
|
|
35372
|
+
await popover.open(params);
|
|
35373
|
+
CURRENT_APP_POPOVER = popover;
|
|
35396
35374
|
|
|
35397
|
-
|
|
35398
|
-
|
|
35399
|
-
// params.$container.data().xuData.validate_screen_ready = $(nav).data().xuData.params[paramsP.dsSessionP].$container.data().xuData.validate_screen_ready;
|
|
35400
|
-
// }
|
|
35375
|
+
func.UI.utils.screen_blocker(false, paramsP.prog_id + '_' + paramsP.sourceScreenP);
|
|
35376
|
+
break;
|
|
35401
35377
|
|
|
35402
|
-
|
|
35403
|
-
|
|
35404
|
-
// if (!$(component_name).length) {
|
|
35405
|
-
// await func.UI.component.create_app_page_component(SESSION_ID, paramsP.dsSessionP);
|
|
35406
|
-
// const page = new UI_FRAMEWORK_PLUGIN.page();
|
|
35407
|
-
// await set_call_screen_properties_values(page);
|
|
35408
|
-
// await page.create(params);
|
|
35409
|
-
// await page.init(params);
|
|
35410
|
-
// nav.push(component_name, { params });
|
|
35411
|
-
// } else {
|
|
35412
|
-
// debugger;
|
|
35413
|
-
// $(component_name).empty();
|
|
35414
|
-
|
|
35415
|
-
// await UI_FRAMEWORK_PLUGIN.page(SESSION_ID, paramsP.dsSessionP);
|
|
35416
|
-
// }
|
|
35417
|
-
// $div.data().xuData.paramsP = $container.data().xuData.paramsP;
|
|
35418
|
-
// break;
|
|
35419
|
-
|
|
35420
|
-
// case 'panel':
|
|
35421
|
-
// $container.append($div_content);
|
|
35422
|
-
// $ret = $container;
|
|
35423
|
-
// break;
|
|
35424
|
-
|
|
35425
|
-
// default: // set data to nav to use in the component
|
|
35426
|
-
// if ($nav && $nav.length) {
|
|
35427
|
-
// // refresh made
|
|
35428
|
-
// } else {
|
|
35429
|
-
// $nav = $('<xu-nav>'); //.attr('xu-ui-id', SESSION_ID);
|
|
35430
|
-
// $container.append($nav);
|
|
35431
|
-
// func.UI.component.init_xu_nav($container, $nav);
|
|
35432
|
-
// }
|
|
35378
|
+
case 'page':
|
|
35379
|
+
const nav = $nav[0];
|
|
35433
35380
|
|
|
35434
|
-
|
|
35381
|
+
params = {
|
|
35382
|
+
div: $div_content,
|
|
35383
|
+
name: paramsP.screenInfo.properties?.menuTitle,
|
|
35384
|
+
screenId: paramsP.screenId,
|
|
35385
|
+
$container: $container,
|
|
35386
|
+
dsSession: paramsP.dsSessionP,
|
|
35387
|
+
SESSION_ID,
|
|
35388
|
+
nav,
|
|
35389
|
+
paramsP,
|
|
35390
|
+
};
|
|
35435
35391
|
|
|
35436
|
-
|
|
35437
|
-
|
|
35438
|
-
|
|
35439
|
-
|
|
35440
|
-
// return $ret;
|
|
35441
|
-
// };
|
|
35392
|
+
var component_name = 'xu-page-component-' + paramsP.dsSessionP;
|
|
35393
|
+
if (!$(nav).data().xuData.nav_params) {
|
|
35394
|
+
$(nav).data().xuData.nav_params = {};
|
|
35395
|
+
}
|
|
35442
35396
|
|
|
35443
|
-
//
|
|
35444
|
-
|
|
35445
|
-
|
|
35446
|
-
|
|
35447
|
-
// var _session = SESSION_OBJ[SESSION_ID];
|
|
35448
|
-
|
|
35449
|
-
// var exist_elm_obj = get_element_info();
|
|
35450
|
-
// var $div = exist_elm_obj.div;
|
|
35451
|
-
// if (!exist_elm_obj.div) {
|
|
35452
|
-
// $div = await 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);
|
|
35453
|
-
|
|
35454
|
-
// //////////////////////////
|
|
35455
|
-
|
|
35456
|
-
// let plugin_name = prop['xu-widget'],
|
|
35457
|
-
// method = prop['xu-method'],
|
|
35458
|
-
// dsP = paramsP.dsSessionP,
|
|
35459
|
-
// propsP = prop,
|
|
35460
|
-
// sourceP = 'widgets';
|
|
35461
|
-
|
|
35462
|
-
// // const set_SYS_GLOBAL_OBJ_WIDGET_INFO = async function (docP) {
|
|
35463
|
-
// // var obj = _.clone(docP);
|
|
35464
|
-
// // obj.date = await func.utils.get_dateTime(
|
|
35465
|
-
// // SESSION_ID,
|
|
35466
|
-
// // "SYS_DATE",
|
|
35467
|
-
// // docP.date
|
|
35468
|
-
// // );
|
|
35469
|
-
// // obj.time = await func.utils.get_dateTime(
|
|
35470
|
-
// // SESSION_ID,
|
|
35471
|
-
// // "SYS_TIME",
|
|
35472
|
-
// // docP.date
|
|
35473
|
-
// // );
|
|
35474
|
-
|
|
35475
|
-
// // var datasource_changes = {
|
|
35476
|
-
// // [0]: {
|
|
35477
|
-
// // ["data_system"]: {
|
|
35478
|
-
// // ["SYS_GLOBAL_OBJ_WIDGET_INFO"]: obj,
|
|
35479
|
-
// // },
|
|
35480
|
-
// // },
|
|
35481
|
-
// // };
|
|
35482
|
-
// // await func.datasource.update(SESSION_ID, datasource_changes);
|
|
35483
|
-
// // };
|
|
35484
|
-
// const call_plugin_api = async function (plugin_nameP, dataP) {
|
|
35485
|
-
// return await func.utils.call_plugin_api(SESSION_ID, plugin_nameP, dataP);
|
|
35486
|
-
// };
|
|
35487
|
-
// const report_error = function (descP, warn) {
|
|
35488
|
-
// func.utils.debug.log(SESSION_ID, _session.DS_GLB[dsP].prog_id + '_' + _session.DS_GLB[dsP].callingMenuId, {
|
|
35489
|
-
// module: 'widgets',
|
|
35490
|
-
// action: 'Init',
|
|
35491
|
-
// source: sourceP,
|
|
35492
|
-
// prop: descP,
|
|
35493
|
-
// details: descP,
|
|
35494
|
-
// result: null,
|
|
35495
|
-
// error: warn ? false : true,
|
|
35496
|
-
// fields: null,
|
|
35497
|
-
// type: 'widgets',
|
|
35498
|
-
// prog_id: _session.DS_GLB[dsP].prog_id,
|
|
35499
|
-
// });
|
|
35500
|
-
// };
|
|
35501
|
-
// const get_fields_data = async function (fields, props) {
|
|
35502
|
-
// const report_error = function (descP, warn) {
|
|
35503
|
-
// func.utils.debug.log(SESSION_ID, _session.DS_GLB[dsP].prog_id + '_' + _session.DS_GLB[dsP].callingMenuId, {
|
|
35504
|
-
// module: 'widgets',
|
|
35505
|
-
// action: 'Init',
|
|
35506
|
-
// source: sourceP,
|
|
35507
|
-
// prop: descP,
|
|
35508
|
-
// details: descP,
|
|
35509
|
-
// result: null,
|
|
35510
|
-
// error: warn ? false : true,
|
|
35511
|
-
// fields: null,
|
|
35512
|
-
// type: 'widgets',
|
|
35513
|
-
// prog_id: _session.DS_GLB[dsP].prog_id,
|
|
35514
|
-
// });
|
|
35515
|
-
// };
|
|
35516
|
-
// const get_property_value = async function (fieldIdP, val) {
|
|
35517
|
-
// if (!val) return;
|
|
35518
|
-
// var value = fieldIdP in props ? props[fieldIdP] : typeof val.defaultValue === 'function' ? val?.defaultValue?.() : val?.defaultValue;
|
|
35519
|
-
// if (val.render === 'eventId') {
|
|
35520
|
-
// value = props?.[fieldIdP]?.event;
|
|
35521
|
-
// }
|
|
35397
|
+
//restore validate
|
|
35398
|
+
if ($(nav)?.data()?.xuData?.params?.[paramsP.dsSessionP]) {
|
|
35399
|
+
params.$container.data().xuData.validate_screen_ready = $(nav).data().xuData.params[paramsP.dsSessionP].$container.data().xuData.validate_screen_ready;
|
|
35400
|
+
}
|
|
35522
35401
|
|
|
35523
|
-
|
|
35524
|
-
|
|
35525
|
-
|
|
35402
|
+
if (!$(nav)?.data()?.xuData) return;
|
|
35403
|
+
$(nav).data().xuData.nav_params[paramsP.dsSessionP] = params;
|
|
35404
|
+
if (!$(component_name).length) {
|
|
35405
|
+
await func.UI.component.create_app_page_component(SESSION_ID, paramsP.dsSessionP);
|
|
35406
|
+
const page = new UI_FRAMEWORK_PLUGIN.page();
|
|
35407
|
+
await set_call_screen_properties_values(page);
|
|
35408
|
+
await page.create(params);
|
|
35409
|
+
await page.init(params);
|
|
35410
|
+
nav.push(component_name, { params });
|
|
35411
|
+
} else {
|
|
35412
|
+
debugger;
|
|
35413
|
+
$(component_name).empty();
|
|
35526
35414
|
|
|
35527
|
-
|
|
35528
|
-
|
|
35529
|
-
|
|
35530
|
-
|
|
35531
|
-
// val.type, //val.type !== "string" || val.type !== "number" ? "string" : val.type,
|
|
35532
|
-
// value,
|
|
35533
|
-
// null,
|
|
35534
|
-
// );
|
|
35535
|
-
// };
|
|
35536
|
-
// var data_obj = {};
|
|
35537
|
-
// var return_code = 1;
|
|
35538
|
-
// // $.each(fields, function (key, val) {
|
|
35539
|
-
// for await (const [key, val] of Object.entries(fields)) {
|
|
35540
|
-
// data_obj[key] = await get_property_value(key, val);
|
|
35541
|
-
// if (!data_obj[key] && val.mandatory) {
|
|
35542
|
-
// return_code = -1;
|
|
35543
|
-
// report_error(`${key} is a mandatory field.`);
|
|
35544
|
-
// break;
|
|
35545
|
-
// }
|
|
35546
|
-
// // console.log(val);
|
|
35547
|
-
// }
|
|
35548
|
-
// for await (const key of ['xu-bind']) {
|
|
35549
|
-
// data_obj[key] = await get_property_value(key, props[key]);
|
|
35550
|
-
// }
|
|
35415
|
+
await UI_FRAMEWORK_PLUGIN.page(SESSION_ID, paramsP.dsSessionP);
|
|
35416
|
+
}
|
|
35417
|
+
$div.data().xuData.paramsP = $container.data().xuData.paramsP;
|
|
35418
|
+
break;
|
|
35551
35419
|
|
|
35552
|
-
|
|
35553
|
-
|
|
35420
|
+
case 'panel':
|
|
35421
|
+
$container.append($div_content);
|
|
35422
|
+
$ret = $container;
|
|
35423
|
+
break;
|
|
35554
35424
|
|
|
35555
|
-
//
|
|
35556
|
-
|
|
35557
|
-
//
|
|
35558
|
-
|
|
35559
|
-
|
|
35560
|
-
|
|
35561
|
-
|
|
35562
|
-
|
|
35563
|
-
// func.utils.load_css_on_demand(path);
|
|
35564
|
-
// };
|
|
35425
|
+
default: // set data to nav to use in the component
|
|
35426
|
+
if ($nav && $nav.length) {
|
|
35427
|
+
// refresh made
|
|
35428
|
+
} else {
|
|
35429
|
+
$nav = $('<xu-nav>'); //.attr('xu-ui-id', SESSION_ID);
|
|
35430
|
+
$container.append($nav);
|
|
35431
|
+
func.UI.component.init_xu_nav($container, $nav);
|
|
35432
|
+
}
|
|
35565
35433
|
|
|
35566
|
-
|
|
35567
|
-
// const index = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${_plugin.manifest['index.mjs'].dist ? 'dist/' : ''}index.mjs`);
|
|
35568
|
-
// const methods = index.methods;
|
|
35569
|
-
// if (methods && !methods[method]) {
|
|
35570
|
-
// return report_error('method not found');
|
|
35571
|
-
// }
|
|
35434
|
+
$nav.data().xuData.$div = $div_content;
|
|
35572
35435
|
|
|
35573
|
-
|
|
35574
|
-
|
|
35575
|
-
|
|
35576
|
-
|
|
35577
|
-
|
|
35436
|
+
await $nav[0].setRoot('xu-root-component-' + SESSION_ID);
|
|
35437
|
+
$ret = $container;
|
|
35438
|
+
break;
|
|
35439
|
+
}
|
|
35440
|
+
return $ret;
|
|
35441
|
+
};
|
|
35578
35442
|
|
|
35579
|
-
|
|
35580
|
-
|
|
35581
|
-
|
|
35582
|
-
|
|
35583
|
-
|
|
35584
|
-
// }
|
|
35443
|
+
if (!(await init())) return;
|
|
35444
|
+
debug();
|
|
35445
|
+
const fx = {
|
|
35446
|
+
widget: async function () {
|
|
35447
|
+
var _session = SESSION_OBJ[SESSION_ID];
|
|
35585
35448
|
|
|
35586
|
-
|
|
35449
|
+
var exist_elm_obj = get_element_info();
|
|
35450
|
+
var $div = exist_elm_obj.div;
|
|
35451
|
+
if (!exist_elm_obj.div) {
|
|
35452
|
+
$div = await 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);
|
|
35587
35453
|
|
|
35588
|
-
|
|
35454
|
+
//////////////////////////
|
|
35455
|
+
|
|
35456
|
+
let plugin_name = prop['xu-widget'],
|
|
35457
|
+
method = prop['xu-method'],
|
|
35458
|
+
dsP = paramsP.dsSessionP,
|
|
35459
|
+
propsP = prop,
|
|
35460
|
+
sourceP = 'widgets';
|
|
35461
|
+
|
|
35462
|
+
// const set_SYS_GLOBAL_OBJ_WIDGET_INFO = async function (docP) {
|
|
35463
|
+
// var obj = _.clone(docP);
|
|
35464
|
+
// obj.date = await func.utils.get_dateTime(
|
|
35465
|
+
// SESSION_ID,
|
|
35466
|
+
// "SYS_DATE",
|
|
35467
|
+
// docP.date
|
|
35468
|
+
// );
|
|
35469
|
+
// obj.time = await func.utils.get_dateTime(
|
|
35470
|
+
// SESSION_ID,
|
|
35471
|
+
// "SYS_TIME",
|
|
35472
|
+
// docP.date
|
|
35473
|
+
// );
|
|
35474
|
+
|
|
35475
|
+
// var datasource_changes = {
|
|
35476
|
+
// [0]: {
|
|
35477
|
+
// ["data_system"]: {
|
|
35478
|
+
// ["SYS_GLOBAL_OBJ_WIDGET_INFO"]: obj,
|
|
35479
|
+
// },
|
|
35480
|
+
// },
|
|
35481
|
+
// };
|
|
35482
|
+
// await func.datasource.update(SESSION_ID, datasource_changes);
|
|
35483
|
+
// };
|
|
35484
|
+
const call_plugin_api = async function (plugin_nameP, dataP) {
|
|
35485
|
+
return await func.utils.call_plugin_api(SESSION_ID, plugin_nameP, dataP);
|
|
35486
|
+
};
|
|
35487
|
+
const report_error = function (descP, warn) {
|
|
35488
|
+
func.utils.debug.log(SESSION_ID, _session.DS_GLB[dsP].prog_id + '_' + _session.DS_GLB[dsP].callingMenuId, {
|
|
35489
|
+
module: 'widgets',
|
|
35490
|
+
action: 'Init',
|
|
35491
|
+
source: sourceP,
|
|
35492
|
+
prop: descP,
|
|
35493
|
+
details: descP,
|
|
35494
|
+
result: null,
|
|
35495
|
+
error: warn ? false : true,
|
|
35496
|
+
fields: null,
|
|
35497
|
+
type: 'widgets',
|
|
35498
|
+
prog_id: _session.DS_GLB[dsP].prog_id,
|
|
35499
|
+
});
|
|
35500
|
+
};
|
|
35501
|
+
const get_fields_data = async function (fields, props) {
|
|
35502
|
+
const report_error = function (descP, warn) {
|
|
35503
|
+
func.utils.debug.log(SESSION_ID, _session.DS_GLB[dsP].prog_id + '_' + _session.DS_GLB[dsP].callingMenuId, {
|
|
35504
|
+
module: 'widgets',
|
|
35505
|
+
action: 'Init',
|
|
35506
|
+
source: sourceP,
|
|
35507
|
+
prop: descP,
|
|
35508
|
+
details: descP,
|
|
35509
|
+
result: null,
|
|
35510
|
+
error: warn ? false : true,
|
|
35511
|
+
fields: null,
|
|
35512
|
+
type: 'widgets',
|
|
35513
|
+
prog_id: _session.DS_GLB[dsP].prog_id,
|
|
35514
|
+
});
|
|
35515
|
+
};
|
|
35516
|
+
const get_property_value = async function (fieldIdP, val) {
|
|
35517
|
+
if (!val) return;
|
|
35518
|
+
var value = fieldIdP in props ? props[fieldIdP] : typeof val.defaultValue === 'function' ? val?.defaultValue?.() : val?.defaultValue;
|
|
35519
|
+
if (val.render === 'eventId') {
|
|
35520
|
+
value = props?.[fieldIdP]?.event;
|
|
35521
|
+
}
|
|
35589
35522
|
|
|
35590
|
-
|
|
35591
|
-
|
|
35592
|
-
|
|
35523
|
+
if (props[`xu-exp:${fieldIdP}`]) {
|
|
35524
|
+
value = (await func.expression.get(SESSION_ID, props[`xu-exp:${fieldIdP}`], dsP, 'widget property')).result;
|
|
35525
|
+
}
|
|
35593
35526
|
|
|
35594
|
-
|
|
35595
|
-
|
|
35596
|
-
|
|
35527
|
+
return func.common.get_cast_val(
|
|
35528
|
+
SESSION_ID,
|
|
35529
|
+
'widgets',
|
|
35530
|
+
fieldIdP,
|
|
35531
|
+
val.type, //val.type !== "string" || val.type !== "number" ? "string" : val.type,
|
|
35532
|
+
value,
|
|
35533
|
+
null,
|
|
35534
|
+
);
|
|
35535
|
+
};
|
|
35536
|
+
var data_obj = {};
|
|
35537
|
+
var return_code = 1;
|
|
35538
|
+
// $.each(fields, function (key, val) {
|
|
35539
|
+
for await (const [key, val] of Object.entries(fields)) {
|
|
35540
|
+
data_obj[key] = await get_property_value(key, val);
|
|
35541
|
+
if (!data_obj[key] && val.mandatory) {
|
|
35542
|
+
return_code = -1;
|
|
35543
|
+
report_error(`${key} is a mandatory field.`);
|
|
35544
|
+
break;
|
|
35545
|
+
}
|
|
35546
|
+
// console.log(val);
|
|
35547
|
+
}
|
|
35548
|
+
for await (const key of ['xu-bind']) {
|
|
35549
|
+
data_obj[key] = await get_property_value(key, props[key]);
|
|
35550
|
+
}
|
|
35597
35551
|
|
|
35598
|
-
|
|
35599
|
-
|
|
35600
|
-
// return report_error(plugin_setup_ret);
|
|
35601
|
-
// }
|
|
35552
|
+
return { code: return_code, data: data_obj };
|
|
35553
|
+
};
|
|
35602
35554
|
|
|
35603
|
-
|
|
35604
|
-
|
|
35605
|
-
|
|
35606
|
-
|
|
35607
|
-
|
|
35608
|
-
|
|
35609
|
-
|
|
35610
|
-
|
|
35611
|
-
|
|
35555
|
+
const load_css_style = function () {
|
|
35556
|
+
const get_css_path = function (resource) {
|
|
35557
|
+
if (_session.worker_type === 'Dev') {
|
|
35558
|
+
return `../../plugins/${plugin_name}/${resource}`;
|
|
35559
|
+
}
|
|
35560
|
+
return `https://${_session.domain}/plugins/${plugin_name}/${APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name].manifest[resource].dist ? 'dist/' : ''}${resource}?gtp_token=${_session.gtp_token}&app_id=${_session.app_id}`;
|
|
35561
|
+
};
|
|
35562
|
+
let path = get_css_path('style.css');
|
|
35563
|
+
func.utils.load_css_on_demand(path);
|
|
35564
|
+
};
|
|
35612
35565
|
|
|
35613
|
-
|
|
35614
|
-
|
|
35615
|
-
|
|
35616
|
-
|
|
35617
|
-
|
|
35618
|
-
|
|
35619
|
-
// propsP,
|
|
35620
|
-
// plugin_name,
|
|
35621
|
-
// $containerP: $div,
|
|
35622
|
-
// plugin_setup: plugin_setup_ret.data,
|
|
35623
|
-
|
|
35624
|
-
// report_error,
|
|
35625
|
-
// call_plugin_api,
|
|
35626
|
-
// // set_SYS_GLOBAL_OBJ_WIDGET_INFO,
|
|
35627
|
-
// api_utils,
|
|
35628
|
-
// };
|
|
35566
|
+
const _plugin = APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
|
|
35567
|
+
const index = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${_plugin.manifest['index.mjs'].dist ? 'dist/' : ''}index.mjs`);
|
|
35568
|
+
const methods = index.methods;
|
|
35569
|
+
if (methods && !methods[method]) {
|
|
35570
|
+
return report_error('method not found');
|
|
35571
|
+
}
|
|
35629
35572
|
|
|
35630
|
-
|
|
35573
|
+
const fields_ret = await get_fields_data(methods[method].fields, propsP);
|
|
35574
|
+
if (fields_ret.code < 0) {
|
|
35575
|
+
return report_error(fields_ret.data);
|
|
35576
|
+
}
|
|
35577
|
+
const fields = fields_ret.data;
|
|
35631
35578
|
|
|
35632
|
-
|
|
35633
|
-
|
|
35634
|
-
|
|
35635
|
-
|
|
35579
|
+
let exclude_attributes = [];
|
|
35580
|
+
for await (const [key, val] of Object.entries(propsP)) {
|
|
35581
|
+
if (typeof fields[key] !== 'undefined' || typeof fields[`xu-exp:${key}`] !== 'undefined') {
|
|
35582
|
+
exclude_attributes.push(key);
|
|
35583
|
+
}
|
|
35584
|
+
}
|
|
35636
35585
|
|
|
35637
|
-
|
|
35638
|
-
// throw `Method: ${method} does not exist`;
|
|
35639
|
-
// }
|
|
35640
|
-
// try {
|
|
35641
|
-
// await fx[method](fields, params);
|
|
35642
|
-
// } catch (err) {
|
|
35643
|
-
// func.utils.debug_report(SESSION_ID, `${plugin_name} widget`, err.message, 'E');
|
|
35644
|
-
// }
|
|
35645
|
-
// }
|
|
35646
|
-
// return $div;
|
|
35647
|
-
// },
|
|
35648
|
-
// [`xu-single-view`]: async function () {
|
|
35649
|
-
// var exist_elm_obj = get_element_info();
|
|
35650
|
-
// var $div = exist_elm_obj.div;
|
|
35586
|
+
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);
|
|
35651
35587
|
|
|
35652
|
-
|
|
35653
|
-
// var $wrapper = $('<div>');
|
|
35654
|
-
// $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, 'div', $wrapper, '');
|
|
35588
|
+
$div.addClass('widget_wrapper'); // class get override in set_attributes_new
|
|
35655
35589
|
|
|
35656
|
-
|
|
35590
|
+
if (!APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name]) {
|
|
35591
|
+
return report_error(`plugin ${plugin_name} not found`);
|
|
35592
|
+
}
|
|
35657
35593
|
|
|
35658
|
-
|
|
35659
|
-
|
|
35660
|
-
|
|
35594
|
+
if (APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name].manifest['style.css'].exist) {
|
|
35595
|
+
load_css_style();
|
|
35596
|
+
}
|
|
35661
35597
|
|
|
35662
|
-
|
|
35663
|
-
|
|
35664
|
-
|
|
35665
|
-
|
|
35666
|
-
// },
|
|
35667
|
-
// function (e) {
|
|
35668
|
-
// // func.UI.screen.hover_out(SESSION_ID, $container, is_skeleton, paramsP);
|
|
35669
|
-
// hover_out();
|
|
35670
|
-
// },
|
|
35671
|
-
// );
|
|
35672
|
-
// }
|
|
35598
|
+
const plugin_setup_ret = await func.utils.get_plugin_setup(SESSION_ID, plugin_name);
|
|
35599
|
+
if (plugin_setup_ret.code < 0) {
|
|
35600
|
+
return report_error(plugin_setup_ret);
|
|
35601
|
+
}
|
|
35673
35602
|
|
|
35674
|
-
|
|
35675
|
-
|
|
35676
|
-
|
|
35677
|
-
|
|
35603
|
+
const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
|
|
35604
|
+
func,
|
|
35605
|
+
glb,
|
|
35606
|
+
SESSION_OBJ,
|
|
35607
|
+
SESSION_ID,
|
|
35608
|
+
APP_OBJ,
|
|
35609
|
+
dsSession: paramsP.dsSessionP,
|
|
35610
|
+
job_id: jobNoP,
|
|
35611
|
+
});
|
|
35678
35612
|
|
|
35679
|
-
|
|
35680
|
-
|
|
35681
|
-
|
|
35682
|
-
|
|
35683
|
-
|
|
35684
|
-
|
|
35685
|
-
|
|
35613
|
+
const params = {
|
|
35614
|
+
SESSION_ID,
|
|
35615
|
+
method,
|
|
35616
|
+
_session,
|
|
35617
|
+
dsP,
|
|
35618
|
+
sourceP,
|
|
35619
|
+
propsP,
|
|
35620
|
+
plugin_name,
|
|
35621
|
+
$containerP: $div,
|
|
35622
|
+
plugin_setup: plugin_setup_ret.data,
|
|
35686
35623
|
|
|
35687
|
-
|
|
35688
|
-
|
|
35689
|
-
//
|
|
35690
|
-
|
|
35624
|
+
report_error,
|
|
35625
|
+
call_plugin_api,
|
|
35626
|
+
// set_SYS_GLOBAL_OBJ_WIDGET_INFO,
|
|
35627
|
+
api_utils,
|
|
35628
|
+
};
|
|
35691
35629
|
|
|
35692
|
-
|
|
35693
|
-
// $div.data().xuData.node = nodeP;
|
|
35694
|
-
// }
|
|
35630
|
+
const fx = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${_plugin.manifest['runtime.mjs'].dist ? 'dist/' : ''}runtime.mjs`);
|
|
35695
35631
|
|
|
35696
|
-
|
|
35697
|
-
|
|
35698
|
-
|
|
35699
|
-
|
|
35700
|
-
// };
|
|
35701
|
-
// }
|
|
35632
|
+
if (_plugin?.manifest?.['runtime.mjs'].dist && _plugin?.manifest?.['runtime.mjs']?.css) {
|
|
35633
|
+
const plugin_runtime_css_url = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, 'dist/runtime.css');
|
|
35634
|
+
func.utils.load_css_on_demand(plugin_runtime_css_url);
|
|
35635
|
+
}
|
|
35702
35636
|
|
|
35703
|
-
|
|
35704
|
-
|
|
35705
|
-
|
|
35706
|
-
|
|
35707
|
-
|
|
35708
|
-
|
|
35709
|
-
|
|
35710
|
-
|
|
35711
|
-
|
|
35712
|
-
|
|
35713
|
-
|
|
35714
|
-
|
|
35715
|
-
|
|
35716
|
-
|
|
35717
|
-
// // $div_content.attr('dir', 'rtl');
|
|
35718
|
-
// // }
|
|
35719
|
-
|
|
35720
|
-
// // return $div;
|
|
35721
|
-
// // };
|
|
35722
|
-
// await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
|
|
35723
|
-
|
|
35724
|
-
// return await render_screen_type($div);
|
|
35725
|
-
// };
|
|
35637
|
+
if (!fx[method]) {
|
|
35638
|
+
throw `Method: ${method} does not exist`;
|
|
35639
|
+
}
|
|
35640
|
+
try {
|
|
35641
|
+
await fx[method](fields, params);
|
|
35642
|
+
} catch (err) {
|
|
35643
|
+
func.utils.debug_report(SESSION_ID, `${plugin_name} widget`, err.message, 'E');
|
|
35644
|
+
}
|
|
35645
|
+
}
|
|
35646
|
+
return $div;
|
|
35647
|
+
},
|
|
35648
|
+
[`xu-single-view`]: async function () {
|
|
35649
|
+
var exist_elm_obj = get_element_info();
|
|
35650
|
+
var $div = exist_elm_obj.div;
|
|
35726
35651
|
|
|
35727
|
-
|
|
35728
|
-
|
|
35729
|
-
|
|
35652
|
+
if (!exist_elm_obj.div) {
|
|
35653
|
+
var $wrapper = $('<div>');
|
|
35654
|
+
$div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, 'div', $wrapper, '');
|
|
35730
35655
|
|
|
35731
|
-
|
|
35732
|
-
// // var content = prop.empty_result_content || '';
|
|
35733
|
-
|
|
35734
|
-
// // var res = await func.expression.get(
|
|
35735
|
-
// // SESSION_ID,
|
|
35736
|
-
// // content, // prop["xu-exp:empty_result_content"],
|
|
35737
|
-
// // paramsP.dsSessionP,
|
|
35738
|
-
// // 'empty_result_content_EXP',
|
|
35739
|
-
// // _ds.currentRecordId,
|
|
35740
|
-
// // );
|
|
35741
|
-
// // content = res.result;
|
|
35742
|
-
|
|
35743
|
-
// // let empty_result_node = {
|
|
35744
|
-
// // type: 'element',
|
|
35745
|
-
// // id: crypto.randomUUID(),
|
|
35746
|
-
// // content,
|
|
35747
|
-
// // // : content || (typeof content === "undefined" && "Empty results"),
|
|
35748
|
-
// // tagName: 'div',
|
|
35749
|
-
// // attributes: {},
|
|
35750
|
-
// // children: [],
|
|
35751
|
-
// // };
|
|
35752
|
-
|
|
35753
|
-
// // 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);
|
|
35754
|
-
// await func.events.validate(SESSION_ID, 'record_not_found', paramsP.dsSessionP);
|
|
35755
|
-
// return await done(null);
|
|
35756
|
-
// };
|
|
35757
|
-
// var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
|
|
35656
|
+
if (!$div) return;
|
|
35758
35657
|
|
|
35759
|
-
|
|
35658
|
+
if (!REFRESHER_IN_PROGRESS && (paramsP.is_mobile_popover || paramsP.is_mobile_page)) {
|
|
35659
|
+
close_all_modals();
|
|
35660
|
+
}
|
|
35760
35661
|
|
|
35761
|
-
|
|
35762
|
-
|
|
35763
|
-
|
|
35662
|
+
$div.hover(
|
|
35663
|
+
function (e) {
|
|
35664
|
+
hover_in();
|
|
35665
|
+
// func.UI.screen.hover_in(SESSION_ID, null, $container, paramsP, is_skeleton);
|
|
35666
|
+
},
|
|
35667
|
+
function (e) {
|
|
35668
|
+
// func.UI.screen.hover_out(SESSION_ID, $container, is_skeleton, paramsP);
|
|
35669
|
+
hover_out();
|
|
35670
|
+
},
|
|
35671
|
+
);
|
|
35672
|
+
}
|
|
35764
35673
|
|
|
35765
|
-
|
|
35766
|
-
|
|
35767
|
-
|
|
35674
|
+
const ret = await iterate_child($div, nodeP, null, $div);
|
|
35675
|
+
if (_.isEmpty($container.data().xuAttributes)) {
|
|
35676
|
+
await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
|
|
35677
|
+
}
|
|
35768
35678
|
|
|
35769
|
-
|
|
35770
|
-
|
|
35679
|
+
$.each($div.data().xuData, function (key, val) {
|
|
35680
|
+
$container.data().xuData[key] = _.cloneDeep(val);
|
|
35681
|
+
});
|
|
35682
|
+
$.each($div.data().xuAttributes, function (key, val) {
|
|
35683
|
+
// $container.data().xuAttributes[key] = _.cloneDeep(val);
|
|
35684
|
+
$container.data().xuAttributes[key] = klona.klona(val);
|
|
35685
|
+
});
|
|
35771
35686
|
|
|
35772
|
-
|
|
35773
|
-
|
|
35774
|
-
|
|
35775
|
-
|
|
35687
|
+
return await render_screen_type($div);
|
|
35688
|
+
},
|
|
35689
|
+
[`xu-multi-view`]: async function () {
|
|
35690
|
+
var $div = $container;
|
|
35776
35691
|
|
|
35777
|
-
|
|
35778
|
-
|
|
35779
|
-
|
|
35780
|
-
// const done = async function ($new_div) {
|
|
35781
|
-
// if (!$container.data()?.xuData?.paramsP) {
|
|
35782
|
-
// return $container;
|
|
35783
|
-
// }
|
|
35784
|
-
// var $div_items = $div.data().xuData.node.children;
|
|
35692
|
+
if (!$div.data().xuData.node || !$div.data().xuData.node.children) {
|
|
35693
|
+
$div.data().xuData.node = nodeP;
|
|
35694
|
+
}
|
|
35785
35695
|
|
|
35786
|
-
|
|
35696
|
+
if (!$div.data().xuData.debug_info) {
|
|
35697
|
+
$div.data().xuData.debug_info = {
|
|
35698
|
+
id: nodeP.id,
|
|
35699
|
+
parent_id: $container.data().xuData.ui_id,
|
|
35700
|
+
};
|
|
35701
|
+
}
|
|
35787
35702
|
|
|
35788
|
-
|
|
35789
|
-
//
|
|
35703
|
+
const done = async function (continuous_idx) {
|
|
35704
|
+
// const do_callback = async function ($div) {
|
|
35705
|
+
// // if ($root_container.data().xuData.progress_bar_circle) {
|
|
35706
|
+
// // setTimeout(function () {
|
|
35707
|
+
// // $.each(
|
|
35708
|
+
// // $root_container.data().xuData.progress_bar_circle,
|
|
35709
|
+
// // function (key, val) {
|
|
35710
|
+
// // val.bar.set(parseFloat(val.value)); // Number from 0.0 to 1.0
|
|
35711
|
+
// // }
|
|
35712
|
+
// // );
|
|
35713
|
+
// // }, 2000);
|
|
35714
|
+
// // }
|
|
35715
|
+
|
|
35716
|
+
// if (paramsP.screenInfo.properties?.rtl) {
|
|
35717
|
+
// $div_content.attr('dir', 'rtl');
|
|
35718
|
+
// }
|
|
35790
35719
|
|
|
35791
|
-
//
|
|
35792
|
-
//
|
|
35720
|
+
// return $div;
|
|
35721
|
+
// };
|
|
35722
|
+
await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
|
|
35793
35723
|
|
|
35794
|
-
|
|
35795
|
-
|
|
35724
|
+
return await render_screen_type($div);
|
|
35725
|
+
};
|
|
35796
35726
|
|
|
35797
|
-
|
|
35798
|
-
|
|
35799
|
-
|
|
35800
|
-
// return (ret.$new_div = $('<template>').append($div));
|
|
35801
|
-
// }
|
|
35727
|
+
if (!REFRESHER_IN_PROGRESS && (paramsP.is_mobile_popover || paramsP.is_mobile_page)) {
|
|
35728
|
+
close_all_modals();
|
|
35729
|
+
}
|
|
35802
35730
|
|
|
35803
|
-
|
|
35731
|
+
const empty_result = async function () {
|
|
35732
|
+
// var content = prop.empty_result_content || '';
|
|
35733
|
+
|
|
35734
|
+
// var res = await func.expression.get(
|
|
35735
|
+
// SESSION_ID,
|
|
35736
|
+
// content, // prop["xu-exp:empty_result_content"],
|
|
35737
|
+
// paramsP.dsSessionP,
|
|
35738
|
+
// 'empty_result_content_EXP',
|
|
35739
|
+
// _ds.currentRecordId,
|
|
35740
|
+
// );
|
|
35741
|
+
// content = res.result;
|
|
35742
|
+
|
|
35743
|
+
// let empty_result_node = {
|
|
35744
|
+
// type: 'element',
|
|
35745
|
+
// id: crypto.randomUUID(),
|
|
35746
|
+
// content,
|
|
35747
|
+
// // : content || (typeof content === "undefined" && "Empty results"),
|
|
35748
|
+
// tagName: 'div',
|
|
35749
|
+
// attributes: {},
|
|
35750
|
+
// children: [],
|
|
35751
|
+
// };
|
|
35804
35752
|
|
|
35805
|
-
//
|
|
35806
|
-
|
|
35807
|
-
|
|
35808
|
-
|
|
35809
|
-
|
|
35810
|
-
// }
|
|
35753
|
+
// 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);
|
|
35754
|
+
await func.events.validate(SESSION_ID, 'record_not_found', paramsP.dsSessionP);
|
|
35755
|
+
return await done(null);
|
|
35756
|
+
};
|
|
35757
|
+
var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
|
|
35811
35758
|
|
|
35812
|
-
|
|
35759
|
+
var continuous_idx = null;
|
|
35813
35760
|
|
|
35814
|
-
|
|
35815
|
-
|
|
35816
|
-
|
|
35761
|
+
if (!_ds.data_feed || _.isEmpty(_ds.data_feed.rows)) {
|
|
35762
|
+
return await empty_result();
|
|
35763
|
+
}
|
|
35817
35764
|
|
|
35818
|
-
|
|
35819
|
-
|
|
35820
|
-
|
|
35821
|
-
// };
|
|
35822
|
-
// if (!element || element === 'script') return await done();
|
|
35823
|
-
// let str = '';
|
|
35765
|
+
var i = 0;
|
|
35766
|
+
for await (const [key, val] of Object.entries(_ds.data_feed.rows)) {
|
|
35767
|
+
var node = JSON.parse(JSON.stringify(nodeP));
|
|
35824
35768
|
|
|
35825
|
-
|
|
35769
|
+
_ds.currentRecordId = val._ROWID;
|
|
35770
|
+
const ret = await iterate_child($div, node, { continuous_idx }, $root_container);
|
|
35826
35771
|
|
|
35827
|
-
|
|
35828
|
-
|
|
35829
|
-
|
|
35830
|
-
|
|
35831
|
-
// function (e) {
|
|
35832
|
-
// hover_out();
|
|
35833
|
-
// },
|
|
35834
|
-
// );
|
|
35835
|
-
// if (paramsP.paramsP === 'grid' || parent_infoP?.iterate_info) {
|
|
35836
|
-
// $div.on('click contextmenu', function (e) {
|
|
35837
|
-
// hover_in($div, e);
|
|
35838
|
-
// });
|
|
35839
|
-
// }
|
|
35772
|
+
if (_.isEmpty($container.data().xuAttributes)) {
|
|
35773
|
+
await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
|
|
35774
|
+
}
|
|
35775
|
+
}
|
|
35840
35776
|
|
|
35841
|
-
|
|
35842
|
-
|
|
35843
|
-
|
|
35844
|
-
|
|
35845
|
-
|
|
35846
|
-
|
|
35847
|
-
|
|
35848
|
-
|
|
35849
|
-
// // const xu_viewport = async function () {
|
|
35850
|
-
// // const data = { $div: $div.clone(true), nodeP, parent_infoP, $root_container, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, $container };
|
|
35851
|
-
// // const container_id = $container.attr('xu-ui-id');
|
|
35852
|
-
// // if (!UI_WORKER_OBJ.pending_for_viewport_render[container_id]) {
|
|
35853
|
-
// // UI_WORKER_OBJ.pending_for_viewport_render[container_id] = { base_$div: $div, data: [], $container };
|
|
35854
|
-
// // await iterate_child($div, nodeP, parent_infoP, $root_container);
|
|
35855
|
-
// // } else {
|
|
35856
|
-
// // $div.remove();
|
|
35857
|
-
// // }
|
|
35858
|
-
// // UI_WORKER_OBJ.pending_for_viewport_render[container_id].data.push(data);
|
|
35859
|
-
|
|
35860
|
-
// // // if (!$div.children().length) {
|
|
35861
|
-
// // // // render the first element to determine height
|
|
35862
|
-
// // // await iterate_child($div, nodeP, parent_infoP, $root_container);
|
|
35863
|
-
// // // // hover_in($div);
|
|
35864
|
-
// // // // func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'render_viewport', data, null, null, paramsP.dsSessionP);
|
|
35865
|
-
// // // } else {
|
|
35866
|
-
// // // }
|
|
35867
|
-
// // };
|
|
35868
|
-
// const xu_viewport = function () {
|
|
35869
|
-
// const observer_inViewport = new IntersectionObserver(
|
|
35870
|
-
// function (entries) {
|
|
35871
|
-
// entries.forEach((entry) => {
|
|
35872
|
-
// if (entry.isIntersecting) {
|
|
35873
|
-
// $(entry.target).trigger('inViewport');
|
|
35874
|
-
|
|
35875
|
-
// // Optional: stop observing once triggered
|
|
35876
|
-
// observer_inViewport.unobserve(entry.target);
|
|
35877
|
-
// }
|
|
35878
|
-
// });
|
|
35879
|
-
// },
|
|
35880
|
-
// {
|
|
35881
|
-
// threshold: 0.1, // Trigger when 10% of element is visible
|
|
35882
|
-
// },
|
|
35883
|
-
// );
|
|
35777
|
+
return await done(continuous_idx);
|
|
35778
|
+
},
|
|
35779
|
+
[`xu-panel`]: async function () {
|
|
35780
|
+
const done = async function ($new_div) {
|
|
35781
|
+
if (!$container.data()?.xuData?.paramsP) {
|
|
35782
|
+
return $container;
|
|
35783
|
+
}
|
|
35784
|
+
var $div_items = $div.data().xuData.node.children;
|
|
35884
35785
|
|
|
35885
|
-
|
|
35886
|
-
// function (entries) {
|
|
35887
|
-
// entries.forEach((entry) => {
|
|
35888
|
-
// if (!entry.isIntersecting) {
|
|
35889
|
-
// // Element is OUT of viewport - trigger custom event
|
|
35890
|
-
// $(entry.target).trigger('outViewport');
|
|
35786
|
+
await func.UI.screen.panel_post_render_handler(SESSION_ID, $container, $new_div, nodeP, $div, jobNoP);
|
|
35891
35787
|
|
|
35892
|
-
//
|
|
35893
|
-
|
|
35894
|
-
// }
|
|
35895
|
-
// });
|
|
35896
|
-
// },
|
|
35897
|
-
// {
|
|
35898
|
-
// threshold: 0, // Trigger when element is completely out of view
|
|
35899
|
-
// },
|
|
35900
|
-
// );
|
|
35788
|
+
// TO FIX should be timeout
|
|
35789
|
+
$container.data().xuData.node.children = $div_items;
|
|
35901
35790
|
|
|
35902
|
-
|
|
35903
|
-
|
|
35904
|
-
// if ($div.children().length) {
|
|
35905
|
-
// $div.removeClass('skeleton');
|
|
35906
|
-
// return;
|
|
35907
|
-
// }
|
|
35791
|
+
return $container;
|
|
35792
|
+
};
|
|
35908
35793
|
|
|
35909
|
-
|
|
35910
|
-
|
|
35911
|
-
// // $div.removeClass('skeleton');
|
|
35912
|
-
// // $div.html(UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')]);
|
|
35913
|
-
// // } else {
|
|
35914
|
-
// hover_in($div);
|
|
35915
|
-
// ui_job_id = func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'render_viewport', { $div, nodeP, parent_infoP, $root_container, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, $container }, null, null, paramsP.dsSessionP);
|
|
35916
|
-
// // }
|
|
35917
|
-
// observer_outViewport.observe($div[0]);
|
|
35918
|
-
// });
|
|
35794
|
+
var $wrapper = $('<div>');
|
|
35795
|
+
$div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, null, $wrapper, '');
|
|
35919
35796
|
|
|
35920
|
-
|
|
35921
|
-
|
|
35797
|
+
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);
|
|
35798
|
+
if (ret.abort) {
|
|
35799
|
+
// render N
|
|
35800
|
+
return (ret.$new_div = $('<template>').append($div));
|
|
35801
|
+
}
|
|
35922
35802
|
|
|
35923
|
-
|
|
35924
|
-
// // UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')] = $div.children().clone(true);
|
|
35925
|
-
// $div.empty();
|
|
35926
|
-
// const height = $div?.data()?.xuData?.viewport_height || 10;
|
|
35927
|
-
// if (typeof height !== 'undefined') {
|
|
35928
|
-
// $div.css('height', height);
|
|
35929
|
-
// }
|
|
35930
|
-
// }
|
|
35931
|
-
// // $div.addClass('skeleton');
|
|
35932
|
-
// observer_inViewport.observe($div[0]);
|
|
35933
|
-
// });
|
|
35934
|
-
// $div.addClass('skeleton');
|
|
35935
|
-
// observer_inViewport.observe($div[0]);
|
|
35936
|
-
// };
|
|
35937
|
-
// xu_viewport();
|
|
35938
|
-
// } else {
|
|
35939
|
-
// await iterate_child($div, nodeP, parent_infoP, $root_container);
|
|
35940
|
-
// }
|
|
35803
|
+
let $ret_panel_div = ret.$new_div;
|
|
35941
35804
|
|
|
35942
|
-
|
|
35943
|
-
|
|
35944
|
-
|
|
35805
|
+
if (!$ret_panel_div?.children()?.length) {
|
|
35806
|
+
////// render default children tree
|
|
35807
|
+
if (nodeP.children.length) {
|
|
35808
|
+
$ret_panel_div = await func.UI.screen.render_ui_tree(SESSION_ID, $container, nodeP.children[0], parent_infoP, paramsP, jobNoP, null, 0, null, nodeP, null, $root_container);
|
|
35809
|
+
}
|
|
35810
|
+
}
|
|
35945
35811
|
|
|
35946
|
-
|
|
35947
|
-
// const done = async function (ret = {}) {
|
|
35948
|
-
// const xu_ui_id = $div.attr('xu-ui-id');
|
|
35949
|
-
// $div.removeClass('display_none');
|
|
35950
|
-
// if (ret.has_xu_exp_render_attribute) {
|
|
35951
|
-
// // $div.css('display', 'unset');
|
|
35952
|
-
|
|
35953
|
-
// const xu_render_cache_id = await get_xu_render_cache_str(SESSION_ID, paramsP.dsSessionP, Object.keys($div.data()?.xuData?.attr_exp_info?.['xu-render']?.fields || {}));
|
|
35954
|
-
// const _$div = $div.clone(true);
|
|
35955
|
-
// UI_WORKER_OBJ.xu_render_cache[xu_ui_id + xu_render_cache_id] = { $div: _$div, paramsP, data: _$div.data() };
|
|
35956
|
-
// nodeP.xu_render_xu_ui_id = xu_ui_id;
|
|
35957
|
-
// nodeP.xu_render_cache_id = xu_render_cache_id;
|
|
35958
|
-
|
|
35959
|
-
// if (ret.xu_render_background_processing) {
|
|
35960
|
-
// temp_$div.remove();
|
|
35961
|
-
// // $container.find(`[xu-ui-id="${xu_ui_id}"]`).remove();
|
|
35962
|
-
// return $div;
|
|
35963
|
-
// } else {
|
|
35964
|
-
// // $div.css('display', 'unset');
|
|
35965
|
-
// temp_$div.replaceWith($div);
|
|
35966
|
-
// return $div;
|
|
35967
|
-
// }
|
|
35968
|
-
// } else {
|
|
35969
|
-
// if (ret.has_xu_render_attribute) {
|
|
35970
|
-
// temp_$div.remove();
|
|
35971
|
-
// return $div;
|
|
35972
|
-
// }
|
|
35973
|
-
// // $div.css('display', 'unset');
|
|
35974
|
-
// temp_$div.replaceWith($div);
|
|
35975
|
-
// return $div;
|
|
35976
|
-
// }
|
|
35977
|
-
// };
|
|
35978
|
-
// if (!element || element === 'script') return await done();
|
|
35979
|
-
// let str = '';
|
|
35812
|
+
let ret_done = await done($ret_panel_div);
|
|
35980
35813
|
|
|
35981
|
-
|
|
35814
|
+
return ret_done;
|
|
35815
|
+
},
|
|
35816
|
+
};
|
|
35982
35817
|
|
|
35983
|
-
|
|
35984
|
-
|
|
35818
|
+
const draw_html_element_org = async function (element) {
|
|
35819
|
+
const done = async function (ret = {}) {
|
|
35820
|
+
return $div;
|
|
35821
|
+
};
|
|
35822
|
+
if (!element || element === 'script') return await done();
|
|
35823
|
+
let str = '';
|
|
35985
35824
|
|
|
35986
|
-
|
|
35825
|
+
var $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, element, null, str);
|
|
35987
35826
|
|
|
35988
|
-
|
|
35989
|
-
|
|
35990
|
-
|
|
35991
|
-
|
|
35992
|
-
|
|
35993
|
-
|
|
35994
|
-
|
|
35995
|
-
|
|
35996
|
-
|
|
35997
|
-
|
|
35998
|
-
|
|
35999
|
-
|
|
36000
|
-
|
|
35827
|
+
$div.hover(
|
|
35828
|
+
function (e) {
|
|
35829
|
+
hover_in($div, e);
|
|
35830
|
+
},
|
|
35831
|
+
function (e) {
|
|
35832
|
+
hover_out();
|
|
35833
|
+
},
|
|
35834
|
+
);
|
|
35835
|
+
if (paramsP.paramsP === 'grid' || parent_infoP?.iterate_info) {
|
|
35836
|
+
$div.on('click contextmenu', function (e) {
|
|
35837
|
+
hover_in($div, e);
|
|
35838
|
+
});
|
|
35839
|
+
}
|
|
36001
35840
|
|
|
36002
|
-
//
|
|
36003
|
-
|
|
36004
|
-
|
|
36005
|
-
|
|
36006
|
-
|
|
36007
|
-
|
|
36008
|
-
|
|
36009
|
-
|
|
36010
|
-
//
|
|
36011
|
-
//
|
|
36012
|
-
//
|
|
36013
|
-
//
|
|
36014
|
-
//
|
|
36015
|
-
//
|
|
36016
|
-
//
|
|
36017
|
-
//
|
|
36018
|
-
//
|
|
36019
|
-
|
|
36020
|
-
|
|
36021
|
-
//
|
|
36022
|
-
//
|
|
36023
|
-
//
|
|
36024
|
-
//
|
|
36025
|
-
//
|
|
36026
|
-
//
|
|
36027
|
-
//
|
|
36028
|
-
//
|
|
36029
|
-
|
|
36030
|
-
|
|
36031
|
-
|
|
36032
|
-
|
|
36033
|
-
|
|
36034
|
-
|
|
36035
|
-
// // Optional: stop observing once triggered
|
|
36036
|
-
// observer_inViewport.unobserve(entry.target);
|
|
36037
|
-
// }
|
|
36038
|
-
// });
|
|
36039
|
-
// },
|
|
36040
|
-
// {
|
|
36041
|
-
// threshold: 0.1, // Trigger when 10% of element is visible
|
|
36042
|
-
// },
|
|
36043
|
-
// );
|
|
35841
|
+
// let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $container, nodeP, $div, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div, true);
|
|
35842
|
+
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);
|
|
35843
|
+
if (ret.abort || nodeP.tagName === 'svg' || !_.isEmpty(nodeP?.attributes?.['xu-text']) || !_.isEmpty(nodeP?.attributes?.['xu-html']) || !_.isEmpty(nodeP?.attributes?.['xu-exp:xu-text']) || !_.isEmpty(nodeP?.attributes?.['xu-exp:xu-html'])) {
|
|
35844
|
+
return await done(ret);
|
|
35845
|
+
}
|
|
35846
|
+
// check if iterator made to prevent children render
|
|
35847
|
+
|
|
35848
|
+
if (nodeP?.attributes?.['xu-viewport'] == 'true') {
|
|
35849
|
+
// const xu_viewport = async function () {
|
|
35850
|
+
// const data = { $div: $div.clone(true), nodeP, parent_infoP, $root_container, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, $container };
|
|
35851
|
+
// const container_id = $container.attr('xu-ui-id');
|
|
35852
|
+
// if (!UI_WORKER_OBJ.pending_for_viewport_render[container_id]) {
|
|
35853
|
+
// UI_WORKER_OBJ.pending_for_viewport_render[container_id] = { base_$div: $div, data: [], $container };
|
|
35854
|
+
// await iterate_child($div, nodeP, parent_infoP, $root_container);
|
|
35855
|
+
// } else {
|
|
35856
|
+
// $div.remove();
|
|
35857
|
+
// }
|
|
35858
|
+
// UI_WORKER_OBJ.pending_for_viewport_render[container_id].data.push(data);
|
|
35859
|
+
|
|
35860
|
+
// // if (!$div.children().length) {
|
|
35861
|
+
// // // render the first element to determine height
|
|
35862
|
+
// // await iterate_child($div, nodeP, parent_infoP, $root_container);
|
|
35863
|
+
// // // hover_in($div);
|
|
35864
|
+
// // // func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'render_viewport', data, null, null, paramsP.dsSessionP);
|
|
35865
|
+
// // } else {
|
|
35866
|
+
// // }
|
|
35867
|
+
// };
|
|
35868
|
+
const xu_viewport = function () {
|
|
35869
|
+
const observer_inViewport = new IntersectionObserver(
|
|
35870
|
+
function (entries) {
|
|
35871
|
+
entries.forEach((entry) => {
|
|
35872
|
+
if (entry.isIntersecting) {
|
|
35873
|
+
$(entry.target).trigger('inViewport');
|
|
36044
35874
|
|
|
36045
|
-
//
|
|
36046
|
-
|
|
36047
|
-
|
|
36048
|
-
|
|
36049
|
-
|
|
36050
|
-
|
|
35875
|
+
// Optional: stop observing once triggered
|
|
35876
|
+
observer_inViewport.unobserve(entry.target);
|
|
35877
|
+
}
|
|
35878
|
+
});
|
|
35879
|
+
},
|
|
35880
|
+
{
|
|
35881
|
+
threshold: 0.1, // Trigger when 10% of element is visible
|
|
35882
|
+
},
|
|
35883
|
+
);
|
|
36051
35884
|
|
|
36052
|
-
|
|
36053
|
-
|
|
36054
|
-
|
|
36055
|
-
|
|
36056
|
-
//
|
|
36057
|
-
|
|
36058
|
-
// threshold: 0, // Trigger when element is completely out of view
|
|
36059
|
-
// },
|
|
36060
|
-
// );
|
|
35885
|
+
const observer_outViewport = new IntersectionObserver(
|
|
35886
|
+
function (entries) {
|
|
35887
|
+
entries.forEach((entry) => {
|
|
35888
|
+
if (!entry.isIntersecting) {
|
|
35889
|
+
// Element is OUT of viewport - trigger custom event
|
|
35890
|
+
$(entry.target).trigger('outViewport');
|
|
36061
35891
|
|
|
36062
|
-
//
|
|
36063
|
-
//
|
|
36064
|
-
|
|
36065
|
-
|
|
36066
|
-
|
|
36067
|
-
|
|
35892
|
+
// Optional: stop observing once triggered
|
|
35893
|
+
// observer_outViewport.unobserve(entry.target);
|
|
35894
|
+
}
|
|
35895
|
+
});
|
|
35896
|
+
},
|
|
35897
|
+
{
|
|
35898
|
+
threshold: 0, // Trigger when element is completely out of view
|
|
35899
|
+
},
|
|
35900
|
+
);
|
|
36068
35901
|
|
|
36069
|
-
|
|
36070
|
-
|
|
36071
|
-
|
|
36072
|
-
|
|
36073
|
-
|
|
36074
|
-
|
|
36075
|
-
// ui_job_id = func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'render_viewport', { $div, nodeP, parent_infoP, $root_container, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, temp_$container }, null, null, paramsP.dsSessionP);
|
|
36076
|
-
// // }
|
|
36077
|
-
// observer_outViewport.observe($div[0]);
|
|
36078
|
-
// });
|
|
35902
|
+
let ui_job_id;
|
|
35903
|
+
$div.on('inViewport', function () {
|
|
35904
|
+
if ($div.children().length) {
|
|
35905
|
+
$div.removeClass('skeleton');
|
|
35906
|
+
return;
|
|
35907
|
+
}
|
|
36079
35908
|
|
|
36080
|
-
//
|
|
36081
|
-
//
|
|
35909
|
+
// if (UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')]) {
|
|
35910
|
+
// $div[0].style.removeProperty('height');
|
|
35911
|
+
// $div.removeClass('skeleton');
|
|
35912
|
+
// $div.html(UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')]);
|
|
35913
|
+
// } else {
|
|
35914
|
+
hover_in($div);
|
|
35915
|
+
ui_job_id = func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'render_viewport', { $div, nodeP, parent_infoP, $root_container, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, $container }, null, null, paramsP.dsSessionP);
|
|
35916
|
+
// }
|
|
35917
|
+
observer_outViewport.observe($div[0]);
|
|
35918
|
+
});
|
|
36082
35919
|
|
|
36083
|
-
|
|
36084
|
-
|
|
36085
|
-
// $div.empty();
|
|
36086
|
-
// const height = $div?.data()?.xuData?.viewport_height || 10;
|
|
36087
|
-
// if (typeof height !== 'undefined') {
|
|
36088
|
-
// $div.css('height', height);
|
|
36089
|
-
// }
|
|
36090
|
-
// }
|
|
36091
|
-
// // $div.addClass('skeleton');
|
|
36092
|
-
// observer_inViewport.observe($div[0]);
|
|
36093
|
-
// });
|
|
36094
|
-
// $div.addClass('skeleton');
|
|
36095
|
-
// observer_inViewport.observe($div[0]);
|
|
36096
|
-
// };
|
|
36097
|
-
// xu_viewport();
|
|
36098
|
-
// } else {
|
|
36099
|
-
// // if (ret.xu_render_background_processing) {
|
|
36100
|
-
// // // let temp_$div = $div.clone(true);
|
|
36101
|
-
// // iterate_child($div, nodeP, parent_infoP, $root_container);
|
|
36102
|
-
// // } else {
|
|
36103
|
-
// // await iterate_child($div, nodeP, parent_infoP, $root_container);
|
|
36104
|
-
// // }
|
|
36105
|
-
// if (!ret.xu_render_background_processing) {
|
|
36106
|
-
// iterate_child($div, nodeP, parent_infoP, $root_container);
|
|
36107
|
-
// }
|
|
36108
|
-
// }
|
|
35920
|
+
$div.on('outViewport', function () {
|
|
35921
|
+
func.UI.worker.delete_job(SESSION_ID, ui_job_id);
|
|
36109
35922
|
|
|
36110
|
-
|
|
36111
|
-
//
|
|
36112
|
-
|
|
35923
|
+
if ($div.children().length) {
|
|
35924
|
+
// UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')] = $div.children().clone(true);
|
|
35925
|
+
$div.empty();
|
|
35926
|
+
const height = $div?.data()?.xuData?.viewport_height || 10;
|
|
35927
|
+
if (typeof height !== 'undefined') {
|
|
35928
|
+
$div.css('height', height);
|
|
35929
|
+
}
|
|
35930
|
+
}
|
|
35931
|
+
// $div.addClass('skeleton');
|
|
35932
|
+
observer_inViewport.observe($div[0]);
|
|
35933
|
+
});
|
|
35934
|
+
$div.addClass('skeleton');
|
|
35935
|
+
observer_inViewport.observe($div[0]);
|
|
35936
|
+
};
|
|
35937
|
+
xu_viewport();
|
|
35938
|
+
} else {
|
|
35939
|
+
await iterate_child($div, nodeP, parent_infoP, $root_container);
|
|
35940
|
+
}
|
|
36113
35941
|
|
|
36114
|
-
//
|
|
36115
|
-
|
|
36116
|
-
|
|
35942
|
+
// const ret_iterate_child = await iterate_child($div, nodeP, parent_infoP, null, $root_container);
|
|
35943
|
+
return await done(ret);
|
|
35944
|
+
};
|
|
36117
35945
|
|
|
36118
|
-
|
|
36119
|
-
|
|
36120
|
-
|
|
36121
|
-
|
|
36122
|
-
|
|
36123
|
-
//
|
|
36124
|
-
// }
|
|
36125
|
-
// // const xu_viewport = async function () {
|
|
36126
|
-
// // const data = { $div, nodeP, parent_infoP, $root_container, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, $container };
|
|
36127
|
-
// // const container_id = $container.attr('xu-ui-id');
|
|
36128
|
-
// // if (!UI_WORKER_OBJ.pending_for_viewport_render[container_id]) {
|
|
36129
|
-
// // UI_WORKER_OBJ.pending_for_viewport_render[container_id] = { base_$div: $div, data: [], $container };
|
|
36130
|
-
// // await iterate_child($div, nodeP, parent_infoP, $root_container);
|
|
36131
|
-
// // }
|
|
36132
|
-
// // UI_WORKER_OBJ.pending_for_viewport_render[container_id].data.push(data);
|
|
36133
|
-
// // };
|
|
35946
|
+
const draw_html_element = async function (element) {
|
|
35947
|
+
const done = async function (ret = {}) {
|
|
35948
|
+
const xu_ui_id = $div.attr('xu-ui-id');
|
|
35949
|
+
$div.removeClass('display_none');
|
|
35950
|
+
if (ret.has_xu_exp_render_attribute) {
|
|
35951
|
+
// $div.css('display', 'unset');
|
|
36134
35952
|
|
|
36135
|
-
|
|
36136
|
-
|
|
36137
|
-
|
|
36138
|
-
|
|
36139
|
-
|
|
36140
|
-
// }
|
|
36141
|
-
// return await draw_html_element(nodeP.tagName);
|
|
35953
|
+
const xu_render_cache_id = await get_xu_render_cache_str(SESSION_ID, paramsP.dsSessionP, Object.keys($div.data()?.xuData?.attr_exp_info?.['xu-render']?.fields || {}));
|
|
35954
|
+
const _$div = $div.clone(true);
|
|
35955
|
+
UI_WORKER_OBJ.xu_render_cache[xu_ui_id + xu_render_cache_id] = { $div: _$div, paramsP, data: _$div.data() };
|
|
35956
|
+
nodeP.xu_render_xu_ui_id = xu_ui_id;
|
|
35957
|
+
nodeP.xu_render_cache_id = xu_render_cache_id;
|
|
36142
35958
|
|
|
36143
|
-
|
|
36144
|
-
|
|
35959
|
+
if (ret.xu_render_background_processing) {
|
|
35960
|
+
temp_$div.remove();
|
|
35961
|
+
// $container.find(`[xu-ui-id="${xu_ui_id}"]`).remove();
|
|
35962
|
+
return $div;
|
|
35963
|
+
} else {
|
|
35964
|
+
// $div.css('display', 'unset');
|
|
35965
|
+
temp_$div.replaceWith($div);
|
|
35966
|
+
return $div;
|
|
35967
|
+
}
|
|
35968
|
+
} else {
|
|
35969
|
+
if (ret.has_xu_render_attribute) {
|
|
35970
|
+
temp_$div.remove();
|
|
35971
|
+
return $div;
|
|
35972
|
+
}
|
|
35973
|
+
// $div.css('display', 'unset');
|
|
35974
|
+
temp_$div.replaceWith($div);
|
|
35975
|
+
return $div;
|
|
35976
|
+
}
|
|
35977
|
+
};
|
|
35978
|
+
if (!element || element === 'script') return await done();
|
|
35979
|
+
let str = '';
|
|
36145
35980
|
|
|
36146
|
-
func.UI.screen.
|
|
35981
|
+
var temp_$div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, element, null, str, true);
|
|
35982
|
+
|
|
35983
|
+
let temp_$container = $('<tmp>').data('xuData', $container.data().xuData);
|
|
35984
|
+
let $div = temp_$div.clone(true);
|
|
35985
|
+
|
|
35986
|
+
// $div.css('display', 'none');
|
|
35987
|
+
|
|
35988
|
+
$div.hover(
|
|
35989
|
+
function (e) {
|
|
35990
|
+
hover_in($div, e);
|
|
35991
|
+
},
|
|
35992
|
+
function (e) {
|
|
35993
|
+
hover_out();
|
|
35994
|
+
},
|
|
35995
|
+
);
|
|
35996
|
+
if (paramsP.paramsP === 'grid' || parent_infoP?.iterate_info) {
|
|
35997
|
+
$div.on('click contextmenu', function (e) {
|
|
35998
|
+
hover_in($div, e);
|
|
35999
|
+
});
|
|
36000
|
+
}
|
|
36001
|
+
|
|
36002
|
+
let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, temp_$container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div, true);
|
|
36003
|
+
if (ret.abort || nodeP.tagName === 'svg' || !_.isEmpty(nodeP?.attributes?.['xu-text']) || !_.isEmpty(nodeP?.attributes?.['xu-html']) || !_.isEmpty(nodeP?.attributes?.['xu-exp:xu-text']) || !_.isEmpty(nodeP?.attributes?.['xu-exp:xu-html'])) {
|
|
36004
|
+
return await done(ret);
|
|
36005
|
+
}
|
|
36006
|
+
// check if iterator made to prevent children render
|
|
36007
|
+
|
|
36008
|
+
if (nodeP?.attributes?.['xu-viewport'] == 'true') {
|
|
36009
|
+
// const xu_viewport = async function () {
|
|
36010
|
+
// const data = { $div: $div.clone(true), nodeP, parent_infoP, $root_container, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, $container };
|
|
36011
|
+
// const container_id = $container.attr('xu-ui-id');
|
|
36012
|
+
// if (!UI_WORKER_OBJ.pending_for_viewport_render[container_id]) {
|
|
36013
|
+
// UI_WORKER_OBJ.pending_for_viewport_render[container_id] = { base_$div: $div, data: [], $container };
|
|
36014
|
+
// await iterate_child($div, nodeP, parent_infoP, $root_container);
|
|
36015
|
+
// } else {
|
|
36016
|
+
// $div.remove();
|
|
36017
|
+
// }
|
|
36018
|
+
// UI_WORKER_OBJ.pending_for_viewport_render[container_id].data.push(data);
|
|
36019
|
+
|
|
36020
|
+
// // if (!$div.children().length) {
|
|
36021
|
+
// // // render the first element to determine height
|
|
36022
|
+
// // await iterate_child($div, nodeP, parent_infoP, $root_container);
|
|
36023
|
+
// // // hover_in($div);
|
|
36024
|
+
// // // func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'render_viewport', data, null, null, paramsP.dsSessionP);
|
|
36025
|
+
// // } else {
|
|
36026
|
+
// // }
|
|
36027
|
+
// };
|
|
36028
|
+
const xu_viewport = function () {
|
|
36029
|
+
const observer_inViewport = new IntersectionObserver(
|
|
36030
|
+
function (entries) {
|
|
36031
|
+
entries.forEach((entry) => {
|
|
36032
|
+
if (entry.isIntersecting) {
|
|
36033
|
+
$(entry.target).trigger('inViewport');
|
|
36034
|
+
|
|
36035
|
+
// Optional: stop observing once triggered
|
|
36036
|
+
observer_inViewport.unobserve(entry.target);
|
|
36037
|
+
}
|
|
36038
|
+
});
|
|
36039
|
+
},
|
|
36040
|
+
{
|
|
36041
|
+
threshold: 0.1, // Trigger when 10% of element is visible
|
|
36042
|
+
},
|
|
36043
|
+
);
|
|
36044
|
+
|
|
36045
|
+
const observer_outViewport = new IntersectionObserver(
|
|
36046
|
+
function (entries) {
|
|
36047
|
+
entries.forEach((entry) => {
|
|
36048
|
+
if (!entry.isIntersecting) {
|
|
36049
|
+
// Element is OUT of viewport - trigger custom event
|
|
36050
|
+
$(entry.target).trigger('outViewport');
|
|
36051
|
+
|
|
36052
|
+
// Optional: stop observing once triggered
|
|
36053
|
+
// observer_outViewport.unobserve(entry.target);
|
|
36054
|
+
}
|
|
36055
|
+
});
|
|
36056
|
+
},
|
|
36057
|
+
{
|
|
36058
|
+
threshold: 0, // Trigger when element is completely out of view
|
|
36059
|
+
},
|
|
36060
|
+
);
|
|
36061
|
+
|
|
36062
|
+
let ui_job_id;
|
|
36063
|
+
$div.on('inViewport', function () {
|
|
36064
|
+
if ($div.children().length) {
|
|
36065
|
+
$div.removeClass('skeleton');
|
|
36066
|
+
return;
|
|
36067
|
+
}
|
|
36068
|
+
|
|
36069
|
+
// if (UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')]) {
|
|
36070
|
+
// $div[0].style.removeProperty('height');
|
|
36071
|
+
// $div.removeClass('skeleton');
|
|
36072
|
+
// $div.html(UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')]);
|
|
36073
|
+
// } else {
|
|
36074
|
+
hover_in($div);
|
|
36075
|
+
ui_job_id = func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'render_viewport', { $div, nodeP, parent_infoP, $root_container, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, temp_$container }, null, null, paramsP.dsSessionP);
|
|
36076
|
+
// }
|
|
36077
|
+
observer_outViewport.observe($div[0]);
|
|
36078
|
+
});
|
|
36079
|
+
|
|
36080
|
+
$div.on('outViewport', function () {
|
|
36081
|
+
func.UI.worker.delete_job(SESSION_ID, ui_job_id);
|
|
36082
|
+
|
|
36083
|
+
if ($div.children().length) {
|
|
36084
|
+
// UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')] = $div.children().clone(true);
|
|
36085
|
+
$div.empty();
|
|
36086
|
+
const height = $div?.data()?.xuData?.viewport_height || 10;
|
|
36087
|
+
if (typeof height !== 'undefined') {
|
|
36088
|
+
$div.css('height', height);
|
|
36089
|
+
}
|
|
36090
|
+
}
|
|
36091
|
+
// $div.addClass('skeleton');
|
|
36092
|
+
observer_inViewport.observe($div[0]);
|
|
36093
|
+
});
|
|
36094
|
+
$div.addClass('skeleton');
|
|
36095
|
+
observer_inViewport.observe($div[0]);
|
|
36096
|
+
};
|
|
36097
|
+
xu_viewport();
|
|
36098
|
+
} else {
|
|
36099
|
+
// if (ret.xu_render_background_processing) {
|
|
36100
|
+
// // let temp_$div = $div.clone(true);
|
|
36101
|
+
// iterate_child($div, nodeP, parent_infoP, $root_container);
|
|
36102
|
+
// } else {
|
|
36103
|
+
// await iterate_child($div, nodeP, parent_infoP, $root_container);
|
|
36104
|
+
// }
|
|
36105
|
+
if (!ret.xu_render_background_processing) {
|
|
36106
|
+
iterate_child($div, nodeP, parent_infoP, $root_container);
|
|
36107
|
+
}
|
|
36108
|
+
}
|
|
36109
|
+
|
|
36110
|
+
// const ret_iterate_child = await iterate_child($div, nodeP, parent_infoP, null, $root_container);
|
|
36111
|
+
return await done(ret);
|
|
36112
|
+
};
|
|
36113
|
+
|
|
36114
|
+
if (nodeP.content && nodeP.attributes) {
|
|
36115
|
+
nodeP.attributes['xu-content'] = nodeP.content;
|
|
36116
|
+
}
|
|
36117
|
+
|
|
36118
|
+
if (nodeP.tagName === 'xu-widget') {
|
|
36119
|
+
if (is_skeleton) return;
|
|
36120
|
+
return await fx['widget']();
|
|
36121
|
+
}
|
|
36122
|
+
if (fx[nodeP.tagName]) {
|
|
36123
|
+
return await fx[nodeP.tagName]();
|
|
36124
|
+
}
|
|
36125
|
+
// const xu_viewport = async function () {
|
|
36126
|
+
// const data = { $div, nodeP, parent_infoP, $root_container, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, $container };
|
|
36127
|
+
// const container_id = $container.attr('xu-ui-id');
|
|
36128
|
+
// if (!UI_WORKER_OBJ.pending_for_viewport_render[container_id]) {
|
|
36129
|
+
// UI_WORKER_OBJ.pending_for_viewport_render[container_id] = { base_$div: $div, data: [], $container };
|
|
36130
|
+
// await iterate_child($div, nodeP, parent_infoP, $root_container);
|
|
36131
|
+
// }
|
|
36132
|
+
// UI_WORKER_OBJ.pending_for_viewport_render[container_id].data.push(data);
|
|
36133
|
+
// };
|
|
36134
|
+
|
|
36135
|
+
// if (nodeP?.attributes?.['xu-viewport'] == 'true') {
|
|
36136
|
+
// return await xu_viewport();
|
|
36137
|
+
// } else {
|
|
36138
|
+
if (!glb.new_xu_render) {
|
|
36139
|
+
return await draw_html_element_org(nodeP.tagName);
|
|
36140
|
+
}
|
|
36141
|
+
return await draw_html_element(nodeP.tagName);
|
|
36142
|
+
|
|
36143
|
+
// }
|
|
36144
|
+
};
|
|
36145
|
+
|
|
36146
|
+
func.UI.screen.render_ui_tree_bad = async function (SESSION_ID, $container, nodeP, parent_infoP, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, $root_container) {
|
|
36147
36147
|
// Early cache session and datasource
|
|
36148
36148
|
let _session, _ds;
|
|
36149
36149
|
if (!is_skeleton) {
|