labellife-design-tool 2.2.9 → 2.3.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.
@@ -2201,6 +2201,7 @@ var InputFieldsDialog = mobxReactLite.observer(function (_ref2) {
2201
2201
  setDisplayIndex = _useState8[1];
2202
2202
  var initialTotalRef = react.useRef(0);
2203
2203
  var completedHistoryRef = react.useRef([]);
2204
+ var removedDueToSkipRef = react.useRef([]);
2204
2205
  var isGoingBackRef = react.useRef(false);
2205
2206
  var prevBackTriggerRef = react.useRef(backTrigger);
2206
2207
  var config = getInputFieldsConfig();
@@ -2243,14 +2244,24 @@ var InputFieldsDialog = mobxReactLite.observer(function (_ref2) {
2243
2244
  var last = completedHistoryRef.current.pop();
2244
2245
  if (!last) return;
2245
2246
  var el = last.el,
2246
- previousValue = last.previousValue;
2247
+ previousValue = last.previousValue,
2248
+ removed = last.removed;
2247
2249
  if (el) {
2248
2250
  var isImage = el.custom && el.custom.inputType === 'image';
2249
- el.set(isImage ? {
2250
- src: previousValue || ''
2251
- } : {
2252
- text: previousValue || ''
2253
- });
2251
+ if (removed) {
2252
+ el.set({
2253
+ visible: true
2254
+ });
2255
+ removedDueToSkipRef.current = removedDueToSkipRef.current.filter(function (e) {
2256
+ return e.id !== el.id;
2257
+ });
2258
+ } else {
2259
+ el.set(isImage ? {
2260
+ src: previousValue || ''
2261
+ } : {
2262
+ text: previousValue || ''
2263
+ });
2264
+ }
2254
2265
  isGoingBackRef.current = true;
2255
2266
  store._unresolveInputField(el);
2256
2267
  }
@@ -2268,6 +2279,15 @@ var InputFieldsDialog = mobxReactLite.observer(function (_ref2) {
2268
2279
  var currentField = fields[0];
2269
2280
  if (!currentField) return null;
2270
2281
 
2282
+ // ── Helper: clear the removed-elements tracking ref ──────────────────
2283
+ // Elements are kept in the canvas with visible:false — they don't render
2284
+ // on screen or in exports, and can be restored via back navigation at any
2285
+ // point (including back-from-summary via backTrigger) without touching
2286
+ // deleted MST nodes.
2287
+ var _flushRemovedElements = function _flushRemovedElements() {
2288
+ removedDueToSkipRef.current = [];
2289
+ };
2290
+
2271
2291
  // ── Shared submit / skip / back helpers ─────────────────────────────
2272
2292
  var handleSubmit = function handleSubmit(elementId, value) {
2273
2293
  var el = store.getElementById(elementId);
@@ -2291,6 +2311,7 @@ var InputFieldsDialog = mobxReactLite.observer(function (_ref2) {
2291
2311
  }
2292
2312
  store._resolveInputField(elementId);
2293
2313
  if (fields.length <= 1) {
2314
+ _flushRemovedElements();
2294
2315
  store.history.addUndoState();
2295
2316
  if (_onComplete) _onComplete();
2296
2317
  } else {
@@ -2303,13 +2324,24 @@ var InputFieldsDialog = mobxReactLite.observer(function (_ref2) {
2303
2324
  var el = store.getElementById(elementId);
2304
2325
  var isImage = el && el.custom && el.custom.inputType === 'image';
2305
2326
  var previousValue = el ? isImage ? el.src : el.text : '';
2327
+ var shouldRemove = !!(el && el.custom && el.custom.removeIfSkipped);
2328
+ if (shouldRemove) {
2329
+ el.set({
2330
+ visible: false
2331
+ });
2332
+ removedDueToSkipRef.current.push(el);
2333
+ }
2306
2334
  completedHistoryRef.current.push({
2307
2335
  el: el,
2308
2336
  previousValue: previousValue,
2309
- skipped: true
2337
+ skipped: true,
2338
+ removed: shouldRemove
2310
2339
  });
2311
2340
  store._resolveInputField(elementId);
2312
2341
  if (fields.length <= 1) {
2342
+ var hadRemovals = removedDueToSkipRef.current.length > 0;
2343
+ _flushRemovedElements();
2344
+ if (hadRemovals) store.history.addUndoState();
2313
2345
  if (_onComplete) _onComplete();
2314
2346
  } else {
2315
2347
  setDisplayIndex(function (prev) {
@@ -2321,14 +2353,24 @@ var InputFieldsDialog = mobxReactLite.observer(function (_ref2) {
2321
2353
  var last = completedHistoryRef.current.pop();
2322
2354
  if (!last) return;
2323
2355
  var el = last.el,
2324
- previousValue = last.previousValue;
2356
+ previousValue = last.previousValue,
2357
+ removed = last.removed;
2325
2358
  if (el) {
2326
2359
  var isImage = el.custom && el.custom.inputType === 'image';
2327
- el.set(isImage ? {
2328
- src: previousValue || ''
2329
- } : {
2330
- text: previousValue || ''
2331
- });
2360
+ if (removed) {
2361
+ el.set({
2362
+ visible: true
2363
+ });
2364
+ removedDueToSkipRef.current = removedDueToSkipRef.current.filter(function (e) {
2365
+ return e.id !== el.id;
2366
+ });
2367
+ } else {
2368
+ el.set(isImage ? {
2369
+ src: previousValue || ''
2370
+ } : {
2371
+ text: previousValue || ''
2372
+ });
2373
+ }
2332
2374
  store._unresolveInputField(el);
2333
2375
  }
2334
2376
  setDisplayIndex(function (prev) {
@@ -2362,6 +2404,7 @@ var InputFieldsDialog = mobxReactLite.observer(function (_ref2) {
2362
2404
  onBack: handleBack,
2363
2405
  canGoBack: canGoBack,
2364
2406
  onComplete: function onComplete() {
2407
+ _flushRemovedElements();
2365
2408
  store.history.addUndoState();
2366
2409
  if (_onComplete) _onComplete();
2367
2410
  }