@xuda.io/runtime-bundle 1.0.1276 → 1.0.1278
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 +6 -6
- package/js/xuda-runtime-bundle.js +51 -1
- package/js/xuda-runtime-bundle.min.js +1 -1
- package/js/xuda-runtime-slim.js +51 -1
- package/js/xuda-runtime-slim.min.es.js +51 -1
- package/js/xuda-runtime-slim.min.js +1 -1
- package/package.json +1 -1
package/js/xuda-runtime-slim.js
CHANGED
|
@@ -8680,6 +8680,8 @@ func.UI.worker.execute = async function (SESSION_ID, queue_obj) {
|
|
|
8680
8680
|
var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[queue_obj.dsSession];
|
|
8681
8681
|
_ds.currentRecordId = currentRecordId || queue_obj.paramsP.currentRecordId;
|
|
8682
8682
|
|
|
8683
|
+
console.info(queue_obj.dsSession, _ds.currentRecordId);
|
|
8684
|
+
|
|
8683
8685
|
var datasource_changes = {
|
|
8684
8686
|
[_ds.dsSession]: { [_ds.currentRecordId]: 'set' },
|
|
8685
8687
|
};
|
|
@@ -8979,7 +8981,55 @@ func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
|
|
|
8979
8981
|
|
|
8980
8982
|
const _ds = func.utils.clean_returned_datasource(SESSION_ID, dsSessionP);
|
|
8981
8983
|
|
|
8982
|
-
|
|
8984
|
+
//////////////
|
|
8985
|
+
function createWatchedObject(obj, onChange) {
|
|
8986
|
+
return new Proxy(obj, {
|
|
8987
|
+
set(target, property, value) {
|
|
8988
|
+
const oldValue = target[property];
|
|
8989
|
+
target[property] = value;
|
|
8990
|
+
|
|
8991
|
+
if (oldValue !== value) {
|
|
8992
|
+
onChange({
|
|
8993
|
+
property,
|
|
8994
|
+
oldValue,
|
|
8995
|
+
newValue: value,
|
|
8996
|
+
timestamp: new Date(),
|
|
8997
|
+
});
|
|
8998
|
+
}
|
|
8999
|
+
|
|
9000
|
+
return true;
|
|
9001
|
+
},
|
|
9002
|
+
|
|
9003
|
+
deleteProperty(target, property) {
|
|
9004
|
+
const oldValue = target[property];
|
|
9005
|
+
delete target[property];
|
|
9006
|
+
|
|
9007
|
+
onChange({
|
|
9008
|
+
property,
|
|
9009
|
+
oldValue,
|
|
9010
|
+
newValue: undefined,
|
|
9011
|
+
deleted: true,
|
|
9012
|
+
timestamp: new Date(),
|
|
9013
|
+
});
|
|
9014
|
+
|
|
9015
|
+
return true;
|
|
9016
|
+
},
|
|
9017
|
+
});
|
|
9018
|
+
}
|
|
9019
|
+
|
|
9020
|
+
// // Usage
|
|
9021
|
+
// const watchedUser = createWatchedObject(
|
|
9022
|
+
// { name: "John", age: 25 },
|
|
9023
|
+
// (change) => console.log("Change detected:", change)
|
|
9024
|
+
// );
|
|
9025
|
+
|
|
9026
|
+
// watchedUser.age = 26; // Logs: Change detected: { property: "age", oldValue: 25, newValue: 26, ... }
|
|
9027
|
+
|
|
9028
|
+
const watchedUser = createWatchedObject(_ds, (change) => console.log('Change detected:', change));
|
|
9029
|
+
|
|
9030
|
+
//////////////
|
|
9031
|
+
|
|
9032
|
+
let obj = { ds: _ds, data: {}, props: _ds.in_parameters || {}, watcher: watchedUser };
|
|
8983
9033
|
try {
|
|
8984
9034
|
const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
|
|
8985
9035
|
obj.data = _ds?.data_feed?.rows?.[row_idx];
|
|
@@ -8681,6 +8681,8 @@ func.UI.worker.execute = async function (SESSION_ID, queue_obj) {
|
|
|
8681
8681
|
var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[queue_obj.dsSession];
|
|
8682
8682
|
_ds.currentRecordId = currentRecordId || queue_obj.paramsP.currentRecordId;
|
|
8683
8683
|
|
|
8684
|
+
console.info(queue_obj.dsSession, _ds.currentRecordId);
|
|
8685
|
+
|
|
8684
8686
|
var datasource_changes = {
|
|
8685
8687
|
[_ds.dsSession]: { [_ds.currentRecordId]: 'set' },
|
|
8686
8688
|
};
|
|
@@ -8980,7 +8982,55 @@ func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
|
|
|
8980
8982
|
|
|
8981
8983
|
const _ds = func.utils.clean_returned_datasource(SESSION_ID, dsSessionP);
|
|
8982
8984
|
|
|
8983
|
-
|
|
8985
|
+
//////////////
|
|
8986
|
+
function createWatchedObject(obj, onChange) {
|
|
8987
|
+
return new Proxy(obj, {
|
|
8988
|
+
set(target, property, value) {
|
|
8989
|
+
const oldValue = target[property];
|
|
8990
|
+
target[property] = value;
|
|
8991
|
+
|
|
8992
|
+
if (oldValue !== value) {
|
|
8993
|
+
onChange({
|
|
8994
|
+
property,
|
|
8995
|
+
oldValue,
|
|
8996
|
+
newValue: value,
|
|
8997
|
+
timestamp: new Date(),
|
|
8998
|
+
});
|
|
8999
|
+
}
|
|
9000
|
+
|
|
9001
|
+
return true;
|
|
9002
|
+
},
|
|
9003
|
+
|
|
9004
|
+
deleteProperty(target, property) {
|
|
9005
|
+
const oldValue = target[property];
|
|
9006
|
+
delete target[property];
|
|
9007
|
+
|
|
9008
|
+
onChange({
|
|
9009
|
+
property,
|
|
9010
|
+
oldValue,
|
|
9011
|
+
newValue: undefined,
|
|
9012
|
+
deleted: true,
|
|
9013
|
+
timestamp: new Date(),
|
|
9014
|
+
});
|
|
9015
|
+
|
|
9016
|
+
return true;
|
|
9017
|
+
},
|
|
9018
|
+
});
|
|
9019
|
+
}
|
|
9020
|
+
|
|
9021
|
+
// // Usage
|
|
9022
|
+
// const watchedUser = createWatchedObject(
|
|
9023
|
+
// { name: "John", age: 25 },
|
|
9024
|
+
// (change) => console.log("Change detected:", change)
|
|
9025
|
+
// );
|
|
9026
|
+
|
|
9027
|
+
// watchedUser.age = 26; // Logs: Change detected: { property: "age", oldValue: 25, newValue: 26, ... }
|
|
9028
|
+
|
|
9029
|
+
const watchedUser = createWatchedObject(_ds, (change) => console.log('Change detected:', change));
|
|
9030
|
+
|
|
9031
|
+
//////////////
|
|
9032
|
+
|
|
9033
|
+
let obj = { ds: _ds, data: {}, props: _ds.in_parameters || {}, watcher: watchedUser };
|
|
8984
9034
|
try {
|
|
8985
9035
|
const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
|
|
8986
9036
|
obj.data = _ds?.data_feed?.rows?.[row_idx];
|