biz9-logic 4.9.96 → 4.9.100

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.
Files changed (3) hide show
  1. package/biz9_config +2 -2
  2. package/index.js +60 -0
  3. package/package.json +1 -1
package/biz9_config CHANGED
@@ -1,7 +1,7 @@
1
- VERSION='9.6.7'
1
+ VERSION='9.7.1'
2
2
  TITLE='BiZ9-Logic';
3
3
  REPO='git@github.com:biz9framework/biz9-logic.git';
4
- BRANCH='9.5.3'
4
+ BRANCH='9.6.8'
5
5
  APP_ID='test_app_id';
6
6
  URL="http://localhost";
7
7
 
package/index.js CHANGED
@@ -1103,6 +1103,66 @@ class Event_Logic {
1103
1103
  };
1104
1104
  }
1105
1105
  class Field_Logic {
1106
+ static get_item_max_group_id = (value_id,item) => {
1107
+ let max_group_id = 1;
1108
+ let full_prop_str = "";
1109
+ for(const prop in item){
1110
+ full_prop_str = String(prop + " "+full_prop_str);
1111
+ }
1112
+ for(let b = 1; b < 30; b++){
1113
+ const exists = Str.check_if_str_exist(full_prop_str,"list_value_"+value_id+"_group_"+b);
1114
+ if(exists){
1115
+ if(b>max_group_id){
1116
+ max_group_id = b;
1117
+ }
1118
+ }
1119
+ }
1120
+ return max_group_id;
1121
+ }
1122
+ static get_item_field_value_list = (data) => {
1123
+ let max_value_id = 1;
1124
+ let max_group_id = 1;
1125
+ let full_prop_str = "";
1126
+ for(const prop in data){
1127
+ full_prop_str = String(prop + " "+full_prop_str);
1128
+ }
1129
+ for(let a = 1; a < 30; a++){
1130
+ const exists = Str.check_if_str_exist(full_prop_str,"list_value_"+a);
1131
+ if(exists){
1132
+ if(a>max_value_id){
1133
+ max_value_id = a;
1134
+ }
1135
+ }
1136
+ for(let b = 1; b < 30; b++){
1137
+ const exists = Str.check_if_str_exist(full_prop_str,"list_value_"+a+"_group_"+b);
1138
+ if(exists){
1139
+ if(b>max_group_id){
1140
+ max_group_id = b;
1141
+ }
1142
+ }
1143
+ }
1144
+ }
1145
+ for(let a = 1; a <= max_value_id+1; a++){
1146
+ let sub_check_str = 'list_value_'+a;
1147
+ data[sub_check_str] = [];
1148
+ for(let b = 1; b < max_group_id+1; b++){
1149
+ let full_sub_check_str = sub_check_str+"_group_"+b;
1150
+ let new_item = {};
1151
+ for(const sub_prop in data){
1152
+ if(sub_prop.startsWith(full_sub_check_str)){
1153
+ new_item[sub_prop.replace(full_sub_check_str+"_","")] = data[sub_prop];
1154
+ }
1155
+ }
1156
+ if(!Obj.check_is_empty(new_item)){
1157
+ data[sub_check_str].push(new_item);
1158
+ }
1159
+ }
1160
+ if(data[sub_check_str].length<=0){
1161
+ delete data[sub_check_str];
1162
+ }
1163
+ }
1164
+ return data;
1165
+ }
1106
1166
  static get_item_field_value_type_list = () => {
1107
1167
  return [
1108
1168
  {value:'text',label:'Text'},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz9-logic",
3
- "version": "4.9.96",
3
+ "version": "4.9.100",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"