@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.
@@ -24682,6 +24682,7 @@ var UI_WORKER_OBJ = {
24682
24682
  num: 9000,
24683
24683
  cache: {},
24684
24684
  viewport_height_set_ids: [],
24685
+ xu_render_cache: {},
24685
24686
  // pending_for_viewport_render: {}
24686
24687
  };
24687
24688
 
@@ -32130,6 +32131,135 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
32130
32131
  return {};
32131
32132
  },
32132
32133
  'xu-render': async function ($elm, val, from_panel) {
32134
+ var value = await func.common.get_cast_val(SESSION_ID, 'common fx', 'xu-render', 'bool', val.value);
32135
+ const init_render = function () {
32136
+ if (!value) {
32137
+ var cloned_$div = $elm.clone(true);
32138
+
32139
+ let $xurender = $('<xurender>').attr('xu-ui-id', $elm.attr('xu-ui-id')).attr('hidden', true).appendTo($container).hide();
32140
+ let original_data_obj = {
32141
+ $container: cloned_$div,
32142
+ nodeP: _.cloneDeep(nodeP),
32143
+ parent_infoP,
32144
+ paramsP,
32145
+ keyP,
32146
+ parent_nodeP,
32147
+ $root_container,
32148
+ };
32149
+ $xurender.data('xuData', cloned_$div.data().xuData);
32150
+ $xurender.data().xuData.original_data_obj = original_data_obj;
32151
+ $xurender.data().xuData.xurender_node = cloned_$div;
32152
+ $xurender.data().xuAttributes = nodeP.attributes || {};
32153
+ $xurender.hide();
32154
+
32155
+ $elm.remove();
32156
+ return { abort: true };
32157
+ }
32158
+ return {};
32159
+ };
32160
+
32161
+ const post_render = async function () {
32162
+ if (value) {
32163
+ try {
32164
+ // abort if already rended
32165
+ if ($elm[0].tagName !== 'XURENDER' && $elm?.length) {
32166
+ return func.events.delete_job(SESSION_ID, jobNoP);
32167
+ }
32168
+
32169
+ let original_data_obj = $elm.data().xuData.original_data_obj;
32170
+
32171
+ if (!original_data_obj) {
32172
+ func.events.delete_job(SESSION_ID, jobNoP);
32173
+ return { delete_job: jobNoP };
32174
+ }
32175
+
32176
+ const new_$div = await func.UI.screen.render_ui_tree(
32177
+ SESSION_ID,
32178
+ $elm, //original_data_obj.$container,
32179
+ _.cloneDeep(original_data_obj.nodeP),
32180
+ original_data_obj.parent_infoP,
32181
+ original_data_obj.paramsP,
32182
+ jobNoP,
32183
+ null,
32184
+ original_data_obj.keyP,
32185
+ null,
32186
+ original_data_obj.parent_nodeP,
32187
+ null,
32188
+ original_data_obj.$root_container,
32189
+ );
32190
+
32191
+ new_$div.data().xuData.original_data_obj = original_data_obj;
32192
+ new_$div.data().xuData.xurender_node = $elm.clone(true);
32193
+ new_$div.data().xuAttributes = $elm.data().xuAttributes || {};
32194
+
32195
+ const replace = async function () {
32196
+ $elm.replaceWith(new_$div);
32197
+ if (from_panel) {
32198
+ const xuPanelWrapper = _.clone(new_$div.data().xuPanelWrapper);
32199
+ $elm.parent().data().xuPanelWrapper = xuPanelWrapper;
32200
+ $elm.replaceWith(new_$div.children());
32201
+ }
32202
+
32203
+ if (val.fields_arr) {
32204
+ return await func.UI.screen.refresh_xu_attributes(SESSION_ID, val.fields_arr, val.jobNoP, new_$div);
32205
+ }
32206
+ func.events.delete_job(SESSION_ID, jobNoP);
32207
+ };
32208
+
32209
+ if ($elm && func.UI.utils.find_in_element_data('xuData', $(SESSION_OBJ[SESSION_ID].root_element), 'xu_id', $elm.data().xuData.xu_id).length) {
32210
+ if (new_$div.data().xuData.paramsP) {
32211
+ return await replace();
32212
+ }
32213
+
32214
+ func.events.delete_job(SESSION_ID, jobNoP);
32215
+ }
32216
+ } catch (error) {
32217
+ func.events.delete_job(SESSION_ID, jobNoP);
32218
+ }
32219
+ return;
32220
+ }
32221
+ // if (!value) {
32222
+ if ($elm.prop('tagName') === 'XURENDER') {
32223
+ func.events.delete_job(SESSION_ID, jobNoP);
32224
+ return;
32225
+ }
32226
+
32227
+ let tmp_$div = $('<div>');
32228
+
32229
+ let $xurender = $('<xurender>').attr('xu-ui-id', $elm.attr('xu-ui-id')).appendTo(tmp_$div).hide();
32230
+ // was true before
32231
+ if ($elm.data().xuData.xurender_node) {
32232
+ $xurender.data({
32233
+ xuAttributes: $elm.data().xuData.xurender_node.data().xuAttributes || {},
32234
+ xuData: $elm.data().xuData.xurender_node.data().xuData || {},
32235
+ });
32236
+ } else {
32237
+ // default new state
32238
+
32239
+ $xurender.data({
32240
+ xuAttributes: $elm.data().xuAttributes || {},
32241
+ xuData: $elm.data().xuData || {},
32242
+ });
32243
+ const original_data_obj = {
32244
+ nodeP: _.cloneDeep($elm.data().xuData.node_org),
32245
+ paramsP: $elm.data().xuData.paramsP,
32246
+ $container: $elm.clone(true),
32247
+ parent_infoP: parent_infoP,
32248
+ };
32249
+
32250
+ $xurender.data().xuData.original_data_obj = original_data_obj;
32251
+ }
32252
+
32253
+ $elm.replaceWith(tmp_$div.children());
32254
+ func.events.delete_job(SESSION_ID, jobNoP);
32255
+ // }
32256
+ };
32257
+ if (is_init) {
32258
+ return init_render();
32259
+ }
32260
+ return await post_render();
32261
+ },
32262
+ 'xu-render-new': async function ($elm, val, from_panel) {
32133
32263
  var value = await func.common.get_cast_val(SESSION_ID, 'common fx', 'xu-render', 'bool', val.value);
32134
32264
  const init_render = function () {
32135
32265
  if (!value) {
@@ -32142,7 +32272,7 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
32142
32272
  .appendTo($container)
32143
32273
  .hide();
32144
32274
  let original_data_obj = {
32145
- not_rendered: true,
32275
+ force_render: true,
32146
32276
  $container: cloned_$div,
32147
32277
  nodeP: _.cloneDeep(nodeP),
32148
32278
  parent_infoP,
@@ -32180,7 +32310,7 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
32180
32310
 
32181
32311
  let new_$div = original_data_obj.$container.clone(true);
32182
32312
 
32183
- if (original_data_obj.not_rendered) {
32313
+ if (original_data_obj.force_render) {
32184
32314
  new_$div = await func.UI.screen.render_ui_tree(
32185
32315
  SESSION_ID,
32186
32316
  $elm, //original_data_obj.$container,
@@ -32227,19 +32357,17 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
32227
32357
  }
32228
32358
  return;
32229
32359
  }
32230
- // if (!value) {
32360
+
32361
+ /////////// !value ///////////
32362
+
32231
32363
  if ($elm.prop('tagName') === 'XURENDER') {
32232
32364
  func.events.delete_job(SESSION_ID, jobNoP);
32233
32365
  return;
32234
32366
  }
32235
32367
 
32236
32368
  let tmp_$div = $('<div>');
32237
-
32238
- let $xurender = $('<xurender>')
32239
- // .attr('xu-ui-id', $elm.data().xuData.node.id + '_' + $elm.data().xuData.recordid)
32240
- .attr('xu-ui-id', $elm.attr('xu-ui-id'))
32241
- .appendTo(tmp_$div)
32242
- .hide();
32369
+ const xu_ui_id = $elm.attr('xu-ui-id');
32370
+ let $xurender = $('<xurender>').attr('xu-ui-id', xu_ui_id).appendTo(tmp_$div).hide();
32243
32371
  // // was true before
32244
32372
  // if ($elm.data().xuData.xurender_node) {
32245
32373
  // $xurender.data({
@@ -32261,10 +32389,12 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
32261
32389
  };
32262
32390
 
32263
32391
  $xurender.data().xuData.original_data_obj = original_data_obj;
32392
+
32393
+ UI_WORKER_OBJ.xu_render_cache[xu_ui_id] = original_data_obj;
32394
+
32264
32395
  // }
32265
32396
  $elm.replaceWith(tmp_$div.children());
32266
32397
  func.events.delete_job(SESSION_ID, jobNoP);
32267
- // }
32268
32398
  };
32269
32399
  if (is_init) {
32270
32400
  return init_render();