pict-section-form 1.0.132 → 1.0.133

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.
@@ -34,7 +34,7 @@
34
34
  </style>
35
35
  </head>
36
36
  <body>
37
- <button type="button" onclick="_Pict.views.PictFormMetacontroller.injectManifestsByHash(['DynamicSection1'], 'FruitGrid'); _Pict.views.PictFormMetacontroller.updateMetatemplateInDOM();">Add Dynamic Section</button>
37
+ <button type="button" onclick="_Pict.views.PictFormMetacontroller.injectManifestsByHash(['DynamicSection1'], 'FruitGrid');">Add Dynamic Section</button>
38
38
  <div id="Pict-Form-Container"></div>
39
39
  <script src="./complex_tabular_application.js" type="text/javascript"></script>
40
40
  </body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pict-section-form",
3
- "version": "1.0.132",
3
+ "version": "1.0.133",
4
4
  "description": "Pict dynamic form sections",
5
5
  "main": "source/Pict-Section-Form.js",
6
6
  "directories": {
@@ -36,7 +36,7 @@
36
36
  "pict-service-commandlineutility": "^1.0.15",
37
37
  "quackage": "^1.0.42",
38
38
  "tui-grid": "^4.21.22",
39
- "typescript": "^5.9.2"
39
+ "typescript": "^5.9.3"
40
40
  },
41
41
  "dependencies": {
42
42
  "fable-serviceproviderbase": "^3.0.15",
@@ -198,11 +198,38 @@ class PictFormMetacontroller extends libPictViewClass
198
198
  /**
199
199
  * @param {Record<string, any>} pManifest - The manifest to add
200
200
  * @param {string} [pAfterSectionHash] - The hash of the section to add after. Omit to add to the start.
201
+ * @param {string} [pUUID] - (optional) The UUID to use for uniqueness. If not provided, a new one will be generated.
202
+ *
203
+ * @return {Array<import('./Pict-View-DynamicForm.js')>} the views that correspond to the newly added sections
204
+ */
205
+ injectManifestAndRender(pManifest, pAfterSectionHash, pUUID)
206
+ {
207
+ const tmpManifest = pUUID ? this.createDistinctManifest(pManifest, pUUID) : pManifest;
208
+ const tmpViewsToRender = this.injectManifest(tmpManifest, pAfterSectionHash);
209
+ this.updateMetatemplateInDOM();
210
+ //FIXME: for some reason, DOM append is not synchronous, so we need to delay the render....................?
211
+ setTimeout(() =>
212
+ {
213
+ for (const tmpViewToRender of tmpViewsToRender)
214
+ {
215
+ tmpViewToRender.render();
216
+ }
217
+ }, 0);
218
+
219
+ return tmpViewsToRender;
220
+ }
221
+
222
+ /**
223
+ * @param {Record<string, any>} pManifest - The manifest to add
224
+ * @param {string} [pAfterSectionHash] - The hash of the section to add after. Omit to add to the start.
225
+ *
226
+ * @return {Array<import('./Pict-View-DynamicForm.js')>} the views that correspond to the newly added sections; note that these views are NOT rendered yet
201
227
  */
202
228
  injectManifest(pManifest, pAfterSectionHash)
203
229
  {
230
+ const tmpAfterSectionHash = pAfterSectionHash ? (pAfterSectionHash.startsWith('PictSectionForm-') ? pAfterSectionHash : `PictSectionForm-${pAfterSectionHash}`) : null;
204
231
  const tmpAllViewKeys = Object.keys(this.pict.views);
205
- const tmpReferenceManifestViewIndex = pAfterSectionHash ? tmpAllViewKeys.indexOf(`PictSectionForm-${pAfterSectionHash}`) : -1;
232
+ const tmpReferenceManifestViewIndex = tmpAfterSectionHash ? tmpAllViewKeys.indexOf(tmpAfterSectionHash) : -1;
206
233
  const tmpViewsToShift = [];
207
234
  if (tmpReferenceManifestViewIndex >= 0)
208
235
  {
@@ -214,22 +241,20 @@ class PictFormMetacontroller extends libPictViewClass
214
241
  delete this.pict.views[tmpKey];
215
242
  }
216
243
  }
217
- const tmpViewsToRender = this.bootstrapAdditiveManifest(pManifest, pAfterSectionHash);
244
+ const tmpViewsToRender = this.bootstrapAdditiveManifest(pManifest, tmpAfterSectionHash);
218
245
  for (const tmpViewToShift of tmpViewsToShift)
219
246
  {
220
247
  this.pict.views[tmpViewToShift.key] = tmpViewToShift.view;
221
248
  }
222
249
  // this ensures if we re-render everything, we have the new sections in the template
223
250
  this.generateMetatemplate();
224
- this.regenerateFormSectionTemplates();
225
- //FIXME: for some reason, DOM append is not synchronous, so we need to delay the render....................?
226
- setTimeout(() =>
251
+ for (const tmpViewToRender of tmpViewsToRender)
227
252
  {
228
- for (const tmpViewToRender of tmpViewsToRender)
229
- {
230
- tmpViewToRender.render();
231
- }
232
- }, 0);
253
+ tmpViewToRender.rebuildCustomTemplate();
254
+ }
255
+ this.pict.CSSMap.injectCSS();
256
+
257
+ return tmpViewsToRender;
233
258
  }
234
259
 
235
260
  /**
@@ -287,15 +312,25 @@ class PictFormMetacontroller extends libPictViewClass
287
312
  */
288
313
  injectManifestsByHash(pManifestHashes, pAfterSectionHash, pUUID)
289
314
  {
315
+ let tmpViewsToRender = [];
290
316
  for (const tmpManifestHash of pManifestHashes)
291
317
  {
292
318
  const tmpManifest = this.findDynamicSectionManifestDefinition(tmpManifestHash);
293
319
  if (tmpManifest)
294
320
  {
295
321
  const tmpUniqueManifest = this.createDistinctManifest(tmpManifest, pUUID);
296
- this.injectManifest(tmpUniqueManifest, pAfterSectionHash);
322
+ const tmpViews = this.injectManifest(tmpUniqueManifest, pAfterSectionHash);
323
+ tmpViewsToRender = tmpViewsToRender.concat(tmpViews);
297
324
  }
298
325
  }
326
+ this.updateMetatemplateInDOM();
327
+ setTimeout(() =>
328
+ {
329
+ for (const tmpViewToRender of tmpViewsToRender)
330
+ {
331
+ tmpViewToRender.render();
332
+ }
333
+ }, 0);
299
334
  }
300
335
 
301
336
  /**
@@ -60,8 +60,18 @@ declare class PictFormMetacontroller extends libPictViewClass {
60
60
  /**
61
61
  * @param {Record<string, any>} pManifest - The manifest to add
62
62
  * @param {string} [pAfterSectionHash] - The hash of the section to add after. Omit to add to the start.
63
+ * @param {string} [pUUID] - (optional) The UUID to use for uniqueness. If not provided, a new one will be generated.
64
+ *
65
+ * @return {Array<import('./Pict-View-DynamicForm.js')>} the views that correspond to the newly added sections
66
+ */
67
+ injectManifestAndRender(pManifest: Record<string, any>, pAfterSectionHash?: string, pUUID?: string): Array<import("./Pict-View-DynamicForm.js")>;
68
+ /**
69
+ * @param {Record<string, any>} pManifest - The manifest to add
70
+ * @param {string} [pAfterSectionHash] - The hash of the section to add after. Omit to add to the start.
71
+ *
72
+ * @return {Array<import('./Pict-View-DynamicForm.js')>} the views that correspond to the newly added sections; note that these views are NOT rendered yet
63
73
  */
64
- injectManifest(pManifest: Record<string, any>, pAfterSectionHash?: string): void;
74
+ injectManifest(pManifest: Record<string, any>, pAfterSectionHash?: string): Array<import("./Pict-View-DynamicForm.js")>;
65
75
  /**
66
76
  * Changes:
67
77
  * * The hashes of each section+group to be globally unique.
@@ -1 +1 @@
1
- {"version":3,"file":"Pict-View-Form-Metacontroller.d.ts","sourceRoot":"","sources":["../../../source/views/Pict-View-Form-Metacontroller.js"],"names":[],"mappings":";AAaA;;GAEG;AAEH;;;;;;GAMG;AACH;IAEC,2DAsBC;IAdA,yBAA2B;IAE3B,wBAAsF;IAEtF,cAAkC;IAElC;;;;;;MAOE;IAQH,wCAGC;IARD,kCAGC;IAOD;;;;OAIG;IACH,qBAFa,GAAG,CAaf;IAED;;;;OAIG;IACH,mBAFa,GAAG,CAaf;IAED,yCAYC;IAED;;;;;OAKG;IACH,kCAHW,aAAa,GACX,IAAI,CAsBhB;IAwBD;;;;OAIG;IACH,WAFa,GAAG,CAMf;IAED,gDAGC;IAED,+CAGC;IAED;;;;OAIG;IACH,2DAJW,MAAM,GAEL,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAW9B;IAED;;;OAGG;IACH,0BAHW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,sBACnB,MAAM,QAiChB;IAED;;;;;;;;;OASG;IACH,kCALW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,UACnB,MAAM,GAEL,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAsC9B;IAED;;;;OAIG;IACH,uCAJW,KAAK,CAAC,MAAM,CAAC,sBACb,MAAM,UACN,MAAM,QAahB;IAED;;;OAGG;IACH,6CAHW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,sBACnB,MAAM,SAehB;IAED;;;;;;;;OAQG;IACH,wDAHW,YAAY,SAoHtB;IAED;;;;;;;OAOG;IACH,4CAHW,MAAM,GACJ,IAAI,CAShB;IAED;;;;OAIG;IACH,6BAFa,IAAI,CAQhB;IAED;;;;;;;OAOG;IACH,+DAFW,YAAY,QAatB;IAED;;;;;;;OAOG;IACH,gEAFW,YAAY,QAatB;IAED;;;;;OAKG;IACH,8EAFW,YAAY,QAmBtB;IAED;;;;;;OAMG;IACH,oEAHW,YAAY,GACV,IAAI,CAkDhB;IAED;;;;;;;OAOG;IACH,uEAJW,YAAY,GAEX,IAAI,CAsFf;IAED;;;;;OAKG;IACH,qCAHW,MAAM,GACJ,MAAM,GAAC,OAAO,CA2C1B;IAED,+CAeC;IAED;;;;;;;OAOG;IACH,kFAJW,MAAM,GAEJ,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAoLtC;IA5JC,gCAA0D;IAC1D,yBAAiD;IA6JnD;;;;OAIG;IACH,gCAHW,MAAM,qBACN,MAAM,QA0BhB;IAED;;;OAGG;IACH,yDAHW,MAAM,uBACN,MAAM,QAKhB;IAED;;;;;OAKG;IACH,yDALW,MAAM,uBACN,MAAM,GAEL,OAAO,CAoDlB;IAED;;;;OAIG;IACH,sCAJW,MAAM,GAEL,OAAO,CA0ClB;IAED;;;OAGG;IACH,wDAHW,MAAM,6BAuBhB;IAED,oCAgBC;IAED;;;;OAIG;IACH,4BAFa,OAAO,CAKnB;CACD;;;;;qCAGU,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;oBA5mCjB,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,KAAK,MAAM"}
1
+ {"version":3,"file":"Pict-View-Form-Metacontroller.d.ts","sourceRoot":"","sources":["../../../source/views/Pict-View-Form-Metacontroller.js"],"names":[],"mappings":";AAaA;;GAEG;AAEH;;;;;;GAMG;AACH;IAEC,2DAsBC;IAdA,yBAA2B;IAE3B,wBAAsF;IAEtF,cAAkC;IAElC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