@xuda.io/runtime-bundle 1.0.1249 → 1.0.1250
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 +262 -112
- package/js/xuda-runtime-bundle.min.js +1 -1
- package/js/xuda-runtime-slim.js +262 -112
- package/js/xuda-runtime-slim.min.es.js +262 -112
- package/js/xuda-runtime-slim.min.js +1 -1
- package/package.json +1 -1
|
@@ -12481,162 +12481,312 @@ func.UI.screen.panel_post_render_handler = async function (
|
|
|
12481
12481
|
return jobNoP;
|
|
12482
12482
|
};
|
|
12483
12483
|
|
|
12484
|
+
// const generate_xu_ui_id = async function (SESSION_ID, nodeP, $container, paramsP, keyP) {
|
|
12485
|
+
// // const _paramsP = _.cloneDeep(paramsP);
|
|
12486
|
+
// const _paramsP = klona.klona(paramsP);
|
|
12487
|
+
// var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_paramsP.dsSessionP];
|
|
12488
|
+
|
|
12489
|
+
// const currentRecordId = $container?.data?.()?.xuData?.recordid || (_ds ? _ds.currentRecordId : '');
|
|
12490
|
+
// const key_path = `${$container?.data()?.xuData?.key_path || '0'}-${keyP || '0'}`;
|
|
12491
|
+
// const elem_key = `${nodeP.xu_tree_id || nodeP.id}-${key_path}-${currentRecordId}`;
|
|
12492
|
+
// let ui_id = `${nodeP.id}-${elem_key}-${_paramsP?.dsSessionP?.toString() || ''}`; //nodeP.xu_tree_id ||
|
|
12493
|
+
|
|
12494
|
+
// const new_ui_id = await func.common.sha256(ui_id);
|
|
12495
|
+
// return new_ui_id;
|
|
12496
|
+
// };
|
|
12497
|
+
|
|
12484
12498
|
const generate_xu_ui_id = async function (SESSION_ID, nodeP, $container, paramsP, keyP) {
|
|
12485
|
-
//
|
|
12486
|
-
const
|
|
12487
|
-
|
|
12499
|
+
// Avoid cloning if we only need dsSessionP
|
|
12500
|
+
const dsSessionP = paramsP.dsSessionP;
|
|
12501
|
+
const _ds = SESSION_OBJ[SESSION_ID].DS_GLB[dsSessionP];
|
|
12502
|
+
|
|
12503
|
+
// Cache container data access
|
|
12504
|
+
const containerXuData = $container?.data?.()?.xuData;
|
|
12505
|
+
const currentRecordId = containerXuData?.recordid || _ds?.currentRecordId || '';
|
|
12488
12506
|
|
|
12489
|
-
|
|
12490
|
-
const key_path = `${
|
|
12491
|
-
const
|
|
12492
|
-
|
|
12507
|
+
// Build strings efficiently
|
|
12508
|
+
const key_path = `${containerXuData?.key_path || '0'}-${keyP || '0'}`;
|
|
12509
|
+
const nodeId = nodeP.xu_tree_id || nodeP.id;
|
|
12510
|
+
const elem_key = `${nodeId}-${key_path}-${currentRecordId}`;
|
|
12511
|
+
const ui_id = `${nodeP.id}-${elem_key}-${dsSessionP?.toString() || ''}`;
|
|
12493
12512
|
|
|
12494
|
-
|
|
12495
|
-
return new_ui_id;
|
|
12513
|
+
return await func.common.fastHash(ui_id);
|
|
12496
12514
|
};
|
|
12497
12515
|
|
|
12516
|
+
// 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) {
|
|
12517
|
+
// // const _paramsP = _.cloneDeep(paramsP);
|
|
12518
|
+
// const _paramsP = klona.klona(paramsP);
|
|
12519
|
+
// var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_paramsP.dsSessionP];
|
|
12520
|
+
// var $appendTo = $container;
|
|
12521
|
+
// if ($appendToP) $appendTo = $appendToP;
|
|
12522
|
+
// if (!$appendTo || !$appendTo.length) return null; // screen closed or not exist abort build
|
|
12523
|
+
// var div = 'div';
|
|
12524
|
+
// if (div_typeP) div = div_typeP;
|
|
12525
|
+
// var items = [];
|
|
12526
|
+
// if (nodeP.children)
|
|
12527
|
+
// items = nodeP.children.map(function (val) {
|
|
12528
|
+
// return val.xu_tree_id || val.id;
|
|
12529
|
+
// });
|
|
12530
|
+
// var currentRecordId = $container?.data?.()?.xuData?.recordid || (_ds ? _ds.currentRecordId : '');
|
|
12531
|
+
// // var xu_id = (glb.screen_num++).toString();
|
|
12532
|
+
// // xu_id = xu_id += '_' + currentRecordId;
|
|
12533
|
+
|
|
12534
|
+
// try {
|
|
12535
|
+
// const key_path = `${$container?.data()?.xuData?.key_path || '0'}-${keyP || '0'}`;
|
|
12536
|
+
// const elem_key = `${nodeP.xu_tree_id || nodeP.id}-${key_path}-${currentRecordId}`;
|
|
12537
|
+
// // let ui_id = `${nodeP.id}-${elem_key}-${_paramsP?.dsSessionP?.toString() || ''}`; //nodeP.xu_tree_id ||
|
|
12538
|
+
|
|
12539
|
+
// /////////////////////////////////
|
|
12540
|
+
|
|
12541
|
+
// var $div;
|
|
12542
|
+
|
|
12543
|
+
// if (div === 'svg') {
|
|
12544
|
+
// const draw_svg = function (element) {
|
|
12545
|
+
// const get_tag_str = function (element, prop, val) {
|
|
12546
|
+
// let class_str = '';
|
|
12547
|
+
// let attr_str = '';
|
|
12548
|
+
// for (const [key, val] of Object.entries(prop)) {
|
|
12549
|
+
// if (key.substr(0, 2) !== 'xu') {
|
|
12550
|
+
// attr_str += ` ${key}="${val}" `;
|
|
12551
|
+
// }
|
|
12552
|
+
// }
|
|
12553
|
+
// if (element === 'svg') {
|
|
12554
|
+
// return `<${element} ${attr_str} > `;
|
|
12555
|
+
// }
|
|
12556
|
+
// let ret = '';
|
|
12557
|
+
// if (val?.children?.length) {
|
|
12558
|
+
// ret = iterate_svg(val);
|
|
12559
|
+
// }
|
|
12560
|
+
|
|
12561
|
+
// return `<${element} ${class_str} ${attr_str} > ${ret} </${element}>`;
|
|
12562
|
+
// };
|
|
12563
|
+
// let svg_str = get_tag_str(element, prop);
|
|
12564
|
+
// let inner_str = '';
|
|
12565
|
+
// const iterate_svg = function (node) {
|
|
12566
|
+
// let ret = '';
|
|
12567
|
+
// if (node.children) {
|
|
12568
|
+
// for (let val of node.children) {
|
|
12569
|
+
// let prop = val.attributes;
|
|
12570
|
+
// ret += get_tag_str(val.tagName, prop, val);
|
|
12571
|
+
// }
|
|
12572
|
+
// }
|
|
12573
|
+
// return ret;
|
|
12574
|
+
// };
|
|
12575
|
+
// inner_str = iterate_svg(nodeP);
|
|
12576
|
+
|
|
12577
|
+
// $div = $(svg_str + inner_str + '</svg>').appendTo($appendTo);
|
|
12578
|
+
// };
|
|
12579
|
+
|
|
12580
|
+
// draw_svg(div_typeP);
|
|
12581
|
+
// } else {
|
|
12582
|
+
// $div = $(`<${div} ${attr_str ? attr_str : ''}>`);
|
|
12583
|
+
// }
|
|
12584
|
+
|
|
12585
|
+
// // // Returns a 32-bit unsigned integer hash of a string (FNV-1a)
|
|
12586
|
+
// // function hash32(str) {
|
|
12587
|
+
// // let h = 0x811c9dc5; // FNV offset basis
|
|
12588
|
+
// // for (let i = 0; i < str.length; i++) {
|
|
12589
|
+
// // h ^= str.charCodeAt(i);
|
|
12590
|
+
// // // multiply by FNV prime (2^24 + 2^8 + 0x93) with 32-bit overflow
|
|
12591
|
+
// // h += (h << 1) + (h << 4) + (h << 7) + (h << 8) + (h << 24);
|
|
12592
|
+
// // }
|
|
12593
|
+
// // // Convert to unsigned 32-bit
|
|
12594
|
+
// // return h >>> 0;
|
|
12595
|
+
// // }
|
|
12596
|
+
|
|
12597
|
+
// // function hash32hex(str) {
|
|
12598
|
+
// // return (hash32(str) >>> 0).toString(16).padStart(8, '0');
|
|
12599
|
+
// // }
|
|
12600
|
+
|
|
12601
|
+
// // const new_ui_id = hash32hex(ui_id);
|
|
12602
|
+
// // const new_ui_id = await func.common.sha256(ui_id);
|
|
12603
|
+
// const new_ui_id = await generate_xu_ui_id(SESSION_ID, nodeP, $container, paramsP, keyP);
|
|
12604
|
+
|
|
12605
|
+
// $div
|
|
12606
|
+
// .attr('xu-ui-id', new_ui_id)
|
|
12607
|
+
// // .attr('xu-node-id', nodeP.id)
|
|
12608
|
+
// .data({
|
|
12609
|
+
// xuData: {
|
|
12610
|
+
// prog_id: _paramsP.prog_id,
|
|
12611
|
+
// nodeid: nodeP.id,
|
|
12612
|
+
// ui_type: nodeP.tagName,
|
|
12613
|
+
// // xu_id,
|
|
12614
|
+
// recordid: currentRecordId,
|
|
12615
|
+
// paramsP: _paramsP,
|
|
12616
|
+
// key: keyP,
|
|
12617
|
+
// key_path, //:($container?.data()?.xuData?.key || "0") + "-" + (keyP || "0"),
|
|
12618
|
+
// screenId: _paramsP.screenId,
|
|
12619
|
+
// parent_container: $container?.attr('id'),
|
|
12620
|
+
// elem_key,
|
|
12621
|
+
// properties: prop,
|
|
12622
|
+
// node: nodeP,
|
|
12623
|
+
// node_org: _.cloneDeep(nodeP),
|
|
12624
|
+
// is_panelP: _paramsP.is_panelP,
|
|
12625
|
+
// ui_id: new_ui_id,
|
|
12626
|
+
// elem_prop: elem_propP,
|
|
12627
|
+
// debug_info: {
|
|
12628
|
+
// id: nodeP.id,
|
|
12629
|
+
// parent_id: $container?.data()?.xuData?.ui_id,
|
|
12630
|
+
// items: items,
|
|
12631
|
+
// },
|
|
12632
|
+
// parent_node: parent_nodeP,
|
|
12633
|
+
// currentRecordId: currentRecordId,
|
|
12634
|
+
// $root_container: $root_container,
|
|
12635
|
+
// parent_element_ui_id: $container?.data()?.xuData?.ui_id,
|
|
12636
|
+
// },
|
|
12637
|
+
// xuAttributes: {},
|
|
12638
|
+
// });
|
|
12639
|
+
// if (is_placeholder) {
|
|
12640
|
+
// $div.addClass('display_none');
|
|
12641
|
+
// }
|
|
12642
|
+
|
|
12643
|
+
// if (div_typeP !== 'svg') {
|
|
12644
|
+
// $div.appendTo($appendTo);
|
|
12645
|
+
// }
|
|
12646
|
+
// } catch (e) {
|
|
12647
|
+
// console.error(e);
|
|
12648
|
+
// }
|
|
12649
|
+
|
|
12650
|
+
// if (parent_infoP?.iterate_info) {
|
|
12651
|
+
// $div.data().xuData.iterate_info = parent_infoP.iterate_info;
|
|
12652
|
+
// }
|
|
12653
|
+
|
|
12654
|
+
// if (classP) $div.addClass(classP);
|
|
12655
|
+
|
|
12656
|
+
// return $div;
|
|
12657
|
+
// };
|
|
12658
|
+
|
|
12498
12659
|
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) {
|
|
12499
|
-
// const _paramsP = _.cloneDeep(paramsP);
|
|
12500
12660
|
const _paramsP = klona.klona(paramsP);
|
|
12501
|
-
|
|
12502
|
-
|
|
12503
|
-
|
|
12504
|
-
|
|
12505
|
-
|
|
12506
|
-
|
|
12507
|
-
|
|
12508
|
-
|
|
12509
|
-
|
|
12510
|
-
|
|
12511
|
-
|
|
12512
|
-
|
|
12513
|
-
|
|
12514
|
-
//
|
|
12661
|
+
const _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_paramsP.dsSessionP];
|
|
12662
|
+
const $appendTo = $appendToP || $container;
|
|
12663
|
+
|
|
12664
|
+
// Early exit if container doesn't exist
|
|
12665
|
+
if (!$appendTo?.length) return null;
|
|
12666
|
+
|
|
12667
|
+
const div = div_typeP || 'div';
|
|
12668
|
+
|
|
12669
|
+
// Cache container data to avoid repeated access
|
|
12670
|
+
const containerData = $container?.data?.();
|
|
12671
|
+
const containerXuData = containerData?.xuData;
|
|
12672
|
+
const currentRecordId = containerXuData?.recordid || (_ds ? _ds.currentRecordId : '');
|
|
12673
|
+
|
|
12674
|
+
// Pre-compute items array
|
|
12675
|
+
const items = nodeP.children ? nodeP.children.map((val) => val.xu_tree_id || val.id) : [];
|
|
12515
12676
|
|
|
12516
12677
|
try {
|
|
12517
|
-
const key_path = `${
|
|
12678
|
+
const key_path = `${containerXuData?.key_path || '0'}-${keyP || '0'}`;
|
|
12518
12679
|
const elem_key = `${nodeP.xu_tree_id || nodeP.id}-${key_path}-${currentRecordId}`;
|
|
12519
|
-
// let ui_id = `${nodeP.id}-${elem_key}-${_paramsP?.dsSessionP?.toString() || ''}`; //nodeP.xu_tree_id ||
|
|
12520
|
-
|
|
12521
|
-
/////////////////////////////////
|
|
12522
12680
|
|
|
12523
|
-
|
|
12681
|
+
let $div;
|
|
12524
12682
|
|
|
12683
|
+
// Handle SVG creation
|
|
12525
12684
|
if (div === 'svg') {
|
|
12526
12685
|
const draw_svg = function (element) {
|
|
12527
12686
|
const get_tag_str = function (element, prop, val) {
|
|
12528
|
-
|
|
12529
|
-
|
|
12530
|
-
for (const [key,
|
|
12531
|
-
if (key.
|
|
12532
|
-
|
|
12687
|
+
const attrs = [];
|
|
12688
|
+
|
|
12689
|
+
for (const [key, value] of Object.entries(prop)) {
|
|
12690
|
+
if (!key.startsWith('xu')) {
|
|
12691
|
+
attrs.push(`${key}="${value}"`);
|
|
12533
12692
|
}
|
|
12534
12693
|
}
|
|
12694
|
+
|
|
12695
|
+
const attr_str = attrs.join(' ');
|
|
12696
|
+
|
|
12535
12697
|
if (element === 'svg') {
|
|
12536
|
-
return `<${element}
|
|
12537
|
-
}
|
|
12538
|
-
let ret = '';
|
|
12539
|
-
if (val?.children?.length) {
|
|
12540
|
-
ret = iterate_svg(val);
|
|
12698
|
+
return `<${element} ${attr_str}>`;
|
|
12541
12699
|
}
|
|
12542
12700
|
|
|
12543
|
-
|
|
12701
|
+
const inner = val?.children?.length ? iterate_svg(val) : '';
|
|
12702
|
+
return `<${element} ${attr_str}>${inner}</${element}>`;
|
|
12544
12703
|
};
|
|
12545
|
-
|
|
12546
|
-
let inner_str = '';
|
|
12704
|
+
|
|
12547
12705
|
const iterate_svg = function (node) {
|
|
12548
|
-
|
|
12549
|
-
|
|
12550
|
-
|
|
12551
|
-
let prop = val.attributes;
|
|
12552
|
-
ret += get_tag_str(val.tagName, prop, val);
|
|
12553
|
-
}
|
|
12554
|
-
}
|
|
12555
|
-
return ret;
|
|
12706
|
+
if (!node.children) return '';
|
|
12707
|
+
|
|
12708
|
+
return node.children.map((val) => get_tag_str(val.tagName, val.attributes, val)).join('');
|
|
12556
12709
|
};
|
|
12557
|
-
|
|
12710
|
+
|
|
12711
|
+
const svg_str = get_tag_str(element, prop);
|
|
12712
|
+
const inner_str = iterate_svg(nodeP);
|
|
12558
12713
|
|
|
12559
12714
|
$div = $(svg_str + inner_str + '</svg>').appendTo($appendTo);
|
|
12560
12715
|
};
|
|
12561
12716
|
|
|
12562
12717
|
draw_svg(div_typeP);
|
|
12563
12718
|
} else {
|
|
12564
|
-
$div = $(`<${div}
|
|
12719
|
+
$div = $(`<${div}${attr_str ? ' ' + attr_str : ''}>`);
|
|
12565
12720
|
}
|
|
12566
12721
|
|
|
12567
|
-
//
|
|
12568
|
-
|
|
12569
|
-
// let h = 0x811c9dc5; // FNV offset basis
|
|
12570
|
-
// for (let i = 0; i < str.length; i++) {
|
|
12571
|
-
// h ^= str.charCodeAt(i);
|
|
12572
|
-
// // multiply by FNV prime (2^24 + 2^8 + 0x93) with 32-bit overflow
|
|
12573
|
-
// h += (h << 1) + (h << 4) + (h << 7) + (h << 8) + (h << 24);
|
|
12574
|
-
// }
|
|
12575
|
-
// // Convert to unsigned 32-bit
|
|
12576
|
-
// return h >>> 0;
|
|
12577
|
-
// }
|
|
12722
|
+
// Generate UI ID
|
|
12723
|
+
const new_ui_id = await generate_xu_ui_id(SESSION_ID, nodeP, $container, paramsP, keyP);
|
|
12578
12724
|
|
|
12579
|
-
//
|
|
12580
|
-
|
|
12581
|
-
|
|
12725
|
+
// Set attributes and data in one go
|
|
12726
|
+
$div.attr('xu-ui-id', new_ui_id);
|
|
12727
|
+
|
|
12728
|
+
// Build xuData object efficiently
|
|
12729
|
+
const xuData = {
|
|
12730
|
+
prog_id: _paramsP.prog_id,
|
|
12731
|
+
nodeid: nodeP.id,
|
|
12732
|
+
ui_type: nodeP.tagName,
|
|
12733
|
+
recordid: currentRecordId,
|
|
12734
|
+
paramsP: _paramsP,
|
|
12735
|
+
key: keyP,
|
|
12736
|
+
key_path,
|
|
12737
|
+
screenId: _paramsP.screenId,
|
|
12738
|
+
parent_container: containerData?.id,
|
|
12739
|
+
elem_key,
|
|
12740
|
+
properties: prop,
|
|
12741
|
+
node: nodeP,
|
|
12742
|
+
node_org: _.cloneDeep(nodeP),
|
|
12743
|
+
is_panelP: _paramsP.is_panelP,
|
|
12744
|
+
ui_id: new_ui_id,
|
|
12745
|
+
elem_prop: elem_propP,
|
|
12746
|
+
debug_info: {
|
|
12747
|
+
id: nodeP.id,
|
|
12748
|
+
parent_id: containerXuData?.ui_id,
|
|
12749
|
+
items: items,
|
|
12750
|
+
},
|
|
12751
|
+
parent_node: parent_nodeP,
|
|
12752
|
+
currentRecordId: currentRecordId,
|
|
12753
|
+
$root_container: $root_container,
|
|
12754
|
+
parent_element_ui_id: containerXuData?.ui_id,
|
|
12755
|
+
};
|
|
12582
12756
|
|
|
12583
|
-
//
|
|
12584
|
-
|
|
12585
|
-
|
|
12757
|
+
// Add iterate_info if present
|
|
12758
|
+
if (parent_infoP?.iterate_info) {
|
|
12759
|
+
xuData.iterate_info = parent_infoP.iterate_info;
|
|
12760
|
+
}
|
|
12586
12761
|
|
|
12587
|
-
|
|
12588
|
-
|
|
12589
|
-
|
|
12590
|
-
|
|
12591
|
-
|
|
12592
|
-
|
|
12593
|
-
|
|
12594
|
-
ui_type: nodeP.tagName,
|
|
12595
|
-
// xu_id,
|
|
12596
|
-
recordid: currentRecordId,
|
|
12597
|
-
paramsP: _paramsP,
|
|
12598
|
-
key: keyP,
|
|
12599
|
-
key_path, //:($container?.data()?.xuData?.key || "0") + "-" + (keyP || "0"),
|
|
12600
|
-
screenId: _paramsP.screenId,
|
|
12601
|
-
parent_container: $container?.attr('id'),
|
|
12602
|
-
elem_key,
|
|
12603
|
-
properties: prop,
|
|
12604
|
-
node: nodeP,
|
|
12605
|
-
node_org: _.cloneDeep(nodeP),
|
|
12606
|
-
is_panelP: _paramsP.is_panelP,
|
|
12607
|
-
ui_id: new_ui_id,
|
|
12608
|
-
elem_prop: elem_propP,
|
|
12609
|
-
debug_info: {
|
|
12610
|
-
id: nodeP.id,
|
|
12611
|
-
parent_id: $container?.data()?.xuData?.ui_id,
|
|
12612
|
-
items: items,
|
|
12613
|
-
},
|
|
12614
|
-
parent_node: parent_nodeP,
|
|
12615
|
-
currentRecordId: currentRecordId,
|
|
12616
|
-
$root_container: $root_container,
|
|
12617
|
-
parent_element_ui_id: $container?.data()?.xuData?.ui_id,
|
|
12618
|
-
},
|
|
12619
|
-
xuAttributes: {},
|
|
12620
|
-
});
|
|
12762
|
+
// Set data once
|
|
12763
|
+
$div.data({
|
|
12764
|
+
xuData: xuData,
|
|
12765
|
+
xuAttributes: {},
|
|
12766
|
+
});
|
|
12767
|
+
|
|
12768
|
+
// Apply placeholder class if needed
|
|
12621
12769
|
if (is_placeholder) {
|
|
12622
12770
|
$div.addClass('display_none');
|
|
12623
12771
|
}
|
|
12624
12772
|
|
|
12773
|
+
// Apply custom class if provided
|
|
12774
|
+
if (classP) {
|
|
12775
|
+
$div.addClass(classP);
|
|
12776
|
+
}
|
|
12777
|
+
|
|
12778
|
+
// Append to DOM (only for non-SVG elements)
|
|
12625
12779
|
if (div_typeP !== 'svg') {
|
|
12626
12780
|
$div.appendTo($appendTo);
|
|
12627
12781
|
}
|
|
12628
|
-
} catch (e) {
|
|
12629
|
-
console.error(e);
|
|
12630
|
-
}
|
|
12631
12782
|
|
|
12632
|
-
|
|
12633
|
-
|
|
12783
|
+
return $div;
|
|
12784
|
+
} catch (e) {
|
|
12785
|
+
console.error('create_container error:', e);
|
|
12786
|
+
return null;
|
|
12634
12787
|
}
|
|
12635
|
-
|
|
12636
|
-
if (classP) $div.addClass(classP);
|
|
12637
|
-
|
|
12638
|
-
return $div;
|
|
12639
12788
|
};
|
|
12789
|
+
|
|
12640
12790
|
func.UI.screen.execute_screen_ready_events = async function (SESSION_ID, paramsP, sourceP, $div, jobNoP, $div_objP) {
|
|
12641
12791
|
var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
|
|
12642
12792
|
if (!_ds) return;
|