@xuda.io/runtime-bundle 1.0.388 → 1.0.390
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/xuda-runtime-bundle.js +110 -27
- package/js/xuda-runtime-bundle.min.js +1 -1
- package/js/xuda-runtime-slim.js +110 -27
- package/js/xuda-runtime-slim.min.es.js +110 -27
- package/js/xuda-runtime-slim.min.js +1 -1
- package/js/xuda-server-bundle.min.mjs +1 -1
- package/js/xuda-server-bundle.mjs +10 -9
- package/js/xuda-worker-bundle.js +10 -9
- package/js/xuda-worker-bundle.min.js +1 -1
- package/package.json +1 -1
|
@@ -28221,6 +28221,22 @@ func.UI.refs_garbage_collector = function (SESSION_ID = Object.keys(SESSION_OBJ)
|
|
|
28221
28221
|
}
|
|
28222
28222
|
}
|
|
28223
28223
|
};
|
|
28224
|
+
|
|
28225
|
+
func.UI.update_xu_ref = function (SESSION_ID, dsSessionP) {
|
|
28226
|
+
const _session = SESSION_OBJ[SESSION_ID];
|
|
28227
|
+
let _ds_0 = _session.DS_GLB[0];
|
|
28228
|
+
|
|
28229
|
+
const _ds = func.utils.clean_returned_datasource(SESSION_ID, dsSessionP);
|
|
28230
|
+
|
|
28231
|
+
const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
|
|
28232
|
+
const data = _ds?.data_feed?.rows?.[row_idx] || {};
|
|
28233
|
+
|
|
28234
|
+
const props = _ds.in_parameters || {};
|
|
28235
|
+
const attributes = $elm?.data()?.xuData?.properties || {};
|
|
28236
|
+
const xu_ui_id = $elm.attr('xu-ui-id');
|
|
28237
|
+
|
|
28238
|
+
_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { ds: _ds, data, attributes, props, xu_ui_id };
|
|
28239
|
+
};
|
|
28224
28240
|
func.datasource = {};
|
|
28225
28241
|
func.datasource.create = async function (
|
|
28226
28242
|
SESSION_ID,
|
|
@@ -30119,15 +30135,16 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
30119
30135
|
_ds.data_feed.rows[row_idx][field_id] = value;
|
|
30120
30136
|
await set_fieldComputed_dependencies(dataSource, field_id, null);
|
|
30121
30137
|
|
|
30122
|
-
//
|
|
30123
|
-
|
|
30124
|
-
|
|
30125
|
-
|
|
30126
|
-
|
|
30127
|
-
|
|
30128
|
-
|
|
30129
|
-
|
|
30130
|
-
|
|
30138
|
+
// search the field in refs
|
|
30139
|
+
let _ds_0 = _session.DS_GLB[0];
|
|
30140
|
+
for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
|
|
30141
|
+
if (val.ds.dsSession == dataSource) {
|
|
30142
|
+
func.UI.update_xu_ref(SESSION_ID, dataSource);
|
|
30143
|
+
// if (!fields_changed.includes(ref_name)) {
|
|
30144
|
+
// fields_changed.push(ref_name);
|
|
30145
|
+
// }
|
|
30146
|
+
}
|
|
30147
|
+
}
|
|
30131
30148
|
|
|
30132
30149
|
if (!update_local_scope_only) {
|
|
30133
30150
|
let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
@@ -31961,20 +31978,21 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
|
|
|
31961
31978
|
|
|
31962
31979
|
const common_fx = {
|
|
31963
31980
|
'xu-ref': async function ($elm, val) {
|
|
31964
|
-
|
|
31965
|
-
|
|
31981
|
+
func.UI.update_xu_ref(SESSION_ID, paramsP.dsSessionP);
|
|
31982
|
+
// const _session = SESSION_OBJ[SESSION_ID];
|
|
31983
|
+
// let _ds_0 = _session.DS_GLB[0];
|
|
31966
31984
|
|
|
31967
|
-
const _ds = func.utils.clean_returned_datasource(SESSION_ID, paramsP.dsSessionP);
|
|
31985
|
+
// const _ds = func.utils.clean_returned_datasource(SESSION_ID, paramsP.dsSessionP);
|
|
31968
31986
|
|
|
31969
|
-
const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
|
|
31970
|
-
const data = _ds?.data_feed?.rows?.[row_idx] || {};
|
|
31987
|
+
// const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
|
|
31988
|
+
// const data = _ds?.data_feed?.rows?.[row_idx] || {};
|
|
31971
31989
|
|
|
31972
|
-
const props = _ds.in_parameters || {};
|
|
31973
|
-
const attributes = $elm?.data()?.xuData?.properties || {};
|
|
31974
|
-
const xu_ui_id = $elm.attr('xu-ui-id');
|
|
31990
|
+
// const props = _ds.in_parameters || {};
|
|
31991
|
+
// const attributes = $elm?.data()?.xuData?.properties || {};
|
|
31992
|
+
// const xu_ui_id = $elm.attr('xu-ui-id');
|
|
31975
31993
|
|
|
31976
|
-
// _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { $el: $elm, ds: _ds, data, attributes, props };
|
|
31977
|
-
_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { ds: _ds, data, attributes, props, xu_ui_id };
|
|
31994
|
+
// // _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { $el: $elm, ds: _ds, data, attributes, props };
|
|
31995
|
+
// _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { ds: _ds, data, attributes, props, xu_ui_id };
|
|
31978
31996
|
|
|
31979
31997
|
// const proxy1 = new Proxy(_session.DS_GLB[paramsP.dsSessionP], {
|
|
31980
31998
|
// get(target, prop, receiver) {
|
|
@@ -31989,15 +32007,80 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
|
|
|
31989
32007
|
|
|
31990
32008
|
// create a new instance of `MutationObserver` named `observer`,
|
|
31991
32009
|
// passing it a callback function
|
|
31992
|
-
const observer = new MutationObserver(() => {
|
|
31993
|
-
|
|
31994
|
-
});
|
|
32010
|
+
// const observer = new MutationObserver(() => {
|
|
32011
|
+
// console.log('callback that runs when observer is triggered');
|
|
32012
|
+
// });
|
|
31995
32013
|
|
|
31996
|
-
// call `observe()`, passing it the element to observe, and the options object
|
|
31997
|
-
observer.observe(_session.DS_GLB[paramsP.dsSessionP], {
|
|
31998
|
-
|
|
31999
|
-
|
|
32000
|
-
});
|
|
32014
|
+
// // call `observe()`, passing it the element to observe, and the options object
|
|
32015
|
+
// observer.observe(_session.DS_GLB[paramsP.dsSessionP], {
|
|
32016
|
+
// subtree: true,
|
|
32017
|
+
// childList: true,
|
|
32018
|
+
// });
|
|
32019
|
+
//==================
|
|
32020
|
+
// class ObjectObserver {
|
|
32021
|
+
// constructor(targetObject, callback) {
|
|
32022
|
+
// this.callback = callback;
|
|
32023
|
+
// this.target = targetObject;
|
|
32024
|
+
|
|
32025
|
+
// // Create a proxy to intercept property access and modifications
|
|
32026
|
+
// this.proxy = new Proxy(targetObject, {
|
|
32027
|
+
// set: (target, property, value) => {
|
|
32028
|
+
// const oldValue = target[property];
|
|
32029
|
+
// target[property] = value;
|
|
32030
|
+
|
|
32031
|
+
// // Call the callback with mutation information
|
|
32032
|
+
// this.callback({
|
|
32033
|
+
// type: 'update',
|
|
32034
|
+
// object: target,
|
|
32035
|
+
// property,
|
|
32036
|
+
// oldValue,
|
|
32037
|
+
// newValue: value,
|
|
32038
|
+
// });
|
|
32039
|
+
|
|
32040
|
+
// return true;
|
|
32041
|
+
// },
|
|
32042
|
+
|
|
32043
|
+
// deleteProperty: (target, property) => {
|
|
32044
|
+
// const oldValue = target[property];
|
|
32045
|
+
// const deleted = delete target[property];
|
|
32046
|
+
|
|
32047
|
+
// if (deleted) {
|
|
32048
|
+
// this.callback({
|
|
32049
|
+
// type: 'delete',
|
|
32050
|
+
// object: target,
|
|
32051
|
+
// property,
|
|
32052
|
+
// oldValue,
|
|
32053
|
+
// });
|
|
32054
|
+
// }
|
|
32055
|
+
|
|
32056
|
+
// return deleted;
|
|
32057
|
+
// },
|
|
32058
|
+
// });
|
|
32059
|
+
|
|
32060
|
+
// return this.proxy;
|
|
32061
|
+
// }
|
|
32062
|
+
|
|
32063
|
+
// // Method to stop observing (for cleanup)
|
|
32064
|
+
// disconnect() {
|
|
32065
|
+
// this.callback = null;
|
|
32066
|
+
// this.target = null;
|
|
32067
|
+
// this.proxy = null;
|
|
32068
|
+
// }
|
|
32069
|
+
// }
|
|
32070
|
+
|
|
32071
|
+
// // Usage example:
|
|
32072
|
+
// const originalObject = _session.DS_GLB[paramsP.dsSessionP];
|
|
32073
|
+
|
|
32074
|
+
// // Create observer with callback
|
|
32075
|
+
// const observedObject = new ObjectObserver(originalObject, (mutation) => {
|
|
32076
|
+
// console.log('Change detected:', mutation);
|
|
32077
|
+
// });
|
|
32078
|
+
|
|
32079
|
+
// // These operations will trigger the callback
|
|
32080
|
+
// observedObject.name = "Jane"; // Property update
|
|
32081
|
+
// observedObject.job = "Developer"; // Property addition
|
|
32082
|
+
// delete observedObject.age; // Property deletion
|
|
32083
|
+
//==================
|
|
32001
32084
|
|
|
32002
32085
|
return {};
|
|
32003
32086
|
},
|