biz9-logic 4.8.21 → 4.8.23

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.
package/biz9_config CHANGED
@@ -1,4 +1,4 @@
1
- VERSION='5.0.1'
1
+ VERSION='5.0.3'
2
2
  TITLE='BiZ9-Logic';
3
3
  REPO='git@github.com:biz9framework/biz9-logic.git';
4
4
  BRANCH='main';
package/index.js CHANGED
@@ -33,9 +33,9 @@ class Item_Logic {
33
33
  DataItem.get_new(data_type,0),
34
34
  DataItem.get_new(data_type,0),
35
35
  Field_Logic.get_test(title,option));
36
-
37
36
  if(option.get_item){
38
37
  item.items = Sub_Item_Logic.get_test_item_list(item,item,option);
38
+ item = Sub_Item_Logic.bind_parent_child_list(item,item.items);
39
39
  }
40
40
  return item;
41
41
  }
@@ -50,10 +50,6 @@ class Item_Logic {
50
50
  }
51
51
  class Template_Logic {
52
52
  static get_test = (title,option) =>{
53
- if(!title){
54
- title = "Template "+ Number.get_id();
55
- option = {};
56
- }
57
53
  option = Field_Logic.get_option(DataType.TEMPLATE,option?option:{});
58
54
  let template = DataItem.get_new_full_item(
59
55
  DataItem.get_new(DataType.TEMPLATE,0),
@@ -62,16 +58,13 @@ class Template_Logic {
62
58
  Field_Logic.get_test(title,option));
63
59
  if(option.get_item){
64
60
  template.items = Sub_Item_Logic.get_test_item_list(template,template,option);
61
+ template = Sub_Item_Logic.bind_parent_child_list(template,template.items);
65
62
  }
66
63
  return template;
67
64
  };
68
65
  }
69
66
  class Team_Logic {
70
67
  static get_test = (title,option) =>{
71
- if(!title){
72
- title = "Team "+Number.get_id();
73
- option = {};
74
- }
75
68
  option = Field_Logic.get_option(DataType.TEAM,option?option:{});
76
69
  let team = DataItem.get_new_full_item(
77
70
  DataItem.get_new(DataType.TEAM,0),
@@ -119,10 +112,6 @@ class Team_Logic {
119
112
  }
120
113
  class Page_Logic {
121
114
  static get_test = (title,option) =>{
122
- if(!title){
123
- title = "Page "+ Number.get_id();
124
- option = {};
125
- }
126
115
  option = Field_Logic.get_option(DataType.PAGE,option?option:{});
127
116
  let page = DataItem.get_new_full_item(
128
117
  DataItem.get_new(DataType.PAGE,0),
@@ -131,6 +120,7 @@ class Page_Logic {
131
120
  Field_Logic.get_test(title,option));
132
121
  if(option.get_section){
133
122
  page.items = Sub_Item_Logic.get_test_section_list(page,page,option);
123
+ page = Sub_Item_Logic.bind_parent_child_list(page,page.items);
134
124
  }
135
125
  return page;
136
126
  };
@@ -145,10 +135,6 @@ class Page_Logic {
145
135
  }
146
136
  class Product_Logic {
147
137
  static get_test = (title,option) =>{
148
- if(!title){
149
- title = "Product 1";
150
- option = {};
151
- }
152
138
  option = Field_Logic.get_option(DataType.PRODUCT,option?option:{});
153
139
  let product = DataItem.get_new_full_item(
154
140
  DataItem.get_new(DataType.PRODUCT,0),
@@ -191,10 +177,6 @@ class Product_Logic {
191
177
  }
192
178
  class Service_Logic {
193
179
  static get_test = (title,option) =>{
194
- if(!title){
195
- title = "Service 1";
196
- option = {};
197
- }
198
180
  option = Field_Logic.get_option(DataType.SERVICE,option?option:{});
199
181
  let service = DataItem.get_new_full_item(
200
182
  DataItem.get_new(DataType.SERVICE,0),
@@ -237,10 +219,6 @@ class Service_Logic {
237
219
  }
238
220
  class Content_Logic {
239
221
  static get_test = (title,option) =>{
240
- if(!title){
241
- title = "Content 1";
242
- option = {};
243
- }
244
222
  option = Field_Logic.get_option(DataType.CONTENT,option?option:{});
245
223
  let content = DataItem.get_new_full_item(
246
224
  DataItem.get_new(DataType.CONTENT,0),
@@ -249,6 +227,7 @@ class Content_Logic {
249
227
  Field_Logic.get_test(title,option));
250
228
  if(option.get_item){
251
229
  content.items = Sub_Item_Logic.get_test_section_list(content,content,option);
230
+ content = Sub_Item_Logic.bind_parent_child_list(content,content.items);
252
231
  }
253
232
  return content;
254
233
  };
@@ -278,10 +257,6 @@ class Content_Logic {
278
257
  }
279
258
  class Blog_Post_Logic {
280
259
  static get_test = (title,option) =>{
281
- if(!title){
282
- title = "Blog Post 1";
283
- option = {};
284
- }
285
260
  option = Field_Logic.get_option(DataType.BLOG_POST,option?option:{});
286
261
  let blog_post = DataItem.get_new_full_item(
287
262
  DataItem.get_new(DataType.BLOG_POST,0),
@@ -321,10 +296,6 @@ class Blog_Post_Logic {
321
296
  }
322
297
  class Event_Logic {
323
298
  static get_test = (title,option) =>{
324
- if(!title){
325
- title = "Event " + Number.get_id();
326
- option = {};
327
- }
328
299
  option = Field_Logic.get_option(DataType.EVENT,option?option:{});
329
300
  let event = DataItem.get_new_full_item(
330
301
  DataItem.get_new(DataType.EVENT,0),
@@ -371,10 +342,6 @@ class Event_Logic {
371
342
  }
372
343
  class Field_Logic {
373
344
  static get_test = (title,option) =>{
374
- if(!title){
375
- title="";
376
- option={};
377
- }
378
345
  if(!option){
379
346
  option= {};
380
347
  }
@@ -424,7 +391,7 @@ class Field_Logic {
424
391
  if(!option.get_item){
425
392
  option.get_item=false;
426
393
  }
427
- if(!option.item_count){
394
+ if(!option.item_count){
428
395
  option.item_count=9;
429
396
  }
430
397
  if(!option.category_count){
@@ -441,7 +408,7 @@ class Field_Logic {
441
408
  option.section_count=9;
442
409
  }
443
410
  if(!option.get_section){
444
- option.get_section=false;
411
+ option.get_section=false;
445
412
  }
446
413
  }
447
414
  if(option.data_type==DataType.PRODUCT){
@@ -618,10 +585,6 @@ class DataType {
618
585
  }
619
586
  class Blank_Logic {
620
587
  static get_test = (title,option) =>{
621
- if(!title){
622
- title = "Blank " + Number.get_id();
623
- option={};
624
- }
625
588
  option = Field_Logic.get_option(DataType.BLANK,option?option:{});
626
589
  let blank = DataItem.get_new_full_item(
627
590
  DataItem.get_new(DataType.BLANK,0),
@@ -630,6 +593,7 @@ class Blank_Logic {
630
593
  Field_Logic.get_test(title,option));
631
594
  if(option.get_item){
632
595
  blank.items = Sub_Item_Logic.get_test_item_list(blank,blank,option);
596
+ blank = Sub_Item_Logic.bind_parent_child_list(blank,blank.items);
633
597
  }
634
598
  return blank;
635
599
  };
@@ -659,10 +623,6 @@ class Blank_Logic {
659
623
  }
660
624
  class Faq_Logic {
661
625
  static get_test = (title,option) =>{
662
- if(!title){
663
- title = "Faq " + Number.get_id();
664
- option={};
665
- }
666
626
  option = Field_Logic.get_option(DataType.FAQ,option?option:{});
667
627
  option.get_value = false;
668
628
  let faq = DataItem.get_new_full_item(
@@ -741,10 +701,6 @@ class Business_Logic {
741
701
  });
742
702
  };
743
703
  static get_test = (title,option) =>{
744
- if(!title){
745
- title="Business "+Number.get_id();
746
- option={};
747
- }
748
704
  option = Field_Logic.get_option(DataType.BUSINESS,option?option:{});
749
705
  Log.w('option',option);
750
706
  let item = DataItem.get_new(DataType.BUSINESS,0);
@@ -1059,7 +1015,7 @@ class Category_Logic {
1059
1015
  DataItem.get_new(DataType.CATEGORY,0),
1060
1016
  DataItem.get_new(DataType.CATEGORY,0),
1061
1017
  Field_Logic.get_test("Category " +String(parseInt(a+1)),option));
1062
- category.type = type;
1018
+ category.type = type;
1063
1019
  category_list.push(category);
1064
1020
  }
1065
1021
  return category_list;
@@ -1404,10 +1360,24 @@ class Sub_Item_Logic {
1404
1360
  let new_list = [];
1405
1361
  for(let a=0;a<option.section_count;a++){
1406
1362
  let item_title ="Section " + String(parseInt(a+1));
1407
- new_list.push(Sub_Item_Logic.get_test(item_title,parent_item,top_item,option));
1363
+ let item = Sub_Item_Logic.get_test(item_title,parent_item,top_item,option);
1364
+ let new_sub_list = [];
1365
+ for(let b=0;b<option.section_count;b++){
1366
+ let sub_item_title ="Section " + String(parseInt(b+1));
1367
+ let sub_item = Sub_Item_Logic.get_test(sub_item_title,item,top_item,option);
1368
+ new_sub_list.push(sub_item);
1369
+ }
1370
+ item = Sub_Item_Logic.bind_parent_child_list(item,new_sub_list);
1371
+ new_list.push(item);
1408
1372
  }
1409
1373
  return new_list;
1410
1374
  }
1375
+ static bind_parent_child_list(item,item_list){
1376
+ for(let a=0;a<item_list.length;a++){
1377
+ item[Str.get_title_url(item_list[a].title)] = item_list[a];
1378
+ }
1379
+ return item;
1380
+ }
1411
1381
  }
1412
1382
  module.exports = {
1413
1383
  Business_Logic,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz9-logic",
3
- "version": "4.8.21",
3
+ "version": "4.8.23",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/test.js CHANGED
@@ -147,8 +147,10 @@ describe("connect", () => {
147
147
  /* --PAGE--START */
148
148
  //let page = Page_Logic.get_test()
149
149
  //let page = Page_Logic.get_test("Page "+Number.get_id())
150
- let page = Page_Logic.get_test("Page "+Number.get_id(),{get_value:true,value_count:5,get_section:false})
150
+ let page = Page_Logic.get_test("Page "+Number.get_id(),{get_value:true,value_count:5,get_section:true,section_count:2})
151
151
  Log.w("page",page);
152
+ Log.w("page_section_1",page.section_1);
153
+ Log.w("page_section_1_section_1",page.section_1.section_1);
152
154
  //let page_list = Page_Logic.get_test_list({page_count:10});
153
155
  //Log.w("Page_list",page_list);
154
156
  /*