pict-section-dataimport 1.0.0 → 1.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pict-section-dataimport",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Embeddable, configurable data-import wizard for Pict apps — upload a CSV/TSV/Excel/fixed-width file, validate + detect its schema, map columns to a Meadow (or host-config) entity schema, generate comprehensions, and push them (records via the browser EntityProvider, or one POST to a Comprehension endpoint). Composes pict-section-upload + pict-section-accordion + pict-section-form, reusing meadow-integration's browser-safe transform/push engine.",
5
5
  "main": "source/Pict-Section-DataImport.js",
6
6
  "files": [
@@ -205,7 +205,13 @@ class PictViewDataImportWizard extends libPictView
205
205
  onAfterRender(pRenderable)
206
206
  {
207
207
  if (this.pict.CSSMap && typeof this.pict.CSSMap.injectCSS === 'function') { this.pict.CSSMap.injectCSS(); }
208
- if (!this._wired)
208
+ // Build the accordion + step bodies on first render, and REBUILD whenever a host re-render has wiped
209
+ // our mount. When the wizard is embedded in a routed host that repaints its container (on navigation,
210
+ // or after a push), the DI-Root template recreates an EMPTY `#DI_Acc_<WizardHash>` while `_wired` stays
211
+ // true — which would otherwise leave a bare accordion shell. createAccordion / createUploader are keyed
212
+ // by hash (reconfigure-or-create) and the accordion keeps its serializable nav state, so the rebuild
213
+ // restores the current step + the host's step bodies without losing progress.
214
+ if (!this._wired || !this._accordionMounted())
209
215
  {
210
216
  this._wired = true;
211
217
  this._buildWizard();
@@ -213,7 +219,21 @@ class PictViewDataImportWizard extends libPictView
213
219
  return super.onAfterRender(pRenderable);
214
220
  }
215
221
 
216
- /** One-time: create the accordion + upload view, render all step bodies. */
222
+ /**
223
+ * Is the accordion currently rendered into its mount, or has a host re-render wiped it? The DI-Root
224
+ * template recreates an empty `#DI_Acc_<WizardHash>` on every paint, so an empty mount means the
225
+ * accordion (and its step bodies) need (re)building.
226
+ * @return {boolean}
227
+ */
228
+ _accordionMounted()
229
+ {
230
+ // No DOM to inspect (server-side render) — defer to the `_wired` one-time gate.
231
+ if (typeof document === 'undefined') { return true; }
232
+ const tmpElement = document.getElementById(`DI_Acc_${this.options.WizardHash}`);
233
+ return !!(tmpElement && tmpElement.children && (tmpElement.children.length > 0));
234
+ }
235
+
236
+ /** Create the accordion + upload view and render all step bodies; safe to re-run (idempotent rebuild). */
217
237
  _buildWizard()
218
238
  {
219
239
  const tmpAccordionProvider = this.pict.providers['Pict-Section-Accordion'];