pict-section-form 1.0.42 → 1.0.43

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.42",
3
+ "version": "1.0.43",
4
4
  "description": "Pict dynamic form sections",
5
5
  "main": "source/Pict-Section-Form.js",
6
6
  "directories": {
@@ -113,6 +113,7 @@ class PictTemplateMetatemplateInputTemplate extends libPictTemplate
113
113
  this.log.trace(`PICT Metacontroller Template [MetaTemplateInput]::[${tmpHash}]`);
114
114
  }
115
115
 
116
+ let tmpInputName = false;
116
117
  let tmpInputAddress = false;
117
118
  let tmpDataType = false;
118
119
  let tmpInputType = false;
@@ -124,30 +125,55 @@ class PictTemplateMetatemplateInputTemplate extends libPictTemplate
124
125
  this.log.warn(`MetaTemplateInput template requires at least parameters (Address and DataType) [${tmpHash}]`);
125
126
  return '';
126
127
  }
127
- tmpInputAddress = tmpHashTemplateSeparator[0];
128
- tmpDataType = tmpHashTemplateSeparator[1];
129
- if (tmpHashTemplateSeparator.length > 2)
128
+ tmpInputName = tmpHashTemplateSeparator[0];
129
+ tmpInputAddress = tmpHashTemplateSeparator[1];
130
+ tmpDataType = tmpHashTemplateSeparator[2];
131
+ if (tmpHashTemplateSeparator.length > 3)
130
132
  {
131
- tmpInputType = tmpHashTemplateSeparator[2];
133
+ tmpInputType = tmpHashTemplateSeparator[3];
132
134
  }
133
-
134
135
  // Construct a fake input object
135
136
  let tmpInput = {
136
137
  Address: tmpInputAddress,
137
- Hash: tmpInputAddress,
138
+ Name: tmpInputName,
139
+ Hash: this.fable.DataFormat.cleanNonAlphaCharacters(tmpInputAddress),
138
140
  DataType: tmpDataType,
139
- PictForm: {}
141
+ PictForm: {
142
+ InformaryDataAddress: tmpInputAddress,
143
+ GroupIndex: 0,
144
+ Row: 0
145
+ }
140
146
  };
141
147
 
148
+ this.currentInputIndex++;
149
+
142
150
  if (tmpInputType)
143
151
  {
144
152
  tmpInput.PictForm.InputType = tmpInputType;
145
153
  }
146
154
 
155
+ // Check to see if the input is already in the manifest
156
+ let tmpRow = tmpMetatemplateGenerator.dynamicInputView.getRow(0, 0);
157
+
158
+ for (let i = 0; i < tmpRow.Inputs.length; i++)
159
+ {
160
+ if (tmpRow.Inputs[i].Hash === tmpInput.Hash)
161
+ {
162
+ let tmpInput = tmpRow.Inputs[i];
163
+ let tmpTemplate = tmpMetatemplateGenerator.getInputMetatemplateTemplateReference(tmpMetatemplateGenerator.dynamicInputView, tmpInput.DataType, tmpInput.PictForm.InputType, `getInput("0","0","${tmpInput.PictForm.InputIndex}")`);
164
+ return this.pict.parseTemplate(tmpTemplate, tmpInput, fCallback, [tmpMetatemplateGenerator.dynamicInputView]);
165
+ }
166
+ }
167
+
168
+ // It isn't already in the manifest, so add it.
169
+ tmpInput.PictForm.InputIndex = tmpRow.Inputs.length;
147
170
  tmpMetatemplateGenerator.dynamicInputView.sectionManifest.addDescriptor(tmpInput.Address, tmpInput);
171
+ tmpRow.Inputs.push(tmpInput);
172
+
148
173
  this.pict.providers.MetatemplateMacros.buildInputMacros(tmpMetatemplateGenerator.dynamicInputView, tmpInput);
149
174
 
150
- let tmpTemplate = tmpMetatemplateGenerator.getInputMetatemplateTemplateReference(tmpMetatemplateGenerator.dynamicInputView, tmpInput.DataType, tmpInput.PictForm.InputType, `getInputFromHash("${tmpInput.Hash}")`);
175
+ // Now generate the metatemplate
176
+ let tmpTemplate = tmpMetatemplateGenerator.getInputMetatemplateTemplateReference(tmpMetatemplateGenerator.dynamicInputView, tmpInput.DataType, tmpInput.PictForm.InputType, `getInput("0","0","${tmpInput.PictForm.InputIndex}")`);
151
177
 
152
178
  return this.pict.parseTemplate(tmpTemplate, tmpInput, fCallback, [tmpMetatemplateGenerator.dynamicInputView]);
153
179
  }