@xuda.io/runtime-bundle 1.0.973 → 1.0.975

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.
@@ -8540,29 +8540,31 @@ func.UI.worker.add_to_queue = async function (SESSION_ID, source, functionP, par
8540
8540
  return;
8541
8541
  }
8542
8542
  }
8543
- calling_job = false;
8544
- if (calling_job) {
8545
- var job_index = func.UI.worker.find_job_index(SESSION_ID, calling_job);
8546
8543
 
8547
- if (job_index === null || typeof job_index === 'undefined') return;
8544
+ // if (calling_job) {
8545
+ // var job_index = func.UI.worker.find_job_index(SESSION_ID, calling_job);
8548
8546
 
8549
- try {
8550
- if (!UI_WORKER_OBJ.jobs[job_index].splice_count) {
8551
- UI_WORKER_OBJ.jobs[job_index].splice_count = 0;
8552
- }
8553
- UI_WORKER_OBJ.jobs[job_index].splice_count++;
8554
- UI_WORKER_OBJ.jobs.splice(job_index + UI_WORKER_OBJ.jobs[job_index].splice_count, 0, obj);
8555
- // }
8556
- } catch (e) {
8557
- console.error('bug');
8558
- // UI_WORKER_OBJ.jobs.splice(0, 0, obj);
8559
- }
8560
- } else {
8561
- // check case of xu-render if queue has child node of the element then delete job
8562
- // check case of execute attributes that queue not contain the element then add to parallel queue
8547
+ // if (job_index === null || typeof job_index === 'undefined') return;
8563
8548
 
8564
- UI_WORKER_OBJ.jobs.push(obj);
8565
- }
8549
+ // try {
8550
+ // if (!UI_WORKER_OBJ.jobs[job_index].splice_count) {
8551
+ // UI_WORKER_OBJ.jobs[job_index].splice_count = 0;
8552
+ // }
8553
+ // UI_WORKER_OBJ.jobs[job_index].splice_count++;
8554
+ // UI_WORKER_OBJ.jobs.splice(job_index + UI_WORKER_OBJ.jobs[job_index].splice_count, 0, obj);
8555
+ // // }
8556
+ // } catch (e) {
8557
+ // console.error('bug');
8558
+ // // UI_WORKER_OBJ.jobs.splice(0, 0, obj);
8559
+ // }
8560
+ // } else {
8561
+ // // check case of xu-render if queue has child node of the element then delete job
8562
+ // // check case of execute attributes that queue not contain the element then add to parallel queue
8563
+
8564
+ // UI_WORKER_OBJ.jobs.push(obj);
8565
+ // }
8566
+
8567
+ UI_WORKER_OBJ.jobs.push(obj);
8566
8568
 
8567
8569
  UI_WORKER_OBJ.num++;
8568
8570
  return UI_WORKER_OBJ.num - 1;
@@ -12079,7 +12081,7 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
12079
12081
  // };
12080
12082
  const program = val.value?.prog || val.value;
12081
12083
  var $wrapper = $('<div>');
12082
- 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, '');
12083
12085
  const params_obj = await get_params_obj_new(SESSION_ID, program, nodeP, paramsP.dsSessionP);
12084
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);
12085
12087
  ret = {
@@ -12449,6 +12451,7 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
12449
12451
  let $xurender = $('<xurender>')
12450
12452
  // .attr('xu-ui-id', nodeP.id + '_' + $elm.data().xuData.recordid)
12451
12453
  .attr('xu-ui-id', $elm.attr('xu-ui-id'))
12454
+ .attr('hidden', true)
12452
12455
  .appendTo($container)
12453
12456
  .hide();
12454
12457
  let original_data_obj = {
@@ -13401,7 +13404,7 @@ func.UI.screen.panel_post_render_handler = async function (
13401
13404
  return jobNoP;
13402
13405
  };
13403
13406
 
13404
- 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) {
13405
13408
  const _paramsP = _.cloneDeep(paramsP);
13406
13409
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_paramsP.dsSessionP];
13407
13410
  var $appendTo = $container;
@@ -13472,7 +13475,24 @@ func.UI.screen.create_container = function (SESSION_ID, $root_container, nodeP,
13472
13475
  // $div = $(`<${div} ${attr_str ? attr_str : ""} ${svg_attributes_str}>`);
13473
13476
  // } else {
13474
13477
  // $div = $(`<${div} ${attr_str ? attr_str : ""}>`);
13475
- $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
+ const new_ui_id = await generateHash(ui_id);
13494
+
13495
+ $div.attr('xu-ui-id', new_ui_id).data({
13476
13496
  xuData: {
13477
13497
  prog_id: _paramsP.prog_id,
13478
13498
  nodeid: nodeP.id,
@@ -13489,7 +13509,7 @@ func.UI.screen.create_container = function (SESSION_ID, $root_container, nodeP,
13489
13509
  node: nodeP,
13490
13510
  node_org: _.cloneDeep(nodeP),
13491
13511
  is_panelP: _paramsP.is_panelP,
13492
- ui_id,
13512
+ ui_id: new_ui_id,
13493
13513
  elem_prop: elem_propP,
13494
13514
  debug_info: {
13495
13515
  id: nodeP.id,
@@ -14163,7 +14183,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
14163
14183
  var exist_elm_obj = get_element_info();
14164
14184
  var $div = exist_elm_obj.div;
14165
14185
  if (!exist_elm_obj.div) {
14166
- $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);
14186
+ $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);
14167
14187
 
14168
14188
  //////////////////////////
14169
14189
 
@@ -14365,7 +14385,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
14365
14385
 
14366
14386
  if (!exist_elm_obj.div) {
14367
14387
  var $wrapper = $('<div>');
14368
- $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, 'div', $wrapper, '');
14388
+ $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, '');
14369
14389
 
14370
14390
  if (!$div) return;
14371
14391
 
@@ -14505,7 +14525,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
14505
14525
  };
14506
14526
 
14507
14527
  var $wrapper = $('<div>');
14508
- $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, null, $wrapper, '');
14528
+ $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, '');
14509
14529
 
14510
14530
  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);
14511
14531
  if (ret.abort) {
@@ -14535,7 +14555,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
14535
14555
  if (!element || element === 'script') return await done();
14536
14556
  let str = '';
14537
14557
 
14538
- 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);
14558
+ 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);
14539
14559
 
14540
14560
  $div.hover(
14541
14561
  function (e) {
@@ -8541,29 +8541,31 @@ func.UI.worker.add_to_queue = async function (SESSION_ID, source, functionP, par
8541
8541
  return;
8542
8542
  }
8543
8543
  }
8544
- calling_job = false;
8545
- if (calling_job) {
8546
- var job_index = func.UI.worker.find_job_index(SESSION_ID, calling_job);
8547
8544
 
8548
- if (job_index === null || typeof job_index === 'undefined') return;
8545
+ // if (calling_job) {
8546
+ // var job_index = func.UI.worker.find_job_index(SESSION_ID, calling_job);
8549
8547
 
8550
- try {
8551
- if (!UI_WORKER_OBJ.jobs[job_index].splice_count) {
8552
- UI_WORKER_OBJ.jobs[job_index].splice_count = 0;
8553
- }
8554
- UI_WORKER_OBJ.jobs[job_index].splice_count++;
8555
- UI_WORKER_OBJ.jobs.splice(job_index + UI_WORKER_OBJ.jobs[job_index].splice_count, 0, obj);
8556
- // }
8557
- } catch (e) {
8558
- console.error('bug');
8559
- // UI_WORKER_OBJ.jobs.splice(0, 0, obj);
8560
- }
8561
- } else {
8562
- // check case of xu-render if queue has child node of the element then delete job
8563
- // check case of execute attributes that queue not contain the element then add to parallel queue
8548
+ // if (job_index === null || typeof job_index === 'undefined') return;
8564
8549
 
8565
- UI_WORKER_OBJ.jobs.push(obj);
8566
- }
8550
+ // try {
8551
+ // if (!UI_WORKER_OBJ.jobs[job_index].splice_count) {
8552
+ // UI_WORKER_OBJ.jobs[job_index].splice_count = 0;
8553
+ // }
8554
+ // UI_WORKER_OBJ.jobs[job_index].splice_count++;
8555
+ // UI_WORKER_OBJ.jobs.splice(job_index + UI_WORKER_OBJ.jobs[job_index].splice_count, 0, obj);
8556
+ // // }
8557
+ // } catch (e) {
8558
+ // console.error('bug');
8559
+ // // UI_WORKER_OBJ.jobs.splice(0, 0, obj);
8560
+ // }
8561
+ // } else {
8562
+ // // check case of xu-render if queue has child node of the element then delete job
8563
+ // // check case of execute attributes that queue not contain the element then add to parallel queue
8564
+
8565
+ // UI_WORKER_OBJ.jobs.push(obj);
8566
+ // }
8567
+
8568
+ UI_WORKER_OBJ.jobs.push(obj);
8567
8569
 
8568
8570
  UI_WORKER_OBJ.num++;
8569
8571
  return UI_WORKER_OBJ.num - 1;
@@ -9806,7 +9808,7 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
9806
9808
  // };
9807
9809
  const program = val.value?.prog || val.value;
9808
9810
  var $wrapper = $('<div>');
9809
- 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, '');
9810
9812
  const params_obj = await get_params_obj_new(SESSION_ID, program, nodeP, paramsP.dsSessionP);
9811
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);
9812
9814
  ret = {
@@ -10176,6 +10178,7 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
10176
10178
  let $xurender = $('<xurender>')
10177
10179
  // .attr('xu-ui-id', nodeP.id + '_' + $elm.data().xuData.recordid)
10178
10180
  .attr('xu-ui-id', $elm.attr('xu-ui-id'))
10181
+ .attr('hidden', true)
10179
10182
  .appendTo($container)
10180
10183
  .hide();
10181
10184
  let original_data_obj = {
@@ -11128,7 +11131,7 @@ func.UI.screen.panel_post_render_handler = async function (
11128
11131
  return jobNoP;
11129
11132
  };
11130
11133
 
11131
- 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) {
11132
11135
  const _paramsP = _.cloneDeep(paramsP);
11133
11136
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_paramsP.dsSessionP];
11134
11137
  var $appendTo = $container;
@@ -11199,7 +11202,24 @@ func.UI.screen.create_container = function (SESSION_ID, $root_container, nodeP,
11199
11202
  // $div = $(`<${div} ${attr_str ? attr_str : ""} ${svg_attributes_str}>`);
11200
11203
  // } else {
11201
11204
  // $div = $(`<${div} ${attr_str ? attr_str : ""}>`);
11202
- $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
+ const new_ui_id = await generateHash(ui_id);
11221
+
11222
+ $div.attr('xu-ui-id', new_ui_id).data({
11203
11223
  xuData: {
11204
11224
  prog_id: _paramsP.prog_id,
11205
11225
  nodeid: nodeP.id,
@@ -11216,7 +11236,7 @@ func.UI.screen.create_container = function (SESSION_ID, $root_container, nodeP,
11216
11236
  node: nodeP,
11217
11237
  node_org: _.cloneDeep(nodeP),
11218
11238
  is_panelP: _paramsP.is_panelP,
11219
- ui_id,
11239
+ ui_id: new_ui_id,
11220
11240
  elem_prop: elem_propP,
11221
11241
  debug_info: {
11222
11242
  id: nodeP.id,
@@ -11890,7 +11910,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
11890
11910
  var exist_elm_obj = get_element_info();
11891
11911
  var $div = exist_elm_obj.div;
11892
11912
  if (!exist_elm_obj.div) {
11893
- $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);
11913
+ $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);
11894
11914
 
11895
11915
  //////////////////////////
11896
11916
 
@@ -12092,7 +12112,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
12092
12112
 
12093
12113
  if (!exist_elm_obj.div) {
12094
12114
  var $wrapper = $('<div>');
12095
- $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, 'div', $wrapper, '');
12115
+ $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, '');
12096
12116
 
12097
12117
  if (!$div) return;
12098
12118
 
@@ -12232,7 +12252,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
12232
12252
  };
12233
12253
 
12234
12254
  var $wrapper = $('<div>');
12235
- $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, null, $wrapper, '');
12255
+ $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, '');
12236
12256
 
12237
12257
  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);
12238
12258
  if (ret.abort) {
@@ -12262,7 +12282,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
12262
12282
  if (!element || element === 'script') return await done();
12263
12283
  let str = '';
12264
12284
 
12265
- 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);
12285
+ 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);
12266
12286
 
12267
12287
  $div.hover(
12268
12288
  function (e) {