pict-section-form 1.0.78 → 1.0.80

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pict-section-form",
3
- "version": "1.0.78",
3
+ "version": "1.0.80",
4
4
  "description": "Pict dynamic form sections",
5
5
  "main": "source/Pict-Section-Form.js",
6
6
  "directories": {
@@ -70,6 +70,13 @@ class CustomInputHandler extends libPictSectionInputExtension
70
70
  }
71
71
 
72
72
  const tmpFilterTemplateRecord = { Value:pValue, Input:pInput, View:pView };
73
+ let tmpRecordStartCursor = null;
74
+ let tmpRecordCount = null;
75
+ if (pEntityInformation.RecordCount)
76
+ {
77
+ tmpRecordStartCursor = pEntityInformation.RecordStartCursor != null ? pEntityInformation.RecordStartCursor : 0;
78
+ tmpRecordCount = pEntityInformation.RecordCount != null ? pEntityInformation.RecordCount : null;
79
+ }
73
80
  // Parse the filter template
74
81
  const tmpFilterString = this.pict.parseTemplate(pEntityInformation.Filter, tmpFilterTemplateRecord);
75
82
  if (tmpFilterString == '')
@@ -79,37 +86,44 @@ class CustomInputHandler extends libPictSectionInputExtension
79
86
  }
80
87
 
81
88
  // Now get the records
82
- this.pict.EntityProvider.getEntitySet(pEntityInformation.Entity, tmpFilterString,
83
- (pError, pRecordSet) =>
89
+ const callback = (pError, pRecordSet) =>
90
+ {
91
+ if (pError)
84
92
  {
85
- if (pError)
86
- {
87
- this.log.error(`EntityBundleRequest request Error getting entity set for [${pEntityInformation.Entity}] with filter [${tmpFilterString}]: ${pError}`, pError);
88
- return fCallback(pError, '');
89
- }
93
+ this.log.error(`EntityBundleRequest request Error getting entity set for [${pEntityInformation.Entity}] with filter [${tmpFilterString}]: ${pError}`, pError);
94
+ return fCallback(pError, '');
95
+ }
90
96
 
91
- this.log.trace(`EntityBundleRequest found ${pRecordSet.length} records for ${pEntityInformation.Entity} filtered to [${tmpFilterString}]`);
97
+ this.log.trace(`EntityBundleRequest found ${pRecordSet.length} records for ${pEntityInformation.Entity} filtered to [${tmpFilterString}]`);
92
98
 
93
- // Now assign it back to the destination; because this is not view specific it doesn't use the manifests from them (to deal with scope overlap with subgrids).
94
- if (pEntityInformation.SingleRecord)
99
+ // Now assign it back to the destination; because this is not view specific it doesn't use the manifests from them (to deal with scope overlap with subgrids).
100
+ if (pEntityInformation.SingleRecord)
101
+ {
102
+ if (pRecordSet.length > 1)
95
103
  {
96
- if (pRecordSet.length > 1)
97
- {
98
- this.log.warn(`EntityBundleRequest found more than one record for ${pEntityInformation.Entity} filtered to [${tmpFilterString}] but SingleRecord is true; setting the first record.`);
99
- }
100
- if (pRecordSet.length < 1)
101
- {
102
- this.pict.manifest.setValueByHash(this.pict, pEntityInformation.Destination, false);
103
- }
104
- this.pict.manifest.setValueByHash(this.pict, pEntityInformation.Destination, pRecordSet[0]);
104
+ this.log.warn(`EntityBundleRequest found more than one record for ${pEntityInformation.Entity} filtered to [${tmpFilterString}] but SingleRecord is true; setting the first record.`);
105
105
  }
106
- else
106
+ if (pRecordSet.length < 1)
107
107
  {
108
- this.pict.manifest.setValueByHash(this.pict, pEntityInformation.Destination, pRecordSet);
108
+ this.pict.manifest.setValueByHash(this.pict, pEntityInformation.Destination, false);
109
109
  }
110
+ this.pict.manifest.setValueByHash(this.pict, pEntityInformation.Destination, pRecordSet[0]);
111
+ }
112
+ else
113
+ {
114
+ this.pict.manifest.setValueByHash(this.pict, pEntityInformation.Destination, pRecordSet);
115
+ }
110
116
 
111
- return fCallback();
112
- });
117
+ return fCallback();
118
+ };
119
+ if (tmpRecordCount)
120
+ {
121
+ this.pict.EntityProvider.getEntitySetPage(pEntityInformation.Entity, tmpFilterString, tmpRecordStartCursor, tmpRecordCount, callback);
122
+ }
123
+ else
124
+ {
125
+ this.pict.EntityProvider.getEntitySet(pEntityInformation.Entity, tmpFilterString, callback);
126
+ }
113
127
  }
114
128
 
115
129
  /**
@@ -129,7 +143,7 @@ class CustomInputHandler extends libPictSectionInputExtension
129
143
  if ((typeof(pInput) !== 'object') || !('PictForm' in pInput) || !('EntitiesBundle' in pInput.PictForm) || !Array.isArray(pInput.PictForm.EntitiesBundle))
130
144
  {
131
145
  this.log.warn(`Input at ${pHTMLSelector} is set as an EntityBundleRequest input but no array of entity requests was found`);
132
- return false;
146
+ return null;
133
147
  }
134
148
 
135
149
  let tmpInput = pInput;
@@ -149,8 +163,8 @@ class CustomInputHandler extends libPictSectionInputExtension
149
163
  catch (pError)
150
164
  {
151
165
  this.log.error(`EntityBundleRequest error gathering entity set: ${pError}`, pError);
152
- return fNext();
153
166
  }
167
+ return fNext();
154
168
  });
155
169
  }
156
170
 
@@ -1 +1 @@
1
- {"version":3,"file":"Pict-Provider-Input-EntityBundleRequest.d.ts","sourceRoot":"","sources":["../../../../source/providers/inputs/Pict-Provider-Input-EntityBundleRequest.js"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH;IAEC,2DAUC;IANA,6BAA6B;IAC7B,MADW,OAAO,MAAM,CAAC,CAChB;IACT,4DAA4D;IAC5D,OADW,OAAO,MAAM,CAAC,GAAG;QAAE,aAAa,EAAE,MAAM,GAAG,CAAA;KAAE,CAC9C;IACV,kBAAkB;IAClB,KADW,GAAG,CACN;IAGT,oGA4DC;IAED;;;;;;;;;OASG;IACH,sDALW,GAAG,iBACH,MAAM,GAEL,OAAO,CAAC,KAAK,OAAC,CAAC,CA4D1B;IAoBD;;;;;;;;;;OAUG;IACH,uEALW,GAAG,iBACH,MAAM,aACN,MAAM,GACJ,GAAG,CAKf;IAED;;;;;;;;OAQG;IACH,8CAJW,GAAG,iBACH,MAAM,GACJ,GAAG,CAMf;IAED;;;;;;;;;OASG;IACH,qDALW,GAAG,iBACH,MAAM,aACN,MAAM,GACJ,GAAG,CAMf;IAED;;;;;;;;;;OAUG;IACH,6EAJW,GAAG,iBACH,MAAM,GACJ,OAAO,CAKnB;IAED;;;;;;;;;;OAUG;IACH,yEALW,GAAG,iBACH,MAAM,aACN,MAAM,GACJ,GAAG,CAKf;CACD"}
1
+ {"version":3,"file":"Pict-Provider-Input-EntityBundleRequest.d.ts","sourceRoot":"","sources":["../../../../source/providers/inputs/Pict-Provider-Input-EntityBundleRequest.js"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH;IAEC,2DAUC;IANA,6BAA6B;IAC7B,MADW,OAAO,MAAM,CAAC,CAChB;IACT,4DAA4D;IAC5D,OADW,OAAO,MAAM,CAAC,GAAG;QAAE,aAAa,EAAE,MAAM,GAAG,CAAA;KAAE,CAC9C;IACV,kBAAkB;IAClB,KADW,GAAG,CACN;IAGT,oGA0EC;IAED;;;;;;;;;OASG;IACH,sDALW,GAAG,iBACH,MAAM,GAEL,OAAO,CAAC,KAAK,OAAC,CAAC,CA4D1B;IAoBD;;;;;;;;;;OAUG;IACH,uEALW,GAAG,iBACH,MAAM,aACN,MAAM,GACJ,GAAG,CAKf;IAED;;;;;;;;OAQG;IACH,8CAJW,GAAG,iBACH,MAAM,GACJ,GAAG,CAMf;IAED;;;;;;;;;OASG;IACH,qDALW,GAAG,iBACH,MAAM,aACN,MAAM,GACJ,GAAG,CAMf;IAED;;;;;;;;;;OAUG;IACH,6EAJW,GAAG,iBACH,MAAM,GACJ,OAAO,CAKnB;IAED;;;;;;;;;;OAUG;IACH,yEALW,GAAG,iBACH,MAAM,aACN,MAAM,GACJ,GAAG,CAKf;CACD"}