@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
package/js/xuda-runtime-slim.js
CHANGED
|
@@ -14756,162 +14756,312 @@ func.UI.screen.panel_post_render_handler = async function (
|
|
|
14756
14756
|
return jobNoP;
|
|
14757
14757
|
};
|
|
14758
14758
|
|
|
14759
|
+
// const generate_xu_ui_id = async function (SESSION_ID, nodeP, $container, paramsP, keyP) {
|
|
14760
|
+
// // const _paramsP = _.cloneDeep(paramsP);
|
|
14761
|
+
// const _paramsP = klona.klona(paramsP);
|
|
14762
|
+
// var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_paramsP.dsSessionP];
|
|
14763
|
+
|
|
14764
|
+
// const currentRecordId = $container?.data?.()?.xuData?.recordid || (_ds ? _ds.currentRecordId : '');
|
|
14765
|
+
// const key_path = `${$container?.data()?.xuData?.key_path || '0'}-${keyP || '0'}`;
|
|
14766
|
+
// const elem_key = `${nodeP.xu_tree_id || nodeP.id}-${key_path}-${currentRecordId}`;
|
|
14767
|
+
// let ui_id = `${nodeP.id}-${elem_key}-${_paramsP?.dsSessionP?.toString() || ''}`; //nodeP.xu_tree_id ||
|
|
14768
|
+
|
|
14769
|
+
// const new_ui_id = await func.common.sha256(ui_id);
|
|
14770
|
+
// return new_ui_id;
|
|
14771
|
+
// };
|
|
14772
|
+
|
|
14759
14773
|
const generate_xu_ui_id = async function (SESSION_ID, nodeP, $container, paramsP, keyP) {
|
|
14760
|
-
//
|
|
14761
|
-
const
|
|
14762
|
-
|
|
14774
|
+
// Avoid cloning if we only need dsSessionP
|
|
14775
|
+
const dsSessionP = paramsP.dsSessionP;
|
|
14776
|
+
const _ds = SESSION_OBJ[SESSION_ID].DS_GLB[dsSessionP];
|
|
14777
|
+
|
|
14778
|
+
// Cache container data access
|
|
14779
|
+
const containerXuData = $container?.data?.()?.xuData;
|
|
14780
|
+
const currentRecordId = containerXuData?.recordid || _ds?.currentRecordId || '';
|
|
14763
14781
|
|
|
14764
|
-
|
|
14765
|
-
const key_path = `${
|
|
14766
|
-
const
|
|
14767
|
-
|
|
14782
|
+
// Build strings efficiently
|
|
14783
|
+
const key_path = `${containerXuData?.key_path || '0'}-${keyP || '0'}`;
|
|
14784
|
+
const nodeId = nodeP.xu_tree_id || nodeP.id;
|
|
14785
|
+
const elem_key = `${nodeId}-${key_path}-${currentRecordId}`;
|
|
14786
|
+
const ui_id = `${nodeP.id}-${elem_key}-${dsSessionP?.toString() || ''}`;
|
|
14768
14787
|
|
|
14769
|
-
|
|
14770
|
-
return new_ui_id;
|
|
14788
|
+
return await func.common.fastHash(ui_id);
|
|
14771
14789
|
};
|
|
14772
14790
|
|
|
14791
|
+
// 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) {
|
|
14792
|
+
// // const _paramsP = _.cloneDeep(paramsP);
|
|
14793
|
+
// const _paramsP = klona.klona(paramsP);
|
|
14794
|
+
// var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_paramsP.dsSessionP];
|
|
14795
|
+
// var $appendTo = $container;
|
|
14796
|
+
// if ($appendToP) $appendTo = $appendToP;
|
|
14797
|
+
// if (!$appendTo || !$appendTo.length) return null; // screen closed or not exist abort build
|
|
14798
|
+
// var div = 'div';
|
|
14799
|
+
// if (div_typeP) div = div_typeP;
|
|
14800
|
+
// var items = [];
|
|
14801
|
+
// if (nodeP.children)
|
|
14802
|
+
// items = nodeP.children.map(function (val) {
|
|
14803
|
+
// return val.xu_tree_id || val.id;
|
|
14804
|
+
// });
|
|
14805
|
+
// var currentRecordId = $container?.data?.()?.xuData?.recordid || (_ds ? _ds.currentRecordId : '');
|
|
14806
|
+
// // var xu_id = (glb.screen_num++).toString();
|
|
14807
|
+
// // xu_id = xu_id += '_' + currentRecordId;
|
|
14808
|
+
|
|
14809
|
+
// try {
|
|
14810
|
+
// const key_path = `${$container?.data()?.xuData?.key_path || '0'}-${keyP || '0'}`;
|
|
14811
|
+
// const elem_key = `${nodeP.xu_tree_id || nodeP.id}-${key_path}-${currentRecordId}`;
|
|
14812
|
+
// // let ui_id = `${nodeP.id}-${elem_key}-${_paramsP?.dsSessionP?.toString() || ''}`; //nodeP.xu_tree_id ||
|
|
14813
|
+
|
|
14814
|
+
// /////////////////////////////////
|
|
14815
|
+
|
|
14816
|
+
// var $div;
|
|
14817
|
+
|
|
14818
|
+
// if (div === 'svg') {
|
|
14819
|
+
// const draw_svg = function (element) {
|
|
14820
|
+
// const get_tag_str = function (element, prop, val) {
|
|
14821
|
+
// let class_str = '';
|
|
14822
|
+
// let attr_str = '';
|
|
14823
|
+
// for (const [key, val] of Object.entries(prop)) {
|
|
14824
|
+
// if (key.substr(0, 2) !== 'xu') {
|
|
14825
|
+
// attr_str += ` ${key}="${val}" `;
|
|
14826
|
+
// }
|
|
14827
|
+
// }
|
|
14828
|
+
// if (element === 'svg') {
|
|
14829
|
+
// return `<${element} ${attr_str} > `;
|
|
14830
|
+
// }
|
|
14831
|
+
// let ret = '';
|
|
14832
|
+
// if (val?.children?.length) {
|
|
14833
|
+
// ret = iterate_svg(val);
|
|
14834
|
+
// }
|
|
14835
|
+
|
|
14836
|
+
// return `<${element} ${class_str} ${attr_str} > ${ret} </${element}>`;
|
|
14837
|
+
// };
|
|
14838
|
+
// let svg_str = get_tag_str(element, prop);
|
|
14839
|
+
// let inner_str = '';
|
|
14840
|
+
// const iterate_svg = function (node) {
|
|
14841
|
+
// let ret = '';
|
|
14842
|
+
// if (node.children) {
|
|
14843
|
+
// for (let val of node.children) {
|
|
14844
|
+
// let prop = val.attributes;
|
|
14845
|
+
// ret += get_tag_str(val.tagName, prop, val);
|
|
14846
|
+
// }
|
|
14847
|
+
// }
|
|
14848
|
+
// return ret;
|
|
14849
|
+
// };
|
|
14850
|
+
// inner_str = iterate_svg(nodeP);
|
|
14851
|
+
|
|
14852
|
+
// $div = $(svg_str + inner_str + '</svg>').appendTo($appendTo);
|
|
14853
|
+
// };
|
|
14854
|
+
|
|
14855
|
+
// draw_svg(div_typeP);
|
|
14856
|
+
// } else {
|
|
14857
|
+
// $div = $(`<${div} ${attr_str ? attr_str : ''}>`);
|
|
14858
|
+
// }
|
|
14859
|
+
|
|
14860
|
+
// // // Returns a 32-bit unsigned integer hash of a string (FNV-1a)
|
|
14861
|
+
// // function hash32(str) {
|
|
14862
|
+
// // let h = 0x811c9dc5; // FNV offset basis
|
|
14863
|
+
// // for (let i = 0; i < str.length; i++) {
|
|
14864
|
+
// // h ^= str.charCodeAt(i);
|
|
14865
|
+
// // // multiply by FNV prime (2^24 + 2^8 + 0x93) with 32-bit overflow
|
|
14866
|
+
// // h += (h << 1) + (h << 4) + (h << 7) + (h << 8) + (h << 24);
|
|
14867
|
+
// // }
|
|
14868
|
+
// // // Convert to unsigned 32-bit
|
|
14869
|
+
// // return h >>> 0;
|
|
14870
|
+
// // }
|
|
14871
|
+
|
|
14872
|
+
// // function hash32hex(str) {
|
|
14873
|
+
// // return (hash32(str) >>> 0).toString(16).padStart(8, '0');
|
|
14874
|
+
// // }
|
|
14875
|
+
|
|
14876
|
+
// // const new_ui_id = hash32hex(ui_id);
|
|
14877
|
+
// // const new_ui_id = await func.common.sha256(ui_id);
|
|
14878
|
+
// const new_ui_id = await generate_xu_ui_id(SESSION_ID, nodeP, $container, paramsP, keyP);
|
|
14879
|
+
|
|
14880
|
+
// $div
|
|
14881
|
+
// .attr('xu-ui-id', new_ui_id)
|
|
14882
|
+
// // .attr('xu-node-id', nodeP.id)
|
|
14883
|
+
// .data({
|
|
14884
|
+
// xuData: {
|
|
14885
|
+
// prog_id: _paramsP.prog_id,
|
|
14886
|
+
// nodeid: nodeP.id,
|
|
14887
|
+
// ui_type: nodeP.tagName,
|
|
14888
|
+
// // xu_id,
|
|
14889
|
+
// recordid: currentRecordId,
|
|
14890
|
+
// paramsP: _paramsP,
|
|
14891
|
+
// key: keyP,
|
|
14892
|
+
// key_path, //:($container?.data()?.xuData?.key || "0") + "-" + (keyP || "0"),
|
|
14893
|
+
// screenId: _paramsP.screenId,
|
|
14894
|
+
// parent_container: $container?.attr('id'),
|
|
14895
|
+
// elem_key,
|
|
14896
|
+
// properties: prop,
|
|
14897
|
+
// node: nodeP,
|
|
14898
|
+
// node_org: _.cloneDeep(nodeP),
|
|
14899
|
+
// is_panelP: _paramsP.is_panelP,
|
|
14900
|
+
// ui_id: new_ui_id,
|
|
14901
|
+
// elem_prop: elem_propP,
|
|
14902
|
+
// debug_info: {
|
|
14903
|
+
// id: nodeP.id,
|
|
14904
|
+
// parent_id: $container?.data()?.xuData?.ui_id,
|
|
14905
|
+
// items: items,
|
|
14906
|
+
// },
|
|
14907
|
+
// parent_node: parent_nodeP,
|
|
14908
|
+
// currentRecordId: currentRecordId,
|
|
14909
|
+
// $root_container: $root_container,
|
|
14910
|
+
// parent_element_ui_id: $container?.data()?.xuData?.ui_id,
|
|
14911
|
+
// },
|
|
14912
|
+
// xuAttributes: {},
|
|
14913
|
+
// });
|
|
14914
|
+
// if (is_placeholder) {
|
|
14915
|
+
// $div.addClass('display_none');
|
|
14916
|
+
// }
|
|
14917
|
+
|
|
14918
|
+
// if (div_typeP !== 'svg') {
|
|
14919
|
+
// $div.appendTo($appendTo);
|
|
14920
|
+
// }
|
|
14921
|
+
// } catch (e) {
|
|
14922
|
+
// console.error(e);
|
|
14923
|
+
// }
|
|
14924
|
+
|
|
14925
|
+
// if (parent_infoP?.iterate_info) {
|
|
14926
|
+
// $div.data().xuData.iterate_info = parent_infoP.iterate_info;
|
|
14927
|
+
// }
|
|
14928
|
+
|
|
14929
|
+
// if (classP) $div.addClass(classP);
|
|
14930
|
+
|
|
14931
|
+
// return $div;
|
|
14932
|
+
// };
|
|
14933
|
+
|
|
14773
14934
|
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) {
|
|
14774
|
-
// const _paramsP = _.cloneDeep(paramsP);
|
|
14775
14935
|
const _paramsP = klona.klona(paramsP);
|
|
14776
|
-
|
|
14777
|
-
|
|
14778
|
-
|
|
14779
|
-
|
|
14780
|
-
|
|
14781
|
-
|
|
14782
|
-
|
|
14783
|
-
|
|
14784
|
-
|
|
14785
|
-
|
|
14786
|
-
|
|
14787
|
-
|
|
14788
|
-
|
|
14789
|
-
//
|
|
14936
|
+
const _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_paramsP.dsSessionP];
|
|
14937
|
+
const $appendTo = $appendToP || $container;
|
|
14938
|
+
|
|
14939
|
+
// Early exit if container doesn't exist
|
|
14940
|
+
if (!$appendTo?.length) return null;
|
|
14941
|
+
|
|
14942
|
+
const div = div_typeP || 'div';
|
|
14943
|
+
|
|
14944
|
+
// Cache container data to avoid repeated access
|
|
14945
|
+
const containerData = $container?.data?.();
|
|
14946
|
+
const containerXuData = containerData?.xuData;
|
|
14947
|
+
const currentRecordId = containerXuData?.recordid || (_ds ? _ds.currentRecordId : '');
|
|
14948
|
+
|
|
14949
|
+
// Pre-compute items array
|
|
14950
|
+
const items = nodeP.children ? nodeP.children.map((val) => val.xu_tree_id || val.id) : [];
|
|
14790
14951
|
|
|
14791
14952
|
try {
|
|
14792
|
-
const key_path = `${
|
|
14953
|
+
const key_path = `${containerXuData?.key_path || '0'}-${keyP || '0'}`;
|
|
14793
14954
|
const elem_key = `${nodeP.xu_tree_id || nodeP.id}-${key_path}-${currentRecordId}`;
|
|
14794
|
-
// let ui_id = `${nodeP.id}-${elem_key}-${_paramsP?.dsSessionP?.toString() || ''}`; //nodeP.xu_tree_id ||
|
|
14795
|
-
|
|
14796
|
-
/////////////////////////////////
|
|
14797
14955
|
|
|
14798
|
-
|
|
14956
|
+
let $div;
|
|
14799
14957
|
|
|
14958
|
+
// Handle SVG creation
|
|
14800
14959
|
if (div === 'svg') {
|
|
14801
14960
|
const draw_svg = function (element) {
|
|
14802
14961
|
const get_tag_str = function (element, prop, val) {
|
|
14803
|
-
|
|
14804
|
-
|
|
14805
|
-
for (const [key,
|
|
14806
|
-
if (key.
|
|
14807
|
-
|
|
14962
|
+
const attrs = [];
|
|
14963
|
+
|
|
14964
|
+
for (const [key, value] of Object.entries(prop)) {
|
|
14965
|
+
if (!key.startsWith('xu')) {
|
|
14966
|
+
attrs.push(`${key}="${value}"`);
|
|
14808
14967
|
}
|
|
14809
14968
|
}
|
|
14969
|
+
|
|
14970
|
+
const attr_str = attrs.join(' ');
|
|
14971
|
+
|
|
14810
14972
|
if (element === 'svg') {
|
|
14811
|
-
return `<${element}
|
|
14812
|
-
}
|
|
14813
|
-
let ret = '';
|
|
14814
|
-
if (val?.children?.length) {
|
|
14815
|
-
ret = iterate_svg(val);
|
|
14973
|
+
return `<${element} ${attr_str}>`;
|
|
14816
14974
|
}
|
|
14817
14975
|
|
|
14818
|
-
|
|
14976
|
+
const inner = val?.children?.length ? iterate_svg(val) : '';
|
|
14977
|
+
return `<${element} ${attr_str}>${inner}</${element}>`;
|
|
14819
14978
|
};
|
|
14820
|
-
|
|
14821
|
-
let inner_str = '';
|
|
14979
|
+
|
|
14822
14980
|
const iterate_svg = function (node) {
|
|
14823
|
-
|
|
14824
|
-
|
|
14825
|
-
|
|
14826
|
-
let prop = val.attributes;
|
|
14827
|
-
ret += get_tag_str(val.tagName, prop, val);
|
|
14828
|
-
}
|
|
14829
|
-
}
|
|
14830
|
-
return ret;
|
|
14981
|
+
if (!node.children) return '';
|
|
14982
|
+
|
|
14983
|
+
return node.children.map((val) => get_tag_str(val.tagName, val.attributes, val)).join('');
|
|
14831
14984
|
};
|
|
14832
|
-
|
|
14985
|
+
|
|
14986
|
+
const svg_str = get_tag_str(element, prop);
|
|
14987
|
+
const inner_str = iterate_svg(nodeP);
|
|
14833
14988
|
|
|
14834
14989
|
$div = $(svg_str + inner_str + '</svg>').appendTo($appendTo);
|
|
14835
14990
|
};
|
|
14836
14991
|
|
|
14837
14992
|
draw_svg(div_typeP);
|
|
14838
14993
|
} else {
|
|
14839
|
-
$div = $(`<${div}
|
|
14994
|
+
$div = $(`<${div}${attr_str ? ' ' + attr_str : ''}>`);
|
|
14840
14995
|
}
|
|
14841
14996
|
|
|
14842
|
-
//
|
|
14843
|
-
|
|
14844
|
-
// let h = 0x811c9dc5; // FNV offset basis
|
|
14845
|
-
// for (let i = 0; i < str.length; i++) {
|
|
14846
|
-
// h ^= str.charCodeAt(i);
|
|
14847
|
-
// // multiply by FNV prime (2^24 + 2^8 + 0x93) with 32-bit overflow
|
|
14848
|
-
// h += (h << 1) + (h << 4) + (h << 7) + (h << 8) + (h << 24);
|
|
14849
|
-
// }
|
|
14850
|
-
// // Convert to unsigned 32-bit
|
|
14851
|
-
// return h >>> 0;
|
|
14852
|
-
// }
|
|
14997
|
+
// Generate UI ID
|
|
14998
|
+
const new_ui_id = await generate_xu_ui_id(SESSION_ID, nodeP, $container, paramsP, keyP);
|
|
14853
14999
|
|
|
14854
|
-
//
|
|
14855
|
-
|
|
14856
|
-
|
|
15000
|
+
// Set attributes and data in one go
|
|
15001
|
+
$div.attr('xu-ui-id', new_ui_id);
|
|
15002
|
+
|
|
15003
|
+
// Build xuData object efficiently
|
|
15004
|
+
const xuData = {
|
|
15005
|
+
prog_id: _paramsP.prog_id,
|
|
15006
|
+
nodeid: nodeP.id,
|
|
15007
|
+
ui_type: nodeP.tagName,
|
|
15008
|
+
recordid: currentRecordId,
|
|
15009
|
+
paramsP: _paramsP,
|
|
15010
|
+
key: keyP,
|
|
15011
|
+
key_path,
|
|
15012
|
+
screenId: _paramsP.screenId,
|
|
15013
|
+
parent_container: containerData?.id,
|
|
15014
|
+
elem_key,
|
|
15015
|
+
properties: prop,
|
|
15016
|
+
node: nodeP,
|
|
15017
|
+
node_org: _.cloneDeep(nodeP),
|
|
15018
|
+
is_panelP: _paramsP.is_panelP,
|
|
15019
|
+
ui_id: new_ui_id,
|
|
15020
|
+
elem_prop: elem_propP,
|
|
15021
|
+
debug_info: {
|
|
15022
|
+
id: nodeP.id,
|
|
15023
|
+
parent_id: containerXuData?.ui_id,
|
|
15024
|
+
items: items,
|
|
15025
|
+
},
|
|
15026
|
+
parent_node: parent_nodeP,
|
|
15027
|
+
currentRecordId: currentRecordId,
|
|
15028
|
+
$root_container: $root_container,
|
|
15029
|
+
parent_element_ui_id: containerXuData?.ui_id,
|
|
15030
|
+
};
|
|
14857
15031
|
|
|
14858
|
-
//
|
|
14859
|
-
|
|
14860
|
-
|
|
15032
|
+
// Add iterate_info if present
|
|
15033
|
+
if (parent_infoP?.iterate_info) {
|
|
15034
|
+
xuData.iterate_info = parent_infoP.iterate_info;
|
|
15035
|
+
}
|
|
14861
15036
|
|
|
14862
|
-
|
|
14863
|
-
|
|
14864
|
-
|
|
14865
|
-
|
|
14866
|
-
|
|
14867
|
-
|
|
14868
|
-
|
|
14869
|
-
ui_type: nodeP.tagName,
|
|
14870
|
-
// xu_id,
|
|
14871
|
-
recordid: currentRecordId,
|
|
14872
|
-
paramsP: _paramsP,
|
|
14873
|
-
key: keyP,
|
|
14874
|
-
key_path, //:($container?.data()?.xuData?.key || "0") + "-" + (keyP || "0"),
|
|
14875
|
-
screenId: _paramsP.screenId,
|
|
14876
|
-
parent_container: $container?.attr('id'),
|
|
14877
|
-
elem_key,
|
|
14878
|
-
properties: prop,
|
|
14879
|
-
node: nodeP,
|
|
14880
|
-
node_org: _.cloneDeep(nodeP),
|
|
14881
|
-
is_panelP: _paramsP.is_panelP,
|
|
14882
|
-
ui_id: new_ui_id,
|
|
14883
|
-
elem_prop: elem_propP,
|
|
14884
|
-
debug_info: {
|
|
14885
|
-
id: nodeP.id,
|
|
14886
|
-
parent_id: $container?.data()?.xuData?.ui_id,
|
|
14887
|
-
items: items,
|
|
14888
|
-
},
|
|
14889
|
-
parent_node: parent_nodeP,
|
|
14890
|
-
currentRecordId: currentRecordId,
|
|
14891
|
-
$root_container: $root_container,
|
|
14892
|
-
parent_element_ui_id: $container?.data()?.xuData?.ui_id,
|
|
14893
|
-
},
|
|
14894
|
-
xuAttributes: {},
|
|
14895
|
-
});
|
|
15037
|
+
// Set data once
|
|
15038
|
+
$div.data({
|
|
15039
|
+
xuData: xuData,
|
|
15040
|
+
xuAttributes: {},
|
|
15041
|
+
});
|
|
15042
|
+
|
|
15043
|
+
// Apply placeholder class if needed
|
|
14896
15044
|
if (is_placeholder) {
|
|
14897
15045
|
$div.addClass('display_none');
|
|
14898
15046
|
}
|
|
14899
15047
|
|
|
15048
|
+
// Apply custom class if provided
|
|
15049
|
+
if (classP) {
|
|
15050
|
+
$div.addClass(classP);
|
|
15051
|
+
}
|
|
15052
|
+
|
|
15053
|
+
// Append to DOM (only for non-SVG elements)
|
|
14900
15054
|
if (div_typeP !== 'svg') {
|
|
14901
15055
|
$div.appendTo($appendTo);
|
|
14902
15056
|
}
|
|
14903
|
-
} catch (e) {
|
|
14904
|
-
console.error(e);
|
|
14905
|
-
}
|
|
14906
15057
|
|
|
14907
|
-
|
|
14908
|
-
|
|
15058
|
+
return $div;
|
|
15059
|
+
} catch (e) {
|
|
15060
|
+
console.error('create_container error:', e);
|
|
15061
|
+
return null;
|
|
14909
15062
|
}
|
|
14910
|
-
|
|
14911
|
-
if (classP) $div.addClass(classP);
|
|
14912
|
-
|
|
14913
|
-
return $div;
|
|
14914
15063
|
};
|
|
15064
|
+
|
|
14915
15065
|
func.UI.screen.execute_screen_ready_events = async function (SESSION_ID, paramsP, sourceP, $div, jobNoP, $div_objP) {
|
|
14916
15066
|
var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
|
|
14917
15067
|
if (!_ds) return;
|