@xuda.io/runtime-bundle 1.0.1251 → 1.0.1252

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.
@@ -34977,45 +34977,1205 @@ func.UI.screen.screen_loading_done = async function (SESSION_ID, paramsP, $div,
34977
34977
  return $div;
34978
34978
  };
34979
34979
 
34980
+ // func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, parent_infoP, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, $root_container) {
34981
+ // if (!is_skeleton) {
34982
+ // var _session = SESSION_OBJ[SESSION_ID];
34983
+ // var _ds = _session.DS_GLB[paramsP.dsSessionP];
34984
+ // }
34985
+ // var prop;
34986
+ // try {
34987
+ // prop = nodeP.attributes;
34988
+ // } catch (error) {
34989
+ // // debugger;
34990
+ // }
34991
+
34992
+ // ///////////
34993
+ // var is_mobile = glb.MOBILE_ARR.includes(paramsP.screenInfo.properties?.menuType) ? true : false;
34994
+
34995
+ // const get_element_info = function () {
34996
+ // var ret = {};
34997
+ // let currentRecordId = _ds?.currentRecordId || '';
34998
+
34999
+ // let $div = func.UI.utils.find_in_element_data('xuData', $container.parent(), 'nodeid', nodeP.id);
35000
+
35001
+ // $.each($div, function (key, val) {
35002
+ // if ($(val)?.data().xuData?.recordid === currentRecordId && $(val)?.data().xuData?.key === keyP && $(val)?.prop('tagName') !== 'XURENDER') {
35003
+ // ret = {
35004
+ // div: $div,
35005
+ // };
35006
+ // }
35007
+ // });
35008
+
35009
+ // return ret;
35010
+ // };
35011
+
35012
+ // const init = async function () {
35013
+ // var ret = true;
35014
+ // if (!nodeP) ret = false;
35015
+ // return ret;
35016
+ // };
35017
+ // const debug = function (is_errorP, error_descP) {
35018
+ // func.utils.debug.log(SESSION_ID, paramsP.prog_id + '_' + nodeP.id_org + '_ui_prop', {
35019
+ // module: 'gui',
35020
+ // action: 'init',
35021
+ // prop: nodeP.id,
35022
+ // details: error_descP,
35023
+ // result: null,
35024
+ // error: is_errorP,
35025
+ // source: _ds?.tree_obj?.menuName || '',
35026
+ // fields: null,
35027
+ // type: null,
35028
+ // prog_id: paramsP.prog_id,
35029
+ // dsSession: null,
35030
+ // });
35031
+ // };
35032
+
35033
+ // const open_modal = async function ($div) {
35034
+ // const modal_id = 'app_modal-' + paramsP.dsSessionP.toString();
35035
+ // var xu_modal_controller = document.querySelector('xu-modal-controller');
35036
+ // if (!xu_modal_controller) {
35037
+ // func.UI.component.create_app_modal_component(SESSION_ID, modal_id);
35038
+ // xu_modal_controller = document.querySelector('xu-modal-controller');
35039
+ // }
35040
+
35041
+ // var controller_params = $(xu_modal_controller).data('xuControllerParams');
35042
+
35043
+ // if (!controller_params) {
35044
+ // controller_params = {};
35045
+ // }
35046
+
35047
+ // var params = {
35048
+ // menuTitle: paramsP.screenInfo.properties?.menuTitle,
35049
+ // screenId: paramsP.screenId,
35050
+ // $dialogDiv: $div.children(),
35051
+ // $container: $container,
35052
+ // dsSession: paramsP.dsSessionP,
35053
+ // };
35054
+
35055
+ // controller_params[modal_id] = params;
35056
+
35057
+ // $(xu_modal_controller).data('xuControllerParams', controller_params);
35058
+ // const modalController = await new UI_FRAMEWORK_PLUGIN.modal();
35059
+
35060
+ // if (!APP_MODAL_OBJ[modal_id]) {
35061
+ // const modal = await modalController.create(SESSION_ID, modal_id, paramsP.screenInfo, close_modal);
35062
+ // APP_MODAL_OBJ[modal_id] = modal;
35063
+ // } else {
35064
+ // $(modal_id).empty();
35065
+ // }
35066
+ // await modalController.init(SESSION_ID, modal_id);
35067
+
35068
+ // return $div;
35069
+ // };
35070
+
35071
+ // const close_modal = async function (modal_id) {
35072
+ // delete APP_MODAL_OBJ[modal_id];
35073
+ // const xu_modal_controller = document.querySelector('xu-modal-controller');
35074
+ // var params = $(xu_modal_controller).data().xuControllerParams[modal_id];
35075
+ // if (params && params.$container) {
35076
+ // await func.UI.screen.validate_exit_events(SESSION_ID, params.$container.data().xuData.paramsP, null);
35077
+ // func.datasource.clean_all(SESSION_ID, params.dsSession);
35078
+ // }
35079
+ // };
35080
+
35081
+ // const close_all_modals = function () {
35082
+ // $.each(APP_MODAL_OBJ, function (key, val) {
35083
+ // if (val) {
35084
+ // // close_modal(key);
35085
+ // UI_FRAMEWORK_PLUGIN.modal.close(key);
35086
+ // }
35087
+ // });
35088
+ // };
35089
+
35090
+ // const open_popover = async function ($div) {
35091
+ // const xu_popover_controller = func.UI.component.create_app_popover_component(SESSION_ID);
35092
+
35093
+ // $(xu_popover_controller).data('xuControllerParams', {
35094
+ // menuTitle: paramsP.screenInfo.properties?.menuTitle,
35095
+ // screenId: paramsP.screenId,
35096
+ // $dialogDiv: $div.children(),
35097
+ // $container: $container,
35098
+ // });
35099
+ // const popover = new UI_FRAMEWORK_PLUGIN.popover(
35100
+ // SESSION_ID,
35101
+ // // ELEMENT_CLICK_EVENT,
35102
+ // // props
35103
+ // );
35104
+ // await popover.open(SESSION_ID);
35105
+ // CURRENT_APP_POPOVER = popover;
35106
+
35107
+ // return;
35108
+ // popoverController
35109
+ // .create({
35110
+ // component: 'xu-popover-content-' + SESSION_ID,
35111
+ // event: ELEMENT_CLICK_EVENT,
35112
+ // translucent: true,
35113
+ // })
35114
+ // .then((modal) => {
35115
+ // modal.present().then(() => {
35116
+ // CURRENT_APP_POPOVER = modal;
35117
+
35118
+ // if (callbackP) callbackP($div);
35119
+ // });
35120
+ // });
35121
+ // };
35122
+ // const iterate_child = async function ($divP, nodeP, parent_infoP, $root_container, before_record_function) {
35123
+ // if (!is_mobile && nodeP.busy) return;
35124
+ // nodeP.busy = true;
35125
+ // const done = async function ($divP) {
35126
+ // setTimeout(function () {
35127
+ // nodeP.busy = false;
35128
+ // }, 1000);
35129
+
35130
+ // return $divP;
35131
+ // };
35132
+ // if (!nodeP || !nodeP.children) {
35133
+ // return await done($divP);
35134
+ // }
35135
+
35136
+ // if (before_record_function) {
35137
+ // await before_record_function();
35138
+ // }
35139
+ // if (nodeP?.children?.length) {
35140
+ // let node_promises = [];
35141
+ // for (const [key, val] of Object.entries(nodeP.children)) {
35142
+ // node_promises.push(
35143
+ // new Promise(async (resolve, reject) => {
35144
+ // const ret = await func.UI.screen.render_ui_tree(SESSION_ID, $divP, nodeP.children[key], parent_infoP, paramsP, jobNoP, is_skeleton, Number(key), null, nodeP, null, $root_container);
35145
+
35146
+ // resolve();
35147
+ // }),
35148
+ // );
35149
+ // }
35150
+ // await Promise.all(node_promises);
35151
+ // }
35152
+ // return await done($divP);
35153
+ // };
35154
+
35155
+ // // const iterate_child = async function ($divP, nodeP, parent_infoP, $root_container, before_record_function) {
35156
+ // // if (!is_mobile && nodeP.busy) return;
35157
+ // // nodeP.busy = true;
35158
+ // // const done = async function ($divP) {
35159
+ // // setTimeout(function () {
35160
+ // // nodeP.busy = false;
35161
+ // // }, 1000);
35162
+
35163
+ // // return $divP;
35164
+ // // };
35165
+ // // if (!nodeP || !nodeP.children) {
35166
+ // // return await done($divP);
35167
+ // // }
35168
+
35169
+ // // if (before_record_function) {
35170
+ // // await before_record_function();
35171
+ // // }
35172
+ // // if (nodeP?.children?.length) {
35173
+ // // for await (const [key, val] of Object.entries(nodeP.children)) {
35174
+ // // const ret = await func.UI.screen.render_ui_tree(SESSION_ID, $divP, nodeP.children[key], parent_infoP, paramsP, jobNoP, is_skeleton, Number(key), null, nodeP, null, $root_container);
35175
+ // // }
35176
+ // // }
35177
+ // // return await done($divP);
35178
+ // // };
35179
+
35180
+ // const _$ = function ($elm) {
35181
+ // try {
35182
+ // const id = $elm.attr('xu-ui-id');
35183
+ // if (!id || !glb.DEBUG_MODE) return $elm;
35184
+ // const $el = $(`[xu-ui-id="${id}"]`);
35185
+
35186
+ // if ($el.length > 1) {
35187
+ // console.warn('Multiple elements for xu-ui-id: ' + id, $el);
35188
+ // }
35189
+
35190
+ // return $($el[0]);
35191
+ // } catch (e) {
35192
+ // console.error(e);
35193
+ // }
35194
+ // };
35195
+
35196
+ // const hover_in = function ($div, e) {
35197
+ // if (is_skeleton || (e && (EXP_BUSY || UI_WORKER_OBJ.jobs.length))) return;
35198
+ // CLIENT_ACTIVITY_TS = Date.now();
35199
+ // if (_$($container)?.data()?.xuData?.debug_info) _$($container).data().xuData.debug_info.hover_item = $div.attr('xu-ui-id');
35200
+ // if (!_ds) return;
35201
+ // ///////// SET Attributes///////////
35202
+ // let attributes = {};
35203
+ // $.each($div[0].attributes, function (index, attr) {
35204
+ // attributes[attr.name] = attr.value;
35205
+ // });
35206
+
35207
+ // _session.DS_GLB[0].data_system.SYS_OBJ_WIN_ELEMENT_HOVERED_ATTRIBUTES = attributes;
35208
+ // //////////////////////////////////
35209
+ // if (!$div.data()?.xuData) return;
35210
+ // const _iterate_info = $div.data().xuData.iterate_info;
35211
+ // if (_iterate_info) {
35212
+ // if (_iterate_info.is_key_dynamic_field) {
35213
+ // _ds.dynamic_fields[_iterate_info.iterator_key].value = _iterate_info._key;
35214
+ // } else {
35215
+ // try {
35216
+ // const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
35217
+ // _ds.data_feed.rows[row_idx][_iterate_info.iterator_key] = _iterate_info._key;
35218
+ // } catch (err) {
35219
+ // console.error(err);
35220
+ // }
35221
+ // }
35222
+
35223
+ // if (_iterate_info.is_val_dynamic_field) {
35224
+ // _ds.dynamic_fields[_iterate_info.iterator_val].value = _iterate_info._val;
35225
+ // } else {
35226
+ // try {
35227
+ // const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
35228
+ // _ds.data_feed.rows[row_idx][_iterate_info.iterator_val] = _iterate_info._val;
35229
+ // } catch (err) {
35230
+ // console.error(err);
35231
+ // }
35232
+ // }
35233
+ // }
35234
+
35235
+ // if ($div && _$($div) && _ds && paramsP.renderType === 'grid') {
35236
+ // func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'update_datasource', { currentRecordId: _$($div).data().xuData.currentRecordId }, null, null, paramsP.dsSessionP);
35237
+ // }
35238
+
35239
+ // const set_value = function (field_id, value) {
35240
+ // var currentRecordId = _$($div).data().xuData.currentRecordId;
35241
+
35242
+ // func.UI.worker.add_to_queue(
35243
+ // SESSION_ID,
35244
+ // 'gui event',
35245
+ // 'update_datasource',
35246
+ // {
35247
+ // currentRecordId,
35248
+ // field_id,
35249
+ // field_value: value,
35250
+ // },
35251
+ // null,
35252
+ // null,
35253
+ // paramsP.dsSessionP,
35254
+ // );
35255
+ // };
35256
+
35257
+ // if ($div?.data()?.iterate_info) {
35258
+ // var data = $div.data().xuData.iterate_info;
35259
+ // if (data.iterator_key) {
35260
+ // set_value(data.iterator_key, data._key);
35261
+ // }
35262
+ // if (data.iterator_val) {
35263
+ // set_value(data.iterator_val, data._val);
35264
+ // }
35265
+ // }
35266
+ // };
35267
+ // const hover_out = function () {
35268
+ // if (is_skeleton) return;
35269
+
35270
+ // CLIENT_ACTIVITY_TS = Date.now();
35271
+ // if (_$($container)?.data()?.xuData?.debug_info) {
35272
+ // _$($container).data().xuData.debug_info.hover_item = null;
35273
+ // }
35274
+ // if (_ds?.data_system) {
35275
+ // SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system.SYS_OBJ_WIN_ELEMENT_HOVERED_ATTRIBUTES = {};
35276
+ // }
35277
+ // };
35278
+ // const render_screen_type = async function ($div) {
35279
+ // const set_call_screen_properties_values = async function (ui_framework) {
35280
+ // params.properties = {};
35281
+ // const get_values = async function (property) {
35282
+ // var property_value = paramsP?.screenInfo?.properties?.[property] || paramsP?.screenInfo?.properties?.frameworkProperties?.[property];
35283
+ // if (paramsP?.call_screen_propertiesP) {
35284
+ // if (paramsP.call_screen_propertiesP?.[property]) {
35285
+ // property_value = paramsP.call_screen_propertiesP[property];
35286
+ // }
35287
+ // if (paramsP.call_screen_propertiesP[`xu-exp:${property}`]) {
35288
+ // property_value = (await func.expression.get(SESSION_ID, paramsP.call_screen_propertiesP[`xu-exp:${property}`], paramsP.dsSessionP, property)).result;
35289
+ // }
35290
+ // }
35291
+ // return property_value;
35292
+ // };
35293
+ // params.properties['name'] = await get_values('menuTitle');
35294
+ // if (await ui_framework?.properties()) {
35295
+ // for await (const [key, val] of Object.entries(await ui_framework.properties())) {
35296
+ // params.properties[key] = await get_values(key);
35297
+ // }
35298
+ // }
35299
+ // };
35300
+
35301
+ // var $div_content = $div.children();
35302
+
35303
+ // $.each($div_content, function (key, val) {
35304
+ // if (!$(val)?.data()?.xuData?.parent_container) {
35305
+ // return true;
35306
+ // }
35307
+ // $(val).data().xuData.parent_container = $div.data().xuData.parent_container;
35308
+ // });
35309
+
35310
+ // let $ret = $div;
35311
+ // var $nav = $(SESSION_OBJ[SESSION_ID].root_element).find('xu-nav');
35312
+ // var params;
35313
+ // switch (paramsP.screen_type) {
35314
+ // case 'modal':
35315
+ // const modal_id = 'app_modal-' + paramsP.dsSessionP.toString();
35316
+ // var xu_modal_controller = document.querySelector('xu-modal-controller');
35317
+ // if (!xu_modal_controller) {
35318
+ // func.UI.component.create_app_modal_component(SESSION_ID, modal_id);
35319
+ // xu_modal_controller = document.querySelector('xu-modal-controller');
35320
+ // }
35321
+
35322
+ // var controller_params = $(xu_modal_controller).data('xuControllerParams');
35323
+
35324
+ // if (!controller_params) {
35325
+ // controller_params = {};
35326
+ // }
35327
+
35328
+ // params = {
35329
+ // screenId: paramsP.screenId,
35330
+ // $dialogDiv: $div.children(),
35331
+ // $container: $container,
35332
+ // dsSession: paramsP.dsSessionP,
35333
+ // modal_id,
35334
+ // screenInfo: paramsP.screenInfo,
35335
+ // close_callback: close_modal,
35336
+ // paramsP,
35337
+ // };
35338
+
35339
+ // controller_params[modal_id] = params;
35340
+
35341
+ // $(xu_modal_controller).data('xuControllerParams', controller_params);
35342
+ // const modalController = await new UI_FRAMEWORK_PLUGIN.modal();
35343
+ // await set_call_screen_properties_values(modalController);
35344
+ // if (!APP_MODAL_OBJ[modal_id]) {
35345
+ // const modal = await modalController.create(params);
35346
+
35347
+ // APP_MODAL_OBJ[modal_id] = modal;
35348
+ // } else {
35349
+ // $(modal_id).empty();
35350
+ // }
35351
+
35352
+ // await modalController.init(params);
35353
+
35354
+ // break;
35355
+
35356
+ // case 'popover':
35357
+ // // open_popover($div);
35358
+
35359
+ // const xu_popover_controller = func.UI.component.create_app_popover_component(SESSION_ID);
35360
+ // params = {
35361
+ // menuTitle: paramsP.screenInfo.properties?.menuTitle,
35362
+ // screenId: paramsP.screenId,
35363
+ // $dialogDiv: $div.children(),
35364
+ // $container: $container,
35365
+ // };
35366
+
35367
+ // $(xu_popover_controller).data('xuControllerParams', params);
35368
+ // const popover = new UI_FRAMEWORK_PLUGIN.popover(SESSION_ID);
35369
+ // await set_call_screen_properties_values(popover);
35370
+ // await popover.open(params);
35371
+ // CURRENT_APP_POPOVER = popover;
35372
+
35373
+ // func.UI.utils.screen_blocker(false, paramsP.prog_id + '_' + paramsP.sourceScreenP);
35374
+ // break;
35375
+
35376
+ // case 'page':
35377
+ // const nav = $nav[0];
35378
+
35379
+ // params = {
35380
+ // div: $div_content,
35381
+ // name: paramsP.screenInfo.properties?.menuTitle,
35382
+ // screenId: paramsP.screenId,
35383
+ // $container: $container,
35384
+ // dsSession: paramsP.dsSessionP,
35385
+ // SESSION_ID,
35386
+ // nav,
35387
+ // paramsP,
35388
+ // };
35389
+
35390
+ // var component_name = 'xu-page-component-' + paramsP.dsSessionP;
35391
+ // if (!$(nav).data().xuData.nav_params) {
35392
+ // $(nav).data().xuData.nav_params = {};
35393
+ // }
35394
+
35395
+ // //restore validate
35396
+ // if ($(nav)?.data()?.xuData?.params?.[paramsP.dsSessionP]) {
35397
+ // params.$container.data().xuData.validate_screen_ready = $(nav).data().xuData.params[paramsP.dsSessionP].$container.data().xuData.validate_screen_ready;
35398
+ // }
35399
+
35400
+ // if (!$(nav)?.data()?.xuData) return;
35401
+ // $(nav).data().xuData.nav_params[paramsP.dsSessionP] = params;
35402
+ // if (!$(component_name).length) {
35403
+ // await func.UI.component.create_app_page_component(SESSION_ID, paramsP.dsSessionP);
35404
+ // const page = new UI_FRAMEWORK_PLUGIN.page();
35405
+ // await set_call_screen_properties_values(page);
35406
+ // await page.create(params);
35407
+ // await page.init(params);
35408
+ // nav.push(component_name, { params });
35409
+ // } else {
35410
+ // debugger;
35411
+ // $(component_name).empty();
35412
+
35413
+ // await UI_FRAMEWORK_PLUGIN.page(SESSION_ID, paramsP.dsSessionP);
35414
+ // }
35415
+ // $div.data().xuData.paramsP = $container.data().xuData.paramsP;
35416
+ // break;
35417
+
35418
+ // case 'panel':
35419
+ // $container.append($div_content);
35420
+ // $ret = $container;
35421
+ // break;
35422
+
35423
+ // default: // set data to nav to use in the component
35424
+ // if ($nav && $nav.length) {
35425
+ // // refresh made
35426
+ // } else {
35427
+ // $nav = $('<xu-nav>'); //.attr('xu-ui-id', SESSION_ID);
35428
+ // $container.append($nav);
35429
+ // func.UI.component.init_xu_nav($container, $nav);
35430
+ // }
35431
+
35432
+ // $nav.data().xuData.$div = $div_content;
35433
+
35434
+ // await $nav[0].setRoot('xu-root-component-' + SESSION_ID);
35435
+ // $ret = $container;
35436
+ // break;
35437
+ // }
35438
+ // return $ret;
35439
+ // };
35440
+
35441
+ // if (!(await init())) return;
35442
+ // debug();
35443
+ // const fx = {
35444
+ // widget: async function () {
35445
+ // var _session = SESSION_OBJ[SESSION_ID];
35446
+
35447
+ // var exist_elm_obj = get_element_info();
35448
+ // var $div = exist_elm_obj.div;
35449
+ // if (!exist_elm_obj.div) {
35450
+ // $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, 'widget_wrapper', null, null, null, null);
35451
+
35452
+ // //////////////////////////
35453
+
35454
+ // let plugin_name = prop['xu-widget'],
35455
+ // method = prop['xu-method'],
35456
+ // dsP = paramsP.dsSessionP,
35457
+ // propsP = prop,
35458
+ // sourceP = 'widgets';
35459
+
35460
+ // // const set_SYS_GLOBAL_OBJ_WIDGET_INFO = async function (docP) {
35461
+ // // var obj = _.clone(docP);
35462
+ // // obj.date = await func.utils.get_dateTime(
35463
+ // // SESSION_ID,
35464
+ // // "SYS_DATE",
35465
+ // // docP.date
35466
+ // // );
35467
+ // // obj.time = await func.utils.get_dateTime(
35468
+ // // SESSION_ID,
35469
+ // // "SYS_TIME",
35470
+ // // docP.date
35471
+ // // );
35472
+
35473
+ // // var datasource_changes = {
35474
+ // // [0]: {
35475
+ // // ["data_system"]: {
35476
+ // // ["SYS_GLOBAL_OBJ_WIDGET_INFO"]: obj,
35477
+ // // },
35478
+ // // },
35479
+ // // };
35480
+ // // await func.datasource.update(SESSION_ID, datasource_changes);
35481
+ // // };
35482
+ // const call_plugin_api = async function (plugin_nameP, dataP) {
35483
+ // return await func.utils.call_plugin_api(SESSION_ID, plugin_nameP, dataP);
35484
+ // };
35485
+ // const report_error = function (descP, warn) {
35486
+ // func.utils.debug.log(SESSION_ID, _session.DS_GLB[dsP].prog_id + '_' + _session.DS_GLB[dsP].callingMenuId, {
35487
+ // module: 'widgets',
35488
+ // action: 'Init',
35489
+ // source: sourceP,
35490
+ // prop: descP,
35491
+ // details: descP,
35492
+ // result: null,
35493
+ // error: warn ? false : true,
35494
+ // fields: null,
35495
+ // type: 'widgets',
35496
+ // prog_id: _session.DS_GLB[dsP].prog_id,
35497
+ // });
35498
+ // };
35499
+ // const get_fields_data = async function (fields, props) {
35500
+ // const report_error = function (descP, warn) {
35501
+ // func.utils.debug.log(SESSION_ID, _session.DS_GLB[dsP].prog_id + '_' + _session.DS_GLB[dsP].callingMenuId, {
35502
+ // module: 'widgets',
35503
+ // action: 'Init',
35504
+ // source: sourceP,
35505
+ // prop: descP,
35506
+ // details: descP,
35507
+ // result: null,
35508
+ // error: warn ? false : true,
35509
+ // fields: null,
35510
+ // type: 'widgets',
35511
+ // prog_id: _session.DS_GLB[dsP].prog_id,
35512
+ // });
35513
+ // };
35514
+ // const get_property_value = async function (fieldIdP, val) {
35515
+ // if (!val) return;
35516
+ // var value = fieldIdP in props ? props[fieldIdP] : typeof val.defaultValue === 'function' ? val?.defaultValue?.() : val?.defaultValue;
35517
+ // if (val.render === 'eventId') {
35518
+ // value = props?.[fieldIdP]?.event;
35519
+ // }
35520
+
35521
+ // if (props[`xu-exp:${fieldIdP}`]) {
35522
+ // value = (await func.expression.get(SESSION_ID, props[`xu-exp:${fieldIdP}`], dsP, 'widget property')).result;
35523
+ // }
35524
+
35525
+ // return func.common.get_cast_val(
35526
+ // SESSION_ID,
35527
+ // 'widgets',
35528
+ // fieldIdP,
35529
+ // val.type, //val.type !== "string" || val.type !== "number" ? "string" : val.type,
35530
+ // value,
35531
+ // null,
35532
+ // );
35533
+ // };
35534
+ // var data_obj = {};
35535
+ // var return_code = 1;
35536
+ // // $.each(fields, function (key, val) {
35537
+ // for await (const [key, val] of Object.entries(fields)) {
35538
+ // data_obj[key] = await get_property_value(key, val);
35539
+ // if (!data_obj[key] && val.mandatory) {
35540
+ // return_code = -1;
35541
+ // report_error(`${key} is a mandatory field.`);
35542
+ // break;
35543
+ // }
35544
+ // // console.log(val);
35545
+ // }
35546
+ // for await (const key of ['xu-bind']) {
35547
+ // data_obj[key] = await get_property_value(key, props[key]);
35548
+ // }
35549
+
35550
+ // return { code: return_code, data: data_obj };
35551
+ // };
35552
+
35553
+ // const load_css_style = function () {
35554
+ // const get_css_path = function (resource) {
35555
+ // if (_session.worker_type === 'Dev') {
35556
+ // return `../../plugins/${plugin_name}/${resource}`;
35557
+ // }
35558
+ // return `https://${_session.domain}/plugins/${plugin_name}/${APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name].manifest[resource].dist ? 'dist/' : ''}${resource}?gtp_token=${_session.gtp_token}&app_id=${_session.app_id}`;
35559
+ // };
35560
+ // let path = get_css_path('style.css');
35561
+ // func.utils.load_css_on_demand(path);
35562
+ // };
35563
+
35564
+ // const _plugin = APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
35565
+ // const index = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${_plugin.manifest['index.mjs'].dist ? 'dist/' : ''}index.mjs`);
35566
+ // const methods = index.methods;
35567
+ // if (methods && !methods[method]) {
35568
+ // return report_error('method not found');
35569
+ // }
35570
+
35571
+ // const fields_ret = await get_fields_data(methods[method].fields, propsP);
35572
+ // if (fields_ret.code < 0) {
35573
+ // return report_error(fields_ret.data);
35574
+ // }
35575
+ // const fields = fields_ret.data;
35576
+
35577
+ // let exclude_attributes = [];
35578
+ // for await (const [key, val] of Object.entries(propsP)) {
35579
+ // if (typeof fields[key] !== 'undefined' || typeof fields[`xu-exp:${key}`] !== 'undefined') {
35580
+ // exclude_attributes.push(key);
35581
+ // }
35582
+ // }
35583
+
35584
+ // let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div, true, exclude_attributes);
35585
+
35586
+ // $div.addClass('widget_wrapper'); // class get override in set_attributes_new
35587
+
35588
+ // if (!APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name]) {
35589
+ // return report_error(`plugin ${plugin_name} not found`);
35590
+ // }
35591
+
35592
+ // if (APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name].manifest['style.css'].exist) {
35593
+ // load_css_style();
35594
+ // }
35595
+
35596
+ // const plugin_setup_ret = await func.utils.get_plugin_setup(SESSION_ID, plugin_name);
35597
+ // if (plugin_setup_ret.code < 0) {
35598
+ // return report_error(plugin_setup_ret);
35599
+ // }
35600
+
35601
+ // const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
35602
+ // func,
35603
+ // glb,
35604
+ // SESSION_OBJ,
35605
+ // SESSION_ID,
35606
+ // APP_OBJ,
35607
+ // dsSession: paramsP.dsSessionP,
35608
+ // job_id: jobNoP,
35609
+ // });
35610
+
35611
+ // const params = {
35612
+ // SESSION_ID,
35613
+ // method,
35614
+ // _session,
35615
+ // dsP,
35616
+ // sourceP,
35617
+ // propsP,
35618
+ // plugin_name,
35619
+ // $containerP: $div,
35620
+ // plugin_setup: plugin_setup_ret.data,
35621
+
35622
+ // report_error,
35623
+ // call_plugin_api,
35624
+ // // set_SYS_GLOBAL_OBJ_WIDGET_INFO,
35625
+ // api_utils,
35626
+ // };
35627
+
35628
+ // const fx = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${_plugin.manifest['runtime.mjs'].dist ? 'dist/' : ''}runtime.mjs`);
35629
+
35630
+ // if (_plugin?.manifest?.['runtime.mjs'].dist && _plugin?.manifest?.['runtime.mjs']?.css) {
35631
+ // const plugin_runtime_css_url = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, 'dist/runtime.css');
35632
+ // func.utils.load_css_on_demand(plugin_runtime_css_url);
35633
+ // }
35634
+
35635
+ // if (!fx[method]) {
35636
+ // throw `Method: ${method} does not exist`;
35637
+ // }
35638
+ // try {
35639
+ // await fx[method](fields, params);
35640
+ // } catch (err) {
35641
+ // func.utils.debug_report(SESSION_ID, `${plugin_name} widget`, err.message, 'E');
35642
+ // }
35643
+ // }
35644
+ // return $div;
35645
+ // },
35646
+ // [`xu-single-view`]: async function () {
35647
+ // var exist_elm_obj = get_element_info();
35648
+ // var $div = exist_elm_obj.div;
35649
+
35650
+ // if (!exist_elm_obj.div) {
35651
+ // var $wrapper = $('<div>');
35652
+ // $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, 'div', $wrapper, '');
35653
+
35654
+ // if (!$div) return;
35655
+
35656
+ // if (!REFRESHER_IN_PROGRESS && (paramsP.is_mobile_popover || paramsP.is_mobile_page)) {
35657
+ // close_all_modals();
35658
+ // }
35659
+
35660
+ // $div.hover(
35661
+ // function (e) {
35662
+ // hover_in();
35663
+ // // func.UI.screen.hover_in(SESSION_ID, null, $container, paramsP, is_skeleton);
35664
+ // },
35665
+ // function (e) {
35666
+ // // func.UI.screen.hover_out(SESSION_ID, $container, is_skeleton, paramsP);
35667
+ // hover_out();
35668
+ // },
35669
+ // );
35670
+ // }
35671
+
35672
+ // const ret = await iterate_child($div, nodeP, null, $div);
35673
+ // if (_.isEmpty($container.data().xuAttributes)) {
35674
+ // await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
35675
+ // }
35676
+
35677
+ // $.each($div.data().xuData, function (key, val) {
35678
+ // $container.data().xuData[key] = _.cloneDeep(val);
35679
+ // });
35680
+ // $.each($div.data().xuAttributes, function (key, val) {
35681
+ // // $container.data().xuAttributes[key] = _.cloneDeep(val);
35682
+ // $container.data().xuAttributes[key] = klona.klona(val);
35683
+ // });
35684
+
35685
+ // return await render_screen_type($div);
35686
+ // },
35687
+ // [`xu-multi-view`]: async function () {
35688
+ // var $div = $container;
35689
+
35690
+ // if (!$div.data().xuData.node || !$div.data().xuData.node.children) {
35691
+ // $div.data().xuData.node = nodeP;
35692
+ // }
35693
+
35694
+ // if (!$div.data().xuData.debug_info) {
35695
+ // $div.data().xuData.debug_info = {
35696
+ // id: nodeP.id,
35697
+ // parent_id: $container.data().xuData.ui_id,
35698
+ // };
35699
+ // }
35700
+
35701
+ // const done = async function (continuous_idx) {
35702
+ // // const do_callback = async function ($div) {
35703
+ // // // if ($root_container.data().xuData.progress_bar_circle) {
35704
+ // // // setTimeout(function () {
35705
+ // // // $.each(
35706
+ // // // $root_container.data().xuData.progress_bar_circle,
35707
+ // // // function (key, val) {
35708
+ // // // val.bar.set(parseFloat(val.value)); // Number from 0.0 to 1.0
35709
+ // // // }
35710
+ // // // );
35711
+ // // // }, 2000);
35712
+ // // // }
35713
+
35714
+ // // if (paramsP.screenInfo.properties?.rtl) {
35715
+ // // $div_content.attr('dir', 'rtl');
35716
+ // // }
35717
+
35718
+ // // return $div;
35719
+ // // };
35720
+ // await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
35721
+
35722
+ // return await render_screen_type($div);
35723
+ // };
35724
+
35725
+ // if (!REFRESHER_IN_PROGRESS && (paramsP.is_mobile_popover || paramsP.is_mobile_page)) {
35726
+ // close_all_modals();
35727
+ // }
35728
+
35729
+ // const empty_result = async function () {
35730
+ // // var content = prop.empty_result_content || '';
35731
+
35732
+ // // var res = await func.expression.get(
35733
+ // // SESSION_ID,
35734
+ // // content, // prop["xu-exp:empty_result_content"],
35735
+ // // paramsP.dsSessionP,
35736
+ // // 'empty_result_content_EXP',
35737
+ // // _ds.currentRecordId,
35738
+ // // );
35739
+ // // content = res.result;
35740
+
35741
+ // // let empty_result_node = {
35742
+ // // type: 'element',
35743
+ // // id: crypto.randomUUID(),
35744
+ // // content,
35745
+ // // // : content || (typeof content === "undefined" && "Empty results"),
35746
+ // // tagName: 'div',
35747
+ // // attributes: {},
35748
+ // // children: [],
35749
+ // // };
35750
+
35751
+ // // 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);
35752
+ // await func.events.validate(SESSION_ID, 'record_not_found', paramsP.dsSessionP);
35753
+ // return await done(null);
35754
+ // };
35755
+ // var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
35756
+
35757
+ // var continuous_idx = null;
35758
+
35759
+ // if (!_ds.data_feed || _.isEmpty(_ds.data_feed.rows)) {
35760
+ // return await empty_result();
35761
+ // }
35762
+
35763
+ // var i = 0;
35764
+ // for await (const [key, val] of Object.entries(_ds.data_feed.rows)) {
35765
+ // var node = JSON.parse(JSON.stringify(nodeP));
35766
+
35767
+ // _ds.currentRecordId = val._ROWID;
35768
+ // const ret = await iterate_child($div, node, { continuous_idx }, $root_container);
35769
+
35770
+ // if (_.isEmpty($container.data().xuAttributes)) {
35771
+ // await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
35772
+ // }
35773
+ // }
35774
+
35775
+ // return await done(continuous_idx);
35776
+ // },
35777
+ // [`xu-panel`]: async function () {
35778
+ // const done = async function ($new_div) {
35779
+ // if (!$container.data()?.xuData?.paramsP) {
35780
+ // return $container;
35781
+ // }
35782
+ // var $div_items = $div.data().xuData.node.children;
35783
+
35784
+ // await func.UI.screen.panel_post_render_handler(SESSION_ID, $container, $new_div, nodeP, $div, jobNoP);
35785
+
35786
+ // // TO FIX should be timeout
35787
+ // $container.data().xuData.node.children = $div_items;
35788
+
35789
+ // return $container;
35790
+ // };
35791
+
35792
+ // var $wrapper = $('<div>');
35793
+ // $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, null, $wrapper, '');
35794
+
35795
+ // let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div.clone(true), true, undefined, refreshed_ds);
35796
+ // if (ret.abort) {
35797
+ // // render N
35798
+ // return (ret.$new_div = $('<template>').append($div));
35799
+ // }
35800
+
35801
+ // let $ret_panel_div = ret.$new_div;
35802
+
35803
+ // if (!$ret_panel_div?.children()?.length) {
35804
+ // ////// render default children tree
35805
+ // if (nodeP.children.length) {
35806
+ // $ret_panel_div = await func.UI.screen.render_ui_tree(SESSION_ID, $container, nodeP.children[0], parent_infoP, paramsP, jobNoP, null, 0, null, nodeP, null, $root_container);
35807
+ // }
35808
+ // }
35809
+
35810
+ // let ret_done = await done($ret_panel_div);
35811
+
35812
+ // return ret_done;
35813
+ // },
35814
+ // };
35815
+
35816
+ // const draw_html_element_org = async function (element) {
35817
+ // const done = async function (ret = {}) {
35818
+ // return $div;
35819
+ // };
35820
+ // if (!element || element === 'script') return await done();
35821
+ // let str = '';
35822
+
35823
+ // var $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, element, null, str);
35824
+
35825
+ // $div.hover(
35826
+ // function (e) {
35827
+ // hover_in($div, e);
35828
+ // },
35829
+ // function (e) {
35830
+ // hover_out();
35831
+ // },
35832
+ // );
35833
+ // if (paramsP.paramsP === 'grid' || parent_infoP?.iterate_info) {
35834
+ // $div.on('click contextmenu', function (e) {
35835
+ // hover_in($div, e);
35836
+ // });
35837
+ // }
35838
+
35839
+ // // let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $container, nodeP, $div, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div, true);
35840
+ // let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div, true);
35841
+ // if (ret.abort || nodeP.tagName === 'svg' || !_.isEmpty(nodeP?.attributes?.['xu-text']) || !_.isEmpty(nodeP?.attributes?.['xu-html']) || !_.isEmpty(nodeP?.attributes?.['xu-exp:xu-text']) || !_.isEmpty(nodeP?.attributes?.['xu-exp:xu-html'])) {
35842
+ // return await done(ret);
35843
+ // }
35844
+ // // check if iterator made to prevent children render
35845
+
35846
+ // if (nodeP?.attributes?.['xu-viewport'] == 'true') {
35847
+ // // const xu_viewport = async function () {
35848
+ // // const data = { $div: $div.clone(true), nodeP, parent_infoP, $root_container, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, $container };
35849
+ // // const container_id = $container.attr('xu-ui-id');
35850
+ // // if (!UI_WORKER_OBJ.pending_for_viewport_render[container_id]) {
35851
+ // // UI_WORKER_OBJ.pending_for_viewport_render[container_id] = { base_$div: $div, data: [], $container };
35852
+ // // await iterate_child($div, nodeP, parent_infoP, $root_container);
35853
+ // // } else {
35854
+ // // $div.remove();
35855
+ // // }
35856
+ // // UI_WORKER_OBJ.pending_for_viewport_render[container_id].data.push(data);
35857
+
35858
+ // // // if (!$div.children().length) {
35859
+ // // // // render the first element to determine height
35860
+ // // // await iterate_child($div, nodeP, parent_infoP, $root_container);
35861
+ // // // // hover_in($div);
35862
+ // // // // func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'render_viewport', data, null, null, paramsP.dsSessionP);
35863
+ // // // } else {
35864
+ // // // }
35865
+ // // };
35866
+ // const xu_viewport = function () {
35867
+ // const observer_inViewport = new IntersectionObserver(
35868
+ // function (entries) {
35869
+ // entries.forEach((entry) => {
35870
+ // if (entry.isIntersecting) {
35871
+ // $(entry.target).trigger('inViewport');
35872
+
35873
+ // // Optional: stop observing once triggered
35874
+ // observer_inViewport.unobserve(entry.target);
35875
+ // }
35876
+ // });
35877
+ // },
35878
+ // {
35879
+ // threshold: 0.1, // Trigger when 10% of element is visible
35880
+ // },
35881
+ // );
35882
+
35883
+ // const observer_outViewport = new IntersectionObserver(
35884
+ // function (entries) {
35885
+ // entries.forEach((entry) => {
35886
+ // if (!entry.isIntersecting) {
35887
+ // // Element is OUT of viewport - trigger custom event
35888
+ // $(entry.target).trigger('outViewport');
35889
+
35890
+ // // Optional: stop observing once triggered
35891
+ // // observer_outViewport.unobserve(entry.target);
35892
+ // }
35893
+ // });
35894
+ // },
35895
+ // {
35896
+ // threshold: 0, // Trigger when element is completely out of view
35897
+ // },
35898
+ // );
35899
+
35900
+ // let ui_job_id;
35901
+ // $div.on('inViewport', function () {
35902
+ // if ($div.children().length) {
35903
+ // $div.removeClass('skeleton');
35904
+ // return;
35905
+ // }
35906
+
35907
+ // // if (UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')]) {
35908
+ // // $div[0].style.removeProperty('height');
35909
+ // // $div.removeClass('skeleton');
35910
+ // // $div.html(UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')]);
35911
+ // // } else {
35912
+ // hover_in($div);
35913
+ // ui_job_id = func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'render_viewport', { $div, nodeP, parent_infoP, $root_container, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, $container }, null, null, paramsP.dsSessionP);
35914
+ // // }
35915
+ // observer_outViewport.observe($div[0]);
35916
+ // });
35917
+
35918
+ // $div.on('outViewport', function () {
35919
+ // func.UI.worker.delete_job(SESSION_ID, ui_job_id);
35920
+
35921
+ // if ($div.children().length) {
35922
+ // // UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')] = $div.children().clone(true);
35923
+ // $div.empty();
35924
+ // const height = $div?.data()?.xuData?.viewport_height || 10;
35925
+ // if (typeof height !== 'undefined') {
35926
+ // $div.css('height', height);
35927
+ // }
35928
+ // }
35929
+ // // $div.addClass('skeleton');
35930
+ // observer_inViewport.observe($div[0]);
35931
+ // });
35932
+ // $div.addClass('skeleton');
35933
+ // observer_inViewport.observe($div[0]);
35934
+ // };
35935
+ // xu_viewport();
35936
+ // } else {
35937
+ // await iterate_child($div, nodeP, parent_infoP, $root_container);
35938
+ // }
35939
+
35940
+ // // const ret_iterate_child = await iterate_child($div, nodeP, parent_infoP, null, $root_container);
35941
+ // return await done(ret);
35942
+ // };
35943
+
35944
+ // const draw_html_element = async function (element) {
35945
+ // const done = async function (ret = {}) {
35946
+ // const xu_ui_id = $div.attr('xu-ui-id');
35947
+ // $div.removeClass('display_none');
35948
+ // if (ret.has_xu_exp_render_attribute) {
35949
+ // // $div.css('display', 'unset');
35950
+
35951
+ // const xu_render_cache_id = await get_xu_render_cache_str(SESSION_ID, paramsP.dsSessionP, Object.keys($div.data()?.xuData?.attr_exp_info?.['xu-render']?.fields || {}));
35952
+ // const _$div = $div.clone(true);
35953
+ // UI_WORKER_OBJ.xu_render_cache[xu_ui_id + xu_render_cache_id] = { $div: _$div, paramsP, data: _$div.data() };
35954
+ // nodeP.xu_render_xu_ui_id = xu_ui_id;
35955
+ // nodeP.xu_render_cache_id = xu_render_cache_id;
35956
+
35957
+ // if (ret.xu_render_background_processing) {
35958
+ // temp_$div.remove();
35959
+ // // $container.find(`[xu-ui-id="${xu_ui_id}"]`).remove();
35960
+ // return $div;
35961
+ // } else {
35962
+ // // $div.css('display', 'unset');
35963
+ // temp_$div.replaceWith($div);
35964
+ // return $div;
35965
+ // }
35966
+ // } else {
35967
+ // if (ret.has_xu_render_attribute) {
35968
+ // temp_$div.remove();
35969
+ // return $div;
35970
+ // }
35971
+ // // $div.css('display', 'unset');
35972
+ // temp_$div.replaceWith($div);
35973
+ // return $div;
35974
+ // }
35975
+ // };
35976
+ // if (!element || element === 'script') return await done();
35977
+ // let str = '';
35978
+
35979
+ // var temp_$div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, element, null, str, true);
35980
+
35981
+ // let temp_$container = $('<tmp>').data('xuData', $container.data().xuData);
35982
+ // let $div = temp_$div.clone(true);
35983
+
35984
+ // // $div.css('display', 'none');
35985
+
35986
+ // $div.hover(
35987
+ // function (e) {
35988
+ // hover_in($div, e);
35989
+ // },
35990
+ // function (e) {
35991
+ // hover_out();
35992
+ // },
35993
+ // );
35994
+ // if (paramsP.paramsP === 'grid' || parent_infoP?.iterate_info) {
35995
+ // $div.on('click contextmenu', function (e) {
35996
+ // hover_in($div, e);
35997
+ // });
35998
+ // }
35999
+
36000
+ // let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, temp_$container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div, true);
36001
+ // if (ret.abort || nodeP.tagName === 'svg' || !_.isEmpty(nodeP?.attributes?.['xu-text']) || !_.isEmpty(nodeP?.attributes?.['xu-html']) || !_.isEmpty(nodeP?.attributes?.['xu-exp:xu-text']) || !_.isEmpty(nodeP?.attributes?.['xu-exp:xu-html'])) {
36002
+ // return await done(ret);
36003
+ // }
36004
+ // // check if iterator made to prevent children render
36005
+
36006
+ // if (nodeP?.attributes?.['xu-viewport'] == 'true') {
36007
+ // // const xu_viewport = async function () {
36008
+ // // const data = { $div: $div.clone(true), nodeP, parent_infoP, $root_container, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, $container };
36009
+ // // const container_id = $container.attr('xu-ui-id');
36010
+ // // if (!UI_WORKER_OBJ.pending_for_viewport_render[container_id]) {
36011
+ // // UI_WORKER_OBJ.pending_for_viewport_render[container_id] = { base_$div: $div, data: [], $container };
36012
+ // // await iterate_child($div, nodeP, parent_infoP, $root_container);
36013
+ // // } else {
36014
+ // // $div.remove();
36015
+ // // }
36016
+ // // UI_WORKER_OBJ.pending_for_viewport_render[container_id].data.push(data);
36017
+
36018
+ // // // if (!$div.children().length) {
36019
+ // // // // render the first element to determine height
36020
+ // // // await iterate_child($div, nodeP, parent_infoP, $root_container);
36021
+ // // // // hover_in($div);
36022
+ // // // // func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'render_viewport', data, null, null, paramsP.dsSessionP);
36023
+ // // // } else {
36024
+ // // // }
36025
+ // // };
36026
+ // const xu_viewport = function () {
36027
+ // const observer_inViewport = new IntersectionObserver(
36028
+ // function (entries) {
36029
+ // entries.forEach((entry) => {
36030
+ // if (entry.isIntersecting) {
36031
+ // $(entry.target).trigger('inViewport');
36032
+
36033
+ // // Optional: stop observing once triggered
36034
+ // observer_inViewport.unobserve(entry.target);
36035
+ // }
36036
+ // });
36037
+ // },
36038
+ // {
36039
+ // threshold: 0.1, // Trigger when 10% of element is visible
36040
+ // },
36041
+ // );
36042
+
36043
+ // const observer_outViewport = new IntersectionObserver(
36044
+ // function (entries) {
36045
+ // entries.forEach((entry) => {
36046
+ // if (!entry.isIntersecting) {
36047
+ // // Element is OUT of viewport - trigger custom event
36048
+ // $(entry.target).trigger('outViewport');
36049
+
36050
+ // // Optional: stop observing once triggered
36051
+ // // observer_outViewport.unobserve(entry.target);
36052
+ // }
36053
+ // });
36054
+ // },
36055
+ // {
36056
+ // threshold: 0, // Trigger when element is completely out of view
36057
+ // },
36058
+ // );
36059
+
36060
+ // let ui_job_id;
36061
+ // $div.on('inViewport', function () {
36062
+ // if ($div.children().length) {
36063
+ // $div.removeClass('skeleton');
36064
+ // return;
36065
+ // }
36066
+
36067
+ // // if (UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')]) {
36068
+ // // $div[0].style.removeProperty('height');
36069
+ // // $div.removeClass('skeleton');
36070
+ // // $div.html(UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')]);
36071
+ // // } else {
36072
+ // hover_in($div);
36073
+ // ui_job_id = func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'render_viewport', { $div, nodeP, parent_infoP, $root_container, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, temp_$container }, null, null, paramsP.dsSessionP);
36074
+ // // }
36075
+ // observer_outViewport.observe($div[0]);
36076
+ // });
36077
+
36078
+ // $div.on('outViewport', function () {
36079
+ // func.UI.worker.delete_job(SESSION_ID, ui_job_id);
36080
+
36081
+ // if ($div.children().length) {
36082
+ // // UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')] = $div.children().clone(true);
36083
+ // $div.empty();
36084
+ // const height = $div?.data()?.xuData?.viewport_height || 10;
36085
+ // if (typeof height !== 'undefined') {
36086
+ // $div.css('height', height);
36087
+ // }
36088
+ // }
36089
+ // // $div.addClass('skeleton');
36090
+ // observer_inViewport.observe($div[0]);
36091
+ // });
36092
+ // $div.addClass('skeleton');
36093
+ // observer_inViewport.observe($div[0]);
36094
+ // };
36095
+ // xu_viewport();
36096
+ // } else {
36097
+ // // if (ret.xu_render_background_processing) {
36098
+ // // // let temp_$div = $div.clone(true);
36099
+ // // iterate_child($div, nodeP, parent_infoP, $root_container);
36100
+ // // } else {
36101
+ // // await iterate_child($div, nodeP, parent_infoP, $root_container);
36102
+ // // }
36103
+ // if (!ret.xu_render_background_processing) {
36104
+ // iterate_child($div, nodeP, parent_infoP, $root_container);
36105
+ // }
36106
+ // }
36107
+
36108
+ // // const ret_iterate_child = await iterate_child($div, nodeP, parent_infoP, null, $root_container);
36109
+ // return await done(ret);
36110
+ // };
36111
+
36112
+ // if (nodeP.content && nodeP.attributes) {
36113
+ // nodeP.attributes['xu-content'] = nodeP.content;
36114
+ // }
36115
+
36116
+ // if (nodeP.tagName === 'xu-widget') {
36117
+ // if (is_skeleton) return;
36118
+ // return await fx['widget']();
36119
+ // }
36120
+ // if (fx[nodeP.tagName]) {
36121
+ // return await fx[nodeP.tagName]();
36122
+ // }
36123
+ // // const xu_viewport = async function () {
36124
+ // // const data = { $div, nodeP, parent_infoP, $root_container, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, $container };
36125
+ // // const container_id = $container.attr('xu-ui-id');
36126
+ // // if (!UI_WORKER_OBJ.pending_for_viewport_render[container_id]) {
36127
+ // // UI_WORKER_OBJ.pending_for_viewport_render[container_id] = { base_$div: $div, data: [], $container };
36128
+ // // await iterate_child($div, nodeP, parent_infoP, $root_container);
36129
+ // // }
36130
+ // // UI_WORKER_OBJ.pending_for_viewport_render[container_id].data.push(data);
36131
+ // // };
36132
+
36133
+ // // if (nodeP?.attributes?.['xu-viewport'] == 'true') {
36134
+ // // return await xu_viewport();
36135
+ // // } else {
36136
+ // if (!glb.new_xu_render) {
36137
+ // return await draw_html_element_org(nodeP.tagName);
36138
+ // }
36139
+ // return await draw_html_element(nodeP.tagName);
36140
+
36141
+ // // }
36142
+ // };
36143
+
34980
36144
  func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, parent_infoP, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, $root_container) {
36145
+ // Early cache session and datasource
36146
+ let _session, _ds;
34981
36147
  if (!is_skeleton) {
34982
- var _session = SESSION_OBJ[SESSION_ID];
34983
- var _ds = _session.DS_GLB[paramsP.dsSessionP];
34984
- }
34985
- var prop;
34986
- try {
34987
- prop = nodeP.attributes;
34988
- } catch (error) {
34989
- // debugger;
36148
+ _session = SESSION_OBJ[SESSION_ID];
36149
+ _ds = _session.DS_GLB[paramsP.dsSessionP];
34990
36150
  }
34991
36151
 
34992
- ///////////
34993
- var is_mobile = glb.MOBILE_ARR.includes(paramsP.screenInfo.properties?.menuType) ? true : false;
36152
+ const prop = nodeP.attributes;
36153
+ const is_mobile = glb.MOBILE_ARR.includes(paramsP.screenInfo.properties?.menuType);
36154
+ const nodeTag = nodeP.tagName;
34994
36155
 
36156
+ // Optimized element finder with caching
34995
36157
  const get_element_info = function () {
34996
- var ret = {};
34997
- let currentRecordId = _ds?.currentRecordId || '';
36158
+ if (!_ds) return {};
34998
36159
 
34999
- let $div = func.UI.utils.find_in_element_data('xuData', $container.parent(), 'nodeid', nodeP.id);
36160
+ const currentRecordId = _ds.currentRecordId || '';
36161
+ const $div = func.UI.utils.find_in_element_data('xuData', $container.parent(), 'nodeid', nodeP.id);
35000
36162
 
35001
- $.each($div, function (key, val) {
35002
- if ($(val)?.data().xuData?.recordid === currentRecordId && $(val)?.data().xuData?.key === keyP && $(val)?.prop('tagName') !== 'XURENDER') {
35003
- ret = {
35004
- div: $div,
35005
- };
36163
+ for (let i = 0; i < $div.length; i++) {
36164
+ const $el = $($div[i]);
36165
+ const xuData = $el.data().xuData;
36166
+ if (xuData?.recordid === currentRecordId && xuData?.key === keyP && $el.prop('tagName') !== 'XURENDER') {
36167
+ return { div: $div };
35006
36168
  }
35007
- });
35008
-
35009
- return ret;
36169
+ }
36170
+ return {};
35010
36171
  };
35011
36172
 
35012
36173
  const init = async function () {
35013
- var ret = true;
35014
- if (!nodeP) ret = false;
35015
- return ret;
36174
+ return !!nodeP;
35016
36175
  };
36176
+
35017
36177
  const debug = function (is_errorP, error_descP) {
35018
- func.utils.debug.log(SESSION_ID, paramsP.prog_id + '_' + nodeP.id_org + '_ui_prop', {
36178
+ func.utils.debug.log(SESSION_ID, `${paramsP.prog_id}_${nodeP.id_org}_ui_prop`, {
35019
36179
  module: 'gui',
35020
36180
  action: 'init',
35021
36181
  prop: nodeP.id,
@@ -35030,21 +36190,36 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
35030
36190
  });
35031
36191
  };
35032
36192
 
36193
+ const close_modal = async function (modal_id) {
36194
+ delete APP_MODAL_OBJ[modal_id];
36195
+ const xu_modal_controller = document.querySelector('xu-modal-controller');
36196
+ const params = $(xu_modal_controller).data().xuControllerParams?.[modal_id];
36197
+ if (params?.container) {
36198
+ await func.UI.screen.validate_exit_events(SESSION_ID, params.$container.data().xuData.paramsP, null);
36199
+ func.datasource.clean_all(SESSION_ID, params.dsSession);
36200
+ }
36201
+ };
36202
+
36203
+ const close_all_modals = function () {
36204
+ Object.entries(APP_MODAL_OBJ).forEach(([key, val]) => {
36205
+ if (val) {
36206
+ UI_FRAMEWORK_PLUGIN.modal.close(key);
36207
+ }
36208
+ });
36209
+ };
36210
+
35033
36211
  const open_modal = async function ($div) {
35034
- const modal_id = 'app_modal-' + paramsP.dsSessionP.toString();
35035
- var xu_modal_controller = document.querySelector('xu-modal-controller');
36212
+ const modal_id = `app_modal-${paramsP.dsSessionP}`;
36213
+ let xu_modal_controller = document.querySelector('xu-modal-controller');
36214
+
35036
36215
  if (!xu_modal_controller) {
35037
36216
  func.UI.component.create_app_modal_component(SESSION_ID, modal_id);
35038
36217
  xu_modal_controller = document.querySelector('xu-modal-controller');
35039
36218
  }
35040
36219
 
35041
- var controller_params = $(xu_modal_controller).data('xuControllerParams');
36220
+ let controller_params = $(xu_modal_controller).data('xuControllerParams') || {};
35042
36221
 
35043
- if (!controller_params) {
35044
- controller_params = {};
35045
- }
35046
-
35047
- var params = {
36222
+ controller_params[modal_id] = {
35048
36223
  menuTitle: paramsP.screenInfo.properties?.menuTitle,
35049
36224
  screenId: paramsP.screenId,
35050
36225
  $dialogDiv: $div.children(),
@@ -35052,41 +36227,19 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
35052
36227
  dsSession: paramsP.dsSessionP,
35053
36228
  };
35054
36229
 
35055
- controller_params[modal_id] = params;
35056
-
35057
36230
  $(xu_modal_controller).data('xuControllerParams', controller_params);
35058
- const modalController = await new UI_FRAMEWORK_PLUGIN.modal();
36231
+ const modalController = new UI_FRAMEWORK_PLUGIN.modal();
35059
36232
 
35060
36233
  if (!APP_MODAL_OBJ[modal_id]) {
35061
- const modal = await modalController.create(SESSION_ID, modal_id, paramsP.screenInfo, close_modal);
35062
- APP_MODAL_OBJ[modal_id] = modal;
36234
+ APP_MODAL_OBJ[modal_id] = await modalController.create(SESSION_ID, modal_id, paramsP.screenInfo, close_modal);
35063
36235
  } else {
35064
36236
  $(modal_id).empty();
35065
36237
  }
35066
- await modalController.init(SESSION_ID, modal_id);
35067
36238
 
36239
+ await modalController.init(SESSION_ID, modal_id);
35068
36240
  return $div;
35069
36241
  };
35070
36242
 
35071
- const close_modal = async function (modal_id) {
35072
- delete APP_MODAL_OBJ[modal_id];
35073
- const xu_modal_controller = document.querySelector('xu-modal-controller');
35074
- var params = $(xu_modal_controller).data().xuControllerParams[modal_id];
35075
- if (params && params.$container) {
35076
- await func.UI.screen.validate_exit_events(SESSION_ID, params.$container.data().xuData.paramsP, null);
35077
- func.datasource.clean_all(SESSION_ID, params.dsSession);
35078
- }
35079
- };
35080
-
35081
- const close_all_modals = function () {
35082
- $.each(APP_MODAL_OBJ, function (key, val) {
35083
- if (val) {
35084
- // close_modal(key);
35085
- UI_FRAMEWORK_PLUGIN.modal.close(key);
35086
- }
35087
- });
35088
- };
35089
-
35090
36243
  const open_popover = async function ($div) {
35091
36244
  const xu_popover_controller = func.UI.component.create_app_popover_component(SESSION_ID);
35092
36245
 
@@ -35096,234 +36249,179 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
35096
36249
  $dialogDiv: $div.children(),
35097
36250
  $container: $container,
35098
36251
  });
35099
- const popover = new UI_FRAMEWORK_PLUGIN.popover(
35100
- SESSION_ID,
35101
- // ELEMENT_CLICK_EVENT,
35102
- // props
35103
- );
36252
+
36253
+ const popover = new UI_FRAMEWORK_PLUGIN.popover(SESSION_ID);
35104
36254
  await popover.open(SESSION_ID);
35105
36255
  CURRENT_APP_POPOVER = popover;
35106
-
35107
- return;
35108
- popoverController
35109
- .create({
35110
- component: 'xu-popover-content-' + SESSION_ID,
35111
- event: ELEMENT_CLICK_EVENT,
35112
- translucent: true,
35113
- })
35114
- .then((modal) => {
35115
- modal.present().then(() => {
35116
- CURRENT_APP_POPOVER = modal;
35117
-
35118
- if (callbackP) callbackP($div);
35119
- });
35120
- });
35121
36256
  };
36257
+
36258
+ // OPTIMIZED: Parallel child iteration with improved logic
35122
36259
  const iterate_child = async function ($divP, nodeP, parent_infoP, $root_container, before_record_function) {
35123
- if (!is_mobile && nodeP.busy) return;
36260
+ if (!is_mobile && nodeP.busy) return $divP;
36261
+
35124
36262
  nodeP.busy = true;
35125
- const done = async function ($divP) {
35126
- setTimeout(function () {
36263
+
36264
+ const done = function ($divP) {
36265
+ setTimeout(() => {
35127
36266
  nodeP.busy = false;
35128
36267
  }, 1000);
35129
-
35130
36268
  return $divP;
35131
36269
  };
35132
- if (!nodeP || !nodeP.children) {
35133
- return await done($divP);
35134
- }
35135
36270
 
35136
- if (before_record_function) {
35137
- await before_record_function();
36271
+ if (!nodeP?.children?.length) {
36272
+ return done($divP);
35138
36273
  }
35139
- if (nodeP?.children?.length) {
35140
- let node_promises = [];
35141
- for (const [key, val] of Object.entries(nodeP.children)) {
35142
- node_promises.push(
35143
- new Promise(async (resolve, reject) => {
35144
- const ret = await func.UI.screen.render_ui_tree(SESSION_ID, $divP, nodeP.children[key], parent_infoP, paramsP, jobNoP, is_skeleton, Number(key), null, nodeP, null, $root_container);
35145
-
35146
- resolve();
35147
- }),
35148
- );
35149
- }
35150
- await Promise.all(node_promises);
36274
+
36275
+ if (before_record_function) {
36276
+ await before_record_function();
35151
36277
  }
35152
- return await done($divP);
35153
- };
35154
36278
 
35155
- // const iterate_child = async function ($divP, nodeP, parent_infoP, $root_container, before_record_function) {
35156
- // if (!is_mobile && nodeP.busy) return;
35157
- // nodeP.busy = true;
35158
- // const done = async function ($divP) {
35159
- // setTimeout(function () {
35160
- // nodeP.busy = false;
35161
- // }, 1000);
35162
-
35163
- // return $divP;
35164
- // };
35165
- // if (!nodeP || !nodeP.children) {
35166
- // return await done($divP);
35167
- // }
36279
+ // Parallel rendering for better performance
36280
+ await Promise.all(nodeP.children.map((child, key) => func.UI.screen.render_ui_tree(SESSION_ID, $divP, child, parent_infoP, paramsP, jobNoP, is_skeleton, key, null, nodeP, null, $root_container)));
35168
36281
 
35169
- // if (before_record_function) {
35170
- // await before_record_function();
35171
- // }
35172
- // if (nodeP?.children?.length) {
35173
- // for await (const [key, val] of Object.entries(nodeP.children)) {
35174
- // const ret = await func.UI.screen.render_ui_tree(SESSION_ID, $divP, nodeP.children[key], parent_infoP, paramsP, jobNoP, is_skeleton, Number(key), null, nodeP, null, $root_container);
35175
- // }
35176
- // }
35177
- // return await done($divP);
35178
- // };
36282
+ return done($divP);
36283
+ };
35179
36284
 
35180
36285
  const _$ = function ($elm) {
35181
36286
  try {
35182
36287
  const id = $elm.attr('xu-ui-id');
35183
36288
  if (!id || !glb.DEBUG_MODE) return $elm;
35184
- const $el = $(`[xu-ui-id="${id}"]`);
35185
36289
 
36290
+ const $el = $(`[xu-ui-id="${id}"]`);
35186
36291
  if ($el.length > 1) {
35187
- console.warn('Multiple elements for xu-ui-id: ' + id, $el);
36292
+ console.warn(`Multiple elements for xu-ui-id: ${id}`, $el);
35188
36293
  }
35189
-
35190
36294
  return $($el[0]);
35191
36295
  } catch (e) {
35192
36296
  console.error(e);
36297
+ return $elm;
35193
36298
  }
35194
36299
  };
35195
36300
 
35196
36301
  const hover_in = function ($div, e) {
35197
36302
  if (is_skeleton || (e && (EXP_BUSY || UI_WORKER_OBJ.jobs.length))) return;
36303
+
35198
36304
  CLIENT_ACTIVITY_TS = Date.now();
35199
- if (_$($container)?.data()?.xuData?.debug_info) _$($container).data().xuData.debug_info.hover_item = $div.attr('xu-ui-id');
36305
+
36306
+ const containerXuData = _$($container)?.data()?.xuData;
36307
+ if (containerXuData?.debug_info) {
36308
+ containerXuData.debug_info.hover_item = $div.attr('xu-ui-id');
36309
+ }
36310
+
35200
36311
  if (!_ds) return;
35201
- ///////// SET Attributes///////////
35202
- let attributes = {};
35203
- $.each($div[0].attributes, function (index, attr) {
36312
+
36313
+ // Set attributes
36314
+ const attributes = {};
36315
+ Array.from($div[0].attributes).forEach((attr) => {
35204
36316
  attributes[attr.name] = attr.value;
35205
36317
  });
35206
-
35207
36318
  _session.DS_GLB[0].data_system.SYS_OBJ_WIN_ELEMENT_HOVERED_ATTRIBUTES = attributes;
35208
- //////////////////////////////////
35209
- if (!$div.data()?.xuData) return;
35210
- const _iterate_info = $div.data().xuData.iterate_info;
36319
+
36320
+ const divXuData = $div.data()?.xuData;
36321
+ if (!divXuData) return;
36322
+
36323
+ const _iterate_info = divXuData.iterate_info;
35211
36324
  if (_iterate_info) {
35212
- if (_iterate_info.is_key_dynamic_field) {
35213
- _ds.dynamic_fields[_iterate_info.iterator_key].value = _iterate_info._key;
35214
- } else {
35215
- try {
35216
- const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
35217
- _ds.data_feed.rows[row_idx][_iterate_info.iterator_key] = _iterate_info._key;
35218
- } catch (err) {
35219
- console.error(err);
36325
+ const set_field_value = (field_id, value, is_dynamic) => {
36326
+ if (is_dynamic) {
36327
+ _ds.dynamic_fields[field_id].value = value;
36328
+ } else {
36329
+ try {
36330
+ const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
36331
+ _ds.data_feed.rows[row_idx][field_id] = value;
36332
+ } catch (err) {
36333
+ console.error(err);
36334
+ }
35220
36335
  }
35221
- }
36336
+ };
35222
36337
 
35223
- if (_iterate_info.is_val_dynamic_field) {
35224
- _ds.dynamic_fields[_iterate_info.iterator_val].value = _iterate_info._val;
35225
- } else {
35226
- try {
35227
- const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
35228
- _ds.data_feed.rows[row_idx][_iterate_info.iterator_val] = _iterate_info._val;
35229
- } catch (err) {
35230
- console.error(err);
35231
- }
35232
- }
36338
+ set_field_value(_iterate_info.iterator_key, _iterate_info._key, _iterate_info.is_key_dynamic_field);
36339
+ set_field_value(_iterate_info.iterator_val, _iterate_info._val, _iterate_info.is_val_dynamic_field);
35233
36340
  }
35234
36341
 
35235
36342
  if ($div && _$($div) && _ds && paramsP.renderType === 'grid') {
35236
36343
  func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'update_datasource', { currentRecordId: _$($div).data().xuData.currentRecordId }, null, null, paramsP.dsSessionP);
35237
36344
  }
35238
36345
 
35239
- const set_value = function (field_id, value) {
35240
- var currentRecordId = _$($div).data().xuData.currentRecordId;
35241
-
35242
- func.UI.worker.add_to_queue(
35243
- SESSION_ID,
35244
- 'gui event',
35245
- 'update_datasource',
35246
- {
35247
- currentRecordId,
35248
- field_id,
35249
- field_value: value,
35250
- },
35251
- null,
35252
- null,
35253
- paramsP.dsSessionP,
35254
- );
35255
- };
36346
+ const iterate_data = $div?.data()?.xuData?.iterate_info;
36347
+ if (iterate_data) {
36348
+ const set_value = (field_id, value) => {
36349
+ func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'update_datasource', { currentRecordId: _$($div).data().xuData.currentRecordId, field_id, field_value: value }, null, null, paramsP.dsSessionP);
36350
+ };
35256
36351
 
35257
- if ($div?.data()?.iterate_info) {
35258
- var data = $div.data().xuData.iterate_info;
35259
- if (data.iterator_key) {
35260
- set_value(data.iterator_key, data._key);
35261
- }
35262
- if (data.iterator_val) {
35263
- set_value(data.iterator_val, data._val);
35264
- }
36352
+ if (iterate_data.iterator_key) set_value(iterate_data.iterator_key, iterate_data._key);
36353
+ if (iterate_data.iterator_val) set_value(iterate_data.iterator_val, iterate_data._val);
35265
36354
  }
35266
36355
  };
36356
+
35267
36357
  const hover_out = function () {
35268
36358
  if (is_skeleton) return;
35269
36359
 
35270
36360
  CLIENT_ACTIVITY_TS = Date.now();
35271
- if (_$($container)?.data()?.xuData?.debug_info) {
35272
- _$($container).data().xuData.debug_info.hover_item = null;
36361
+
36362
+ const containerXuData = _$($container)?.data()?.xuData;
36363
+ if (containerXuData?.debug_info) {
36364
+ containerXuData.debug_info.hover_item = null;
35273
36365
  }
36366
+
35274
36367
  if (_ds?.data_system) {
35275
36368
  SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system.SYS_OBJ_WIN_ELEMENT_HOVERED_ATTRIBUTES = {};
35276
36369
  }
35277
36370
  };
36371
+
35278
36372
  const render_screen_type = async function ($div) {
35279
36373
  const set_call_screen_properties_values = async function (ui_framework) {
35280
36374
  params.properties = {};
36375
+
35281
36376
  const get_values = async function (property) {
35282
- var property_value = paramsP?.screenInfo?.properties?.[property] || paramsP?.screenInfo?.properties?.frameworkProperties?.[property];
36377
+ let property_value = paramsP?.screenInfo?.properties?.[property] || paramsP?.screenInfo?.properties?.frameworkProperties?.[property];
36378
+
35283
36379
  if (paramsP?.call_screen_propertiesP) {
35284
- if (paramsP.call_screen_propertiesP?.[property]) {
36380
+ if (paramsP.call_screen_propertiesP[property]) {
35285
36381
  property_value = paramsP.call_screen_propertiesP[property];
35286
36382
  }
35287
- if (paramsP.call_screen_propertiesP[`xu-exp:${property}`]) {
35288
- property_value = (await func.expression.get(SESSION_ID, paramsP.call_screen_propertiesP[`xu-exp:${property}`], paramsP.dsSessionP, property)).result;
36383
+ const expKey = `xu-exp:${property}`;
36384
+ if (paramsP.call_screen_propertiesP[expKey]) {
36385
+ property_value = (await func.expression.get(SESSION_ID, paramsP.call_screen_propertiesP[expKey], paramsP.dsSessionP, property)).result;
35289
36386
  }
35290
36387
  }
35291
36388
  return property_value;
35292
36389
  };
36390
+
35293
36391
  params.properties['name'] = await get_values('menuTitle');
35294
- if (await ui_framework?.properties()) {
35295
- for await (const [key, val] of Object.entries(await ui_framework.properties())) {
36392
+ const uiProps = await ui_framework?.properties?.();
36393
+ if (uiProps) {
36394
+ for (const [key, val] of Object.entries(uiProps)) {
35296
36395
  params.properties[key] = await get_values(key);
35297
36396
  }
35298
36397
  }
35299
36398
  };
35300
36399
 
35301
- var $div_content = $div.children();
36400
+ const $div_content = $div.children();
35302
36401
 
35303
- $.each($div_content, function (key, val) {
35304
- if (!$(val)?.data()?.xuData?.parent_container) {
35305
- return true;
36402
+ // Update parent container for children
36403
+ $div_content.each((key, val) => {
36404
+ const xuData = $(val)?.data()?.xuData;
36405
+ if (xuData && !xuData.parent_container) {
36406
+ xuData.parent_container = $div.data().xuData.parent_container;
35306
36407
  }
35307
- $(val).data().xuData.parent_container = $div.data().xuData.parent_container;
35308
36408
  });
35309
36409
 
35310
36410
  let $ret = $div;
35311
- var $nav = $(SESSION_OBJ[SESSION_ID].root_element).find('xu-nav');
35312
- var params;
36411
+ const $nav = $(SESSION_OBJ[SESSION_ID].root_element).find('xu-nav');
36412
+ let params;
36413
+
35313
36414
  switch (paramsP.screen_type) {
35314
36415
  case 'modal':
35315
- const modal_id = 'app_modal-' + paramsP.dsSessionP.toString();
35316
- var xu_modal_controller = document.querySelector('xu-modal-controller');
36416
+ const modal_id = `app_modal-${paramsP.dsSessionP}`;
36417
+ let xu_modal_controller = document.querySelector('xu-modal-controller');
36418
+
35317
36419
  if (!xu_modal_controller) {
35318
36420
  func.UI.component.create_app_modal_component(SESSION_ID, modal_id);
35319
36421
  xu_modal_controller = document.querySelector('xu-modal-controller');
35320
36422
  }
35321
36423
 
35322
- var controller_params = $(xu_modal_controller).data('xuControllerParams');
35323
-
35324
- if (!controller_params) {
35325
- controller_params = {};
35326
- }
36424
+ let controller_params = $(xu_modal_controller).data('xuControllerParams') || {};
35327
36425
 
35328
36426
  params = {
35329
36427
  screenId: paramsP.screenId,
@@ -35337,25 +36435,20 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
35337
36435
  };
35338
36436
 
35339
36437
  controller_params[modal_id] = params;
35340
-
35341
36438
  $(xu_modal_controller).data('xuControllerParams', controller_params);
35342
- const modalController = await new UI_FRAMEWORK_PLUGIN.modal();
36439
+
36440
+ const modalController = new UI_FRAMEWORK_PLUGIN.modal();
35343
36441
  await set_call_screen_properties_values(modalController);
35344
- if (!APP_MODAL_OBJ[modal_id]) {
35345
- const modal = await modalController.create(params);
35346
36442
 
35347
- APP_MODAL_OBJ[modal_id] = modal;
36443
+ if (!APP_MODAL_OBJ[modal_id]) {
36444
+ APP_MODAL_OBJ[modal_id] = await modalController.create(params);
35348
36445
  } else {
35349
36446
  $(modal_id).empty();
35350
36447
  }
35351
-
35352
36448
  await modalController.init(params);
35353
-
35354
36449
  break;
35355
36450
 
35356
36451
  case 'popover':
35357
- // open_popover($div);
35358
-
35359
36452
  const xu_popover_controller = func.UI.component.create_app_popover_component(SESSION_ID);
35360
36453
  params = {
35361
36454
  menuTitle: paramsP.screenInfo.properties?.menuTitle,
@@ -35369,13 +36462,11 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
35369
36462
  await set_call_screen_properties_values(popover);
35370
36463
  await popover.open(params);
35371
36464
  CURRENT_APP_POPOVER = popover;
35372
-
35373
- func.UI.utils.screen_blocker(false, paramsP.prog_id + '_' + paramsP.sourceScreenP);
36465
+ func.UI.utils.screen_blocker(false, `${paramsP.prog_id}_${paramsP.sourceScreenP}`);
35374
36466
  break;
35375
36467
 
35376
36468
  case 'page':
35377
36469
  const nav = $nav[0];
35378
-
35379
36470
  params = {
35380
36471
  div: $div_content,
35381
36472
  name: paramsP.screenInfo.properties?.menuTitle,
@@ -35387,18 +36478,21 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
35387
36478
  paramsP,
35388
36479
  };
35389
36480
 
35390
- var component_name = 'xu-page-component-' + paramsP.dsSessionP;
35391
- if (!$(nav).data().xuData.nav_params) {
35392
- $(nav).data().xuData.nav_params = {};
36481
+ const component_name = `xu-page-component-${paramsP.dsSessionP}`;
36482
+ const navXuData = $(nav).data().xuData;
36483
+
36484
+ if (!navXuData.nav_params) {
36485
+ navXuData.nav_params = {};
35393
36486
  }
35394
36487
 
35395
- //restore validate
35396
- if ($(nav)?.data()?.xuData?.params?.[paramsP.dsSessionP]) {
35397
- params.$container.data().xuData.validate_screen_ready = $(nav).data().xuData.params[paramsP.dsSessionP].$container.data().xuData.validate_screen_ready;
36488
+ // Restore validate
36489
+ if (navXuData.params?.[paramsP.dsSessionP]) {
36490
+ params.$container.data().xuData.validate_screen_ready = navXuData.params[paramsP.dsSessionP].$container.data().xuData.validate_screen_ready;
35398
36491
  }
35399
36492
 
35400
- if (!$(nav)?.data()?.xuData) return;
35401
- $(nav).data().xuData.nav_params[paramsP.dsSessionP] = params;
36493
+ if (!navXuData) return;
36494
+ navXuData.nav_params[paramsP.dsSessionP] = params;
36495
+
35402
36496
  if (!$(component_name).length) {
35403
36497
  await func.UI.component.create_app_page_component(SESSION_ID, paramsP.dsSessionP);
35404
36498
  const page = new UI_FRAMEWORK_PLUGIN.page();
@@ -35407,9 +36501,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
35407
36501
  await page.init(params);
35408
36502
  nav.push(component_name, { params });
35409
36503
  } else {
35410
- debugger;
35411
36504
  $(component_name).empty();
35412
-
35413
36505
  await UI_FRAMEWORK_PLUGIN.page(SESSION_ID, paramsP.dsSessionP);
35414
36506
  }
35415
36507
  $div.data().xuData.paramsP = $container.data().xuData.paramsP;
@@ -35420,18 +36512,15 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
35420
36512
  $ret = $container;
35421
36513
  break;
35422
36514
 
35423
- default: // set data to nav to use in the component
35424
- if ($nav && $nav.length) {
35425
- // refresh made
35426
- } else {
35427
- $nav = $('<xu-nav>'); //.attr('xu-ui-id', SESSION_ID);
36515
+ default:
36516
+ if (!$nav?.length) {
36517
+ $nav = $('<xu-nav>');
35428
36518
  $container.append($nav);
35429
36519
  func.UI.component.init_xu_nav($container, $nav);
35430
36520
  }
35431
36521
 
35432
36522
  $nav.data().xuData.$div = $div_content;
35433
-
35434
- await $nav[0].setRoot('xu-root-component-' + SESSION_ID);
36523
+ await $nav[0].setRoot(`xu-root-component-${SESSION_ID}`);
35435
36524
  $ret = $container;
35436
36525
  break;
35437
36526
  }
@@ -35440,130 +36529,92 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
35440
36529
 
35441
36530
  if (!(await init())) return;
35442
36531
  debug();
36532
+
35443
36533
  const fx = {
35444
36534
  widget: async function () {
35445
- var _session = SESSION_OBJ[SESSION_ID];
36535
+ const exist_elm_obj = get_element_info();
36536
+ let $div = exist_elm_obj.div;
35446
36537
 
35447
- var exist_elm_obj = get_element_info();
35448
- var $div = exist_elm_obj.div;
35449
36538
  if (!exist_elm_obj.div) {
35450
36539
  $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, 'widget_wrapper', null, null, null, null);
35451
36540
 
35452
- //////////////////////////
35453
-
35454
- let plugin_name = prop['xu-widget'],
35455
- method = prop['xu-method'],
35456
- dsP = paramsP.dsSessionP,
35457
- propsP = prop,
35458
- sourceP = 'widgets';
35459
-
35460
- // const set_SYS_GLOBAL_OBJ_WIDGET_INFO = async function (docP) {
35461
- // var obj = _.clone(docP);
35462
- // obj.date = await func.utils.get_dateTime(
35463
- // SESSION_ID,
35464
- // "SYS_DATE",
35465
- // docP.date
35466
- // );
35467
- // obj.time = await func.utils.get_dateTime(
35468
- // SESSION_ID,
35469
- // "SYS_TIME",
35470
- // docP.date
35471
- // );
35472
-
35473
- // var datasource_changes = {
35474
- // [0]: {
35475
- // ["data_system"]: {
35476
- // ["SYS_GLOBAL_OBJ_WIDGET_INFO"]: obj,
35477
- // },
35478
- // },
35479
- // };
35480
- // await func.datasource.update(SESSION_ID, datasource_changes);
35481
- // };
35482
- const call_plugin_api = async function (plugin_nameP, dataP) {
36541
+ const plugin_name = prop['xu-widget'];
36542
+ const method = prop['xu-method'];
36543
+ const dsP = paramsP.dsSessionP;
36544
+ const propsP = prop;
36545
+ const sourceP = 'widgets';
36546
+
36547
+ const call_plugin_api = async (plugin_nameP, dataP) => {
35483
36548
  return await func.utils.call_plugin_api(SESSION_ID, plugin_nameP, dataP);
35484
36549
  };
35485
- const report_error = function (descP, warn) {
35486
- func.utils.debug.log(SESSION_ID, _session.DS_GLB[dsP].prog_id + '_' + _session.DS_GLB[dsP].callingMenuId, {
36550
+
36551
+ const report_error = (descP, warn) => {
36552
+ func.utils.debug.log(SESSION_ID, `${_session.DS_GLB[dsP].prog_id}_${_session.DS_GLB[dsP].callingMenuId}`, {
35487
36553
  module: 'widgets',
35488
36554
  action: 'Init',
35489
36555
  source: sourceP,
35490
36556
  prop: descP,
35491
36557
  details: descP,
35492
36558
  result: null,
35493
- error: warn ? false : true,
36559
+ error: !warn,
35494
36560
  fields: null,
35495
36561
  type: 'widgets',
35496
36562
  prog_id: _session.DS_GLB[dsP].prog_id,
35497
36563
  });
35498
36564
  };
35499
- const get_fields_data = async function (fields, props) {
35500
- const report_error = function (descP, warn) {
35501
- func.utils.debug.log(SESSION_ID, _session.DS_GLB[dsP].prog_id + '_' + _session.DS_GLB[dsP].callingMenuId, {
35502
- module: 'widgets',
35503
- action: 'Init',
35504
- source: sourceP,
35505
- prop: descP,
35506
- details: descP,
35507
- result: null,
35508
- error: warn ? false : true,
35509
- fields: null,
35510
- type: 'widgets',
35511
- prog_id: _session.DS_GLB[dsP].prog_id,
35512
- });
35513
- };
35514
- const get_property_value = async function (fieldIdP, val) {
36565
+
36566
+ const get_fields_data = async (fields, props) => {
36567
+ const get_property_value = async (fieldIdP, val) => {
35515
36568
  if (!val) return;
35516
- var value = fieldIdP in props ? props[fieldIdP] : typeof val.defaultValue === 'function' ? val?.defaultValue?.() : val?.defaultValue;
36569
+
36570
+ let value = fieldIdP in props ? props[fieldIdP] : typeof val.defaultValue === 'function' ? val.defaultValue() : val.defaultValue;
36571
+
35517
36572
  if (val.render === 'eventId') {
35518
36573
  value = props?.[fieldIdP]?.event;
35519
36574
  }
35520
36575
 
35521
- if (props[`xu-exp:${fieldIdP}`]) {
35522
- value = (await func.expression.get(SESSION_ID, props[`xu-exp:${fieldIdP}`], dsP, 'widget property')).result;
36576
+ const expKey = `xu-exp:${fieldIdP}`;
36577
+ if (props[expKey]) {
36578
+ value = (await func.expression.get(SESSION_ID, props[expKey], dsP, 'widget property')).result;
35523
36579
  }
35524
36580
 
35525
- return func.common.get_cast_val(
35526
- SESSION_ID,
35527
- 'widgets',
35528
- fieldIdP,
35529
- val.type, //val.type !== "string" || val.type !== "number" ? "string" : val.type,
35530
- value,
35531
- null,
35532
- );
36581
+ return func.common.get_cast_val(SESSION_ID, 'widgets', fieldIdP, val.type, value, null);
35533
36582
  };
35534
- var data_obj = {};
35535
- var return_code = 1;
35536
- // $.each(fields, function (key, val) {
35537
- for await (const [key, val] of Object.entries(fields)) {
36583
+
36584
+ const data_obj = {};
36585
+ let return_code = 1;
36586
+
36587
+ for (const [key, val] of Object.entries(fields)) {
35538
36588
  data_obj[key] = await get_property_value(key, val);
35539
36589
  if (!data_obj[key] && val.mandatory) {
35540
36590
  return_code = -1;
35541
36591
  report_error(`${key} is a mandatory field.`);
35542
36592
  break;
35543
36593
  }
35544
- // console.log(val);
35545
- }
35546
- for await (const key of ['xu-bind']) {
35547
- data_obj[key] = await get_property_value(key, props[key]);
35548
36594
  }
35549
36595
 
36596
+ data_obj['xu-bind'] = await get_property_value('xu-bind', props['xu-bind']);
36597
+
35550
36598
  return { code: return_code, data: data_obj };
35551
36599
  };
35552
36600
 
35553
- const load_css_style = function () {
35554
- const get_css_path = function (resource) {
36601
+ const load_css_style = () => {
36602
+ const get_css_path = (resource) => {
35555
36603
  if (_session.worker_type === 'Dev') {
35556
36604
  return `../../plugins/${plugin_name}/${resource}`;
35557
36605
  }
35558
- return `https://${_session.domain}/plugins/${plugin_name}/${APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name].manifest[resource].dist ? 'dist/' : ''}${resource}?gtp_token=${_session.gtp_token}&app_id=${_session.app_id}`;
36606
+ const manifest = APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name].manifest[resource];
36607
+ const dist = manifest.dist ? 'dist/' : '';
36608
+ return `https://${_session.domain}/plugins/${plugin_name}/${dist}${resource}?gtp_token=${_session.gtp_token}&app_id=${_session.app_id}`;
35559
36609
  };
35560
- let path = get_css_path('style.css');
35561
- func.utils.load_css_on_demand(path);
36610
+ func.utils.load_css_on_demand(get_css_path('style.css'));
35562
36611
  };
35563
36612
 
35564
36613
  const _plugin = APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
35565
- const index = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${_plugin.manifest['index.mjs'].dist ? 'dist/' : ''}index.mjs`);
36614
+ const indexDist = _plugin.manifest['index.mjs'].dist ? 'dist/' : '';
36615
+ const index = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${indexDist}index.mjs`);
35566
36616
  const methods = index.methods;
36617
+
35567
36618
  if (methods && !methods[method]) {
35568
36619
  return report_error('method not found');
35569
36620
  }
@@ -35572,18 +36623,13 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
35572
36623
  if (fields_ret.code < 0) {
35573
36624
  return report_error(fields_ret.data);
35574
36625
  }
35575
- const fields = fields_ret.data;
35576
36626
 
35577
- let exclude_attributes = [];
35578
- for await (const [key, val] of Object.entries(propsP)) {
35579
- if (typeof fields[key] !== 'undefined' || typeof fields[`xu-exp:${key}`] !== 'undefined') {
35580
- exclude_attributes.push(key);
35581
- }
35582
- }
36627
+ const fields = fields_ret.data;
36628
+ const exclude_attributes = Object.keys(propsP).filter((key) => fields[key] !== undefined || fields[`xu-exp:${key}`] !== undefined);
35583
36629
 
35584
- let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div, true, exclude_attributes);
36630
+ const ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div, true, exclude_attributes);
35585
36631
 
35586
- $div.addClass('widget_wrapper'); // class get override in set_attributes_new
36632
+ $div.addClass('widget_wrapper');
35587
36633
 
35588
36634
  if (!APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name]) {
35589
36635
  return report_error(`plugin ${plugin_name} not found`);
@@ -35618,23 +36664,23 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
35618
36664
  plugin_name,
35619
36665
  $containerP: $div,
35620
36666
  plugin_setup: plugin_setup_ret.data,
35621
-
35622
36667
  report_error,
35623
36668
  call_plugin_api,
35624
- // set_SYS_GLOBAL_OBJ_WIDGET_INFO,
35625
36669
  api_utils,
35626
36670
  };
35627
36671
 
35628
- const fx = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${_plugin.manifest['runtime.mjs'].dist ? 'dist/' : ''}runtime.mjs`);
36672
+ const runtimeDist = _plugin.manifest['runtime.mjs'].dist ? 'dist/' : '';
36673
+ const fx = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${runtimeDist}runtime.mjs`);
35629
36674
 
35630
36675
  if (_plugin?.manifest?.['runtime.mjs'].dist && _plugin?.manifest?.['runtime.mjs']?.css) {
35631
- const plugin_runtime_css_url = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, 'dist/runtime.css');
35632
- func.utils.load_css_on_demand(plugin_runtime_css_url);
36676
+ const css_url = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, 'dist/runtime.css');
36677
+ func.utils.load_css_on_demand(css_url);
35633
36678
  }
35634
36679
 
35635
36680
  if (!fx[method]) {
35636
36681
  throw `Method: ${method} does not exist`;
35637
36682
  }
36683
+
35638
36684
  try {
35639
36685
  await fx[method](fields, params);
35640
36686
  } catch (err) {
@@ -35643,12 +36689,13 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
35643
36689
  }
35644
36690
  return $div;
35645
36691
  },
35646
- [`xu-single-view`]: async function () {
35647
- var exist_elm_obj = get_element_info();
35648
- var $div = exist_elm_obj.div;
36692
+
36693
+ 'xu-single-view': async function () {
36694
+ const exist_elm_obj = get_element_info();
36695
+ let $div = exist_elm_obj.div;
35649
36696
 
35650
36697
  if (!exist_elm_obj.div) {
35651
- var $wrapper = $('<div>');
36698
+ const $wrapper = $('<div>');
35652
36699
  $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, 'div', $wrapper, '');
35653
36700
 
35654
36701
  if (!$div) return;
@@ -35658,67 +36705,41 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
35658
36705
  }
35659
36706
 
35660
36707
  $div.hover(
35661
- function (e) {
35662
- hover_in();
35663
- // func.UI.screen.hover_in(SESSION_ID, null, $container, paramsP, is_skeleton);
35664
- },
35665
- function (e) {
35666
- // func.UI.screen.hover_out(SESSION_ID, $container, is_skeleton, paramsP);
35667
- hover_out();
35668
- },
36708
+ (e) => hover_in(),
36709
+ (e) => hover_out(),
35669
36710
  );
35670
36711
  }
35671
36712
 
35672
- const ret = await iterate_child($div, nodeP, null, $div);
36713
+ await iterate_child($div, nodeP, null, $div);
36714
+
35673
36715
  if (_.isEmpty($container.data().xuAttributes)) {
35674
36716
  await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
35675
36717
  }
35676
36718
 
35677
- $.each($div.data().xuData, function (key, val) {
35678
- $container.data().xuData[key] = _.cloneDeep(val);
35679
- });
35680
- $.each($div.data().xuAttributes, function (key, val) {
35681
- // $container.data().xuAttributes[key] = _.cloneDeep(val);
35682
- $container.data().xuAttributes[key] = klona.klona(val);
35683
- });
36719
+ // Copy xuData and xuAttributes
36720
+ Object.assign($container.data().xuData, _.cloneDeep($div.data().xuData));
36721
+ Object.assign($container.data().xuAttributes, klona.klona($div.data().xuAttributes));
35684
36722
 
35685
36723
  return await render_screen_type($div);
35686
36724
  },
35687
- [`xu-multi-view`]: async function () {
35688
- var $div = $container;
35689
36725
 
35690
- if (!$div.data().xuData.node || !$div.data().xuData.node.children) {
35691
- $div.data().xuData.node = nodeP;
36726
+ 'xu-multi-view': async function () {
36727
+ let $div = $container;
36728
+
36729
+ const divXuData = $div.data().xuData;
36730
+ if (!divXuData.node || !divXuData.node.children) {
36731
+ divXuData.node = nodeP;
35692
36732
  }
35693
36733
 
35694
- if (!$div.data().xuData.debug_info) {
35695
- $div.data().xuData.debug_info = {
36734
+ if (!divXuData.debug_info) {
36735
+ divXuData.debug_info = {
35696
36736
  id: nodeP.id,
35697
36737
  parent_id: $container.data().xuData.ui_id,
35698
36738
  };
35699
36739
  }
35700
36740
 
35701
36741
  const done = async function (continuous_idx) {
35702
- // const do_callback = async function ($div) {
35703
- // // if ($root_container.data().xuData.progress_bar_circle) {
35704
- // // setTimeout(function () {
35705
- // // $.each(
35706
- // // $root_container.data().xuData.progress_bar_circle,
35707
- // // function (key, val) {
35708
- // // val.bar.set(parseFloat(val.value)); // Number from 0.0 to 1.0
35709
- // // }
35710
- // // );
35711
- // // }, 2000);
35712
- // // }
35713
-
35714
- // if (paramsP.screenInfo.properties?.rtl) {
35715
- // $div_content.attr('dir', 'rtl');
35716
- // }
35717
-
35718
- // return $div;
35719
- // };
35720
36742
  await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
35721
-
35722
36743
  return await render_screen_type($div);
35723
36744
  };
35724
36745
 
@@ -35727,351 +36748,150 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
35727
36748
  }
35728
36749
 
35729
36750
  const empty_result = async function () {
35730
- // var content = prop.empty_result_content || '';
35731
-
35732
- // var res = await func.expression.get(
35733
- // SESSION_ID,
35734
- // content, // prop["xu-exp:empty_result_content"],
35735
- // paramsP.dsSessionP,
35736
- // 'empty_result_content_EXP',
35737
- // _ds.currentRecordId,
35738
- // );
35739
- // content = res.result;
35740
-
35741
- // let empty_result_node = {
35742
- // type: 'element',
35743
- // id: crypto.randomUUID(),
35744
- // content,
35745
- // // : content || (typeof content === "undefined" && "Empty results"),
35746
- // tagName: 'div',
35747
- // attributes: {},
35748
- // children: [],
35749
- // };
35750
-
35751
- // 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);
35752
36751
  await func.events.validate(SESSION_ID, 'record_not_found', paramsP.dsSessionP);
35753
36752
  return await done(null);
35754
36753
  };
35755
- var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
35756
-
35757
- var continuous_idx = null;
35758
36754
 
35759
36755
  if (!_ds.data_feed || _.isEmpty(_ds.data_feed.rows)) {
35760
36756
  return await empty_result();
35761
36757
  }
35762
36758
 
35763
- var i = 0;
35764
- for await (const [key, val] of Object.entries(_ds.data_feed.rows)) {
35765
- var node = JSON.parse(JSON.stringify(nodeP));
35766
-
36759
+ for (const [key, val] of Object.entries(_ds.data_feed.rows)) {
36760
+ const node = JSON.parse(JSON.stringify(nodeP));
35767
36761
  _ds.currentRecordId = val._ROWID;
35768
- const ret = await iterate_child($div, node, { continuous_idx }, $root_container);
36762
+ await iterate_child($div, node, { continuous_idx: null }, $root_container);
35769
36763
 
35770
36764
  if (_.isEmpty($container.data().xuAttributes)) {
35771
36765
  await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
35772
36766
  }
35773
36767
  }
35774
36768
 
35775
- return await done(continuous_idx);
36769
+ return await done(null);
35776
36770
  },
35777
- [`xu-panel`]: async function () {
36771
+
36772
+ 'xu-panel': async function () {
35778
36773
  const done = async function ($new_div) {
35779
36774
  if (!$container.data()?.xuData?.paramsP) {
35780
36775
  return $container;
35781
36776
  }
35782
- var $div_items = $div.data().xuData.node.children;
35783
36777
 
36778
+ const $div_items = $div.data().xuData.node.children;
35784
36779
  await func.UI.screen.panel_post_render_handler(SESSION_ID, $container, $new_div, nodeP, $div, jobNoP);
35785
-
35786
- // TO FIX should be timeout
35787
36780
  $container.data().xuData.node.children = $div_items;
35788
-
35789
36781
  return $container;
35790
36782
  };
35791
36783
 
35792
- var $wrapper = $('<div>');
35793
- $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, null, $wrapper, '');
36784
+ const $wrapper = $('<div>');
36785
+ const $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, null, $wrapper, '');
36786
+
36787
+ const ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div.clone(true), true, undefined, refreshed_ds);
35794
36788
 
35795
- let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div.clone(true), true, undefined, refreshed_ds);
35796
36789
  if (ret.abort) {
35797
- // render N
35798
36790
  return (ret.$new_div = $('<template>').append($div));
35799
36791
  }
35800
36792
 
35801
36793
  let $ret_panel_div = ret.$new_div;
35802
36794
 
35803
- if (!$ret_panel_div?.children()?.length) {
35804
- ////// render default children tree
35805
- if (nodeP.children.length) {
35806
- $ret_panel_div = await func.UI.screen.render_ui_tree(SESSION_ID, $container, nodeP.children[0], parent_infoP, paramsP, jobNoP, null, 0, null, nodeP, null, $root_container);
35807
- }
36795
+ if (!$ret_panel_div?.children()?.length && nodeP.children.length) {
36796
+ $ret_panel_div = await func.UI.screen.render_ui_tree(SESSION_ID, $container, nodeP.children[0], parent_infoP, paramsP, jobNoP, null, 0, null, nodeP, null, $root_container);
35808
36797
  }
35809
36798
 
35810
- let ret_done = await done($ret_panel_div);
35811
-
35812
- return ret_done;
36799
+ return await done($ret_panel_div);
35813
36800
  },
35814
36801
  };
35815
36802
 
35816
- const draw_html_element_org = async function (element) {
35817
- const done = async function (ret = {}) {
35818
- return $div;
35819
- };
35820
- if (!element || element === 'script') return await done();
35821
- let str = '';
35822
-
35823
- var $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, element, null, str);
35824
-
35825
- $div.hover(
35826
- function (e) {
35827
- hover_in($div, e);
35828
- },
35829
- function (e) {
35830
- hover_out();
35831
- },
35832
- );
35833
- if (paramsP.paramsP === 'grid' || parent_infoP?.iterate_info) {
35834
- $div.on('click contextmenu', function (e) {
35835
- hover_in($div, e);
35836
- });
35837
- }
35838
-
35839
- // let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $container, nodeP, $div, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div, true);
35840
- let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div, true);
35841
- if (ret.abort || nodeP.tagName === 'svg' || !_.isEmpty(nodeP?.attributes?.['xu-text']) || !_.isEmpty(nodeP?.attributes?.['xu-html']) || !_.isEmpty(nodeP?.attributes?.['xu-exp:xu-text']) || !_.isEmpty(nodeP?.attributes?.['xu-exp:xu-html'])) {
35842
- return await done(ret);
35843
- }
35844
- // check if iterator made to prevent children render
35845
-
35846
- if (nodeP?.attributes?.['xu-viewport'] == 'true') {
35847
- // const xu_viewport = async function () {
35848
- // const data = { $div: $div.clone(true), nodeP, parent_infoP, $root_container, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, $container };
35849
- // const container_id = $container.attr('xu-ui-id');
35850
- // if (!UI_WORKER_OBJ.pending_for_viewport_render[container_id]) {
35851
- // UI_WORKER_OBJ.pending_for_viewport_render[container_id] = { base_$div: $div, data: [], $container };
35852
- // await iterate_child($div, nodeP, parent_infoP, $root_container);
35853
- // } else {
35854
- // $div.remove();
35855
- // }
35856
- // UI_WORKER_OBJ.pending_for_viewport_render[container_id].data.push(data);
35857
-
35858
- // // if (!$div.children().length) {
35859
- // // // render the first element to determine height
35860
- // // await iterate_child($div, nodeP, parent_infoP, $root_container);
35861
- // // // hover_in($div);
35862
- // // // func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'render_viewport', data, null, null, paramsP.dsSessionP);
35863
- // // } else {
35864
- // // }
35865
- // };
35866
- const xu_viewport = function () {
35867
- const observer_inViewport = new IntersectionObserver(
35868
- function (entries) {
35869
- entries.forEach((entry) => {
35870
- if (entry.isIntersecting) {
35871
- $(entry.target).trigger('inViewport');
35872
-
35873
- // Optional: stop observing once triggered
35874
- observer_inViewport.unobserve(entry.target);
35875
- }
35876
- });
35877
- },
35878
- {
35879
- threshold: 0.1, // Trigger when 10% of element is visible
35880
- },
35881
- );
35882
-
35883
- const observer_outViewport = new IntersectionObserver(
35884
- function (entries) {
35885
- entries.forEach((entry) => {
35886
- if (!entry.isIntersecting) {
35887
- // Element is OUT of viewport - trigger custom event
35888
- $(entry.target).trigger('outViewport');
35889
-
35890
- // Optional: stop observing once triggered
35891
- // observer_outViewport.unobserve(entry.target);
35892
- }
35893
- });
35894
- },
35895
- {
35896
- threshold: 0, // Trigger when element is completely out of view
35897
- },
35898
- );
35899
-
35900
- let ui_job_id;
35901
- $div.on('inViewport', function () {
35902
- if ($div.children().length) {
35903
- $div.removeClass('skeleton');
35904
- return;
35905
- }
35906
-
35907
- // if (UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')]) {
35908
- // $div[0].style.removeProperty('height');
35909
- // $div.removeClass('skeleton');
35910
- // $div.html(UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')]);
35911
- // } else {
35912
- hover_in($div);
35913
- ui_job_id = func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'render_viewport', { $div, nodeP, parent_infoP, $root_container, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, $container }, null, null, paramsP.dsSessionP);
35914
- // }
35915
- observer_outViewport.observe($div[0]);
35916
- });
35917
-
35918
- $div.on('outViewport', function () {
35919
- func.UI.worker.delete_job(SESSION_ID, ui_job_id);
35920
-
35921
- if ($div.children().length) {
35922
- // UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')] = $div.children().clone(true);
35923
- $div.empty();
35924
- const height = $div?.data()?.xuData?.viewport_height || 10;
35925
- if (typeof height !== 'undefined') {
35926
- $div.css('height', height);
35927
- }
35928
- }
35929
- // $div.addClass('skeleton');
35930
- observer_inViewport.observe($div[0]);
35931
- });
35932
- $div.addClass('skeleton');
35933
- observer_inViewport.observe($div[0]);
35934
- };
35935
- xu_viewport();
35936
- } else {
35937
- await iterate_child($div, nodeP, parent_infoP, $root_container);
35938
- }
35939
-
35940
- // const ret_iterate_child = await iterate_child($div, nodeP, parent_infoP, null, $root_container);
35941
- return await done(ret);
35942
- };
35943
-
35944
36803
  const draw_html_element = async function (element) {
35945
36804
  const done = async function (ret = {}) {
35946
36805
  const xu_ui_id = $div.attr('xu-ui-id');
35947
36806
  $div.removeClass('display_none');
35948
- if (ret.has_xu_exp_render_attribute) {
35949
- // $div.css('display', 'unset');
35950
36807
 
36808
+ if (ret.has_xu_exp_render_attribute) {
35951
36809
  const xu_render_cache_id = await get_xu_render_cache_str(SESSION_ID, paramsP.dsSessionP, Object.keys($div.data()?.xuData?.attr_exp_info?.['xu-render']?.fields || {}));
36810
+
35952
36811
  const _$div = $div.clone(true);
35953
- UI_WORKER_OBJ.xu_render_cache[xu_ui_id + xu_render_cache_id] = { $div: _$div, paramsP, data: _$div.data() };
36812
+ UI_WORKER_OBJ.xu_render_cache[xu_ui_id + xu_render_cache_id] = {
36813
+ $div: _$div,
36814
+ paramsP,
36815
+ data: _$div.data(),
36816
+ };
36817
+
35954
36818
  nodeP.xu_render_xu_ui_id = xu_ui_id;
35955
36819
  nodeP.xu_render_cache_id = xu_render_cache_id;
35956
36820
 
35957
36821
  if (ret.xu_render_background_processing) {
35958
- temp_$div.remove();
35959
- // $container.find(`[xu-ui-id="${xu_ui_id}"]`).remove();
35960
- return $div;
35961
- } else {
35962
- // $div.css('display', 'unset');
35963
- temp_$div.replaceWith($div);
35964
- return $div;
35965
- }
35966
- } else {
35967
- if (ret.has_xu_render_attribute) {
35968
36822
  temp_$div.remove();
35969
36823
  return $div;
35970
36824
  }
35971
- // $div.css('display', 'unset');
35972
36825
  temp_$div.replaceWith($div);
35973
36826
  return $div;
35974
36827
  }
36828
+
36829
+ if (ret.has_xu_render_attribute) {
36830
+ temp_$div.remove();
36831
+ return $div;
36832
+ }
36833
+
36834
+ temp_$div.replaceWith($div);
36835
+ return $div;
35975
36836
  };
35976
- if (!element || element === 'script') return await done();
35977
- let str = '';
35978
36837
 
35979
- var temp_$div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, element, null, str, true);
36838
+ if (!element || element === 'script') return await done();
35980
36839
 
35981
- let temp_$container = $('<tmp>').data('xuData', $container.data().xuData);
35982
- let $div = temp_$div.clone(true);
36840
+ const temp_$div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, element, null, '', true);
35983
36841
 
35984
- // $div.css('display', 'none');
36842
+ const temp_$container = $('<tmp>').data('xuData', $container.data().xuData);
36843
+ const $div = temp_$div.clone(true);
35985
36844
 
35986
36845
  $div.hover(
35987
- function (e) {
35988
- hover_in($div, e);
35989
- },
35990
- function (e) {
35991
- hover_out();
35992
- },
36846
+ (e) => hover_in($div, e),
36847
+ (e) => hover_out(),
35993
36848
  );
36849
+
35994
36850
  if (paramsP.paramsP === 'grid' || parent_infoP?.iterate_info) {
35995
- $div.on('click contextmenu', function (e) {
35996
- hover_in($div, e);
35997
- });
36851
+ $div.on('click contextmenu', (e) => hover_in($div, e));
35998
36852
  }
35999
36853
 
36000
- let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, temp_$container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div, true);
36001
- if (ret.abort || nodeP.tagName === 'svg' || !_.isEmpty(nodeP?.attributes?.['xu-text']) || !_.isEmpty(nodeP?.attributes?.['xu-html']) || !_.isEmpty(nodeP?.attributes?.['xu-exp:xu-text']) || !_.isEmpty(nodeP?.attributes?.['xu-exp:xu-html'])) {
36854
+ const ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, temp_$container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div, true);
36855
+
36856
+ if (ret.abort || nodeTag === 'svg' || !_.isEmpty(nodeP?.attributes?.['xu-text']) || !_.isEmpty(nodeP?.attributes?.['xu-html']) || !_.isEmpty(nodeP?.attributes?.['xu-exp:xu-text']) || !_.isEmpty(nodeP?.attributes?.['xu-exp:xu-html'])) {
36002
36857
  return await done(ret);
36003
36858
  }
36004
- // check if iterator made to prevent children render
36005
-
36006
- if (nodeP?.attributes?.['xu-viewport'] == 'true') {
36007
- // const xu_viewport = async function () {
36008
- // const data = { $div: $div.clone(true), nodeP, parent_infoP, $root_container, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, $container };
36009
- // const container_id = $container.attr('xu-ui-id');
36010
- // if (!UI_WORKER_OBJ.pending_for_viewport_render[container_id]) {
36011
- // UI_WORKER_OBJ.pending_for_viewport_render[container_id] = { base_$div: $div, data: [], $container };
36012
- // await iterate_child($div, nodeP, parent_infoP, $root_container);
36013
- // } else {
36014
- // $div.remove();
36015
- // }
36016
- // UI_WORKER_OBJ.pending_for_viewport_render[container_id].data.push(data);
36017
-
36018
- // // if (!$div.children().length) {
36019
- // // // render the first element to determine height
36020
- // // await iterate_child($div, nodeP, parent_infoP, $root_container);
36021
- // // // hover_in($div);
36022
- // // // func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'render_viewport', data, null, null, paramsP.dsSessionP);
36023
- // // } else {
36024
- // // }
36025
- // };
36859
+
36860
+ if (nodeP?.attributes?.['xu-viewport'] === 'true') {
36026
36861
  const xu_viewport = function () {
36027
36862
  const observer_inViewport = new IntersectionObserver(
36028
- function (entries) {
36863
+ (entries) => {
36029
36864
  entries.forEach((entry) => {
36030
36865
  if (entry.isIntersecting) {
36031
36866
  $(entry.target).trigger('inViewport');
36032
-
36033
- // Optional: stop observing once triggered
36034
36867
  observer_inViewport.unobserve(entry.target);
36035
36868
  }
36036
36869
  });
36037
36870
  },
36038
- {
36039
- threshold: 0.1, // Trigger when 10% of element is visible
36040
- },
36871
+ { threshold: 0.1 },
36041
36872
  );
36042
36873
 
36043
36874
  const observer_outViewport = new IntersectionObserver(
36044
- function (entries) {
36875
+ (entries) => {
36045
36876
  entries.forEach((entry) => {
36046
36877
  if (!entry.isIntersecting) {
36047
- // Element is OUT of viewport - trigger custom event
36048
36878
  $(entry.target).trigger('outViewport');
36049
-
36050
- // Optional: stop observing once triggered
36051
- // observer_outViewport.unobserve(entry.target);
36052
36879
  }
36053
36880
  });
36054
36881
  },
36055
- {
36056
- threshold: 0, // Trigger when element is completely out of view
36057
- },
36882
+ { threshold: 0 },
36058
36883
  );
36059
36884
 
36060
36885
  let ui_job_id;
36886
+
36061
36887
  $div.on('inViewport', function () {
36062
36888
  if ($div.children().length) {
36063
36889
  $div.removeClass('skeleton');
36064
36890
  return;
36065
36891
  }
36066
36892
 
36067
- // if (UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')]) {
36068
- // $div[0].style.removeProperty('height');
36069
- // $div.removeClass('skeleton');
36070
- // $div.html(UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')]);
36071
- // } else {
36072
36893
  hover_in($div);
36073
36894
  ui_job_id = func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'render_viewport', { $div, nodeP, parent_infoP, $root_container, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, temp_$container }, null, null, paramsP.dsSessionP);
36074
- // }
36075
36895
  observer_outViewport.observe($div[0]);
36076
36896
  });
36077
36897
 
@@ -36079,66 +36899,49 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
36079
36899
  func.UI.worker.delete_job(SESSION_ID, ui_job_id);
36080
36900
 
36081
36901
  if ($div.children().length) {
36082
- // UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')] = $div.children().clone(true);
36083
36902
  $div.empty();
36084
36903
  const height = $div?.data()?.xuData?.viewport_height || 10;
36085
- if (typeof height !== 'undefined') {
36904
+ if (height !== undefined) {
36086
36905
  $div.css('height', height);
36087
36906
  }
36088
36907
  }
36089
- // $div.addClass('skeleton');
36090
36908
  observer_inViewport.observe($div[0]);
36091
36909
  });
36910
+
36092
36911
  $div.addClass('skeleton');
36093
36912
  observer_inViewport.observe($div[0]);
36094
36913
  };
36095
36914
  xu_viewport();
36096
36915
  } else {
36097
- // if (ret.xu_render_background_processing) {
36098
- // // let temp_$div = $div.clone(true);
36099
- // iterate_child($div, nodeP, parent_infoP, $root_container);
36100
- // } else {
36101
- // await iterate_child($div, nodeP, parent_infoP, $root_container);
36102
- // }
36103
36916
  if (!ret.xu_render_background_processing) {
36104
36917
  iterate_child($div, nodeP, parent_infoP, $root_container);
36105
36918
  }
36106
36919
  }
36107
36920
 
36108
- // const ret_iterate_child = await iterate_child($div, nodeP, parent_infoP, null, $root_container);
36109
36921
  return await done(ret);
36110
36922
  };
36111
36923
 
36924
+ // Handle content attribute
36112
36925
  if (nodeP.content && nodeP.attributes) {
36113
36926
  nodeP.attributes['xu-content'] = nodeP.content;
36114
36927
  }
36115
36928
 
36116
- if (nodeP.tagName === 'xu-widget') {
36929
+ // Handle xu-widget
36930
+ if (nodeTag === 'xu-widget') {
36117
36931
  if (is_skeleton) return;
36118
36932
  return await fx['widget']();
36119
36933
  }
36120
- if (fx[nodeP.tagName]) {
36121
- return await fx[nodeP.tagName]();
36934
+
36935
+ // Handle custom tags
36936
+ if (fx[nodeTag]) {
36937
+ return await fx[nodeTag]();
36122
36938
  }
36123
- // const xu_viewport = async function () {
36124
- // const data = { $div, nodeP, parent_infoP, $root_container, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, $container };
36125
- // const container_id = $container.attr('xu-ui-id');
36126
- // if (!UI_WORKER_OBJ.pending_for_viewport_render[container_id]) {
36127
- // UI_WORKER_OBJ.pending_for_viewport_render[container_id] = { base_$div: $div, data: [], $container };
36128
- // await iterate_child($div, nodeP, parent_infoP, $root_container);
36129
- // }
36130
- // UI_WORKER_OBJ.pending_for_viewport_render[container_id].data.push(data);
36131
- // };
36132
36939
 
36133
- // if (nodeP?.attributes?.['xu-viewport'] == 'true') {
36134
- // return await xu_viewport();
36135
- // } else {
36940
+ // Render HTML element
36136
36941
  if (!glb.new_xu_render) {
36137
- return await draw_html_element_org(nodeP.tagName);
36942
+ return await draw_html_element_org(nodeTag);
36138
36943
  }
36139
- return await draw_html_element(nodeP.tagName);
36140
-
36141
- // }
36944
+ return await draw_html_element(nodeTag);
36142
36945
  };
36143
36946
 
36144
36947
  func.UI.screen.refresh_document_changes_for_realtime_update = async function (SESSION_ID, doc_change) {