@xuda.io/runtime-bundle 1.0.1426 → 1.0.1428

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.
@@ -30570,6 +30570,18 @@ func.UI.worker.execute = async function (SESSION_ID, queue_obj) {
30570
30570
  'xu-on': true,
30571
30571
  'xu-for-key': true,
30572
30572
  'xu-for-val': true,
30573
+ 'xu-click': true,
30574
+ 'xu-change': true,
30575
+ 'xu-blur': true,
30576
+ 'xu-focus': true,
30577
+ 'xu-init': true,
30578
+ 'xu-attrs': true,
30579
+ 'xu-cdn': true,
30580
+ 'xu-style': true,
30581
+ 'xu-style-global': true,
30582
+ 'xu-script': true,
30583
+ 'xu-viewport': true,
30584
+ 'xu-ui-plugin': true,
30573
30585
  };
30574
30586
 
30575
30587
  const execution_plan = [];
@@ -30581,12 +30593,13 @@ func.UI.worker.execute = async function (SESSION_ID, queue_obj) {
30581
30593
 
30582
30594
  const attr_new = attr.split('xu-exp:')[1];
30583
30595
  const xu_func = attr_new || attr;
30596
+ const is_raw_value_attribute = !!raw_value_attributes[attr] || attr.substr(0, 6) === 'xu-on:';
30584
30597
  execution_plan.push({
30585
30598
  attr,
30586
30599
  attr_new,
30587
30600
  xu_func,
30588
30601
  is_regular_attribute: !!(attr_new && attr_new.substr(0, 2) !== 'xu'),
30589
- requires_expression: !raw_value_attributes[attr] && attr !== 'xu-class' && attr !== 'xu-ui-plugin',
30602
+ requires_expression: !is_raw_value_attribute && attr !== 'xu-class' && attr !== 'xu-ui-plugin',
30590
30603
  regular_attr_name: attr_new ? (attr_new !== 'viewBox' ? attr_new.toLowerCase() : attr_new) : null,
30591
30604
  });
30592
30605
  }
@@ -39616,6 +39629,58 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
39616
39629
  var datasource_changed = [];
39617
39630
  let client_datasource_changes = {};
39618
39631
  let server_datasource_changes = {};
39632
+ const mark_field_changed = async function (dataSource, field_id) {
39633
+ if (!fields_changed.includes(field_id)) {
39634
+ fields_changed.push(field_id);
39635
+
39636
+ // Refresh dependent in-parameters that reference this field.
39637
+ for (const [_dsSession, _ds] of Object.entries(_session.DS_GLB)) {
39638
+ if (_ds.args.parameters_raw_obj) {
39639
+ for (const [key, exp] of Object.entries(_ds.args.parameters_raw_obj)) {
39640
+ if (exp.includes(field_id)) {
39641
+ let ret = await func.expression.get(SESSION_ID, exp, _dsSession, 'parameters');
39642
+ _ds.in_parameters[key].value = ret.result;
39643
+ }
39644
+ }
39645
+ }
39646
+ }
39647
+ }
39648
+ if (!datasource_changed.includes(dataSource)) {
39649
+ datasource_changed.push(dataSource);
39650
+ }
39651
+ };
39652
+ const queue_remote_change = async function (dataSource, record_id, field_id, value, _ds) {
39653
+ if (update_local_scope_only) {
39654
+ return;
39655
+ }
39656
+
39657
+ let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
39658
+ if (glb.IS_WORKER) {
39659
+ if (tree_ret.menuType === 'globals' || tree_ret.menuType === 'component') {
39660
+ const _progFields = await func.datasource.get_progFields(SESSION_ID, dataSource);
39661
+ let view_field_obj = func.common.find_item_by_key(_progFields, 'field_id', field_id);
39662
+ if (!view_field_obj?.data?.serverField && record_id !== 'data_system') {
39663
+ if (!client_datasource_changes[dataSource]) {
39664
+ client_datasource_changes[dataSource] = {};
39665
+ }
39666
+ if (!client_datasource_changes[dataSource][record_id]) {
39667
+ client_datasource_changes[dataSource][record_id] = {};
39668
+ }
39669
+ client_datasource_changes[dataSource][record_id][field_id] = value;
39670
+ }
39671
+ }
39672
+ } else {
39673
+ if ((tree_ret.menuType === 'component' && _ds._run_at !== 'client') || tree_ret.menuType === 'globals') {
39674
+ if (!server_datasource_changes[dataSource]) {
39675
+ server_datasource_changes[dataSource] = {};
39676
+ }
39677
+ if (!server_datasource_changes[dataSource][record_id]) {
39678
+ server_datasource_changes[dataSource][record_id] = {};
39679
+ }
39680
+ server_datasource_changes[dataSource][record_id][field_id] = value;
39681
+ }
39682
+ }
39683
+ };
39619
39684
 
39620
39685
  const update_xu_ref = function (dataSource) {
39621
39686
  let ret;
@@ -39686,6 +39751,18 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
39686
39751
  continue;
39687
39752
  }
39688
39753
 
39754
+ const dynamic_field = _ds?.dynamic_fields?.[field_id];
39755
+ if (dynamic_field) {
39756
+ if (!xu_isEqual(dynamic_field.value, value)) {
39757
+ dynamic_field.value = value;
39758
+ await set_fieldComputed_dependencies(dataSource, field_id, null);
39759
+ update_xu_ref(dataSource);
39760
+ await queue_remote_change(dataSource, record_id, field_id, value, _ds);
39761
+ await mark_field_changed(dataSource, field_id);
39762
+ }
39763
+ continue;
39764
+ }
39765
+
39689
39766
  try {
39690
39767
  const row_idx = func.common.find_ROWID_idx(_ds, record_id);
39691
39768
  // if (_ds.data_feed.rows[row_idx][field_id] !== value) {
@@ -39696,55 +39773,8 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
39696
39773
  // search the field in refs
39697
39774
  update_xu_ref(dataSource);
39698
39775
 
39699
- if (!update_local_scope_only) {
39700
- let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
39701
- if (glb.IS_WORKER) {
39702
- // RUN AT SERVER
39703
- if (tree_ret.menuType === 'globals' || tree_ret.menuType === 'component') {
39704
- const _progFields = await func.datasource.get_progFields(SESSION_ID, dataSource);
39705
- let view_field_obj = func.common.find_item_by_key(_progFields, 'field_id', field_id);
39706
- if (!view_field_obj?.data?.serverField && record_id !== 'data_system') {
39707
- if (!client_datasource_changes[dataSource]) {
39708
- client_datasource_changes[dataSource] = {};
39709
- }
39710
- if (!client_datasource_changes[dataSource][record_id]) {
39711
- client_datasource_changes[dataSource][record_id] = {};
39712
- }
39713
- client_datasource_changes[dataSource][record_id][field_id] = value;
39714
- }
39715
- }
39716
- } else {
39717
- // RUN AT CLIENT
39718
- if ((tree_ret.menuType === 'component' && _ds._run_at !== 'client') || tree_ret.menuType === 'globals') {
39719
- if (!server_datasource_changes[dataSource]) {
39720
- server_datasource_changes[dataSource] = {};
39721
- }
39722
- if (!server_datasource_changes[dataSource][record_id]) {
39723
- server_datasource_changes[dataSource][record_id] = {};
39724
- }
39725
- server_datasource_changes[dataSource][record_id][field_id] = value;
39726
- }
39727
- }
39728
- }
39729
-
39730
- if (!fields_changed.includes(field_id)) {
39731
- fields_changed.push(field_id);
39732
-
39733
- ///// REFRESH PARAMETERS IN
39734
- for (const [_dsSession, _ds] of Object.entries(_session.DS_GLB)) {
39735
- if (_ds.args.parameters_raw_obj) {
39736
- for (const [key, exp] of Object.entries(_ds.args.parameters_raw_obj)) {
39737
- if (exp.includes(field_id)) {
39738
- let ret = await func.expression.get(SESSION_ID, exp, _dsSession, 'parameters');
39739
- _ds.in_parameters[key].value = ret.result;
39740
- }
39741
- }
39742
- }
39743
- }
39744
- }
39745
- if (!datasource_changed.includes(dataSource)) {
39746
- datasource_changed.push(dataSource);
39747
- }
39776
+ await queue_remote_change(dataSource, record_id, field_id, value, _ds);
39777
+ await mark_field_changed(dataSource, field_id);
39748
39778
 
39749
39779
  if (!_ds.data_feed.rows_changed) {
39750
39780
  _ds.data_feed.rows_changed = [];
@@ -40287,6 +40317,10 @@ func.datasource.get_value = async function (SESSION_ID, fieldIdP, dsSessionP, ro
40287
40317
  if (_ds.alias) _field_id = _ds.alias[fieldIdP];
40288
40318
  }
40289
40319
 
40320
+ if (typeof _ds?.dynamic_fields?.[_field_id] !== 'undefined') {
40321
+ return await return_dynamic_value(_field_id, _ds.dynamic_fields[_field_id]);
40322
+ }
40323
+
40290
40324
  if (!org_dsSessionP && recordId) {
40291
40325
  try {
40292
40326
  const row_idx = func.common.find_ROWID_idx(_ds, recordId);
@@ -40312,10 +40346,6 @@ func.datasource.get_value = async function (SESSION_ID, fieldIdP, dsSessionP, ro
40312
40346
  }
40313
40347
  } catch (error) {}
40314
40348
 
40315
- if (typeof _ds?.dynamic_fields?.[_field_id] !== 'undefined') {
40316
- return await return_dynamic_value(_field_id, _ds.dynamic_fields[_field_id]);
40317
- }
40318
-
40319
40349
  return await search_in_parameters(fieldIdP);
40320
40350
  };
40321
40351