@xuda.io/runtime-bundle 1.0.1054 → 1.0.1056

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.
@@ -12642,112 +12642,45 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
12642
12642
  const init_render = async function () {
12643
12643
  nodeP.xu_render_made = value;
12644
12644
  if (!value) {
12645
- // const cloned_$div = $elm.clone(true);
12646
-
12647
- // const xu_ui_id = await generate_xu_ui_id(SESSION_ID, nodeP, $container, paramsP, keyP);
12648
-
12649
- // let $xurender = $('<xurender>').attr('xu-ui-id', xu_ui_id).attr('hidden', true).appendTo($container).hide();
12650
- // let original_data_obj = {
12651
- // force_render: true,
12652
- // $container: cloned_$div,
12653
- // nodeP: _.cloneDeep(nodeP),
12654
- // parent_infoP,
12655
- // paramsP,
12656
- // keyP,
12657
- // parent_nodeP,
12658
- // $root_container,
12659
- // };
12660
- // $xurender.data('xuData', cloned_$div.data().xuData);
12661
- // $xurender.data().xuData.original_data_obj = original_data_obj;
12662
- // $xurender.data().xuData.xurender_node = cloned_$div;
12663
- // $xurender.data().xuAttributes = nodeP.attributes || {};
12664
- // $xurender.hide();
12665
-
12666
- // $elm.remove();
12667
- // nodeP.xu_render_made = true;
12668
-
12669
12645
  return { has_xu_render_attribute: true, xu_render_in_process: true };
12670
12646
  }
12671
12647
  return { has_xu_render_attribute: true };
12672
12648
  };
12673
12649
 
12674
12650
  const post_render = async function () {
12651
+ // always come from refresh
12675
12652
  let nodeP = $container.data().xuData.node.children[keyP];
12676
12653
  nodeP.xu_render_made = value;
12677
12654
  if (value) {
12678
12655
  try {
12679
- // // abort if already rended
12680
- // if ($elm[0].tagName !== 'XURENDER' && $elm?.length) {
12681
- // return func.events.delete_job(SESSION_ID, jobNoP);
12682
- // }
12683
-
12684
- // let original_data_obj = $elm.data().xuData.original_data_obj;
12685
-
12686
- // if (!original_data_obj) {
12687
- // func.events.delete_job(SESSION_ID, jobNoP);
12688
- // return { delete_job: jobNoP };
12689
- // }
12690
-
12691
- ////////////
12692
12656
  const xu_render_cache_id = await get_xu_render_cache_str(SESSION_ID, paramsP.dsSessionP);
12693
12657
  const xu_ui_id = $elm.attr('xu-ui-id');
12694
12658
  let new_$div = UI_WORKER_OBJ?.xu_render_cache?.[xu_ui_id]?.[xu_render_cache_id]?.$div.clone(true);
12695
12659
 
12696
- /////////////
12697
- // let new_$div = original_data_obj.$container.clone(true);
12698
-
12699
12660
  if (!new_$div) {
12700
- new_$div = await func.UI.screen.render_ui_tree(
12701
- SESSION_ID,
12702
- $container, //original_data_obj.$container,
12703
- nodeP,
12704
- parent_infoP,
12705
- paramsP,
12706
- jobNoP,
12707
- null,
12708
- keyP,
12709
- null,
12710
- parent_nodeP,
12711
- null,
12712
- $root_container,
12713
- );
12714
-
12715
- UI_WORKER_OBJ.xu_render_cache[xu_ui_id][xu_render_cache_id] = { $div: new_$div.clone(true) };
12661
+ UI_WORKER_OBJ.xu_render_cache[xu_ui_id][xu_render_cache_id] = {};
12716
12662
  nodeP.xu_render_xu_ui_id = xu_ui_id;
12717
12663
  nodeP.xu_render_cache_id = xu_render_cache_id;
12664
+ new_$div = await func.UI.screen.render_ui_tree(SESSION_ID, $container, nodeP, parent_infoP, paramsP, jobNoP, null, keyP, null, parent_nodeP, null, $root_container);
12665
+ UI_WORKER_OBJ.xu_render_cache[xu_ui_id][xu_render_cache_id].$div = new_$div.clone(true);
12666
+ }
12667
+ // append order handling
12668
+
12669
+ if (!$container.children()) {
12670
+ new_$div.appendTo($container);
12671
+ } else {
12672
+ // iterate the container node
12673
+ let $last_elm_found;
12674
+ $.each($container.data().xuData.node.children, (item_key, item_val) => {
12675
+ const $elm = $(`[xu-node-id="${item_val.id}"]`);
12676
+ if ($elm.length) {
12677
+ $last_elm_found = $elm;
12678
+ }
12679
+ if (key == item_key) {
12680
+ debugger;
12681
+ }
12682
+ });
12718
12683
  }
12719
- new_$div.appendTo($container);
12720
- // ////////////
12721
- // if (!UI_WORKER_OBJ.xu_render_cache[xu_ui_id]) {
12722
- // UI_WORKER_OBJ.xu_render_cache[xu_ui_id] = {};
12723
- // }
12724
- // UI_WORKER_OBJ.xu_render_cache[xu_ui_id][cache_str] = original_data_obj;
12725
- // //////////////
12726
- // new_$div.data().xuData.original_data_obj = original_data_obj;
12727
- // new_$div.data().xuData.xurender_node = $elm.clone(true);
12728
- // new_$div.data().xuAttributes = $elm.data().xuAttributes || {};
12729
-
12730
- // const replace = async function () {
12731
- // $elm.replaceWith(new_$div);
12732
- // if (from_panel) {
12733
- // const xuPanelWrapper = _.clone(new_$div.data().xuPanelWrapper);
12734
- // $elm.parent().data().xuPanelWrapper = xuPanelWrapper;
12735
- // $elm.replaceWith(new_$div.children());
12736
- // }
12737
-
12738
- // if (val.fields_arr) {
12739
- // return await func.UI.screen.refresh_xu_attributes(SESSION_ID, val.fields_arr, val.jobNoP, new_$div);
12740
- // }
12741
- // func.events.delete_job(SESSION_ID, jobNoP);
12742
- // };
12743
-
12744
- // if ($elm && func.UI.utils.find_in_element_data('xuData', $(SESSION_OBJ[SESSION_ID].root_element), 'xu_id', $elm.data().xuData.xu_id).length) {
12745
- // if (new_$div.data().xuData.paramsP) {
12746
- // return await replace();
12747
- // }
12748
-
12749
- // func.events.delete_job(SESSION_ID, jobNoP);
12750
- // }
12751
12684
  } catch (error) {
12752
12685
  func.events.delete_job(SESSION_ID, jobNoP);
12753
12686
  }
@@ -12764,58 +12697,6 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
12764
12697
  UI_WORKER_OBJ.xu_render_cache[xu_ui_id][cache_str] = { $div: $elm.clone(true) };
12765
12698
  $elm.remove();
12766
12699
  func.events.delete_job(SESSION_ID, jobNoP);
12767
-
12768
- // if ($elm.prop('tagName') === 'XURENDER') {
12769
- // func.events.delete_job(SESSION_ID, jobNoP);
12770
- // return;
12771
- // }
12772
-
12773
- // let tmp_$div = $('<div>');
12774
- // // const xu_ui_id = $elm.attr('xu-ui-id');
12775
- // const xu_ui_id = await generate_xu_ui_id(SESSION_ID, nodeP, $container, paramsP, keyP);
12776
-
12777
- // let $xurender = $('<xurender>').attr('xu-ui-id', xu_ui_id).appendTo(tmp_$div).hide();
12778
- // // // was true before
12779
- // // if ($elm.data().xuData.xurender_node) {
12780
- // // $xurender.data({
12781
- // // xuAttributes: $elm.data().xuData.xurender_node.data().xuAttributes || {},
12782
- // // xuData: $elm.data().xuData.xurender_node.data().xuData || {},
12783
- // // });
12784
- // // } else {
12785
- // // default new state
12786
-
12787
- // $xurender.data({
12788
- // xuAttributes: $elm.data().xuAttributes || {},
12789
- // xuData: $elm.data().xuData || {},
12790
- // });
12791
- // // const original_data_obj = {
12792
- // // nodeP: _.cloneDeep($elm.data().xuData.node_org),
12793
- // // paramsP: $elm.data().xuData.paramsP,
12794
- // // $container: $elm.clone(true),
12795
- // // parent_infoP: parent_infoP,
12796
- // // };
12797
- // const cloned_$div = $elm.clone(true);
12798
- // let original_data_obj = {
12799
- // force_render: false,
12800
- // $container: cloned_$div,
12801
- // nodeP: cloned_$div.data().xuData.node_org,
12802
- // parent_infoP,
12803
- // paramsP,
12804
- // keyP,
12805
- // parent_nodeP, //:cloned_$div.data().xuData.original_data_obj.parent_nodeP,
12806
- // $root_container,
12807
- // };
12808
-
12809
- // $xurender.data().xuData.original_data_obj = original_data_obj;
12810
-
12811
- // const cache_str = await get_xu_render_cache_str(SESSION_ID, paramsP.dsSessionP);
12812
- // if (!UI_WORKER_OBJ.xu_render_cache[xu_ui_id]) {
12813
- // UI_WORKER_OBJ.xu_render_cache[xu_ui_id] = {};
12814
- // }
12815
- // UI_WORKER_OBJ.xu_render_cache[xu_ui_id][cache_str] = original_data_obj;
12816
- // // }
12817
- // $elm.replaceWith(tmp_$div.children());
12818
- // func.events.delete_job(SESSION_ID, jobNoP);
12819
12700
  };
12820
12701
  if (is_init) {
12821
12702
  return await init_render();
@@ -10367,112 +10367,45 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
10367
10367
  const init_render = async function () {
10368
10368
  nodeP.xu_render_made = value;
10369
10369
  if (!value) {
10370
- // const cloned_$div = $elm.clone(true);
10371
-
10372
- // const xu_ui_id = await generate_xu_ui_id(SESSION_ID, nodeP, $container, paramsP, keyP);
10373
-
10374
- // let $xurender = $('<xurender>').attr('xu-ui-id', xu_ui_id).attr('hidden', true).appendTo($container).hide();
10375
- // let original_data_obj = {
10376
- // force_render: true,
10377
- // $container: cloned_$div,
10378
- // nodeP: _.cloneDeep(nodeP),
10379
- // parent_infoP,
10380
- // paramsP,
10381
- // keyP,
10382
- // parent_nodeP,
10383
- // $root_container,
10384
- // };
10385
- // $xurender.data('xuData', cloned_$div.data().xuData);
10386
- // $xurender.data().xuData.original_data_obj = original_data_obj;
10387
- // $xurender.data().xuData.xurender_node = cloned_$div;
10388
- // $xurender.data().xuAttributes = nodeP.attributes || {};
10389
- // $xurender.hide();
10390
-
10391
- // $elm.remove();
10392
- // nodeP.xu_render_made = true;
10393
-
10394
10370
  return { has_xu_render_attribute: true, xu_render_in_process: true };
10395
10371
  }
10396
10372
  return { has_xu_render_attribute: true };
10397
10373
  };
10398
10374
 
10399
10375
  const post_render = async function () {
10376
+ // always come from refresh
10400
10377
  let nodeP = $container.data().xuData.node.children[keyP];
10401
10378
  nodeP.xu_render_made = value;
10402
10379
  if (value) {
10403
10380
  try {
10404
- // // abort if already rended
10405
- // if ($elm[0].tagName !== 'XURENDER' && $elm?.length) {
10406
- // return func.events.delete_job(SESSION_ID, jobNoP);
10407
- // }
10408
-
10409
- // let original_data_obj = $elm.data().xuData.original_data_obj;
10410
-
10411
- // if (!original_data_obj) {
10412
- // func.events.delete_job(SESSION_ID, jobNoP);
10413
- // return { delete_job: jobNoP };
10414
- // }
10415
-
10416
- ////////////
10417
10381
  const xu_render_cache_id = await get_xu_render_cache_str(SESSION_ID, paramsP.dsSessionP);
10418
10382
  const xu_ui_id = $elm.attr('xu-ui-id');
10419
10383
  let new_$div = UI_WORKER_OBJ?.xu_render_cache?.[xu_ui_id]?.[xu_render_cache_id]?.$div.clone(true);
10420
10384
 
10421
- /////////////
10422
- // let new_$div = original_data_obj.$container.clone(true);
10423
-
10424
10385
  if (!new_$div) {
10425
- new_$div = await func.UI.screen.render_ui_tree(
10426
- SESSION_ID,
10427
- $container, //original_data_obj.$container,
10428
- nodeP,
10429
- parent_infoP,
10430
- paramsP,
10431
- jobNoP,
10432
- null,
10433
- keyP,
10434
- null,
10435
- parent_nodeP,
10436
- null,
10437
- $root_container,
10438
- );
10439
-
10440
- UI_WORKER_OBJ.xu_render_cache[xu_ui_id][xu_render_cache_id] = { $div: new_$div.clone(true) };
10386
+ UI_WORKER_OBJ.xu_render_cache[xu_ui_id][xu_render_cache_id] = {};
10441
10387
  nodeP.xu_render_xu_ui_id = xu_ui_id;
10442
10388
  nodeP.xu_render_cache_id = xu_render_cache_id;
10389
+ new_$div = await func.UI.screen.render_ui_tree(SESSION_ID, $container, nodeP, parent_infoP, paramsP, jobNoP, null, keyP, null, parent_nodeP, null, $root_container);
10390
+ UI_WORKER_OBJ.xu_render_cache[xu_ui_id][xu_render_cache_id].$div = new_$div.clone(true);
10391
+ }
10392
+ // append order handling
10393
+
10394
+ if (!$container.children()) {
10395
+ new_$div.appendTo($container);
10396
+ } else {
10397
+ // iterate the container node
10398
+ let $last_elm_found;
10399
+ $.each($container.data().xuData.node.children, (item_key, item_val) => {
10400
+ const $elm = $(`[xu-node-id="${item_val.id}"]`);
10401
+ if ($elm.length) {
10402
+ $last_elm_found = $elm;
10403
+ }
10404
+ if (key == item_key) {
10405
+ debugger;
10406
+ }
10407
+ });
10443
10408
  }
10444
- new_$div.appendTo($container);
10445
- // ////////////
10446
- // if (!UI_WORKER_OBJ.xu_render_cache[xu_ui_id]) {
10447
- // UI_WORKER_OBJ.xu_render_cache[xu_ui_id] = {};
10448
- // }
10449
- // UI_WORKER_OBJ.xu_render_cache[xu_ui_id][cache_str] = original_data_obj;
10450
- // //////////////
10451
- // new_$div.data().xuData.original_data_obj = original_data_obj;
10452
- // new_$div.data().xuData.xurender_node = $elm.clone(true);
10453
- // new_$div.data().xuAttributes = $elm.data().xuAttributes || {};
10454
-
10455
- // const replace = async function () {
10456
- // $elm.replaceWith(new_$div);
10457
- // if (from_panel) {
10458
- // const xuPanelWrapper = _.clone(new_$div.data().xuPanelWrapper);
10459
- // $elm.parent().data().xuPanelWrapper = xuPanelWrapper;
10460
- // $elm.replaceWith(new_$div.children());
10461
- // }
10462
-
10463
- // if (val.fields_arr) {
10464
- // return await func.UI.screen.refresh_xu_attributes(SESSION_ID, val.fields_arr, val.jobNoP, new_$div);
10465
- // }
10466
- // func.events.delete_job(SESSION_ID, jobNoP);
10467
- // };
10468
-
10469
- // if ($elm && func.UI.utils.find_in_element_data('xuData', $(SESSION_OBJ[SESSION_ID].root_element), 'xu_id', $elm.data().xuData.xu_id).length) {
10470
- // if (new_$div.data().xuData.paramsP) {
10471
- // return await replace();
10472
- // }
10473
-
10474
- // func.events.delete_job(SESSION_ID, jobNoP);
10475
- // }
10476
10409
  } catch (error) {
10477
10410
  func.events.delete_job(SESSION_ID, jobNoP);
10478
10411
  }
@@ -10489,58 +10422,6 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
10489
10422
  UI_WORKER_OBJ.xu_render_cache[xu_ui_id][cache_str] = { $div: $elm.clone(true) };
10490
10423
  $elm.remove();
10491
10424
  func.events.delete_job(SESSION_ID, jobNoP);
10492
-
10493
- // if ($elm.prop('tagName') === 'XURENDER') {
10494
- // func.events.delete_job(SESSION_ID, jobNoP);
10495
- // return;
10496
- // }
10497
-
10498
- // let tmp_$div = $('<div>');
10499
- // // const xu_ui_id = $elm.attr('xu-ui-id');
10500
- // const xu_ui_id = await generate_xu_ui_id(SESSION_ID, nodeP, $container, paramsP, keyP);
10501
-
10502
- // let $xurender = $('<xurender>').attr('xu-ui-id', xu_ui_id).appendTo(tmp_$div).hide();
10503
- // // // was true before
10504
- // // if ($elm.data().xuData.xurender_node) {
10505
- // // $xurender.data({
10506
- // // xuAttributes: $elm.data().xuData.xurender_node.data().xuAttributes || {},
10507
- // // xuData: $elm.data().xuData.xurender_node.data().xuData || {},
10508
- // // });
10509
- // // } else {
10510
- // // default new state
10511
-
10512
- // $xurender.data({
10513
- // xuAttributes: $elm.data().xuAttributes || {},
10514
- // xuData: $elm.data().xuData || {},
10515
- // });
10516
- // // const original_data_obj = {
10517
- // // nodeP: _.cloneDeep($elm.data().xuData.node_org),
10518
- // // paramsP: $elm.data().xuData.paramsP,
10519
- // // $container: $elm.clone(true),
10520
- // // parent_infoP: parent_infoP,
10521
- // // };
10522
- // const cloned_$div = $elm.clone(true);
10523
- // let original_data_obj = {
10524
- // force_render: false,
10525
- // $container: cloned_$div,
10526
- // nodeP: cloned_$div.data().xuData.node_org,
10527
- // parent_infoP,
10528
- // paramsP,
10529
- // keyP,
10530
- // parent_nodeP, //:cloned_$div.data().xuData.original_data_obj.parent_nodeP,
10531
- // $root_container,
10532
- // };
10533
-
10534
- // $xurender.data().xuData.original_data_obj = original_data_obj;
10535
-
10536
- // const cache_str = await get_xu_render_cache_str(SESSION_ID, paramsP.dsSessionP);
10537
- // if (!UI_WORKER_OBJ.xu_render_cache[xu_ui_id]) {
10538
- // UI_WORKER_OBJ.xu_render_cache[xu_ui_id] = {};
10539
- // }
10540
- // UI_WORKER_OBJ.xu_render_cache[xu_ui_id][cache_str] = original_data_obj;
10541
- // // }
10542
- // $elm.replaceWith(tmp_$div.children());
10543
- // func.events.delete_job(SESSION_ID, jobNoP);
10544
10425
  };
10545
10426
  if (is_init) {
10546
10427
  return await init_render();