pict-section-form 1.0.109 → 1.0.111

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.109",
3
+ "version": "1.0.111",
4
4
  "description": "Pict dynamic form sections",
5
5
  "main": "source/Pict-Section-Form.js",
6
6
  "directories": {
@@ -31,7 +31,7 @@
31
31
  "browser-env": "^3.3.0",
32
32
  "eslint": "^9.26.0",
33
33
  "jquery": "^3.7.1",
34
- "pict": "^1.0.293",
34
+ "pict": "^1.0.299",
35
35
  "pict-application": "^1.0.27",
36
36
  "pict-service-commandlineutility": "^1.0.15",
37
37
  "quackage": "^1.0.42",
@@ -558,6 +558,90 @@ Glug glug glug Oo... -->
558
558
  */
559
559
 
560
560
 
561
+ /*
562
+ *
563
+ * [ RecordSet Templates START ]
564
+ *
565
+ */
566
+ {
567
+ "HashPostfix": "-RecordSetTemplate-Group-Prefix",
568
+ "Template": /*HTML*/`
569
+ <div {~D:Record.Macro.PictFormLayout~}>
570
+ <!-- Form RecordSet Template Group Prefix [{~D:Context[0].UUID~}]::[{~D:Context[0].Hash~}] {~D:Record.Hash~}::{~D:Record.Name~} -->
571
+ `
572
+ },
573
+ {
574
+ "HashPostfix": "-RecordSetTemplate-Group-Postfix",
575
+ "Template": /*HTML*/`
576
+ <div><a href="#/" onclick="{~D:Record.Macro.TabularCreateRowFunctionCall~}">create</a></div>
577
+ </div>
578
+ <!-- Form RecordSet Template Group Prefix [{~D:Context[0].UUID~}]::[{~D:Context[0].Hash~}] {~D:Record.Hash~}::{~D:Record.Name~} -->
579
+ `
580
+ },
581
+
582
+
583
+ /*
584
+ * BEGIN RecordSet Template "Extra" Columns
585
+ * these are meant to be easy ways to add controls to the left or right side of a record column
586
+ */
587
+
588
+ {
589
+ "HashPostfix": "-RecordSetTemplate-Row-ExtraPrefix",
590
+ "Template": /*HTML*/`<!-- RecordSetTemplateRow-ExtraPrefix -->`
591
+ },
592
+ // by default PICT puts a "delete row" button on the right side of a RecordSet Templateset
593
+ {
594
+ "HashPostfix": "-RecordSetTemplate-Row-ExtraPostfix",
595
+ "Template": /*HTML*/`<!-- RecordSetTemplateRow-ExtraPostfix-->
596
+ <div class="PictSectionForm-RecordSet-Controls">
597
+ <a href="#/" onClick="{~P~}.views['{~D:Context[0].Hash~}'].deleteDynamicTableRow({~D:Record.Group~},'{~D:Record.Key~}')">del</a>
598
+ <a href="#/" onClick="{~P~}.views['{~D:Context[0].Hash~}'].moveDynamicTableRowUp({~D:Record.Group~},'{~D:Record.Key~}')">up</a>
599
+ <a href="#/" onClick="{~P~}.views['{~D:Context[0].Hash~}'].moveDynamicTableRowDown({~D:Record.Group~},'{~D:Record.Key~}')">down</a>
600
+ </div>
601
+ `
602
+ },
603
+ /*
604
+ * END RecordSet Template "Extra" Columns
605
+ */
606
+
607
+ /*
608
+ * BEGIN RecordSet TemplateSet Templates ("row" and "cell" prefix/postfix ... tr/td)
609
+ * (these are repeated for each "row" which is a record, and then wrap each "cell" which is a columnar input)
610
+ */
611
+ {
612
+ "HashPostfix": "-RecordSetTemplate-Row-Prefix",
613
+ "Template": /*HTML*/`
614
+ <div class="RecordSetEntry">
615
+ <!-- RecordSetTemplateRow-Prefix -->
616
+ `
617
+ },
618
+ {
619
+ "HashPostfix": "-RecordSetTemplate-Cell-Prefix",
620
+ "Template": /*HTML*/`
621
+ <div style="display:inline;">
622
+ <!-- RecordSetTemplateCell-Prefix -->
623
+ <span class="RecordSetInputLabel">{~D:Record.Name~}</span>
624
+ `
625
+ },
626
+ {
627
+ "HashPostfix": "-RecordSetTemplate-Cell-Postfix",
628
+ "Template": /*HTML*/`
629
+ <!-- RecordSetTemplateCell-Postfix -->
630
+ </div>
631
+ `
632
+ },
633
+ {
634
+ "HashPostfix": "-RecordSetTemplate-Row-Postfix",
635
+ "Template": /*HTML*/`
636
+ <!-- RecordSetTemplateRow-Postfix -->
637
+ </div>`
638
+ },
639
+ /*
640
+ * END RecordSet TemplateSet Templates
641
+ */
642
+
643
+
644
+
561
645
  /*
562
646
  *
563
647
  * [ Tabular Templates START ]
@@ -47,7 +47,8 @@ class CustomInputHandler extends libPictSectionInputExtension
47
47
 
48
48
  getSectionSelector(pTabViewSectionHash)
49
49
  {
50
- return `#Pict-${this.UUID}-${pTabViewSectionHash}-Wrap`;
50
+ const metaController = this.pict.views.PictFormMetacontroller;
51
+ return `#Pict-${metaController ? metaController.UUID : this.UUID}-${pTabViewSectionHash}-Wrap`;
51
52
  }
52
53
 
53
54
  selectTabByViewHash(pViewHash, pInputHash, pTabViewHash)
@@ -41,7 +41,6 @@ class RecordLayout extends libPictSectionGroupLayout
41
41
 
42
42
  tmpTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView, `-Template-Row-Prefix`, `getGroup("${pGroup.GroupIndex}")`);
43
43
 
44
- // There are three row layouts: Record, Tabular and Columnar
45
44
  for (let k = 0; k < tmpRow.Inputs.length; k++)
46
45
  {
47
46
  let tmpInput = tmpRow.Inputs[k];
@@ -38,54 +38,92 @@ class RecordSetLayout extends libPictSectionGroupLayout
38
38
  let tmpMetatemplateGenerator = this.pict.providers.MetatemplateGenerator;
39
39
  let tmpTemplate = '';
40
40
  let tmpTemplateSetRecordRowTemplate = '';
41
- tmpTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView, `-TabularTemplate-Group-Prefix`, `getGroup("${pGroup.GroupIndex}")`);
42
- // Tabular templates only have one "row" for the header in the standard template, and then a row for each record.
43
- // The row for each record happens as a TemplateSet.
44
- tmpTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView, `-TabularTemplate-RowHeader-Prefix`, `getGroup("${pGroup.GroupIndex}")`);
45
- tmpTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView, `-TabularTemplate-RowHeader-ExtraPrefix`, `getGroup("${pGroup.GroupIndex}")`);
41
+ tmpTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView, `-RecordSetTemplate-Group-Prefix`, `getGroup("${pGroup.GroupIndex}")`);
46
42
 
43
+ let tmpMaxRowIndex = 0;
44
+ for (let k = 0; k < pGroup.supportingManifest.elementAddresses.length; k++)
45
+ {
46
+ let tmpSupportingManifestHash = pGroup.supportingManifest.elementAddresses[k];
47
+ let tmpInput = pGroup.supportingManifest.elementDescriptors[tmpSupportingManifestHash];
48
+ // Update the InputIndex to match the current render config
49
+ if (!('PictForm' in tmpInput))
50
+ {
51
+ tmpInput.PictForm = {};
52
+ }
53
+ if (tmpInput.PictForm.TabularHidden)
54
+ {
55
+ continue;
56
+ }
57
+ tmpInput.PictForm.InputIndex = k;
58
+ tmpInput.PictForm.GroupIndex = pGroup.GroupIndex;
59
+ if (tmpInput.PictForm.Row)
60
+ {
61
+ tmpInput.PictForm.RowIndex = tmpInput.PictForm.Row;
62
+ if (tmpInput.PictForm.RowIndex > tmpMaxRowIndex)
63
+ {
64
+ tmpMaxRowIndex = tmpInput.PictForm.RowIndex;
65
+ }
66
+ }
67
+ }
47
68
 
48
- for (let j = 0; j < pGroup.Rows.length; j++)
69
+ for (let k = 0; k < pGroup.supportingManifest.elementAddresses.length; k++)
49
70
  {
71
+ let tmpSupportingManifestHash = pGroup.supportingManifest.elementAddresses[k];
72
+ let tmpInput = pGroup.supportingManifest.elementDescriptors[tmpSupportingManifestHash];
73
+ // Update the InputIndex to match the current render config
74
+ if (!('PictForm' in tmpInput))
75
+ {
76
+ tmpInput.PictForm = {};
77
+ }
78
+ if (tmpInput.PictForm.TabularHidden)
79
+ {
80
+ continue;
81
+ }
82
+ if (!tmpInput.PictForm.RowIndex)
83
+ {
84
+ tmpInput.PictForm.RowIndex = tmpMaxRowIndex + 1;
85
+ }
86
+ }
87
+
88
+ for (let d = 0; d < tmpMaxRowIndex + 1; d++)
89
+ {
90
+ tmpTemplateSetRecordRowTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView, `-Template-Row-Prefix`, `getGroup("${pGroup.GroupIndex}")`);
50
91
  for (let k = 0; k < pGroup.supportingManifest.elementAddresses.length; k++)
51
92
  {
52
93
  let tmpSupportingManifestHash = pGroup.supportingManifest.elementAddresses[k];
53
94
  let tmpInput = pGroup.supportingManifest.elementDescriptors[tmpSupportingManifestHash];
54
95
  // Update the InputIndex to match the current render config
55
- if (!('PictForm' in tmpInput))
96
+ if (tmpInput.PictForm.TabularHidden)
56
97
  {
57
- tmpInput.PictForm = {};
98
+ continue;
58
99
  }
59
- tmpInput.PictForm.InputIndex = k;
60
- tmpInput.PictForm.GroupIndex = pGroup.GroupIndex;
61
- tmpInput.PictForm.RowIndex = j;
62
-
63
- tmpTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView, `-TabularTemplate-HeaderCell`, `getTabularRecordInput("${pGroup.GroupIndex}","${k}")`);
64
100
 
65
- tmpTemplateSetRecordRowTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView, `-TabularTemplate-Cell-Prefix`, `getTabularRecordInput("${pGroup.GroupIndex}","${k}")`);
66
- let tmpInputType = (('PictForm' in tmpInput) && tmpInput.PictForm.InputType) ? tmpInput.PictForm.InputType : 'Default';
67
- tmpTemplateSetRecordRowTemplate += tmpMetatemplateGenerator.getTabularInputMetatemplateTemplateReference(pView, tmpInput.DataType, tmpInputType, `getTabularRecordInput("${pGroup.GroupIndex}","${k}")`, pGroup.GroupIndex, k);
68
- tmpTemplateSetRecordRowTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView, `-TabularTemplate-Cell-Postfix`, `getTabularRecordInput("${pGroup.GroupIndex}","${k}")`);
101
+ // tmpTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView, `-TabularTemplate-HeaderCell`, `getTabularRecordInput("${pGroup.GroupIndex}","${k}")`);
102
+ if (tmpInput.PictForm.RowIndex == d)
103
+ {
104
+ tmpTemplateSetRecordRowTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView, `-RecordSetTemplate-Cell-Prefix`, `getTabularRecordInput("${pGroup.GroupIndex}","${k}")`);
105
+ let tmpInputType = (('PictForm' in tmpInput) && tmpInput.PictForm.InputType) ? tmpInput.PictForm.InputType : 'Default';
106
+ tmpTemplateSetRecordRowTemplate += tmpMetatemplateGenerator.getTabularInputMetatemplateTemplateReference(pView, tmpInput.DataType, tmpInputType, `getTabularRecordInput("${pGroup.GroupIndex}","${k}")`, pGroup.GroupIndex, k);
107
+ tmpTemplateSetRecordRowTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView, `-RecordSetTemplate-Cell-Postfix`, `getTabularRecordInput("${pGroup.GroupIndex}","${k}")`);
108
+ }
69
109
  }
110
+ tmpTemplateSetRecordRowTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView, `-Template-Row-Postfix`, `getGroup("${pGroup.GroupIndex}")`);
70
111
  }
71
112
 
72
- tmpTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView, `-TabularTemplate-RowHeader-ExtraPostfix`, `getGroup("${pGroup.GroupIndex}")`);
73
- tmpTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView, `-TabularTemplate-RowHeader-Postfix`, `getGroup("${pGroup.GroupIndex}")`);
74
-
75
113
  // This is the template by which the tabular template includes the rows.
76
114
  // The template recursion here is difficult to envision without drawing it.
77
115
  // TODO: Consider making this function available in manyfest in some fashion it seems dope.
78
116
  let tmpTemplateSetVirtualRowTemplate = '';
79
- tmpTemplateSetVirtualRowTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView, `-TabularTemplate-Row-Prefix`, `getGroup("${pGroup.GroupIndex}")`);
80
- tmpTemplateSetVirtualRowTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReferenceRaw(pView, `-TabularTemplate-Row-ExtraPrefix`, `Record`);
117
+ tmpTemplateSetVirtualRowTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView, `-RecordSetTemplate-Row-Prefix`, `getGroup("${pGroup.GroupIndex}")`);
118
+ tmpTemplateSetVirtualRowTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReferenceRaw(pView, `-RecordSetTemplate-Row-ExtraPrefix`, `Record`);
81
119
  tmpTemplateSetVirtualRowTemplate += `\n\n{~T:${pGroup.SectionTabularRowTemplateHash}:Record~}\n`;
82
- tmpTemplateSetVirtualRowTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReferenceRaw(pView, `-TabularTemplate-Row-ExtraPostfix`, `Record`);
83
- tmpTemplateSetVirtualRowTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView, `-TabularTemplate-Row-Postfix`, `getGroup("${pGroup.GroupIndex}")`);
120
+ tmpTemplateSetVirtualRowTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReferenceRaw(pView, `-RecordSetTemplate-Row-ExtraPostfix`, `Record`);
121
+ tmpTemplateSetVirtualRowTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView, `-RecordSetTemplate-Row-Postfix`, `getGroup("${pGroup.GroupIndex}")`);
84
122
 
85
123
  // This is a custom template expression
86
124
  tmpTemplate += `\n\n{~MTVS:${pGroup.SectionTabularRowVirtualTemplateHash}:${pGroup.GroupIndex}:${pView.getMarshalDestinationAddress()}.${pGroup.RecordSetAddress}~}\n`;
87
125
 
88
- tmpTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView, `-TabularTemplate-Group-Postfix`, `getGroup("${pGroup.GroupIndex}")`);
126
+ tmpTemplate += tmpMetatemplateGenerator.getMetatemplateTemplateReference(pView, `-RecordSetTemplate-Group-Postfix`, `getGroup("${pGroup.GroupIndex}")`);
89
127
  // Add the TemplateSetTemplate
90
128
  this.pict.TemplateProvider.addTemplate(pGroup.SectionTabularRowVirtualTemplateHash, tmpTemplateSetVirtualRowTemplate);
91
129
  this.pict.TemplateProvider.addTemplate(pGroup.SectionTabularRowTemplateHash, tmpTemplateSetRecordRowTemplate);
@@ -1 +1 @@
1
- {"version":3,"file":"Pict-Provider-Input-TabSectionSelector.d.ts","sourceRoot":"","sources":["../../../../source/providers/inputs/Pict-Provider-Input-TabSectionSelector.js"],"names":[],"mappings":";AAEA;;;;;;GAMG;AACH;IAEC,2DAiBC;IAbA,6BAA6B;IAC7B,MADW,OAAO,MAAM,CAAC,CAChB;IACT,6BAA6B;IAC7B,OADW,OAAO,MAAM,CAAC,CACf;IAIV,qBAAqB;IACrB,cADW,MAAM,CAC4B;IAC7C,4BAAyD;IACzD,mBAAoH;IAKrH,2DAKC;IAED,+CAGC;IAED,0DAGC;IAED,qDAGC;IAED,iFA+CC;IAED;;;;OAIG;IACH,wCAHW,MAAM,GACJ,MAAM,CAKlB;CA0CD"}
1
+ {"version":3,"file":"Pict-Provider-Input-TabSectionSelector.d.ts","sourceRoot":"","sources":["../../../../source/providers/inputs/Pict-Provider-Input-TabSectionSelector.js"],"names":[],"mappings":";AAEA;;;;;;GAMG;AACH;IAEC,2DAiBC;IAbA,6BAA6B;IAC7B,MADW,OAAO,MAAM,CAAC,CAChB;IACT,6BAA6B;IAC7B,OADW,OAAO,MAAM,CAAC,CACf;IAIV,qBAAqB;IACrB,cADW,MAAM,CAC4B;IAC7C,4BAAyD;IACzD,mBAAoH;IAKrH,2DAKC;IAED,+CAGC;IAED,0DAGC;IAED,qDAIC;IAED,iFA+CC;IAED;;;;OAIG;IACH,wCAHW,MAAM,GACJ,MAAM,CAKlB;CA0CD"}
@@ -1 +1 @@
1
- {"version":3,"file":"Pict-Layout-Record.d.ts","sourceRoot":"","sources":["../../../../source/providers/layouts/Pict-Layout-Record.js"],"names":[],"mappings":";AAEA;IAEC,2DAUC;IANA,6BAA6B;IAC7B,MADW,OAAO,MAAM,CAAC,CAChB;IACT,6BAA6B;IAC7B,OADW,OAAO,MAAM,CAAC,CACf;CAiDX"}
1
+ {"version":3,"file":"Pict-Layout-Record.d.ts","sourceRoot":"","sources":["../../../../source/providers/layouts/Pict-Layout-Record.js"],"names":[],"mappings":";AAEA;IAEC,2DAUC;IANA,6BAA6B;IAC7B,MADW,OAAO,MAAM,CAAC,CAChB;IACT,6BAA6B;IAC7B,OADW,OAAO,MAAM,CAAC,CACf;CAgDX"}
@@ -1 +1 @@
1
- {"version":3,"file":"Pict-Layout-RecordSet.d.ts","sourceRoot":"","sources":["../../../../source/providers/layouts/Pict-Layout-RecordSet.js"],"names":[],"mappings":";AAEA;IAEC,2DAUC;IANA,6BAA6B;IAC7B,MADW,OAAO,MAAM,CAAC,CAChB;IACT,6BAA6B;IAC7B,OADW,OAAO,MAAM,CAAC,CACf;CAmFX"}
1
+ {"version":3,"file":"Pict-Layout-RecordSet.d.ts","sourceRoot":"","sources":["../../../../source/providers/layouts/Pict-Layout-RecordSet.js"],"names":[],"mappings":";AAEA;IAEC,2DAUC;IANA,6BAA6B;IAC7B,MADW,OAAO,MAAM,CAAC,CAChB;IACT,6BAA6B;IAC7B,OADW,OAAO,MAAM,CAAC,CACf;CAyHX"}