@xuda.io/runtime-bundle 1.0.974 → 1.0.976

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.
@@ -11704,7 +11704,7 @@ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, j
11704
11704
  if (attr === 'xu-exp:xu-for' || attr === 'xu-for') {
11705
11705
  if (val?.includes(field_id)) {
11706
11706
  const parent_element_ui_id = node_id;
11707
-
11707
+ debugger;
11708
11708
  let _$elem = $(`[xu-ui-id^=${parent_element_ui_id}]`);
11709
11709
 
11710
11710
  const _elem_key = parent_element_ui_id;
@@ -12081,7 +12081,7 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
12081
12081
  // };
12082
12082
  const program = val.value?.prog || val.value;
12083
12083
  var $wrapper = $('<div>');
12084
- var $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, nodeP.attributes, null, null, null, $wrapper, '');
12084
+ var $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, nodeP.attributes, null, null, null, $wrapper, '');
12085
12085
  const params_obj = await get_params_obj_new(SESSION_ID, program, nodeP, paramsP.dsSessionP);
12086
12086
  let ret_init = await func.UI.screen.init(SESSION_ID, program, paramsP.screenId, _ds, $div, null, _ds.currentRecordId, jobNoP, true, params_obj.params_res, 'alterXu_panel', undefined, undefined, params_obj.params_raw);
12087
12087
  ret = {
@@ -13404,7 +13404,7 @@ func.UI.screen.panel_post_render_handler = async function (
13404
13404
  return jobNoP;
13405
13405
  };
13406
13406
 
13407
- func.UI.screen.create_container = function (SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, classP, elem_propP, div_typeP, $appendToP, attr_str) {
13407
+ 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) {
13408
13408
  const _paramsP = _.cloneDeep(paramsP);
13409
13409
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_paramsP.dsSessionP];
13410
13410
  var $appendTo = $container;
@@ -13475,7 +13475,29 @@ func.UI.screen.create_container = function (SESSION_ID, $root_container, nodeP,
13475
13475
  // $div = $(`<${div} ${attr_str ? attr_str : ""} ${svg_attributes_str}>`);
13476
13476
  // } else {
13477
13477
  // $div = $(`<${div} ${attr_str ? attr_str : ""}>`);
13478
- $div.attr('xu-ui-id', ui_id).data({
13478
+
13479
+ // async function generateHash(str, algorithm = 'SHA-256') {
13480
+ // // Encode the string as UTF-8
13481
+ // const msgBuffer = new TextEncoder().encode(str);
13482
+
13483
+ // // Hash the string
13484
+ // const hashBuffer = await crypto.subtle.digest(algorithm, msgBuffer);
13485
+
13486
+ // // Convert to hex string
13487
+ // const hashArray = Array.from(new Uint8Array(hashBuffer));
13488
+ // const hashHex = hashArray.map((b) => b.toString(16).padStart(2, '0')).join('');
13489
+
13490
+ // return hashHex;
13491
+ // }
13492
+
13493
+ function hash32hex(str) {
13494
+ return (hash32(str) >>> 0).toString(16).padStart(8, '0');
13495
+ }
13496
+
13497
+ // const new_ui_id = await generateHash(ui_id);
13498
+ const new_ui_id = hash32hex(ui_id);
13499
+
13500
+ $div.attr('xu-ui-id', new_ui_id).data({
13479
13501
  xuData: {
13480
13502
  prog_id: _paramsP.prog_id,
13481
13503
  nodeid: nodeP.id,
@@ -13492,7 +13514,7 @@ func.UI.screen.create_container = function (SESSION_ID, $root_container, nodeP,
13492
13514
  node: nodeP,
13493
13515
  node_org: _.cloneDeep(nodeP),
13494
13516
  is_panelP: _paramsP.is_panelP,
13495
- ui_id,
13517
+ ui_id: new_ui_id,
13496
13518
  elem_prop: elem_propP,
13497
13519
  debug_info: {
13498
13520
  id: nodeP.id,
@@ -14166,7 +14188,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
14166
14188
  var exist_elm_obj = get_element_info();
14167
14189
  var $div = exist_elm_obj.div;
14168
14190
  if (!exist_elm_obj.div) {
14169
- $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, 'widget_wrapper', null, null, null, null);
14191
+ $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);
14170
14192
 
14171
14193
  //////////////////////////
14172
14194
 
@@ -14368,7 +14390,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
14368
14390
 
14369
14391
  if (!exist_elm_obj.div) {
14370
14392
  var $wrapper = $('<div>');
14371
- $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, 'div', $wrapper, '');
14393
+ $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, '');
14372
14394
 
14373
14395
  if (!$div) return;
14374
14396
 
@@ -14508,7 +14530,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
14508
14530
  };
14509
14531
 
14510
14532
  var $wrapper = $('<div>');
14511
- $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, null, $wrapper, '');
14533
+ $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, '');
14512
14534
 
14513
14535
  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);
14514
14536
  if (ret.abort) {
@@ -14538,7 +14560,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
14538
14560
  if (!element || element === 'script') return await done();
14539
14561
  let str = '';
14540
14562
 
14541
- var $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, element, null, str);
14563
+ 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);
14542
14564
 
14543
14565
  $div.hover(
14544
14566
  function (e) {
@@ -9431,7 +9431,7 @@ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, j
9431
9431
  if (attr === 'xu-exp:xu-for' || attr === 'xu-for') {
9432
9432
  if (val?.includes(field_id)) {
9433
9433
  const parent_element_ui_id = node_id;
9434
-
9434
+ debugger;
9435
9435
  let _$elem = $(`[xu-ui-id^=${parent_element_ui_id}]`);
9436
9436
 
9437
9437
  const _elem_key = parent_element_ui_id;
@@ -9808,7 +9808,7 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
9808
9808
  // };
9809
9809
  const program = val.value?.prog || val.value;
9810
9810
  var $wrapper = $('<div>');
9811
- var $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, nodeP.attributes, null, null, null, $wrapper, '');
9811
+ var $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, nodeP.attributes, null, null, null, $wrapper, '');
9812
9812
  const params_obj = await get_params_obj_new(SESSION_ID, program, nodeP, paramsP.dsSessionP);
9813
9813
  let ret_init = await func.UI.screen.init(SESSION_ID, program, paramsP.screenId, _ds, $div, null, _ds.currentRecordId, jobNoP, true, params_obj.params_res, 'alterXu_panel', undefined, undefined, params_obj.params_raw);
9814
9814
  ret = {
@@ -11131,7 +11131,7 @@ func.UI.screen.panel_post_render_handler = async function (
11131
11131
  return jobNoP;
11132
11132
  };
11133
11133
 
11134
- func.UI.screen.create_container = function (SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, classP, elem_propP, div_typeP, $appendToP, attr_str) {
11134
+ 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) {
11135
11135
  const _paramsP = _.cloneDeep(paramsP);
11136
11136
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_paramsP.dsSessionP];
11137
11137
  var $appendTo = $container;
@@ -11202,7 +11202,29 @@ func.UI.screen.create_container = function (SESSION_ID, $root_container, nodeP,
11202
11202
  // $div = $(`<${div} ${attr_str ? attr_str : ""} ${svg_attributes_str}>`);
11203
11203
  // } else {
11204
11204
  // $div = $(`<${div} ${attr_str ? attr_str : ""}>`);
11205
- $div.attr('xu-ui-id', ui_id).data({
11205
+
11206
+ // async function generateHash(str, algorithm = 'SHA-256') {
11207
+ // // Encode the string as UTF-8
11208
+ // const msgBuffer = new TextEncoder().encode(str);
11209
+
11210
+ // // Hash the string
11211
+ // const hashBuffer = await crypto.subtle.digest(algorithm, msgBuffer);
11212
+
11213
+ // // Convert to hex string
11214
+ // const hashArray = Array.from(new Uint8Array(hashBuffer));
11215
+ // const hashHex = hashArray.map((b) => b.toString(16).padStart(2, '0')).join('');
11216
+
11217
+ // return hashHex;
11218
+ // }
11219
+
11220
+ function hash32hex(str) {
11221
+ return (hash32(str) >>> 0).toString(16).padStart(8, '0');
11222
+ }
11223
+
11224
+ // const new_ui_id = await generateHash(ui_id);
11225
+ const new_ui_id = hash32hex(ui_id);
11226
+
11227
+ $div.attr('xu-ui-id', new_ui_id).data({
11206
11228
  xuData: {
11207
11229
  prog_id: _paramsP.prog_id,
11208
11230
  nodeid: nodeP.id,
@@ -11219,7 +11241,7 @@ func.UI.screen.create_container = function (SESSION_ID, $root_container, nodeP,
11219
11241
  node: nodeP,
11220
11242
  node_org: _.cloneDeep(nodeP),
11221
11243
  is_panelP: _paramsP.is_panelP,
11222
- ui_id,
11244
+ ui_id: new_ui_id,
11223
11245
  elem_prop: elem_propP,
11224
11246
  debug_info: {
11225
11247
  id: nodeP.id,
@@ -11893,7 +11915,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
11893
11915
  var exist_elm_obj = get_element_info();
11894
11916
  var $div = exist_elm_obj.div;
11895
11917
  if (!exist_elm_obj.div) {
11896
- $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, 'widget_wrapper', null, null, null, null);
11918
+ $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);
11897
11919
 
11898
11920
  //////////////////////////
11899
11921
 
@@ -12095,7 +12117,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
12095
12117
 
12096
12118
  if (!exist_elm_obj.div) {
12097
12119
  var $wrapper = $('<div>');
12098
- $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, 'div', $wrapper, '');
12120
+ $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, '');
12099
12121
 
12100
12122
  if (!$div) return;
12101
12123
 
@@ -12235,7 +12257,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
12235
12257
  };
12236
12258
 
12237
12259
  var $wrapper = $('<div>');
12238
- $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, null, $wrapper, '');
12260
+ $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, '');
12239
12261
 
12240
12262
  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);
12241
12263
  if (ret.abort) {
@@ -12265,7 +12287,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
12265
12287
  if (!element || element === 'script') return await done();
12266
12288
  let str = '';
12267
12289
 
12268
- var $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, element, null, str);
12290
+ 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);
12269
12291
 
12270
12292
  $div.hover(
12271
12293
  function (e) {