@xuda.io/runtime-bundle 1.0.676 → 1.0.678

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.
@@ -28707,6 +28707,16 @@ func.datasource.execute = async function (SESSION_ID, dataSourceSession, IS_DATA
28707
28707
  filterModelUserSql: _ds.progDataSource.filterModelUserSql,
28708
28708
  };
28709
28709
 
28710
+ let _dataSourceFilterModelType = ds?.progDataSource?.dataSourceFilterModelType;
28711
+
28712
+ if (ds?.progDataSource?.dataSourceFilterModelTypeFx) {
28713
+ const fx_ret = await func.expression.get(SESSION_ID, _ds.progDataSource.dataSourceFilterModelTypeFx, dataSourceSession, 'query');
28714
+ _dataSourceFilterModelType = fx_ret.result;
28715
+ }
28716
+ if (!['query', 'index'].includes(_dataSourceFilterModelType)) {
28717
+ return func.utils.debug_report(SESSION_ID, 'Data source', `Valid values for dataSourceFilterModelType are: "query" or "index" (${_dataSourceFilterModelType})`, 'E');
28718
+ }
28719
+
28710
28720
  _ds.v.raw_data = await func.db.get_query(
28711
28721
  SESSION_ID,
28712
28722
  _ds._dataSourceTableId,
@@ -28722,27 +28732,11 @@ func.datasource.execute = async function (SESSION_ID, dataSourceSession, IS_DATA
28722
28732
  _ds?.progDataSource?.sortModel,
28723
28733
  null,
28724
28734
  filterModel,
28725
- _ds?.progDataSource?.dataSourceFilterModelType,
28735
+ _dataSourceFilterModelType,
28726
28736
  );
28727
28737
 
28728
28738
  if (_ds?.progDataSource?.dataSourceLimit) {
28729
- const ret_rows_found = await func.db.get_query(
28730
- SESSION_ID,
28731
- _ds._dataSourceTableId,
28732
- _ds.v.couchView,
28733
- dataSourceSession,
28734
- _ds.viewSourceDesc,
28735
- 'datasource table',
28736
- prog_obj.progDataSource.dataSourceReduce,
28737
- null,
28738
- null,
28739
- true,
28740
- null,
28741
- null,
28742
- null,
28743
- filterModel,
28744
- _ds?.progDataSource?.dataSourceFilterModelType,
28745
- );
28739
+ const ret_rows_found = await func.db.get_query(SESSION_ID, _ds._dataSourceTableId, _ds.v.couchView, dataSourceSession, _ds.viewSourceDesc, 'datasource table', prog_obj.progDataSource.dataSourceReduce, null, null, true, null, null, null, filterModel, _dataSourceFilterModelType);
28746
28740
  _ds.rows_found = ret_rows_found?.rows?.[0]?.value || 0;
28747
28741
  } else {
28748
28742
  _ds.rows_found = _ds?.v?.raw_data?.rows?.length || 0;
@@ -31191,24 +31185,6 @@ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, j
31191
31185
  .filter(function () {
31192
31186
  // // look if the changed field include in the calling in parameters
31193
31187
  let parameter_in_filed_id;
31194
- // const _$callingContainer = $(this).data()?.xuData?.paramsP?.$callingContainerP;
31195
- // if (_$callingContainer) {
31196
- // const _source_xuAttributes = _$callingContainer.data()?.xuAttributes;
31197
- // if (_source_xuAttributes) {
31198
- // for (const [attr, value] of Object.entries(_source_xuAttributes)) {
31199
- // if (value && typeof value === 'string' && value.includes(val_field)) {
31200
- // const pattern = /xu-exp:(\w+)/;
31201
- // const match = attr.match(pattern);
31202
- // if (match) {
31203
- // parameter_in_filed_id = attr.split(':')[1];
31204
- // } else {
31205
- // parameter_in_filed_id = attr;
31206
- // }
31207
- // break;
31208
- // }
31209
- // }
31210
- // }
31211
- // }
31212
31188
 
31213
31189
  let attr = [];
31214
31190
 
@@ -31986,7 +31962,6 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
31986
31962
  'xu-bind': async function ($elm, val) {
31987
31963
  if (is_skeleton) return;
31988
31964
 
31989
- // let view_field_id = val.value;
31990
31965
  let val_is_reference_field = false;
31991
31966
 
31992
31967
  let _prog_id = $elm.data().xuData.paramsP.prog_id;
@@ -32080,17 +32055,9 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
32080
32055
  return await func.datasource.update(SESSION_ID, datasource_changes);
32081
32056
  }
32082
32057
 
32083
- // update array for checkbox that not in xu-for
32058
+ // update array for radio that not in xu-for
32084
32059
  if (field_prop.props.fieldType === 'array' && $elm.attr('type') === 'radio' && val_is_reference_field) {
32085
- let arr_value_before_cast = _.clone((await func.datasource.get_value(SESSION_ID, bind_field_id, _dsP, _ds.currentRecordId)).ret.value);
32086
32060
  let value_from_getter = bind.getter($elm[0]);
32087
- // let value;
32088
- // if (arr_value_before_cast.includes(value_from_getter)) {
32089
- // value = arr_value_before_cast.filter((item) => !_.isEqual(item, value_from_getter));
32090
- // } else {
32091
- // arr_value_before_cast.push(value_from_getter);
32092
- // value = arr_value_before_cast;
32093
- // }
32094
32061
 
32095
32062
  let datasource_changes = {
32096
32063
  [_dsP]: {
@@ -32551,6 +32518,11 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
32551
32518
  const trigger = val.key.split('xu-on:')[1].toLowerCase();
32552
32519
  $elm.on(trigger, async function (evt) {
32553
32520
  for await (const [key, val] of Object.entries($elm.data().xuAttributes['xu-on:' + evt.type])) {
32521
+ if (!_.isEmpty(val.props.condition)) {
32522
+ const expCond = await func.expression.get(SESSION_ID, val.props.condition, paramsP.dsSessionP, 'condition', paramsP.recordid); // execute expression
32523
+ if (!expCond.result) continue;
32524
+ }
32525
+
32554
32526
  if (val.event_modifiers && evt[val.event_modifiers]) {
32555
32527
  evt[val.event_modifiers]();
32556
32528
  }