@xuda.io/runtime-bundle 1.0.1342 → 1.0.1344

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.
@@ -28200,7 +28200,6 @@ func.UI.find_field_in_progUi_attributes = function (progUi, field_id, prop, tag_
28200
28200
  };
28201
28201
 
28202
28202
  func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
28203
- return;
28204
28203
  let ret;
28205
28204
  const _session = SESSION_OBJ[SESSION_ID];
28206
28205
  let _ds_0 = _session.DS_GLB[0];
@@ -28336,136 +28335,136 @@ func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
28336
28335
  return ret;
28337
28336
  };
28338
28337
 
28339
- func.UI.create_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
28340
- let ret;
28341
- const _session = SESSION_OBJ[SESSION_ID];
28342
- let _ds_0 = _session.DS_GLB[0];
28338
+ // func.UI.create_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
28339
+ // let ret;
28340
+ // const _session = SESSION_OBJ[SESSION_ID];
28341
+ // let _ds_0 = _session.DS_GLB[0];
28343
28342
 
28344
- function createWatchedObject(obj, onChange) {
28345
- const watchers = new WeakMap();
28343
+ // function createWatchedObject(obj, onChange) {
28344
+ // const watchers = new WeakMap();
28346
28345
 
28347
- function createProxy(target, path = []) {
28348
- if (watchers.has(target)) {
28349
- return watchers.get(target);
28350
- }
28346
+ // function createProxy(target, path = []) {
28347
+ // if (watchers.has(target)) {
28348
+ // return watchers.get(target);
28349
+ // }
28351
28350
 
28352
- const proxy = new Proxy(target, {
28353
- set(obj, prop, value) {
28354
- const oldValue = obj[prop];
28355
- let currentPath = [...path, prop];
28351
+ // const proxy = new Proxy(target, {
28352
+ // set(obj, prop, value) {
28353
+ // const oldValue = obj[prop];
28354
+ // let currentPath = [...path, prop];
28356
28355
 
28357
- // Set the new value
28358
- obj[prop] = value;
28356
+ // // Set the new value
28357
+ // obj[prop] = value;
28359
28358
 
28360
- // If the new value is an object, make it observable too
28361
- if (typeof value === 'object' && value !== null) {
28362
- obj[prop] = createProxy(value, currentPath);
28363
- }
28359
+ // // If the new value is an object, make it observable too
28360
+ // if (typeof value === 'object' && value !== null) {
28361
+ // obj[prop] = createProxy(value, currentPath);
28362
+ // }
28364
28363
 
28365
- // Notify of change
28366
- // if (oldValue !== value) {
28367
- if (!_.isEqual(value, oldValue)) {
28368
- currentPath.shift();
28369
- onChange({
28370
- path: currentPath.join('.'),
28371
- oldValue,
28372
- newValue: value,
28373
- type: 'set',
28374
- timestamp: Date.now(),
28375
- });
28376
- }
28364
+ // // Notify of change
28365
+ // // if (oldValue !== value) {
28366
+ // if (!_.isEqual(value, oldValue)) {
28367
+ // currentPath.shift();
28368
+ // onChange({
28369
+ // path: currentPath.join('.'),
28370
+ // oldValue,
28371
+ // newValue: value,
28372
+ // type: 'set',
28373
+ // timestamp: Date.now(),
28374
+ // });
28375
+ // }
28377
28376
 
28378
- return true;
28379
- },
28377
+ // return true;
28378
+ // },
28380
28379
 
28381
- deleteProperty(obj, prop) {
28382
- const oldValue = obj[prop];
28383
- const currentPath = [...path, prop];
28380
+ // deleteProperty(obj, prop) {
28381
+ // const oldValue = obj[prop];
28382
+ // const currentPath = [...path, prop];
28384
28383
 
28385
- delete obj[prop];
28384
+ // delete obj[prop];
28386
28385
 
28387
- onChange({
28388
- path: currentPath.join('.'),
28389
- oldValue,
28390
- newValue: undefined,
28391
- type: 'delete',
28392
- timestamp: Date.now(),
28393
- });
28386
+ // onChange({
28387
+ // path: currentPath.join('.'),
28388
+ // oldValue,
28389
+ // newValue: undefined,
28390
+ // type: 'delete',
28391
+ // timestamp: Date.now(),
28392
+ // });
28394
28393
 
28395
- return true;
28396
- },
28397
- });
28394
+ // return true;
28395
+ // },
28396
+ // });
28398
28397
 
28399
- // Make nested objects observable
28400
- for (const [key, value] of Object.entries(target)) {
28401
- if (typeof value === 'object' && value !== null) {
28402
- target[key] = createProxy(value, [...path, key]);
28403
- }
28404
- }
28398
+ // // Make nested objects observable
28399
+ // for (const [key, value] of Object.entries(target)) {
28400
+ // if (typeof value === 'object' && value !== null) {
28401
+ // target[key] = createProxy(value, [...path, key]);
28402
+ // }
28403
+ // }
28405
28404
 
28406
- watchers.set(target, proxy);
28407
- return proxy;
28408
- }
28405
+ // watchers.set(target, proxy);
28406
+ // return proxy;
28407
+ // }
28409
28408
 
28410
- return createProxy(obj);
28411
- }
28409
+ // return createProxy(obj);
28410
+ // }
28412
28411
 
28413
- let _ds = _session.DS_GLB[dsSessionP];
28412
+ // let _ds = _session.DS_GLB[dsSessionP];
28414
28413
 
28415
- // const watchedDs = createWatchedObject({ _ref: _ds }, async (change) => {
28416
- // // console.log('Change detected:', change);
28417
- // const { path, newValue, oldValue } = change;
28414
+ // // const watchedDs = createWatchedObject({ _ref: _ds }, async (change) => {
28415
+ // // // console.log('Change detected:', change);
28416
+ // // const { path, newValue, oldValue } = change;
28418
28417
 
28419
- // });
28418
+ // // });
28420
28419
 
28421
- const createBasicProxy = (target) => {
28422
- return new Proxy(target, {
28423
- // Intercept property access
28424
- get(obj, prop) {
28425
- console.log(`Getting property: ${String(prop)}`);
28426
- return prop in obj ? obj[prop] : `Property ${String(prop)} not found`;
28427
- },
28420
+ // const createBasicProxy = (target) => {
28421
+ // return new Proxy(target, {
28422
+ // // Intercept property access
28423
+ // get(obj, prop) {
28424
+ // console.log(`Getting property: ${String(prop)}`);
28425
+ // return prop in obj ? obj[prop] : `Property ${String(prop)} not found`;
28426
+ // },
28428
28427
 
28429
- // Intercept property assignment
28430
- set(obj, prop, value) {
28431
- console.log(`Setting property: ${String(prop)} to ${value}`);
28432
- obj[prop] = value;
28433
- return true; // indicates success
28434
- },
28428
+ // // Intercept property assignment
28429
+ // set(obj, prop, value) {
28430
+ // console.log(`Setting property: ${String(prop)} to ${value}`);
28431
+ // obj[prop] = value;
28432
+ // return true; // indicates success
28433
+ // },
28435
28434
 
28436
- // Intercept property deletion
28437
- deleteProperty(obj, prop) {
28438
- console.log(`Deleting property: ${String(prop)}`);
28439
- if (prop in obj) {
28440
- delete obj[prop];
28441
- return true;
28442
- }
28443
- return false;
28444
- },
28445
- });
28446
- };
28447
- const p = createBasicProxy(_ds);
28448
- // let obj = { ds: watchedDs._ref, data: {}, props: _ds.in_parameters || {} };
28449
- let obj = { ds: {}, data: {}, props: _ds.in_parameters || {} };
28450
- try {
28451
- const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
28452
- obj.data = _ds?.data_feed?.rows?.[row_idx];
28453
- } catch (error) {
28454
- // error normal if find_ROWID_idx fail
28455
- }
28435
+ // // Intercept property deletion
28436
+ // deleteProperty(obj, prop) {
28437
+ // console.log(`Deleting property: ${String(prop)}`);
28438
+ // if (prop in obj) {
28439
+ // delete obj[prop];
28440
+ // return true;
28441
+ // }
28442
+ // return false;
28443
+ // },
28444
+ // });
28445
+ // };
28446
+ // const p = createBasicProxy(_ds);
28447
+ // // let obj = { ds: watchedDs._ref, data: {}, props: _ds.in_parameters || {} };
28448
+ // let obj = { ds: {}, data: {}, props: _ds.in_parameters || {} };
28449
+ // try {
28450
+ // const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
28451
+ // obj.data = _ds?.data_feed?.rows?.[row_idx];
28452
+ // } catch (error) {
28453
+ // // error normal if find_ROWID_idx fail
28454
+ // }
28456
28455
 
28457
- let SYS_GLOBAL_OBJ_REFS = _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'];
28456
+ // let SYS_GLOBAL_OBJ_REFS = _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'];
28458
28457
 
28459
- if ($elm) {
28460
- const attributes = $elm?.data()?.xuData?.xuPanelProps || $elm?.data()?.xuData?.debug_info?.attribute_stat || {};
28461
- obj.attributes = attributes;
28462
- obj.xu_ui_id = $elm.attr('xu-ui-id');
28463
- }
28458
+ // if ($elm) {
28459
+ // const attributes = $elm?.data()?.xuData?.xuPanelProps || $elm?.data()?.xuData?.debug_info?.attribute_stat || {};
28460
+ // obj.attributes = attributes;
28461
+ // obj.xu_ui_id = $elm.attr('xu-ui-id');
28462
+ // }
28464
28463
 
28465
- SYS_GLOBAL_OBJ_REFS[ref_field_id] = obj;
28464
+ // SYS_GLOBAL_OBJ_REFS[ref_field_id] = obj;
28466
28465
 
28467
- return ret;
28468
- };
28466
+ // return ret;
28467
+ // };
28469
28468
  func.datasource = {};
28470
28469
  func.datasource.create = async function (
28471
28470
  SESSION_ID,
@@ -42760,17 +42759,13 @@ func.index.set_ds_0_proxy = function (SESSION_ID) {
42760
42759
  const fx = _session?.watchers?.[path];
42761
42760
  fx(change);
42762
42761
  }
42763
- return;
42764
- if (!change.path.includes('data_system.SYS_GLOBAL_OBJ_REFS')) return;
42765
- const ref_id = change.path.split('SYS_GLOBAL_OBJ_REFS.')[1].split('.')[0];
42762
+
42763
+ ///////////////////////
42764
+ const ref_id = change.path.split('.')[0];
42766
42765
  if (!ref_id) return;
42767
42766
  const _ref = SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system.SYS_GLOBAL_OBJ_REFS[ref_id];
42768
-
42769
42767
  if (!_ref) return;
42770
- const prefix_path = `data_system.SYS_GLOBAL_OBJ_REFS.${ref_id}.ds`;
42771
- if (!change.path.includes(prefix_path)) return;
42772
42768
  const _ds = _ref.ds;
42773
-
42774
42769
  const datasource_changes = {
42775
42770
  [_ds.dsSession]: {
42776
42771
  ['datasource_main']: {
@@ -42779,6 +42774,27 @@ func.index.set_ds_0_proxy = function (SESSION_ID) {
42779
42774
  },
42780
42775
  };
42781
42776
  await func.datasource.update(SESSION_ID, datasource_changes);
42777
+ ///////////////////
42778
+
42779
+ return;
42780
+ // if (!change.path.includes('data_system.SYS_GLOBAL_OBJ_REFS')) return;
42781
+ // const ref_id = change.path.split('SYS_GLOBAL_OBJ_REFS.')[1].split('.')[0];
42782
+ // if (!ref_id) return;
42783
+ // const _ref = SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system.SYS_GLOBAL_OBJ_REFS[ref_id];
42784
+
42785
+ // if (!_ref) return;
42786
+ // const prefix_path = `data_system.SYS_GLOBAL_OBJ_REFS.${ref_id}.ds`;
42787
+ // if (!change.path.includes(prefix_path)) return;
42788
+ // const _ds = _ref.ds;
42789
+
42790
+ // const datasource_changes = {
42791
+ // [_ds.dsSession]: {
42792
+ // ['datasource_main']: {
42793
+ // watcher: { path: path.replace(prefix_path + '.', ''), newValue },
42794
+ // },
42795
+ // },
42796
+ // };
42797
+ // await func.datasource.update(SESSION_ID, datasource_changes);
42782
42798
  } catch (error) {}
42783
42799
  });
42784
42800