pict-section-form 1.0.152 → 1.0.154

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.
@@ -8,6 +8,12 @@ class ComplexTabularApplication extends libPictSectionForm.PictFormApplication
8
8
  {
9
9
  super(pFable, pOptions, pServiceHash);
10
10
 
11
+ if (!this.pict.AppData.UI)
12
+ {
13
+ this.pict.AppData.UI = {};
14
+ }
15
+ // test defaulting to alternate tab
16
+ this.pict.AppData.UI.StatisticsTabState = "FruitStatistics";
11
17
  this.pict.addProvider('CustomDataProvider', libCustomDataProvider.default_configuration, libCustomDataProvider);
12
18
  }
13
19
  }
@@ -475,7 +481,7 @@ module.exports.default_configuration.pict_configuration = {
475
481
  // The default when there is no state is the first entry here.
476
482
  // If you want to set a default, you can just do it in the state address though.
477
483
  TabGroupSet: ["Statistics", "FruitStatistics"],
478
- TabGroupNames: ["Statistics", "Fruit Statistics"]
484
+ TabGroupNames: ["Statistics", "Fruit Statistics"],
479
485
  }
480
486
  },
481
487
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pict-section-form",
3
- "version": "1.0.152",
3
+ "version": "1.0.154",
4
4
  "description": "Pict dynamic form sections",
5
5
  "main": "source/Pict-Section-Form.js",
6
6
  "directories": {
@@ -30,11 +30,11 @@
30
30
  "author": "steven velozo <steven@velozo.com>",
31
31
  "license": "MIT",
32
32
  "devDependencies": {
33
- "@eslint/js": "^9.38.0",
33
+ "@eslint/js": "^9.39.1",
34
34
  "browser-env": "^3.3.0",
35
- "eslint": "^9.38.0",
35
+ "eslint": "^9.39.1",
36
36
  "jquery": "^3.7.1",
37
- "pict": "^1.0.325",
37
+ "pict": "^1.0.334",
38
38
  "pict-application": "^1.0.29",
39
39
  "pict-service-commandlineutility": "^1.0.16",
40
40
  "quackage": "^1.0.45",
@@ -28,24 +28,50 @@ class CustomInputHandler extends libPictSectionInputExtension
28
28
  this.setCSSSnippets();
29
29
  }
30
30
 
31
+ /**
32
+ * @param {string} [pCSSHideClass]
33
+ * @param {string} [pCSSSnippet]
34
+ */
31
35
  setCSSSnippets(pCSSHideClass, pCSSSnippet)
32
36
  {
33
37
  this.cssHideClass = pCSSHideClass || this.cssHideClass;
34
38
  this.cssSnippet = pCSSSnippet || this.cssSnippet;
39
+
35
40
  this.pict.CSSMap.addCSS('Pict-Section-Form-Input-Group-TabSelector', this.cssSnippet, 1001, 'Pict-Input-TabSelector');
36
41
  this.pict.CSSMap.injectCSS();
37
42
  }
38
43
 
44
+ /**
45
+ * @param {Object} pView - The view object.
46
+ * @param {Object} pInput - The input object.
47
+ * @param {string} pGroupHash - The group hash.
48
+ *
49
+ * @return {string}
50
+ */
39
51
  getTabSelector(pView, pInput, pGroupHash)
40
52
  {
41
53
  return `#TAB-${pGroupHash}-${pInput.Macro.RawHTMLID}`;
42
54
  }
43
55
 
56
+
57
+ /**
58
+ * @param {Object} pView - The view object.
59
+ * @param {string} pGroupHash - The group hash.
60
+ *
61
+ * @return {string}
62
+ */
44
63
  getGroupSelector(pView, pGroupHash)
45
64
  {
46
65
  return `#GROUP-${pView.formID}-${pGroupHash}`;
47
66
  }
48
67
 
68
+ /**
69
+ * @param {string} pViewHash
70
+ * @param {string} pInputHash
71
+ * @param {string} pTabHash
72
+ *
73
+ * @return {boolean}
74
+ */
49
75
  selectTabByViewHash(pViewHash, pInputHash, pTabHash)
50
76
  {
51
77
  // First get the view
@@ -86,6 +112,7 @@ class CustomInputHandler extends libPictSectionInputExtension
86
112
  this.pict.ContentAssignment.addClass(this.getTabSelector(tmpView, tmpInput, tmpTabGroupHash), this.cssSelectedTabClass);
87
113
  }
88
114
  }
115
+ tmpView.setDataByInput(tmpInput, pTabHash);
89
116
  return true;
90
117
  }
91
118
 
@@ -135,7 +162,8 @@ class CustomInputHandler extends libPictSectionInputExtension
135
162
  this.pict.ContentAssignment.projectContent('replace', this.getTabSelectorInputHTMLID(pInput.Macro.RawHTMLID), tmpTabGroupSetEntries, 'FixTheTypescriptTypes');
136
163
 
137
164
  // Now set the default tab (or first one)
138
- let tmpDefaultTabGroupHash = pInput.PictForm?.DefaultTabGroupHash || tmpTabSet[0];
165
+ const tmpDefaultTabGroupHash = (pInput.PictForm?.DefaultFromData !== false && pValue) || pInput.PictForm?.DefaultTabGroupHash || tmpTabSet[0];
166
+
139
167
  this.selectTabByViewHash(pView.Hash, pInput.Hash, tmpDefaultTabGroupHash);
140
168
 
141
169
  return super.onInputInitialize(pView, pGroup, pRow, pInput, pValue, pHTMLTabSelector, pTransactionGUID);
@@ -28,6 +28,10 @@ class CustomInputHandler extends libPictSectionInputExtension
28
28
  this.setCSSSnippets();
29
29
  }
30
30
 
31
+ /**
32
+ * @param {string} [pCSSHideClass]
33
+ * @param {string} [pCSSSnippet]
34
+ */
31
35
  setCSSSnippets(pCSSHideClass, pCSSSnippet)
32
36
  {
33
37
  this.cssHideClass = pCSSHideClass || this.cssHideClass;
@@ -35,22 +39,45 @@ class CustomInputHandler extends libPictSectionInputExtension
35
39
  this.pict.CSSMap.addCSS('Pict-Section-Form-Input-Section-TabSelector', this.cssSnippet, 1001, 'Pict-Input-TabSelector');
36
40
  }
37
41
 
42
+ /**
43
+ * @param {string} pManifestSectionHash
44
+ *
45
+ * @return {string}
46
+ */
38
47
  getViewHash(pManifestSectionHash)
39
48
  {
40
49
  return `PictSectionForm-${pManifestSectionHash}`;
41
50
  }
42
51
 
52
+ /**
53
+ * @param {string} pTabSectionHash
54
+ * @param {Object} pInput
55
+ *
56
+ * @return {string}
57
+ */
43
58
  getTabSelector(pTabSectionHash, pInput)
44
59
  {
45
60
  return `#TAB-${pTabSectionHash}-${pInput.Macro.RawHTMLID}`;
46
61
  }
47
62
 
63
+ /**
64
+ * @param {string} pTabViewSectionHash
65
+ *
66
+ * @return {string}
67
+ */
48
68
  getSectionSelector(pTabViewSectionHash)
49
69
  {
50
70
  const metaController = this.pict.views.PictFormMetacontroller;
51
71
  return `#Pict-${metaController ? metaController.UUID : this.UUID}-${pTabViewSectionHash}-Wrap`;
52
72
  }
53
73
 
74
+ /**
75
+ * @param {string} pViewHash
76
+ * @param {string} pInputHash
77
+ * @param {string} pTabViewHash
78
+ *
79
+ * @return {boolean}
80
+ */
54
81
  selectTabByViewHash(pViewHash, pInputHash, pTabViewHash)
55
82
  {
56
83
  // First get the view
@@ -97,13 +124,16 @@ class CustomInputHandler extends libPictSectionInputExtension
97
124
  this.pict.ContentAssignment.addClass(this.getTabSelector(tmpTabSectionHash, tmpInput), this.cssSelectedTabClass);
98
125
  }
99
126
  }
127
+ tmpView.setDataByInput(tmpInput, pTabViewHash);
100
128
  return true;
101
129
  }
102
130
 
103
131
  /**
104
132
  * Generates the HTML ID for a select input element.
133
+ *
105
134
  * @param {string} pInputHTMLID - The HTML ID of the input element.
106
- * @returns {string} - The generated HTML ID for the select input element.
135
+ *
136
+ * @return {string} - The generated HTML ID for the select input element.
107
137
  */
108
138
  getTabSelectorInputHTMLID(pInputHTMLID)
109
139
  {
@@ -146,7 +176,7 @@ class CustomInputHandler extends libPictSectionInputExtension
146
176
  this.pict.ContentAssignment.projectContent('replace', this.getTabSelectorInputHTMLID(pInput.Macro.RawHTMLID), tmpTabSectionSetEntries, 'FixTheTypescriptTypes');
147
177
 
148
178
  // Now set the default tab (or first one)
149
- let tmpDefaultTabSectionHash = pInput.PictForm?.DefaultTabSectionHash || tmpTabSet[0];
179
+ const tmpDefaultTabSectionHash = (pInput.PictForm?.DefaultFromData !== false && pValue) || pInput.PictForm?.DefaultTabSectionHash || tmpTabSet[0];
150
180
  this.selectTabByViewHash(pView.Hash, pInput.Hash, tmpDefaultTabSectionHash);
151
181
 
152
182
  return super.onInputInitialize(pView, pGroup, pRow, pInput, pValue, pHTMLTabSelector, pTransactionGUID);
@@ -795,7 +795,7 @@ class ManifestFactory extends libFableServiceProviderBase
795
795
  let tmpValue = tmpRecord[tmpKey];
796
796
 
797
797
  // Use the manifest to put it on the descriptor
798
- if (tmpValue && tmpValue.length > 0)
798
+ if (tmpValue)
799
799
  {
800
800
  tmpDescriptorManifest.setValueAtAddress(tmpDescriptor, tmpAddress, tmpValue);
801
801
  }
@@ -817,7 +817,7 @@ class ManifestFactory extends libFableServiceProviderBase
817
817
  let tmpValue = parseFloat(tmpRawValue);
818
818
 
819
819
  // Use the manifest to put it on the descriptor
820
- if (tmpValue && !isNaN(tmpValue))
820
+ if (!isNaN(tmpValue))
821
821
  {
822
822
  tmpDescriptorManifest.setValueAtAddress(tmpDescriptor, tmpAddress, tmpValue);
823
823
  this.log.trace(`Set Float Descriptor Extension [${tmpKey}] on descriptor [${tmpDescriptor.Hash}] to value [${tmpValue}]`);
@@ -840,7 +840,7 @@ class ManifestFactory extends libFableServiceProviderBase
840
840
  let tmpValue = parseInt(tmpRawValue);
841
841
 
842
842
  // Use the manifest to put it on the descriptor
843
- if (tmpValue && !isNaN(tmpValue))
843
+ if (!isNaN(tmpValue))
844
844
  {
845
845
  tmpDescriptorManifest.setValueAtAddress(tmpDescriptor, tmpAddress, tmpValue);
846
846
  }
@@ -875,6 +875,10 @@ class ManifestFactory extends libFableServiceProviderBase
875
875
  {
876
876
  tmpDescriptorManifest.setValueAtAddress(tmpDescriptor, tmpAddress, tmpValue);
877
877
  }
878
+ else
879
+ {
880
+ this.log.warn(`Could not parse Boolean value [${tmpRawValue}] for Descriptor Boolean Extension [${tmpKey}] on descriptor [${tmpDescriptor.Hash}]`);
881
+ }
878
882
  }
879
883
  catch (pError)
880
884
  {
@@ -291,7 +291,7 @@ class PictViewDynamicForm extends libPictViewClass
291
291
  this.pict.TransactionTracking.registerTransaction(tmpTransactionGUID);
292
292
  try
293
293
  {
294
- this.sectionManifest.setValueByHash(this.getMarshalDestinationObject(), pInput.Hash, pValue)
294
+ this.sectionManifest.setValueByHash(this.getMarshalDestinationObject(), pInput.Hash, pValue);
295
295
 
296
296
  // TODO: DRY TIME, excellent.
297
297
  let tmpValue = pValue;
@@ -16,10 +16,34 @@ declare class CustomInputHandler extends libPictSectionInputExtension {
16
16
  cssHideClass: string;
17
17
  cssSelectedTabClass: string;
18
18
  cssSnippet: string;
19
- setCSSSnippets(pCSSHideClass: any, pCSSSnippet: any): void;
20
- getTabSelector(pView: any, pInput: any, pGroupHash: any): string;
21
- getGroupSelector(pView: any, pGroupHash: any): string;
22
- selectTabByViewHash(pViewHash: any, pInputHash: any, pTabHash: any): boolean;
19
+ /**
20
+ * @param {string} [pCSSHideClass]
21
+ * @param {string} [pCSSSnippet]
22
+ */
23
+ setCSSSnippets(pCSSHideClass?: string, pCSSSnippet?: string): void;
24
+ /**
25
+ * @param {Object} pView - The view object.
26
+ * @param {Object} pInput - The input object.
27
+ * @param {string} pGroupHash - The group hash.
28
+ *
29
+ * @return {string}
30
+ */
31
+ getTabSelector(pView: any, pInput: any, pGroupHash: string): string;
32
+ /**
33
+ * @param {Object} pView - The view object.
34
+ * @param {string} pGroupHash - The group hash.
35
+ *
36
+ * @return {string}
37
+ */
38
+ getGroupSelector(pView: any, pGroupHash: string): string;
39
+ /**
40
+ * @param {string} pViewHash
41
+ * @param {string} pInputHash
42
+ * @param {string} pTabHash
43
+ *
44
+ * @return {boolean}
45
+ */
46
+ selectTabByViewHash(pViewHash: string, pInputHash: string, pTabHash: string): boolean;
23
47
  /**
24
48
  * Generates the HTML ID for a select input element.
25
49
  * @param {string} pInputHTMLID - The HTML ID of the input element.
@@ -1 +1 @@
1
- {"version":3,"file":"Pict-Provider-Input-TabGroupSelector.d.ts","sourceRoot":"","sources":["../../../../source/providers/inputs/Pict-Provider-Input-TabGroupSelector.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,CAC0B;IAC3C,4BAAuD;IACvD,mBAAgH;IAKjH,2DAMC;IAED,iEAGC;IAED,sDAGC;IAED,6EAyCC;IAED;;;;OAIG;IACH,wCAHW,MAAM,GACJ,MAAM,CAKlB;CA2CD"}
1
+ {"version":3,"file":"Pict-Provider-Input-TabGroupSelector.d.ts","sourceRoot":"","sources":["../../../../source/providers/inputs/Pict-Provider-Input-TabGroupSelector.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,CAC0B;IAC3C,4BAAuD;IACvD,mBAAgH;IAKjH;;;OAGG;IACH,+BAHW,MAAM,gBACN,MAAM,QAShB;IAED;;;;;;OAMG;IACH,oDAJW,MAAM,GAEL,MAAM,CAKjB;IAGD;;;;;OAKG;IACH,yCAJW,MAAM,GAEL,MAAM,CAKjB;IAED;;;;;;OAMG;IACH,+BANW,MAAM,cACN,MAAM,YACN,MAAM,GAEL,OAAO,CA4ClB;IAED;;;;OAIG;IACH,wCAHW,MAAM,GACJ,MAAM,CAKlB;CA4CD"}
@@ -16,15 +16,44 @@ declare class CustomInputHandler extends libPictSectionInputExtension {
16
16
  cssHideClass: string;
17
17
  cssSelectedTabClass: string;
18
18
  cssSnippet: string;
19
- setCSSSnippets(pCSSHideClass: any, pCSSSnippet: any): void;
20
- getViewHash(pManifestSectionHash: any): string;
21
- getTabSelector(pTabSectionHash: any, pInput: any): string;
22
- getSectionSelector(pTabViewSectionHash: any): string;
23
- selectTabByViewHash(pViewHash: any, pInputHash: any, pTabViewHash: any): boolean;
19
+ /**
20
+ * @param {string} [pCSSHideClass]
21
+ * @param {string} [pCSSSnippet]
22
+ */
23
+ setCSSSnippets(pCSSHideClass?: string, pCSSSnippet?: string): void;
24
+ /**
25
+ * @param {string} pManifestSectionHash
26
+ *
27
+ * @return {string}
28
+ */
29
+ getViewHash(pManifestSectionHash: string): string;
30
+ /**
31
+ * @param {string} pTabSectionHash
32
+ * @param {Object} pInput
33
+ *
34
+ * @return {string}
35
+ */
36
+ getTabSelector(pTabSectionHash: string, pInput: any): string;
37
+ /**
38
+ * @param {string} pTabViewSectionHash
39
+ *
40
+ * @return {string}
41
+ */
42
+ getSectionSelector(pTabViewSectionHash: string): string;
43
+ /**
44
+ * @param {string} pViewHash
45
+ * @param {string} pInputHash
46
+ * @param {string} pTabViewHash
47
+ *
48
+ * @return {boolean}
49
+ */
50
+ selectTabByViewHash(pViewHash: string, pInputHash: string, pTabViewHash: string): boolean;
24
51
  /**
25
52
  * Generates the HTML ID for a select input element.
53
+ *
26
54
  * @param {string} pInputHTMLID - The HTML ID of the input element.
27
- * @returns {string} - The generated HTML ID for the select input element.
55
+ *
56
+ * @return {string} - The generated HTML ID for the select input element.
28
57
  */
29
58
  getTabSelectorInputHTMLID(pInputHTMLID: string): string;
30
59
  }
@@ -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,qDAIC;IAED,iFA+CC;IAED;;;;OAIG;IACH,wCAHW,MAAM,GACJ,MAAM,CAKlB;CA2CD"}
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;;;OAGG;IACH,+BAHW,MAAM,gBACN,MAAM,QAOhB;IAED;;;;OAIG;IACH,kCAJW,MAAM,GAEL,MAAM,CAKjB;IAED;;;;;OAKG;IACH,gCALW,MAAM,gBAGL,MAAM,CAKjB;IAED;;;;OAIG;IACH,wCAJW,MAAM,GAEL,MAAM,CAMjB;IAED;;;;;;OAMG;IACH,+BANW,MAAM,cACN,MAAM,gBACN,MAAM,GAEL,OAAO,CAkDlB;IAED;;;;;;OAMG;IACH,wCAJW,MAAM,GAEL,MAAM,CAKjB;CA2CD"}
@@ -1 +1 @@
1
- {"version":3,"file":"ManifestFactory.d.ts","sourceRoot":"","sources":["../../../source/services/ManifestFactory.js"],"names":[],"mappings":";AAOA;IAEC,2DA4CC;IAtCA,sIAAsI;IACtI,OADW,OAAO,MAAM,CAAC,GAAG;QAAE,6CAA6C,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,GAAG,CAAA;KAAE,CACxH;IACV,kBAAkB;IAClB,KADW,GAAG,CACN;IACR,qBAAqB;IACrB,MADW,MAAM,CACR;IAET,cAAmC;IAcnC,+BAAoC;IAEpC,sBAA2B;IAC3B,oBAAyB;IASzB,2BAA2B;IAE3B,gCAAgD;IAChD,sCAAwC;IACxC,kCAA0C;IAG3C;;;;;OAKG;IACH,2BAHW,MAAM,GACL,MAAM,CASjB;IAED;;;;;;;;;OASG;IACH,uCAwJC;IAED;;;;OAIG;IACH,8CAOC;IAED;;;;;;OAMG;IACH,iCAJW,MAAM,OAiBhB;IAED;;;;;;;OAOG;IACH,mCALW,MAAM,MAAO,cACb,MAAM,OAkBhB;IAED;;;;OAIG;IACH,8BAFa,OAAO,CAenB;IAED,2FAyDC;IAED;;;;;;;OAOG;IACH,kEAkgBC;IAED;;;;;;;;;OASG;IACH,2GAGC;IAED;;;;;;OAMG;IACH,0CAJW,GAAG,GAEF,GAAG,CAwDd;CACD;;+BAGU,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC"}
1
+ {"version":3,"file":"ManifestFactory.d.ts","sourceRoot":"","sources":["../../../source/services/ManifestFactory.js"],"names":[],"mappings":";AAOA;IAEC,2DA4CC;IAtCA,sIAAsI;IACtI,OADW,OAAO,MAAM,CAAC,GAAG;QAAE,6CAA6C,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,GAAG,CAAA;KAAE,CACxH;IACV,kBAAkB;IAClB,KADW,GAAG,CACN;IACR,qBAAqB;IACrB,MADW,MAAM,CACR;IAET,cAAmC;IAcnC,+BAAoC;IAEpC,sBAA2B;IAC3B,oBAAyB;IASzB,2BAA2B;IAE3B,gCAAgD;IAChD,sCAAwC;IACxC,kCAA0C;IAG3C;;;;;OAKG;IACH,2BAHW,MAAM,GACL,MAAM,CASjB;IAED;;;;;;;;;OASG;IACH,uCAwJC;IAED;;;;OAIG;IACH,8CAOC;IAED;;;;;;OAMG;IACH,iCAJW,MAAM,OAiBhB;IAED;;;;;;;OAOG;IACH,mCALW,MAAM,MAAO,cACb,MAAM,OAkBhB;IAED;;;;OAIG;IACH,8BAFa,OAAO,CAenB;IAED,2FAyDC;IAED;;;;;;;OAOG;IACH,kEAsgBC;IAED;;;;;;;;;OASG;IACH,2GAGC;IAED;;;;;;OAMG;IACH,0CAJW,GAAG,GAEF,GAAG,CAwDd;CACD;;+BAGU,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC"}