@xuda.io/runtime-bundle 1.0.1288 → 1.0.1290
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.
- package/js/modules/xuda-studio-doc-utils.min.mjs +1 -1
- package/js/modules/xuda-studio-doc-utils.mjs +1 -1
- package/js/xuda-runtime-bundle.js +1747 -1742
- package/js/xuda-runtime-bundle.min.js +1 -1
- package/js/xuda-runtime-slim.js +1758 -1753
- package/js/xuda-runtime-slim.min.es.js +1758 -1753
- package/js/xuda-runtime-slim.min.js +1 -1
- package/js/xuda-server-bundle.min.mjs +1 -1
- package/js/xuda-server-bundle.mjs +1 -1
- package/js/xuda-worker-bundle.js +1 -1
- package/js/xuda-worker-bundle.min.js +1 -1
- package/package.json +1 -1
package/js/xuda-runtime-slim.js
CHANGED
|
@@ -4826,7 +4826,7 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
4826
4826
|
await func.UI.screen.refresh_screen(
|
|
4827
4827
|
SESSION_ID,
|
|
4828
4828
|
klona.klona(fields_changed), // _.cloneDeep(fields_changed),
|
|
4829
|
-
|
|
4829
|
+
datasource_changed[0],
|
|
4830
4830
|
datasource_changed[0], // refresh the current datasource only
|
|
4831
4831
|
value,
|
|
4832
4832
|
);
|
|
@@ -12187,7 +12187,7 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
|
|
|
12187
12187
|
}
|
|
12188
12188
|
|
|
12189
12189
|
const panels_obj = await func.UI.utils.get_panels_wrapper_from_dom(SESSION_ID, $(SESSION_OBJ[SESSION_ID].root_element), false);
|
|
12190
|
-
|
|
12190
|
+
found = false;
|
|
12191
12191
|
for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
|
|
12192
12192
|
// const progDataSource_str = JSON.stringify(panel_val.prog_doc.progDataSource);
|
|
12193
12193
|
if (!panel_val.$panel_div?.data()?.xuData) continue;
|
|
@@ -12314,11 +12314,16 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
|
|
|
12314
12314
|
var ret = {};
|
|
12315
12315
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
12316
12316
|
var _ds = _session.DS_GLB[paramsP.dsSessionP];
|
|
12317
|
+
var _refreshed_ds = _session.DS_GLB[refreshed_ds];
|
|
12318
|
+
let create_new_ds = refreshed_ds && _refreshed_ds.prog_id !== prog_id;
|
|
12319
|
+
//let create_new_ds = prog_id !== _ds.prog_id
|
|
12320
|
+
|
|
12317
12321
|
const init_program = async function () {
|
|
12318
12322
|
async function render_panel() {
|
|
12319
12323
|
const prog_id = val.value?.prog || val.value;
|
|
12320
12324
|
const params_obj = await get_params_obj_new(SESSION_ID, prog_id, nodeP, paramsP.dsSessionP);
|
|
12321
|
-
|
|
12325
|
+
//prog_id !== _ds.prog_id ? null : refreshed_ds
|
|
12326
|
+
let ret_panel = await func.UI.screen.init(SESSION_ID, prog_id, paramsP.screenId, _ds, $elm, null, _ds.currentRecordId, null, true, params_obj.params_res, 'initXu_panel', undefined, create_new_ds ? null : refreshed_ds, params_obj.params_raw);
|
|
12322
12327
|
ret = { $new_div: ret_panel };
|
|
12323
12328
|
if ($container.data().xuData) {
|
|
12324
12329
|
$container.data().xuData.xuPanelProps = $elm.data().xuAttributes;
|
|
@@ -13434,844 +13439,844 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
|
|
|
13434
13439
|
}
|
|
13435
13440
|
};
|
|
13436
13441
|
|
|
13437
|
-
func.UI.screen.execute_xu_functions_bad = async function (SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, xu_func, $elm, val, is_init, refreshed_ds) {
|
|
13438
|
-
|
|
13442
|
+
// func.UI.screen.execute_xu_functions_bad = async function (SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, xu_func, $elm, val, is_init, refreshed_ds) {
|
|
13443
|
+
// if (is_skeleton) return;
|
|
13439
13444
|
|
|
13440
|
-
|
|
13441
|
-
|
|
13442
|
-
|
|
13443
|
-
|
|
13444
|
-
|
|
13445
|
-
|
|
13446
|
-
|
|
13445
|
+
// // Cache frequently accessed values
|
|
13446
|
+
// const _session = SESSION_OBJ[SESSION_ID];
|
|
13447
|
+
// const _ds = _session.DS_GLB[paramsP.dsSessionP];
|
|
13448
|
+
// const elmData = $elm.data();
|
|
13449
|
+
// const xuData = elmData.xuData;
|
|
13450
|
+
// const nodeTag = nodeP.tagName;
|
|
13451
|
+
// const isXuTag = nodeTag && nodeTag.startsWith('xu-');
|
|
13447
13452
|
|
|
13448
|
-
|
|
13449
|
-
|
|
13450
|
-
|
|
13451
|
-
|
|
13452
|
-
|
|
13453
|
-
|
|
13454
|
-
|
|
13453
|
+
// const load_cdn = async function (resource) {
|
|
13454
|
+
// if (!_.isObject(resource)) {
|
|
13455
|
+
// resource = _.isString(resource) ? { src: resource, type: 'js' } : null;
|
|
13456
|
+
// }
|
|
13457
|
+
// if (!resource) {
|
|
13458
|
+
// throw new Error('cdn resource in wrong format');
|
|
13459
|
+
// }
|
|
13455
13460
|
|
|
13456
|
-
|
|
13457
|
-
|
|
13458
|
-
|
|
13459
|
-
|
|
13460
|
-
|
|
13461
|
-
|
|
13462
|
-
|
|
13463
|
-
|
|
13461
|
+
// try {
|
|
13462
|
+
// const loadFn = resource.type === 'css' ? func.utils.load_css_on_demand : func.utils.load_js_on_demand;
|
|
13463
|
+
// const moduleArg = resource.type === 'module' ? 'module' : undefined;
|
|
13464
|
+
// await loadFn(resource.src, moduleArg);
|
|
13465
|
+
// } catch (error) {
|
|
13466
|
+
// func.utils.debug_report(SESSION_ID, 'xu-cdn', 'Fail to load: ' + resource.src, 'W');
|
|
13467
|
+
// }
|
|
13468
|
+
// };
|
|
13464
13469
|
|
|
13465
|
-
|
|
13466
|
-
|
|
13467
|
-
|
|
13468
|
-
|
|
13469
|
-
|
|
13470
|
-
|
|
13471
|
-
|
|
13472
|
-
|
|
13473
|
-
|
|
13470
|
+
// const common_fx = {
|
|
13471
|
+
// 'xu-attrs': async function ($elm, val) {
|
|
13472
|
+
// if (!val.value || !_.isObject(val.value)) {
|
|
13473
|
+
// if (val.value) throw 'xu-attrs value is not an object';
|
|
13474
|
+
// return {};
|
|
13475
|
+
// }
|
|
13476
|
+
// Object.assign(nodeP.attributes, val.value);
|
|
13477
|
+
// return {};
|
|
13478
|
+
// },
|
|
13474
13479
|
|
|
13475
|
-
|
|
13476
|
-
|
|
13480
|
+
// 'xu-ref': async function ($elm, val, dsSession) {
|
|
13481
|
+
// if (!val.value) return {};
|
|
13477
13482
|
|
|
13478
|
-
|
|
13483
|
+
// func.UI.update_xu_ref(SESSION_ID, dsSession || paramsP.dsSessionP, val.value, $elm);
|
|
13479
13484
|
|
|
13480
|
-
|
|
13481
|
-
|
|
13485
|
+
// const targetNode = $elm[0];
|
|
13486
|
+
// if (!targetNode) return {};
|
|
13482
13487
|
|
|
13483
|
-
|
|
13484
|
-
|
|
13485
|
-
|
|
13488
|
+
// const observer = new MutationObserver(() => {
|
|
13489
|
+
// func.UI.screen.refresh_xu_attributes(SESSION_ID, [val.value]);
|
|
13490
|
+
// });
|
|
13486
13491
|
|
|
13487
|
-
|
|
13488
|
-
|
|
13489
|
-
|
|
13492
|
+
// observer.observe(targetNode, { attributes: true, childList: true, subtree: true });
|
|
13493
|
+
// return {};
|
|
13494
|
+
// },
|
|
13495
|
+
|
|
13496
|
+
// 'xu-bind': async function ($elm, val) {
|
|
13497
|
+
// if (is_skeleton) return {};
|
|
13498
|
+
|
|
13499
|
+
// let val_is_reference_field = false;
|
|
13500
|
+
// let _prog_id = xuData.paramsP.prog_id;
|
|
13501
|
+
// let _dsP = xuData.paramsP.dsSessionP;
|
|
13502
|
+
|
|
13503
|
+
// const view_ret = await func.utils.VIEWS_OBJ.get(SESSION_ID, _prog_id);
|
|
13504
|
+
// if (!view_ret) return {};
|
|
13505
|
+
|
|
13506
|
+
// let is_dynamic_field = false;
|
|
13507
|
+
// let field_prop;
|
|
13508
|
+
// let bind_field_id;
|
|
13509
|
+
// const input_field_type = $elm.attr('type');
|
|
13510
|
+
|
|
13511
|
+
// const get_bind_field = async function (field_id) {
|
|
13512
|
+
// if (['_FOR_VAL', '_FOR_KEY'].includes(field_id)) {
|
|
13513
|
+
// is_dynamic_field = true;
|
|
13514
|
+
// field_prop = _ds.dynamic_fields[field_id];
|
|
13515
|
+
// } else {
|
|
13516
|
+
// field_prop = func.common.find_item_by_key(view_ret.progFields, 'field_id', field_id);
|
|
13517
|
+
// if (!field_prop) {
|
|
13518
|
+
// const ret_get_value = await func.datasource.get_value(SESSION_ID, field_id, _dsP);
|
|
13519
|
+
// if (ret_get_value.found) {
|
|
13520
|
+
// _dsP = ret_get_value.dsSessionP;
|
|
13521
|
+
// const ds = _session.DS_GLB[_dsP];
|
|
13522
|
+
// _prog_id = ds.prog_id;
|
|
13523
|
+
// const new_view_ret = await func.utils.VIEWS_OBJ.get(SESSION_ID, _prog_id);
|
|
13524
|
+
// if (!new_view_ret) return {};
|
|
13525
|
+
// field_prop = func.common.find_item_by_key(new_view_ret.progFields, 'field_id', field_id);
|
|
13526
|
+
// }
|
|
13527
|
+
// if (!field_prop) {
|
|
13528
|
+
// throw `field ${field_id} not found in the program scope`;
|
|
13529
|
+
// }
|
|
13530
|
+
// }
|
|
13531
|
+
// }
|
|
13532
|
+
// return field_id;
|
|
13533
|
+
// };
|
|
13490
13534
|
|
|
13491
|
-
|
|
13492
|
-
|
|
13535
|
+
// try {
|
|
13536
|
+
// bind_field_id = await get_bind_field(val.value.split('.')[0]);
|
|
13537
|
+
// val_is_reference_field = true;
|
|
13538
|
+
// } catch (err) {
|
|
13539
|
+
// console.error(err?.message || err);
|
|
13540
|
+
// return {};
|
|
13541
|
+
// }
|
|
13493
13542
|
|
|
13494
|
-
|
|
13495
|
-
|
|
13496
|
-
|
|
13543
|
+
// const field_changed = async function (e) {
|
|
13544
|
+
// const ds = _session.DS_GLB[_dsP];
|
|
13545
|
+
// const fieldType = field_prop.props.fieldType;
|
|
13546
|
+
// const isCheckbox = input_field_type === 'checkbox';
|
|
13547
|
+
// const isRadio = input_field_type === 'radio';
|
|
13548
|
+
|
|
13549
|
+
// // Handle array field with checkbox
|
|
13550
|
+
// if (fieldType === 'array' && isCheckbox && val_is_reference_field) {
|
|
13551
|
+
// const arr_value = _.clone((await func.datasource.get_value(SESSION_ID, bind_field_id, _dsP, ds.currentRecordId)).ret.value);
|
|
13552
|
+
// const value_from_getter = bind.getter($elm[0]);
|
|
13553
|
+
// const value = arr_value.includes(value_from_getter) ? arr_value.filter((item) => !_.isEqual(item, value_from_getter)) : [...arr_value, value_from_getter];
|
|
13554
|
+
|
|
13555
|
+
// return await func.datasource.update(SESSION_ID, {
|
|
13556
|
+
// [_dsP]: { [ds.currentRecordId]: { [bind_field_id]: value } },
|
|
13557
|
+
// });
|
|
13558
|
+
// }
|
|
13497
13559
|
|
|
13498
|
-
|
|
13499
|
-
|
|
13560
|
+
// // Handle array field with radio
|
|
13561
|
+
// if (fieldType === 'array' && isRadio && val_is_reference_field) {
|
|
13562
|
+
// return await func.datasource.update(SESSION_ID, {
|
|
13563
|
+
// [_dsP]: { [ds.currentRecordId]: { [bind_field_id]: [bind.getter($elm[0])] } },
|
|
13564
|
+
// });
|
|
13565
|
+
// }
|
|
13500
13566
|
|
|
13501
|
-
|
|
13502
|
-
let field_prop;
|
|
13503
|
-
let bind_field_id;
|
|
13504
|
-
const input_field_type = $elm.attr('type');
|
|
13567
|
+
// let value = await func.common.get_cast_val(SESSION_ID, 'xu-bind', 'value', fieldType, bind.getter($elm[0]));
|
|
13505
13568
|
|
|
13506
|
-
|
|
13507
|
-
|
|
13508
|
-
|
|
13509
|
-
field_prop = _ds.dynamic_fields[field_id];
|
|
13510
|
-
} else {
|
|
13511
|
-
field_prop = func.common.find_item_by_key(view_ret.progFields, 'field_id', field_id);
|
|
13512
|
-
if (!field_prop) {
|
|
13513
|
-
const ret_get_value = await func.datasource.get_value(SESSION_ID, field_id, _dsP);
|
|
13514
|
-
if (ret_get_value.found) {
|
|
13515
|
-
_dsP = ret_get_value.dsSessionP;
|
|
13516
|
-
const ds = _session.DS_GLB[_dsP];
|
|
13517
|
-
_prog_id = ds.prog_id;
|
|
13518
|
-
const new_view_ret = await func.utils.VIEWS_OBJ.get(SESSION_ID, _prog_id);
|
|
13519
|
-
if (!new_view_ret) return {};
|
|
13520
|
-
field_prop = func.common.find_item_by_key(new_view_ret.progFields, 'field_id', field_id);
|
|
13521
|
-
}
|
|
13522
|
-
if (!field_prop) {
|
|
13523
|
-
throw `field ${field_id} not found in the program scope`;
|
|
13524
|
-
}
|
|
13525
|
-
}
|
|
13526
|
-
}
|
|
13527
|
-
return field_id;
|
|
13528
|
-
};
|
|
13569
|
+
// if (fieldType === 'object') {
|
|
13570
|
+
// value = await func.common.get_cast_val(SESSION_ID, 'xu-bind', 'value', input_field_type, bind.getter($elm[0]));
|
|
13571
|
+
// }
|
|
13529
13572
|
|
|
13530
|
-
|
|
13531
|
-
bind_field_id = await get_bind_field(val.value.split('.')[0]);
|
|
13532
|
-
val_is_reference_field = true;
|
|
13533
|
-
} catch (err) {
|
|
13534
|
-
console.error(err?.message || err);
|
|
13535
|
-
return {};
|
|
13536
|
-
}
|
|
13573
|
+
// if (!ds.currentRecordId) return;
|
|
13537
13574
|
|
|
13538
|
-
|
|
13539
|
-
|
|
13540
|
-
|
|
13541
|
-
const isCheckbox = input_field_type === 'checkbox';
|
|
13542
|
-
const isRadio = input_field_type === 'radio';
|
|
13543
|
-
|
|
13544
|
-
// Handle array field with checkbox
|
|
13545
|
-
if (fieldType === 'array' && isCheckbox && val_is_reference_field) {
|
|
13546
|
-
const arr_value = _.clone((await func.datasource.get_value(SESSION_ID, bind_field_id, _dsP, ds.currentRecordId)).ret.value);
|
|
13547
|
-
const value_from_getter = bind.getter($elm[0]);
|
|
13548
|
-
const value = arr_value.includes(value_from_getter) ? arr_value.filter((item) => !_.isEqual(item, value_from_getter)) : [...arr_value, value_from_getter];
|
|
13549
|
-
|
|
13550
|
-
return await func.datasource.update(SESSION_ID, {
|
|
13551
|
-
[_dsP]: { [ds.currentRecordId]: { [bind_field_id]: value } },
|
|
13552
|
-
});
|
|
13553
|
-
}
|
|
13575
|
+
// await func.datasource.update(SESSION_ID, {
|
|
13576
|
+
// [_dsP]: { [ds.currentRecordId]: { [bind_field_id]: value } },
|
|
13577
|
+
// });
|
|
13554
13578
|
|
|
13555
|
-
|
|
13556
|
-
|
|
13557
|
-
return await func.datasource.update(SESSION_ID, {
|
|
13558
|
-
[_dsP]: { [ds.currentRecordId]: { [bind_field_id]: [bind.getter($elm[0])] } },
|
|
13559
|
-
});
|
|
13560
|
-
}
|
|
13579
|
+
// const iterate_info = xuData?.iterate_info;
|
|
13580
|
+
// const reference_source_obj = iterate_info?.reference_source_obj;
|
|
13561
13581
|
|
|
13562
|
-
|
|
13582
|
+
// if (reference_source_obj?.ret?.type === 'array' && iterate_info.iterator_val === bind_field_id) {
|
|
13583
|
+
// const arr_idx = Number(iterate_info._key);
|
|
13584
|
+
// const dataset_arr = await func.datasource.get_value(SESSION_ID, reference_source_obj.fieldIdP, _dsP, reference_source_obj.currentRecordId);
|
|
13585
|
+
// const new_arr = _.cloneDeep(dataset_arr.ret.value);
|
|
13563
13586
|
|
|
13564
|
-
|
|
13565
|
-
|
|
13566
|
-
|
|
13587
|
+
// if (fieldType === 'object' && val_is_reference_field) {
|
|
13588
|
+
// let obj_item = new_arr[arr_idx];
|
|
13589
|
+
// const e_exp = val.value.replace(bind_field_id, 'obj_item');
|
|
13590
|
+
// eval(e_exp + (input_field_type === 'string' ? `="${value}"` : `=${value}`));
|
|
13591
|
+
// new_arr[arr_idx] = obj_item;
|
|
13592
|
+
// } else {
|
|
13593
|
+
// new_arr[arr_idx] = value;
|
|
13594
|
+
// }
|
|
13567
13595
|
|
|
13568
|
-
|
|
13596
|
+
// await func.datasource.update(
|
|
13597
|
+
// SESSION_ID,
|
|
13598
|
+
// {
|
|
13599
|
+
// [_dsP]: { [ds.currentRecordId]: { [reference_source_obj.fieldIdP]: new_arr } },
|
|
13600
|
+
// },
|
|
13601
|
+
// null,
|
|
13602
|
+
// true,
|
|
13603
|
+
// );
|
|
13604
|
+
// }
|
|
13569
13605
|
|
|
13570
|
-
|
|
13571
|
-
|
|
13572
|
-
});
|
|
13606
|
+
// await func.datasource.update_changes_for_out_parameter(SESSION_ID, _dsP, ds.parentDataSourceNo);
|
|
13607
|
+
// };
|
|
13573
13608
|
|
|
13574
|
-
|
|
13575
|
-
|
|
13609
|
+
// const bind = new UI_FRAMEWORK_PLUGIN.bind();
|
|
13610
|
+
// bind.listener($elm[0], field_changed);
|
|
13576
13611
|
|
|
13577
|
-
|
|
13578
|
-
|
|
13579
|
-
|
|
13580
|
-
const new_arr = _.cloneDeep(dataset_arr.ret.value);
|
|
13612
|
+
// const set_value = function () {
|
|
13613
|
+
// const ds = _session.DS_GLB[paramsP.dsSessionP];
|
|
13614
|
+
// if (!ds.currentRecordId) return;
|
|
13581
13615
|
|
|
13582
|
-
|
|
13583
|
-
|
|
13584
|
-
|
|
13585
|
-
|
|
13586
|
-
|
|
13587
|
-
|
|
13588
|
-
|
|
13589
|
-
|
|
13616
|
+
// try {
|
|
13617
|
+
// let value;
|
|
13618
|
+
// if (val_is_reference_field) {
|
|
13619
|
+
// if (is_dynamic_field) {
|
|
13620
|
+
// value = ds.dynamic_fields[bind_field_id].value;
|
|
13621
|
+
// } else {
|
|
13622
|
+
// const row_idx = func.common.find_ROWID_idx(ds, ds.currentRecordId);
|
|
13623
|
+
// value = ds.data_feed.rows?.[row_idx]?.[bind_field_id];
|
|
13624
|
+
// }
|
|
13590
13625
|
|
|
13591
|
-
|
|
13592
|
-
|
|
13593
|
-
{
|
|
13594
|
-
[_dsP]: { [ds.currentRecordId]: { [reference_source_obj.fieldIdP]: new_arr } },
|
|
13595
|
-
},
|
|
13596
|
-
null,
|
|
13597
|
-
true,
|
|
13598
|
-
);
|
|
13599
|
-
}
|
|
13626
|
+
// const fieldType = field_prop.props.fieldType;
|
|
13627
|
+
// const elmValue = $elm.attr('value');
|
|
13600
13628
|
|
|
13601
|
-
|
|
13602
|
-
|
|
13629
|
+
// if (fieldType === 'array' && input_field_type === 'checkbox' && elmValue) {
|
|
13630
|
+
// value = value.includes(elmValue);
|
|
13631
|
+
// } else if (fieldType === 'array' && input_field_type === 'radio' && elmValue) {
|
|
13632
|
+
// value = value.includes(elmValue) ? elmValue : false;
|
|
13633
|
+
// } else if (fieldType === 'object' && val.value.split('.').length > 1) {
|
|
13634
|
+
// value = eval(val.value.replace(bind_field_id, '(' + JSON.stringify(value) + ')'));
|
|
13635
|
+
// }
|
|
13636
|
+
// } else {
|
|
13637
|
+
// value = val.value;
|
|
13638
|
+
// }
|
|
13603
13639
|
|
|
13604
|
-
|
|
13605
|
-
|
|
13640
|
+
// if (value !== undefined) {
|
|
13641
|
+
// bind.setter($elm[0], value);
|
|
13642
|
+
// }
|
|
13643
|
+
// } catch (err) {
|
|
13644
|
+
// console.error(err);
|
|
13645
|
+
// }
|
|
13646
|
+
// };
|
|
13606
13647
|
|
|
13607
|
-
|
|
13608
|
-
|
|
13609
|
-
|
|
13648
|
+
// $('body').on('xu-bind-refresh.' + _ds.dsSession, set_value);
|
|
13649
|
+
// set_value();
|
|
13650
|
+
// return {};
|
|
13651
|
+
// },
|
|
13652
|
+
|
|
13653
|
+
// 'xu-render': async function ($elm, val, from_panel) {
|
|
13654
|
+
// const value = await func.common.get_cast_val(SESSION_ID, 'common fx', 'xu-render', 'bool', val.value);
|
|
13655
|
+
|
|
13656
|
+
// if (!glb.new_xu_render) {
|
|
13657
|
+
// // Old render logic (kept as is for compatibility)
|
|
13658
|
+
// const init_render = function () {
|
|
13659
|
+
// if (!value) {
|
|
13660
|
+
// const cloned_$div = $elm.clone(true);
|
|
13661
|
+
// const $xurender = $('<xurender>').attr('xu-ui-id', $elm.attr('xu-ui-id')).attr('hidden', true).appendTo($container);
|
|
13662
|
+
// const original_data_obj = {
|
|
13663
|
+
// $container: cloned_$div,
|
|
13664
|
+
// nodeP: _.cloneDeep(nodeP),
|
|
13665
|
+
// parent_infoP,
|
|
13666
|
+
// paramsP,
|
|
13667
|
+
// keyP,
|
|
13668
|
+
// parent_nodeP,
|
|
13669
|
+
// $root_container,
|
|
13670
|
+
// };
|
|
13671
|
+
// $xurender.data('xuData', cloned_$div.data().xuData);
|
|
13672
|
+
// $xurender.data().xuData.original_data_obj = original_data_obj;
|
|
13673
|
+
// $xurender.data().xuData.xurender_node = cloned_$div;
|
|
13674
|
+
// $xurender.data().xuAttributes = nodeP.attributes || {};
|
|
13675
|
+
// $elm.remove();
|
|
13676
|
+
// return { abort: true };
|
|
13677
|
+
// }
|
|
13678
|
+
// return {};
|
|
13679
|
+
// };
|
|
13610
13680
|
|
|
13611
|
-
|
|
13612
|
-
|
|
13613
|
-
|
|
13614
|
-
|
|
13615
|
-
|
|
13616
|
-
|
|
13617
|
-
const row_idx = func.common.find_ROWID_idx(ds, ds.currentRecordId);
|
|
13618
|
-
value = ds.data_feed.rows?.[row_idx]?.[bind_field_id];
|
|
13619
|
-
}
|
|
13681
|
+
// const post_render = async function () {
|
|
13682
|
+
// if (value) {
|
|
13683
|
+
// try {
|
|
13684
|
+
// if ($elm[0].tagName !== 'XURENDER' || !$elm?.length) {
|
|
13685
|
+
// return func.events.delete_job(SESSION_ID, jobNoP);
|
|
13686
|
+
// }
|
|
13620
13687
|
|
|
13621
|
-
|
|
13622
|
-
|
|
13688
|
+
// const original_data_obj = $elm.data().xuData.original_data_obj;
|
|
13689
|
+
// if (!original_data_obj) {
|
|
13690
|
+
// func.events.delete_job(SESSION_ID, jobNoP);
|
|
13691
|
+
// return { delete_job: jobNoP };
|
|
13692
|
+
// }
|
|
13623
13693
|
|
|
13624
|
-
|
|
13625
|
-
|
|
13626
|
-
|
|
13627
|
-
|
|
13628
|
-
|
|
13629
|
-
|
|
13630
|
-
|
|
13631
|
-
|
|
13632
|
-
|
|
13633
|
-
|
|
13694
|
+
// const new_$div = await func.UI.screen.render_ui_tree(SESSION_ID, $elm, _.cloneDeep(original_data_obj.nodeP), original_data_obj.parent_infoP, original_data_obj.paramsP, jobNoP, null, original_data_obj.keyP, null, original_data_obj.parent_nodeP, null, original_data_obj.$root_container);
|
|
13695
|
+
|
|
13696
|
+
// new_$div.data().xuData.original_data_obj = original_data_obj;
|
|
13697
|
+
// new_$div.data().xuData.xurender_node = $elm.clone(true);
|
|
13698
|
+
// new_$div.data().xuAttributes = $elm.data().xuAttributes || {};
|
|
13699
|
+
|
|
13700
|
+
// const replace = async function () {
|
|
13701
|
+
// $elm.replaceWith(from_panel ? new_$div.children() : new_$div);
|
|
13702
|
+
// if (from_panel) {
|
|
13703
|
+
// $elm.parent().data().xuPanelWrapper = _.clone(new_$div.data().xuPanelWrapper);
|
|
13704
|
+
// }
|
|
13705
|
+
// if (val.fields_arr) {
|
|
13706
|
+
// return await func.UI.screen.refresh_xu_attributes(SESSION_ID, val.fields_arr, val.jobNoP, new_$div);
|
|
13707
|
+
// }
|
|
13708
|
+
// func.events.delete_job(SESSION_ID, jobNoP);
|
|
13709
|
+
// };
|
|
13634
13710
|
|
|
13635
|
-
|
|
13636
|
-
|
|
13637
|
-
|
|
13638
|
-
|
|
13639
|
-
|
|
13640
|
-
|
|
13641
|
-
|
|
13711
|
+
// if ($elm && $(`[xu-ui-id="${$elm.attr('xu-ui-id')}"]`).length && new_$div.data().xuData.paramsP) {
|
|
13712
|
+
// return await replace();
|
|
13713
|
+
// }
|
|
13714
|
+
// func.events.delete_job(SESSION_ID, jobNoP);
|
|
13715
|
+
// } catch (error) {
|
|
13716
|
+
// func.events.delete_job(SESSION_ID, jobNoP);
|
|
13717
|
+
// }
|
|
13718
|
+
// return;
|
|
13719
|
+
// }
|
|
13642
13720
|
|
|
13643
|
-
|
|
13644
|
-
|
|
13645
|
-
|
|
13646
|
-
|
|
13721
|
+
// if ($elm.prop('tagName') === 'XURENDER') {
|
|
13722
|
+
// func.events.delete_job(SESSION_ID, jobNoP);
|
|
13723
|
+
// return;
|
|
13724
|
+
// }
|
|
13647
13725
|
|
|
13648
|
-
|
|
13649
|
-
const value = await func.common.get_cast_val(SESSION_ID, 'common fx', 'xu-render', 'bool', val.value);
|
|
13726
|
+
// const $xurender = $('<xurender>').attr('xu-ui-id', $elm.attr('xu-ui-id'));
|
|
13650
13727
|
|
|
13651
|
-
|
|
13652
|
-
|
|
13653
|
-
|
|
13654
|
-
|
|
13655
|
-
|
|
13656
|
-
|
|
13657
|
-
|
|
13658
|
-
|
|
13659
|
-
|
|
13660
|
-
|
|
13661
|
-
|
|
13662
|
-
|
|
13663
|
-
|
|
13664
|
-
|
|
13665
|
-
|
|
13666
|
-
|
|
13667
|
-
|
|
13668
|
-
$xurender.data().xuData.xurender_node = cloned_$div;
|
|
13669
|
-
$xurender.data().xuAttributes = nodeP.attributes || {};
|
|
13670
|
-
$elm.remove();
|
|
13671
|
-
return { abort: true };
|
|
13672
|
-
}
|
|
13673
|
-
return {};
|
|
13674
|
-
};
|
|
13728
|
+
// if ($elm.data().xuData.xurender_node) {
|
|
13729
|
+
// $xurender.data({
|
|
13730
|
+
// xuAttributes: $elm.data().xuData.xurender_node.data().xuAttributes || {},
|
|
13731
|
+
// xuData: $elm.data().xuData.xurender_node.data().xuData || {},
|
|
13732
|
+
// });
|
|
13733
|
+
// } else {
|
|
13734
|
+
// $xurender.data({
|
|
13735
|
+
// xuAttributes: $elm.data().xuAttributes || {},
|
|
13736
|
+
// xuData: $elm.data().xuData || {},
|
|
13737
|
+
// });
|
|
13738
|
+
// $xurender.data().xuData.original_data_obj = {
|
|
13739
|
+
// nodeP: _.cloneDeep($elm.data().xuData.node_org),
|
|
13740
|
+
// paramsP: $elm.data().xuData.paramsP,
|
|
13741
|
+
// $container: $elm.clone(true),
|
|
13742
|
+
// parent_infoP: parent_infoP,
|
|
13743
|
+
// };
|
|
13744
|
+
// }
|
|
13675
13745
|
|
|
13676
|
-
|
|
13677
|
-
|
|
13678
|
-
|
|
13679
|
-
|
|
13680
|
-
return func.events.delete_job(SESSION_ID, jobNoP);
|
|
13681
|
-
}
|
|
13746
|
+
// $.each($elm.find('xu-teleport'), (key, val) => {
|
|
13747
|
+
// const xuTeleportData = $(val).data().xuTeleportData || [];
|
|
13748
|
+
// xuTeleportData.forEach((id) => $(`[xu-ui-id="${id}"]`).remove());
|
|
13749
|
+
// });
|
|
13682
13750
|
|
|
13683
|
-
|
|
13684
|
-
|
|
13685
|
-
|
|
13686
|
-
return { delete_job: jobNoP };
|
|
13687
|
-
}
|
|
13751
|
+
// $elm.replaceWith($xurender);
|
|
13752
|
+
// func.events.delete_job(SESSION_ID, jobNoP);
|
|
13753
|
+
// };
|
|
13688
13754
|
|
|
13689
|
-
|
|
13755
|
+
// return is_init ? init_render() : await post_render();
|
|
13756
|
+
// }
|
|
13690
13757
|
|
|
13691
|
-
|
|
13692
|
-
|
|
13693
|
-
|
|
13758
|
+
// // New render logic
|
|
13759
|
+
// const has_xu_render_attribute = true;
|
|
13760
|
+
// const has_xu_exp_render_attribute = !!xuData?.attr_exp_info?.['xu-render'];
|
|
13694
13761
|
|
|
13695
|
-
|
|
13696
|
-
|
|
13697
|
-
|
|
13698
|
-
|
|
13699
|
-
|
|
13700
|
-
|
|
13701
|
-
|
|
13702
|
-
}
|
|
13703
|
-
func.events.delete_job(SESSION_ID, jobNoP);
|
|
13704
|
-
};
|
|
13762
|
+
// const init_render = async function () {
|
|
13763
|
+
// nodeP.xu_render_made = value;
|
|
13764
|
+
// if (!value) {
|
|
13765
|
+
// return has_xu_exp_render_attribute ? { has_xu_exp_render_attribute, has_xu_render_attribute, xu_render_background_processing: true } : { has_xu_render_attribute, abort: true };
|
|
13766
|
+
// }
|
|
13767
|
+
// return { has_xu_exp_render_attribute, has_xu_render_attribute };
|
|
13768
|
+
// };
|
|
13705
13769
|
|
|
13706
|
-
|
|
13707
|
-
|
|
13708
|
-
|
|
13709
|
-
|
|
13710
|
-
|
|
13711
|
-
|
|
13712
|
-
|
|
13713
|
-
|
|
13714
|
-
|
|
13770
|
+
// const post_render = async function () {
|
|
13771
|
+
// const containerNodeP = $container.data().xuData.node.children[keyP];
|
|
13772
|
+
// containerNodeP.xu_render_made = value;
|
|
13773
|
+
|
|
13774
|
+
// if (value) {
|
|
13775
|
+
// try {
|
|
13776
|
+
// const xu_render_cache_id = await get_xu_render_cache_str(SESSION_ID, paramsP.dsSessionP, Object.keys(xuData?.attr_exp_info?.['xu-render']?.fields || {}));
|
|
13777
|
+
// const xu_ui_id = $elm.attr('xu-ui-id');
|
|
13778
|
+
// const cache_key = xu_ui_id + xu_render_cache_id;
|
|
13779
|
+
// let new_$div = UI_WORKER_OBJ?.xu_render_cache?.[cache_key]?.$div?.clone(true);
|
|
13780
|
+
// let found_parent_vars = false;
|
|
13781
|
+
|
|
13782
|
+
// if (new_$div) {
|
|
13783
|
+
// const parent_data = get_parent_ds_fields(SESSION_ID, paramsP.dsSessionP);
|
|
13784
|
+
// const parent_fields = Object.keys(parent_data);
|
|
13785
|
+
|
|
13786
|
+
// $.each(new_$div.find('*'), (key, val) => {
|
|
13787
|
+
// if (found_parent_vars) return;
|
|
13788
|
+
// const _xuAttributes = $(val)?.data()?.xuAttributes;
|
|
13789
|
+
// if (!_xuAttributes) return;
|
|
13790
|
+
|
|
13791
|
+
// for (const attr_val of Object.values(_xuAttributes)) {
|
|
13792
|
+
// if (parent_fields.some((field) => attr_val.includes('@' + field))) {
|
|
13793
|
+
// found_parent_vars = true;
|
|
13794
|
+
// break;
|
|
13795
|
+
// }
|
|
13796
|
+
// }
|
|
13797
|
+
// });
|
|
13798
|
+
// }
|
|
13715
13799
|
|
|
13716
|
-
|
|
13717
|
-
|
|
13718
|
-
|
|
13719
|
-
|
|
13800
|
+
// if (!new_$div || found_parent_vars) {
|
|
13801
|
+
// UI_WORKER_OBJ.xu_render_cache[cache_key] = { paramsP };
|
|
13802
|
+
// containerNodeP.xu_render_xu_ui_id = xu_ui_id;
|
|
13803
|
+
// containerNodeP.xu_render_cache_id = xu_render_cache_id;
|
|
13720
13804
|
|
|
13721
|
-
|
|
13805
|
+
// new_$div = await func.UI.screen.render_ui_tree(SESSION_ID, $container, containerNodeP, parent_infoP, paramsP, jobNoP, null, keyP, null, parent_nodeP, null, $root_container);
|
|
13722
13806
|
|
|
13723
|
-
|
|
13724
|
-
|
|
13725
|
-
|
|
13726
|
-
xuData: $elm.data().xuData.xurender_node.data().xuData || {},
|
|
13727
|
-
});
|
|
13728
|
-
} else {
|
|
13729
|
-
$xurender.data({
|
|
13730
|
-
xuAttributes: $elm.data().xuAttributes || {},
|
|
13731
|
-
xuData: $elm.data().xuData || {},
|
|
13732
|
-
});
|
|
13733
|
-
$xurender.data().xuData.original_data_obj = {
|
|
13734
|
-
nodeP: _.cloneDeep($elm.data().xuData.node_org),
|
|
13735
|
-
paramsP: $elm.data().xuData.paramsP,
|
|
13736
|
-
$container: $elm.clone(true),
|
|
13737
|
-
parent_infoP: parent_infoP,
|
|
13738
|
-
};
|
|
13739
|
-
}
|
|
13807
|
+
// const _$div = new_$div.clone(true);
|
|
13808
|
+
// UI_WORKER_OBJ.xu_render_cache[cache_key] = { $div: _$div, data: _$div.data(), paramsP };
|
|
13809
|
+
// }
|
|
13740
13810
|
|
|
13741
|
-
|
|
13742
|
-
|
|
13743
|
-
|
|
13744
|
-
|
|
13811
|
+
// // Append order handling
|
|
13812
|
+
// if (!$container.children().length) {
|
|
13813
|
+
// new_$div.appendTo($container);
|
|
13814
|
+
// } else {
|
|
13815
|
+
// let $last_elm_found = [];
|
|
13816
|
+
// $.each($container.data().xuData.node.children, (item_key, item_val) => {
|
|
13817
|
+
// const $elm = func.UI.utils.find_in_element_data('xuData', $(_session.root_element), 'nodeid', item_val.id);
|
|
13818
|
+
// if ($elm.length) $last_elm_found = $elm;
|
|
13819
|
+
// if (keyP == item_key) {
|
|
13820
|
+
// $last_elm_found.length ? new_$div.after($last_elm_found) : $container.prepend(new_$div);
|
|
13821
|
+
// }
|
|
13822
|
+
// });
|
|
13823
|
+
// }
|
|
13824
|
+
// } catch (error) {
|
|
13825
|
+
// func.events.delete_job(SESSION_ID, jobNoP);
|
|
13826
|
+
// }
|
|
13827
|
+
// return;
|
|
13828
|
+
// }
|
|
13745
13829
|
|
|
13746
|
-
|
|
13747
|
-
|
|
13748
|
-
|
|
13830
|
+
// // !value
|
|
13831
|
+
// const xu_ui_id = $elm.attr('xu-ui-id');
|
|
13832
|
+
// const cache_str = await get_xu_render_cache_str(SESSION_ID, paramsP.dsSessionP, Object.keys(xuData?.attr_exp_info?.['xu-render']?.fields || {}));
|
|
13833
|
+
// const _$div = $elm.clone(true);
|
|
13834
|
+
// UI_WORKER_OBJ.xu_render_cache[xu_ui_id + cache_str] = { $div: _$div, data: _$div.data(), paramsP };
|
|
13835
|
+
// $elm.remove();
|
|
13836
|
+
// func.events.delete_job(SESSION_ID, jobNoP);
|
|
13837
|
+
// };
|
|
13749
13838
|
|
|
13750
|
-
|
|
13751
|
-
|
|
13839
|
+
// return is_init ? await init_render() : await post_render();
|
|
13840
|
+
// },
|
|
13752
13841
|
|
|
13753
|
-
|
|
13754
|
-
|
|
13755
|
-
|
|
13842
|
+
// 'xu-show': async function ($elm, val) {
|
|
13843
|
+
// const value = await func.common.get_cast_val(SESSION_ID, 'common fx', 'xu-show', 'bool', val.value);
|
|
13844
|
+
// $elm.toggle(value);
|
|
13845
|
+
// return {};
|
|
13846
|
+
// },
|
|
13756
13847
|
|
|
13757
|
-
|
|
13758
|
-
|
|
13759
|
-
|
|
13760
|
-
|
|
13761
|
-
|
|
13762
|
-
|
|
13763
|
-
|
|
13848
|
+
// 'xu-content': async function ($elm, val) {
|
|
13849
|
+
// try {
|
|
13850
|
+
// $elm.html(val.value);
|
|
13851
|
+
// } catch (error) {
|
|
13852
|
+
// console.warn(error);
|
|
13853
|
+
// }
|
|
13854
|
+
// },
|
|
13764
13855
|
|
|
13765
|
-
|
|
13766
|
-
|
|
13767
|
-
|
|
13856
|
+
// 'xu-text': async function ($elm, val) {
|
|
13857
|
+
// try {
|
|
13858
|
+
// $elm.text(val.value);
|
|
13859
|
+
// } catch (error) {
|
|
13860
|
+
// console.warn(error);
|
|
13861
|
+
// }
|
|
13862
|
+
// },
|
|
13768
13863
|
|
|
13769
|
-
|
|
13770
|
-
|
|
13771
|
-
|
|
13772
|
-
|
|
13773
|
-
|
|
13774
|
-
|
|
13775
|
-
|
|
13776
|
-
|
|
13777
|
-
if (new_$div) {
|
|
13778
|
-
const parent_data = get_parent_ds_fields(SESSION_ID, paramsP.dsSessionP);
|
|
13779
|
-
const parent_fields = Object.keys(parent_data);
|
|
13780
|
-
|
|
13781
|
-
$.each(new_$div.find('*'), (key, val) => {
|
|
13782
|
-
if (found_parent_vars) return;
|
|
13783
|
-
const _xuAttributes = $(val)?.data()?.xuAttributes;
|
|
13784
|
-
if (!_xuAttributes) return;
|
|
13785
|
-
|
|
13786
|
-
for (const attr_val of Object.values(_xuAttributes)) {
|
|
13787
|
-
if (parent_fields.some((field) => attr_val.includes('@' + field))) {
|
|
13788
|
-
found_parent_vars = true;
|
|
13789
|
-
break;
|
|
13790
|
-
}
|
|
13791
|
-
}
|
|
13792
|
-
});
|
|
13793
|
-
}
|
|
13864
|
+
// 'xu-html': async function ($elm, val) {
|
|
13865
|
+
// try {
|
|
13866
|
+
// $elm.html(val.value);
|
|
13867
|
+
// } catch (error) {
|
|
13868
|
+
// console.warn(error);
|
|
13869
|
+
// }
|
|
13870
|
+
// },
|
|
13794
13871
|
|
|
13795
|
-
|
|
13796
|
-
|
|
13797
|
-
containerNodeP.xu_render_xu_ui_id = xu_ui_id;
|
|
13798
|
-
containerNodeP.xu_render_cache_id = xu_render_cache_id;
|
|
13872
|
+
// 'xu-for': async function ($elm, data) {
|
|
13873
|
+
// if (parent_infoP?.iterate_info || !data.value) return {};
|
|
13799
13874
|
|
|
13800
|
-
|
|
13875
|
+
// try {
|
|
13876
|
+
// let arr = data.value;
|
|
13877
|
+
// let reference_source_obj;
|
|
13878
|
+
// const _progFields = await func.datasource.get_progFields(SESSION_ID, paramsP.dsSessionP);
|
|
13879
|
+
// const view_field_obj = func.common.find_item_by_key(_progFields, 'field_id', data.value);
|
|
13880
|
+
|
|
13881
|
+
// if (view_field_obj) {
|
|
13882
|
+
// reference_source_obj = await func.datasource.get_value(SESSION_ID, data.value, paramsP.dsSessionP);
|
|
13883
|
+
// arr = reference_source_obj?.ret?.value;
|
|
13884
|
+
// } else {
|
|
13885
|
+
// if (typeof data.value === 'string') {
|
|
13886
|
+
// arr = eval(data.value.replaceAll('\\', ''));
|
|
13887
|
+
// }
|
|
13888
|
+
// if (typeof arr === 'number') {
|
|
13889
|
+
// arr = Array.from(Array(arr).keys());
|
|
13890
|
+
// }
|
|
13891
|
+
// }
|
|
13801
13892
|
|
|
13802
|
-
|
|
13803
|
-
|
|
13804
|
-
|
|
13893
|
+
// const custom_iterator_key = xuData.iterator_key;
|
|
13894
|
+
// const custom_iterator_val = xuData.iterator_val;
|
|
13895
|
+
// const iterator_key = custom_iterator_key || '_FOR_KEY';
|
|
13896
|
+
// const iterator_val = custom_iterator_val || '_FOR_VAL';
|
|
13897
|
+
// const is_key_dynamic_field = !custom_iterator_key;
|
|
13898
|
+
// const is_val_dynamic_field = !custom_iterator_val;
|
|
13805
13899
|
|
|
13806
|
-
|
|
13807
|
-
|
|
13808
|
-
|
|
13809
|
-
|
|
13810
|
-
|
|
13811
|
-
|
|
13812
|
-
|
|
13813
|
-
|
|
13814
|
-
|
|
13815
|
-
|
|
13816
|
-
|
|
13817
|
-
|
|
13818
|
-
|
|
13819
|
-
|
|
13820
|
-
|
|
13821
|
-
|
|
13822
|
-
|
|
13823
|
-
|
|
13824
|
-
|
|
13825
|
-
|
|
13826
|
-
const xu_ui_id = $elm.attr('xu-ui-id');
|
|
13827
|
-
const cache_str = await get_xu_render_cache_str(SESSION_ID, paramsP.dsSessionP, Object.keys(xuData?.attr_exp_info?.['xu-render']?.fields || {}));
|
|
13828
|
-
const _$div = $elm.clone(true);
|
|
13829
|
-
UI_WORKER_OBJ.xu_render_cache[xu_ui_id + cache_str] = { $div: _$div, data: _$div.data(), paramsP };
|
|
13830
|
-
$elm.remove();
|
|
13831
|
-
func.events.delete_job(SESSION_ID, jobNoP);
|
|
13832
|
-
};
|
|
13833
|
-
|
|
13834
|
-
return is_init ? await init_render() : await post_render();
|
|
13835
|
-
},
|
|
13836
|
-
|
|
13837
|
-
'xu-show': async function ($elm, val) {
|
|
13838
|
-
const value = await func.common.get_cast_val(SESSION_ID, 'common fx', 'xu-show', 'bool', val.value);
|
|
13839
|
-
$elm.toggle(value);
|
|
13840
|
-
return {};
|
|
13841
|
-
},
|
|
13842
|
-
|
|
13843
|
-
'xu-content': async function ($elm, val) {
|
|
13844
|
-
try {
|
|
13845
|
-
$elm.html(val.value);
|
|
13846
|
-
} catch (error) {
|
|
13847
|
-
console.warn(error);
|
|
13848
|
-
}
|
|
13849
|
-
},
|
|
13850
|
-
|
|
13851
|
-
'xu-text': async function ($elm, val) {
|
|
13852
|
-
try {
|
|
13853
|
-
$elm.text(val.value);
|
|
13854
|
-
} catch (error) {
|
|
13855
|
-
console.warn(error);
|
|
13856
|
-
}
|
|
13857
|
-
},
|
|
13858
|
-
|
|
13859
|
-
'xu-html': async function ($elm, val) {
|
|
13860
|
-
try {
|
|
13861
|
-
$elm.html(val.value);
|
|
13862
|
-
} catch (error) {
|
|
13863
|
-
console.warn(error);
|
|
13864
|
-
}
|
|
13865
|
-
},
|
|
13866
|
-
|
|
13867
|
-
'xu-for': async function ($elm, data) {
|
|
13868
|
-
if (parent_infoP?.iterate_info || !data.value) return {};
|
|
13869
|
-
|
|
13870
|
-
try {
|
|
13871
|
-
let arr = data.value;
|
|
13872
|
-
let reference_source_obj;
|
|
13873
|
-
const _progFields = await func.datasource.get_progFields(SESSION_ID, paramsP.dsSessionP);
|
|
13874
|
-
const view_field_obj = func.common.find_item_by_key(_progFields, 'field_id', data.value);
|
|
13875
|
-
|
|
13876
|
-
if (view_field_obj) {
|
|
13877
|
-
reference_source_obj = await func.datasource.get_value(SESSION_ID, data.value, paramsP.dsSessionP);
|
|
13878
|
-
arr = reference_source_obj?.ret?.value;
|
|
13879
|
-
} else {
|
|
13880
|
-
if (typeof data.value === 'string') {
|
|
13881
|
-
arr = eval(data.value.replaceAll('\\', ''));
|
|
13882
|
-
}
|
|
13883
|
-
if (typeof arr === 'number') {
|
|
13884
|
-
arr = Array.from(Array(arr).keys());
|
|
13885
|
-
}
|
|
13886
|
-
}
|
|
13887
|
-
|
|
13888
|
-
const custom_iterator_key = xuData.iterator_key;
|
|
13889
|
-
const custom_iterator_val = xuData.iterator_val;
|
|
13890
|
-
const iterator_key = custom_iterator_key || '_FOR_KEY';
|
|
13891
|
-
const iterator_val = custom_iterator_val || '_FOR_VAL';
|
|
13892
|
-
const is_key_dynamic_field = !custom_iterator_key;
|
|
13893
|
-
const is_val_dynamic_field = !custom_iterator_val;
|
|
13894
|
-
|
|
13895
|
-
const set_value = async function (is_dynamic_field, currentRecordId, field_id, value) {
|
|
13896
|
-
if (is_dynamic_field) {
|
|
13897
|
-
func.datasource.add_dynamic_field_to_ds(SESSION_ID, paramsP.dsSessionP, field_id, value);
|
|
13898
|
-
} else {
|
|
13899
|
-
const _progFields = await func.datasource.get_progFields(SESSION_ID, paramsP.dsSessionP);
|
|
13900
|
-
const view_field_obj = func.common.find_item_by_key(_progFields, 'field_id', field_id);
|
|
13901
|
-
|
|
13902
|
-
if (view_field_obj) {
|
|
13903
|
-
const ds = _session.DS_GLB[paramsP.dsSessionP];
|
|
13904
|
-
try {
|
|
13905
|
-
const row_idx = func.common.find_ROWID_idx(ds, currentRecordId);
|
|
13906
|
-
ds.data_feed.rows[row_idx][field_id] = value;
|
|
13907
|
-
} catch (err) {
|
|
13908
|
-
console.error(err);
|
|
13909
|
-
}
|
|
13910
|
-
} else {
|
|
13911
|
-
console.error('field not exist in dataset for xu-for method');
|
|
13912
|
-
}
|
|
13913
|
-
}
|
|
13914
|
-
};
|
|
13915
|
-
|
|
13916
|
-
const currentRecordId = _ds.currentRecordId.toString();
|
|
13917
|
-
let i = 0;
|
|
13918
|
-
|
|
13919
|
-
for (let [_key, _val] of Object.entries(arr)) {
|
|
13920
|
-
if (_.isArray(arr)) _key = Number(_key);
|
|
13900
|
+
// const set_value = async function (is_dynamic_field, currentRecordId, field_id, value) {
|
|
13901
|
+
// if (is_dynamic_field) {
|
|
13902
|
+
// func.datasource.add_dynamic_field_to_ds(SESSION_ID, paramsP.dsSessionP, field_id, value);
|
|
13903
|
+
// } else {
|
|
13904
|
+
// const _progFields = await func.datasource.get_progFields(SESSION_ID, paramsP.dsSessionP);
|
|
13905
|
+
// const view_field_obj = func.common.find_item_by_key(_progFields, 'field_id', field_id);
|
|
13906
|
+
|
|
13907
|
+
// if (view_field_obj) {
|
|
13908
|
+
// const ds = _session.DS_GLB[paramsP.dsSessionP];
|
|
13909
|
+
// try {
|
|
13910
|
+
// const row_idx = func.common.find_ROWID_idx(ds, currentRecordId);
|
|
13911
|
+
// ds.data_feed.rows[row_idx][field_id] = value;
|
|
13912
|
+
// } catch (err) {
|
|
13913
|
+
// console.error(err);
|
|
13914
|
+
// }
|
|
13915
|
+
// } else {
|
|
13916
|
+
// console.error('field not exist in dataset for xu-for method');
|
|
13917
|
+
// }
|
|
13918
|
+
// }
|
|
13919
|
+
// };
|
|
13921
13920
|
|
|
13922
|
-
|
|
13923
|
-
|
|
13921
|
+
// const currentRecordId = _ds.currentRecordId.toString();
|
|
13922
|
+
// let i = 0;
|
|
13924
13923
|
|
|
13925
|
-
|
|
13926
|
-
|
|
13927
|
-
_key,
|
|
13928
|
-
iterator_key,
|
|
13929
|
-
iterator_val,
|
|
13930
|
-
is_key_dynamic_field,
|
|
13931
|
-
is_val_dynamic_field,
|
|
13932
|
-
reference_source_obj,
|
|
13933
|
-
};
|
|
13924
|
+
// for (let [_key, _val] of Object.entries(arr)) {
|
|
13925
|
+
// if (_.isArray(arr)) _key = Number(_key);
|
|
13934
13926
|
|
|
13935
|
-
|
|
13936
|
-
|
|
13927
|
+
// await set_value(is_key_dynamic_field, currentRecordId, iterator_key, _key);
|
|
13928
|
+
// await set_value(is_val_dynamic_field, currentRecordId, iterator_val, _val);
|
|
13937
13929
|
|
|
13938
|
-
|
|
13930
|
+
// const iterate_info = {
|
|
13931
|
+
// _val,
|
|
13932
|
+
// _key,
|
|
13933
|
+
// iterator_key,
|
|
13934
|
+
// iterator_val,
|
|
13935
|
+
// is_key_dynamic_field,
|
|
13936
|
+
// is_val_dynamic_field,
|
|
13937
|
+
// reference_source_obj,
|
|
13938
|
+
// };
|
|
13939
13939
|
|
|
13940
|
-
|
|
13941
|
-
|
|
13942
|
-
$(val).data().xuData.iterate_info = iterate_info;
|
|
13943
|
-
}
|
|
13944
|
-
});
|
|
13940
|
+
// const _parent_info = klona.klona(parent_infoP) || {};
|
|
13941
|
+
// _parent_info.iterate_info = iterate_info;
|
|
13945
13942
|
|
|
13946
|
-
|
|
13947
|
-
}
|
|
13943
|
+
// const $divP = await func.UI.screen.render_ui_tree(SESSION_ID, $container, nodeP, _parent_info, paramsP, jobNoP, null, i, null, nodeP, null, $root_container);
|
|
13948
13944
|
|
|
13949
|
-
|
|
13950
|
-
|
|
13951
|
-
|
|
13952
|
-
|
|
13953
|
-
|
|
13954
|
-
}
|
|
13955
|
-
},
|
|
13956
|
-
|
|
13957
|
-
'xu-for-key': async function ($elm, val) {
|
|
13958
|
-
xuData.iterator_key = val.value;
|
|
13959
|
-
return {};
|
|
13960
|
-
},
|
|
13961
|
-
|
|
13962
|
-
'xu-for-val': async function ($elm, val) {
|
|
13963
|
-
xuData.iterator_val = val.value;
|
|
13964
|
-
return {};
|
|
13965
|
-
},
|
|
13966
|
-
|
|
13967
|
-
'xu-class': async function ($elm, val) {
|
|
13968
|
-
try {
|
|
13969
|
-
const classes_obj = _.isString(val.value) ? JSON.parse(val.value) : _.defaults(val.value, {});
|
|
13970
|
-
|
|
13971
|
-
for (const [cla, cond] of Object.entries(classes_obj)) {
|
|
13972
|
-
const res = await func.expression.get(SESSION_ID, cond, paramsP.dsSessionP, 'UI Attr EXP', xuData.currentRecordId, null, null, null, null, null, xuData.iterate_info);
|
|
13973
|
-
|
|
13974
|
-
$elm.toggleClass(cla, res.result);
|
|
13975
|
-
}
|
|
13945
|
+
// $.each($divP.children(), (key, val) => {
|
|
13946
|
+
// if ($(val)?.data()?.xuData) {
|
|
13947
|
+
// $(val).data().xuData.iterate_info = iterate_info;
|
|
13948
|
+
// }
|
|
13949
|
+
// });
|
|
13976
13950
|
|
|
13977
|
-
|
|
13978
|
-
|
|
13979
|
-
} catch (e) {
|
|
13980
|
-
console.warn('parse error:' + val.value);
|
|
13981
|
-
return { abort: true };
|
|
13982
|
-
}
|
|
13983
|
-
},
|
|
13951
|
+
// i++;
|
|
13952
|
+
// }
|
|
13984
13953
|
|
|
13985
|
-
|
|
13986
|
-
|
|
13987
|
-
|
|
13954
|
+
// $elm.remove();
|
|
13955
|
+
// return { abort: true };
|
|
13956
|
+
// } catch (e) {
|
|
13957
|
+
// console.error('Iterator Arr parse error', e);
|
|
13958
|
+
// return { abort: true };
|
|
13959
|
+
// }
|
|
13960
|
+
// },
|
|
13988
13961
|
|
|
13989
|
-
|
|
13990
|
-
|
|
13962
|
+
// 'xu-for-key': async function ($elm, val) {
|
|
13963
|
+
// xuData.iterator_key = val.value;
|
|
13964
|
+
// return {};
|
|
13965
|
+
// },
|
|
13991
13966
|
|
|
13992
|
-
|
|
13993
|
-
|
|
13994
|
-
|
|
13995
|
-
|
|
13996
|
-
console.warn(`attribute ${new_val.key} not found for ${nodeTag}`);
|
|
13997
|
-
return {};
|
|
13998
|
-
}
|
|
13967
|
+
// 'xu-for-val': async function ($elm, val) {
|
|
13968
|
+
// xuData.iterator_val = val.value;
|
|
13969
|
+
// return {};
|
|
13970
|
+
// },
|
|
13999
13971
|
|
|
14000
|
-
|
|
14001
|
-
|
|
13972
|
+
// 'xu-class': async function ($elm, val) {
|
|
13973
|
+
// try {
|
|
13974
|
+
// const classes_obj = _.isString(val.value) ? JSON.parse(val.value) : _.defaults(val.value, {});
|
|
14002
13975
|
|
|
14003
|
-
|
|
14004
|
-
|
|
13976
|
+
// for (const [cla, cond] of Object.entries(classes_obj)) {
|
|
13977
|
+
// const res = await func.expression.get(SESSION_ID, cond, paramsP.dsSessionP, 'UI Attr EXP', xuData.currentRecordId, null, null, null, null, null, xuData.iterate_info);
|
|
14005
13978
|
|
|
14006
|
-
|
|
14007
|
-
|
|
14008
|
-
}
|
|
13979
|
+
// $elm.toggleClass(cla, res.result);
|
|
13980
|
+
// }
|
|
14009
13981
|
|
|
14010
|
-
|
|
14011
|
-
|
|
14012
|
-
|
|
13982
|
+
// xuData.debug_info.attribute_stat['xu-class'] = $elm.attr('class');
|
|
13983
|
+
// return {};
|
|
13984
|
+
// } catch (e) {
|
|
13985
|
+
// console.warn('parse error:' + val.value);
|
|
13986
|
+
// return { abort: true };
|
|
13987
|
+
// }
|
|
13988
|
+
// },
|
|
14013
13989
|
|
|
14014
|
-
|
|
14015
|
-
|
|
14016
|
-
|
|
13990
|
+
// 'xu-exp': async function ($elm, val) {
|
|
13991
|
+
// const exp = val.value === null ? true : val.value;
|
|
13992
|
+
// const exp_ret = await func.expression.get(SESSION_ID, exp, paramsP.dsSessionP, 'UI Attr EXP', _ds.currentRecordId, null, null, null, null, null, xuData.iterate_info);
|
|
14017
13993
|
|
|
14018
|
-
|
|
14019
|
-
|
|
14020
|
-
const xuAttributes = _$elm.data().xuAttributes;
|
|
14021
|
-
if (_.isEmpty(xuAttributes)) return;
|
|
13994
|
+
// const value = func.UI.screen.fix_val_defaults(val.key, exp_ret.result);
|
|
13995
|
+
// const new_val = { key: val.key, value };
|
|
14022
13996
|
|
|
14023
|
-
|
|
14024
|
-
|
|
13997
|
+
// if (isXuTag) {
|
|
13998
|
+
// if (tag_fx[nodeTag]?.[new_val.key]) {
|
|
13999
|
+
// return await tag_fx[nodeTag][new_val.key]($elm, new_val);
|
|
14000
|
+
// }
|
|
14001
|
+
// console.warn(`attribute ${new_val.key} not found for ${nodeTag}`);
|
|
14002
|
+
// return {};
|
|
14003
|
+
// }
|
|
14025
14004
|
|
|
14026
|
-
|
|
14027
|
-
|
|
14028
|
-
const expCond = await func.expression.get(SESSION_ID, val.props.condition, paramsP.dsSessionP, 'condition', paramsP.recordid);
|
|
14029
|
-
if (!expCond.result) continue;
|
|
14030
|
-
}
|
|
14005
|
+
// if (!xuData) return {};
|
|
14006
|
+
// xuData.debug_info.attribute_stat[new_val.key] = new_val.value;
|
|
14031
14007
|
|
|
14032
|
-
|
|
14033
|
-
|
|
14034
|
-
}
|
|
14008
|
+
// if (new_val.value === undefined || new_val.value === null) return {};
|
|
14009
|
+
// if (glb.solid_attributes.includes(new_val.key) && !new_val.value) return {};
|
|
14035
14010
|
|
|
14036
|
-
|
|
14037
|
-
|
|
14038
|
-
|
|
14011
|
+
// if (new_val.key.startsWith('xu')) {
|
|
14012
|
+
// return await common_fx[new_val.key]($elm, new_val);
|
|
14013
|
+
// }
|
|
14039
14014
|
|
|
14040
|
-
|
|
14041
|
-
|
|
14042
|
-
|
|
14043
|
-
}
|
|
14044
|
-
});
|
|
14045
|
-
return {};
|
|
14046
|
-
},
|
|
14015
|
+
// $elm.attr(new_val.key, ($elm.attr(new_val.key) || '') + new_val.value);
|
|
14016
|
+
// return {};
|
|
14017
|
+
// },
|
|
14047
14018
|
|
|
14048
|
-
|
|
14049
|
-
|
|
14050
|
-
|
|
14051
|
-
try {
|
|
14052
|
-
const fn = eval(`async (el)=>{${val.value}}`);
|
|
14053
|
-
await fn($elm[0]);
|
|
14054
|
-
} catch (e) {
|
|
14055
|
-
eval(val.value);
|
|
14056
|
-
}
|
|
14057
|
-
clearInterval(checkExist);
|
|
14058
|
-
}
|
|
14059
|
-
}, 100);
|
|
14060
|
-
return {};
|
|
14061
|
-
},
|
|
14019
|
+
// 'xu-on': async function ($elm, val) {
|
|
14020
|
+
// CLIENT_ACTIVITY_TS = Date.now();
|
|
14021
|
+
// const trigger = val.key.split('xu-on:')[1].toLowerCase();
|
|
14062
14022
|
|
|
14063
|
-
|
|
14064
|
-
|
|
14065
|
-
|
|
14066
|
-
|
|
14023
|
+
// $elm.on(trigger, async function (evt) {
|
|
14024
|
+
// const _$elm = $(evt.currentTarget);
|
|
14025
|
+
// const xuAttributes = _$elm.data().xuAttributes;
|
|
14026
|
+
// if (_.isEmpty(xuAttributes)) return;
|
|
14067
14027
|
|
|
14068
|
-
|
|
14069
|
-
|
|
14070
|
-
const parsed = parser.parseCSS(val.value);
|
|
14071
|
-
const xuUiId = `[xu-ui-id="${$elm.attr('xu-ui-id')}"]`;
|
|
14072
|
-
|
|
14073
|
-
parsed.forEach((rule) => {
|
|
14074
|
-
rule.selector = rule.selector
|
|
14075
|
-
.split(',')
|
|
14076
|
-
.map((sel) => `${xuUiId} ${sel}, ${xuUiId}${sel}`)
|
|
14077
|
-
.join(',');
|
|
14078
|
-
});
|
|
14028
|
+
// const handlers = xuAttributes['xu-on:' + evt.type];
|
|
14029
|
+
// if (!handlers) return;
|
|
14079
14030
|
|
|
14080
|
-
|
|
14081
|
-
|
|
14082
|
-
|
|
14031
|
+
// for (const [key, val] of Object.entries(handlers)) {
|
|
14032
|
+
// if (!_.isEmpty(val.props.condition)) {
|
|
14033
|
+
// const expCond = await func.expression.get(SESSION_ID, val.props.condition, paramsP.dsSessionP, 'condition', paramsP.recordid);
|
|
14034
|
+
// if (!expCond.result) continue;
|
|
14035
|
+
// }
|
|
14083
14036
|
|
|
14084
|
-
|
|
14085
|
-
|
|
14086
|
-
|
|
14087
|
-
}
|
|
14088
|
-
return {};
|
|
14089
|
-
},
|
|
14037
|
+
// if (val.event_modifiers && evt[val.event_modifiers]) {
|
|
14038
|
+
// evt[val.event_modifiers]();
|
|
14039
|
+
// }
|
|
14090
14040
|
|
|
14091
|
-
|
|
14092
|
-
|
|
14093
|
-
|
|
14041
|
+
// if (val.workflow) {
|
|
14042
|
+
// for (const [key2, val2] of Object.entries(val.workflow)) {
|
|
14043
|
+
// if (!val2.data.enabled) continue;
|
|
14094
14044
|
|
|
14095
|
-
|
|
14045
|
+
// func.events.add_to_queue(SESSION_ID, 'element event', val2.id, evt.type, val2.data.action, val2.data.name, null, _$elm.attr('xu-ui-id'), null, evt, null, null, null, paramsP.dsSessionP, null, null, null, evt.type, val2.data.name, null, null, val2, null, null, null, null, null, null);
|
|
14046
|
+
// }
|
|
14047
|
+
// }
|
|
14048
|
+
// }
|
|
14049
|
+
// });
|
|
14050
|
+
// return {};
|
|
14051
|
+
// },
|
|
14052
|
+
|
|
14053
|
+
// 'xu-script': async function ($elm, val) {
|
|
14054
|
+
// const checkExist = setInterval(async function () {
|
|
14055
|
+
// if ($elm.is(':visible')) {
|
|
14056
|
+
// try {
|
|
14057
|
+
// const fn = eval(`async (el)=>{${val.value}}`);
|
|
14058
|
+
// await fn($elm[0]);
|
|
14059
|
+
// } catch (e) {
|
|
14060
|
+
// eval(val.value);
|
|
14061
|
+
// }
|
|
14062
|
+
// clearInterval(checkExist);
|
|
14063
|
+
// }
|
|
14064
|
+
// }, 100);
|
|
14065
|
+
// return {};
|
|
14066
|
+
// },
|
|
14067
|
+
|
|
14068
|
+
// 'xu-style-global': async function ($elm, val) {
|
|
14069
|
+
// $('head').append(`<style>${val.value}</style>`);
|
|
14070
|
+
// return {};
|
|
14071
|
+
// },
|
|
14072
|
+
|
|
14073
|
+
// 'xu-style': async function ($elm, val) {
|
|
14074
|
+
// const parser = new cssjs();
|
|
14075
|
+
// const parsed = parser.parseCSS(val.value);
|
|
14076
|
+
// const xuUiId = `[xu-ui-id="${$elm.attr('xu-ui-id')}"]`;
|
|
14077
|
+
|
|
14078
|
+
// parsed.forEach((rule) => {
|
|
14079
|
+
// rule.selector = rule.selector
|
|
14080
|
+
// .split(',')
|
|
14081
|
+
// .map((sel) => `${xuUiId} ${sel}, ${xuUiId}${sel}`)
|
|
14082
|
+
// .join(',');
|
|
14083
|
+
// });
|
|
14096
14084
|
|
|
14097
|
-
|
|
14098
|
-
|
|
14099
|
-
|
|
14100
|
-
}
|
|
14085
|
+
// $('head').append(`<style>${parser.getCSSForEditor(parsed)}</style>`);
|
|
14086
|
+
// return {};
|
|
14087
|
+
// },
|
|
14101
14088
|
|
|
14102
|
-
|
|
14089
|
+
// 'xu-cdn': async function ($elm, val) {
|
|
14090
|
+
// for (const resource of Object.values(val.value)) {
|
|
14091
|
+
// await load_cdn(resource);
|
|
14092
|
+
// }
|
|
14093
|
+
// return {};
|
|
14094
|
+
// },
|
|
14103
14095
|
|
|
14104
|
-
|
|
14105
|
-
|
|
14096
|
+
// 'xu-ui-plugin': async function ($elm, val) {
|
|
14097
|
+
// for (const [plugin_name, value] of Object.entries(val.value)) {
|
|
14098
|
+
// const _plugin = APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
|
|
14106
14099
|
|
|
14107
|
-
|
|
14108
|
-
prop_val.value = value?.attributes?.[prop_name];
|
|
14109
|
-
if (value?.attributes?.[`xu-exp:${prop_name}`]) {
|
|
14110
|
-
const res = await func.expression.get(SESSION_ID, value.attributes[`xu-exp:${prop_name}`], paramsP.dsSessionP, 'UI Attr EXP');
|
|
14111
|
-
prop_val.value = res.result;
|
|
14112
|
-
}
|
|
14113
|
-
}
|
|
14100
|
+
// if (!_plugin?.installed || !_plugin?.manifest?.['runtime.mjs']?.exist || !_plugin?.manifest?.['index.mjs']?.exist || !value.enabled) continue;
|
|
14114
14101
|
|
|
14115
|
-
|
|
14102
|
+
// if (_plugin.manifest['runtime.mjs'].dist && _plugin.manifest['runtime.mjs'].css) {
|
|
14103
|
+
// const css_url = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, 'dist/runtime.css');
|
|
14104
|
+
// func.utils.load_css_on_demand(css_url);
|
|
14105
|
+
// }
|
|
14116
14106
|
|
|
14117
|
-
|
|
14107
|
+
// const plugin_index_src = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, `${_plugin.manifest['index.mjs'].dist ? 'dist/' : ''}index.mjs`);
|
|
14118
14108
|
|
|
14119
|
-
|
|
14120
|
-
|
|
14121
|
-
await load_cdn(resource);
|
|
14122
|
-
}
|
|
14123
|
-
}
|
|
14109
|
+
// const plugin_index_resources = await import(plugin_index_src);
|
|
14110
|
+
// const properties = _.cloneDeep(plugin_index_resources.properties);
|
|
14124
14111
|
|
|
14125
|
-
|
|
14126
|
-
|
|
14127
|
-
|
|
14128
|
-
|
|
14129
|
-
|
|
14130
|
-
|
|
14112
|
+
// for (const [prop_name, prop_val] of Object.entries(properties)) {
|
|
14113
|
+
// prop_val.value = value?.attributes?.[prop_name];
|
|
14114
|
+
// if (value?.attributes?.[`xu-exp:${prop_name}`]) {
|
|
14115
|
+
// const res = await func.expression.get(SESSION_ID, value.attributes[`xu-exp:${prop_name}`], paramsP.dsSessionP, 'UI Attr EXP');
|
|
14116
|
+
// prop_val.value = res.result;
|
|
14117
|
+
// }
|
|
14118
|
+
// }
|
|
14131
14119
|
|
|
14132
|
-
|
|
14133
|
-
try {
|
|
14134
|
-
const fields_obj = JSON5.parse(val.value);
|
|
14135
|
-
for (const [field_id, value] of Object.entries(fields_obj)) {
|
|
14136
|
-
func.datasource.add_dynamic_field_to_ds(SESSION_ID, paramsP.dsSessionP, field_id, value);
|
|
14137
|
-
}
|
|
14138
|
-
} catch (err) {
|
|
14139
|
-
console.error(err);
|
|
14140
|
-
}
|
|
14141
|
-
return {};
|
|
14142
|
-
},
|
|
14120
|
+
// const plugin_runtime_src = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, `${_plugin.manifest['runtime.mjs'].dist ? 'dist/' : ''}runtime.mjs`);
|
|
14143
14121
|
|
|
14144
|
-
|
|
14145
|
-
return {};
|
|
14146
|
-
},
|
|
14147
|
-
};
|
|
14122
|
+
// const plugin_runtime_resources = await import(plugin_runtime_src);
|
|
14148
14123
|
|
|
14149
|
-
|
|
14150
|
-
|
|
14151
|
-
|
|
14152
|
-
|
|
14153
|
-
|
|
14154
|
-
const prog_id = val.value?.prog || val.value;
|
|
14155
|
-
const params_obj = await get_params_obj_new(SESSION_ID, prog_id, nodeP, paramsP.dsSessionP);
|
|
14156
|
-
const ret_panel = await func.UI.screen.init(SESSION_ID, prog_id, paramsP.screenId, _ds, $elm, null, _ds.currentRecordId, null, true, params_obj.params_res, 'initXu_panel', undefined, prog_id !== _ds.prog_id ? null : refreshed_ds, params_obj.params_raw);
|
|
14124
|
+
// if (plugin_runtime_resources.cdn && _.isArray(plugin_runtime_resources.cdn)) {
|
|
14125
|
+
// for (const resource of plugin_runtime_resources.cdn) {
|
|
14126
|
+
// await load_cdn(resource);
|
|
14127
|
+
// }
|
|
14128
|
+
// }
|
|
14157
14129
|
|
|
14158
|
-
|
|
14159
|
-
|
|
14160
|
-
|
|
14161
|
-
|
|
14162
|
-
|
|
14163
|
-
|
|
14164
|
-
}
|
|
14130
|
+
// if (plugin_runtime_resources.fn) {
|
|
14131
|
+
// await plugin_runtime_resources.fn(plugin_name, $elm?.[0], properties);
|
|
14132
|
+
// }
|
|
14133
|
+
// }
|
|
14134
|
+
// return {};
|
|
14135
|
+
// },
|
|
14165
14136
|
|
|
14166
|
-
|
|
14167
|
-
|
|
14168
|
-
|
|
14137
|
+
// 'xu-store': async function ($elm, val) {
|
|
14138
|
+
// try {
|
|
14139
|
+
// const fields_obj = JSON5.parse(val.value);
|
|
14140
|
+
// for (const [field_id, value] of Object.entries(fields_obj)) {
|
|
14141
|
+
// func.datasource.add_dynamic_field_to_ds(SESSION_ID, paramsP.dsSessionP, field_id, value);
|
|
14142
|
+
// }
|
|
14143
|
+
// } catch (err) {
|
|
14144
|
+
// console.error(err);
|
|
14145
|
+
// }
|
|
14146
|
+
// return {};
|
|
14147
|
+
// },
|
|
14169
14148
|
|
|
14170
|
-
|
|
14171
|
-
|
|
14172
|
-
|
|
14173
|
-
|
|
14174
|
-
const $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, nodeP.attributes, null, null, null, $wrapper, '');
|
|
14149
|
+
// 'xu-viewport': async function ($elm, val) {
|
|
14150
|
+
// return {};
|
|
14151
|
+
// },
|
|
14152
|
+
// };
|
|
14175
14153
|
|
|
14176
|
-
|
|
14177
|
-
|
|
14154
|
+
// const tag_fx = {
|
|
14155
|
+
// 'xu-panel': {
|
|
14156
|
+
// program: async function ($elm, val) {
|
|
14157
|
+
// const init_program = async function () {
|
|
14158
|
+
// async function render_panel() {
|
|
14159
|
+
// const prog_id = val.value?.prog || val.value;
|
|
14160
|
+
// const params_obj = await get_params_obj_new(SESSION_ID, prog_id, nodeP, paramsP.dsSessionP);
|
|
14161
|
+
// const ret_panel = await func.UI.screen.init(SESSION_ID, prog_id, paramsP.screenId, _ds, $elm, null, _ds.currentRecordId, null, true, params_obj.params_res, 'initXu_panel', undefined, prog_id !== _ds.prog_id ? null : refreshed_ds, params_obj.params_raw);
|
|
14162
|
+
|
|
14163
|
+
// const containerData = $container.data();
|
|
14164
|
+
// if (containerData.xuData) {
|
|
14165
|
+
// containerData.xuData.xuPanelProps = elmData.xuAttributes;
|
|
14166
|
+
// containerData.xuData.xuPanelData = ret_panel.data();
|
|
14167
|
+
// }
|
|
14168
|
+
// return { $new_div: ret_panel };
|
|
14169
|
+
// }
|
|
14178
14170
|
|
|
14179
|
-
|
|
14171
|
+
// if (!val.value) val.value = '_empty_panel_program';
|
|
14172
|
+
// return await render_panel();
|
|
14173
|
+
// };
|
|
14180
14174
|
|
|
14181
|
-
|
|
14182
|
-
|
|
14175
|
+
// const alter_program = async function () {
|
|
14176
|
+
// async function render_panel() {
|
|
14177
|
+
// const program = val.value?.prog || val.value;
|
|
14178
|
+
// const $wrapper = $('<div>');
|
|
14179
|
+
// const $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, nodeP.attributes, null, null, null, $wrapper, '');
|
|
14183
14180
|
|
|
14184
|
-
|
|
14185
|
-
|
|
14186
|
-
return { abort: true };
|
|
14187
|
-
};
|
|
14181
|
+
// const params_obj = await get_params_obj_new(SESSION_ID, program, nodeP, paramsP.dsSessionP);
|
|
14182
|
+
// const ret_init = await func.UI.screen.init(SESSION_ID, program, paramsP.screenId, _ds, $div, null, _ds.currentRecordId, jobNoP, true, params_obj.params_res, 'alterXu_panel', undefined, undefined, params_obj.params_raw);
|
|
14188
14183
|
|
|
14189
|
-
|
|
14190
|
-
},
|
|
14184
|
+
// await func.UI.screen.panel_post_render_handler(SESSION_ID, $elm, ret_init, nodeP, $div.clone(true), jobNoP);
|
|
14191
14185
|
|
|
14192
|
-
|
|
14193
|
-
|
|
14194
|
-
},
|
|
14186
|
+
// return { $new_div: ret_init, abort: true };
|
|
14187
|
+
// }
|
|
14195
14188
|
|
|
14196
|
-
|
|
14197
|
-
|
|
14198
|
-
|
|
14199
|
-
|
|
14200
|
-
},
|
|
14189
|
+
// if (!val.value) return { abort: true };
|
|
14190
|
+
// await render_panel();
|
|
14191
|
+
// return { abort: true };
|
|
14192
|
+
// };
|
|
14201
14193
|
|
|
14202
|
-
|
|
14203
|
-
|
|
14204
|
-
|
|
14205
|
-
|
|
14206
|
-
|
|
14207
|
-
|
|
14208
|
-
|
|
14209
|
-
|
|
14210
|
-
|
|
14211
|
-
|
|
14212
|
-
|
|
14213
|
-
|
|
14214
|
-
|
|
14215
|
-
|
|
14216
|
-
|
|
14217
|
-
|
|
14218
|
-
|
|
14219
|
-
|
|
14220
|
-
|
|
14221
|
-
|
|
14222
|
-
|
|
14223
|
-
|
|
14224
|
-
|
|
14225
|
-
|
|
14226
|
-
|
|
14227
|
-
|
|
14228
|
-
|
|
14194
|
+
// return is_init ? await init_program() : await alter_program();
|
|
14195
|
+
// },
|
|
14196
|
+
|
|
14197
|
+
// 'xu-render': async function ($elm, val) {
|
|
14198
|
+
// return await common_fx['xu-render']($elm, val, true);
|
|
14199
|
+
// },
|
|
14200
|
+
|
|
14201
|
+
// 'xu-ref': async function ($elm, val) {
|
|
14202
|
+
// if (!val.value) return {};
|
|
14203
|
+
// return await common_fx['xu-ref']($container, val, $container?.data?.()?.xuData?.xuPanelData?.xuData?.paramsP?.dsSessionP);
|
|
14204
|
+
// },
|
|
14205
|
+
// },
|
|
14206
|
+
|
|
14207
|
+
// 'xu-teleport': {
|
|
14208
|
+
// to: async function ($elm, val) {
|
|
14209
|
+
// if (!glb.new_xu_render && val.value) {
|
|
14210
|
+
// if ($elm?.parent()?.data()?.xuData?.length) {
|
|
14211
|
+
// $elm.parent().data('xuTeleportData', []);
|
|
14212
|
+
// for (const [key, node] of Object.entries(nodeP.children)) {
|
|
14213
|
+
// const $teleport_elm = await func.UI.screen.render_ui_tree(SESSION_ID, $(val.value), node, parent_infoP, paramsP, jobNoP, is_skeleton, Number(key), null, node, null, $root_container);
|
|
14214
|
+
// $elm.parent().data().xuTeleportData.push($teleport_elm.attr('xu-ui-id'));
|
|
14215
|
+
// $teleport_elm.attr('xu-teleport-parent-id', $elm.parent().attr('xu-ui-id'));
|
|
14216
|
+
// }
|
|
14217
|
+
// $elm.remove();
|
|
14218
|
+
// } else {
|
|
14219
|
+
// $elm.data('xuTeleportData', []).attr('hidden', true);
|
|
14220
|
+
// for (const [key, node] of Object.entries(nodeP.children)) {
|
|
14221
|
+
// const $to_container = $(val.value);
|
|
14222
|
+
// if (!$to_container?.length) {
|
|
14223
|
+
// return console.error(`container ${val.value} for xuTeleportData not found`);
|
|
14224
|
+
// }
|
|
14225
|
+
// const $teleport_elm = await func.UI.screen.render_ui_tree(SESSION_ID, $to_container, node, parent_infoP, paramsP, jobNoP, is_skeleton, Number(key), null, node, null, $root_container);
|
|
14226
|
+
// $elm.data().xuTeleportData.push($teleport_elm.attr('xu-ui-id'));
|
|
14227
|
+
// $teleport_elm.attr('xu-teleport-parent-id', $elm.attr('xu-ui-id'));
|
|
14228
|
+
// }
|
|
14229
|
+
// }
|
|
14230
|
+
// return { abort: true };
|
|
14231
|
+
// }
|
|
14232
|
+
// return {};
|
|
14233
|
+
// },
|
|
14229
14234
|
|
|
14230
|
-
|
|
14231
|
-
|
|
14232
|
-
|
|
14235
|
+
// 'xu-render': async function ($elm, val) {
|
|
14236
|
+
// return await common_fx['xu-render']($elm, val, true);
|
|
14237
|
+
// },
|
|
14233
14238
|
|
|
14234
|
-
|
|
14235
|
-
|
|
14236
|
-
|
|
14237
|
-
|
|
14238
|
-
|
|
14239
|
+
// 'xu-show': async function ($elm, val) {
|
|
14240
|
+
// return await common_fx['xu-show']($elm, val, true);
|
|
14241
|
+
// },
|
|
14242
|
+
// },
|
|
14243
|
+
// };
|
|
14239
14244
|
|
|
14240
|
-
|
|
14241
|
-
|
|
14242
|
-
|
|
14243
|
-
|
|
14244
|
-
|
|
14245
|
+
// // Main execution logic
|
|
14246
|
+
// if (isXuTag) {
|
|
14247
|
+
// if (xu_func === 'xu-exp') {
|
|
14248
|
+
// return common_fx[xu_func]($elm, val);
|
|
14249
|
+
// }
|
|
14245
14250
|
|
|
14246
|
-
|
|
14247
|
-
|
|
14248
|
-
|
|
14251
|
+
// if (tag_fx?.[nodeTag]?.[xu_func]) {
|
|
14252
|
+
// return await tag_fx[nodeTag][xu_func]($elm, val);
|
|
14253
|
+
// }
|
|
14249
14254
|
|
|
14250
|
-
|
|
14251
|
-
|
|
14252
|
-
|
|
14255
|
+
// console.warn(`attribute ${xu_func} not found for ${nodeTag}`);
|
|
14256
|
+
// return {};
|
|
14257
|
+
// }
|
|
14253
14258
|
|
|
14254
|
-
|
|
14259
|
+
// if (_.isEmpty(elmData)) return {};
|
|
14255
14260
|
|
|
14256
|
-
|
|
14257
|
-
|
|
14258
|
-
|
|
14261
|
+
// if (!xuData.debug_info.attribute_stat) {
|
|
14262
|
+
// xuData.debug_info.attribute_stat = {};
|
|
14263
|
+
// }
|
|
14259
14264
|
|
|
14260
|
-
|
|
14261
|
-
|
|
14262
|
-
|
|
14265
|
+
// if (xu_func !== 'xu-exp') {
|
|
14266
|
+
// xuData.debug_info.attribute_stat[xu_func] = val.value;
|
|
14267
|
+
// }
|
|
14263
14268
|
|
|
14264
|
-
|
|
14265
|
-
|
|
14266
|
-
|
|
14267
|
-
|
|
14268
|
-
|
|
14269
|
-
|
|
14270
|
-
|
|
14271
|
-
|
|
14272
|
-
|
|
14273
|
-
|
|
14274
|
-
};
|
|
14269
|
+
// try {
|
|
14270
|
+
// if (!common_fx[xu_func]) {
|
|
14271
|
+
// console.warn('invalid xu-tag', xu_func);
|
|
14272
|
+
// return {};
|
|
14273
|
+
// }
|
|
14274
|
+
// return await common_fx[xu_func]($elm, val);
|
|
14275
|
+
// } catch (error) {
|
|
14276
|
+
// console.error('execute_xu_functions error:', error);
|
|
14277
|
+
// return {};
|
|
14278
|
+
// }
|
|
14279
|
+
// };
|
|
14275
14280
|
|
|
14276
14281
|
func.UI.screen.fix_val_defaults = function (key, val) {
|
|
14277
14282
|
var ret = val;
|
|
@@ -14643,225 +14648,225 @@ func.UI.screen.set_attributes_new = async function (SESSION_ID, is_skeleton, $ro
|
|
|
14643
14648
|
return _ret;
|
|
14644
14649
|
};
|
|
14645
14650
|
|
|
14646
|
-
func.UI.screen.set_attributes_new_bad = async function (SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $elm, is_init, execute_attributes = [], refreshed_ds) {
|
|
14647
|
-
|
|
14651
|
+
// func.UI.screen.set_attributes_new_bad = async function (SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $elm, is_init, execute_attributes = [], refreshed_ds) {
|
|
14652
|
+
// const done_exp = new Set(); // Use Set for O(1) lookups instead of array
|
|
14648
14653
|
|
|
14649
|
-
|
|
14650
|
-
|
|
14654
|
+
// const _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
|
|
14655
|
+
// if (!_ds) return { abort: true };
|
|
14651
14656
|
|
|
14652
|
-
|
|
14653
|
-
|
|
14657
|
+
// // Early return if not an element or no attributes
|
|
14658
|
+
// if (nodeP.type !== 'element' || !nodeP.attributes) return {};
|
|
14654
14659
|
|
|
14655
|
-
|
|
14656
|
-
|
|
14657
|
-
|
|
14658
|
-
|
|
14659
|
-
|
|
14660
|
-
|
|
14660
|
+
// // Cache frequently accessed values
|
|
14661
|
+
// const nodeAttrs = nodeP.attributes;
|
|
14662
|
+
// const elmData = $elm.data();
|
|
14663
|
+
// const xuData = elmData.xuData;
|
|
14664
|
+
// const containerData = $container?.data();
|
|
14665
|
+
// const containerXuData = containerData?.xuData;
|
|
14661
14666
|
|
|
14662
|
-
|
|
14663
|
-
|
|
14664
|
-
|
|
14665
|
-
|
|
14666
|
-
|
|
14667
|
-
|
|
14668
|
-
|
|
14667
|
+
// const get_attr_value = async function (key) {
|
|
14668
|
+
// const expKey = `xu-exp:${key}`;
|
|
14669
|
+
// if (nodeAttrs.hasOwnProperty(expKey)) {
|
|
14670
|
+
// return await get_xuExp(key);
|
|
14671
|
+
// }
|
|
14672
|
+
// return func.UI.screen.fix_val_defaults(key, nodeAttrs[key]);
|
|
14673
|
+
// };
|
|
14669
14674
|
|
|
14670
|
-
|
|
14671
|
-
|
|
14675
|
+
// const get_xuExp = async function (attrib) {
|
|
14676
|
+
// if (is_skeleton) return;
|
|
14672
14677
|
|
|
14673
|
-
|
|
14674
|
-
|
|
14678
|
+
// const attr = `xu-exp:${attrib}`;
|
|
14679
|
+
// if (!nodeAttrs.hasOwnProperty(attr)) return;
|
|
14675
14680
|
|
|
14676
|
-
|
|
14677
|
-
|
|
14678
|
-
|
|
14679
|
-
|
|
14680
|
-
|
|
14681
|
-
|
|
14682
|
-
const exp = nodeAttrs[attr];
|
|
14683
|
-
const res = await func.expression.get(SESSION_ID, exp, paramsP.dsSessionP, 'UI Attr EXP', _ds.currentRecordId);
|
|
14681
|
+
// if (glb.new_xu_render) {
|
|
14682
|
+
// if (!xuData.attr_exp_info) {
|
|
14683
|
+
// xuData.attr_exp_info = {};
|
|
14684
|
+
// }
|
|
14685
|
+
// }
|
|
14684
14686
|
|
|
14685
|
-
|
|
14686
|
-
|
|
14687
|
-
}
|
|
14687
|
+
// const exp = nodeAttrs[attr];
|
|
14688
|
+
// const res = await func.expression.get(SESSION_ID, exp, paramsP.dsSessionP, 'UI Attr EXP', _ds.currentRecordId);
|
|
14688
14689
|
|
|
14689
|
-
|
|
14690
|
-
|
|
14691
|
-
|
|
14690
|
+
// if (glb.new_xu_render) {
|
|
14691
|
+
// xuData.attr_exp_info[attrib] = res;
|
|
14692
|
+
// }
|
|
14692
14693
|
|
|
14693
|
-
|
|
14694
|
-
|
|
14695
|
-
|
|
14696
|
-
const solidAttrsSet = new Set(glb.solid_attributes);
|
|
14697
|
-
const abbreviationsSet = new Set(glb.attr_abbreviations_arr);
|
|
14698
|
-
const runXuBeforeSet = new Set(Object.values(glb.run_xu_before));
|
|
14699
|
-
const runXuAfterSet = new Set(Object.values(glb.run_xu_after));
|
|
14700
|
-
|
|
14701
|
-
// Process attributes in a single pass where possible
|
|
14702
|
-
const attrsToDelete = [];
|
|
14703
|
-
const xuOnAttrs = {};
|
|
14704
|
-
|
|
14705
|
-
for (const [key, val] of Object.entries(nodeAttrs)) {
|
|
14706
|
-
// Handle xu-exp attributes
|
|
14707
|
-
if (key.startsWith('xu-exp:')) {
|
|
14708
|
-
if (_.isEmpty(val)) {
|
|
14709
|
-
attrsToDelete.push(key);
|
|
14710
|
-
continue;
|
|
14711
|
-
}
|
|
14712
|
-
const clean_key = key.slice(7); // 'xu-exp:'.length = 7
|
|
14713
|
-
if (nodeAttrs[clean_key] !== undefined) {
|
|
14714
|
-
attrsToDelete.push(clean_key);
|
|
14715
|
-
}
|
|
14716
|
-
}
|
|
14717
|
-
// Handle abbreviations
|
|
14718
|
-
else if (abbreviationsSet.has(key)) {
|
|
14719
|
-
xuOnAttrs[`xu-on:${key.slice(3)}`] = [
|
|
14720
|
-
{
|
|
14721
|
-
handler: 'custom',
|
|
14722
|
-
props: {},
|
|
14723
|
-
event: [
|
|
14724
|
-
{
|
|
14725
|
-
id: Date.now(),
|
|
14726
|
-
data: {
|
|
14727
|
-
action: 'update',
|
|
14728
|
-
name: { value: val },
|
|
14729
|
-
enabled: true,
|
|
14730
|
-
},
|
|
14731
|
-
props: {},
|
|
14732
|
-
},
|
|
14733
|
-
],
|
|
14734
|
-
},
|
|
14735
|
-
];
|
|
14736
|
-
attrsToDelete.push(key);
|
|
14737
|
-
}
|
|
14738
|
-
}
|
|
14694
|
+
// done_exp.add(attr);
|
|
14695
|
+
// return res.result;
|
|
14696
|
+
// };
|
|
14739
14697
|
|
|
14740
|
-
|
|
14741
|
-
|
|
14742
|
-
|
|
14743
|
-
|
|
14698
|
+
// // Create Sets for O(1) lookups
|
|
14699
|
+
// const html5EventsSet = new Set(glb.html5_events_handler);
|
|
14700
|
+
// const executeAttrsSet = new Set(execute_attributes);
|
|
14701
|
+
// const solidAttrsSet = new Set(glb.solid_attributes);
|
|
14702
|
+
// const abbreviationsSet = new Set(glb.attr_abbreviations_arr);
|
|
14703
|
+
// const runXuBeforeSet = new Set(Object.values(glb.run_xu_before));
|
|
14704
|
+
// const runXuAfterSet = new Set(Object.values(glb.run_xu_after));
|
|
14705
|
+
|
|
14706
|
+
// // Process attributes in a single pass where possible
|
|
14707
|
+
// const attrsToDelete = [];
|
|
14708
|
+
// const xuOnAttrs = {};
|
|
14709
|
+
|
|
14710
|
+
// for (const [key, val] of Object.entries(nodeAttrs)) {
|
|
14711
|
+
// // Handle xu-exp attributes
|
|
14712
|
+
// if (key.startsWith('xu-exp:')) {
|
|
14713
|
+
// if (_.isEmpty(val)) {
|
|
14714
|
+
// attrsToDelete.push(key);
|
|
14715
|
+
// continue;
|
|
14716
|
+
// }
|
|
14717
|
+
// const clean_key = key.slice(7); // 'xu-exp:'.length = 7
|
|
14718
|
+
// if (nodeAttrs[clean_key] !== undefined) {
|
|
14719
|
+
// attrsToDelete.push(clean_key);
|
|
14720
|
+
// }
|
|
14721
|
+
// }
|
|
14722
|
+
// // Handle abbreviations
|
|
14723
|
+
// else if (abbreviationsSet.has(key)) {
|
|
14724
|
+
// xuOnAttrs[`xu-on:${key.slice(3)}`] = [
|
|
14725
|
+
// {
|
|
14726
|
+
// handler: 'custom',
|
|
14727
|
+
// props: {},
|
|
14728
|
+
// event: [
|
|
14729
|
+
// {
|
|
14730
|
+
// id: Date.now(),
|
|
14731
|
+
// data: {
|
|
14732
|
+
// action: 'update',
|
|
14733
|
+
// name: { value: val },
|
|
14734
|
+
// enabled: true,
|
|
14735
|
+
// },
|
|
14736
|
+
// props: {},
|
|
14737
|
+
// },
|
|
14738
|
+
// ],
|
|
14739
|
+
// },
|
|
14740
|
+
// ];
|
|
14741
|
+
// attrsToDelete.push(key);
|
|
14742
|
+
// }
|
|
14743
|
+
// }
|
|
14744
14744
|
|
|
14745
|
-
|
|
14746
|
-
|
|
14745
|
+
// // Delete marked attributes
|
|
14746
|
+
// for (const key of attrsToDelete) {
|
|
14747
|
+
// delete nodeAttrs[key];
|
|
14748
|
+
// }
|
|
14747
14749
|
|
|
14748
|
-
|
|
14749
|
-
|
|
14750
|
-
const fixedVal = func.UI.screen.fix_val_defaults(key, val);
|
|
14750
|
+
// // Add xu-on attributes
|
|
14751
|
+
// Object.assign(nodeAttrs, xuOnAttrs);
|
|
14751
14752
|
|
|
14752
|
-
|
|
14753
|
-
|
|
14754
|
-
|
|
14755
|
-
delete nodeAttrs[key];
|
|
14756
|
-
} else {
|
|
14757
|
-
nodeAttrs[key] = fixedVal;
|
|
14758
|
-
}
|
|
14759
|
-
}
|
|
14753
|
+
// // Clean up attributes
|
|
14754
|
+
// for (const [key, val] of Object.entries(nodeAttrs)) {
|
|
14755
|
+
// const fixedVal = func.UI.screen.fix_val_defaults(key, val);
|
|
14760
14756
|
|
|
14761
|
-
|
|
14757
|
+
// if (fixedVal === undefined || fixedVal === null) {
|
|
14758
|
+
// delete nodeAttrs[key];
|
|
14759
|
+
// } else if (solidAttrsSet.has(key) && !fixedVal) {
|
|
14760
|
+
// delete nodeAttrs[key];
|
|
14761
|
+
// } else {
|
|
14762
|
+
// nodeAttrs[key] = fixedVal;
|
|
14763
|
+
// }
|
|
14764
|
+
// }
|
|
14762
14765
|
|
|
14763
|
-
|
|
14764
|
-
const shouldAbort = () => _ret.abort || containerXuData?.pending_to_delete;
|
|
14766
|
+
// const _ret = {};
|
|
14765
14767
|
|
|
14766
|
-
|
|
14767
|
-
|
|
14768
|
-
const attr = 'xu-attrs';
|
|
14769
|
-
await func.UI.screen.execute_xu_functions(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, attr, $elm, { key: attr, value: await get_attr_value(attr) }, is_init);
|
|
14770
|
-
}
|
|
14768
|
+
// // Helper to check abort condition
|
|
14769
|
+
// const shouldAbort = () => _ret.abort || containerXuData?.pending_to_delete;
|
|
14771
14770
|
|
|
14772
|
-
|
|
14773
|
-
|
|
14774
|
-
|
|
14775
|
-
|
|
14776
|
-
|
|
14771
|
+
// // XU-ATTRS
|
|
14772
|
+
// if (nodeAttrs['xu-attrs'] || nodeAttrs['xu-exp:xu-attrs']) {
|
|
14773
|
+
// const attr = 'xu-attrs';
|
|
14774
|
+
// await func.UI.screen.execute_xu_functions(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, attr, $elm, { key: attr, value: await get_attr_value(attr) }, is_init);
|
|
14775
|
+
// }
|
|
14777
14776
|
|
|
14778
|
-
|
|
14779
|
-
|
|
14780
|
-
|
|
14777
|
+
// // BEFORE
|
|
14778
|
+
// if (!_.isEmpty(nodeAttrs)) {
|
|
14779
|
+
// for (const [key, attr] of Object.entries(glb.run_xu_before)) {
|
|
14780
|
+
// if (shouldAbort()) break;
|
|
14781
|
+
// if (html5EventsSet.has(attr) || executeAttrsSet.has(attr)) continue;
|
|
14781
14782
|
|
|
14782
|
-
|
|
14783
|
-
|
|
14784
|
-
|
|
14785
|
-
}
|
|
14783
|
+
// const expKey = `xu-exp:${attr}`;
|
|
14784
|
+
// if (!nodeAttrs.hasOwnProperty(attr) && !nodeAttrs.hasOwnProperty(expKey)) continue;
|
|
14785
|
+
// if (!nodeAttrs[expKey] && nodeAttrs.hasOwnProperty(attr) && func.UI.screen.fix_val_defaults(attr, nodeAttrs[attr]) === undefined) continue;
|
|
14786
14786
|
|
|
14787
|
-
|
|
14788
|
-
|
|
14789
|
-
|
|
14790
|
-
|
|
14787
|
+
// const ret = await func.UI.screen.execute_xu_functions(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, attr, $elm, { key: attr, value: await get_attr_value(attr) }, is_init);
|
|
14788
|
+
// Object.assign(_ret, ret);
|
|
14789
|
+
// }
|
|
14790
|
+
// }
|
|
14791
14791
|
|
|
14792
|
-
|
|
14793
|
-
|
|
14794
|
-
|
|
14792
|
+
// // ALL - Process attributes
|
|
14793
|
+
// const isXuPanel = nodeP.tagName === 'xu-panel';
|
|
14794
|
+
// const isXuTeleport = nodeP.tagName === 'xu-teleport';
|
|
14795
|
+
// const elmElement = $elm.get(0);
|
|
14795
14796
|
|
|
14796
|
-
|
|
14797
|
-
|
|
14797
|
+
// for (const [key, val] of Object.entries(nodeAttrs)) {
|
|
14798
|
+
// if (shouldAbort()) break;
|
|
14799
|
+
// if (html5EventsSet.has(key) || executeAttrsSet.has(key)) continue;
|
|
14798
14800
|
|
|
14799
|
-
|
|
14800
|
-
|
|
14801
|
-
elmElement.setAttribute(key, val);
|
|
14802
|
-
} catch (err) {
|
|
14803
|
-
console.error(err.message);
|
|
14804
|
-
}
|
|
14805
|
-
continue;
|
|
14806
|
-
}
|
|
14801
|
+
// const colonIndex = key.indexOf(':');
|
|
14802
|
+
// const new_key = colonIndex > -1 ? key.slice(0, colonIndex) : key;
|
|
14807
14803
|
|
|
14808
|
-
|
|
14809
|
-
|
|
14810
|
-
|
|
14811
|
-
|
|
14804
|
+
// if (!isXuPanel && !isXuTeleport && (!new_key.startsWith('xu-') || new_key.length < 3 || new_key[2] !== '-')) {
|
|
14805
|
+
// try {
|
|
14806
|
+
// elmElement.setAttribute(key, val);
|
|
14807
|
+
// } catch (err) {
|
|
14808
|
+
// console.error(err.message);
|
|
14809
|
+
// }
|
|
14810
|
+
// continue;
|
|
14811
|
+
// }
|
|
14812
14812
|
|
|
14813
|
-
|
|
14814
|
-
|
|
14815
|
-
|
|
14816
|
-
|
|
14813
|
+
// // Store xu attributes
|
|
14814
|
+
// if (elmData.xuAttributes) {
|
|
14815
|
+
// elmData.xuAttributes[key] = val;
|
|
14816
|
+
// }
|
|
14817
14817
|
|
|
14818
|
-
|
|
14819
|
-
|
|
14820
|
-
|
|
14821
|
-
|
|
14822
|
-
}
|
|
14818
|
+
// const expKey = `xu-exp:${new_key}`;
|
|
14819
|
+
// if (new_key === 'xu-exp' || nodeAttrs[expKey] || runXuBeforeSet.has(new_key) || runXuAfterSet.has(new_key)) {
|
|
14820
|
+
// continue;
|
|
14821
|
+
// }
|
|
14823
14822
|
|
|
14824
|
-
|
|
14825
|
-
|
|
14826
|
-
|
|
14823
|
+
// if (new_key === 'xu-on') {
|
|
14824
|
+
// const ret = await func.UI.screen.execute_xu_functions(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, 'xu-on', $elm, { key: key, value: await get_attr_value(key) }, is_init, refreshed_ds);
|
|
14825
|
+
// Object.assign(_ret, ret);
|
|
14826
|
+
// continue;
|
|
14827
|
+
// }
|
|
14827
14828
|
|
|
14828
|
-
|
|
14829
|
-
|
|
14830
|
-
|
|
14829
|
+
// const ret = await func.UI.screen.execute_xu_functions(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, new_key, $elm, { key: key, value: await get_attr_value(key) }, is_init, refreshed_ds);
|
|
14830
|
+
// Object.assign(_ret, ret);
|
|
14831
|
+
// }
|
|
14831
14832
|
|
|
14832
|
-
|
|
14833
|
-
|
|
14833
|
+
// // EXP - Process expressions
|
|
14834
|
+
// for (const [key, val] of Object.entries(nodeAttrs)) {
|
|
14835
|
+
// if (shouldAbort()) break;
|
|
14834
14836
|
|
|
14835
|
-
|
|
14836
|
-
|
|
14837
|
+
// if (!key.startsWith('xu-exp:')) continue;
|
|
14838
|
+
// const attr = key.slice(7);
|
|
14837
14839
|
|
|
14838
|
-
|
|
14839
|
-
|
|
14840
|
-
}
|
|
14840
|
+
// if (html5EventsSet.has(attr) || executeAttrsSet.has(attr)) continue;
|
|
14841
|
+
// if (done_exp.has(key)) continue;
|
|
14841
14842
|
|
|
14842
|
-
|
|
14843
|
-
|
|
14844
|
-
|
|
14845
|
-
if (html5EventsSet.has(attr) || executeAttrsSet.has(attr)) continue;
|
|
14843
|
+
// const ret = await func.UI.screen.execute_xu_functions(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, 'xu-exp', $elm, { key: attr, value: val }, true, refreshed_ds);
|
|
14844
|
+
// Object.assign(_ret, ret);
|
|
14845
|
+
// }
|
|
14846
14846
|
|
|
14847
|
-
|
|
14848
|
-
|
|
14847
|
+
// // AFTER
|
|
14848
|
+
// for (const [key, attr] of Object.entries(glb.run_xu_after)) {
|
|
14849
|
+
// if (containerXuData?.pending_to_delete) break;
|
|
14850
|
+
// if (html5EventsSet.has(attr) || executeAttrsSet.has(attr)) continue;
|
|
14849
14851
|
|
|
14850
|
-
|
|
14851
|
-
|
|
14852
|
-
}
|
|
14852
|
+
// const expKey = `xu-exp:${attr}`;
|
|
14853
|
+
// if (!nodeAttrs || (!nodeAttrs[attr] && !nodeAttrs[expKey])) continue;
|
|
14853
14854
|
|
|
14854
|
-
|
|
14855
|
-
|
|
14856
|
-
|
|
14857
|
-
if (!html5EventsSet.has(key)) break;
|
|
14855
|
+
// const ret = await func.UI.screen.execute_xu_functions(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, attr, $elm, { key: attr, value: await get_attr_value(attr) }, is_init, refreshed_ds);
|
|
14856
|
+
// Object.assign(_ret, ret);
|
|
14857
|
+
// }
|
|
14858
14858
|
|
|
14859
|
-
|
|
14860
|
-
|
|
14861
|
-
|
|
14859
|
+
// // REGISTER EVENTS ATTRIBUTES
|
|
14860
|
+
// for (const [key, val] of Object.entries(nodeAttrs)) {
|
|
14861
|
+
// if (containerXuData?.pending_to_delete) break;
|
|
14862
|
+
// if (!html5EventsSet.has(key)) break;
|
|
14862
14863
|
|
|
14863
|
-
|
|
14864
|
-
|
|
14864
|
+
// const expVal = await get_xuExp(key);
|
|
14865
|
+
// $elm.attr(key, expVal || val);
|
|
14866
|
+
// }
|
|
14867
|
+
|
|
14868
|
+
// return _ret;
|
|
14869
|
+
// };
|
|
14865
14870
|
|
|
14866
14871
|
func.UI.screen.panel_post_render_handler = async function (
|
|
14867
14872
|
SESSION_ID,
|
|
@@ -15095,136 +15100,136 @@ func.UI.screen.create_container = async function (SESSION_ID, $root_container, n
|
|
|
15095
15100
|
return $div;
|
|
15096
15101
|
};
|
|
15097
15102
|
|
|
15098
|
-
func.UI.screen.create_container_bad = async function (SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, classP, elem_propP, div_typeP, $appendToP, attr_str, is_placeholder) {
|
|
15099
|
-
|
|
15100
|
-
|
|
15101
|
-
|
|
15102
|
-
|
|
15103
|
-
// Early exit if container doesn't exist
|
|
15104
|
-
if (!$appendTo?.length) return null;
|
|
15103
|
+
// func.UI.screen.create_container_bad = async function (SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, classP, elem_propP, div_typeP, $appendToP, attr_str, is_placeholder) {
|
|
15104
|
+
// const _paramsP = klona.klona(paramsP);
|
|
15105
|
+
// const _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_paramsP.dsSessionP];
|
|
15106
|
+
// const $appendTo = $appendToP || $container;
|
|
15105
15107
|
|
|
15106
|
-
|
|
15108
|
+
// // Early exit if container doesn't exist
|
|
15109
|
+
// if (!$appendTo?.length) return null;
|
|
15107
15110
|
|
|
15108
|
-
|
|
15109
|
-
const containerData = $container?.data?.();
|
|
15110
|
-
const containerXuData = containerData?.xuData;
|
|
15111
|
-
const currentRecordId = containerXuData?.recordid || (_ds ? _ds.currentRecordId : '');
|
|
15111
|
+
// const div = div_typeP || 'div';
|
|
15112
15112
|
|
|
15113
|
-
|
|
15114
|
-
|
|
15113
|
+
// // Cache container data to avoid repeated access
|
|
15114
|
+
// const containerData = $container?.data?.();
|
|
15115
|
+
// const containerXuData = containerData?.xuData;
|
|
15116
|
+
// const currentRecordId = containerXuData?.recordid || (_ds ? _ds.currentRecordId : '');
|
|
15115
15117
|
|
|
15116
|
-
|
|
15117
|
-
|
|
15118
|
-
const elem_key = `${nodeP.xu_tree_id || nodeP.id}-${key_path}-${currentRecordId}`;
|
|
15118
|
+
// // Pre-compute items array
|
|
15119
|
+
// const items = nodeP.children ? nodeP.children.map((val) => val.xu_tree_id || val.id) : [];
|
|
15119
15120
|
|
|
15120
|
-
|
|
15121
|
+
// try {
|
|
15122
|
+
// const key_path = `${containerXuData?.key_path || '0'}-${keyP || '0'}`;
|
|
15123
|
+
// const elem_key = `${nodeP.xu_tree_id || nodeP.id}-${key_path}-${currentRecordId}`;
|
|
15121
15124
|
|
|
15122
|
-
|
|
15123
|
-
if (div === 'svg') {
|
|
15124
|
-
const draw_svg = function (element) {
|
|
15125
|
-
const get_tag_str = function (element, prop, val) {
|
|
15126
|
-
const attrs = [];
|
|
15125
|
+
// let $div;
|
|
15127
15126
|
|
|
15128
|
-
|
|
15129
|
-
|
|
15130
|
-
|
|
15131
|
-
|
|
15132
|
-
|
|
15127
|
+
// // Handle SVG creation
|
|
15128
|
+
// if (div === 'svg') {
|
|
15129
|
+
// const draw_svg = function (element) {
|
|
15130
|
+
// const get_tag_str = function (element, prop, val) {
|
|
15131
|
+
// const attrs = [];
|
|
15133
15132
|
|
|
15134
|
-
|
|
15133
|
+
// for (const [key, value] of Object.entries(prop)) {
|
|
15134
|
+
// if (!key.startsWith('xu')) {
|
|
15135
|
+
// attrs.push(`${key}="${value}"`);
|
|
15136
|
+
// }
|
|
15137
|
+
// }
|
|
15135
15138
|
|
|
15136
|
-
|
|
15137
|
-
return `<${element} ${attr_str}>`;
|
|
15138
|
-
}
|
|
15139
|
+
// const attr_str = attrs.join(' ');
|
|
15139
15140
|
|
|
15140
|
-
|
|
15141
|
-
|
|
15142
|
-
|
|
15141
|
+
// if (element === 'svg') {
|
|
15142
|
+
// return `<${element} ${attr_str}>`;
|
|
15143
|
+
// }
|
|
15143
15144
|
|
|
15144
|
-
|
|
15145
|
-
|
|
15145
|
+
// const inner = val?.children?.length ? iterate_svg(val) : '';
|
|
15146
|
+
// return `<${element} ${attr_str}>${inner}</${element}>`;
|
|
15147
|
+
// };
|
|
15146
15148
|
|
|
15147
|
-
|
|
15148
|
-
|
|
15149
|
+
// const iterate_svg = function (node) {
|
|
15150
|
+
// if (!node.children) return '';
|
|
15149
15151
|
|
|
15150
|
-
|
|
15151
|
-
|
|
15152
|
+
// return node.children.map((val) => get_tag_str(val.tagName, val.attributes, val)).join('');
|
|
15153
|
+
// };
|
|
15152
15154
|
|
|
15153
|
-
|
|
15154
|
-
|
|
15155
|
+
// const svg_str = get_tag_str(element, prop);
|
|
15156
|
+
// const inner_str = iterate_svg(nodeP);
|
|
15155
15157
|
|
|
15156
|
-
|
|
15157
|
-
|
|
15158
|
-
$div = $(`<${div}${attr_str ? ' ' + attr_str : ''}>`);
|
|
15159
|
-
}
|
|
15158
|
+
// $div = $(svg_str + inner_str + '</svg>').appendTo($appendTo);
|
|
15159
|
+
// };
|
|
15160
15160
|
|
|
15161
|
-
|
|
15162
|
-
|
|
15161
|
+
// draw_svg(div_typeP);
|
|
15162
|
+
// } else {
|
|
15163
|
+
// $div = $(`<${div}${attr_str ? ' ' + attr_str : ''}>`);
|
|
15164
|
+
// }
|
|
15163
15165
|
|
|
15164
|
-
|
|
15165
|
-
|
|
15166
|
-
|
|
15167
|
-
|
|
15168
|
-
|
|
15169
|
-
|
|
15170
|
-
|
|
15171
|
-
|
|
15172
|
-
|
|
15173
|
-
|
|
15174
|
-
|
|
15175
|
-
|
|
15176
|
-
|
|
15177
|
-
|
|
15178
|
-
|
|
15179
|
-
|
|
15180
|
-
|
|
15181
|
-
|
|
15182
|
-
|
|
15183
|
-
|
|
15184
|
-
|
|
15185
|
-
|
|
15186
|
-
|
|
15187
|
-
|
|
15188
|
-
|
|
15189
|
-
|
|
15190
|
-
|
|
15191
|
-
|
|
15192
|
-
|
|
15193
|
-
|
|
15194
|
-
|
|
15166
|
+
// // Generate UI ID
|
|
15167
|
+
// const new_ui_id = await generate_xu_ui_id(SESSION_ID, nodeP, $container, paramsP, keyP);
|
|
15168
|
+
|
|
15169
|
+
// // Set attributes and data in one go
|
|
15170
|
+
// $div.attr('xu-ui-id', new_ui_id);
|
|
15171
|
+
|
|
15172
|
+
// // Build xuData object efficiently
|
|
15173
|
+
// const xuData = {
|
|
15174
|
+
// prog_id: _paramsP.prog_id,
|
|
15175
|
+
// nodeid: nodeP.id,
|
|
15176
|
+
// ui_type: nodeP.tagName,
|
|
15177
|
+
// recordid: currentRecordId,
|
|
15178
|
+
// paramsP: _paramsP,
|
|
15179
|
+
// key: keyP,
|
|
15180
|
+
// key_path,
|
|
15181
|
+
// screenId: _paramsP.screenId,
|
|
15182
|
+
// parent_container: containerData?.id,
|
|
15183
|
+
// elem_key,
|
|
15184
|
+
// properties: prop,
|
|
15185
|
+
// node: nodeP,
|
|
15186
|
+
// node_org: _.cloneDeep(nodeP),
|
|
15187
|
+
// is_panelP: _paramsP.is_panelP,
|
|
15188
|
+
// ui_id: new_ui_id,
|
|
15189
|
+
// elem_prop: elem_propP,
|
|
15190
|
+
// debug_info: {
|
|
15191
|
+
// id: nodeP.id,
|
|
15192
|
+
// parent_id: containerXuData?.ui_id,
|
|
15193
|
+
// items: items,
|
|
15194
|
+
// },
|
|
15195
|
+
// parent_node: parent_nodeP,
|
|
15196
|
+
// currentRecordId: currentRecordId,
|
|
15197
|
+
// $root_container: $root_container,
|
|
15198
|
+
// parent_element_ui_id: containerXuData?.ui_id,
|
|
15199
|
+
// };
|
|
15195
15200
|
|
|
15196
|
-
|
|
15197
|
-
|
|
15198
|
-
|
|
15199
|
-
|
|
15201
|
+
// // Add iterate_info if present
|
|
15202
|
+
// if (parent_infoP?.iterate_info) {
|
|
15203
|
+
// xuData.iterate_info = parent_infoP.iterate_info;
|
|
15204
|
+
// }
|
|
15200
15205
|
|
|
15201
|
-
|
|
15202
|
-
|
|
15203
|
-
|
|
15204
|
-
|
|
15205
|
-
|
|
15206
|
+
// // Set data once
|
|
15207
|
+
// $div.data({
|
|
15208
|
+
// xuData: xuData,
|
|
15209
|
+
// xuAttributes: {},
|
|
15210
|
+
// });
|
|
15206
15211
|
|
|
15207
|
-
|
|
15208
|
-
|
|
15209
|
-
|
|
15210
|
-
|
|
15212
|
+
// // Apply placeholder class if needed
|
|
15213
|
+
// if (is_placeholder) {
|
|
15214
|
+
// $div.addClass('display_none');
|
|
15215
|
+
// }
|
|
15211
15216
|
|
|
15212
|
-
|
|
15213
|
-
|
|
15214
|
-
|
|
15215
|
-
|
|
15217
|
+
// // Apply custom class if provided
|
|
15218
|
+
// if (classP) {
|
|
15219
|
+
// $div.addClass(classP);
|
|
15220
|
+
// }
|
|
15216
15221
|
|
|
15217
|
-
|
|
15218
|
-
|
|
15219
|
-
|
|
15220
|
-
|
|
15222
|
+
// // Append to DOM (only for non-SVG elements)
|
|
15223
|
+
// if (div_typeP !== 'svg') {
|
|
15224
|
+
// $div.appendTo($appendTo);
|
|
15225
|
+
// }
|
|
15221
15226
|
|
|
15222
|
-
|
|
15223
|
-
|
|
15224
|
-
|
|
15225
|
-
|
|
15226
|
-
|
|
15227
|
-
};
|
|
15227
|
+
// return $div;
|
|
15228
|
+
// } catch (e) {
|
|
15229
|
+
// console.error('create_container error:', e);
|
|
15230
|
+
// return null;
|
|
15231
|
+
// }
|
|
15232
|
+
// };
|
|
15228
15233
|
|
|
15229
15234
|
func.UI.screen.execute_screen_ready_events = async function (SESSION_ID, paramsP, sourceP, $div, jobNoP, $div_objP) {
|
|
15230
15235
|
var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
|
|
@@ -16566,902 +16571,902 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
|
|
|
16566
16571
|
// }
|
|
16567
16572
|
};
|
|
16568
16573
|
|
|
16569
|
-
func.UI.screen.render_ui_tree_bad = async function (SESSION_ID, $container, nodeP, parent_infoP, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, $root_container) {
|
|
16570
|
-
|
|
16571
|
-
|
|
16572
|
-
|
|
16573
|
-
|
|
16574
|
-
|
|
16575
|
-
|
|
16576
|
-
|
|
16577
|
-
const prop = nodeP.attributes;
|
|
16578
|
-
const is_mobile = glb.MOBILE_ARR.includes(paramsP.screenInfo.properties?.menuType);
|
|
16579
|
-
const nodeTag = nodeP.tagName;
|
|
16580
|
-
|
|
16581
|
-
// Optimized element finder with caching
|
|
16582
|
-
const get_element_info = function () {
|
|
16583
|
-
if (!_ds) return {};
|
|
16584
|
-
|
|
16585
|
-
const currentRecordId = _ds.currentRecordId || '';
|
|
16586
|
-
const $div = func.UI.utils.find_in_element_data('xuData', $container.parent(), 'nodeid', nodeP.id);
|
|
16587
|
-
|
|
16588
|
-
for (let i = 0; i < $div.length; i++) {
|
|
16589
|
-
const $el = $($div[i]);
|
|
16590
|
-
const xuData = $el.data().xuData;
|
|
16591
|
-
if (xuData?.recordid === currentRecordId && xuData?.key === keyP && $el.prop('tagName') !== 'XURENDER') {
|
|
16592
|
-
return { div: $div };
|
|
16593
|
-
}
|
|
16594
|
-
}
|
|
16595
|
-
return {};
|
|
16596
|
-
};
|
|
16597
|
-
|
|
16598
|
-
const init = async function () {
|
|
16599
|
-
return !!nodeP;
|
|
16600
|
-
};
|
|
16601
|
-
|
|
16602
|
-
const debug = function (is_errorP, error_descP) {
|
|
16603
|
-
func.utils.debug.log(SESSION_ID, `${paramsP.prog_id}_${nodeP.id_org}_ui_prop`, {
|
|
16604
|
-
module: 'gui',
|
|
16605
|
-
action: 'init',
|
|
16606
|
-
prop: nodeP.id,
|
|
16607
|
-
details: error_descP,
|
|
16608
|
-
result: null,
|
|
16609
|
-
error: is_errorP,
|
|
16610
|
-
source: _ds?.tree_obj?.menuName || '',
|
|
16611
|
-
fields: null,
|
|
16612
|
-
type: null,
|
|
16613
|
-
prog_id: paramsP.prog_id,
|
|
16614
|
-
dsSession: null,
|
|
16615
|
-
});
|
|
16616
|
-
};
|
|
16617
|
-
|
|
16618
|
-
const close_modal = async function (modal_id) {
|
|
16619
|
-
delete APP_MODAL_OBJ[modal_id];
|
|
16620
|
-
const xu_modal_controller = document.querySelector('xu-modal-controller');
|
|
16621
|
-
const params = $(xu_modal_controller).data().xuControllerParams?.[modal_id];
|
|
16622
|
-
if (params?.container) {
|
|
16623
|
-
await func.UI.screen.validate_exit_events(SESSION_ID, params.$container.data().xuData.paramsP, null);
|
|
16624
|
-
func.datasource.clean_all(SESSION_ID, params.dsSession);
|
|
16625
|
-
}
|
|
16626
|
-
};
|
|
16627
|
-
|
|
16628
|
-
const close_all_modals = function () {
|
|
16629
|
-
Object.entries(APP_MODAL_OBJ).forEach(([key, val]) => {
|
|
16630
|
-
if (val) {
|
|
16631
|
-
UI_FRAMEWORK_PLUGIN.modal.close(key);
|
|
16632
|
-
}
|
|
16633
|
-
});
|
|
16634
|
-
};
|
|
16635
|
-
|
|
16636
|
-
const open_modal = async function ($div) {
|
|
16637
|
-
const modal_id = `app_modal-${paramsP.dsSessionP}`;
|
|
16638
|
-
let xu_modal_controller = document.querySelector('xu-modal-controller');
|
|
16639
|
-
|
|
16640
|
-
if (!xu_modal_controller) {
|
|
16641
|
-
func.UI.component.create_app_modal_component(SESSION_ID, modal_id);
|
|
16642
|
-
xu_modal_controller = document.querySelector('xu-modal-controller');
|
|
16643
|
-
}
|
|
16644
|
-
|
|
16645
|
-
let controller_params = $(xu_modal_controller).data('xuControllerParams') || {};
|
|
16646
|
-
|
|
16647
|
-
controller_params[modal_id] = {
|
|
16648
|
-
menuTitle: paramsP.screenInfo.properties?.menuTitle,
|
|
16649
|
-
screenId: paramsP.screenId,
|
|
16650
|
-
$dialogDiv: $div.children(),
|
|
16651
|
-
$container: $container,
|
|
16652
|
-
dsSession: paramsP.dsSessionP,
|
|
16653
|
-
};
|
|
16574
|
+
// func.UI.screen.render_ui_tree_bad = async function (SESSION_ID, $container, nodeP, parent_infoP, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, $root_container) {
|
|
16575
|
+
// // Early cache session and datasource
|
|
16576
|
+
// let _session, _ds;
|
|
16577
|
+
// if (!is_skeleton) {
|
|
16578
|
+
// _session = SESSION_OBJ[SESSION_ID];
|
|
16579
|
+
// _ds = _session.DS_GLB[paramsP.dsSessionP];
|
|
16580
|
+
// }
|
|
16654
16581
|
|
|
16655
|
-
|
|
16656
|
-
|
|
16582
|
+
// const prop = nodeP.attributes;
|
|
16583
|
+
// const is_mobile = glb.MOBILE_ARR.includes(paramsP.screenInfo.properties?.menuType);
|
|
16584
|
+
// const nodeTag = nodeP.tagName;
|
|
16657
16585
|
|
|
16658
|
-
|
|
16659
|
-
|
|
16660
|
-
|
|
16661
|
-
$(modal_id).empty();
|
|
16662
|
-
}
|
|
16586
|
+
// // Optimized element finder with caching
|
|
16587
|
+
// const get_element_info = function () {
|
|
16588
|
+
// if (!_ds) return {};
|
|
16663
16589
|
|
|
16664
|
-
|
|
16665
|
-
|
|
16666
|
-
};
|
|
16590
|
+
// const currentRecordId = _ds.currentRecordId || '';
|
|
16591
|
+
// const $div = func.UI.utils.find_in_element_data('xuData', $container.parent(), 'nodeid', nodeP.id);
|
|
16667
16592
|
|
|
16668
|
-
|
|
16669
|
-
|
|
16593
|
+
// for (let i = 0; i < $div.length; i++) {
|
|
16594
|
+
// const $el = $($div[i]);
|
|
16595
|
+
// const xuData = $el.data().xuData;
|
|
16596
|
+
// if (xuData?.recordid === currentRecordId && xuData?.key === keyP && $el.prop('tagName') !== 'XURENDER') {
|
|
16597
|
+
// return { div: $div };
|
|
16598
|
+
// }
|
|
16599
|
+
// }
|
|
16600
|
+
// return {};
|
|
16601
|
+
// };
|
|
16670
16602
|
|
|
16671
|
-
|
|
16672
|
-
|
|
16673
|
-
|
|
16674
|
-
$dialogDiv: $div.children(),
|
|
16675
|
-
$container: $container,
|
|
16676
|
-
});
|
|
16603
|
+
// const init = async function () {
|
|
16604
|
+
// return !!nodeP;
|
|
16605
|
+
// };
|
|
16677
16606
|
|
|
16678
|
-
|
|
16679
|
-
|
|
16680
|
-
|
|
16681
|
-
|
|
16607
|
+
// const debug = function (is_errorP, error_descP) {
|
|
16608
|
+
// func.utils.debug.log(SESSION_ID, `${paramsP.prog_id}_${nodeP.id_org}_ui_prop`, {
|
|
16609
|
+
// module: 'gui',
|
|
16610
|
+
// action: 'init',
|
|
16611
|
+
// prop: nodeP.id,
|
|
16612
|
+
// details: error_descP,
|
|
16613
|
+
// result: null,
|
|
16614
|
+
// error: is_errorP,
|
|
16615
|
+
// source: _ds?.tree_obj?.menuName || '',
|
|
16616
|
+
// fields: null,
|
|
16617
|
+
// type: null,
|
|
16618
|
+
// prog_id: paramsP.prog_id,
|
|
16619
|
+
// dsSession: null,
|
|
16620
|
+
// });
|
|
16621
|
+
// };
|
|
16682
16622
|
|
|
16683
|
-
|
|
16684
|
-
|
|
16685
|
-
|
|
16623
|
+
// const close_modal = async function (modal_id) {
|
|
16624
|
+
// delete APP_MODAL_OBJ[modal_id];
|
|
16625
|
+
// const xu_modal_controller = document.querySelector('xu-modal-controller');
|
|
16626
|
+
// const params = $(xu_modal_controller).data().xuControllerParams?.[modal_id];
|
|
16627
|
+
// if (params?.container) {
|
|
16628
|
+
// await func.UI.screen.validate_exit_events(SESSION_ID, params.$container.data().xuData.paramsP, null);
|
|
16629
|
+
// func.datasource.clean_all(SESSION_ID, params.dsSession);
|
|
16630
|
+
// }
|
|
16631
|
+
// };
|
|
16686
16632
|
|
|
16687
|
-
|
|
16633
|
+
// const close_all_modals = function () {
|
|
16634
|
+
// Object.entries(APP_MODAL_OBJ).forEach(([key, val]) => {
|
|
16635
|
+
// if (val) {
|
|
16636
|
+
// UI_FRAMEWORK_PLUGIN.modal.close(key);
|
|
16637
|
+
// }
|
|
16638
|
+
// });
|
|
16639
|
+
// };
|
|
16688
16640
|
|
|
16689
|
-
|
|
16690
|
-
|
|
16691
|
-
|
|
16692
|
-
}, 1000);
|
|
16693
|
-
return $divP;
|
|
16694
|
-
};
|
|
16641
|
+
// const open_modal = async function ($div) {
|
|
16642
|
+
// const modal_id = `app_modal-${paramsP.dsSessionP}`;
|
|
16643
|
+
// let xu_modal_controller = document.querySelector('xu-modal-controller');
|
|
16695
16644
|
|
|
16696
|
-
|
|
16697
|
-
|
|
16698
|
-
|
|
16645
|
+
// if (!xu_modal_controller) {
|
|
16646
|
+
// func.UI.component.create_app_modal_component(SESSION_ID, modal_id);
|
|
16647
|
+
// xu_modal_controller = document.querySelector('xu-modal-controller');
|
|
16648
|
+
// }
|
|
16699
16649
|
|
|
16700
|
-
|
|
16701
|
-
await before_record_function();
|
|
16702
|
-
}
|
|
16650
|
+
// let controller_params = $(xu_modal_controller).data('xuControllerParams') || {};
|
|
16703
16651
|
|
|
16704
|
-
|
|
16705
|
-
|
|
16652
|
+
// controller_params[modal_id] = {
|
|
16653
|
+
// menuTitle: paramsP.screenInfo.properties?.menuTitle,
|
|
16654
|
+
// screenId: paramsP.screenId,
|
|
16655
|
+
// $dialogDiv: $div.children(),
|
|
16656
|
+
// $container: $container,
|
|
16657
|
+
// dsSession: paramsP.dsSessionP,
|
|
16658
|
+
// };
|
|
16706
16659
|
|
|
16707
|
-
|
|
16708
|
-
|
|
16660
|
+
// $(xu_modal_controller).data('xuControllerParams', controller_params);
|
|
16661
|
+
// const modalController = new UI_FRAMEWORK_PLUGIN.modal();
|
|
16709
16662
|
|
|
16710
|
-
|
|
16711
|
-
|
|
16712
|
-
|
|
16713
|
-
|
|
16663
|
+
// if (!APP_MODAL_OBJ[modal_id]) {
|
|
16664
|
+
// APP_MODAL_OBJ[modal_id] = await modalController.create(SESSION_ID, modal_id, paramsP.screenInfo, close_modal);
|
|
16665
|
+
// } else {
|
|
16666
|
+
// $(modal_id).empty();
|
|
16667
|
+
// }
|
|
16714
16668
|
|
|
16715
|
-
|
|
16716
|
-
|
|
16717
|
-
|
|
16718
|
-
}
|
|
16719
|
-
return $($el[0]);
|
|
16720
|
-
} catch (e) {
|
|
16721
|
-
console.error(e);
|
|
16722
|
-
return $elm;
|
|
16723
|
-
}
|
|
16724
|
-
};
|
|
16669
|
+
// await modalController.init(SESSION_ID, modal_id);
|
|
16670
|
+
// return $div;
|
|
16671
|
+
// };
|
|
16725
16672
|
|
|
16726
|
-
|
|
16727
|
-
|
|
16673
|
+
// const open_popover = async function ($div) {
|
|
16674
|
+
// const xu_popover_controller = func.UI.component.create_app_popover_component(SESSION_ID);
|
|
16728
16675
|
|
|
16729
|
-
|
|
16676
|
+
// $(xu_popover_controller).data('xuControllerParams', {
|
|
16677
|
+
// menuTitle: paramsP.screenInfo.properties?.menuTitle,
|
|
16678
|
+
// screenId: paramsP.screenId,
|
|
16679
|
+
// $dialogDiv: $div.children(),
|
|
16680
|
+
// $container: $container,
|
|
16681
|
+
// });
|
|
16730
16682
|
|
|
16731
|
-
|
|
16732
|
-
|
|
16733
|
-
|
|
16734
|
-
|
|
16683
|
+
// const popover = new UI_FRAMEWORK_PLUGIN.popover(SESSION_ID);
|
|
16684
|
+
// await popover.open(SESSION_ID);
|
|
16685
|
+
// CURRENT_APP_POPOVER = popover;
|
|
16686
|
+
// };
|
|
16735
16687
|
|
|
16736
|
-
|
|
16688
|
+
// // OPTIMIZED: Parallel child iteration with improved logic
|
|
16689
|
+
// const iterate_child = async function ($divP, nodeP, parent_infoP, $root_container, before_record_function) {
|
|
16690
|
+
// if (!is_mobile && nodeP.busy) return $divP;
|
|
16737
16691
|
|
|
16738
|
-
|
|
16739
|
-
const attributes = {};
|
|
16740
|
-
Array.from($div[0].attributes).forEach((attr) => {
|
|
16741
|
-
attributes[attr.name] = attr.value;
|
|
16742
|
-
});
|
|
16743
|
-
_session.DS_GLB[0].data_system.SYS_OBJ_WIN_ELEMENT_HOVERED_ATTRIBUTES = attributes;
|
|
16692
|
+
// nodeP.busy = true;
|
|
16744
16693
|
|
|
16745
|
-
|
|
16746
|
-
|
|
16694
|
+
// const done = function ($divP) {
|
|
16695
|
+
// setTimeout(() => {
|
|
16696
|
+
// nodeP.busy = false;
|
|
16697
|
+
// }, 1000);
|
|
16698
|
+
// return $divP;
|
|
16699
|
+
// };
|
|
16747
16700
|
|
|
16748
|
-
|
|
16749
|
-
|
|
16750
|
-
|
|
16751
|
-
if (is_dynamic) {
|
|
16752
|
-
_ds.dynamic_fields[field_id].value = value;
|
|
16753
|
-
} else {
|
|
16754
|
-
try {
|
|
16755
|
-
const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
|
|
16756
|
-
_ds.data_feed.rows[row_idx][field_id] = value;
|
|
16757
|
-
} catch (err) {
|
|
16758
|
-
console.error(err);
|
|
16759
|
-
}
|
|
16760
|
-
}
|
|
16761
|
-
};
|
|
16701
|
+
// if (!nodeP?.children?.length) {
|
|
16702
|
+
// return done($divP);
|
|
16703
|
+
// }
|
|
16762
16704
|
|
|
16763
|
-
|
|
16764
|
-
|
|
16765
|
-
|
|
16705
|
+
// if (before_record_function) {
|
|
16706
|
+
// await before_record_function();
|
|
16707
|
+
// }
|
|
16766
16708
|
|
|
16767
|
-
|
|
16768
|
-
|
|
16769
|
-
}
|
|
16709
|
+
// // Parallel rendering for better performance
|
|
16710
|
+
// 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)));
|
|
16770
16711
|
|
|
16771
|
-
|
|
16772
|
-
|
|
16773
|
-
const set_value = (field_id, value) => {
|
|
16774
|
-
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);
|
|
16775
|
-
};
|
|
16712
|
+
// return done($divP);
|
|
16713
|
+
// };
|
|
16776
16714
|
|
|
16777
|
-
|
|
16778
|
-
|
|
16779
|
-
|
|
16780
|
-
|
|
16715
|
+
// const _$ = function ($elm) {
|
|
16716
|
+
// try {
|
|
16717
|
+
// const id = $elm.attr('xu-ui-id');
|
|
16718
|
+
// if (!id || !glb.DEBUG_MODE) return $elm;
|
|
16781
16719
|
|
|
16782
|
-
|
|
16783
|
-
|
|
16720
|
+
// const $el = $(`[xu-ui-id="${id}"]`);
|
|
16721
|
+
// if ($el.length > 1) {
|
|
16722
|
+
// console.warn(`Multiple elements for xu-ui-id: ${id}`, $el);
|
|
16723
|
+
// }
|
|
16724
|
+
// return $($el[0]);
|
|
16725
|
+
// } catch (e) {
|
|
16726
|
+
// console.error(e);
|
|
16727
|
+
// return $elm;
|
|
16728
|
+
// }
|
|
16729
|
+
// };
|
|
16784
16730
|
|
|
16785
|
-
|
|
16731
|
+
// const hover_in = function ($div, e) {
|
|
16732
|
+
// if (is_skeleton || (e && (EXP_BUSY || UI_WORKER_OBJ.jobs.length))) return;
|
|
16786
16733
|
|
|
16787
|
-
|
|
16788
|
-
if (containerXuData?.debug_info) {
|
|
16789
|
-
containerXuData.debug_info.hover_item = null;
|
|
16790
|
-
}
|
|
16734
|
+
// CLIENT_ACTIVITY_TS = Date.now();
|
|
16791
16735
|
|
|
16792
|
-
|
|
16793
|
-
|
|
16794
|
-
|
|
16795
|
-
|
|
16736
|
+
// const containerXuData = _$($container)?.data()?.xuData;
|
|
16737
|
+
// if (containerXuData?.debug_info) {
|
|
16738
|
+
// containerXuData.debug_info.hover_item = $div.attr('xu-ui-id');
|
|
16739
|
+
// }
|
|
16796
16740
|
|
|
16797
|
-
|
|
16798
|
-
const set_call_screen_properties_values = async function (ui_framework, params) {
|
|
16799
|
-
params.properties = {};
|
|
16741
|
+
// if (!_ds) return;
|
|
16800
16742
|
|
|
16801
|
-
|
|
16802
|
-
|
|
16743
|
+
// // Set attributes
|
|
16744
|
+
// const attributes = {};
|
|
16745
|
+
// Array.from($div[0].attributes).forEach((attr) => {
|
|
16746
|
+
// attributes[attr.name] = attr.value;
|
|
16747
|
+
// });
|
|
16748
|
+
// _session.DS_GLB[0].data_system.SYS_OBJ_WIN_ELEMENT_HOVERED_ATTRIBUTES = attributes;
|
|
16749
|
+
|
|
16750
|
+
// const divXuData = $div.data()?.xuData;
|
|
16751
|
+
// if (!divXuData) return;
|
|
16752
|
+
|
|
16753
|
+
// const _iterate_info = divXuData.iterate_info;
|
|
16754
|
+
// if (_iterate_info) {
|
|
16755
|
+
// const set_field_value = (field_id, value, is_dynamic) => {
|
|
16756
|
+
// if (is_dynamic) {
|
|
16757
|
+
// _ds.dynamic_fields[field_id].value = value;
|
|
16758
|
+
// } else {
|
|
16759
|
+
// try {
|
|
16760
|
+
// const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
|
|
16761
|
+
// _ds.data_feed.rows[row_idx][field_id] = value;
|
|
16762
|
+
// } catch (err) {
|
|
16763
|
+
// console.error(err);
|
|
16764
|
+
// }
|
|
16765
|
+
// }
|
|
16766
|
+
// };
|
|
16803
16767
|
|
|
16804
|
-
|
|
16805
|
-
|
|
16806
|
-
|
|
16807
|
-
}
|
|
16808
|
-
const expKey = `xu-exp:${property}`;
|
|
16809
|
-
if (paramsP.call_screen_propertiesP[expKey]) {
|
|
16810
|
-
property_value = (await func.expression.get(SESSION_ID, paramsP.call_screen_propertiesP[expKey], paramsP.dsSessionP, property)).result;
|
|
16811
|
-
}
|
|
16812
|
-
}
|
|
16813
|
-
return property_value;
|
|
16814
|
-
};
|
|
16768
|
+
// set_field_value(_iterate_info.iterator_key, _iterate_info._key, _iterate_info.is_key_dynamic_field);
|
|
16769
|
+
// set_field_value(_iterate_info.iterator_val, _iterate_info._val, _iterate_info.is_val_dynamic_field);
|
|
16770
|
+
// }
|
|
16815
16771
|
|
|
16816
|
-
|
|
16817
|
-
|
|
16818
|
-
|
|
16819
|
-
for (const [key, val] of Object.entries(uiProps)) {
|
|
16820
|
-
params.properties[key] = await get_values(key);
|
|
16821
|
-
}
|
|
16822
|
-
}
|
|
16823
|
-
};
|
|
16772
|
+
// if ($div && _$($div) && _ds && paramsP.renderType === 'grid') {
|
|
16773
|
+
// func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'update_datasource', { currentRecordId: _$($div).data().xuData.currentRecordId }, null, null, paramsP.dsSessionP);
|
|
16774
|
+
// }
|
|
16824
16775
|
|
|
16825
|
-
|
|
16776
|
+
// const iterate_data = $div?.data()?.xuData?.iterate_info;
|
|
16777
|
+
// if (iterate_data) {
|
|
16778
|
+
// const set_value = (field_id, value) => {
|
|
16779
|
+
// 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);
|
|
16780
|
+
// };
|
|
16826
16781
|
|
|
16827
|
-
|
|
16828
|
-
|
|
16829
|
-
|
|
16830
|
-
|
|
16831
|
-
xuData.parent_container = $div.data().xuData.parent_container;
|
|
16832
|
-
}
|
|
16833
|
-
});
|
|
16782
|
+
// if (iterate_data.iterator_key) set_value(iterate_data.iterator_key, iterate_data._key);
|
|
16783
|
+
// if (iterate_data.iterator_val) set_value(iterate_data.iterator_val, iterate_data._val);
|
|
16784
|
+
// }
|
|
16785
|
+
// };
|
|
16834
16786
|
|
|
16835
|
-
|
|
16836
|
-
|
|
16787
|
+
// const hover_out = function () {
|
|
16788
|
+
// if (is_skeleton) return;
|
|
16837
16789
|
|
|
16838
|
-
|
|
16839
|
-
case 'modal':
|
|
16840
|
-
const modal_id = `app_modal-${paramsP.dsSessionP}`;
|
|
16841
|
-
let xu_modal_controller = document.querySelector('xu-modal-controller');
|
|
16790
|
+
// CLIENT_ACTIVITY_TS = Date.now();
|
|
16842
16791
|
|
|
16843
|
-
|
|
16844
|
-
|
|
16845
|
-
|
|
16846
|
-
|
|
16792
|
+
// const containerXuData = _$($container)?.data()?.xuData;
|
|
16793
|
+
// if (containerXuData?.debug_info) {
|
|
16794
|
+
// containerXuData.debug_info.hover_item = null;
|
|
16795
|
+
// }
|
|
16847
16796
|
|
|
16848
|
-
|
|
16797
|
+
// if (_ds?.data_system) {
|
|
16798
|
+
// SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system.SYS_OBJ_WIN_ELEMENT_HOVERED_ATTRIBUTES = {};
|
|
16799
|
+
// }
|
|
16800
|
+
// };
|
|
16849
16801
|
|
|
16850
|
-
|
|
16851
|
-
|
|
16852
|
-
|
|
16853
|
-
$container: $container,
|
|
16854
|
-
dsSession: paramsP.dsSessionP,
|
|
16855
|
-
modal_id,
|
|
16856
|
-
screenInfo: paramsP.screenInfo,
|
|
16857
|
-
close_callback: close_modal,
|
|
16858
|
-
paramsP,
|
|
16859
|
-
};
|
|
16802
|
+
// const render_screen_type = async function ($div) {
|
|
16803
|
+
// const set_call_screen_properties_values = async function (ui_framework, params) {
|
|
16804
|
+
// params.properties = {};
|
|
16860
16805
|
|
|
16861
|
-
|
|
16862
|
-
|
|
16806
|
+
// const get_values = async function (property) {
|
|
16807
|
+
// let property_value = paramsP?.screenInfo?.properties?.[property] || paramsP?.screenInfo?.properties?.frameworkProperties?.[property];
|
|
16863
16808
|
|
|
16864
|
-
|
|
16865
|
-
|
|
16809
|
+
// if (paramsP?.call_screen_propertiesP) {
|
|
16810
|
+
// if (paramsP.call_screen_propertiesP[property]) {
|
|
16811
|
+
// property_value = paramsP.call_screen_propertiesP[property];
|
|
16812
|
+
// }
|
|
16813
|
+
// const expKey = `xu-exp:${property}`;
|
|
16814
|
+
// if (paramsP.call_screen_propertiesP[expKey]) {
|
|
16815
|
+
// property_value = (await func.expression.get(SESSION_ID, paramsP.call_screen_propertiesP[expKey], paramsP.dsSessionP, property)).result;
|
|
16816
|
+
// }
|
|
16817
|
+
// }
|
|
16818
|
+
// return property_value;
|
|
16819
|
+
// };
|
|
16866
16820
|
|
|
16867
|
-
|
|
16868
|
-
|
|
16869
|
-
|
|
16870
|
-
|
|
16871
|
-
|
|
16872
|
-
|
|
16873
|
-
|
|
16821
|
+
// params.properties['name'] = await get_values('menuTitle');
|
|
16822
|
+
// const uiProps = await ui_framework?.properties?.();
|
|
16823
|
+
// if (uiProps) {
|
|
16824
|
+
// for (const [key, val] of Object.entries(uiProps)) {
|
|
16825
|
+
// params.properties[key] = await get_values(key);
|
|
16826
|
+
// }
|
|
16827
|
+
// }
|
|
16828
|
+
// };
|
|
16874
16829
|
|
|
16875
|
-
|
|
16876
|
-
const xu_popover_controller = func.UI.component.create_app_popover_component(SESSION_ID);
|
|
16877
|
-
const popoverParams = {
|
|
16878
|
-
menuTitle: paramsP.screenInfo.properties?.menuTitle,
|
|
16879
|
-
screenId: paramsP.screenId,
|
|
16880
|
-
$dialogDiv: $div.children(),
|
|
16881
|
-
$container: $container,
|
|
16882
|
-
};
|
|
16830
|
+
// const $div_content = $div.children();
|
|
16883
16831
|
|
|
16884
|
-
|
|
16885
|
-
|
|
16886
|
-
|
|
16887
|
-
|
|
16888
|
-
|
|
16889
|
-
|
|
16890
|
-
|
|
16832
|
+
// // Update parent container for children
|
|
16833
|
+
// $div_content.each((key, val) => {
|
|
16834
|
+
// const xuData = $(val)?.data()?.xuData;
|
|
16835
|
+
// if (xuData && !xuData.parent_container) {
|
|
16836
|
+
// xuData.parent_container = $div.data().xuData.parent_container;
|
|
16837
|
+
// }
|
|
16838
|
+
// });
|
|
16891
16839
|
|
|
16892
|
-
|
|
16893
|
-
|
|
16894
|
-
const pageParams = {
|
|
16895
|
-
div: $div_content,
|
|
16896
|
-
name: paramsP.screenInfo.properties?.menuTitle,
|
|
16897
|
-
screenId: paramsP.screenId,
|
|
16898
|
-
$container: $container,
|
|
16899
|
-
dsSession: paramsP.dsSessionP,
|
|
16900
|
-
SESSION_ID,
|
|
16901
|
-
nav,
|
|
16902
|
-
paramsP,
|
|
16903
|
-
};
|
|
16840
|
+
// let $ret = $div;
|
|
16841
|
+
// const $nav = $(SESSION_OBJ[SESSION_ID].root_element).find('xu-nav');
|
|
16904
16842
|
|
|
16905
|
-
|
|
16906
|
-
|
|
16843
|
+
// switch (paramsP.screen_type) {
|
|
16844
|
+
// case 'modal':
|
|
16845
|
+
// const modal_id = `app_modal-${paramsP.dsSessionP}`;
|
|
16846
|
+
// let xu_modal_controller = document.querySelector('xu-modal-controller');
|
|
16907
16847
|
|
|
16908
|
-
|
|
16909
|
-
|
|
16910
|
-
|
|
16848
|
+
// if (!xu_modal_controller) {
|
|
16849
|
+
// func.UI.component.create_app_modal_component(SESSION_ID, modal_id);
|
|
16850
|
+
// xu_modal_controller = document.querySelector('xu-modal-controller');
|
|
16851
|
+
// }
|
|
16911
16852
|
|
|
16912
|
-
|
|
16913
|
-
|
|
16914
|
-
|
|
16915
|
-
|
|
16853
|
+
// let controller_params = $(xu_modal_controller).data('xuControllerParams') || {};
|
|
16854
|
+
|
|
16855
|
+
// const modalParams = {
|
|
16856
|
+
// screenId: paramsP.screenId,
|
|
16857
|
+
// $dialogDiv: $div.children(),
|
|
16858
|
+
// $container: $container,
|
|
16859
|
+
// dsSession: paramsP.dsSessionP,
|
|
16860
|
+
// modal_id,
|
|
16861
|
+
// screenInfo: paramsP.screenInfo,
|
|
16862
|
+
// close_callback: close_modal,
|
|
16863
|
+
// paramsP,
|
|
16864
|
+
// };
|
|
16916
16865
|
|
|
16917
|
-
|
|
16918
|
-
|
|
16866
|
+
// controller_params[modal_id] = modalParams;
|
|
16867
|
+
// $(xu_modal_controller).data('xuControllerParams', controller_params);
|
|
16919
16868
|
|
|
16920
|
-
|
|
16921
|
-
|
|
16922
|
-
const page = new UI_FRAMEWORK_PLUGIN.page();
|
|
16923
|
-
await set_call_screen_properties_values(page, pageParams);
|
|
16924
|
-
await page.create(pageParams);
|
|
16925
|
-
await page.init(pageParams);
|
|
16926
|
-
nav.push(component_name, { params: pageParams });
|
|
16927
|
-
} else {
|
|
16928
|
-
$(component_name).empty();
|
|
16929
|
-
await UI_FRAMEWORK_PLUGIN.page(SESSION_ID, paramsP.dsSessionP);
|
|
16930
|
-
}
|
|
16931
|
-
$div.data().xuData.paramsP = $container.data().xuData.paramsP;
|
|
16932
|
-
break;
|
|
16869
|
+
// const modalController = new UI_FRAMEWORK_PLUGIN.modal();
|
|
16870
|
+
// await set_call_screen_properties_values(modalController, modalParams);
|
|
16933
16871
|
|
|
16934
|
-
|
|
16935
|
-
|
|
16936
|
-
|
|
16937
|
-
|
|
16872
|
+
// if (!APP_MODAL_OBJ[modal_id]) {
|
|
16873
|
+
// APP_MODAL_OBJ[modal_id] = await modalController.create(modalParams);
|
|
16874
|
+
// } else {
|
|
16875
|
+
// $(modal_id).empty();
|
|
16876
|
+
// }
|
|
16877
|
+
// await modalController.init(modalParams);
|
|
16878
|
+
// break;
|
|
16879
|
+
|
|
16880
|
+
// case 'popover':
|
|
16881
|
+
// const xu_popover_controller = func.UI.component.create_app_popover_component(SESSION_ID);
|
|
16882
|
+
// const popoverParams = {
|
|
16883
|
+
// menuTitle: paramsP.screenInfo.properties?.menuTitle,
|
|
16884
|
+
// screenId: paramsP.screenId,
|
|
16885
|
+
// $dialogDiv: $div.children(),
|
|
16886
|
+
// $container: $container,
|
|
16887
|
+
// };
|
|
16938
16888
|
|
|
16939
|
-
|
|
16940
|
-
|
|
16941
|
-
|
|
16942
|
-
|
|
16943
|
-
|
|
16944
|
-
|
|
16945
|
-
|
|
16889
|
+
// $(xu_popover_controller).data('xuControllerParams', popoverParams);
|
|
16890
|
+
// const popover = new UI_FRAMEWORK_PLUGIN.popover(SESSION_ID);
|
|
16891
|
+
// await set_call_screen_properties_values(popover, popoverParams);
|
|
16892
|
+
// await popover.open(popoverParams);
|
|
16893
|
+
// CURRENT_APP_POPOVER = popover;
|
|
16894
|
+
// func.UI.utils.screen_blocker(false, `${paramsP.prog_id}_${paramsP.sourceScreenP}`);
|
|
16895
|
+
// break;
|
|
16896
|
+
|
|
16897
|
+
// case 'page':
|
|
16898
|
+
// const nav = $nav[0];
|
|
16899
|
+
// const pageParams = {
|
|
16900
|
+
// div: $div_content,
|
|
16901
|
+
// name: paramsP.screenInfo.properties?.menuTitle,
|
|
16902
|
+
// screenId: paramsP.screenId,
|
|
16903
|
+
// $container: $container,
|
|
16904
|
+
// dsSession: paramsP.dsSessionP,
|
|
16905
|
+
// SESSION_ID,
|
|
16906
|
+
// nav,
|
|
16907
|
+
// paramsP,
|
|
16908
|
+
// };
|
|
16946
16909
|
|
|
16947
|
-
|
|
16948
|
-
|
|
16949
|
-
navData.$div = $div_content;
|
|
16950
|
-
}
|
|
16910
|
+
// const component_name = `xu-page-component-${paramsP.dsSessionP}`;
|
|
16911
|
+
// const navXuData = $(nav).data().xuData;
|
|
16951
16912
|
|
|
16952
|
-
|
|
16953
|
-
|
|
16954
|
-
|
|
16955
|
-
}
|
|
16956
|
-
$ret = $container;
|
|
16957
|
-
break;
|
|
16958
|
-
}
|
|
16959
|
-
return $ret;
|
|
16960
|
-
};
|
|
16913
|
+
// if (!navXuData.nav_params) {
|
|
16914
|
+
// navXuData.nav_params = {};
|
|
16915
|
+
// }
|
|
16961
16916
|
|
|
16962
|
-
|
|
16963
|
-
|
|
16917
|
+
// // Restore validate
|
|
16918
|
+
// if (navXuData.params?.[paramsP.dsSessionP]) {
|
|
16919
|
+
// pageParams.$container.data().xuData.validate_screen_ready = navXuData.params[paramsP.dsSessionP].$container.data().xuData.validate_screen_ready;
|
|
16920
|
+
// }
|
|
16964
16921
|
|
|
16965
|
-
|
|
16966
|
-
|
|
16967
|
-
|
|
16968
|
-
|
|
16922
|
+
// if (!navXuData) return;
|
|
16923
|
+
// navXuData.nav_params[paramsP.dsSessionP] = pageParams;
|
|
16924
|
+
|
|
16925
|
+
// if (!$(component_name).length) {
|
|
16926
|
+
// await func.UI.component.create_app_page_component(SESSION_ID, paramsP.dsSessionP);
|
|
16927
|
+
// const page = new UI_FRAMEWORK_PLUGIN.page();
|
|
16928
|
+
// await set_call_screen_properties_values(page, pageParams);
|
|
16929
|
+
// await page.create(pageParams);
|
|
16930
|
+
// await page.init(pageParams);
|
|
16931
|
+
// nav.push(component_name, { params: pageParams });
|
|
16932
|
+
// } else {
|
|
16933
|
+
// $(component_name).empty();
|
|
16934
|
+
// await UI_FRAMEWORK_PLUGIN.page(SESSION_ID, paramsP.dsSessionP);
|
|
16935
|
+
// }
|
|
16936
|
+
// $div.data().xuData.paramsP = $container.data().xuData.paramsP;
|
|
16937
|
+
// break;
|
|
16938
|
+
|
|
16939
|
+
// case 'panel':
|
|
16940
|
+
// $container.append($div_content);
|
|
16941
|
+
// $ret = $container;
|
|
16942
|
+
// break;
|
|
16943
|
+
|
|
16944
|
+
// default:
|
|
16945
|
+
// let $activeNav = $nav;
|
|
16946
|
+
// if (!$activeNav?.length) {
|
|
16947
|
+
// $activeNav = $('<xu-nav>');
|
|
16948
|
+
// $container.append($activeNav);
|
|
16949
|
+
// func.UI.component.init_xu_nav($container, $activeNav);
|
|
16950
|
+
// }
|
|
16969
16951
|
|
|
16970
|
-
|
|
16971
|
-
|
|
16952
|
+
// const navData = $activeNav.data().xuData;
|
|
16953
|
+
// if (navData) {
|
|
16954
|
+
// navData.$div = $div_content;
|
|
16955
|
+
// }
|
|
16972
16956
|
|
|
16973
|
-
|
|
16974
|
-
|
|
16975
|
-
|
|
16976
|
-
|
|
16977
|
-
|
|
16957
|
+
// const navElement = $activeNav[0];
|
|
16958
|
+
// if (navElement && navElement.setRoot) {
|
|
16959
|
+
// await navElement.setRoot(`xu-root-component-${SESSION_ID}`);
|
|
16960
|
+
// }
|
|
16961
|
+
// $ret = $container;
|
|
16962
|
+
// break;
|
|
16963
|
+
// }
|
|
16964
|
+
// return $ret;
|
|
16965
|
+
// };
|
|
16978
16966
|
|
|
16979
|
-
|
|
16980
|
-
|
|
16981
|
-
};
|
|
16967
|
+
// if (!(await init())) return;
|
|
16968
|
+
// debug();
|
|
16982
16969
|
|
|
16983
|
-
|
|
16984
|
-
|
|
16985
|
-
|
|
16986
|
-
|
|
16987
|
-
source: sourceP,
|
|
16988
|
-
prop: descP,
|
|
16989
|
-
details: descP,
|
|
16990
|
-
result: null,
|
|
16991
|
-
error: !warn,
|
|
16992
|
-
fields: null,
|
|
16993
|
-
type: 'widgets',
|
|
16994
|
-
prog_id: _session.DS_GLB[dsP].prog_id,
|
|
16995
|
-
});
|
|
16996
|
-
};
|
|
16970
|
+
// const fx = {
|
|
16971
|
+
// widget: async function () {
|
|
16972
|
+
// const exist_elm_obj = get_element_info();
|
|
16973
|
+
// let $div = exist_elm_obj.div;
|
|
16997
16974
|
|
|
16998
|
-
|
|
16999
|
-
|
|
17000
|
-
if (!val) return;
|
|
16975
|
+
// if (!exist_elm_obj.div) {
|
|
16976
|
+
// $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);
|
|
17001
16977
|
|
|
17002
|
-
|
|
16978
|
+
// const plugin_name = prop['xu-widget'];
|
|
16979
|
+
// const method = prop['xu-method'];
|
|
16980
|
+
// const dsP = paramsP.dsSessionP;
|
|
16981
|
+
// const propsP = prop;
|
|
16982
|
+
// const sourceP = 'widgets';
|
|
17003
16983
|
|
|
17004
|
-
|
|
17005
|
-
|
|
17006
|
-
|
|
16984
|
+
// const call_plugin_api = async (plugin_nameP, dataP) => {
|
|
16985
|
+
// return await func.utils.call_plugin_api(SESSION_ID, plugin_nameP, dataP);
|
|
16986
|
+
// };
|
|
17007
16987
|
|
|
17008
|
-
|
|
17009
|
-
|
|
17010
|
-
|
|
17011
|
-
|
|
16988
|
+
// const report_error = (descP, warn) => {
|
|
16989
|
+
// func.utils.debug.log(SESSION_ID, `${_session.DS_GLB[dsP].prog_id}_${_session.DS_GLB[dsP].callingMenuId}`, {
|
|
16990
|
+
// module: 'widgets',
|
|
16991
|
+
// action: 'Init',
|
|
16992
|
+
// source: sourceP,
|
|
16993
|
+
// prop: descP,
|
|
16994
|
+
// details: descP,
|
|
16995
|
+
// result: null,
|
|
16996
|
+
// error: !warn,
|
|
16997
|
+
// fields: null,
|
|
16998
|
+
// type: 'widgets',
|
|
16999
|
+
// prog_id: _session.DS_GLB[dsP].prog_id,
|
|
17000
|
+
// });
|
|
17001
|
+
// };
|
|
17012
17002
|
|
|
17013
|
-
|
|
17014
|
-
|
|
17003
|
+
// const get_fields_data = async (fields, props) => {
|
|
17004
|
+
// const get_property_value = async (fieldIdP, val) => {
|
|
17005
|
+
// if (!val) return;
|
|
17015
17006
|
|
|
17016
|
-
|
|
17017
|
-
let return_code = 1;
|
|
17007
|
+
// let value = fieldIdP in props ? props[fieldIdP] : typeof val.defaultValue === 'function' ? val.defaultValue() : val.defaultValue;
|
|
17018
17008
|
|
|
17019
|
-
|
|
17020
|
-
|
|
17021
|
-
|
|
17022
|
-
return_code = -1;
|
|
17023
|
-
report_error(`${key} is a mandatory field.`);
|
|
17024
|
-
break;
|
|
17025
|
-
}
|
|
17026
|
-
}
|
|
17009
|
+
// if (val.render === 'eventId') {
|
|
17010
|
+
// value = props?.[fieldIdP]?.event;
|
|
17011
|
+
// }
|
|
17027
17012
|
|
|
17028
|
-
|
|
17013
|
+
// const expKey = `xu-exp:${fieldIdP}`;
|
|
17014
|
+
// if (props[expKey]) {
|
|
17015
|
+
// value = (await func.expression.get(SESSION_ID, props[expKey], dsP, 'widget property')).result;
|
|
17016
|
+
// }
|
|
17029
17017
|
|
|
17030
|
-
|
|
17031
|
-
|
|
17018
|
+
// return func.common.get_cast_val(SESSION_ID, 'widgets', fieldIdP, val.type, value, null);
|
|
17019
|
+
// };
|
|
17032
17020
|
|
|
17033
|
-
|
|
17034
|
-
|
|
17035
|
-
if (_session.worker_type === 'Dev') {
|
|
17036
|
-
return `../../plugins/${plugin_name}/${resource}`;
|
|
17037
|
-
}
|
|
17038
|
-
const manifest = APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name].manifest[resource];
|
|
17039
|
-
const dist = manifest.dist ? 'dist/' : '';
|
|
17040
|
-
return `https://${_session.domain}/plugins/${plugin_name}/${dist}${resource}?gtp_token=${_session.gtp_token}&app_id=${_session.app_id}`;
|
|
17041
|
-
};
|
|
17042
|
-
func.utils.load_css_on_demand(get_css_path('style.css'));
|
|
17043
|
-
};
|
|
17021
|
+
// const data_obj = {};
|
|
17022
|
+
// let return_code = 1;
|
|
17044
17023
|
|
|
17045
|
-
|
|
17046
|
-
|
|
17047
|
-
|
|
17048
|
-
|
|
17024
|
+
// for (const [key, val] of Object.entries(fields)) {
|
|
17025
|
+
// data_obj[key] = await get_property_value(key, val);
|
|
17026
|
+
// if (!data_obj[key] && val.mandatory) {
|
|
17027
|
+
// return_code = -1;
|
|
17028
|
+
// report_error(`${key} is a mandatory field.`);
|
|
17029
|
+
// break;
|
|
17030
|
+
// }
|
|
17031
|
+
// }
|
|
17049
17032
|
|
|
17050
|
-
|
|
17051
|
-
return report_error('method not found');
|
|
17052
|
-
}
|
|
17033
|
+
// data_obj['xu-bind'] = await get_property_value('xu-bind', props['xu-bind']);
|
|
17053
17034
|
|
|
17054
|
-
|
|
17055
|
-
|
|
17056
|
-
return report_error(fields_ret.data);
|
|
17057
|
-
}
|
|
17035
|
+
// return { code: return_code, data: data_obj };
|
|
17036
|
+
// };
|
|
17058
17037
|
|
|
17059
|
-
|
|
17060
|
-
|
|
17038
|
+
// const load_css_style = () => {
|
|
17039
|
+
// const get_css_path = (resource) => {
|
|
17040
|
+
// if (_session.worker_type === 'Dev') {
|
|
17041
|
+
// return `../../plugins/${plugin_name}/${resource}`;
|
|
17042
|
+
// }
|
|
17043
|
+
// const manifest = APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name].manifest[resource];
|
|
17044
|
+
// const dist = manifest.dist ? 'dist/' : '';
|
|
17045
|
+
// return `https://${_session.domain}/plugins/${plugin_name}/${dist}${resource}?gtp_token=${_session.gtp_token}&app_id=${_session.app_id}`;
|
|
17046
|
+
// };
|
|
17047
|
+
// func.utils.load_css_on_demand(get_css_path('style.css'));
|
|
17048
|
+
// };
|
|
17061
17049
|
|
|
17062
|
-
|
|
17050
|
+
// const _plugin = APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
|
|
17051
|
+
// const indexDist = _plugin.manifest['index.mjs'].dist ? 'dist/' : '';
|
|
17052
|
+
// const index = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${indexDist}index.mjs`);
|
|
17053
|
+
// const methods = index.methods;
|
|
17063
17054
|
|
|
17064
|
-
|
|
17055
|
+
// if (methods && !methods[method]) {
|
|
17056
|
+
// return report_error('method not found');
|
|
17057
|
+
// }
|
|
17065
17058
|
|
|
17066
|
-
|
|
17067
|
-
|
|
17068
|
-
|
|
17059
|
+
// const fields_ret = await get_fields_data(methods[method].fields, propsP);
|
|
17060
|
+
// if (fields_ret.code < 0) {
|
|
17061
|
+
// return report_error(fields_ret.data);
|
|
17062
|
+
// }
|
|
17069
17063
|
|
|
17070
|
-
|
|
17071
|
-
|
|
17072
|
-
}
|
|
17064
|
+
// const fields = fields_ret.data;
|
|
17065
|
+
// const exclude_attributes = Object.keys(propsP).filter((key) => fields[key] !== undefined || fields[`xu-exp:${key}`] !== undefined);
|
|
17073
17066
|
|
|
17074
|
-
|
|
17075
|
-
if (plugin_setup_ret.code < 0) {
|
|
17076
|
-
return report_error(plugin_setup_ret);
|
|
17077
|
-
}
|
|
17067
|
+
// 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);
|
|
17078
17068
|
|
|
17079
|
-
|
|
17080
|
-
func,
|
|
17081
|
-
glb,
|
|
17082
|
-
SESSION_OBJ,
|
|
17083
|
-
SESSION_ID,
|
|
17084
|
-
APP_OBJ,
|
|
17085
|
-
dsSession: paramsP.dsSessionP,
|
|
17086
|
-
job_id: jobNoP,
|
|
17087
|
-
});
|
|
17069
|
+
// $div.addClass('widget_wrapper');
|
|
17088
17070
|
|
|
17089
|
-
|
|
17090
|
-
|
|
17091
|
-
|
|
17092
|
-
_session,
|
|
17093
|
-
dsP,
|
|
17094
|
-
sourceP,
|
|
17095
|
-
propsP,
|
|
17096
|
-
plugin_name,
|
|
17097
|
-
$containerP: $div,
|
|
17098
|
-
plugin_setup: plugin_setup_ret.data,
|
|
17099
|
-
report_error,
|
|
17100
|
-
call_plugin_api,
|
|
17101
|
-
api_utils,
|
|
17102
|
-
};
|
|
17071
|
+
// if (!APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name]) {
|
|
17072
|
+
// return report_error(`plugin ${plugin_name} not found`);
|
|
17073
|
+
// }
|
|
17103
17074
|
|
|
17104
|
-
|
|
17105
|
-
|
|
17075
|
+
// if (APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name].manifest['style.css'].exist) {
|
|
17076
|
+
// load_css_style();
|
|
17077
|
+
// }
|
|
17106
17078
|
|
|
17107
|
-
|
|
17108
|
-
|
|
17109
|
-
|
|
17110
|
-
|
|
17079
|
+
// const plugin_setup_ret = await func.utils.get_plugin_setup(SESSION_ID, plugin_name);
|
|
17080
|
+
// if (plugin_setup_ret.code < 0) {
|
|
17081
|
+
// return report_error(plugin_setup_ret);
|
|
17082
|
+
// }
|
|
17111
17083
|
|
|
17112
|
-
|
|
17113
|
-
|
|
17114
|
-
|
|
17084
|
+
// const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
|
|
17085
|
+
// func,
|
|
17086
|
+
// glb,
|
|
17087
|
+
// SESSION_OBJ,
|
|
17088
|
+
// SESSION_ID,
|
|
17089
|
+
// APP_OBJ,
|
|
17090
|
+
// dsSession: paramsP.dsSessionP,
|
|
17091
|
+
// job_id: jobNoP,
|
|
17092
|
+
// });
|
|
17115
17093
|
|
|
17116
|
-
|
|
17117
|
-
|
|
17118
|
-
|
|
17119
|
-
|
|
17120
|
-
|
|
17121
|
-
|
|
17122
|
-
|
|
17123
|
-
|
|
17094
|
+
// const params = {
|
|
17095
|
+
// SESSION_ID,
|
|
17096
|
+
// method,
|
|
17097
|
+
// _session,
|
|
17098
|
+
// dsP,
|
|
17099
|
+
// sourceP,
|
|
17100
|
+
// propsP,
|
|
17101
|
+
// plugin_name,
|
|
17102
|
+
// $containerP: $div,
|
|
17103
|
+
// plugin_setup: plugin_setup_ret.data,
|
|
17104
|
+
// report_error,
|
|
17105
|
+
// call_plugin_api,
|
|
17106
|
+
// api_utils,
|
|
17107
|
+
// };
|
|
17124
17108
|
|
|
17125
|
-
|
|
17126
|
-
|
|
17127
|
-
let $div = exist_elm_obj.div;
|
|
17109
|
+
// const runtimeDist = _plugin.manifest['runtime.mjs'].dist ? 'dist/' : '';
|
|
17110
|
+
// const fx = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${runtimeDist}runtime.mjs`);
|
|
17128
17111
|
|
|
17129
|
-
|
|
17130
|
-
|
|
17131
|
-
|
|
17112
|
+
// if (_plugin?.manifest?.['runtime.mjs'].dist && _plugin?.manifest?.['runtime.mjs']?.css) {
|
|
17113
|
+
// const css_url = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, 'dist/runtime.css');
|
|
17114
|
+
// func.utils.load_css_on_demand(css_url);
|
|
17115
|
+
// }
|
|
17132
17116
|
|
|
17133
|
-
|
|
17117
|
+
// if (!fx[method]) {
|
|
17118
|
+
// throw `Method: ${method} does not exist`;
|
|
17119
|
+
// }
|
|
17134
17120
|
|
|
17135
|
-
|
|
17136
|
-
|
|
17137
|
-
|
|
17121
|
+
// try {
|
|
17122
|
+
// await fx[method](fields, params);
|
|
17123
|
+
// } catch (err) {
|
|
17124
|
+
// func.utils.debug_report(SESSION_ID, `${plugin_name} widget`, err.message, 'E');
|
|
17125
|
+
// }
|
|
17126
|
+
// }
|
|
17127
|
+
// return $div;
|
|
17128
|
+
// },
|
|
17138
17129
|
|
|
17139
|
-
|
|
17140
|
-
|
|
17141
|
-
|
|
17142
|
-
);
|
|
17143
|
-
}
|
|
17130
|
+
// 'xu-single-view': async function () {
|
|
17131
|
+
// const exist_elm_obj = get_element_info();
|
|
17132
|
+
// let $div = exist_elm_obj.div;
|
|
17144
17133
|
|
|
17145
|
-
|
|
17134
|
+
// if (!exist_elm_obj.div) {
|
|
17135
|
+
// const $wrapper = $('<div>');
|
|
17136
|
+
// $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, '');
|
|
17146
17137
|
|
|
17147
|
-
|
|
17148
|
-
|
|
17149
|
-
|
|
17138
|
+
// if (!$div) return;
|
|
17139
|
+
|
|
17140
|
+
// if (!REFRESHER_IN_PROGRESS && (paramsP.is_mobile_popover || paramsP.is_mobile_page)) {
|
|
17141
|
+
// close_all_modals();
|
|
17142
|
+
// }
|
|
17143
|
+
|
|
17144
|
+
// $div.hover(
|
|
17145
|
+
// (e) => hover_in(),
|
|
17146
|
+
// (e) => hover_out(),
|
|
17147
|
+
// );
|
|
17148
|
+
// }
|
|
17150
17149
|
|
|
17151
|
-
|
|
17152
|
-
Object.assign($container.data().xuData, _.cloneDeep($div.data().xuData));
|
|
17153
|
-
Object.assign($container.data().xuAttributes, klona.klona($div.data().xuAttributes));
|
|
17150
|
+
// await iterate_child($div, nodeP, null, $div);
|
|
17154
17151
|
|
|
17155
|
-
|
|
17156
|
-
|
|
17152
|
+
// if (_.isEmpty($container.data().xuAttributes)) {
|
|
17153
|
+
// await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
|
|
17154
|
+
// }
|
|
17157
17155
|
|
|
17158
|
-
|
|
17159
|
-
|
|
17156
|
+
// // Copy xuData and xuAttributes
|
|
17157
|
+
// Object.assign($container.data().xuData, _.cloneDeep($div.data().xuData));
|
|
17158
|
+
// Object.assign($container.data().xuAttributes, klona.klona($div.data().xuAttributes));
|
|
17160
17159
|
|
|
17161
|
-
|
|
17162
|
-
|
|
17163
|
-
divXuData.node = nodeP;
|
|
17164
|
-
}
|
|
17160
|
+
// return await render_screen_type($div);
|
|
17161
|
+
// },
|
|
17165
17162
|
|
|
17166
|
-
|
|
17167
|
-
|
|
17168
|
-
id: nodeP.id,
|
|
17169
|
-
parent_id: $container.data().xuData.ui_id,
|
|
17170
|
-
};
|
|
17171
|
-
}
|
|
17163
|
+
// 'xu-multi-view': async function () {
|
|
17164
|
+
// let $div = $container;
|
|
17172
17165
|
|
|
17173
|
-
|
|
17174
|
-
|
|
17175
|
-
|
|
17176
|
-
|
|
17166
|
+
// const divXuData = $div.data().xuData;
|
|
17167
|
+
// if (!divXuData.node || !divXuData.node.children) {
|
|
17168
|
+
// divXuData.node = nodeP;
|
|
17169
|
+
// }
|
|
17177
17170
|
|
|
17178
|
-
|
|
17179
|
-
|
|
17180
|
-
|
|
17171
|
+
// if (!divXuData.debug_info) {
|
|
17172
|
+
// divXuData.debug_info = {
|
|
17173
|
+
// id: nodeP.id,
|
|
17174
|
+
// parent_id: $container.data().xuData.ui_id,
|
|
17175
|
+
// };
|
|
17176
|
+
// }
|
|
17181
17177
|
|
|
17182
|
-
|
|
17183
|
-
|
|
17184
|
-
|
|
17185
|
-
|
|
17178
|
+
// const done = async function (continuous_idx) {
|
|
17179
|
+
// await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
|
|
17180
|
+
// return await render_screen_type($div);
|
|
17181
|
+
// };
|
|
17186
17182
|
|
|
17187
|
-
|
|
17188
|
-
|
|
17189
|
-
|
|
17183
|
+
// if (!REFRESHER_IN_PROGRESS && (paramsP.is_mobile_popover || paramsP.is_mobile_page)) {
|
|
17184
|
+
// close_all_modals();
|
|
17185
|
+
// }
|
|
17190
17186
|
|
|
17191
|
-
|
|
17192
|
-
|
|
17193
|
-
|
|
17194
|
-
|
|
17187
|
+
// const empty_result = async function () {
|
|
17188
|
+
// await func.events.validate(SESSION_ID, 'record_not_found', paramsP.dsSessionP);
|
|
17189
|
+
// return await done(null);
|
|
17190
|
+
// };
|
|
17195
17191
|
|
|
17196
|
-
|
|
17197
|
-
|
|
17198
|
-
|
|
17199
|
-
}
|
|
17192
|
+
// if (!_ds.data_feed || _.isEmpty(_ds.data_feed.rows)) {
|
|
17193
|
+
// return await empty_result();
|
|
17194
|
+
// }
|
|
17200
17195
|
|
|
17201
|
-
|
|
17202
|
-
|
|
17196
|
+
// for (const [key, val] of Object.entries(_ds.data_feed.rows)) {
|
|
17197
|
+
// const node = JSON.parse(JSON.stringify(nodeP));
|
|
17198
|
+
// _ds.currentRecordId = val._ROWID;
|
|
17199
|
+
// await iterate_child($div, node, { continuous_idx: null }, $root_container);
|
|
17203
17200
|
|
|
17204
|
-
|
|
17205
|
-
|
|
17206
|
-
|
|
17207
|
-
|
|
17208
|
-
}
|
|
17201
|
+
// if (_.isEmpty($container.data().xuAttributes)) {
|
|
17202
|
+
// await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
|
|
17203
|
+
// }
|
|
17204
|
+
// }
|
|
17209
17205
|
|
|
17210
|
-
|
|
17211
|
-
|
|
17212
|
-
$container.data().xuData.node.children = $div_items;
|
|
17213
|
-
return $container;
|
|
17214
|
-
};
|
|
17206
|
+
// return await done(null);
|
|
17207
|
+
// },
|
|
17215
17208
|
|
|
17216
|
-
|
|
17217
|
-
|
|
17209
|
+
// 'xu-panel': async function () {
|
|
17210
|
+
// const done = async function ($new_div) {
|
|
17211
|
+
// if (!$container.data()?.xuData?.paramsP) {
|
|
17212
|
+
// return $container;
|
|
17213
|
+
// }
|
|
17218
17214
|
|
|
17219
|
-
|
|
17215
|
+
// const $div_items = $div.data().xuData.node.children;
|
|
17216
|
+
// await func.UI.screen.panel_post_render_handler(SESSION_ID, $container, $new_div, nodeP, $div, jobNoP);
|
|
17217
|
+
// $container.data().xuData.node.children = $div_items;
|
|
17218
|
+
// return $container;
|
|
17219
|
+
// };
|
|
17220
17220
|
|
|
17221
|
-
|
|
17222
|
-
|
|
17223
|
-
}
|
|
17221
|
+
// const $wrapper = $('<div>');
|
|
17222
|
+
// 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, '');
|
|
17224
17223
|
|
|
17225
|
-
|
|
17224
|
+
// 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);
|
|
17226
17225
|
|
|
17227
|
-
|
|
17228
|
-
|
|
17229
|
-
|
|
17226
|
+
// if (ret.abort) {
|
|
17227
|
+
// return (ret.$new_div = $('<template>').append($div));
|
|
17228
|
+
// }
|
|
17230
17229
|
|
|
17231
|
-
|
|
17232
|
-
},
|
|
17233
|
-
};
|
|
17230
|
+
// let $ret_panel_div = ret.$new_div;
|
|
17234
17231
|
|
|
17235
|
-
|
|
17236
|
-
|
|
17237
|
-
|
|
17238
|
-
$div.removeClass('display_none');
|
|
17232
|
+
// if (!$ret_panel_div?.children()?.length && nodeP.children.length) {
|
|
17233
|
+
// $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);
|
|
17234
|
+
// }
|
|
17239
17235
|
|
|
17240
|
-
|
|
17241
|
-
|
|
17236
|
+
// return await done($ret_panel_div);
|
|
17237
|
+
// },
|
|
17238
|
+
// };
|
|
17242
17239
|
|
|
17243
|
-
|
|
17244
|
-
|
|
17245
|
-
|
|
17246
|
-
|
|
17247
|
-
data: _$div.data(),
|
|
17248
|
-
};
|
|
17240
|
+
// const draw_html_element = async function (element) {
|
|
17241
|
+
// const done = async function (ret = {}) {
|
|
17242
|
+
// const xu_ui_id = $div.attr('xu-ui-id');
|
|
17243
|
+
// $div.removeClass('display_none');
|
|
17249
17244
|
|
|
17250
|
-
|
|
17251
|
-
|
|
17245
|
+
// if (ret.has_xu_exp_render_attribute) {
|
|
17246
|
+
// 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 || {}));
|
|
17252
17247
|
|
|
17253
|
-
|
|
17254
|
-
|
|
17255
|
-
|
|
17256
|
-
|
|
17257
|
-
|
|
17258
|
-
|
|
17259
|
-
}
|
|
17248
|
+
// const _$div = $div.clone(true);
|
|
17249
|
+
// UI_WORKER_OBJ.xu_render_cache[xu_ui_id + xu_render_cache_id] = {
|
|
17250
|
+
// $div: _$div,
|
|
17251
|
+
// paramsP,
|
|
17252
|
+
// data: _$div.data(),
|
|
17253
|
+
// };
|
|
17260
17254
|
|
|
17261
|
-
|
|
17262
|
-
|
|
17263
|
-
return $div;
|
|
17264
|
-
}
|
|
17255
|
+
// nodeP.xu_render_xu_ui_id = xu_ui_id;
|
|
17256
|
+
// nodeP.xu_render_cache_id = xu_render_cache_id;
|
|
17265
17257
|
|
|
17266
|
-
|
|
17267
|
-
|
|
17268
|
-
|
|
17258
|
+
// if (ret.xu_render_background_processing) {
|
|
17259
|
+
// temp_$div.remove();
|
|
17260
|
+
// return $div;
|
|
17261
|
+
// }
|
|
17262
|
+
// temp_$div.replaceWith($div);
|
|
17263
|
+
// return $div;
|
|
17264
|
+
// }
|
|
17269
17265
|
|
|
17270
|
-
|
|
17266
|
+
// if (ret.has_xu_render_attribute) {
|
|
17267
|
+
// temp_$div.remove();
|
|
17268
|
+
// return $div;
|
|
17269
|
+
// }
|
|
17271
17270
|
|
|
17272
|
-
|
|
17271
|
+
// temp_$div.replaceWith($div);
|
|
17272
|
+
// return $div;
|
|
17273
|
+
// };
|
|
17273
17274
|
|
|
17274
|
-
|
|
17275
|
-
const $div = temp_$div.clone(true);
|
|
17275
|
+
// if (!element || element === 'script') return await done();
|
|
17276
17276
|
|
|
17277
|
-
|
|
17278
|
-
(e) => hover_in($div, e),
|
|
17279
|
-
(e) => hover_out(),
|
|
17280
|
-
);
|
|
17277
|
+
// 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);
|
|
17281
17278
|
|
|
17282
|
-
|
|
17283
|
-
|
|
17284
|
-
}
|
|
17279
|
+
// const temp_$container = $('<tmp>').data('xuData', $container.data().xuData);
|
|
17280
|
+
// const $div = temp_$div.clone(true);
|
|
17285
17281
|
|
|
17286
|
-
|
|
17282
|
+
// $div.hover(
|
|
17283
|
+
// (e) => hover_in($div, e),
|
|
17284
|
+
// (e) => hover_out(),
|
|
17285
|
+
// );
|
|
17287
17286
|
|
|
17288
|
-
|
|
17289
|
-
|
|
17290
|
-
|
|
17287
|
+
// if (paramsP.paramsP === 'grid' || parent_infoP?.iterate_info) {
|
|
17288
|
+
// $div.on('click contextmenu', (e) => hover_in($div, e));
|
|
17289
|
+
// }
|
|
17291
17290
|
|
|
17292
|
-
|
|
17293
|
-
const xu_viewport = function () {
|
|
17294
|
-
const observer_inViewport = new IntersectionObserver(
|
|
17295
|
-
(entries) => {
|
|
17296
|
-
entries.forEach((entry) => {
|
|
17297
|
-
if (entry.isIntersecting) {
|
|
17298
|
-
$(entry.target).trigger('inViewport');
|
|
17299
|
-
observer_inViewport.unobserve(entry.target);
|
|
17300
|
-
}
|
|
17301
|
-
});
|
|
17302
|
-
},
|
|
17303
|
-
{ threshold: 0.1 },
|
|
17304
|
-
);
|
|
17291
|
+
// 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);
|
|
17305
17292
|
|
|
17306
|
-
|
|
17307
|
-
|
|
17308
|
-
|
|
17309
|
-
if (!entry.isIntersecting) {
|
|
17310
|
-
$(entry.target).trigger('outViewport');
|
|
17311
|
-
}
|
|
17312
|
-
});
|
|
17313
|
-
},
|
|
17314
|
-
{ threshold: 0 },
|
|
17315
|
-
);
|
|
17293
|
+
// 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'])) {
|
|
17294
|
+
// return await done(ret);
|
|
17295
|
+
// }
|
|
17316
17296
|
|
|
17317
|
-
|
|
17297
|
+
// if (nodeP?.attributes?.['xu-viewport'] === 'true') {
|
|
17298
|
+
// const xu_viewport = function () {
|
|
17299
|
+
// const observer_inViewport = new IntersectionObserver(
|
|
17300
|
+
// (entries) => {
|
|
17301
|
+
// entries.forEach((entry) => {
|
|
17302
|
+
// if (entry.isIntersecting) {
|
|
17303
|
+
// $(entry.target).trigger('inViewport');
|
|
17304
|
+
// observer_inViewport.unobserve(entry.target);
|
|
17305
|
+
// }
|
|
17306
|
+
// });
|
|
17307
|
+
// },
|
|
17308
|
+
// { threshold: 0.1 },
|
|
17309
|
+
// );
|
|
17318
17310
|
|
|
17319
|
-
|
|
17320
|
-
|
|
17321
|
-
|
|
17322
|
-
|
|
17323
|
-
|
|
17311
|
+
// const observer_outViewport = new IntersectionObserver(
|
|
17312
|
+
// (entries) => {
|
|
17313
|
+
// entries.forEach((entry) => {
|
|
17314
|
+
// if (!entry.isIntersecting) {
|
|
17315
|
+
// $(entry.target).trigger('outViewport');
|
|
17316
|
+
// }
|
|
17317
|
+
// });
|
|
17318
|
+
// },
|
|
17319
|
+
// { threshold: 0 },
|
|
17320
|
+
// );
|
|
17324
17321
|
|
|
17325
|
-
|
|
17326
|
-
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);
|
|
17327
|
-
observer_outViewport.observe($div[0]);
|
|
17328
|
-
});
|
|
17322
|
+
// let ui_job_id;
|
|
17329
17323
|
|
|
17330
|
-
|
|
17331
|
-
|
|
17324
|
+
// $div.on('inViewport', function () {
|
|
17325
|
+
// if ($div.children().length) {
|
|
17326
|
+
// $div.removeClass('skeleton');
|
|
17327
|
+
// return;
|
|
17328
|
+
// }
|
|
17332
17329
|
|
|
17333
|
-
|
|
17334
|
-
|
|
17335
|
-
|
|
17336
|
-
|
|
17337
|
-
$div.css('height', height);
|
|
17338
|
-
}
|
|
17339
|
-
}
|
|
17340
|
-
observer_inViewport.observe($div[0]);
|
|
17341
|
-
});
|
|
17330
|
+
// hover_in($div);
|
|
17331
|
+
// 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);
|
|
17332
|
+
// observer_outViewport.observe($div[0]);
|
|
17333
|
+
// });
|
|
17342
17334
|
|
|
17343
|
-
|
|
17344
|
-
|
|
17345
|
-
};
|
|
17346
|
-
xu_viewport();
|
|
17347
|
-
} else {
|
|
17348
|
-
if (!ret.xu_render_background_processing) {
|
|
17349
|
-
iterate_child($div, nodeP, parent_infoP, $root_container);
|
|
17350
|
-
}
|
|
17351
|
-
}
|
|
17335
|
+
// $div.on('outViewport', function () {
|
|
17336
|
+
// func.UI.worker.delete_job(SESSION_ID, ui_job_id);
|
|
17352
17337
|
|
|
17353
|
-
|
|
17354
|
-
|
|
17338
|
+
// if ($div.children().length) {
|
|
17339
|
+
// $div.empty();
|
|
17340
|
+
// const height = $div?.data()?.xuData?.viewport_height || 10;
|
|
17341
|
+
// if (height !== undefined) {
|
|
17342
|
+
// $div.css('height', height);
|
|
17343
|
+
// }
|
|
17344
|
+
// }
|
|
17345
|
+
// observer_inViewport.observe($div[0]);
|
|
17346
|
+
// });
|
|
17355
17347
|
|
|
17356
|
-
|
|
17357
|
-
|
|
17358
|
-
|
|
17359
|
-
|
|
17348
|
+
// $div.addClass('skeleton');
|
|
17349
|
+
// observer_inViewport.observe($div[0]);
|
|
17350
|
+
// };
|
|
17351
|
+
// xu_viewport();
|
|
17352
|
+
// } else {
|
|
17353
|
+
// if (!ret.xu_render_background_processing) {
|
|
17354
|
+
// iterate_child($div, nodeP, parent_infoP, $root_container);
|
|
17355
|
+
// }
|
|
17356
|
+
// }
|
|
17360
17357
|
|
|
17361
|
-
|
|
17362
|
-
|
|
17363
|
-
if (is_skeleton) return;
|
|
17364
|
-
return await fx['widget']();
|
|
17365
|
-
}
|
|
17358
|
+
// return await done(ret);
|
|
17359
|
+
// };
|
|
17366
17360
|
|
|
17367
|
-
|
|
17368
|
-
|
|
17369
|
-
|
|
17370
|
-
|
|
17361
|
+
// // Handle content attribute
|
|
17362
|
+
// if (nodeP.content && nodeP.attributes) {
|
|
17363
|
+
// nodeP.attributes['xu-content'] = nodeP.content;
|
|
17364
|
+
// }
|
|
17371
17365
|
|
|
17372
|
-
|
|
17373
|
-
|
|
17374
|
-
|
|
17375
|
-
|
|
17376
|
-
|
|
17366
|
+
// // Handle xu-widget
|
|
17367
|
+
// if (nodeTag === 'xu-widget') {
|
|
17368
|
+
// if (is_skeleton) return;
|
|
17369
|
+
// return await fx['widget']();
|
|
17370
|
+
// }
|
|
17377
17371
|
|
|
17378
|
-
|
|
17372
|
+
// // Handle custom tags
|
|
17373
|
+
// if (fx[nodeTag]) {
|
|
17374
|
+
// return await fx[nodeTag]();
|
|
17375
|
+
// }
|
|
17379
17376
|
|
|
17380
|
-
|
|
17377
|
+
// // Old rendering path (when glb.new_xu_render is false)
|
|
17378
|
+
// const draw_html_element_org = async function (element) {
|
|
17379
|
+
// const done = async function (ret = {}) {
|
|
17380
|
+
// return $div;
|
|
17381
|
+
// };
|
|
17381
17382
|
|
|
17382
|
-
|
|
17383
|
-
(e) => hover_in($div, e),
|
|
17384
|
-
(e) => hover_out(),
|
|
17385
|
-
);
|
|
17383
|
+
// if (!element || element === 'script') return await done();
|
|
17386
17384
|
|
|
17387
|
-
|
|
17388
|
-
$div.on('click contextmenu', (e) => hover_in($div, e));
|
|
17389
|
-
}
|
|
17385
|
+
// const $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, '');
|
|
17390
17386
|
|
|
17391
|
-
|
|
17387
|
+
// $div.hover(
|
|
17388
|
+
// (e) => hover_in($div, e),
|
|
17389
|
+
// (e) => hover_out(),
|
|
17390
|
+
// );
|
|
17392
17391
|
|
|
17393
|
-
|
|
17394
|
-
|
|
17395
|
-
|
|
17392
|
+
// if (paramsP.paramsP === 'grid' || parent_infoP?.iterate_info) {
|
|
17393
|
+
// $div.on('click contextmenu', (e) => hover_in($div, e));
|
|
17394
|
+
// }
|
|
17396
17395
|
|
|
17397
|
-
|
|
17398
|
-
const xu_viewport = function () {
|
|
17399
|
-
const observer_inViewport = new IntersectionObserver(
|
|
17400
|
-
(entries) => {
|
|
17401
|
-
entries.forEach((entry) => {
|
|
17402
|
-
if (entry.isIntersecting) {
|
|
17403
|
-
$(entry.target).trigger('inViewport');
|
|
17404
|
-
observer_inViewport.unobserve(entry.target);
|
|
17405
|
-
}
|
|
17406
|
-
});
|
|
17407
|
-
},
|
|
17408
|
-
{ threshold: 0.1 },
|
|
17409
|
-
);
|
|
17396
|
+
// 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);
|
|
17410
17397
|
|
|
17411
|
-
|
|
17412
|
-
|
|
17413
|
-
|
|
17414
|
-
if (!entry.isIntersecting) {
|
|
17415
|
-
$(entry.target).trigger('outViewport');
|
|
17416
|
-
}
|
|
17417
|
-
});
|
|
17418
|
-
},
|
|
17419
|
-
{ threshold: 0 },
|
|
17420
|
-
);
|
|
17398
|
+
// 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'])) {
|
|
17399
|
+
// return await done(ret);
|
|
17400
|
+
// }
|
|
17421
17401
|
|
|
17422
|
-
|
|
17402
|
+
// if (nodeP?.attributes?.['xu-viewport'] === 'true') {
|
|
17403
|
+
// const xu_viewport = function () {
|
|
17404
|
+
// const observer_inViewport = new IntersectionObserver(
|
|
17405
|
+
// (entries) => {
|
|
17406
|
+
// entries.forEach((entry) => {
|
|
17407
|
+
// if (entry.isIntersecting) {
|
|
17408
|
+
// $(entry.target).trigger('inViewport');
|
|
17409
|
+
// observer_inViewport.unobserve(entry.target);
|
|
17410
|
+
// }
|
|
17411
|
+
// });
|
|
17412
|
+
// },
|
|
17413
|
+
// { threshold: 0.1 },
|
|
17414
|
+
// );
|
|
17423
17415
|
|
|
17424
|
-
|
|
17425
|
-
|
|
17426
|
-
|
|
17427
|
-
|
|
17428
|
-
|
|
17416
|
+
// const observer_outViewport = new IntersectionObserver(
|
|
17417
|
+
// (entries) => {
|
|
17418
|
+
// entries.forEach((entry) => {
|
|
17419
|
+
// if (!entry.isIntersecting) {
|
|
17420
|
+
// $(entry.target).trigger('outViewport');
|
|
17421
|
+
// }
|
|
17422
|
+
// });
|
|
17423
|
+
// },
|
|
17424
|
+
// { threshold: 0 },
|
|
17425
|
+
// );
|
|
17429
17426
|
|
|
17430
|
-
|
|
17431
|
-
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);
|
|
17432
|
-
observer_outViewport.observe($div[0]);
|
|
17433
|
-
});
|
|
17427
|
+
// let ui_job_id;
|
|
17434
17428
|
|
|
17435
|
-
|
|
17436
|
-
|
|
17429
|
+
// $div.on('inViewport', function () {
|
|
17430
|
+
// if ($div.children().length) {
|
|
17431
|
+
// $div.removeClass('skeleton');
|
|
17432
|
+
// return;
|
|
17433
|
+
// }
|
|
17437
17434
|
|
|
17438
|
-
|
|
17439
|
-
|
|
17440
|
-
|
|
17441
|
-
|
|
17442
|
-
$div.css('height', height);
|
|
17443
|
-
}
|
|
17444
|
-
}
|
|
17445
|
-
observer_inViewport.observe($div[0]);
|
|
17446
|
-
});
|
|
17435
|
+
// // hover_in($div);
|
|
17436
|
+
// 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);
|
|
17437
|
+
// observer_outViewport.observe($div[0]);
|
|
17438
|
+
// });
|
|
17447
17439
|
|
|
17448
|
-
|
|
17449
|
-
|
|
17450
|
-
};
|
|
17451
|
-
xu_viewport();
|
|
17452
|
-
} else {
|
|
17453
|
-
await iterate_child($div, nodeP, parent_infoP, $root_container);
|
|
17454
|
-
}
|
|
17440
|
+
// $div.on('outViewport', function () {
|
|
17441
|
+
// func.UI.worker.delete_job(SESSION_ID, ui_job_id);
|
|
17455
17442
|
|
|
17456
|
-
|
|
17457
|
-
|
|
17443
|
+
// if ($div.children().length) {
|
|
17444
|
+
// $div.empty();
|
|
17445
|
+
// const height = $div?.data()?.xuData?.viewport_height || 10;
|
|
17446
|
+
// if (height !== undefined) {
|
|
17447
|
+
// $div.css('height', height);
|
|
17448
|
+
// }
|
|
17449
|
+
// }
|
|
17450
|
+
// observer_inViewport.observe($div[0]);
|
|
17451
|
+
// });
|
|
17458
17452
|
|
|
17459
|
-
|
|
17460
|
-
|
|
17461
|
-
|
|
17462
|
-
|
|
17463
|
-
|
|
17464
|
-
|
|
17453
|
+
// $div.addClass('skeleton');
|
|
17454
|
+
// observer_inViewport.observe($div[0]);
|
|
17455
|
+
// };
|
|
17456
|
+
// xu_viewport();
|
|
17457
|
+
// } else {
|
|
17458
|
+
// await iterate_child($div, nodeP, parent_infoP, $root_container);
|
|
17459
|
+
// }
|
|
17460
|
+
|
|
17461
|
+
// return await done(ret);
|
|
17462
|
+
// };
|
|
17463
|
+
|
|
17464
|
+
// // Render HTML element
|
|
17465
|
+
// if (!glb.new_xu_render) {
|
|
17466
|
+
// return await draw_html_element_org(nodeTag);
|
|
17467
|
+
// }
|
|
17468
|
+
// return await draw_html_element(nodeTag);
|
|
17469
|
+
// };
|
|
17465
17470
|
|
|
17466
17471
|
func.UI.screen.refresh_document_changes_for_realtime_update = async function (SESSION_ID, doc_change) {
|
|
17467
17472
|
let _session = SESSION_OBJ[SESSION_ID];
|