@xuda.io/runtime-bundle 1.0.353 → 1.0.354

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.
@@ -8959,19 +8959,12 @@ func.UI.worker.find_job_index = function (SESSION_ID, jobNoP) {
8959
8959
  };
8960
8960
 
8961
8961
  func.UI.ds_garbage_collector = function (SESSION_ID = Object.keys(SESSION_OBJ)[0], re_check) {
8962
- // return;
8963
8962
  let _session = SESSION_OBJ[SESSION_ID];
8964
8963
 
8965
8964
  const _data_system = _session?.DS_GLB?.[0]?.data_system;
8966
8965
  if (_data_system?.SYS_GLOBAL_BOL_AJAX_BUSY) return;
8967
8966
  if (!_data_system?.SYS_GLOBAL_BOL_IDLE) return;
8968
8967
 
8969
- // for (const [key, val] of Object.entries(_data_system?.SYS_GLOBAL_OBJ_REFS || {})) {
8970
- // if (!$(`[xu-ui-id='${val?.$el.attr('xu-ui-id')}'`)?.length) {
8971
- // delete _data_system.SYS_GLOBAL_OBJ_REFS[key];
8972
- // }
8973
- // }
8974
-
8975
8968
  let abort;
8976
8969
 
8977
8970
  for (const [dsP, _ds] of Object.entries(_session.DS_GLB)) {
@@ -9018,7 +9011,7 @@ func.UI.ds_garbage_collector = function (SESSION_ID = Object.keys(SESSION_OBJ)[0
9018
9011
  func.datasource.del(SESSION_ID, val);
9019
9012
  }
9020
9013
  };
9021
- func.UI.refs_garbage_collector = function (SESSION_ID = Object.keys(SESSION_OBJ)[0], re_check) {
9014
+ func.UI.refs_garbage_collector = function (SESSION_ID = Object.keys(SESSION_OBJ)[0]) {
9022
9015
  let _session = SESSION_OBJ[SESSION_ID];
9023
9016
  const _data_system = _session?.DS_GLB?.[0]?.data_system;
9024
9017
 
@@ -11922,16 +11915,19 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
11922
11915
 
11923
11916
  const common_fx = {
11924
11917
  'xu-ref': async function ($elm, val) {
11925
- // console.log('xu-ref', $elm, val);
11926
11918
  const _session = SESSION_OBJ[SESSION_ID];
11927
11919
  let _ds_0 = _session.DS_GLB[0];
11928
- // if (!_ds_0.data_system['SYS_GLOBAL_OBJ_REFS']) {
11929
- // _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'] = {};
11930
- // }
11931
- // if (!_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val]) {
11920
+
11932
11921
  const _ds = _session.DS_GLB[paramsP.dsSessionP];
11933
- _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { $el: $elm, ds: _ds, data: _ds?.data_feed?.rows || {}, props: $elm?.data()?.xuData?.properties };
11934
- // }
11922
+
11923
+ const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
11924
+ const data = _ds?.data_feed?.rows?.[row_idx] || {};
11925
+
11926
+ const props = _ds.in_parameters || {};
11927
+ const attributes = $elm?.data()?.xuData?.properties || {};
11928
+
11929
+ _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { $el: $elm, ds: _ds, data, attributes, props };
11930
+
11935
11931
  return {};
11936
11932
  },
11937
11933
  'xu-bind': async function ($elm, val) {
@@ -12264,14 +12260,12 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
12264
12260
  if (!custom_iterator_key) {
12265
12261
  is_key_dynamic_field = true;
12266
12262
 
12267
- // iterator_key = $elm.data().xuData.node_org.id.replaceAll("-", "_") + "_FOR_KEY";
12268
12263
  iterator_key = '_FOR_KEY';
12269
12264
  }
12270
12265
 
12271
12266
  if (!custom_iterator_val) {
12272
12267
  is_val_dynamic_field = true;
12273
12268
 
12274
- // iterator_val = $elm.data().xuData.node_org.id.replaceAll("-", "_") + "_FOR_VAL";
12275
12269
  iterator_val = '_FOR_VAL';
12276
12270
  }
12277
12271
 
@@ -12318,13 +12312,7 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
12318
12312
  };
12319
12313
  let _parent_info = _.cloneDeep(parent_infoP) || {};
12320
12314
  _parent_info.iterate_info = iterate_info;
12321
- // if (parent_infoP) {
12322
- // _parent_info = iterate_info;
12323
- // } else {
12324
- // _parent_info = {
12325
- // iterate_info,
12326
- // };
12327
- // }
12315
+
12328
12316
  const $divP = await func.UI.screen.render_ui_tree(
12329
12317
  SESSION_ID,
12330
12318
  $container,
@@ -12390,13 +12378,6 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
12390
12378
  },
12391
12379
  'xu-exp': async function ($elm, val) {
12392
12380
  let exp = val.value === null ? true : val.value;
12393
- // if (val.value.includes("@_FOR_KEY")) {
12394
- // exp = exp.replaceAll("@_FOR_KEY", "@" + $elm.data().xuData.iterate_info.iterator_key);
12395
- // }
12396
-
12397
- // if (val.value.includes("@_FOR_VAL")) {
12398
- // exp = exp.replaceAll("@_FOR_VAL", "@" + $elm.data().xuData.iterate_info.iterator_val);
12399
- // }
12400
12381
 
12401
12382
  let exp_ret = await func.expression.get(SESSION_ID, exp, paramsP.dsSessionP, 'UI Attr EXP', SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP].currentRecordId);
12402
12383
 
@@ -12805,10 +12786,6 @@ func.UI.screen.set_attributes_new = async function (SESSION_ID, is_skeleton, $ro
12805
12786
  _ret = _.assignIn(_ret, ret);
12806
12787
  }
12807
12788
 
12808
- // if (nodeP.tagName === "svg") {
12809
- // console.log(svg_attributes_str);
12810
- // }
12811
-
12812
12789
  // EXP for
12813
12790
 
12814
12791
  for await (const [key, val] of Object.entries(nodeP.attributes)) {
@@ -12917,20 +12894,6 @@ func.UI.screen.panel_post_render_handler = async function (
12917
12894
  if ($old_panel_div?.length) {
12918
12895
  $($old_panel_div[0]).after($wrapper.children());
12919
12896
  } else {
12920
- // $container.append($wrapper.children());
12921
-
12922
- // find existing xurender
12923
- // $.each($wrapper.children(), function (key, val) {
12924
- // console.log(">", `[xu-ui-id=${$(val).attr("xu-ui-id")}]`);
12925
- // const $elm = $container.find(`[xu-ui-id=${$(val).attr("xu-ui-id")}]`);
12926
- // if (
12927
- // // $(val).data().xuData.key_path === cloned_$div.data().xuData.key_path
12928
- // $elm.length
12929
- // ) {
12930
- // $elm.remove();
12931
- // }
12932
- // $container.append($(val));
12933
- // });
12934
12897
  $.each($wrapper.children(), function (key, child) {
12935
12898
  $.each($container.children(), function (key, elm) {
12936
12899
  if ($(elm).data().xuData.elem_key === $(child).data().xuData.elem_key) {
@@ -13058,59 +13021,7 @@ func.UI.screen.create_container = function (SESSION_ID, $root_container, nodeP,
13058
13021
  },
13059
13022
  xuAttributes: {},
13060
13023
  });
13061
- // }
13062
-
13063
- // $div.appendTo($appendTo);
13064
13024
 
13065
- ////////////////////////
13066
-
13067
- // let svg_attributes_str = ""
13068
- // if (div_typeP === "svg") {
13069
- // for (const [key, val] of Object.entries(nodeP.attributes)) {
13070
- // svg_attributes_str += `${key}="${val}" `
13071
- // }
13072
- // }
13073
-
13074
- // var $div =
13075
- // // $(`<${div} ${attr_str ? attr_str : ""} ${svg_attributes_str}>`)
13076
- // $(`<${div} ${attr_str ? attr_str : ""}>`)
13077
- // .attr("xu-ui-id", ui_id)
13078
- // .data({
13079
- // xuData: {
13080
- // prog_id: _paramsP.prog_id,
13081
- // nodeid: nodeP.id,
13082
- // ui_type: nodeP.tagName,
13083
- // xu_id: xu_id,
13084
- // recordid: currentRecordId,
13085
- // paramsP: _paramsP,
13086
- // key: keyP,
13087
- // key_path, //:($container?.data()?.xuData?.key || "0") + "-" + (keyP || "0"),
13088
- // screenId: _paramsP.screenId,
13089
- // parent_container: $container?.attr("id"),
13090
- // elem_key,
13091
- // ui_id,
13092
- // properties: prop,
13093
- // node: nodeP,
13094
- // node_org: _.cloneDeep(nodeP),
13095
- // is_panelP: _paramsP.is_panelP,
13096
-
13097
- // elem_prop: elem_propP,
13098
- // debug_info: {
13099
- // id: nodeP.id,
13100
- // parent_id: $container?.data()?.xuData?.ui_id,
13101
- // items: items,
13102
- // },
13103
- // parent_node: parent_nodeP,
13104
- // currentRecordId: currentRecordId,
13105
- // $root_container: $root_container,
13106
- // parent_element_ui_id: $container?.data()?.xuData?.ui_id,
13107
- // },
13108
- // xuAttributes: {},
13109
- // })
13110
-
13111
- // if (div_typeP === "svg") {
13112
- // $div.removeAttr("xu-ui-id")
13113
- // }
13114
13025
  if (div_typeP !== 'svg') {
13115
13026
  $div.appendTo($appendTo);
13116
13027
  }
@@ -13673,20 +13584,8 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
13673
13584
  await func.UI.component.create_app_page_component(SESSION_ID, paramsP.dsSessionP);
13674
13585
  const page = new UI_FRAMEWORK_PLUGIN.page();
13675
13586
  await set_call_screen_properties_values(page);
13676
- await page.create(
13677
- params,
13678
- // SESSION_ID,
13679
- // paramsP.dsSessionP,
13680
- // nav,
13681
- // $nav.data().xuData.nav_params[paramsP.dsSessionP]
13682
- );
13683
- await page.init(
13684
- params,
13685
- // SESSION_ID,
13686
- // paramsP.dsSessionP,
13687
- // nav,
13688
- // $nav.data().xuData.nav_params[paramsP.dsSessionP]
13689
- );
13587
+ await page.create(params);
13588
+ await page.init(params);
13690
13589
  nav.push(component_name, { params });
13691
13590
  } else {
13692
13591
  debugger;
@@ -13922,20 +13821,6 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
13922
13821
  } catch (err) {
13923
13822
  func.utils.debug_report(SESSION_ID, `${plugin_name} widget`, err.message, 'E');
13924
13823
  }
13925
-
13926
- // glb.lifecycle.plugins[plugin_name] = {
13927
- // plugin_script: fx,
13928
- // setup_data: plugin_setup_ret.data,
13929
- // fields,
13930
- // params,
13931
- // };
13932
-
13933
- // await glb.lifecycle.execute(SESSION_ID, "initialized");
13934
- // await glb.lifecycle.execute(SESSION_ID, method);
13935
-
13936
- // } catch (err) {
13937
- // report_error(err);
13938
- // }
13939
13824
  }
13940
13825
  return $div;
13941
13826
  },
@@ -13979,107 +13864,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
13979
13864
  $container.data().xuAttributes[key] = _.cloneDeep(val);
13980
13865
  });
13981
13866
 
13982
- // var $div_content = $div.children();
13983
-
13984
- // $.each($div_content, function (key, val) {
13985
- // $(val).data().xuData.parent_container =
13986
- // $div.data().xuData.parent_container;
13987
- // });
13988
-
13989
13867
  return await render_screen_type($div);
13990
-
13991
- // if (paramsP.is_mobile_modal) {
13992
- // return await open_modal($div);
13993
- // }
13994
- // if (paramsP.is_mobile_popover) {
13995
- // open_popover($div);
13996
- // func.UI.utils.screen_blocker(
13997
- // false,
13998
- // paramsP.prog_id + "_" + paramsP.sourceScreenP
13999
- // );
14000
- // return;
14001
- // }
14002
-
14003
- // if (paramsP.is_mobile_page) {
14004
- // const $nav = $(SESSION_OBJ[SESSION_ID].root_element).find("xu-nav");
14005
- // const nav = $nav[0];
14006
-
14007
- // var params = {
14008
- // div: $div_content,
14009
- // name: paramsP.screenInfo.properties?.menuTitle,
14010
- // screenId: paramsP.screenId,
14011
- // $container: $container,
14012
- // // icon: $div.data().xuData.paramsP.screenInfo.rICN,
14013
- // dsSession: paramsP.dsSessionP,
14014
- // };
14015
- // var component_name = "xu-page-component-" + paramsP.dsSessionP;
14016
- // if (!$(nav).data().xuData.nav_params) {
14017
- // $(nav).data().xuData.nav_params = {};
14018
- // }
14019
-
14020
- // //restore validate
14021
- // if ($(nav)?.data()?.xuData?.params?.[paramsP.dsSessionP]) {
14022
- // params.$container.data().xuData.validate_screen_ready = $(nav)
14023
- // .data()
14024
- // .xuData.params[
14025
- // paramsP.dsSessionP
14026
- // ].$container.data().xuData.validate_screen_ready;
14027
- // }
14028
-
14029
- // if (!$(nav)?.data()?.xuData) return;
14030
- // $(nav).data().xuData.nav_params[paramsP.dsSessionP] = params;
14031
- // if (!$(component_name).length) {
14032
- // await func.UI.component.create_app_page_component(
14033
- // SESSION_ID,
14034
- // paramsP.dsSessionP
14035
- // );
14036
- // const page = new UI_FRAMEWORK_PLUGIN.page();
14037
- // await page.create(
14038
- // SESSION_ID,
14039
- // paramsP.dsSessionP,
14040
- // nav,
14041
- // $nav.data().xuData.nav_params[paramsP.dsSessionP]
14042
- // );
14043
- // await page.init(
14044
- // SESSION_ID,
14045
- // paramsP.dsSessionP,
14046
- // nav,
14047
- // $nav.data().xuData.nav_params[paramsP.dsSessionP]
14048
- // );
14049
- // nav.push(component_name, { params });
14050
- // } else {
14051
- // debugger;
14052
- // $(component_name).empty();
14053
-
14054
- // await UI_FRAMEWORK_PLUGIN.page(SESSION_ID, paramsP.dsSessionP);
14055
- // }
14056
- // $div.data().xuData.paramsP = $container.data().xuData.paramsP;
14057
-
14058
- // return $div;
14059
- // }
14060
-
14061
- // if (
14062
- // !paramsP.is_mobile_page &&
14063
- // !paramsP.is_mobile_modal &&
14064
- // !paramsP.is_mobile_popover &&
14065
- // !paramsP.is_panelP
14066
- // ) {
14067
- // var $nav = $(SESSION_OBJ[SESSION_ID].root_element).find("xu-nav");
14068
- // if ($nav && $nav.length) {
14069
- // // refresh made
14070
- // } else {
14071
- // $nav = $("<xu-nav>");
14072
- // $container.append($nav);
14073
- // func.UI.component.init_xu_nav($container, $nav);
14074
- // }
14075
-
14076
- // $nav.data().xuData.$div = $div_content; // set data to nav to use in the component
14077
-
14078
- // await $nav[0].setRoot("xu-root-component-" + SESSION_ID);
14079
- // } else {
14080
- // $container.append($div_content);
14081
- // }
14082
- // return $container;
14083
13868
  },
14084
13869
  [`xu-multi-view`]: async function () {
14085
13870
  var $div = $container;
@@ -14115,41 +13900,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
14115
13900
  return $div;
14116
13901
  };
14117
13902
  await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
14118
- // var $div_content = $div.children();
14119
-
14120
- // if (continuous_idx !== null || !prop.app_items_per_page) {
14121
- // $.each($div.data().xuData, function (key, val) {
14122
- // $container.data().xuData[key] = val;
14123
- // });
14124
- // $.each($div.data().xuAttributes, function (key, val) {
14125
- // $container.data().xuAttributes[key] = val;
14126
- // });
14127
-
14128
- // if (!$container.data().xuData.node) {
14129
- // $container.data().xuData.node = {};
14130
- // }
14131
-
14132
- // $container.data().xuData.node.children = [];
14133
-
14134
- // $.each($div_content, function (key, val) {
14135
- // if (!$(val)?.data()?.xuData) return;
14136
- // if (
14137
- // continuous_idx === null ||
14138
- // (continuous_idx && key > continuous_idx)
14139
- // ) {
14140
- // $(val).data().xuData.parent_container =
14141
- // $div.data().xuData.parent_container;
14142
- // $container
14143
- // .data()
14144
- // .xuData.node.children.push($(val).data().xuData.node);
14145
- // }
14146
- // });
14147
- // }
14148
13903
 
14149
- // if (continuous_idx !== null) {
14150
- // if (glb.CURRENT_APP_LOADING === 1) glb.CURRENT_APP_LOADING = 0; // re-activate loader
14151
- // return;
14152
- // }
14153
13904
  return await render_screen_type($div);
14154
13905
  };
14155
13906
 
@@ -14183,38 +13934,6 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
14183
13934
  const ret = await func.UI.screen.render_ui_tree(SESSION_ID, $container, empty_result_node, parent_infoP, paramsP, jobNoP, null, 0, null, nodeP, null, $root_container);
14184
13935
  await func.events.validate(SESSION_ID, 'record_not_found', paramsP.dsSessionP);
14185
13936
  return await done(null);
14186
-
14187
- // var text = "";
14188
- // if (prop?.app_empty_result_text !== "undefined") {
14189
- // text = prop.app_empty_result_text;
14190
- // }
14191
- // if (
14192
- // prop.app_empty_result_text_EXP &&
14193
- // prop.app_empty_result_text_EXP !== "undefined"
14194
- // ) {
14195
- // let exp = prop.app_empty_result_text_EXP;
14196
- // if (exp && exp !== "undefined") {
14197
- // var res = func.expression.get(
14198
- // SESSION_ID,
14199
- // exp,
14200
- // paramsP.dsSessionP,
14201
- // "app_empty_result_text_EXP",
14202
- // _ds.currentRecordId
14203
- // );
14204
- // text = res.result;
14205
- // }
14206
- // }
14207
- // if (icon || text) {
14208
- // $container.append(
14209
- // `<div style="width: 100%;" >${img}<h6 style="text-align: center;">${text}</h6></div>`
14210
- // );
14211
- // }
14212
- // await func.events.validate(
14213
- // SESSION_ID,
14214
- // "record_not_found",
14215
- // paramsP.dsSessionP
14216
- // );
14217
- // return await done(null);
14218
13937
  };
14219
13938
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
14220
13939
 
@@ -14227,25 +13946,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
14227
13946
  var i = 0;
14228
13947
  for await (const [key, val] of Object.entries(_ds.data_feed.rows)) {
14229
13948
  var node = JSON.parse(JSON.stringify(nodeP));
14230
- // TO FIX
14231
- // if (
14232
- // continuous_idx === null &&
14233
- // prop.app_items_per_page &&
14234
- // i >= Number(prop.app_items_per_page)
14235
- // ) {
14236
- // continuous_idx = i;
14237
- // await done(null);
14238
-
14239
- // setTimeout(async function () {
14240
- // await run_item(continuous_idx);
14241
- // if (!glb.CURRENT_APP_LOADING) {
14242
- // glb.CURRENT_APP_LOADING = 1;
14243
- // } // deactivate loader
14244
- // }, 1000);
14245
-
14246
- // continue;
14247
- // }
14248
- ////////
13949
+
14249
13950
  _ds.currentRecordId = val._ROWID;
14250
13951
  const ret = await iterate_child($div, node, { continuous_idx }, null, $root_container);
14251
13952
 
@@ -14297,46 +13998,6 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
14297
13998
  };
14298
13999
  if (!element || element === 'script') return await done();
14299
14000
  let str = '';
14300
- // var $div
14301
- // const draw_svg = function () {
14302
- // const get_tag_str = function (element, prop, val) {
14303
- // let class_str = "";
14304
- // let attr_str = "";
14305
- // for (const [key, val] of Object.entries(prop)) {
14306
- // if (key.substr(0, 2) !== "xu") {
14307
- // attr_str += ` ${key}="${val}" `;
14308
- // }
14309
- // }
14310
- // if (element === "svg") {
14311
- // return `<${element} ${attr_str} > `;
14312
- // }
14313
- // let ret = "";
14314
- // if (val?.children?.length) {
14315
- // ret = iterate_svg(val);
14316
- // }
14317
-
14318
- // return `<${element} ${class_str} ${attr_str} > ${ret} </${element}>`;
14319
- // };
14320
- // let svg_str = get_tag_str(element, prop);
14321
- // let inner_str = "";
14322
- // const iterate_svg = function (node) {
14323
- // let ret = "";
14324
- // if (node.children) {
14325
- // for (let val of node.children) {
14326
- // let prop = val.attributes;
14327
- // ret += get_tag_str(val.tagName, prop, val);
14328
- // }
14329
- // }
14330
- // return ret;
14331
- // };
14332
- // inner_str = iterate_svg(nodeP);
14333
-
14334
- // $div = $(svg_str + inner_str + "</svg>").appendTo($container);
14335
- // };
14336
- // if (element === "svg") {
14337
- // draw_svg();
14338
- // // return await done();
14339
- // }
14340
14001
 
14341
14002
  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);
14342
14003