@xuda.io/runtime-bundle 1.0.1281 → 1.0.1283

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.
@@ -3276,6 +3276,10 @@ func.datasource.prepare = async function (SESSION_ID, prog_id, dataSourceNoP, pa
3276
3276
  console.log('DATASOURCE_REFRESH', dataSourceNoP);
3277
3277
  IS_DATASOURCE_REFRESH = true;
3278
3278
  _ds.refreshed = true;
3279
+ if (_ds.watcher) {
3280
+ _.set(_ds, watcher.path, watcher.newValue);
3281
+ debugger;
3282
+ }
3279
3283
  try {
3280
3284
  if (!_ds.v) _ds.v = {};
3281
3285
 
@@ -8981,50 +8985,6 @@ func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
8981
8985
 
8982
8986
  const _ds = func.utils.clean_returned_datasource(SESSION_ID, dsSessionP);
8983
8987
 
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
8988
  function createWatchedObject(obj, onChange) {
9029
8989
  const watchers = new WeakMap();
9030
8990
 
@@ -9094,10 +9054,20 @@ func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
9094
9054
 
9095
9055
  const watchedUser = createWatchedObject(_ds, async (change) => {
9096
9056
  console.log('Change detected:', change);
9057
+ const { path, newValue } = change;
9097
9058
  try {
9098
- _session.DS_GLB[dsSessionP].watcher = {};
9059
+ // _session.DS_GLB[dsSessionP].watcher = { path, newValue };
9060
+
9061
+ const datasource_changes = {
9062
+ [dsSessionP]: {
9063
+ ['datasource_main']: {
9064
+ watcher: { path, newValue },
9065
+ },
9066
+ },
9067
+ };
9068
+ await func.datasource.update(SESSION_ID, datasource_changes);
9099
9069
 
9100
- _.set(_session.DS_GLB[dsSessionP].watcher, change.path, change.newValue);
9070
+ // _.set(_session.DS_GLB[dsSessionP].watcher, change.path, change.newValue);
9101
9071
 
9102
9072
  await func.action.execute(SESSION_ID, 'act_refresh', _session.DS_GLB[dsSessionP], null, null, null, $elm);
9103
9073
  } catch (error) {}
@@ -3277,6 +3277,10 @@ func.datasource.prepare = async function (SESSION_ID, prog_id, dataSourceNoP, pa
3277
3277
  console.log('DATASOURCE_REFRESH', dataSourceNoP);
3278
3278
  IS_DATASOURCE_REFRESH = true;
3279
3279
  _ds.refreshed = true;
3280
+ if (_ds.watcher) {
3281
+ _.set(_ds, watcher.path, watcher.newValue);
3282
+ debugger;
3283
+ }
3280
3284
  try {
3281
3285
  if (!_ds.v) _ds.v = {};
3282
3286
 
@@ -8982,50 +8986,6 @@ func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
8982
8986
 
8983
8987
  const _ds = func.utils.clean_returned_datasource(SESSION_ID, dsSessionP);
8984
8988
 
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
8989
  function createWatchedObject(obj, onChange) {
9030
8990
  const watchers = new WeakMap();
9031
8991
 
@@ -9095,10 +9055,20 @@ func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
9095
9055
 
9096
9056
  const watchedUser = createWatchedObject(_ds, async (change) => {
9097
9057
  console.log('Change detected:', change);
9058
+ const { path, newValue } = change;
9098
9059
  try {
9099
- _session.DS_GLB[dsSessionP].watcher = {};
9060
+ // _session.DS_GLB[dsSessionP].watcher = { path, newValue };
9061
+
9062
+ const datasource_changes = {
9063
+ [dsSessionP]: {
9064
+ ['datasource_main']: {
9065
+ watcher: { path, newValue },
9066
+ },
9067
+ },
9068
+ };
9069
+ await func.datasource.update(SESSION_ID, datasource_changes);
9100
9070
 
9101
- _.set(_session.DS_GLB[dsSessionP].watcher, change.path, change.newValue);
9071
+ // _.set(_session.DS_GLB[dsSessionP].watcher, change.path, change.newValue);
9102
9072
 
9103
9073
  await func.action.execute(SESSION_ID, 'act_refresh', _session.DS_GLB[dsSessionP], null, null, null, $elm);
9104
9074
  } catch (error) {}