@xuda.io/runtime-bundle 1.0.673 → 1.0.675

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.
@@ -8695,23 +8695,17 @@ func.UI.worker.execute = async function (SESSION_ID, queue_obj) {
8695
8695
  return done();
8696
8696
  },
8697
8697
  execute_xu_for: async function () {
8698
- // var $elm = func.UI.utils.find_in_element_data(
8699
- // "xuData",
8700
- // $(SESSION_OBJ[SESSION_ID].root_element),
8701
- // "xu_id",
8702
- // queue_obj.paramsP.elem_key
8703
- // );
8704
-
8705
8698
  var $elm = queue_obj?.paramsP?.elem_val?.$elm; // $(SESSION_OBJ[SESSION_ID].root_element).find(`[xu-ui-id=${queue_obj.paramsP.elem_key}]`)
8706
8699
 
8707
8700
  if (!$elm?.length) {
8708
- // return func.events.delete_job(SESSION_ID, queue_obj.jobNoP);
8709
8701
  return func.UI.worker.delete_job(SESSION_ID, queue_obj.job_num);
8710
8702
  }
8711
8703
 
8712
8704
  // $elm.empty();
8713
8705
 
8714
8706
  $.each($elm.children(), (key, val) => {
8707
+ if (!$(val)?.data()?.xuData) return true;
8708
+
8715
8709
  if ($(val).data().xuData.nodeid === queue_obj?.paramsP?.xu_for_item_id) {
8716
8710
  $(val).remove();
8717
8711
  }
@@ -12395,7 +12389,7 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
12395
12389
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_dsP];
12396
12390
 
12397
12391
  // update array for checkbox that not in xu-for
12398
- if (field_prop.props.fieldType === 'array' && ($elm.attr('type') === 'checkbox' || $elm.attr('type') === 'radio') && val_is_reference_field) {
12392
+ if (field_prop.props.fieldType === 'array' && $elm.attr('type') === 'checkbox' && val_is_reference_field) {
12399
12393
  let arr_value_before_cast = _.clone((await func.datasource.get_value(SESSION_ID, bind_field_id, _dsP, _ds.currentRecordId)).ret.value);
12400
12394
  let value_from_getter = bind.getter($elm[0]);
12401
12395
  let value;
@@ -12417,6 +12411,29 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
12417
12411
  return await func.datasource.update(SESSION_ID, datasource_changes);
12418
12412
  }
12419
12413
 
12414
+ // update array for checkbox that not in xu-for
12415
+ if (field_prop.props.fieldType === 'array' && $elm.attr('type') === 'radio' && val_is_reference_field) {
12416
+ let arr_value_before_cast = _.clone((await func.datasource.get_value(SESSION_ID, bind_field_id, _dsP, _ds.currentRecordId)).ret.value);
12417
+ let value_from_getter = bind.getter($elm[0]);
12418
+ // let value;
12419
+ // if (arr_value_before_cast.includes(value_from_getter)) {
12420
+ // value = arr_value_before_cast.filter((item) => !_.isEqual(item, value_from_getter));
12421
+ // } else {
12422
+ // arr_value_before_cast.push(value_from_getter);
12423
+ // value = arr_value_before_cast;
12424
+ // }
12425
+
12426
+ let datasource_changes = {
12427
+ [_dsP]: {
12428
+ [_ds.currentRecordId]: {
12429
+ [bind_field_id]: [value_from_getter],
12430
+ },
12431
+ },
12432
+ };
12433
+
12434
+ return await func.datasource.update(SESSION_ID, datasource_changes);
12435
+ }
12436
+
12420
12437
  var value = await func.common.get_cast_val(SESSION_ID, 'xu-bind', 'value', field_prop.props.fieldType, bind.getter($elm[0]));
12421
12438
 
12422
12439
  if (field_prop.props.fieldType === 'object' && !val_is_reference_field) {
@@ -8696,23 +8696,17 @@ func.UI.worker.execute = async function (SESSION_ID, queue_obj) {
8696
8696
  return done();
8697
8697
  },
8698
8698
  execute_xu_for: async function () {
8699
- // var $elm = func.UI.utils.find_in_element_data(
8700
- // "xuData",
8701
- // $(SESSION_OBJ[SESSION_ID].root_element),
8702
- // "xu_id",
8703
- // queue_obj.paramsP.elem_key
8704
- // );
8705
-
8706
8699
  var $elm = queue_obj?.paramsP?.elem_val?.$elm; // $(SESSION_OBJ[SESSION_ID].root_element).find(`[xu-ui-id=${queue_obj.paramsP.elem_key}]`)
8707
8700
 
8708
8701
  if (!$elm?.length) {
8709
- // return func.events.delete_job(SESSION_ID, queue_obj.jobNoP);
8710
8702
  return func.UI.worker.delete_job(SESSION_ID, queue_obj.job_num);
8711
8703
  }
8712
8704
 
8713
8705
  // $elm.empty();
8714
8706
 
8715
8707
  $.each($elm.children(), (key, val) => {
8708
+ if (!$(val)?.data()?.xuData) return true;
8709
+
8716
8710
  if ($(val).data().xuData.nodeid === queue_obj?.paramsP?.xu_for_item_id) {
8717
8711
  $(val).remove();
8718
8712
  }
@@ -10117,7 +10111,7 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
10117
10111
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_dsP];
10118
10112
 
10119
10113
  // update array for checkbox that not in xu-for
10120
- if (field_prop.props.fieldType === 'array' && ($elm.attr('type') === 'checkbox' || $elm.attr('type') === 'radio') && val_is_reference_field) {
10114
+ if (field_prop.props.fieldType === 'array' && $elm.attr('type') === 'checkbox' && val_is_reference_field) {
10121
10115
  let arr_value_before_cast = _.clone((await func.datasource.get_value(SESSION_ID, bind_field_id, _dsP, _ds.currentRecordId)).ret.value);
10122
10116
  let value_from_getter = bind.getter($elm[0]);
10123
10117
  let value;
@@ -10139,6 +10133,29 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
10139
10133
  return await func.datasource.update(SESSION_ID, datasource_changes);
10140
10134
  }
10141
10135
 
10136
+ // update array for checkbox that not in xu-for
10137
+ if (field_prop.props.fieldType === 'array' && $elm.attr('type') === 'radio' && val_is_reference_field) {
10138
+ let arr_value_before_cast = _.clone((await func.datasource.get_value(SESSION_ID, bind_field_id, _dsP, _ds.currentRecordId)).ret.value);
10139
+ let value_from_getter = bind.getter($elm[0]);
10140
+ // let value;
10141
+ // if (arr_value_before_cast.includes(value_from_getter)) {
10142
+ // value = arr_value_before_cast.filter((item) => !_.isEqual(item, value_from_getter));
10143
+ // } else {
10144
+ // arr_value_before_cast.push(value_from_getter);
10145
+ // value = arr_value_before_cast;
10146
+ // }
10147
+
10148
+ let datasource_changes = {
10149
+ [_dsP]: {
10150
+ [_ds.currentRecordId]: {
10151
+ [bind_field_id]: [value_from_getter],
10152
+ },
10153
+ },
10154
+ };
10155
+
10156
+ return await func.datasource.update(SESSION_ID, datasource_changes);
10157
+ }
10158
+
10142
10159
  var value = await func.common.get_cast_val(SESSION_ID, 'xu-bind', 'value', field_prop.props.fieldType, bind.getter($elm[0]));
10143
10160
 
10144
10161
  if (field_prop.props.fieldType === 'object' && !val_is_reference_field) {