@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.
@@ -8960,19 +8960,12 @@ func.UI.worker.find_job_index = function (SESSION_ID, jobNoP) {
8960
8960
  };
8961
8961
 
8962
8962
  func.UI.ds_garbage_collector = function (SESSION_ID = Object.keys(SESSION_OBJ)[0], re_check) {
8963
- // return;
8964
8963
  let _session = SESSION_OBJ[SESSION_ID];
8965
8964
 
8966
8965
  const _data_system = _session?.DS_GLB?.[0]?.data_system;
8967
8966
  if (_data_system?.SYS_GLOBAL_BOL_AJAX_BUSY) return;
8968
8967
  if (!_data_system?.SYS_GLOBAL_BOL_IDLE) return;
8969
8968
 
8970
- // for (const [key, val] of Object.entries(_data_system?.SYS_GLOBAL_OBJ_REFS || {})) {
8971
- // if (!$(`[xu-ui-id='${val?.$el.attr('xu-ui-id')}'`)?.length) {
8972
- // delete _data_system.SYS_GLOBAL_OBJ_REFS[key];
8973
- // }
8974
- // }
8975
-
8976
8969
  let abort;
8977
8970
 
8978
8971
  for (const [dsP, _ds] of Object.entries(_session.DS_GLB)) {
@@ -9019,7 +9012,7 @@ func.UI.ds_garbage_collector = function (SESSION_ID = Object.keys(SESSION_OBJ)[0
9019
9012
  func.datasource.del(SESSION_ID, val);
9020
9013
  }
9021
9014
  };
9022
- func.UI.refs_garbage_collector = function (SESSION_ID = Object.keys(SESSION_OBJ)[0], re_check) {
9015
+ func.UI.refs_garbage_collector = function (SESSION_ID = Object.keys(SESSION_OBJ)[0]) {
9023
9016
  let _session = SESSION_OBJ[SESSION_ID];
9024
9017
  const _data_system = _session?.DS_GLB?.[0]?.data_system;
9025
9018
 
@@ -9988,16 +9981,19 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
9988
9981
 
9989
9982
  const common_fx = {
9990
9983
  'xu-ref': async function ($elm, val) {
9991
- // console.log('xu-ref', $elm, val);
9992
9984
  const _session = SESSION_OBJ[SESSION_ID];
9993
9985
  let _ds_0 = _session.DS_GLB[0];
9994
- // if (!_ds_0.data_system['SYS_GLOBAL_OBJ_REFS']) {
9995
- // _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'] = {};
9996
- // }
9997
- // if (!_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val]) {
9986
+
9998
9987
  const _ds = _session.DS_GLB[paramsP.dsSessionP];
9999
- _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { $el: $elm, ds: _ds, data: _ds?.data_feed?.rows || {}, props: $elm?.data()?.xuData?.properties };
10000
- // }
9988
+
9989
+ const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
9990
+ const data = _ds?.data_feed?.rows?.[row_idx] || {};
9991
+
9992
+ const props = _ds.in_parameters || {};
9993
+ const attributes = $elm?.data()?.xuData?.properties || {};
9994
+
9995
+ _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { $el: $elm, ds: _ds, data, attributes, props };
9996
+
10001
9997
  return {};
10002
9998
  },
10003
9999
  'xu-bind': async function ($elm, val) {
@@ -10330,14 +10326,12 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
10330
10326
  if (!custom_iterator_key) {
10331
10327
  is_key_dynamic_field = true;
10332
10328
 
10333
- // iterator_key = $elm.data().xuData.node_org.id.replaceAll("-", "_") + "_FOR_KEY";
10334
10329
  iterator_key = '_FOR_KEY';
10335
10330
  }
10336
10331
 
10337
10332
  if (!custom_iterator_val) {
10338
10333
  is_val_dynamic_field = true;
10339
10334
 
10340
- // iterator_val = $elm.data().xuData.node_org.id.replaceAll("-", "_") + "_FOR_VAL";
10341
10335
  iterator_val = '_FOR_VAL';
10342
10336
  }
10343
10337
 
@@ -10384,13 +10378,7 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
10384
10378
  };
10385
10379
  let _parent_info = _.cloneDeep(parent_infoP) || {};
10386
10380
  _parent_info.iterate_info = iterate_info;
10387
- // if (parent_infoP) {
10388
- // _parent_info = iterate_info;
10389
- // } else {
10390
- // _parent_info = {
10391
- // iterate_info,
10392
- // };
10393
- // }
10381
+
10394
10382
  const $divP = await func.UI.screen.render_ui_tree(
10395
10383
  SESSION_ID,
10396
10384
  $container,
@@ -10456,13 +10444,6 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
10456
10444
  },
10457
10445
  'xu-exp': async function ($elm, val) {
10458
10446
  let exp = val.value === null ? true : val.value;
10459
- // if (val.value.includes("@_FOR_KEY")) {
10460
- // exp = exp.replaceAll("@_FOR_KEY", "@" + $elm.data().xuData.iterate_info.iterator_key);
10461
- // }
10462
-
10463
- // if (val.value.includes("@_FOR_VAL")) {
10464
- // exp = exp.replaceAll("@_FOR_VAL", "@" + $elm.data().xuData.iterate_info.iterator_val);
10465
- // }
10466
10447
 
10467
10448
  let exp_ret = await func.expression.get(SESSION_ID, exp, paramsP.dsSessionP, 'UI Attr EXP', SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP].currentRecordId);
10468
10449
 
@@ -10871,10 +10852,6 @@ func.UI.screen.set_attributes_new = async function (SESSION_ID, is_skeleton, $ro
10871
10852
  _ret = _.assignIn(_ret, ret);
10872
10853
  }
10873
10854
 
10874
- // if (nodeP.tagName === "svg") {
10875
- // console.log(svg_attributes_str);
10876
- // }
10877
-
10878
10855
  // EXP for
10879
10856
 
10880
10857
  for await (const [key, val] of Object.entries(nodeP.attributes)) {
@@ -10983,20 +10960,6 @@ func.UI.screen.panel_post_render_handler = async function (
10983
10960
  if ($old_panel_div?.length) {
10984
10961
  $($old_panel_div[0]).after($wrapper.children());
10985
10962
  } else {
10986
- // $container.append($wrapper.children());
10987
-
10988
- // find existing xurender
10989
- // $.each($wrapper.children(), function (key, val) {
10990
- // console.log(">", `[xu-ui-id=${$(val).attr("xu-ui-id")}]`);
10991
- // const $elm = $container.find(`[xu-ui-id=${$(val).attr("xu-ui-id")}]`);
10992
- // if (
10993
- // // $(val).data().xuData.key_path === cloned_$div.data().xuData.key_path
10994
- // $elm.length
10995
- // ) {
10996
- // $elm.remove();
10997
- // }
10998
- // $container.append($(val));
10999
- // });
11000
10963
  $.each($wrapper.children(), function (key, child) {
11001
10964
  $.each($container.children(), function (key, elm) {
11002
10965
  if ($(elm).data().xuData.elem_key === $(child).data().xuData.elem_key) {
@@ -11124,59 +11087,7 @@ func.UI.screen.create_container = function (SESSION_ID, $root_container, nodeP,
11124
11087
  },
11125
11088
  xuAttributes: {},
11126
11089
  });
11127
- // }
11128
-
11129
- // $div.appendTo($appendTo);
11130
11090
 
11131
- ////////////////////////
11132
-
11133
- // let svg_attributes_str = ""
11134
- // if (div_typeP === "svg") {
11135
- // for (const [key, val] of Object.entries(nodeP.attributes)) {
11136
- // svg_attributes_str += `${key}="${val}" `
11137
- // }
11138
- // }
11139
-
11140
- // var $div =
11141
- // // $(`<${div} ${attr_str ? attr_str : ""} ${svg_attributes_str}>`)
11142
- // $(`<${div} ${attr_str ? attr_str : ""}>`)
11143
- // .attr("xu-ui-id", ui_id)
11144
- // .data({
11145
- // xuData: {
11146
- // prog_id: _paramsP.prog_id,
11147
- // nodeid: nodeP.id,
11148
- // ui_type: nodeP.tagName,
11149
- // xu_id: xu_id,
11150
- // recordid: currentRecordId,
11151
- // paramsP: _paramsP,
11152
- // key: keyP,
11153
- // key_path, //:($container?.data()?.xuData?.key || "0") + "-" + (keyP || "0"),
11154
- // screenId: _paramsP.screenId,
11155
- // parent_container: $container?.attr("id"),
11156
- // elem_key,
11157
- // ui_id,
11158
- // properties: prop,
11159
- // node: nodeP,
11160
- // node_org: _.cloneDeep(nodeP),
11161
- // is_panelP: _paramsP.is_panelP,
11162
-
11163
- // elem_prop: elem_propP,
11164
- // debug_info: {
11165
- // id: nodeP.id,
11166
- // parent_id: $container?.data()?.xuData?.ui_id,
11167
- // items: items,
11168
- // },
11169
- // parent_node: parent_nodeP,
11170
- // currentRecordId: currentRecordId,
11171
- // $root_container: $root_container,
11172
- // parent_element_ui_id: $container?.data()?.xuData?.ui_id,
11173
- // },
11174
- // xuAttributes: {},
11175
- // })
11176
-
11177
- // if (div_typeP === "svg") {
11178
- // $div.removeAttr("xu-ui-id")
11179
- // }
11180
11091
  if (div_typeP !== 'svg') {
11181
11092
  $div.appendTo($appendTo);
11182
11093
  }
@@ -11739,20 +11650,8 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
11739
11650
  await func.UI.component.create_app_page_component(SESSION_ID, paramsP.dsSessionP);
11740
11651
  const page = new UI_FRAMEWORK_PLUGIN.page();
11741
11652
  await set_call_screen_properties_values(page);
11742
- await page.create(
11743
- params,
11744
- // SESSION_ID,
11745
- // paramsP.dsSessionP,
11746
- // nav,
11747
- // $nav.data().xuData.nav_params[paramsP.dsSessionP]
11748
- );
11749
- await page.init(
11750
- params,
11751
- // SESSION_ID,
11752
- // paramsP.dsSessionP,
11753
- // nav,
11754
- // $nav.data().xuData.nav_params[paramsP.dsSessionP]
11755
- );
11653
+ await page.create(params);
11654
+ await page.init(params);
11756
11655
  nav.push(component_name, { params });
11757
11656
  } else {
11758
11657
  debugger;
@@ -11988,20 +11887,6 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
11988
11887
  } catch (err) {
11989
11888
  func.utils.debug_report(SESSION_ID, `${plugin_name} widget`, err.message, 'E');
11990
11889
  }
11991
-
11992
- // glb.lifecycle.plugins[plugin_name] = {
11993
- // plugin_script: fx,
11994
- // setup_data: plugin_setup_ret.data,
11995
- // fields,
11996
- // params,
11997
- // };
11998
-
11999
- // await glb.lifecycle.execute(SESSION_ID, "initialized");
12000
- // await glb.lifecycle.execute(SESSION_ID, method);
12001
-
12002
- // } catch (err) {
12003
- // report_error(err);
12004
- // }
12005
11890
  }
12006
11891
  return $div;
12007
11892
  },
@@ -12045,107 +11930,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
12045
11930
  $container.data().xuAttributes[key] = _.cloneDeep(val);
12046
11931
  });
12047
11932
 
12048
- // var $div_content = $div.children();
12049
-
12050
- // $.each($div_content, function (key, val) {
12051
- // $(val).data().xuData.parent_container =
12052
- // $div.data().xuData.parent_container;
12053
- // });
12054
-
12055
11933
  return await render_screen_type($div);
12056
-
12057
- // if (paramsP.is_mobile_modal) {
12058
- // return await open_modal($div);
12059
- // }
12060
- // if (paramsP.is_mobile_popover) {
12061
- // open_popover($div);
12062
- // func.UI.utils.screen_blocker(
12063
- // false,
12064
- // paramsP.prog_id + "_" + paramsP.sourceScreenP
12065
- // );
12066
- // return;
12067
- // }
12068
-
12069
- // if (paramsP.is_mobile_page) {
12070
- // const $nav = $(SESSION_OBJ[SESSION_ID].root_element).find("xu-nav");
12071
- // const nav = $nav[0];
12072
-
12073
- // var params = {
12074
- // div: $div_content,
12075
- // name: paramsP.screenInfo.properties?.menuTitle,
12076
- // screenId: paramsP.screenId,
12077
- // $container: $container,
12078
- // // icon: $div.data().xuData.paramsP.screenInfo.rICN,
12079
- // dsSession: paramsP.dsSessionP,
12080
- // };
12081
- // var component_name = "xu-page-component-" + paramsP.dsSessionP;
12082
- // if (!$(nav).data().xuData.nav_params) {
12083
- // $(nav).data().xuData.nav_params = {};
12084
- // }
12085
-
12086
- // //restore validate
12087
- // if ($(nav)?.data()?.xuData?.params?.[paramsP.dsSessionP]) {
12088
- // params.$container.data().xuData.validate_screen_ready = $(nav)
12089
- // .data()
12090
- // .xuData.params[
12091
- // paramsP.dsSessionP
12092
- // ].$container.data().xuData.validate_screen_ready;
12093
- // }
12094
-
12095
- // if (!$(nav)?.data()?.xuData) return;
12096
- // $(nav).data().xuData.nav_params[paramsP.dsSessionP] = params;
12097
- // if (!$(component_name).length) {
12098
- // await func.UI.component.create_app_page_component(
12099
- // SESSION_ID,
12100
- // paramsP.dsSessionP
12101
- // );
12102
- // const page = new UI_FRAMEWORK_PLUGIN.page();
12103
- // await page.create(
12104
- // SESSION_ID,
12105
- // paramsP.dsSessionP,
12106
- // nav,
12107
- // $nav.data().xuData.nav_params[paramsP.dsSessionP]
12108
- // );
12109
- // await page.init(
12110
- // SESSION_ID,
12111
- // paramsP.dsSessionP,
12112
- // nav,
12113
- // $nav.data().xuData.nav_params[paramsP.dsSessionP]
12114
- // );
12115
- // nav.push(component_name, { params });
12116
- // } else {
12117
- // debugger;
12118
- // $(component_name).empty();
12119
-
12120
- // await UI_FRAMEWORK_PLUGIN.page(SESSION_ID, paramsP.dsSessionP);
12121
- // }
12122
- // $div.data().xuData.paramsP = $container.data().xuData.paramsP;
12123
-
12124
- // return $div;
12125
- // }
12126
-
12127
- // if (
12128
- // !paramsP.is_mobile_page &&
12129
- // !paramsP.is_mobile_modal &&
12130
- // !paramsP.is_mobile_popover &&
12131
- // !paramsP.is_panelP
12132
- // ) {
12133
- // var $nav = $(SESSION_OBJ[SESSION_ID].root_element).find("xu-nav");
12134
- // if ($nav && $nav.length) {
12135
- // // refresh made
12136
- // } else {
12137
- // $nav = $("<xu-nav>");
12138
- // $container.append($nav);
12139
- // func.UI.component.init_xu_nav($container, $nav);
12140
- // }
12141
-
12142
- // $nav.data().xuData.$div = $div_content; // set data to nav to use in the component
12143
-
12144
- // await $nav[0].setRoot("xu-root-component-" + SESSION_ID);
12145
- // } else {
12146
- // $container.append($div_content);
12147
- // }
12148
- // return $container;
12149
11934
  },
12150
11935
  [`xu-multi-view`]: async function () {
12151
11936
  var $div = $container;
@@ -12181,41 +11966,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
12181
11966
  return $div;
12182
11967
  };
12183
11968
  await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
12184
- // var $div_content = $div.children();
12185
-
12186
- // if (continuous_idx !== null || !prop.app_items_per_page) {
12187
- // $.each($div.data().xuData, function (key, val) {
12188
- // $container.data().xuData[key] = val;
12189
- // });
12190
- // $.each($div.data().xuAttributes, function (key, val) {
12191
- // $container.data().xuAttributes[key] = val;
12192
- // });
12193
-
12194
- // if (!$container.data().xuData.node) {
12195
- // $container.data().xuData.node = {};
12196
- // }
12197
-
12198
- // $container.data().xuData.node.children = [];
12199
-
12200
- // $.each($div_content, function (key, val) {
12201
- // if (!$(val)?.data()?.xuData) return;
12202
- // if (
12203
- // continuous_idx === null ||
12204
- // (continuous_idx && key > continuous_idx)
12205
- // ) {
12206
- // $(val).data().xuData.parent_container =
12207
- // $div.data().xuData.parent_container;
12208
- // $container
12209
- // .data()
12210
- // .xuData.node.children.push($(val).data().xuData.node);
12211
- // }
12212
- // });
12213
- // }
12214
11969
 
12215
- // if (continuous_idx !== null) {
12216
- // if (glb.CURRENT_APP_LOADING === 1) glb.CURRENT_APP_LOADING = 0; // re-activate loader
12217
- // return;
12218
- // }
12219
11970
  return await render_screen_type($div);
12220
11971
  };
12221
11972
 
@@ -12249,38 +12000,6 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
12249
12000
  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);
12250
12001
  await func.events.validate(SESSION_ID, 'record_not_found', paramsP.dsSessionP);
12251
12002
  return await done(null);
12252
-
12253
- // var text = "";
12254
- // if (prop?.app_empty_result_text !== "undefined") {
12255
- // text = prop.app_empty_result_text;
12256
- // }
12257
- // if (
12258
- // prop.app_empty_result_text_EXP &&
12259
- // prop.app_empty_result_text_EXP !== "undefined"
12260
- // ) {
12261
- // let exp = prop.app_empty_result_text_EXP;
12262
- // if (exp && exp !== "undefined") {
12263
- // var res = func.expression.get(
12264
- // SESSION_ID,
12265
- // exp,
12266
- // paramsP.dsSessionP,
12267
- // "app_empty_result_text_EXP",
12268
- // _ds.currentRecordId
12269
- // );
12270
- // text = res.result;
12271
- // }
12272
- // }
12273
- // if (icon || text) {
12274
- // $container.append(
12275
- // `<div style="width: 100%;" >${img}<h6 style="text-align: center;">${text}</h6></div>`
12276
- // );
12277
- // }
12278
- // await func.events.validate(
12279
- // SESSION_ID,
12280
- // "record_not_found",
12281
- // paramsP.dsSessionP
12282
- // );
12283
- // return await done(null);
12284
12003
  };
12285
12004
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
12286
12005
 
@@ -12293,25 +12012,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
12293
12012
  var i = 0;
12294
12013
  for await (const [key, val] of Object.entries(_ds.data_feed.rows)) {
12295
12014
  var node = JSON.parse(JSON.stringify(nodeP));
12296
- // TO FIX
12297
- // if (
12298
- // continuous_idx === null &&
12299
- // prop.app_items_per_page &&
12300
- // i >= Number(prop.app_items_per_page)
12301
- // ) {
12302
- // continuous_idx = i;
12303
- // await done(null);
12304
-
12305
- // setTimeout(async function () {
12306
- // await run_item(continuous_idx);
12307
- // if (!glb.CURRENT_APP_LOADING) {
12308
- // glb.CURRENT_APP_LOADING = 1;
12309
- // } // deactivate loader
12310
- // }, 1000);
12311
-
12312
- // continue;
12313
- // }
12314
- ////////
12015
+
12315
12016
  _ds.currentRecordId = val._ROWID;
12316
12017
  const ret = await iterate_child($div, node, { continuous_idx }, null, $root_container);
12317
12018
 
@@ -12363,46 +12064,6 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
12363
12064
  };
12364
12065
  if (!element || element === 'script') return await done();
12365
12066
  let str = '';
12366
- // var $div
12367
- // const draw_svg = function () {
12368
- // const get_tag_str = function (element, prop, val) {
12369
- // let class_str = "";
12370
- // let attr_str = "";
12371
- // for (const [key, val] of Object.entries(prop)) {
12372
- // if (key.substr(0, 2) !== "xu") {
12373
- // attr_str += ` ${key}="${val}" `;
12374
- // }
12375
- // }
12376
- // if (element === "svg") {
12377
- // return `<${element} ${attr_str} > `;
12378
- // }
12379
- // let ret = "";
12380
- // if (val?.children?.length) {
12381
- // ret = iterate_svg(val);
12382
- // }
12383
-
12384
- // return `<${element} ${class_str} ${attr_str} > ${ret} </${element}>`;
12385
- // };
12386
- // let svg_str = get_tag_str(element, prop);
12387
- // let inner_str = "";
12388
- // const iterate_svg = function (node) {
12389
- // let ret = "";
12390
- // if (node.children) {
12391
- // for (let val of node.children) {
12392
- // let prop = val.attributes;
12393
- // ret += get_tag_str(val.tagName, prop, val);
12394
- // }
12395
- // }
12396
- // return ret;
12397
- // };
12398
- // inner_str = iterate_svg(nodeP);
12399
-
12400
- // $div = $(svg_str + inner_str + "</svg>").appendTo($container);
12401
- // };
12402
- // if (element === "svg") {
12403
- // draw_svg();
12404
- // // return await done();
12405
- // }
12406
12067
 
12407
12068
  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);
12408
12069