@xuda.io/runtime-bundle 1.0.994 → 1.0.996

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.
@@ -2723,6 +2723,7 @@ var UI_WORKER_OBJ = {
2723
2723
  num: 9000,
2724
2724
  cache: {},
2725
2725
  viewport_height_set_ids: [],
2726
+ xu_render_cache: {},
2726
2727
  // pending_for_viewport_render: {}
2727
2728
  };
2728
2729
 
@@ -10171,6 +10172,135 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
10171
10172
  return {};
10172
10173
  },
10173
10174
  'xu-render': async function ($elm, val, from_panel) {
10175
+ var value = await func.common.get_cast_val(SESSION_ID, 'common fx', 'xu-render', 'bool', val.value);
10176
+ const init_render = function () {
10177
+ if (!value) {
10178
+ var cloned_$div = $elm.clone(true);
10179
+
10180
+ let $xurender = $('<xurender>').attr('xu-ui-id', $elm.attr('xu-ui-id')).attr('hidden', true).appendTo($container).hide();
10181
+ let original_data_obj = {
10182
+ $container: cloned_$div,
10183
+ nodeP: _.cloneDeep(nodeP),
10184
+ parent_infoP,
10185
+ paramsP,
10186
+ keyP,
10187
+ parent_nodeP,
10188
+ $root_container,
10189
+ };
10190
+ $xurender.data('xuData', cloned_$div.data().xuData);
10191
+ $xurender.data().xuData.original_data_obj = original_data_obj;
10192
+ $xurender.data().xuData.xurender_node = cloned_$div;
10193
+ $xurender.data().xuAttributes = nodeP.attributes || {};
10194
+ $xurender.hide();
10195
+
10196
+ $elm.remove();
10197
+ return { abort: true };
10198
+ }
10199
+ return {};
10200
+ };
10201
+
10202
+ const post_render = async function () {
10203
+ if (value) {
10204
+ try {
10205
+ // abort if already rended
10206
+ if ($elm[0].tagName !== 'XURENDER' && $elm?.length) {
10207
+ return func.events.delete_job(SESSION_ID, jobNoP);
10208
+ }
10209
+
10210
+ let original_data_obj = $elm.data().xuData.original_data_obj;
10211
+
10212
+ if (!original_data_obj) {
10213
+ func.events.delete_job(SESSION_ID, jobNoP);
10214
+ return { delete_job: jobNoP };
10215
+ }
10216
+
10217
+ const new_$div = await func.UI.screen.render_ui_tree(
10218
+ SESSION_ID,
10219
+ $elm, //original_data_obj.$container,
10220
+ _.cloneDeep(original_data_obj.nodeP),
10221
+ original_data_obj.parent_infoP,
10222
+ original_data_obj.paramsP,
10223
+ jobNoP,
10224
+ null,
10225
+ original_data_obj.keyP,
10226
+ null,
10227
+ original_data_obj.parent_nodeP,
10228
+ null,
10229
+ original_data_obj.$root_container,
10230
+ );
10231
+
10232
+ new_$div.data().xuData.original_data_obj = original_data_obj;
10233
+ new_$div.data().xuData.xurender_node = $elm.clone(true);
10234
+ new_$div.data().xuAttributes = $elm.data().xuAttributes || {};
10235
+
10236
+ const replace = async function () {
10237
+ $elm.replaceWith(new_$div);
10238
+ if (from_panel) {
10239
+ const xuPanelWrapper = _.clone(new_$div.data().xuPanelWrapper);
10240
+ $elm.parent().data().xuPanelWrapper = xuPanelWrapper;
10241
+ $elm.replaceWith(new_$div.children());
10242
+ }
10243
+
10244
+ if (val.fields_arr) {
10245
+ return await func.UI.screen.refresh_xu_attributes(SESSION_ID, val.fields_arr, val.jobNoP, new_$div);
10246
+ }
10247
+ func.events.delete_job(SESSION_ID, jobNoP);
10248
+ };
10249
+
10250
+ if ($elm && func.UI.utils.find_in_element_data('xuData', $(SESSION_OBJ[SESSION_ID].root_element), 'xu_id', $elm.data().xuData.xu_id).length) {
10251
+ if (new_$div.data().xuData.paramsP) {
10252
+ return await replace();
10253
+ }
10254
+
10255
+ func.events.delete_job(SESSION_ID, jobNoP);
10256
+ }
10257
+ } catch (error) {
10258
+ func.events.delete_job(SESSION_ID, jobNoP);
10259
+ }
10260
+ return;
10261
+ }
10262
+ // if (!value) {
10263
+ if ($elm.prop('tagName') === 'XURENDER') {
10264
+ func.events.delete_job(SESSION_ID, jobNoP);
10265
+ return;
10266
+ }
10267
+
10268
+ let tmp_$div = $('<div>');
10269
+
10270
+ let $xurender = $('<xurender>').attr('xu-ui-id', $elm.attr('xu-ui-id')).appendTo(tmp_$div).hide();
10271
+ // was true before
10272
+ if ($elm.data().xuData.xurender_node) {
10273
+ $xurender.data({
10274
+ xuAttributes: $elm.data().xuData.xurender_node.data().xuAttributes || {},
10275
+ xuData: $elm.data().xuData.xurender_node.data().xuData || {},
10276
+ });
10277
+ } else {
10278
+ // default new state
10279
+
10280
+ $xurender.data({
10281
+ xuAttributes: $elm.data().xuAttributes || {},
10282
+ xuData: $elm.data().xuData || {},
10283
+ });
10284
+ const original_data_obj = {
10285
+ nodeP: _.cloneDeep($elm.data().xuData.node_org),
10286
+ paramsP: $elm.data().xuData.paramsP,
10287
+ $container: $elm.clone(true),
10288
+ parent_infoP: parent_infoP,
10289
+ };
10290
+
10291
+ $xurender.data().xuData.original_data_obj = original_data_obj;
10292
+ }
10293
+
10294
+ $elm.replaceWith(tmp_$div.children());
10295
+ func.events.delete_job(SESSION_ID, jobNoP);
10296
+ // }
10297
+ };
10298
+ if (is_init) {
10299
+ return init_render();
10300
+ }
10301
+ return await post_render();
10302
+ },
10303
+ 'xu-render-new': async function ($elm, val, from_panel) {
10174
10304
  var value = await func.common.get_cast_val(SESSION_ID, 'common fx', 'xu-render', 'bool', val.value);
10175
10305
  const init_render = function () {
10176
10306
  if (!value) {
@@ -10183,7 +10313,7 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
10183
10313
  .appendTo($container)
10184
10314
  .hide();
10185
10315
  let original_data_obj = {
10186
- not_rendered: true,
10316
+ force_render: true,
10187
10317
  $container: cloned_$div,
10188
10318
  nodeP: _.cloneDeep(nodeP),
10189
10319
  parent_infoP,
@@ -10221,7 +10351,7 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
10221
10351
 
10222
10352
  let new_$div = original_data_obj.$container.clone(true);
10223
10353
 
10224
- if (original_data_obj.not_rendered) {
10354
+ if (original_data_obj.force_render) {
10225
10355
  new_$div = await func.UI.screen.render_ui_tree(
10226
10356
  SESSION_ID,
10227
10357
  $elm, //original_data_obj.$container,
@@ -10268,19 +10398,17 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
10268
10398
  }
10269
10399
  return;
10270
10400
  }
10271
- // if (!value) {
10401
+
10402
+ /////////// !value ///////////
10403
+
10272
10404
  if ($elm.prop('tagName') === 'XURENDER') {
10273
10405
  func.events.delete_job(SESSION_ID, jobNoP);
10274
10406
  return;
10275
10407
  }
10276
10408
 
10277
10409
  let tmp_$div = $('<div>');
10278
-
10279
- let $xurender = $('<xurender>')
10280
- // .attr('xu-ui-id', $elm.data().xuData.node.id + '_' + $elm.data().xuData.recordid)
10281
- .attr('xu-ui-id', $elm.attr('xu-ui-id'))
10282
- .appendTo(tmp_$div)
10283
- .hide();
10410
+ const xu_ui_id = $elm.attr('xu-ui-id');
10411
+ let $xurender = $('<xurender>').attr('xu-ui-id', xu_ui_id).appendTo(tmp_$div).hide();
10284
10412
  // // was true before
10285
10413
  // if ($elm.data().xuData.xurender_node) {
10286
10414
  // $xurender.data({
@@ -10302,10 +10430,12 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
10302
10430
  };
10303
10431
 
10304
10432
  $xurender.data().xuData.original_data_obj = original_data_obj;
10433
+
10434
+ UI_WORKER_OBJ.xu_render_cache[xu_ui_id] = original_data_obj;
10435
+
10305
10436
  // }
10306
10437
  $elm.replaceWith(tmp_$div.children());
10307
10438
  func.events.delete_job(SESSION_ID, jobNoP);
10308
- // }
10309
10439
  };
10310
10440
  if (is_init) {
10311
10441
  return init_render();