pict-section-form 1.2.0 → 1.2.1

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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "workbench.colorTheme": "Default High Contrast",
2
+ "workbench.colorTheme": "Default Dark Modern",
3
3
  "sqltools.connections": [
4
4
  {
5
5
  "mysqlOptions": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pict-section-form",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Pict dynamic form sections",
5
5
  "main": "source/Pict-Section-Form.js",
6
6
  "directories": {
@@ -26,6 +26,19 @@ class RecordLayout extends libPictSectionGroupLayout
26
26
  */
27
27
  generateGroupLayoutTemplate(pView, pGroup)
28
28
  {
29
+ pGroup.Rows.sort((rowA, rowB) =>
30
+ {
31
+ if (rowA.RowNumber && rowB.RowNumber)
32
+ {
33
+ return rowA.RowNumber >= rowB.RowNumber ? 1 : -1;
34
+ }
35
+ if (!rowA.RowNumber && !rowB.RowNumber)
36
+ {
37
+ return rowA.Hash >= rowB.Hash ? 1 : -1;
38
+ }
39
+ return rowA.RowNumber ? 1 : -1;
40
+ });
41
+
29
42
  // loop over descriptors that have my group set?
30
43
  // set their GroupIndex from pGroup
31
44
  for (let j = 0; j < pGroup.Rows.length; j++)
@@ -29,6 +29,19 @@ class RecordLayout extends libPictSectionGroupLayout
29
29
  let tmpMetatemplateGenerator = this.pict.providers.MetatemplateGenerator;
30
30
  let tmpTemplate = '';
31
31
 
32
+ pGroup.Rows.sort((rowA, rowB) =>
33
+ {
34
+ if (rowA.RowNumber && rowB.RowNumber)
35
+ {
36
+ return rowA.RowNumber >= rowB.RowNumber ? 1 : -1;
37
+ }
38
+ if (!rowA.RowNumber && !rowB.RowNumber)
39
+ {
40
+ return rowA.Hash >= rowB.Hash ? 1 : -1;
41
+ }
42
+ return rowA.RowNumber ? 1 : -1;
43
+ });
44
+
32
45
  if (!('Rows' in pGroup))
33
46
  {
34
47
  pGroup.Rows = [];
@@ -34,6 +34,19 @@ class VerticalRecordLayout extends libPictSectionGroupLayout
34
34
  pGroup.Rows = [];
35
35
  }
36
36
 
37
+ pGroup.Rows.sort((rowA, rowB) =>
38
+ {
39
+ if (rowA.RowNumber && rowB.RowNumber)
40
+ {
41
+ return rowA.RowNumber >= rowB.RowNumber ? 1 : -1;
42
+ }
43
+ if (!rowA.RowNumber && !rowB.RowNumber)
44
+ {
45
+ return rowA.Hash >= rowB.Hash ? 1 : -1;
46
+ }
47
+ return rowA.RowNumber ? 1 : -1;
48
+ });
49
+
37
50
  tmpTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView, `-Template-Group-Prefix`, `getGroup("${pGroup.GroupIndex}")`);
38
51
  // Every input has its own "row" in the vertical layout
39
52
  tmpTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView, `-Template-VerticalRow-Prefix`, `getGroup("${pGroup.GroupIndex}")`);
@@ -122,6 +122,10 @@ class ManifestFactory extends libFableServiceProviderBase
122
122
  tmpGroup.Rows = [];
123
123
  }
124
124
 
125
+ if (Number(tmpDescriptor.PictForm.Row))
126
+ {
127
+ tmpDescriptor.PictForm.Row = Number(tmpDescriptor.PictForm.Row);
128
+ }
125
129
  let tmpRowHash = (typeof (tmpDescriptor.PictForm.Row) == 'string') ? tmpDescriptor.PictForm.Row :
126
130
  (typeof (tmpDescriptor.PictForm.Row) == 'number') ? `Row_${tmpDescriptor.PictForm.Row.toString()}` :
127
131
  'Row_Default';
@@ -133,6 +137,10 @@ class ManifestFactory extends libFableServiceProviderBase
133
137
  if (!tmpRow)
134
138
  {
135
139
  tmpRow = { Hash: tmpRowHash, Name: tmpRowHash, Inputs: [] };
140
+ if (typeof (tmpDescriptor.PictForm.Row) == 'number')
141
+ {
142
+ tmpRow.RowNumber = tmpDescriptor.PictForm.Row
143
+ }
136
144
  tmpGroup.Rows.push(tmpRow);
137
145
  tmpRow.Inputs.push(tmpDescriptor);
138
146
  }