@crystaldesign/diva-backoffice 26.12.0-beta.10 → 26.12.0-beta.12

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.
Files changed (47) hide show
  1. package/build/esm/index.js +1253 -822
  2. package/build/types/backoffice/src/layout/Toolbar/Tools/DivaAgent/backofficeToolset.d.ts.map +1 -1
  3. package/build/types/backoffice/src/layout/Toolbar/Tools/DivaAgent/navigationToolset.d.ts.map +1 -1
  4. package/build/types/backoffice/src/store/GridRegistry.d.ts +21 -1
  5. package/build/types/backoffice/src/store/GridRegistry.d.ts.map +1 -1
  6. package/build/types/backoffice/src/tests/unit/layout/Toolbar/Tools/DivaAgent/addRowsReceipt.test.d.ts +2 -0
  7. package/build/types/backoffice/src/tests/unit/layout/Toolbar/Tools/DivaAgent/addRowsReceipt.test.d.ts.map +1 -0
  8. package/build/types/backoffice/src/tests/unit/layout/Toolbar/Tools/DivaAgent/fakeGridEnvironment.d.ts +9 -3
  9. package/build/types/backoffice/src/tests/unit/layout/Toolbar/Tools/DivaAgent/fakeGridEnvironment.d.ts.map +1 -1
  10. package/build/types/backoffice/src/tests/unit/layout/Toolbar/Tools/DivaAgent/partlistposActions.test.d.ts +2 -0
  11. package/build/types/backoffice/src/tests/unit/layout/Toolbar/Tools/DivaAgent/partlistposActions.test.d.ts.map +1 -0
  12. package/build/types/backoffice/src/tests/unit/layout/Toolbar/Tools/DivaAgent/recordIdAsRowId.test.d.ts +2 -0
  13. package/build/types/backoffice/src/tests/unit/layout/Toolbar/Tools/DivaAgent/recordIdAsRowId.test.d.ts.map +1 -0
  14. package/build/types/backoffice/src/tests/unit/layout/Toolbar/Tools/DivaAgent/subtableParentBinding.test.d.ts +2 -0
  15. package/build/types/backoffice/src/tests/unit/layout/Toolbar/Tools/DivaAgent/subtableParentBinding.test.d.ts.map +1 -0
  16. package/build/types/backoffice/src/ui/CommonComponents/SpreadsheetWrapper/index.d.ts +3 -1
  17. package/build/types/backoffice/src/ui/CommonComponents/SpreadsheetWrapper/index.d.ts.map +1 -1
  18. package/build/types/backoffice/src/ui/IDMCatalogEditor/Tables/CatalogVersions.d.ts +3 -0
  19. package/build/types/backoffice/src/ui/IDMCatalogEditor/Tables/CatalogVersions.d.ts.map +1 -1
  20. package/build/types/backoffice/src/ui/IDMCatalogEditor/Tables/FeaturesWithFeatureClass.d.ts +3 -0
  21. package/build/types/backoffice/src/ui/IDMCatalogEditor/Tables/FeaturesWithFeatureClass.d.ts.map +1 -1
  22. package/build/types/backoffice/src/ui/IDMCatalogEditor/Tables/Items.d.ts +3 -0
  23. package/build/types/backoffice/src/ui/IDMCatalogEditor/Tables/Items.d.ts.map +1 -1
  24. package/build/types/backoffice/src/ui/IDMCatalogEditor/Tables/OptionCombinations/index.d.ts +4 -1
  25. package/build/types/backoffice/src/ui/IDMCatalogEditor/Tables/OptionCombinations/index.d.ts.map +1 -1
  26. package/build/types/backoffice/src/ui/IDMCatalogEditor/Tables/OptionGroupOptions.d.ts +4 -1
  27. package/build/types/backoffice/src/ui/IDMCatalogEditor/Tables/OptionGroupOptions.d.ts.map +1 -1
  28. package/build/types/backoffice/src/ui/IDMCatalogEditor/Tables/PartlistPos.d.ts +4 -1
  29. package/build/types/backoffice/src/ui/IDMCatalogEditor/Tables/PartlistPos.d.ts.map +1 -1
  30. package/build/types/backoffice/src/ui/IDMCatalogEditor/Tables/PriceFeatureGroupFinishes.d.ts +4 -1
  31. package/build/types/backoffice/src/ui/IDMCatalogEditor/Tables/PriceFeatureGroupFinishes.d.ts.map +1 -1
  32. package/build/types/backoffice/src/ui/IDMCatalogEditor/Tables/PriceFeatureGroupPercentageSurcharge.d.ts +4 -1
  33. package/build/types/backoffice/src/ui/IDMCatalogEditor/Tables/PriceFeatureGroupPercentageSurcharge.d.ts.map +1 -1
  34. package/build/types/backoffice/src/ui/IDMCatalogEditor/modules/TableCatalogs/index.d.ts.map +1 -1
  35. package/build/types/backoffice/src/ui/IDMCatalogEditor/modules/TableDecisions/index.d.ts.map +1 -1
  36. package/build/types/backoffice/src/ui/IDMCatalogEditor/modules/TableFeatureClasses/index.d.ts.map +1 -1
  37. package/build/types/backoffice/src/ui/IDMCatalogEditor/modules/TableOptionGroups/index.d.ts.map +1 -1
  38. package/build/types/backoffice/src/ui/IDMCatalogEditor/modules/TablePartlists/index.d.ts.map +1 -1
  39. package/build/types/backoffice/src/ui/IDMCatalogEditor/modules/TablePriceFeatureGroups/index.d.ts.map +1 -1
  40. package/build/types/backoffice/src/ui/IDMCatalogEditor/modules/TableSeries/index.d.ts.map +1 -1
  41. package/build/types/backoffice/src/ui/IDMCollectionEditor/Tables/CollectionMembers.d.ts +4 -1
  42. package/build/types/backoffice/src/ui/IDMCollectionEditor/Tables/CollectionMembers.d.ts.map +1 -1
  43. package/build/types/backoffice/src/ui/IDMCollectionEditor/modules/TableCollections/index.d.ts.map +1 -1
  44. package/build/types/backoffice/src/ui/IDMEnricherEditor/Tables/Prices/index.d.ts +4 -1
  45. package/build/types/backoffice/src/ui/IDMEnricherEditor/Tables/Prices/index.d.ts.map +1 -1
  46. package/build/types/backoffice/src/ui/IDMEnricherEditor/modules/TablePriceList/index.d.ts.map +1 -1
  47. package/package.json +10 -10
@@ -18203,6 +18203,12 @@ function _objectSpread$21(e) { for (var r = 1; r < arguments.length; r++) { var
18203
18203
  * It is also the headless twin of a dialog - the modal a human fills is one way to produce `input`, not the only one.
18204
18204
  */
18205
18205
 
18206
+ /**
18207
+ * The parent row a SUBTABLE is bound to - the row its endpoint is scoped by - as the module that opens the subtable
18208
+ * declares it. A stageTableEdits without parentRow lands under exactly this row and is refused while there is none;
18209
+ * a parentRow call waits until it reports the row that call selected.
18210
+ */
18211
+
18206
18212
  /**
18207
18213
  * A live table as the agent sees it: registered by the SpreadsheetWrapper on mount (re-registered when its label or
18208
18214
  * description changes), removed on unmount. The callbacks read the current handle and actions at call time, so a
@@ -18239,7 +18245,7 @@ var GridRegistry = /*#__PURE__*/function () {
18239
18245
  });
18240
18246
  }
18241
18247
 
18242
- /** Grids currently mounted, in mount order (main table first, subtables after). */
18248
+ /** Grids currently mounted, in mount order. */
18243
18249
  }, {
18244
18250
  key: "entries",
18245
18251
  get: function get() {
@@ -35986,7 +35992,7 @@ var discardButton = "discard-button-oUFPg";
35986
35992
  var css_248z$K = ".container-fszxW {\n display: contents;\n}\n\n.approval-bar-nVCIH {\n position: sticky;\n top: 0;\n z-index: 20;\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 8px 14px;\n background: #fffbea;\n color: #744210;\n border: 1px solid #d69e2e;\n border-radius: 6px;\n margin: 0 0 6px 0;\n font-size: 13px;\n}\n\n.darkmode .approval-bar-nVCIH {\n background: #3b3416;\n color: #fbd38d;\n border-color: #b7791f;\n}\n\n.label-BDsm4 {\n font-weight: 600;\n}\n\n.apply-button-OCoIX {\n background: #2f855a;\n color: #fff;\n border: none;\n border-radius: 5px;\n padding: 5px 16px;\n font-weight: 600;\n cursor: pointer;\n}\n\n.discard-button-oUFPg {\n background: transparent;\n border: 1px solid #a0aec0;\n border-radius: 5px;\n padding: 5px 16px;\n font-weight: 600;\n cursor: pointer;\n color: inherit;\n}\n";
35987
35993
  styleInject(css_248z$K);
35988
35994
 
35989
- var _excluded$9 = ["toolbarToolId"];
35995
+ var _excluded$9 = ["toolbarToolId", "agentBoundParent"];
35990
35996
  function ownKeys$1j(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
35991
35997
  function _objectSpread$1j(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1j(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1j(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
35992
35998
  /**
@@ -35999,6 +36005,7 @@ function _objectSpread$1j(e) { for (var r = 1; r < arguments.length; r++) { var
35999
36005
  var SpreadsheetWrapper = /*#__PURE__*/forwardRef(function SpreadsheetWrapper(_ref, ref) {
36000
36006
  var _props$configuration$, _props$configuration, _props$configuration$2, _read$list, _ref2, _props$configuration$3, _props$configuration2, _props$configuration3, _root$contentStore$bo, _root$contentStore$ri;
36001
36007
  var toolbarToolId = _ref.toolbarToolId,
36008
+ agentBoundParent = _ref.agentBoundParent,
36002
36009
  props = _objectWithoutProperties(_ref, _excluded$9);
36003
36010
  var root = useStore();
36004
36011
  var _useTranslation = useTranslation(),
@@ -36009,6 +36016,10 @@ var SpreadsheetWrapper = /*#__PURE__*/forwardRef(function SpreadsheetWrapper(_re
36009
36016
  // re-register the grid on every render.
36010
36017
  var actionsRef = useRef([]);
36011
36018
  actionsRef.current = (_props$configuration$ = (_props$configuration = props.configuration) === null || _props$configuration === void 0 ? void 0 : _props$configuration.agentActions) !== null && _props$configuration$ !== void 0 ? _props$configuration$ : [];
36019
+ // Same for the bound parent: it follows the parent selection, only being a subtable at all is registered.
36020
+ var boundParentRef = useRef(agentBoundParent);
36021
+ boundParentRef.current = agentBoundParent;
36022
+ var isSubtable = agentBoundParent !== undefined;
36012
36023
  var _useState = useState(null),
36013
36024
  _useState2 = _slicedToArray(_useState, 2),
36014
36025
  agentApproval = _useState2[0],
@@ -36031,7 +36042,7 @@ var SpreadsheetWrapper = /*#__PURE__*/forwardRef(function SpreadsheetWrapper(_re
36031
36042
  var gridLabel = (_ref2 = (_props$configuration$3 = (_props$configuration2 = props.configuration) === null || _props$configuration2 === void 0 ? void 0 : _props$configuration2.agentGridId) !== null && _props$configuration$3 !== void 0 ? _props$configuration$3 : String(readUrl).split('?')[0].split('/').filter(Boolean).pop()) !== null && _ref2 !== void 0 ? _ref2 : 'table';
36032
36043
  var gridDescription = (_props$configuration3 = props.configuration) === null || _props$configuration3 === void 0 ? void 0 : _props$configuration3.agentDescription;
36033
36044
  useEffect(function () {
36034
- var id = root.gridRegistry.register({
36045
+ var id = root.gridRegistry.register(_objectSpread$1j(_objectSpread$1j({
36035
36046
  label: gridLabel,
36036
36047
  gridId: props.gridId,
36037
36048
  readUrl: String(readUrl),
@@ -36042,7 +36053,12 @@ var SpreadsheetWrapper = /*#__PURE__*/forwardRef(function SpreadsheetWrapper(_re
36042
36053
  },
36043
36054
  getActions: function getActions() {
36044
36055
  return actionsRef.current;
36045
- },
36056
+ }
36057
+ }, isSubtable ? {
36058
+ getBoundParent: function getBoundParent() {
36059
+ return boundParentRef.current;
36060
+ }
36061
+ } : {}), {}, {
36046
36062
  requestAgentApproval: function requestAgentApproval(changeCount, actionLabel, signal) {
36047
36063
  return new Promise(function (resolve) {
36048
36064
  var _agentApprovalRef$cur;
@@ -36079,14 +36095,14 @@ var SpreadsheetWrapper = /*#__PURE__*/forwardRef(function SpreadsheetWrapper(_re
36079
36095
  setAgentApproval(entry);
36080
36096
  });
36081
36097
  }
36082
- });
36098
+ }));
36083
36099
  return function () {
36084
36100
  var _agentApprovalRef$cur2;
36085
36101
  root.gridRegistry.unregister(id);
36086
36102
  // Unmounting with an open approval = deny, so the waiting tool never hangs.
36087
36103
  (_agentApprovalRef$cur2 = agentApprovalRef.current) === null || _agentApprovalRef$cur2 === void 0 || _agentApprovalRef$cur2.resolve(false);
36088
36104
  };
36089
- }, [root, gridLabel, gridDescription, toolbarToolId]);
36105
+ }, [root, gridLabel, gridDescription, toolbarToolId, isSubtable]);
36090
36106
 
36091
36107
  //if the spreadsheet is inside a toolbar, we need to prevent it form referencing it self
36092
36108
  var refSecondaryGrids = [(_root$contentStore$bo = root.contentStore.bottomToolBar.toolbarElement) !== null && _root$contentStore$bo !== void 0 ? _root$contentStore$bo : undefined, (_root$contentStore$ri = root.contentStore.rightToolBar.toolbarElement) !== null && _root$contentStore$ri !== void 0 ? _root$contentStore$ri : undefined].filter(function (element) {
@@ -43098,14 +43114,15 @@ function ActionMenu(_ref) {
43098
43114
  * pricelists module rather than taking one of its own. Export runs through the enricher's own api2
43099
43115
  * endpoint instead of the grid's excel export, because the served file is a report, not the grid content.
43100
43116
  */
43101
- var Prices = observer(function (_ref) {
43117
+ var Prices = observer(function (props) {
43102
43118
  var _pricelist$seriePrice;
43103
- var organizationId = _ref.organizationId,
43104
- selectedPackage = _ref.selectedPackage,
43105
- apiConfig = _ref.apiConfig,
43106
- pricelist = _ref.pricelist,
43107
- setNodeDataValue = _ref.setNodeDataValue,
43108
- viewOnly = _ref.viewOnly;
43119
+ var organizationId = props.organizationId,
43120
+ selectedPackage = props.selectedPackage,
43121
+ apiConfig = props.apiConfig,
43122
+ pricelist = props.pricelist,
43123
+ setNodeDataValue = props.setNodeDataValue,
43124
+ viewOnly = props.viewOnly,
43125
+ agentBoundParent = props.agentBoundParent;
43109
43126
  var _useTranslation = useTranslation(),
43110
43127
  t = _useTranslation.t;
43111
43128
  var root = useStore();
@@ -43245,9 +43262,9 @@ var Prices = observer(function (_ref) {
43245
43262
  field: 'itemFactor',
43246
43263
  cellDataType: 'number',
43247
43264
  cellRenderer: PriceFactorCellRenderer,
43248
- valueGetter: function valueGetter(_ref3) {
43265
+ valueGetter: function valueGetter(_ref2) {
43249
43266
  var _pricelist$articlePri;
43250
- var data = _ref3.data;
43267
+ var data = _ref2.data;
43251
43268
  if (!data) return;
43252
43269
  return (_pricelist$articlePri = pricelist.articlePricefactors) === null || _pricelist$articlePri === void 0 || (_pricelist$articlePri = _pricelist$articlePri[selectedSerie === null || selectedSerie === void 0 ? void 0 : selectedSerie.serieNo]) === null || _pricelist$articlePri === void 0 ? void 0 : _pricelist$articlePri[data.typeNo];
43253
43270
  },
@@ -43287,9 +43304,9 @@ var Prices = observer(function (_ref) {
43287
43304
  field: 'typeKeyPricefactors',
43288
43305
  cellDataType: 'number',
43289
43306
  cellRenderer: PriceFactorCellRenderer,
43290
- valueGetter: function valueGetter(_ref4) {
43307
+ valueGetter: function valueGetter(_ref3) {
43291
43308
  var _pricelist$typeKeyPri;
43292
- var data = _ref4.data;
43309
+ var data = _ref3.data;
43293
43310
  if (!data) return;
43294
43311
  return (_pricelist$typeKeyPri = pricelist.typeKeyPricefactors) === null || _pricelist$typeKeyPri === void 0 || (_pricelist$typeKeyPri = _pricelist$typeKeyPri[selectedSerie === null || selectedSerie === void 0 ? void 0 : selectedSerie.serieNo]) === null || _pricelist$typeKeyPri === void 0 ? void 0 : _pricelist$typeKeyPri[data.typeKey];
43295
43312
  },
@@ -43323,7 +43340,7 @@ var Prices = observer(function (_ref) {
43323
43340
  headerGroupComponentParams: {
43324
43341
  additionalElement: /*#__PURE__*/jsx(PriceFactorHeaderComponent, {
43325
43342
  onSave: (/*#__PURE__*/function () {
43326
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data, value) {
43343
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data, value) {
43327
43344
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
43328
43345
  while (1) switch (_context4.prev = _context4.next) {
43329
43346
  case 0:
@@ -43335,12 +43352,12 @@ var Prices = observer(function (_ref) {
43335
43352
  }, _callee4);
43336
43353
  }));
43337
43354
  return function (_x5, _x6) {
43338
- return _ref5.apply(this, arguments);
43355
+ return _ref4.apply(this, arguments);
43339
43356
  };
43340
43357
  }()),
43341
43358
  value: (_pricelist$pfgPricefa = pricelist.pfgPricefactors) === null || _pricelist$pfgPricefa === void 0 || (_pricelist$pfgPricefa = _pricelist$pfgPricefa[selectedSerie === null || selectedSerie === void 0 ? void 0 : selectedSerie.serieNo]) === null || _pricelist$pfgPricefa === void 0 ? void 0 : _pricelist$pfgPricefa[priceFeatureGroup.id],
43342
43359
  onPriorityChange: (/*#__PURE__*/function () {
43343
- var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(value) {
43360
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(value) {
43344
43361
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
43345
43362
  while (1) switch (_context5.prev = _context5.next) {
43346
43363
  case 0:
@@ -43352,7 +43369,7 @@ var Prices = observer(function (_ref) {
43352
43369
  }, _callee5);
43353
43370
  }));
43354
43371
  return function (_x7) {
43355
- return _ref6.apply(this, arguments);
43372
+ return _ref5.apply(this, arguments);
43356
43373
  };
43357
43374
  }()),
43358
43375
  priority: !!((_pricelist$pfgPricefa2 = pricelist.pfgPricefactorsPriority) !== null && _pricelist$pfgPricefa2 !== void 0 && (_pricelist$pfgPricefa2 = _pricelist$pfgPricefa2[selectedSerie === null || selectedSerie === void 0 ? void 0 : selectedSerie.serieNo]) !== null && _pricelist$pfgPricefa2 !== void 0 && _pricelist$pfgPricefa2.includes(priceFeatureGroup.id)),
@@ -43382,7 +43399,7 @@ var Prices = observer(function (_ref) {
43382
43399
  headerComponentParams: {
43383
43400
  additionalElement: /*#__PURE__*/jsx(PriceFactorHeaderComponent, {
43384
43401
  onSave: (/*#__PURE__*/function () {
43385
- var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(data, value) {
43402
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(data, value) {
43386
43403
  return _regeneratorRuntime.wrap(function _callee6$(_context6) {
43387
43404
  while (1) switch (_context6.prev = _context6.next) {
43388
43405
  case 0:
@@ -43394,12 +43411,12 @@ var Prices = observer(function (_ref) {
43394
43411
  }, _callee6);
43395
43412
  }));
43396
43413
  return function (_x8, _x9) {
43397
- return _ref7.apply(this, arguments);
43414
+ return _ref6.apply(this, arguments);
43398
43415
  };
43399
43416
  }()),
43400
43417
  value: (_pricelist$pgPricefac = pricelist.pgPricefactors) === null || _pricelist$pgPricefac === void 0 || (_pricelist$pgPricefac = _pricelist$pgPricefac[selectedSerie === null || selectedSerie === void 0 ? void 0 : selectedSerie.serieNo]) === null || _pricelist$pgPricefac === void 0 ? void 0 : _pricelist$pgPricefac[priceGroup],
43401
43418
  onPriorityChange: (/*#__PURE__*/function () {
43402
- var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(value) {
43419
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(value) {
43403
43420
  return _regeneratorRuntime.wrap(function _callee7$(_context7) {
43404
43421
  while (1) switch (_context7.prev = _context7.next) {
43405
43422
  case 0:
@@ -43411,7 +43428,7 @@ var Prices = observer(function (_ref) {
43411
43428
  }, _callee7);
43412
43429
  }));
43413
43430
  return function (_x10) {
43414
- return _ref8.apply(this, arguments);
43431
+ return _ref7.apply(this, arguments);
43415
43432
  };
43416
43433
  }()),
43417
43434
  priority: !!((_pricelist$pgPricefac2 = pricelist.pgPricefactorsPriority) !== null && _pricelist$pgPricefac2 !== void 0 && (_pricelist$pgPricefac2 = _pricelist$pgPricefac2[selectedSerie === null || selectedSerie === void 0 ? void 0 : selectedSerie.serieNo]) !== null && _pricelist$pgPricefac2 !== void 0 && _pricelist$pgPricefac2.includes(priceGroup)),
@@ -43508,7 +43525,7 @@ var Prices = observer(function (_ref) {
43508
43525
  children: /*#__PURE__*/jsx(PriceFactorInput, {
43509
43526
  value: (_pricelist$seriePrice = pricelist.seriePricefactors) === null || _pricelist$seriePrice === void 0 ? void 0 : _pricelist$seriePrice[selectedSerie === null || selectedSerie === void 0 ? void 0 : selectedSerie.serieNo],
43510
43527
  onSave: (/*#__PURE__*/function () {
43511
- var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_, value) {
43528
+ var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_, value) {
43512
43529
  return _regeneratorRuntime.wrap(function _callee8$(_context8) {
43513
43530
  while (1) switch (_context8.prev = _context8.next) {
43514
43531
  case 0:
@@ -43520,7 +43537,7 @@ var Prices = observer(function (_ref) {
43520
43537
  }, _callee8);
43521
43538
  }));
43522
43539
  return function (_x11, _x12) {
43523
- return _ref9.apply(this, arguments);
43540
+ return _ref8.apply(this, arguments);
43524
43541
  };
43525
43542
  }()),
43526
43543
  disabled: !selectedSerie
@@ -43545,6 +43562,7 @@ var Prices = observer(function (_ref) {
43545
43562
  }), selectedSerie && /*#__PURE__*/jsx(Spreadsheet, {
43546
43563
  ref: spreadsheetRef,
43547
43564
  gridId: 'crud-grid_enricherprices',
43565
+ agentBoundParent: agentBoundParent,
43548
43566
  applicationData: applicationData,
43549
43567
  configuration: configuration
43550
43568
  }), contextHolder]
@@ -43601,7 +43619,14 @@ var TablePriceList = observer(function () {
43601
43619
  apiConfig: apiConfig,
43602
43620
  pricelist: selectedPriceList,
43603
43621
  setNodeDataValue: setNodeDataValue,
43604
- viewOnly: viewOnly
43622
+ viewOnly: viewOnly,
43623
+ // `name` is editable and not unique; the record id is what the binding check must compare.
43624
+ agentBoundParent: {
43625
+ grid: 'pricelists',
43626
+ column: '_id',
43627
+ value: selectedPriceList._id,
43628
+ tool: 'pricelistpos'
43629
+ }
43605
43630
  },
43606
43631
  startWidth: 300,
43607
43632
  defaultPinned: false,
@@ -44370,7 +44395,8 @@ var Catalogs = /*#__PURE__*/forwardRef(function Catalogs(_ref, ref) {
44370
44395
  showApi2 = _ref$showApi === void 0 ? false : _ref$showApi,
44371
44396
  setSelectedCatalog = _ref.setSelectedCatalog,
44372
44397
  onActualChange = _ref.onActualChange,
44373
- refreshTrigger = _ref.refreshTrigger;
44398
+ refreshTrigger = _ref.refreshTrigger,
44399
+ agentBoundParent = _ref.agentBoundParent;
44374
44400
  var root = useStore();
44375
44401
  var _useTranslation = useTranslation(),
44376
44402
  t = _useTranslation.t,
@@ -45232,6 +45258,7 @@ var Catalogs = /*#__PURE__*/forwardRef(function Catalogs(_ref, ref) {
45232
45258
  children: [/*#__PURE__*/jsx(Spreadsheet, {
45233
45259
  ref: ref,
45234
45260
  gridId: "catalogs-versions-grid",
45261
+ agentBoundParent: agentBoundParent,
45235
45262
  applicationData: applicationData,
45236
45263
  rowActions: rowActions,
45237
45264
  configuration: configuration,
@@ -45787,7 +45814,13 @@ var TableCatalogs = observer(function () {
45787
45814
  catalog: selectedCatalogRow,
45788
45815
  setSelectedCatalog: setSelectedCatalog,
45789
45816
  onActualChange: onActualChange,
45790
- refreshTrigger: refreshTrigger
45817
+ refreshTrigger: refreshTrigger,
45818
+ agentBoundParent: {
45819
+ grid: 'catalogs',
45820
+ column: '_id',
45821
+ value: selectedCatalogRow === null || selectedCatalogRow === void 0 ? void 0 : selectedCatalogRow._id,
45822
+ tool: 'catalogVersions'
45823
+ }
45791
45824
  },
45792
45825
  condition: function condition() {
45793
45826
  return (selectedCatalogRow === null || selectedCatalogRow === void 0 ? void 0 : selectedCatalogRow._id) != null;
@@ -46686,7 +46719,8 @@ var ItemsTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
46686
46719
  selectedSerie = _ref.selectedSerie,
46687
46720
  hooks = _ref.hooks,
46688
46721
  serieRunActive = _ref.serieRunActive,
46689
- refreshToken = _ref.refreshToken;
46722
+ refreshToken = _ref.refreshToken,
46723
+ agentBoundParent = _ref.agentBoundParent;
46690
46724
  var root = useStore();
46691
46725
  var _useTranslation = useTranslation(),
46692
46726
  t = _useTranslation.t,
@@ -47342,6 +47376,7 @@ var ItemsTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
47342
47376
  ,
47343
47377
 
47344
47378
  gridId: 'crud-grid_items',
47379
+ agentBoundParent: agentBoundParent,
47345
47380
  applicationData: applicationData,
47346
47381
  configuration: configuration,
47347
47382
  hooks: hooks
@@ -47502,7 +47537,7 @@ function _objectSpread$Y(e) { for (var r = 1; r < arguments.length; r++) { var t
47502
47537
  * serie, persisting a manual override and clearing it again all run from here through the goods-group API.
47503
47538
  */
47504
47539
  var TableSeries = observer(function () {
47505
- var _selectedSerie$goodsG;
47540
+ var _selectedSerie$goodsG, _selectedSerie$serieN;
47506
47541
  var root = useStore();
47507
47542
  var _useDivaCore = useDivaCore(),
47508
47543
  onEvent = _useDivaCore.actions.onEvent;
@@ -47670,7 +47705,13 @@ var TableSeries = observer(function () {
47670
47705
  selectedSerie: selectedSerie,
47671
47706
  apiConfig: apiConfig,
47672
47707
  serieRunActive: runningSerieIds.has(selectedSerie === null || selectedSerie === void 0 ? void 0 : selectedSerie._id) || !!(selectedSerie !== null && selectedSerie !== void 0 && (_selectedSerie$goodsG = selectedSerie.goodsGroup) !== null && _selectedSerie$goodsG !== void 0 && _selectedSerie$goodsG.runningRunId),
47673
- refreshToken: panelRefreshToken
47708
+ refreshToken: panelRefreshToken,
47709
+ agentBoundParent: {
47710
+ grid: 'series',
47711
+ column: 'serieNo',
47712
+ value: selectedSerie === null || selectedSerie === void 0 || (_selectedSerie$serieN = selectedSerie.serieNo) === null || _selectedSerie$serieN === void 0 ? void 0 : _selectedSerie$serieN.toString(),
47713
+ tool: 'items'
47714
+ }
47674
47715
  },
47675
47716
  condition: function condition() {
47676
47717
  return (selectedSerie === null || selectedSerie === void 0 ? void 0 : selectedSerie._id) !== undefined;
@@ -49135,7 +49176,8 @@ function Items(_ref) {
49135
49176
  var organizationId = _ref.organizationId,
49136
49177
  selectedCatalog = _ref.selectedCatalog,
49137
49178
  apiConfig = _ref.apiConfig,
49138
- selectedOptionGroup = _ref.selectedOptionGroup;
49179
+ selectedOptionGroup = _ref.selectedOptionGroup,
49180
+ agentBoundParent = _ref.agentBoundParent;
49139
49181
  var applicationData = useMemo(function () {
49140
49182
  return {
49141
49183
  organizationId: organizationId,
@@ -49190,6 +49232,7 @@ function Items(_ref) {
49190
49232
  }, [selectedCatalog === null || selectedCatalog === void 0 ? void 0 : selectedCatalog.isoLanguageIds]);
49191
49233
  return /*#__PURE__*/jsx(Spreadsheet, {
49192
49234
  gridId: 'crud-grid_optiongroupoptions',
49235
+ agentBoundParent: agentBoundParent,
49193
49236
  applicationData: applicationData,
49194
49237
  configuration: configuration
49195
49238
  }, selectedOptionGroup);
@@ -49226,7 +49269,13 @@ var TableOptionGroups = observer(function () {
49226
49269
  organizationId: organizationId,
49227
49270
  selectedCatalog: selectedCatalog,
49228
49271
  selectedOptionGroup: selectedOptionGroup === null || selectedOptionGroup === void 0 ? void 0 : selectedOptionGroup.optionGroupKey,
49229
- apiConfig: apiConfig
49272
+ apiConfig: apiConfig,
49273
+ agentBoundParent: {
49274
+ grid: 'optiongroups',
49275
+ column: 'optionGroupKey',
49276
+ value: selectedOptionGroup === null || selectedOptionGroup === void 0 ? void 0 : selectedOptionGroup.optionGroupKey,
49277
+ tool: 'optionGroupOptions'
49278
+ }
49230
49279
  },
49231
49280
  condition: function condition() {
49232
49281
  return (selectedOptionGroup === null || selectedOptionGroup === void 0 ? void 0 : selectedOptionGroup.optionGroupKey) !== undefined;
@@ -49429,7 +49478,8 @@ var FeaturesWithFeatureClass = /*#__PURE__*/forwardRef(function FeaturesWithFeat
49429
49478
  selectedCatalog = _ref.selectedCatalog,
49430
49479
  featureClassId = _ref.featureClassId,
49431
49480
  apiConfig = _ref.apiConfig,
49432
- hooks = _ref.hooks;
49481
+ hooks = _ref.hooks,
49482
+ agentBoundParent = _ref.agentBoundParent;
49433
49483
  var _useTranslation = useTranslation(),
49434
49484
  t = _useTranslation.t;
49435
49485
  var applicationData = useMemo(function () {
@@ -49578,6 +49628,7 @@ var FeaturesWithFeatureClass = /*#__PURE__*/forwardRef(function FeaturesWithFeat
49578
49628
  return /*#__PURE__*/jsx(Spreadsheet, {
49579
49629
  ref: ref,
49580
49630
  gridId: 'crud-grid_features_featureClass',
49631
+ agentBoundParent: agentBoundParent,
49581
49632
  applicationData: applicationData,
49582
49633
  hooks: hooks,
49583
49634
  configuration: configuration
@@ -49585,6 +49636,7 @@ var FeaturesWithFeatureClass = /*#__PURE__*/forwardRef(function FeaturesWithFeat
49585
49636
  });
49586
49637
 
49587
49638
  var TableFeatureClasses = observer(function () {
49639
+ var _selectedFeatureClass;
49588
49640
  var _useTranslation = useTranslation(),
49589
49641
  t = _useTranslation.t;
49590
49642
  var _useModule = useModule(['featureclasses']),
@@ -49615,7 +49667,13 @@ var TableFeatureClasses = observer(function () {
49615
49667
  organizationId: organizationId,
49616
49668
  selectedCatalog: selectedCatalog,
49617
49669
  apiConfig: apiConfig,
49618
- featureClassId: selectedFeatureClass === null || selectedFeatureClass === void 0 ? void 0 : selectedFeatureClass._id
49670
+ featureClassId: selectedFeatureClass === null || selectedFeatureClass === void 0 ? void 0 : selectedFeatureClass._id,
49671
+ agentBoundParent: {
49672
+ grid: 'featureclasses',
49673
+ column: 'featureClassNo',
49674
+ value: selectedFeatureClass === null || selectedFeatureClass === void 0 || (_selectedFeatureClass = selectedFeatureClass.featureClassNo) === null || _selectedFeatureClass === void 0 ? void 0 : _selectedFeatureClass.toString(),
49675
+ tool: 'features'
49676
+ }
49619
49677
  },
49620
49678
  condition: function condition() {
49621
49679
  return (selectedFeatureClass === null || selectedFeatureClass === void 0 ? void 0 : selectedFeatureClass._id) !== undefined;
@@ -51902,7 +51960,8 @@ function OptionCombinations(_ref) {
51902
51960
  catalogId = _ref.catalogId,
51903
51961
  defaultLanguage = _ref.defaultLanguage,
51904
51962
  apiConfig = _ref.apiConfig,
51905
- setNodeDataValue = _ref.setNodeDataValue;
51963
+ setNodeDataValue = _ref.setNodeDataValue,
51964
+ agentBoundParent = _ref.agentBoundParent;
51906
51965
  var _useTranslation = useTranslation(),
51907
51966
  i18n = _useTranslation.i18n;
51908
51967
  var addFeature = useCallback(function (value) {
@@ -52086,13 +52145,14 @@ function OptionCombinations(_ref) {
52086
52145
  }, [apiInterface, decision, i18n.language, removeFeature, addFeature, catalogId, apiConfig.idmService]);
52087
52146
  return /*#__PURE__*/jsx(Spreadsheet, {
52088
52147
  gridId: 'crud-grid_optionCombinations',
52148
+ agentBoundParent: agentBoundParent,
52089
52149
  applicationData: applicationData,
52090
52150
  configuration: configuration
52091
52151
  }, decision._id);
52092
52152
  }
52093
52153
 
52094
52154
  var TableDecisions = observer(function () {
52095
- var _selectedCatalog$isoL;
52155
+ var _selectedCatalog$isoL, _selectedDecision$dec;
52096
52156
  var _useTranslation = useTranslation(),
52097
52157
  t = _useTranslation.t;
52098
52158
  var spreadsheetRef = useRef(null);
@@ -52132,7 +52192,13 @@ var TableDecisions = observer(function () {
52132
52192
  catalogId: catalogId,
52133
52193
  defaultLanguage: (selectedCatalog === null || selectedCatalog === void 0 ? void 0 : selectedCatalog.fallBackLanguage) || (selectedCatalog === null || selectedCatalog === void 0 || (_selectedCatalog$isoL = selectedCatalog.isoLanguageIds) === null || _selectedCatalog$isoL === void 0 ? void 0 : _selectedCatalog$isoL[0]) || 'DE',
52134
52194
  apiConfig: apiConfig,
52135
- setNodeDataValue: setNodeDataValue
52195
+ setNodeDataValue: setNodeDataValue,
52196
+ agentBoundParent: {
52197
+ grid: 'decisions',
52198
+ column: 'decisionNo',
52199
+ value: selectedDecision === null || selectedDecision === void 0 || (_selectedDecision$dec = selectedDecision.decisionNo) === null || _selectedDecision$dec === void 0 ? void 0 : _selectedDecision$dec.toString(),
52200
+ tool: 'optionCombinations'
52201
+ }
52136
52202
  },
52137
52203
  condition: function condition() {
52138
52204
  return (selectedDecision === null || selectedDecision === void 0 ? void 0 : selectedDecision._id) !== undefined;
@@ -52330,6 +52396,7 @@ var TableDecisions = observer(function () {
52330
52396
  });
52331
52397
  });
52332
52398
 
52399
+ /** Resolves a translated dictionary value (e.g. `{ DE: '...', FR: '...' }`) to a plain string for the given language, falling back to German. */
52333
52400
  function resolveTranslatedText(value, language) {
52334
52401
  var _ref, _value$language;
52335
52402
  if (value == null) return '';
@@ -52346,7 +52413,8 @@ function PartlistPos(_ref2) {
52346
52413
  setNodeDataValue = _ref2.setNodeDataValue,
52347
52414
  onPartlistPosExcelImportComplete = _ref2.onPartlistPosExcelImportComplete,
52348
52415
  _ref2$spreadsheetRemo = _ref2.spreadsheetRemountNonce,
52349
- spreadsheetRemountNonce = _ref2$spreadsheetRemo === void 0 ? 0 : _ref2$spreadsheetRemo;
52416
+ spreadsheetRemountNonce = _ref2$spreadsheetRemo === void 0 ? 0 : _ref2$spreadsheetRemo,
52417
+ agentBoundParent = _ref2.agentBoundParent;
52350
52418
  var _useTranslation = useTranslation(),
52351
52419
  t = _useTranslation.t;
52352
52420
  var addFeature = useCallback(function (value) {
@@ -52776,6 +52844,7 @@ function PartlistPos(_ref2) {
52776
52844
  }), /*#__PURE__*/jsx(Spreadsheet, {
52777
52845
  ref: ref,
52778
52846
  gridId: 'crud-grid_partlistpos',
52847
+ agentBoundParent: agentBoundParent,
52779
52848
  applicationData: applicationData,
52780
52849
  configuration: configuration,
52781
52850
  hooks: hooks
@@ -52883,7 +52952,13 @@ var TablePartlists = observer(function () {
52883
52952
  partlist: selectedPartlist,
52884
52953
  spreadsheetRemountNonce: partlistPosSpreadsheetRemountNonce,
52885
52954
  setNodeDataValue: setNodeDataValue,
52886
- onPartlistPosExcelImportComplete: onPartlistPosExcelImportComplete
52955
+ onPartlistPosExcelImportComplete: onPartlistPosExcelImportComplete,
52956
+ agentBoundParent: {
52957
+ grid: 'partlists',
52958
+ column: 'partlistKey',
52959
+ value: selectedPartlist === null || selectedPartlist === void 0 ? void 0 : selectedPartlist.partlistKey,
52960
+ tool: 'partlistpos'
52961
+ }
52887
52962
  },
52888
52963
  condition: function condition() {
52889
52964
  return (selectedPartlist === null || selectedPartlist === void 0 ? void 0 : selectedPartlist._id) !== undefined;
@@ -54726,7 +54801,8 @@ function PriceFeatureGroupPercentageSurcharge(_ref) {
54726
54801
  defaultLanguage = _ref.defaultLanguage,
54727
54802
  apiConfig = _ref.apiConfig,
54728
54803
  setNodeDataValue = _ref.setNodeDataValue,
54729
- setIsPercentage = _ref.setIsPercentage;
54804
+ setIsPercentage = _ref.setIsPercentage,
54805
+ agentBoundParent = _ref.agentBoundParent;
54730
54806
  var _useTranslation = useTranslation(),
54731
54807
  i18n = _useTranslation.i18n;
54732
54808
  var addFeature = useCallback(function (value) {
@@ -54914,6 +54990,7 @@ function PriceFeatureGroupPercentageSurcharge(_ref) {
54914
54990
  }, [apiInterface, priceFeatureGroup, i18n.language, removeFeature, addFeature]);
54915
54991
  return /*#__PURE__*/jsx(Spreadsheet, {
54916
54992
  gridId: 'crud-grid_priceFeatureGroupPercentageSurcharge',
54993
+ agentBoundParent: agentBoundParent,
54917
54994
  applicationData: applicationData,
54918
54995
  hooks: hooks,
54919
54996
  configuration: configuration
@@ -54926,7 +55003,8 @@ function PriceFeatureGroupFinishes(_ref) {
54926
55003
  defaultLanguage = _ref.defaultLanguage,
54927
55004
  apiConfig = _ref.apiConfig,
54928
55005
  setNodeDataValue = _ref.setNodeDataValue,
54929
- setIsPercentage = _ref.setIsPercentage;
55006
+ setIsPercentage = _ref.setIsPercentage,
55007
+ agentBoundParent = _ref.agentBoundParent;
54930
55008
  var _useTranslation = useTranslation(),
54931
55009
  t = _useTranslation.t,
54932
55010
  i18n = _useTranslation.i18n;
@@ -55115,6 +55193,7 @@ function PriceFeatureGroupFinishes(_ref) {
55115
55193
  }, [priceFeatureGroup, addFeature, removeFeature, catalogId, apiConfig.idmService, i18n.language, t]);
55116
55194
  return /*#__PURE__*/jsx(Spreadsheet, {
55117
55195
  gridId: 'crud-grid_priceGroupFinishes',
55196
+ agentBoundParent: agentBoundParent,
55118
55197
  applicationData: applicationData,
55119
55198
  hooks: hooks,
55120
55199
  configuration: configuration
@@ -55124,7 +55203,7 @@ function PriceFeatureGroupFinishes(_ref) {
55124
55203
  function ownKeys$P(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
55125
55204
  function _objectSpread$P(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$P(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$P(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
55126
55205
  var TablePriceFeatureGroups = observer(function () {
55127
- var _selectedCatalog$isoL, _selectedCatalog$isoL2;
55206
+ var _selectedPriceFeature, _selectedCatalog$isoL, _selectedCatalog$isoL2;
55128
55207
  var _useTranslation = useTranslation(),
55129
55208
  t = _useTranslation.t;
55130
55209
  var root = useStore();
@@ -55155,6 +55234,13 @@ var TablePriceFeatureGroups = observer(function () {
55155
55234
  var _spreadsheetRef$curre;
55156
55235
  return (_spreadsheetRef$curre = spreadsheetRef.current) === null || _spreadsheetRef$curre === void 0 ? void 0 : _spreadsheetRef$curre.setNodeDataValue(selectedNodeId, data);
55157
55236
  }, [selectedNodeId]);
55237
+
55238
+ // Both subtables are scoped by the selected group.
55239
+ var boundPriceFeatureGroup = {
55240
+ grid: 'pricefeaturegroups',
55241
+ column: 'priceFeatureGroupNo',
55242
+ value: selectedPriceFeatureGroup === null || selectedPriceFeatureGroup === void 0 || (_selectedPriceFeature = selectedPriceFeatureGroup.priceFeatureGroupNo) === null || _selectedPriceFeature === void 0 ? void 0 : _selectedPriceFeature.toString()
55243
+ };
55158
55244
  useTools({
55159
55245
  mainInformationWindowCodex: 'IDM_PRICE_FEATURE_GROUPS_TABLE_INFO',
55160
55246
  catalog: selectedCatalog,
@@ -55172,7 +55258,10 @@ var TablePriceFeatureGroups = observer(function () {
55172
55258
  defaultLanguage: (selectedCatalog === null || selectedCatalog === void 0 ? void 0 : selectedCatalog.fallBackLanguage) || (selectedCatalog === null || selectedCatalog === void 0 || (_selectedCatalog$isoL = selectedCatalog.isoLanguageIds) === null || _selectedCatalog$isoL === void 0 ? void 0 : _selectedCatalog$isoL[0]) || 'DE',
55173
55259
  apiConfig: apiConfig,
55174
55260
  setNodeDataValue: setNodeDataValue,
55175
- setIsPercentage: setIsPercentage
55261
+ setIsPercentage: setIsPercentage,
55262
+ agentBoundParent: _objectSpread$P(_objectSpread$P({}, boundPriceFeatureGroup), {}, {
55263
+ tool: 'priceFeatureGroupFinishes'
55264
+ })
55176
55265
  },
55177
55266
  disabled: isPercentage === true,
55178
55267
  condition: function condition() {
@@ -55188,7 +55277,10 @@ var TablePriceFeatureGroups = observer(function () {
55188
55277
  defaultLanguage: (selectedCatalog === null || selectedCatalog === void 0 ? void 0 : selectedCatalog.fallBackLanguage) || (selectedCatalog === null || selectedCatalog === void 0 || (_selectedCatalog$isoL2 = selectedCatalog.isoLanguageIds) === null || _selectedCatalog$isoL2 === void 0 ? void 0 : _selectedCatalog$isoL2[0]) || 'DE',
55189
55278
  apiConfig: apiConfig,
55190
55279
  setNodeDataValue: setNodeDataValue,
55191
- setIsPercentage: setIsPercentage
55280
+ setIsPercentage: setIsPercentage,
55281
+ agentBoundParent: _objectSpread$P(_objectSpread$P({}, boundPriceFeatureGroup), {}, {
55282
+ tool: 'priceFeatureGroupPercentageSurcharge'
55283
+ })
55192
55284
  },
55193
55285
  disabled: isPercentage === false || (selectedPriceFeatureGroup === null || selectedPriceFeatureGroup === void 0 ? void 0 : selectedPriceFeatureGroup.additionalPrice) == false,
55194
55286
  condition: function condition() {
@@ -55697,7 +55789,8 @@ function isPackageSelectableAsCollectionMember(packageData, organizationId, pare
55697
55789
  function CollectionMembers(_ref) {
55698
55790
  var collection = _ref.collection,
55699
55791
  organizationId = _ref.organizationId,
55700
- apiConfig = _ref.apiConfig;
55792
+ apiConfig = _ref.apiConfig,
55793
+ agentBoundParent = _ref.agentBoundParent;
55701
55794
  var _useTranslation = useTranslation();
55702
55795
  _useTranslation.t;
55703
55796
  var i18n = _useTranslation.i18n;
@@ -55793,6 +55886,7 @@ function CollectionMembers(_ref) {
55793
55886
  }, [apiInterface, i18n.language, organizationId]);
55794
55887
  return /*#__PURE__*/jsx(Spreadsheet, {
55795
55888
  gridId: 'crud-grid_collectionmembers',
55889
+ agentBoundParent: agentBoundParent,
55796
55890
  applicationData: applicationData,
55797
55891
  configuration: configuration
55798
55892
  });
@@ -55821,7 +55915,13 @@ function TableCollections () {
55821
55915
  elementProps: {
55822
55916
  collection: selectedCollection,
55823
55917
  organizationId: organizationId,
55824
- apiConfig: apiConfig
55918
+ apiConfig: apiConfig,
55919
+ agentBoundParent: {
55920
+ grid: 'collections',
55921
+ column: '_id',
55922
+ value: selectedCollection === null || selectedCollection === void 0 ? void 0 : selectedCollection._id,
55923
+ tool: 'collectionMembers'
55924
+ }
55825
55925
  },
55826
55926
  condition: function condition() {
55827
55927
  return (selectedCollection === null || selectedCollection === void 0 ? void 0 : selectedCollection._id) !== undefined;
@@ -81412,6 +81512,11 @@ function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t
81412
81512
 
81413
81513
  /** What the toolset acts on: the catalog or package a view is bound to, and that view's serie/item selection and setters. */
81414
81514
 
81515
+ /** A serie/item change reloads the planner, which takes seconds — a result sent after 3 s let selectItem hit the previous serie. */
81516
+ var SELECTION_SETTLE = {
81517
+ timeoutMs: 15000
81518
+ };
81519
+
81415
81520
  /** Definitions of the serie/item selection tools this toolset executes — sent to the backend per turn. */
81416
81521
  var BACKOFFICE_TOOL_DEFS = [{
81417
81522
  name: 'listSeries',
@@ -81433,7 +81538,8 @@ var BACKOFFICE_TOOL_DEFS = [{
81433
81538
  },
81434
81539
  required: ['serieNo']
81435
81540
  },
81436
- endsTurn: true
81541
+ endsTurn: true,
81542
+ settle: SELECTION_SETTLE
81437
81543
  }, {
81438
81544
  name: 'selectItem',
81439
81545
  description: 'Select an item (article) of the current serie in the backoffice — the planner instance reloads with it and the turn ends automatically. typeNo = typeNr from findPlannableArticle. Announce the selection to the user BEFORE calling.',
@@ -81447,7 +81553,8 @@ var BACKOFFICE_TOOL_DEFS = [{
81447
81553
  },
81448
81554
  required: ['typeNo']
81449
81555
  },
81450
- endsTurn: true
81556
+ endsTurn: true,
81557
+ settle: SELECTION_SETTLE
81451
81558
  }];
81452
81559
 
81453
81560
  /** Toolset that drives the backoffice serie/item selection through the same context setters the WYSIWYG dropdowns use. */
@@ -82604,7 +82711,12 @@ var NAVIGATION_TOOL_DEFS = [{
82604
82711
  },
82605
82712
  required: ['path']
82606
82713
  },
82607
- endsTurn: true
82714
+ endsTurn: true,
82715
+ // Settled only once the requested view is mounted — the series view took 40 s on a slow tab.
82716
+ settle: {
82717
+ timeoutMs: 30000,
82718
+ pathArgument: 'path'
82719
+ }
82608
82720
  }, {
82609
82721
  name: 'reloadPlanner',
82610
82722
  description: 'Discard the loaded planner instance(s) of the current catalog/package so the next planner use loads CURRENT data — call it after COMMITTED catalog-data changes BEFORE any planner verification (the instance was initialized with pre-change data; same effect as the configurator reload button). The turn ends automatically — announce it BEFORE calling.',
@@ -82761,7 +82873,7 @@ var NAVIGATION_TOOL_DEFS = [{
82761
82873
  argAliases: GRID_ARG_ALIASES
82762
82874
  }, {
82763
82875
  name: 'stageTableEdits',
82764
- description: "Change table data WITH the user's approval, in bulk: cell edits, new rows and row removals are ALL staged at once (highlighted in the table, nothing saved yet), the user gets ONE Übernehmen/Verwerfen bar on the table, and only Übernehmen commits everything through the table's normal edit path. Rows are addressed by keyColumn+keyValue (a column value that is UNIQUE in the table, e.g. typeNo='ART_001' — the row is located for you, no locateRow/readGridRows round-trip) or by rowId from readGridRows; when a keyColumn value is NOT unique (e.g. a typeNo that recurs in the prices matrix) it cannot disambiguate — readGridRows and address those rows by rowId instead. MULTIPLE existing rows in ONE call (different keyValues, e.g. a whole batch of prices/retailArticleNr edits) are fully supported, including rows that are not yet loaded on screen (a big table like prices): each such row is located, staged and saved on its own — sequentially, before the next lookup runs, so one row is never lost to another row's server-side lookup — while the ONE approval for the whole call still covers everything; the trade-off is that the approval bar then shows a COUNT of intended changes instead of highlighted cells, because most rows are not loaded yet when the user has to decide. A LOOKUP cell write (e.g. items.decisionRefs) resolves an EXACT identity key (its decisionNo etc.) FIRST, before any label-text search runs — a short numeric key is never crowded out by unrelated rows whose label text happens to contain the same digits. SUBTABLE work in the same call: parentRow {grid, column, value, tool} selects the parent row, opens its subtable tool and targets it. CAUTION when the parent column DEFINES the subtable's columns (a decision's `featureRefs` drives its optioncombinations columns): changing it REBUILDS the subtable, and the rebuild can overrun a cell write that has not settled yet — an ESTABLISHED neighbour cell is emptied silently and nothing in the response reports the loss. So: set the parent column to its FINAL value in one edit, THEN write the subtable cells, THEN read them back — and never let a `featureRefs` edit directly follow a cell write; put a read between them and re-read after every rebuild. Removing a column from `featureRefs` DOES delete its values — nothing stays orphaned in the record, no cleanup ritual is needed. But the PLANNER resolves a decision's rows when its instance starts, so `getDecision` can still report the OLD condition long after the grid is correct: never treat an engine read as evidence about a change you just made — `reloadPlanner` first, then cross-read. The grid and the record are the truth here; the engine is a snapshot. For addRows: FIRST check the table's column metadata (listGrids) and fill EVERY column marked 'required' that is not marked 'defaulted' — one missing required column fails the ENTIRE staging. Blocks until the user decides. Put every related change into ONE call — but keep the payload MODERATE: a very large or deeply-nested addRows/edits array can exceed the function-call parse limit and fail as MALFORMED. Split big operations (a whole item list, dozens of finishes) across several calls, and build a new catalog TOP-DOWN (shell row first, navigate into the editor, then section by section) instead of one mega-call.",
82876
+ description: "Change table data WITH the user's approval, in bulk: cell edits, new rows and row removals are ALL staged at once (highlighted in the table, nothing saved yet), the user gets ONE Übernehmen/Verwerfen bar on the table, and only Übernehmen commits everything through the table's normal edit path. Rows are addressed by keyColumn+keyValue (a column value that is UNIQUE in the table, e.g. typeNo='ART_001' — the row is located for you, no locateRow/readGridRows round-trip) or by rowId from readGridRows; when a keyColumn value is NOT unique (e.g. a typeNo that recurs in the prices matrix) it cannot disambiguate — readGridRows and address those rows by rowId instead. MULTIPLE existing rows in ONE call (different keyValues, e.g. a whole batch of prices/retailArticleNr edits) are fully supported, including rows that are not yet loaded on screen (a big table like prices): each such row is located, staged and saved on its own — sequentially, before the next lookup runs, so one row is never lost to another row's server-side lookup — while the ONE approval for the whole call still covers everything; the trade-off is that the approval bar then shows a COUNT of intended changes instead of highlighted cells, because most rows are not loaded yet when the user has to decide. A LOOKUP cell write (e.g. items.decisionRefs) resolves an EXACT identity key (its decisionNo etc.) FIRST, before any label-text search runs — a short numeric key is never crowded out by unrelated rows whose label text happens to contain the same digits. SUBTABLE work in the same call: parentRow {grid, column, value, tool} selects the parent row, opens its subtable tool and targets it — pass it on EVERY subtable write, because WITHOUT it nothing re-binds the parent: the edit lands under the parent row the open subtable is bound to (whichever an earlier call left selected), named in the receipt as boundParentRow — check it before building on the write — and a subtable bound to no parent row REFUSES the write. CAUTION when the parent column DEFINES the subtable's columns (a decision's `featureRefs` drives its optioncombinations columns): changing it REBUILDS the subtable, and the rebuild can overrun a cell write that has not settled yet — an ESTABLISHED neighbour cell is emptied silently and nothing in the response reports the loss. So: set the parent column to its FINAL value in one edit, THEN write the subtable cells, THEN read them back — and never let a `featureRefs` edit directly follow a cell write; put a read between them and re-read after every rebuild. Removing a column from `featureRefs` DOES delete its values — nothing stays orphaned in the record, no cleanup ritual is needed. But the PLANNER resolves a decision's rows when its instance starts, so `getDecision` can still report the OLD condition long after the grid is correct: never treat an engine read as evidence about a change you just made — `reloadPlanner` first, then cross-read. The grid and the record are the truth here; the engine is a snapshot. For addRows: FIRST check the table's column metadata (listGrids) and fill EVERY column marked 'required' that is not marked 'defaulted' — one missing required column fails the ENTIRE staging. Blocks until the user decides. Put every related change into ONE call — but keep the payload MODERATE: a very large or deeply-nested addRows/edits array can exceed the function-call parse limit and fail as MALFORMED. Split big operations (a whole item list, dozens of finishes) across several calls, and build a new catalog TOP-DOWN (shell row first, navigate into the editor, then section by section) instead of one mega-call.",
82765
82877
  input_schema: {
82766
82878
  type: 'object',
82767
82879
  properties: {
@@ -83150,6 +83262,9 @@ function columnAgentMeta(divaDef) {
83150
83262
  if (isHeaderAddColumn(divaDef)) {
83151
83263
  meta.note = "header ADD control, not a data column — runTableAction 'addColumn' adds a table column; readColumnOptions lists the addable entries";
83152
83264
  }
83265
+ if (isPosCountActionsColumn(divaDef)) {
83266
+ meta.note = "position COUNT column — write the bare number ('1'; '0' for a conditioned position). It is stored as SET_POS_COUNT_VALUE:<n>; readGridRows returns the number";
83267
+ }
83153
83268
  // A select editor's value list binds just as an enum does — surface it so a rejected write is avoidable.
83154
83269
  var editorValues = divaDef === null || divaDef === void 0 || (_divaDef$cellEditorPa = divaDef.cellEditorParams) === null || _divaDef$cellEditorPa === void 0 ? void 0 : _divaDef$cellEditorPa.values;
83155
83270
  if (!meta.allowedValues && Array.isArray(editorValues) && editorValues.length) meta.selectableValues = editorValues;
@@ -83175,6 +83290,47 @@ function isComputedColumn(divaDef) {
83175
83290
  return !!(divaDef && !divaDef.field && divaDef.colId && typeof divaDef.cellEditToRowUpdate === 'function');
83176
83291
  }
83177
83292
 
83293
+ /**
83294
+ * Where a stageTableEdits WITHOUT parentRow lands: only a SUBTABLE is bound to a parent, and only the parent its module
83295
+ * declares is provable — `refusal` is set while it declares none, so the write never lands on a guessed one.
83296
+ */
83297
+ function declaredParentBinding(entry) {
83298
+ if (!entry.getBoundParent) return {};
83299
+ var declared = entry.getBoundParent();
83300
+ // With the tool declared, boundParentRow IS the parentRow the next call should pass.
83301
+ if (declared !== null && declared !== void 0 && declared.value) {
83302
+ return {
83303
+ parent: _objectSpread$5({
83304
+ grid: declared.grid,
83305
+ column: declared.column,
83306
+ value: declared.value
83307
+ }, declared.tool ? {
83308
+ tool: declared.tool
83309
+ } : {})
83310
+ };
83311
+ }
83312
+ var tool = declared !== null && declared !== void 0 && declared.tool ? "tool:'".concat(declared.tool, "'") : 'tool';
83313
+ var parentRowShape = declared ? "{grid:'".concat(declared.grid, "', column:'").concat(declared.column, "', value, ").concat(tool, "}") : '{grid, column, value, tool}';
83314
+ return {
83315
+ refusal: "'".concat(entry.label, "' is a SUBTABLE bound to no parent row right now, so a write without parentRow has no provable target. Pass parentRow ").concat(parentRowShape, " to bind it explicitly. Nothing was staged.")
83316
+ };
83317
+ }
83318
+
83319
+ /** partlistpos.actions: a NUMBER column whose own parser wraps the count into SET_POS_COUNT_VALUE:n — not the decision action grammar. */
83320
+ function isPosCountActionsColumn(divaDef) {
83321
+ return (divaDef === null || divaDef === void 0 ? void 0 : divaDef.field) === 'actions' && (divaDef === null || divaDef === void 0 ? void 0 : divaDef.cellDataType) === 'number';
83322
+ }
83323
+
83324
+ /** The count a partlistpos.actions cell stores (['SET_POS_COUNT_VALUE:1'] → 1); undefined when none is set. */
83325
+ function posCountOf(value) {
83326
+ if (!Array.isArray(value)) return typeof value === 'number' ? value : undefined;
83327
+ var action = value.find(function (entry) {
83328
+ return typeof entry === 'string' && entry.startsWith('SET_POS_COUNT_VALUE:');
83329
+ });
83330
+ var parsed = action ? Number(String(action).split(':')[1]) : NaN;
83331
+ return Number.isNaN(parsed) ? undefined : parsed;
83332
+ }
83333
+
83178
83334
  /** The DIVA def behind an agent-facing column id: plain columns match on field, computed ones on colId. */
83179
83335
  function divaDefOf(divaDefs, column) {
83180
83336
  var _divaDefs$find;
@@ -83535,7 +83691,7 @@ function trimRowData(data) {
83535
83691
  function createNavigationToolset(ctx) {
83536
83692
  var root = ctx.root;
83537
83693
  var resolveGrid = function resolveGrid(gridLabel) {
83538
- var _entries$find, _entry$getHandle;
83694
+ var _entry$getHandle;
83539
83695
  var entries = root.gridRegistry.entries;
83540
83696
  var path = root.navigationState.path;
83541
83697
  if (!entries.length) {
@@ -83543,14 +83699,7 @@ function createNavigationToolset(ctx) {
83543
83699
  error: "No table is currently on screen (current view: ".concat(path, ") \u2014 navigateTo the view that hosts the table first.")
83544
83700
  };
83545
83701
  }
83546
- // gridId beats label: labels derive from the read endpoint and can collide between mounted grids.
83547
- var wanted = gridLabel === null || gridLabel === void 0 ? void 0 : gridLabel.toLowerCase();
83548
- var entry = wanted ? (_entries$find = entries.find(function (candidate) {
83549
- var _candidate$gridId;
83550
- return ((_candidate$gridId = candidate.gridId) === null || _candidate$gridId === void 0 ? void 0 : _candidate$gridId.toLowerCase()) === wanted;
83551
- })) !== null && _entries$find !== void 0 ? _entries$find : entries.find(function (candidate) {
83552
- return candidate.label.toLowerCase() === wanted;
83553
- }) : entries[0];
83702
+ var entry = gridLabel ? findGridEntry(root, gridLabel) : entries[0];
83554
83703
  if (!entry) {
83555
83704
  return {
83556
83705
  error: "No table '".concat(gridLabel, "' on the current view (").concat(path, ") \u2014 it has: ").concat(entries.map(function (candidate) {
@@ -83668,8 +83817,8 @@ function createNavigationToolset(ctx) {
83668
83817
  /** Shared parentRow prelude: select the parent row, open its subtable tool and resolve the target grid into `args.grid`. */
83669
83818
  var applyParentRowPrelude = /*#__PURE__*/function () {
83670
83819
  var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(input, args) {
83671
- var _parent$error, _parentRow$column, _parentRow$value, _parentRow$tool, _parentRow$tool2, _ref14, _args$grid;
83672
- var parentRow, parent, column, value, parentNode, _cellValueOf, matchedValue, candidates, before, openError, toolId, alreadyOpen, existing, targetGrid;
83820
+ var _parent$error, _parentRow$column, _parentRow$value, _parentRow$tool, _parentRow$tool2, _args$grid, _yield$waitForNewGrid, _resolveGrid$error;
83821
+ var parentRow, parent, column, value, parentNode, _cellValueOf, matchedValue, candidates, before, openError, toolId, alreadyOpen, declaredForTool, existing, targetGrid, mounted, bindingError, api;
83673
83822
  return _regeneratorRuntime.wrap(function _callee$(_context) {
83674
83823
  while (1) switch (_context.prev = _context.next) {
83675
83824
  case 0:
@@ -83740,66 +83889,120 @@ function createNavigationToolset(ctx) {
83740
83889
  // gridId first, like every other lookup here: the label alone can also be the PARENT's.
83741
83890
  toolId = String((_parentRow$tool2 = parentRow.tool) !== null && _parentRow$tool2 !== void 0 ? _parentRow$tool2 : '').toLowerCase();
83742
83891
  alreadyOpen = function alreadyOpen() {
83743
- var _entries$find2;
83892
+ var _entries$find;
83744
83893
  var entries = root.gridRegistry.entries;
83745
- var hit = (_entries$find2 = entries.find(function (registered) {
83894
+ var hit = (_entries$find = entries.find(function (registered) {
83746
83895
  var _registered$gridId;
83747
83896
  return ((_registered$gridId = registered.gridId) === null || _registered$gridId === void 0 ? void 0 : _registered$gridId.toLowerCase()) === toolId;
83748
- })) !== null && _entries$find2 !== void 0 ? _entries$find2 : entries.find(function (registered) {
83897
+ })) !== null && _entries$find !== void 0 ? _entries$find : entries.find(function (registered) {
83749
83898
  return registered.label.toLowerCase() === toolId;
83750
83899
  });
83751
83900
  return hit ? gridIdentity(hit) : undefined;
83752
- }; // A grid under the tool's name is EITHER the subtable already open OR the parent of the same label (labels
83753
- // derive from the read endpoint and collide). Only a fresh registration settles that, so the mount gets a
83754
- // short window first; the existing match is trusted only when nothing new appears in it. Without any match
83901
+ }; // A subtable that declares its tool is found by it: for five of them neither gridId nor label carries the tool's
83902
+ // name (finishes under 'priceFeatureGroupFinishes', catalog-versions under 'catalogVersions'), and a parent switch
83903
+ // re-mounts under the SAME gridId, so a repeated call would never see it as new either. The binding wait below
83904
+ // then catches the switch.
83905
+ declaredForTool = root.gridRegistry.entries.find(function (registered) {
83906
+ var _registered$getBoundP;
83907
+ return ((_registered$getBoundP = registered.getBoundParent) === null || _registered$getBoundP === void 0 || (_registered$getBoundP = _registered$getBoundP.call(registered)) === null || _registered$getBoundP === void 0 || (_registered$getBoundP = _registered$getBoundP.tool) === null || _registered$getBoundP === void 0 ? void 0 : _registered$getBoundP.toLowerCase()) === toolId;
83908
+ }); // Otherwise a grid under the tool's name is EITHER the subtable already open OR the parent of the same label
83909
+ // (labels derive from the read endpoint and collide). Only a fresh registration settles that, so the mount gets
83910
+ // a short window first; the existing match is trusted only when nothing new appears in it. Without any match
83755
83911
  // there is nothing to fall back on, and the wait is the full one.
83756
- existing = alreadyOpen();
83912
+ existing = declaredForTool ? gridIdentity(declaredForTool) : alreadyOpen();
83757
83913
  if (!((_args$grid = args.grid) !== null && _args$grid !== void 0)) {
83758
- _context.next = 36;
83914
+ _context.next = 37;
83759
83915
  break;
83760
83916
  }
83761
- _context.t2 = _args$grid;
83762
- _context.next = 39;
83917
+ _context.t1 = _args$grid;
83918
+ _context.next = 54;
83763
83919
  break;
83764
- case 36:
83765
- _context.next = 38;
83766
- return waitForNewGrid(root, before, existing ? 1500 : 5000);
83767
- case 38:
83768
- _context.t2 = _context.sent;
83769
- case 39:
83770
- _context.t3 = _ref14 = _context.t2;
83771
- _context.t1 = _context.t3 !== null;
83772
- if (!_context.t1) {
83773
- _context.next = 43;
83920
+ case 37:
83921
+ if (!declaredForTool) {
83922
+ _context.next = 41;
83774
83923
  break;
83775
83924
  }
83776
- _context.t1 = _ref14 !== void 0;
83925
+ _context.t2 = existing;
83926
+ _context.next = 53;
83927
+ break;
83928
+ case 41:
83929
+ _context.next = 43;
83930
+ return waitForNewGrid(root, before, existing ? 1500 : 5000);
83777
83931
  case 43:
83778
- if (!_context.t1) {
83932
+ _context.t4 = _yield$waitForNewGrid = _context.sent;
83933
+ _context.t3 = _context.t4 !== null;
83934
+ if (!_context.t3) {
83779
83935
  _context.next = 47;
83780
83936
  break;
83781
83937
  }
83782
- _context.t4 = _ref14;
83783
- _context.next = 48;
83784
- break;
83938
+ _context.t3 = _yield$waitForNewGrid !== void 0;
83785
83939
  case 47:
83786
- _context.t4 = existing;
83787
- case 48:
83788
- targetGrid = _context.t4;
83789
- if (targetGrid) {
83940
+ if (!_context.t3) {
83790
83941
  _context.next = 51;
83791
83942
  break;
83792
83943
  }
83944
+ _context.t5 = _yield$waitForNewGrid;
83945
+ _context.next = 52;
83946
+ break;
83947
+ case 51:
83948
+ _context.t5 = existing;
83949
+ case 52:
83950
+ _context.t2 = _context.t5;
83951
+ case 53:
83952
+ _context.t1 = _context.t2;
83953
+ case 54:
83954
+ targetGrid = _context.t1;
83955
+ if (targetGrid) {
83956
+ _context.next = 57;
83957
+ break;
83958
+ }
83793
83959
  return _context.abrupt("return", {
83794
83960
  error: "parentRow: the tool opened but no new table appeared — pass 'grid' (the subtable's label) explicitly."
83795
83961
  });
83796
- case 51:
83962
+ case 57:
83797
83963
  args.grid = targetGrid;
83798
- _context.next = 54;
83964
+ // An explicit `grid` that names no registered table fails by name here, not as a binding timeout further down.
83965
+ _context.next = 60;
83799
83966
  return waitForGrid(root, targetGrid, 5000);
83800
- case 54:
83967
+ case 60:
83968
+ mounted = _context.sent;
83969
+ if (mounted) {
83970
+ _context.next = 63;
83971
+ break;
83972
+ }
83973
+ return _context.abrupt("return", {
83974
+ error: "parentRow: ".concat((_resolveGrid$error = resolveGrid(targetGrid).error) !== null && _resolveGrid$error !== void 0 ? _resolveGrid$error : "table '".concat(targetGrid, "' did not appear."))
83975
+ });
83976
+ case 63:
83977
+ _context.next = 65;
83978
+ return waitForDeclaredParent(root, targetGrid, parent.api, parentNode.node, 5000);
83979
+ case 65:
83980
+ bindingError = _context.sent;
83981
+ if (!bindingError) {
83982
+ _context.next = 68;
83983
+ break;
83984
+ }
83985
+ return _context.abrupt("return", {
83986
+ error: bindingError
83987
+ });
83988
+ case 68:
83989
+ _context.next = 70;
83990
+ return waitForGrid(root, targetGrid, 5000);
83991
+ case 70:
83992
+ api = _context.sent;
83993
+ if (api) {
83994
+ _context.next = 73;
83995
+ break;
83996
+ }
83997
+ return _context.abrupt("return", {
83998
+ error: "parentRow: table '".concat(targetGrid, "' switched to the selected parent, but its grid is not ready yet \u2014 retry.")
83999
+ });
84000
+ case 73:
84001
+ _context.next = 75;
84002
+ return waitForRows(api, 5000);
84003
+ case 75:
83801
84004
  return _context.abrupt("return", undefined);
83802
- case 55:
84005
+ case 76:
83803
84006
  case "end":
83804
84007
  return _context.stop();
83805
84008
  }
@@ -83814,6 +84017,7 @@ function createNavigationToolset(ctx) {
83814
84017
  tools: NAVIGATION_TOOL_DEFS,
83815
84018
  // Structural facts read fresh per turn; the backend formats them into its dynamic prompt sections.
83816
84019
  getFacts: function getFacts() {
84020
+ var _root$dataStore;
83817
84021
  var _currentEditorIds2 = currentEditorIds(root, ctx),
83818
84022
  catalogId = _currentEditorIds2.catalogId,
83819
84023
  packageId = _currentEditorIds2.packageId;
@@ -83832,6 +84036,8 @@ function createNavigationToolset(ctx) {
83832
84036
  };
83833
84037
  return {
83834
84038
  catalogId: catalogId,
84039
+ // A reload or a cross-catalog navigateTo can switch the organization silently — name it with every answer.
84040
+ organizationId: (_root$dataStore = root.dataStore) === null || _root$dataStore === void 0 ? void 0 : _root$dataStore.selectedOrganizationId,
83835
84041
  currentPath: root.navigationState.path,
83836
84042
  grids: root.gridRegistry.entries.map(function (entry) {
83837
84043
  var _handle$getDivaColumn, _handle$getDivaColumn2, _handle$getDivaColumn3, _entry$getActions, _entry$getActions2;
@@ -83893,7 +84099,7 @@ function createNavigationToolset(ctx) {
83893
84099
  },
83894
84100
  dispatch: function () {
83895
84101
  var _dispatch = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11(name, input, signal, onProgress) {
83896
- var awaitingApproval, args, _i2, _Object$entries, _Object$entries$_i, alias, canonical, from, _allViews2, views, editorSubviews, _args$path, _root$navigationState2, _allViews3, _views, _editorSubviews, requested, dynamic, known, catalogIdIn, fromCatalog, toCatalog, _args$value, _resolveGrid, entry, api, error, multiValues, filterBeforeBulk, rows, missing, notUnique, deadline, notReached, anyLookupFilter, _iterator4, _step4, _trimmed$row, value, hit, _cellValueOf2, matches, trimmed, filterBeforeLocate, located, _args$value2, matchedRows, _cellValueOf3, matchedValue, gridsOnScreen, subtableHint, trimmedFirstRow, revealNote, revealed, _args$id, openError, _entry$getHandle$getD, _entry$getHandle2, _entry$getHandle$getD2, _entry$getHandle3, _lastNode$data, _entry$getHandle$hasP, _entry$getHandle4, _api$getFilterModel, prelude, _resolveGrid2, _entry, _api, _error, waitedForRowsMs, previewCell, leafFields, _requested, columns, unknownColumns, limit, _rows, displayed, unsavedRowCount, i, _api$getDisplayedRowA, _i3, node, values, truncatedColumns, _iterator5, _step5, column, divaDefs, columnMeta, lastNode, totalRowCount, dirty, filterModel, filteredBy, _ref23, _ref24, _staged$0$rowId, _staged$, _addedRows$, _outcome$committed, _root$navigationState3, _outcome$failed, _outcome$skipped, KNOWN_KEYS, ALIASES, unknownKeys, hints, edits, addRows, removeRowIds, removeRows, _prelude, _resolveGrid3, _entry2, _api2, _error2, handle, serieScope, fmt, _divaDefs, checkCellInput, writeCell, isLookupColumn, lookupWrite, staged, storedWrite, expectedValueOf, stagingNotes, failed, unchanged, removed, removedRecordIds, filterBeforeStaging, keyFilterApplied, restoreUserFilter, keyCache, resolveByKey, resolveTarget, applyEditToNode, columnDefFor, needsServerLookup, lookupKeyOf, lookupKeys, _iterator6, _step6, _edit2, _keyColumn2, _keyValue2, _iterator7, _step7, _removal, _keyColumn3, _keyValue3, _iterator8, _step8, edit, keyColumn, keyValue, _iterator9, _step9, removal, _keyColumn, _keyValue, mergedOutcome, mergeCommitOutcome, preApproved, intendedCount, _approved, _iterator10, _step10, _loop2, _ret2, filterWasChanged, _iterator12, _step12, _removal2, _target2, _target2$error, id, _iterator13, _step13, _edit3$column, _edit3, _column, _target3, _target3$error, _node2, _rowId, targets, _iterator14, _step14, _api2$getRowNode2, rowId, addedRows, providedAddColumns, conditionedPosDefaults, _loop3, _ret3, _i4, addSchemaHint, validationErrors, alreadySent, _iterator15, _step15, _api2$getRowNode10, _rowId2, rowErrors, focusNode, totalStaged, survivingOperations, approved, survived, survivedCount, trimEcho, finalOutcome, outcome, serverErrors, reported, isSessionRowId, sentValuesOf, lengthLimitNote, addError, _iterator16, _step16, failure, _iterator17, _step17, _rowId3, _iterator18, _step18, _api2$getRowNode11, _rowId4, _rowErrors, _i6, _addedRows, _api2$getRowNode5, a, outcomeIsEmpty, survivedAfterCommit, autoCommitted, autoCommittedOps, committedIds, failedIds, editTargets, addTargets, removalTargets, hasIdColumn, verifyBudget, probeServerRow, verifiedChanges, _iterator19, _step19, _loop4, verifiedAdds, _iterator20, _step20, target, probe, verifiedRemovals, _iterator21, _step21, _target, _probe, appliedCount, livePath, editorPathFor, echoValues, withServerIds, landedInSeries, foreignSeries, committedOps, confirmedCount, notCommittedRowIds, isEmptyCell, silentlyDropped, isSubtable, dirtyGrids, _root$navigationState4, _livePath$match, _livePath$match2, _ref37, _ref38, _livePath, packageBase, catalogBase, baseId, isPack, _root$webplannerInsta, destroyed, reloadTriggered, knownKeys, source, _action, _input, _entry3$getActions, _entry3$getActions2, _resolveGrid4, _entry3, _error3, _handle, actionName, actionInput, _addTargets, viewActions, available, approve, declined, autoNote, authorizedFetch, refreshAndSettle, unsettledNote, viewAction, mutating, cloneSettled, _catalogId, _handle$getApplicatio7, _handle$getApplicatio8, catalogId, importSettled, _handle$getApplicatio9, _handle$getApplicatio10, _params$scope, _pricelistNode, app, serieNo, params, scope, key, parent, parentHandle, pricelistNode, patch, label, factors, pricelistRowId, factorOutcome, rejected, _handle$getApplicatio11, _handle$getApplicatio12, _app, pricesSettled, _target4, keys, resolved, _iterator23, _step23, _loop7, _ret5, added, newColumns, _loop8, _i11, _resolved, decisionSubtableNote, partialNote, _column5, _search, _entry4$getActions, _entry4$getActions2, _enumDef$customParams, _data, _resolveGrid5, _entry4, _api3, _error4, _handle2, _column4, search, _limit, optionAction, _yield$optionAction$o, options, note, enumDef, enumData, _enumDef$customParams2, computedDef, fields, _enumDef$cellDataType, firstRow, rowData, _options, _defs$find$customPara, _defs$find, _handle2$getApplicati, _handle2$getApplicati2, defs, url, _rowFields, appScope, deps, hint, _resolveGrid6, _api4, _error5;
84102
+ var awaitingApproval, args, _i2, _Object$entries, _Object$entries$_i, alias, canonical, from, _allViews2, views, editorSubviews, _args$path, _root$navigationState2, _allViews3, _views, _editorSubviews, requested, dynamic, known, catalogIdIn, fromCatalog, toCatalog, _args$value, _resolveGrid, entry, api, error, multiValues, filterBeforeBulk, rows, missing, notUnique, deadline, notReached, anyLookupFilter, _iterator4, _step4, _trimmed$row, value, hit, _cellValueOf2, matches, trimmed, filterBeforeLocate, located, _args$value2, matchedRows, _cellValueOf3, matchedValue, gridsOnScreen, subtableHint, trimmedFirstRow, revealNote, revealed, _args$id, openError, _entry$getHandle$getD, _entry$getHandle2, _lastNode$data, _entry$getHandle$hasP, _entry$getHandle3, _api$getFilterModel, prelude, _resolveGrid2, _entry, _api, _error, waitedForRowsMs, previewCell, divaDefs, leafFields, _requested, columns, unknownColumns, limit, _rows, displayed, unsavedRowCount, i, _api$getDisplayedRowA, _i3, node, values, truncatedColumns, _iterator5, _step5, column, raw, columnMeta, lastNode, totalRowCount, dirty, filterModel, filteredBy, _ref22, _ref23, _staged$0$rowId, _staged$, _addedRows$, _outcome$committed, _root$navigationState3, _outcome$failed, _outcome$skipped, KNOWN_KEYS, ALIASES, unknownKeys, hints, edits, EDIT_KEYS, EDIT_ALIASES, editFaults, addRows, removeRowIds, removeRows, _prelude, _resolveGrid3, _entry2, _api2, _error2, handle, explicitParentRow, mountedAfterFirst, isSubtable, parentBinding, boundParentRow, parentBindingNote, idColumnPresent, isUnloadedRecordId, reroutedRecordIds, _iterator6, _step6, _edit2, _i4, _arr2, rowId, serieScope, fmt, _divaDefs, checkCellInput, writeCell, isLookupColumn, lookupWrite, staged, storedWrite, expectedValueOf, stagingNotes, failed, unchanged, removed, removedRecordIds, filterBeforeStaging, keyFilterApplied, restoreUserFilter, keyCache, resolveByKey, resolveTarget, applyEditToNode, columnDefFor, needsServerLookup, lookupKeyOf, lookupKeys, _iterator7, _step7, _edit3, _keyColumn2, _keyValue2, _iterator8, _step8, _removal, _keyColumn3, _keyValue3, _iterator9, _step9, edit, keyColumn, keyValue, _iterator10, _step10, removal, _keyColumn, _keyValue, mergedOutcome, mergeCommitOutcome, preApproved, intendedCount, _approved, _iterator11, _step11, _loop2, _ret2, filterWasChanged, _iterator13, _step13, _removal2, _target2, _target2$error, id, _iterator14, _step14, _edit4$column, _edit4, _column, _target3, _target3$error, _node2, _rowId2, targets, _iterator15, _step15, _api2$getRowNode2, _rowId, addedRows, providedAddColumns, conditionedPosDefaults, _loop3, _ret3, _i5, addSchemaHint, validationErrors, alreadySent, _iterator16, _step16, _api2$getRowNode10, _rowId3, rowErrors, focusNode, totalStaged, survivingOperations, approved, survived, survivedCount, trimEcho, finalOutcome, outcome, serverErrors, reported, isSessionRowId, sentValuesOf, lengthLimitNote, addError, _iterator17, _step17, failure, _iterator18, _step18, _rowId4, _iterator19, _step19, _api2$getRowNode11, _rowId5, _rowErrors, _i7, _addedRows, _api2$getRowNode5, a, outcomeIsEmpty, survivedAfterCommit, autoCommitted, autoCommittedOps, committedIds, failedIds, editTargets, addTargets, removalTargets, hasIdColumn, verifyDeadline, verifyDeadlineHit, filterBeforeVerify, verifyFilterApplied, probeServerRow, restoreVerifyFilter, verifiedChanges, verifiedAdds, verifiedRemovals, _iterator20, _step20, _loop4, _iterator21, _step21, target, probe, _iterator22, _step22, _target, _probe, appliedCount, livePath, editorPathFor, echoValues, withServerIds, addedRowsWithoutId, landedInSeries, foreignSeries, committedOps, confirmedCount, notCommittedRowIds, isEmptyCell, silentlyDropped, dirtyGrids, _root$navigationState4, _livePath$match, _livePath$match2, _ref36, _ref37, _livePath, packageBase, catalogBase, baseId, isPack, _root$webplannerInsta, destroyed, reloadTriggered, knownKeys, source, _action, _input, _entry3$getActions, _entry3$getActions2, _resolveGrid4, _entry3, _error3, _handle, actionName, actionInput, _addTargets, viewActions, available, approve, declined, autoNote, authorizedFetch, refreshAndSettle, unsettledNote, viewAction, mutating, cloneSettled, _catalogId, _handle$getApplicatio7, _handle$getApplicatio8, catalogId, importSettled, _handle$getApplicatio9, _handle$getApplicatio10, _params$scope, _pricelistNode, app, serieNo, params, scope, key, parent, parentHandle, pricelistNode, patch, label, factors, pricelistRowId, factorOutcome, rejected, _handle$getApplicatio11, _handle$getApplicatio12, _app, pricesSettled, _target4, keys, resolved, _iterator24, _step24, _loop7, _ret5, added, newColumns, _loop8, _i12, _resolved, decisionSubtableNote, partialNote, _column5, _search, _entry4$getActions, _entry4$getActions2, _enumDef$customParams, _data, _resolveGrid5, _entry4, _api3, _error4, _handle2, _column4, search, _limit, optionAction, _yield$optionAction$o, options, note, enumDef, enumData, _enumDef$customParams2, computedDef, fields, _enumDef$cellDataType, firstRow, rowData, _options, _defs$find$customPara, _defs$find, _handle2$getApplicati, _handle2$getApplicati2, defs, url, _rowFields, appScope, deps, hint, _resolveGrid6, _api4, _error5;
83897
84103
  return _regeneratorRuntime.wrap(function _callee11$(_context18) {
83898
84104
  while (1) switch (_context18.prev = _context18.next) {
83899
84105
  case 0:
@@ -83909,7 +84115,7 @@ function createNavigationToolset(ctx) {
83909
84115
  if (!args[canonical] && from) args[canonical] = from;
83910
84116
  }
83911
84117
  _context18.t0 = name;
83912
- _context18.next = _context18.t0 === 'listViews' ? 6 : _context18.t0 === 'navigateTo' ? 8 : _context18.t0 === 'listGrids' ? 24 : _context18.t0 === 'locateRow' ? 25 : _context18.t0 === 'openToolbarTool' ? 114 : _context18.t0 === 'readGridRows' ? 120 : _context18.t0 === 'stageTableEdits' ? 167 : _context18.t0 === 'reloadPage' ? 506 : _context18.t0 === 'reloadPlanner' ? 511 : _context18.t0 === 'runTableAction' ? 525 : _context18.t0 === 'readColumnOptions' ? 736 : _context18.t0 === 'clearGridFilter' ? 793 : 798;
84118
+ _context18.next = _context18.t0 === 'listViews' ? 6 : _context18.t0 === 'navigateTo' ? 8 : _context18.t0 === 'listGrids' ? 24 : _context18.t0 === 'locateRow' ? 25 : _context18.t0 === 'openToolbarTool' ? 114 : _context18.t0 === 'readGridRows' ? 120 : _context18.t0 === 'stageTableEdits' ? 167 : _context18.t0 === 'reloadPage' ? 543 : _context18.t0 === 'reloadPlanner' ? 548 : _context18.t0 === 'runTableAction' ? 562 : _context18.t0 === 'readColumnOptions' ? 773 : _context18.t0 === 'clearGridFilter' ? 830 : 835;
83913
84119
  break;
83914
84120
  case 6:
83915
84121
  _allViews2 = allViews(root, ctx), views = _allViews2.views, editorSubviews = _allViews2.editorSubviews;
@@ -83972,11 +84178,11 @@ function createNavigationToolset(ctx) {
83972
84178
  var api = handle === null || handle === void 0 ? void 0 : handle.getGridApi();
83973
84179
  var divaDefs = (_handle$getDivaColumn4 = handle === null || handle === void 0 ? void 0 : handle.getDivaColumnDefs()) !== null && _handle$getDivaColumn4 !== void 0 ? _handle$getDivaColumn4 : [];
83974
84180
  // Hidden columns are internal storage (raw maps, org scoping) — not an editing surface.
83975
- var columns = agentColumns(api, divaDefs).map(function (_ref15) {
83976
- var id = _ref15.id,
83977
- header = _ref15.header,
83978
- groupHeader = _ref15.groupHeader,
83979
- divaDef = _ref15.divaDef;
84181
+ var columns = agentColumns(api, divaDefs).map(function (_ref14) {
84182
+ var id = _ref14.id,
84183
+ header = _ref14.header,
84184
+ groupHeader = _ref14.groupHeader,
84185
+ divaDef = _ref14.divaDef;
83980
84186
  return _objectSpread$5({
83981
84187
  field: id,
83982
84188
  // Both halves go through t(): a group header can be a translation key just as a column header can.
@@ -83993,9 +84199,9 @@ function createNavigationToolset(ctx) {
83993
84199
  description: "Adds a table COLUMN via the '".concat(def.field, "' header control (writes the parent entity's ").concat(def.field, "): input = ONE key \u2014 readColumnOptions('").concat(def.field, "') lists the addable entries (already-added ones are excluded).")
83994
84200
  };
83995
84201
  });
83996
- actions.push.apply(actions, _toConsumableArray(((_entry$getActions3 = (_entry$getActions4 = entry.getActions) === null || _entry$getActions4 === void 0 ? void 0 : _entry$getActions4.call(entry)) !== null && _entry$getActions3 !== void 0 ? _entry$getActions3 : []).map(function (_ref16) {
83997
- var name = _ref16.name,
83998
- description = _ref16.description;
84202
+ actions.push.apply(actions, _toConsumableArray(((_entry$getActions3 = (_entry$getActions4 = entry.getActions) === null || _entry$getActions4 === void 0 ? void 0 : _entry$getActions4.call(entry)) !== null && _entry$getActions3 !== void 0 ? _entry$getActions3 : []).map(function (_ref15) {
84203
+ var name = _ref15.name,
84204
+ description = _ref15.description;
83999
84205
  return {
84000
84206
  name: name,
84001
84207
  description: description
@@ -84294,7 +84500,8 @@ function createNavigationToolset(ctx) {
84294
84500
  truncatedColumns.push(column);
84295
84501
  return "".concat(json.slice(0, 120), "\u2026");
84296
84502
  };
84297
- leafFields = agentColumns(_api, (_entry$getHandle$getD = (_entry$getHandle2 = _entry.getHandle()) === null || _entry$getHandle2 === void 0 ? void 0 : _entry$getHandle2.getDivaColumnDefs()) !== null && _entry$getHandle$getD !== void 0 ? _entry$getHandle$getD : []).map(function (column) {
84503
+ divaDefs = (_entry$getHandle$getD = (_entry$getHandle2 = _entry.getHandle()) === null || _entry$getHandle2 === void 0 ? void 0 : _entry$getHandle2.getDivaColumnDefs()) !== null && _entry$getHandle$getD !== void 0 ? _entry$getHandle$getD : [];
84504
+ leafFields = agentColumns(_api, divaDefs).map(function (column) {
84298
84505
  return column.id;
84299
84506
  });
84300
84507
  _requested = Array.isArray(input === null || input === void 0 ? void 0 : input.columns) ? input.columns.map(String) : undefined;
@@ -84317,25 +84524,26 @@ function createNavigationToolset(ctx) {
84317
84524
  if ((_api$getDisplayedRowA = _api.getDisplayedRowAtIndex(i)) !== null && _api$getDisplayedRowA !== void 0 && (_api$getDisplayedRowA = _api$getDisplayedRowA.data) !== null && _api$getDisplayedRowA !== void 0 && (_api$getDisplayedRowA = _api$getDisplayedRowA.__diva_context) !== null && _api$getDisplayedRowA !== void 0 && _api$getDisplayedRowA.isNew) unsavedRowCount += 1;
84318
84525
  }
84319
84526
  _i3 = 0;
84320
- case 147:
84527
+ case 148:
84321
84528
  if (!(_i3 < displayed && _rows.length < limit)) {
84322
- _context18.next = 159;
84529
+ _context18.next = 160;
84323
84530
  break;
84324
84531
  }
84325
84532
  node = _api.getDisplayedRowAtIndex(_i3);
84326
84533
  if (!(!isRealRow(node) || !node.id)) {
84327
- _context18.next = 151;
84534
+ _context18.next = 152;
84328
84535
  break;
84329
84536
  }
84330
- return _context18.abrupt("continue", 156);
84331
- case 151:
84537
+ return _context18.abrupt("continue", 157);
84538
+ case 152:
84332
84539
  values = {};
84333
84540
  truncatedColumns = [];
84334
84541
  _iterator5 = _createForOfIteratorHelper$1(columns);
84335
84542
  try {
84336
84543
  for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
84337
84544
  column = _step5.value;
84338
- values[column] = previewCell(column, cellValueOf(_api, node, column), truncatedColumns);
84545
+ raw = cellValueOf(_api, node, column); // The stored SET_POS_COUNT_VALUE:n form reads like a decision action; the number is what gets written back.
84546
+ values[column] = isPosCountActionsColumn(divaDefOf(divaDefs, column)) ? posCountOf(raw) : previewCell(column, raw, truncatedColumns);
84339
84547
  }
84340
84548
  } catch (err) {
84341
84549
  _iterator5.e(err);
@@ -84348,12 +84556,11 @@ function createNavigationToolset(ctx) {
84348
84556
  }, truncatedColumns.length ? {
84349
84557
  truncatedColumns: truncatedColumns
84350
84558
  } : {}));
84351
- case 156:
84559
+ case 157:
84352
84560
  _i3++;
84353
- _context18.next = 147;
84561
+ _context18.next = 148;
84354
84562
  break;
84355
- case 159:
84356
- divaDefs = (_entry$getHandle$getD2 = (_entry$getHandle3 = _entry.getHandle()) === null || _entry$getHandle3 === void 0 ? void 0 : _entry$getHandle3.getDivaColumnDefs()) !== null && _entry$getHandle$getD2 !== void 0 ? _entry$getHandle$getD2 : [];
84563
+ case 160:
84357
84564
  columnMeta = columns.map(function (field) {
84358
84565
  return _objectSpread$5({
84359
84566
  column: field
@@ -84363,7 +84570,7 @@ function createNavigationToolset(ctx) {
84363
84570
  }); // `displayed` covers ALL known server rows incl. unloaded stubs; rows.length would undercount big tables.
84364
84571
  lastNode = displayed ? _api.getDisplayedRowAtIndex(displayed - 1) : null;
84365
84572
  totalRowCount = displayed && lastNode !== null && lastNode !== void 0 && (_lastNode$data = lastNode.data) !== null && _lastNode$data !== void 0 && (_lastNode$data = _lastNode$data.__diva_context) !== null && _lastNode$data !== void 0 && _lastNode$data.isEmpty ? displayed - 1 : displayed; // totalRowCount counts DISPLAYED rows, so an unreconciled optimistic row inflates it.
84366
- dirty = (_entry$getHandle$hasP = (_entry$getHandle4 = _entry.getHandle()) === null || _entry$getHandle4 === void 0 ? void 0 : _entry$getHandle4.hasPendingChanges()) !== null && _entry$getHandle$hasP !== void 0 ? _entry$getHandle$hasP : false; // An active filter makes totalRowCount the FILTERED count — without naming it, the number reads as the table size.
84573
+ dirty = (_entry$getHandle$hasP = (_entry$getHandle3 = _entry.getHandle()) === null || _entry$getHandle3 === void 0 ? void 0 : _entry$getHandle3.hasPendingChanges()) !== null && _entry$getHandle$hasP !== void 0 ? _entry$getHandle$hasP : false; // An active filter makes totalRowCount the FILTERED count — without naming it, the number reads as the table size.
84367
84574
  filterModel = (_api$getFilterModel = _api.getFilterModel()) !== null && _api$getFilterModel !== void 0 ? _api$getFilterModel : {};
84368
84575
  filteredBy = Object.keys(filterModel);
84369
84576
  return _context18.abrupt("return", _objectSpread$5(_objectSpread$5(_objectSpread$5(_objectSpread$5(_objectSpread$5(_objectSpread$5(_objectSpread$5({
@@ -84415,7 +84622,36 @@ function createNavigationToolset(ctx) {
84415
84622
  error: "Unknown parameter(s) ".concat(hints.join(', '), ". stageTableEdits takes: ").concat(KNOWN_KEYS.join(', '), ". Nothing was staged.")
84416
84623
  });
84417
84624
  case 173:
84418
- edits = Array.isArray(input === null || input === void 0 ? void 0 : input.edits) ? input.edits : []; // Entries without the `values` wrapper are unambiguous — treat the entry AS the values.
84625
+ edits = Array.isArray(input === null || input === void 0 ? void 0 : input.edits) ? input.edits : []; // A missing `newValue` would coerce to '' — the documented "clear the cell" — and wipe the cell in silence.
84626
+ EDIT_KEYS = ['rowId', 'keyColumn', 'keyValue', 'column', 'newValue'];
84627
+ EDIT_ALIASES = {
84628
+ value: 'newValue',
84629
+ field: 'column',
84630
+ id: 'rowId'
84631
+ };
84632
+ editFaults = edits.flatMap(function (edit, index) {
84633
+ var keys = Object.keys(edit !== null && edit !== void 0 ? edit : {});
84634
+ var unknown = keys.filter(function (key) {
84635
+ return !EDIT_KEYS.includes(key);
84636
+ }).map(function (key) {
84637
+ return EDIT_ALIASES[key] ? "'".concat(key, "' \u2192 '").concat(EDIT_ALIASES[key], "'") : "'".concat(key, "'");
84638
+ });
84639
+ var missing = ['column', 'newValue'].filter(function (key) {
84640
+ return (edit === null || edit === void 0 ? void 0 : edit[key]) === undefined;
84641
+ });
84642
+ if (!unknown.length && !missing.length) return [];
84643
+ var faults = [missing.length ? "is missing ".concat(missing.join(' and ')) : '', unknown.length ? "has unknown key(s) ".concat(unknown.join(', ')) : ''];
84644
+ return ["edits[".concat(index, "] ").concat(faults.filter(Boolean).join(' and '))];
84645
+ });
84646
+ if (!editFaults.length) {
84647
+ _context18.next = 179;
84648
+ break;
84649
+ }
84650
+ return _context18.abrupt("return", {
84651
+ error: "".concat(editFaults.join('; '), ". Each edit takes: ").concat(EDIT_KEYS.join(', '), " \u2014 newValue is required (an empty string clears the cell). Nothing was staged.")
84652
+ });
84653
+ case 179:
84654
+ // Entries without the `values` wrapper are unambiguous — treat the entry AS the values.
84419
84655
  addRows = (Array.isArray(input === null || input === void 0 ? void 0 : input.addRows) ? input.addRows : []).map(function (row) {
84420
84656
  return row && _typeof(row) === 'object' && !('values' in row) && Object.keys(row).length ? {
84421
84657
  values: row
@@ -84424,56 +84660,123 @@ function createNavigationToolset(ctx) {
84424
84660
  removeRowIds = _toConsumableArray(new Set((Array.isArray(input === null || input === void 0 ? void 0 : input.removeRowIds) ? input.removeRowIds : []).map(String)));
84425
84661
  removeRows = Array.isArray(input === null || input === void 0 ? void 0 : input.removeRows) ? input.removeRows : [];
84426
84662
  if (!(!edits.length && !addRows.length && !removeRowIds.length && !removeRows.length)) {
84427
- _context18.next = 179;
84663
+ _context18.next = 184;
84428
84664
  break;
84429
84665
  }
84430
84666
  throw new Error('Provide edits: [{rowId | keyColumn+keyValue, column, newValue}], addRows: [{values}], removeRowIds and/or removeRows: [{keyColumn, keyValue}] — key addressing locates the row for you (unique value of any column), rowIds come from readGridRows.');
84431
- case 179:
84432
- _context18.next = 181;
84667
+ case 184:
84668
+ _context18.next = 186;
84433
84669
  return applyParentRowPrelude(input, args);
84434
- case 181:
84670
+ case 186:
84435
84671
  _prelude = _context18.sent;
84436
84672
  if (!_prelude) {
84437
- _context18.next = 184;
84673
+ _context18.next = 189;
84438
84674
  break;
84439
84675
  }
84440
84676
  return _context18.abrupt("return", _prelude);
84441
- case 184:
84677
+ case 189:
84442
84678
  _resolveGrid3 = resolveGrid(args.grid), _entry2 = _resolveGrid3.entry, _api2 = _resolveGrid3.api, _error2 = _resolveGrid3.error;
84443
84679
  if (!(_error2 || !_api2 || !_entry2)) {
84444
- _context18.next = 187;
84680
+ _context18.next = 192;
84445
84681
  break;
84446
84682
  }
84447
84683
  return _context18.abrupt("return", {
84448
84684
  error: _error2
84449
84685
  });
84450
- case 187:
84686
+ case 192:
84451
84687
  handle = _entry2.getHandle();
84452
84688
  if (handle) {
84453
- _context18.next = 190;
84689
+ _context18.next = 195;
84454
84690
  break;
84455
84691
  }
84456
84692
  return _context18.abrupt("return", {
84457
84693
  error: "Table '".concat(_entry2.label, "' is not ready.")
84458
84694
  });
84459
- case 190:
84695
+ case 195:
84460
84696
  if (!handle.hasPendingChanges()) {
84461
- _context18.next = 192;
84697
+ _context18.next = 197;
84462
84698
  break;
84463
84699
  }
84464
84700
  throw new Error('This table already has uncommitted (staged) changes — wait for the pending decision or ask the user to save/discard their manual edits first.');
84465
- case 192:
84701
+ case 197:
84702
+ // Without parentRow the write lands under the parent the subtable is bound to — the one an earlier call left
84703
+ // selected. Only the subtable's own declaration names it; without one the write is refused, never guessed.
84704
+ explicitParentRow = !!(input !== null && input !== void 0 && input.parentRow); // Mount order is the fallback for a subtable whose module declares no parent (media refs, the assortment item
84705
+ // groups): it keeps the SUBTABLE note, only its parent row cannot be named.
84706
+ mountedAfterFirst = root.gridRegistry.entries.findIndex(function (candidate) {
84707
+ return candidate.label === _entry2.label;
84708
+ }) > 0;
84709
+ isSubtable = explicitParentRow || !!_entry2.getBoundParent || mountedAfterFirst;
84710
+ parentBinding = explicitParentRow ? undefined : declaredParentBinding(_entry2);
84711
+ if (!(parentBinding !== null && parentBinding !== void 0 && parentBinding.refusal)) {
84712
+ _context18.next = 203;
84713
+ break;
84714
+ }
84715
+ return _context18.abrupt("return", {
84716
+ error: parentBinding.refusal
84717
+ });
84718
+ case 203:
84719
+ boundParentRow = parentBinding === null || parentBinding === void 0 ? void 0 : parentBinding.parent;
84720
+ parentBindingNote = boundParentRow ? " SUBTABLE WRITE WITHOUT parentRow: bound to the parent row this subtable is showing \u2014 '".concat(boundParentRow.grid, "' ").concat(boundParentRow.column, " = '").concat(boundParentRow.value, "' (boundParentRow). Verify that is the intended parent; pass parentRow to bind explicitly.") : mountedAfterFirst && !explicitParentRow && !_entry2.getBoundParent ? ' SUBTABLE WRITE WITHOUT parentRow: this table declares no parent binding, so the parent row it landed under cannot be named here — verify it in the table before building on the write.' : ''; // A record _id offered as rowId — partlistpos hands the _id out AS the rowId, and locateRow.firstRow._id is the
84721
+ // same value — is a valid address once its node is loaded. When it is not (the subtable re-rendered, a filter
84722
+ // reset), refusing it as "not a grid rowId" is circular: address it by the `_id` column instead, so the
84723
+ // key machinery below locates it server-side like any other key.
84724
+ idColumnPresent = !!_api2.getColumnDef('_id');
84725
+ isUnloadedRecordId = function isUnloadedRecordId(rowId) {
84726
+ return idColumnPresent && typeof rowId === 'string' && isRecordId(rowId) && !isRealRow(_api2.getRowNode(rowId));
84727
+ };
84728
+ reroutedRecordIds = 0;
84729
+ _iterator6 = _createForOfIteratorHelper$1(edits);
84730
+ try {
84731
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
84732
+ _edit2 = _step6.value;
84733
+ if ((_edit2 === null || _edit2 === void 0 ? void 0 : _edit2.rowId) != null && isUnloadedRecordId(String(_edit2.rowId))) {
84734
+ _edit2.keyColumn = '_id';
84735
+ _edit2.keyValue = String(_edit2.rowId);
84736
+ delete _edit2.rowId;
84737
+ reroutedRecordIds += 1;
84738
+ }
84739
+ }
84740
+ } catch (err) {
84741
+ _iterator6.e(err);
84742
+ } finally {
84743
+ _iterator6.f();
84744
+ }
84745
+ _i4 = 0, _arr2 = _toConsumableArray(removeRowIds);
84746
+ case 211:
84747
+ if (!(_i4 < _arr2.length)) {
84748
+ _context18.next = 221;
84749
+ break;
84750
+ }
84751
+ rowId = _arr2[_i4];
84752
+ if (isUnloadedRecordId(rowId)) {
84753
+ _context18.next = 215;
84754
+ break;
84755
+ }
84756
+ return _context18.abrupt("continue", 218);
84757
+ case 215:
84758
+ removeRowIds.splice(removeRowIds.indexOf(rowId), 1);
84759
+ removeRows.push({
84760
+ keyColumn: '_id',
84761
+ keyValue: rowId
84762
+ });
84763
+ reroutedRecordIds += 1;
84764
+ case 218:
84765
+ _i4++;
84766
+ _context18.next = 211;
84767
+ break;
84768
+ case 221:
84466
84769
  // Hard stop for CREATES when the serie scope is unresolved — the row would be filed wherever the endpoint defaults to.
84467
84770
  serieScope = serieScopeOf(_entry2, handle);
84468
84771
  if (!(addRows.length && serieScope && !serieScope.serieId)) {
84469
- _context18.next = 195;
84772
+ _context18.next = 224;
84470
84773
  break;
84471
84774
  }
84472
84775
  return _context18.abrupt("return", {
84473
84776
  error: "'".concat(_entry2.label, "' belongs to ONE serie (its endpoint is /series/<id>/\u2026) and NO serie is selected, so a new row would be filed wherever the view defaults to \u2014 usually the FIRST serie (serie 0, the components serie). Nothing was staged."),
84474
84777
  fix: 'selectSerie(<serieNo>) first — listSeries shows the numbers and the current selection — then re-send this call unchanged.'
84475
84778
  });
84476
- case 195:
84779
+ case 224:
84477
84780
  fmt = function fmt(v) {
84478
84781
  return v == null ? undefined : _typeof(v) === 'object' ? JSON.stringify(v).slice(0, 80) : v;
84479
84782
  }; // The AG col def loses the DIVA custom props (editable/required/customParams) — check the DIVA def too.
@@ -84555,12 +84858,12 @@ function createNavigationToolset(ctx) {
84555
84858
  };
84556
84859
  var multi = !!(divaDef !== null && divaDef !== void 0 && (_divaDef$customParams7 = divaDef.customParams) !== null && _divaDef$customParams7 !== void 0 && _divaDef$customParams7.multiple);
84557
84860
  var resolve = function resolve(token) {
84558
- var _ref17, _enumData$find;
84559
- return (_ref17 = (_enumData$find = enumData.find(function (e) {
84861
+ var _ref16, _enumData$find;
84862
+ return (_ref16 = (_enumData$find = enumData.find(function (e) {
84560
84863
  return String(e === null || e === void 0 ? void 0 : e.value) === token;
84561
84864
  })) !== null && _enumData$find !== void 0 ? _enumData$find : enumData.find(function (e) {
84562
84865
  return String(e === null || e === void 0 ? void 0 : e.value).toLowerCase() === token.toLowerCase();
84563
- })) !== null && _ref17 !== void 0 ? _ref17 : enumData.find(function (e) {
84866
+ })) !== null && _ref16 !== void 0 ? _ref16 : enumData.find(function (e) {
84564
84867
  return String(e === null || e === void 0 ? void 0 : e.name).toLowerCase() === token.toLowerCase();
84565
84868
  });
84566
84869
  };
@@ -84587,6 +84890,21 @@ function createNavigationToolset(ctx) {
84587
84890
  }).join(',')
84588
84891
  };
84589
84892
  }
84893
+ // partlistpos.actions is the position COUNT: its own parser wraps the bare number into SET_POS_COUNT_VALUE:n, so
84894
+ // the decision grammar below would reject every valid input (measured: '1', "1" and the stored form all refused).
84895
+ if (column === 'actions' && raw !== '' && isPosCountActionsColumn(divaDef)) {
84896
+ var count = /^(?:SET_POS_COUNT_VALUE:)?\s*(\d+)\s*$/.exec(raw.trim());
84897
+ if (!count) {
84898
+ return {
84899
+ ok: false,
84900
+ error: "Column 'actions' on '".concat(_entry2.label, "' is the POSITION COUNT \u2014 write the bare number ('1'; '0' for a conditioned position). It is stored as SET_POS_COUNT_VALUE:<n>, which is what readGridRows shows. '").concat(raw, "' is not a count.")
84901
+ };
84902
+ }
84903
+ return {
84904
+ ok: true,
84905
+ text: count[1]
84906
+ };
84907
+ }
84590
84908
  if (column === 'actions' && raw !== '') {
84591
84909
  // Validate against the real codec so an invented verb fails here instead of being stored as a dead row.
84592
84910
  var _tokens = raw.split(';').map(function (s) {
@@ -84645,7 +84963,7 @@ function createNavigationToolset(ctx) {
84645
84963
  };
84646
84964
  /** The table's own write path; a refusal comes back as the message the agent reports. */
84647
84965
  writeCell = /*#__PURE__*/function () {
84648
- var _ref18 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(rowId, column, text) {
84966
+ var _ref17 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(rowId, column, text) {
84649
84967
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
84650
84968
  while (1) switch (_context2.prev = _context2.next) {
84651
84969
  case 0:
@@ -84676,7 +84994,7 @@ function createNavigationToolset(ctx) {
84676
84994
  }, _callee2, null, [[0, 7]]);
84677
84995
  }));
84678
84996
  return function writeCell(_x11, _x12, _x13) {
84679
- return _ref18.apply(this, arguments);
84997
+ return _ref17.apply(this, arguments);
84680
84998
  };
84681
84999
  }();
84682
85000
  isLookupColumn = function isLookupColumn(column) {
@@ -84684,7 +85002,7 @@ function createNavigationToolset(ctx) {
84684
85002
  return ((_divaDefOf = divaDefOf(_divaDefs, column)) === null || _divaDefOf === void 0 ? void 0 : _divaDefOf.cellDataType) === 'lookup';
84685
85003
  };
84686
85004
  lookupWrite = /*#__PURE__*/function () {
84687
- var _ref19 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(column, raw, rowData) {
85005
+ var _ref18 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(column, raw, rowData) {
84688
85006
  var _divaDefs$find2;
84689
85007
  var multiple, normalizedRaw, parsed, keys, _yield$handle$resolve, data, resolved, _missing, candidates, valueForLabel, corrected, _yield$handle$resolve2, separatorHint, candidateList, candidateHint;
84690
85008
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
@@ -84795,7 +85113,7 @@ function createNavigationToolset(ctx) {
84795
85113
  }, _callee3, null, [[6, 35]]);
84796
85114
  }));
84797
85115
  return function lookupWrite(_x14, _x15, _x16) {
84798
- return _ref19.apply(this, arguments);
85116
+ return _ref18.apply(this, arguments);
84799
85117
  };
84800
85118
  }();
84801
85119
  staged = [];
@@ -84821,7 +85139,7 @@ function createNavigationToolset(ctx) {
84821
85139
  }; // Key addressing: loose (contains) or multiple matches are rejected — edits must never hit the wrong row.
84822
85140
  keyCache = new Map();
84823
85141
  resolveByKey = /*#__PURE__*/function () {
84824
- var _ref20 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(keyColumn, keyValue) {
85142
+ var _ref19 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(keyColumn, keyValue) {
84825
85143
  var label, cacheKey, cached, located, matches, exact;
84826
85144
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
84827
85145
  while (1) switch (_context4.prev = _context4.next) {
@@ -84903,11 +85221,11 @@ function createNavigationToolset(ctx) {
84903
85221
  }, _callee4, null, [[5, 11]]);
84904
85222
  }));
84905
85223
  return function resolveByKey(_x17, _x18) {
84906
- return _ref20.apply(this, arguments);
85224
+ return _ref19.apply(this, arguments);
84907
85225
  };
84908
85226
  }();
84909
85227
  resolveTarget = /*#__PURE__*/function () {
84910
- var _ref21 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(address) {
85228
+ var _ref20 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(address) {
84911
85229
  var rowId, _node, keyColumn, keyValue;
84912
85230
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
84913
85231
  while (1) switch (_context5.prev = _context5.next) {
@@ -84933,7 +85251,7 @@ function createNavigationToolset(ctx) {
84933
85251
  }
84934
85252
  return _context5.abrupt("return", {
84935
85253
  label: rowId,
84936
- error: "'".concat(rowId, "' is a record _id, not a grid rowId \u2014 address the row by keyColumn/keyValue (a unique cell value), or readGridRows for its rowId.")
85254
+ error: "'".concat(rowId, "' is a record _id, not a grid rowId, and this table has no _id column to look it up by \u2014 address the row by keyColumn/keyValue (a unique cell value), or readGridRows for its rowId.")
84937
85255
  });
84938
85256
  case 7:
84939
85257
  return _context5.abrupt("return", {
@@ -84960,12 +85278,12 @@ function createNavigationToolset(ctx) {
84960
85278
  }, _callee5);
84961
85279
  }));
84962
85280
  return function resolveTarget(_x19) {
84963
- return _ref21.apply(this, arguments);
85281
+ return _ref20.apply(this, arguments);
84964
85282
  };
84965
85283
  }();
84966
85284
  /** Apply one column edit to an already-resolved row — shared by the direct loop and the sequential lookup path below. */
84967
85285
  applyEditToNode = /*#__PURE__*/function () {
84968
- var _ref22 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(node, rowId, column, rawNewValue) {
85286
+ var _ref21 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(node, rowId, column, rawNewValue) {
84969
85287
  var _node$data2, _api2$getRowNode;
84970
85288
  var from, _node$data, _res$data$column, res, _ok, check, ok;
84971
85289
  return _regeneratorRuntime.wrap(function _callee6$(_context6) {
@@ -85065,7 +85383,7 @@ function createNavigationToolset(ctx) {
85065
85383
  }, _callee6);
85066
85384
  }));
85067
85385
  return function applyEditToNode(_x20, _x21, _x22, _x23) {
85068
- return _ref22.apply(this, arguments);
85386
+ return _ref21.apply(this, arguments);
85069
85387
  };
85070
85388
  }(); // --- Multiple EXISTING rows addressed by keyColumn/keyValue, none of them already loaded on screen
85071
85389
  // (the prices grid, and generally any table bigger than its initial window): each such lookup goes
@@ -85102,13 +85420,13 @@ function createNavigationToolset(ctx) {
85102
85420
  return "".concat(keyColumn, "\0").concat(keyValue);
85103
85421
  };
85104
85422
  lookupKeys = new Map();
85105
- _iterator6 = _createForOfIteratorHelper$1(edits);
85423
+ _iterator7 = _createForOfIteratorHelper$1(edits);
85106
85424
  try {
85107
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
85108
- _edit2 = _step6.value;
85109
- if ((_edit2 === null || _edit2 === void 0 ? void 0 : _edit2.rowId) == null && (_edit2 === null || _edit2 === void 0 ? void 0 : _edit2.keyColumn) != null && (_edit2 === null || _edit2 === void 0 ? void 0 : _edit2.keyValue) != null) {
85110
- _keyColumn2 = String(_edit2.keyColumn);
85111
- _keyValue2 = String(_edit2.keyValue);
85425
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
85426
+ _edit3 = _step7.value;
85427
+ if ((_edit3 === null || _edit3 === void 0 ? void 0 : _edit3.rowId) == null && (_edit3 === null || _edit3 === void 0 ? void 0 : _edit3.keyColumn) != null && (_edit3 === null || _edit3 === void 0 ? void 0 : _edit3.keyValue) != null) {
85428
+ _keyColumn2 = String(_edit3.keyColumn);
85429
+ _keyValue2 = String(_edit3.keyValue);
85112
85430
  if (needsServerLookup(_keyColumn2, _keyValue2)) lookupKeys.set(lookupKeyOf(_keyColumn2, _keyValue2), {
85113
85431
  keyColumn: _keyColumn2,
85114
85432
  keyValue: _keyValue2
@@ -85116,14 +85434,14 @@ function createNavigationToolset(ctx) {
85116
85434
  }
85117
85435
  }
85118
85436
  } catch (err) {
85119
- _iterator6.e(err);
85437
+ _iterator7.e(err);
85120
85438
  } finally {
85121
- _iterator6.f();
85439
+ _iterator7.f();
85122
85440
  }
85123
- _iterator7 = _createForOfIteratorHelper$1(removeRows);
85441
+ _iterator8 = _createForOfIteratorHelper$1(removeRows);
85124
85442
  try {
85125
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
85126
- _removal = _step7.value;
85443
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
85444
+ _removal = _step8.value;
85127
85445
  if ((_removal === null || _removal === void 0 ? void 0 : _removal.keyColumn) != null && (_removal === null || _removal === void 0 ? void 0 : _removal.keyValue) != null) {
85128
85446
  _keyColumn3 = String(_removal.keyColumn);
85129
85447
  _keyValue3 = String(_removal.keyValue);
@@ -85137,15 +85455,15 @@ function createNavigationToolset(ctx) {
85137
85455
  // rows that were loaded at that point. So once any key needs the server, every key-addressed row goes
85138
85456
  // through the per-row path: a row that is still loaded resolves there without touching the filter.
85139
85457
  } catch (err) {
85140
- _iterator7.e(err);
85458
+ _iterator8.e(err);
85141
85459
  } finally {
85142
- _iterator7.f();
85460
+ _iterator8.f();
85143
85461
  }
85144
85462
  if (lookupKeys.size > 0) {
85145
- _iterator8 = _createForOfIteratorHelper$1(edits);
85463
+ _iterator9 = _createForOfIteratorHelper$1(edits);
85146
85464
  try {
85147
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
85148
- edit = _step8.value;
85465
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
85466
+ edit = _step9.value;
85149
85467
  if ((edit === null || edit === void 0 ? void 0 : edit.rowId) == null && (edit === null || edit === void 0 ? void 0 : edit.keyColumn) != null && (edit === null || edit === void 0 ? void 0 : edit.keyValue) != null) {
85150
85468
  keyColumn = String(edit.keyColumn);
85151
85469
  keyValue = String(edit.keyValue);
@@ -85156,14 +85474,14 @@ function createNavigationToolset(ctx) {
85156
85474
  }
85157
85475
  }
85158
85476
  } catch (err) {
85159
- _iterator8.e(err);
85477
+ _iterator9.e(err);
85160
85478
  } finally {
85161
- _iterator8.f();
85479
+ _iterator9.f();
85162
85480
  }
85163
- _iterator9 = _createForOfIteratorHelper$1(removeRows);
85481
+ _iterator10 = _createForOfIteratorHelper$1(removeRows);
85164
85482
  try {
85165
- for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
85166
- removal = _step9.value;
85483
+ for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
85484
+ removal = _step10.value;
85167
85485
  if ((removal === null || removal === void 0 ? void 0 : removal.keyColumn) != null && (removal === null || removal === void 0 ? void 0 : removal.keyValue) != null) {
85168
85486
  _keyColumn = String(removal.keyColumn);
85169
85487
  _keyValue = String(removal.keyValue);
@@ -85174,9 +85492,9 @@ function createNavigationToolset(ctx) {
85174
85492
  }
85175
85493
  }
85176
85494
  } catch (err) {
85177
- _iterator9.e(err);
85495
+ _iterator10.e(err);
85178
85496
  } finally {
85179
- _iterator9.f();
85497
+ _iterator10.f();
85180
85498
  }
85181
85499
  }
85182
85500
  mergedOutcome = {
@@ -85185,32 +85503,33 @@ function createNavigationToolset(ctx) {
85185
85503
  skipped: []
85186
85504
  };
85187
85505
  mergeCommitOutcome = function mergeCommitOutcome(incoming) {
85188
- var _mergedOutcome$commit, _mergedOutcome$failed, _mergedOutcome$skippe;
85506
+ var _mergedOutcome$commit, _mergedOutcome$create, _mergedOutcome$failed, _mergedOutcome$skippe;
85189
85507
  if (!incoming) return;
85190
85508
  (_mergedOutcome$commit = mergedOutcome.committed).push.apply(_mergedOutcome$commit, _toConsumableArray(incoming.committed));
85509
+ if (incoming.createdIds) mergedOutcome.createdIds = _objectSpread$5(_objectSpread$5({}, (_mergedOutcome$create = mergedOutcome.createdIds) !== null && _mergedOutcome$create !== void 0 ? _mergedOutcome$create : {}), incoming.createdIds);
85191
85510
  (_mergedOutcome$failed = mergedOutcome.failed).push.apply(_mergedOutcome$failed, _toConsumableArray(incoming.failed));
85192
85511
  (_mergedOutcome$skippe = mergedOutcome.skipped).push.apply(_mergedOutcome$skippe, _toConsumableArray(incoming.skipped));
85193
85512
  };
85194
85513
  preApproved = false;
85195
85514
  if (!(lookupKeys.size > 0)) {
85196
- _context18.next = 265;
85515
+ _context18.next = 294;
85197
85516
  break;
85198
85517
  }
85199
85518
  intendedCount = edits.length + addRows.length + removeRowIds.length + removeRows.length;
85200
85519
  if (!ctx.autoApprove) awaitingApproval();
85201
85520
  _context18.t5 = ctx.autoApprove;
85202
85521
  if (_context18.t5) {
85203
- _context18.next = 236;
85522
+ _context18.next = 265;
85204
85523
  break;
85205
85524
  }
85206
- _context18.next = 235;
85525
+ _context18.next = 264;
85207
85526
  return _entry2.requestAgentApproval(intendedCount, "".concat(intendedCount, " change(s) \u2014 ").concat(lookupKeys.size, " row(s) must be located first"), signal);
85208
- case 235:
85527
+ case 264:
85209
85528
  _context18.t5 = _context18.sent;
85210
- case 236:
85529
+ case 265:
85211
85530
  _approved = _context18.t5;
85212
85531
  if (_approved) {
85213
- _context18.next = 240;
85532
+ _context18.next = 269;
85214
85533
  break;
85215
85534
  }
85216
85535
  restoreUserFilter();
@@ -85219,16 +85538,16 @@ function createNavigationToolset(ctx) {
85219
85538
  stagedCount: 0,
85220
85539
  note: 'The user DECLINED the change — nothing was staged or saved. Do not retry; ask what to do instead.'
85221
85540
  });
85222
- case 240:
85541
+ case 269:
85223
85542
  preApproved = true;
85224
- _iterator10 = _createForOfIteratorHelper$1(lookupKeys.values());
85225
- _context18.prev = 242;
85543
+ _iterator11 = _createForOfIteratorHelper$1(lookupKeys.values());
85544
+ _context18.prev = 271;
85226
85545
  _loop2 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop2() {
85227
- var _step10$value, keyColumn, keyValue, target, _target$error, node, rowId, rowEdits, rowRemovals, _node$data3, _iterator11, _step11, _edit$column, _edit;
85546
+ var _step11$value, keyColumn, keyValue, target, _target$error, node, rowId, rowEdits, rowRemovals, _node$data3, _iterator12, _step12, _edit$column, _edit;
85228
85547
  return _regeneratorRuntime.wrap(function _loop2$(_context7) {
85229
85548
  while (1) switch (_context7.prev = _context7.next) {
85230
85549
  case 0:
85231
- _step10$value = _step10.value, keyColumn = _step10$value.keyColumn, keyValue = _step10$value.keyValue;
85550
+ _step11$value = _step11.value, keyColumn = _step11$value.keyColumn, keyValue = _step11$value.keyValue;
85232
85551
  _context7.next = 3;
85233
85552
  return resolveByKey(keyColumn, keyValue);
85234
85553
  case 3:
@@ -85278,15 +85597,15 @@ function createNavigationToolset(ctx) {
85278
85597
  _context7.next = 38;
85279
85598
  break;
85280
85599
  case 21:
85281
- _iterator11 = _createForOfIteratorHelper$1(rowEdits);
85600
+ _iterator12 = _createForOfIteratorHelper$1(rowEdits);
85282
85601
  _context7.prev = 22;
85283
- _iterator11.s();
85602
+ _iterator12.s();
85284
85603
  case 24:
85285
- if ((_step11 = _iterator11.n()).done) {
85604
+ if ((_step12 = _iterator12.n()).done) {
85286
85605
  _context7.next = 30;
85287
85606
  break;
85288
85607
  }
85289
- _edit = _step11.value;
85608
+ _edit = _step12.value;
85290
85609
  _context7.next = 28;
85291
85610
  return applyEditToNode(node, rowId, String((_edit$column = _edit === null || _edit === void 0 ? void 0 : _edit.column) !== null && _edit$column !== void 0 ? _edit$column : ''), _edit === null || _edit === void 0 ? void 0 : _edit.newValue);
85292
85611
  case 28:
@@ -85298,10 +85617,10 @@ function createNavigationToolset(ctx) {
85298
85617
  case 32:
85299
85618
  _context7.prev = 32;
85300
85619
  _context7.t0 = _context7["catch"](22);
85301
- _iterator11.e(_context7.t0);
85620
+ _iterator12.e(_context7.t0);
85302
85621
  case 35:
85303
85622
  _context7.prev = 35;
85304
- _iterator11.f();
85623
+ _iterator12.f();
85305
85624
  return _context7.finish(35);
85306
85625
  case 38:
85307
85626
  _context7.t1 = mergeCommitOutcome;
@@ -85316,117 +85635,117 @@ function createNavigationToolset(ctx) {
85316
85635
  }
85317
85636
  }, _loop2, null, [[22, 32, 35, 38]]);
85318
85637
  });
85319
- _iterator10.s();
85320
- case 245:
85321
- if ((_step10 = _iterator10.n()).done) {
85322
- _context18.next = 252;
85638
+ _iterator11.s();
85639
+ case 274:
85640
+ if ((_step11 = _iterator11.n()).done) {
85641
+ _context18.next = 281;
85323
85642
  break;
85324
85643
  }
85325
- return _context18.delegateYield(_loop2(), "t6", 247);
85326
- case 247:
85644
+ return _context18.delegateYield(_loop2(), "t6", 276);
85645
+ case 276:
85327
85646
  _ret2 = _context18.t6;
85328
85647
  if (!(_ret2 === 0)) {
85329
- _context18.next = 250;
85648
+ _context18.next = 279;
85330
85649
  break;
85331
85650
  }
85332
- return _context18.abrupt("continue", 250);
85333
- case 250:
85334
- _context18.next = 245;
85651
+ return _context18.abrupt("continue", 279);
85652
+ case 279:
85653
+ _context18.next = 274;
85335
85654
  break;
85336
- case 252:
85337
- _context18.next = 257;
85655
+ case 281:
85656
+ _context18.next = 286;
85338
85657
  break;
85339
- case 254:
85340
- _context18.prev = 254;
85341
- _context18.t7 = _context18["catch"](242);
85342
- _iterator10.e(_context18.t7);
85343
- case 257:
85344
- _context18.prev = 257;
85345
- _iterator10.f();
85346
- return _context18.finish(257);
85347
- case 260:
85658
+ case 283:
85659
+ _context18.prev = 283;
85660
+ _context18.t7 = _context18["catch"](271);
85661
+ _iterator11.e(_context18.t7);
85662
+ case 286:
85663
+ _context18.prev = 286;
85664
+ _iterator11.f();
85665
+ return _context18.finish(286);
85666
+ case 289:
85348
85667
  // Bring the loaded window back to what the caller had before more edits (possibly rowId-addressed,
85349
85668
  // always assumed already-loaded) rely on it — restoreUserFilter only mutates when a lookup above
85350
85669
  // actually changed something, and the grid needs a moment to settle after a filter change.
85351
85670
  filterWasChanged = keyFilterApplied;
85352
85671
  restoreUserFilter();
85353
85672
  if (!filterWasChanged) {
85354
- _context18.next = 265;
85673
+ _context18.next = 294;
85355
85674
  break;
85356
85675
  }
85357
- _context18.next = 265;
85676
+ _context18.next = 294;
85358
85677
  return waitForRows(_api2);
85359
- case 265:
85678
+ case 294:
85360
85679
  // Key-addressed removals resolve to rowIds before the edit loop (conflicts are checked against the final id list).
85361
85680
  // Rows already resolved+staged+committed by the sequential lookup pass above are skipped here.
85362
- _iterator12 = _createForOfIteratorHelper$1(removeRows);
85363
- _context18.prev = 266;
85364
- _iterator12.s();
85365
- case 268:
85366
- if ((_step12 = _iterator12.n()).done) {
85367
- _context18.next = 282;
85681
+ _iterator13 = _createForOfIteratorHelper$1(removeRows);
85682
+ _context18.prev = 295;
85683
+ _iterator13.s();
85684
+ case 297:
85685
+ if ((_step13 = _iterator13.n()).done) {
85686
+ _context18.next = 311;
85368
85687
  break;
85369
85688
  }
85370
- _removal2 = _step12.value;
85689
+ _removal2 = _step13.value;
85371
85690
  if (!((_removal2 === null || _removal2 === void 0 ? void 0 : _removal2.keyColumn) != null && (_removal2 === null || _removal2 === void 0 ? void 0 : _removal2.keyValue) != null && lookupKeys.has(lookupKeyOf(String(_removal2.keyColumn), String(_removal2.keyValue))))) {
85372
- _context18.next = 272;
85691
+ _context18.next = 301;
85373
85692
  break;
85374
85693
  }
85375
- return _context18.abrupt("continue", 280);
85376
- case 272:
85377
- _context18.next = 274;
85694
+ return _context18.abrupt("continue", 309);
85695
+ case 301:
85696
+ _context18.next = 303;
85378
85697
  return resolveTarget(_removal2);
85379
- case 274:
85698
+ case 303:
85380
85699
  _target2 = _context18.sent;
85381
85700
  if (!(_target2.error || !_target2.node)) {
85382
- _context18.next = 278;
85701
+ _context18.next = 307;
85383
85702
  break;
85384
85703
  }
85385
85704
  failed.push({
85386
85705
  rowId: _target2.label,
85387
85706
  error: (_target2$error = _target2.error) !== null && _target2$error !== void 0 ? _target2$error : 'Row not found.'
85388
85707
  });
85389
- return _context18.abrupt("continue", 280);
85390
- case 278:
85708
+ return _context18.abrupt("continue", 309);
85709
+ case 307:
85391
85710
  id = String(_target2.node.id);
85392
85711
  if (!removeRowIds.includes(id)) removeRowIds.push(id);
85393
- case 280:
85394
- _context18.next = 268;
85712
+ case 309:
85713
+ _context18.next = 297;
85395
85714
  break;
85396
- case 282:
85397
- _context18.next = 287;
85715
+ case 311:
85716
+ _context18.next = 316;
85398
85717
  break;
85399
- case 284:
85400
- _context18.prev = 284;
85401
- _context18.t8 = _context18["catch"](266);
85402
- _iterator12.e(_context18.t8);
85403
- case 287:
85404
- _context18.prev = 287;
85405
- _iterator12.f();
85406
- return _context18.finish(287);
85407
- case 290:
85408
- _iterator13 = _createForOfIteratorHelper$1(edits);
85409
- _context18.prev = 291;
85410
- _iterator13.s();
85411
- case 293:
85412
- if ((_step13 = _iterator13.n()).done) {
85413
- _context18.next = 313;
85718
+ case 313:
85719
+ _context18.prev = 313;
85720
+ _context18.t8 = _context18["catch"](295);
85721
+ _iterator13.e(_context18.t8);
85722
+ case 316:
85723
+ _context18.prev = 316;
85724
+ _iterator13.f();
85725
+ return _context18.finish(316);
85726
+ case 319:
85727
+ _iterator14 = _createForOfIteratorHelper$1(edits);
85728
+ _context18.prev = 320;
85729
+ _iterator14.s();
85730
+ case 322:
85731
+ if ((_step14 = _iterator14.n()).done) {
85732
+ _context18.next = 342;
85414
85733
  break;
85415
85734
  }
85416
- _edit3 = _step13.value;
85417
- if (!((_edit3 === null || _edit3 === void 0 ? void 0 : _edit3.rowId) == null && (_edit3 === null || _edit3 === void 0 ? void 0 : _edit3.keyColumn) != null && (_edit3 === null || _edit3 === void 0 ? void 0 : _edit3.keyValue) != null && lookupKeys.has(lookupKeyOf(String(_edit3.keyColumn), String(_edit3.keyValue))))) {
85418
- _context18.next = 297;
85735
+ _edit4 = _step14.value;
85736
+ if (!((_edit4 === null || _edit4 === void 0 ? void 0 : _edit4.rowId) == null && (_edit4 === null || _edit4 === void 0 ? void 0 : _edit4.keyColumn) != null && (_edit4 === null || _edit4 === void 0 ? void 0 : _edit4.keyValue) != null && lookupKeys.has(lookupKeyOf(String(_edit4.keyColumn), String(_edit4.keyValue))))) {
85737
+ _context18.next = 326;
85419
85738
  break;
85420
85739
  }
85421
- return _context18.abrupt("continue", 311);
85422
- case 297:
85423
- _column = String((_edit3$column = _edit3 === null || _edit3 === void 0 ? void 0 : _edit3.column) !== null && _edit3$column !== void 0 ? _edit3$column : '');
85424
- _context18.next = 300;
85425
- return resolveTarget(_edit3);
85426
- case 300:
85740
+ return _context18.abrupt("continue", 340);
85741
+ case 326:
85742
+ _column = String((_edit4$column = _edit4 === null || _edit4 === void 0 ? void 0 : _edit4.column) !== null && _edit4$column !== void 0 ? _edit4$column : '');
85743
+ _context18.next = 329;
85744
+ return resolveTarget(_edit4);
85745
+ case 329:
85427
85746
  _target3 = _context18.sent;
85428
85747
  if (!(_target3.error || !_target3.node)) {
85429
- _context18.next = 304;
85748
+ _context18.next = 333;
85430
85749
  break;
85431
85750
  }
85432
85751
  failed.push({
@@ -85434,38 +85753,38 @@ function createNavigationToolset(ctx) {
85434
85753
  column: _column,
85435
85754
  error: (_target3$error = _target3.error) !== null && _target3$error !== void 0 ? _target3$error : 'Row not found.'
85436
85755
  });
85437
- return _context18.abrupt("continue", 311);
85438
- case 304:
85756
+ return _context18.abrupt("continue", 340);
85757
+ case 333:
85439
85758
  _node2 = _target3.node;
85440
- _rowId = String(_node2.id);
85441
- if (!removeRowIds.includes(_rowId)) {
85442
- _context18.next = 309;
85759
+ _rowId2 = String(_node2.id);
85760
+ if (!removeRowIds.includes(_rowId2)) {
85761
+ _context18.next = 338;
85443
85762
  break;
85444
85763
  }
85445
85764
  failed.push({
85446
- rowId: _rowId,
85765
+ rowId: _rowId2,
85447
85766
  column: _column,
85448
85767
  error: 'This row is also being removed — edit OR remove a row, not both.'
85449
85768
  });
85450
- return _context18.abrupt("continue", 311);
85451
- case 309:
85452
- _context18.next = 311;
85453
- return applyEditToNode(_node2, _rowId, _column, _edit3 === null || _edit3 === void 0 ? void 0 : _edit3.newValue);
85454
- case 311:
85455
- _context18.next = 293;
85769
+ return _context18.abrupt("continue", 340);
85770
+ case 338:
85771
+ _context18.next = 340;
85772
+ return applyEditToNode(_node2, _rowId2, _column, _edit4 === null || _edit4 === void 0 ? void 0 : _edit4.newValue);
85773
+ case 340:
85774
+ _context18.next = 322;
85456
85775
  break;
85457
- case 313:
85458
- _context18.next = 318;
85776
+ case 342:
85777
+ _context18.next = 347;
85459
85778
  break;
85460
- case 315:
85461
- _context18.prev = 315;
85462
- _context18.t9 = _context18["catch"](291);
85463
- _iterator13.e(_context18.t9);
85464
- case 318:
85465
- _context18.prev = 318;
85466
- _iterator13.f();
85467
- return _context18.finish(318);
85468
- case 321:
85779
+ case 344:
85780
+ _context18.prev = 344;
85781
+ _context18.t9 = _context18["catch"](320);
85782
+ _iterator14.e(_context18.t9);
85783
+ case 347:
85784
+ _context18.prev = 347;
85785
+ _iterator14.f();
85786
+ return _context18.finish(347);
85787
+ case 350:
85469
85788
  targets = removeRowIds.filter(function (rowId) {
85470
85789
  if (isRealRow(_api2.getRowNode(rowId))) return true;
85471
85790
  failed.push({
@@ -85474,47 +85793,47 @@ function createNavigationToolset(ctx) {
85474
85793
  });
85475
85794
  return false;
85476
85795
  });
85477
- _iterator14 = _createForOfIteratorHelper$1(targets);
85796
+ _iterator15 = _createForOfIteratorHelper$1(targets);
85478
85797
  try {
85479
- for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
85480
- rowId = _step14.value;
85481
- removedRecordIds.set(rowId, (_api2$getRowNode2 = _api2.getRowNode(rowId)) === null || _api2$getRowNode2 === void 0 || (_api2$getRowNode2 = _api2$getRowNode2.data) === null || _api2$getRowNode2 === void 0 ? void 0 : _api2$getRowNode2._id);
85798
+ for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
85799
+ _rowId = _step15.value;
85800
+ removedRecordIds.set(_rowId, (_api2$getRowNode2 = _api2.getRowNode(_rowId)) === null || _api2$getRowNode2 === void 0 || (_api2$getRowNode2 = _api2$getRowNode2.data) === null || _api2$getRowNode2 === void 0 ? void 0 : _api2$getRowNode2._id);
85482
85801
  }
85483
85802
  } catch (err) {
85484
- _iterator14.e(err);
85803
+ _iterator15.e(err);
85485
85804
  } finally {
85486
- _iterator14.f();
85805
+ _iterator15.f();
85487
85806
  }
85488
85807
  if (!targets.length) {
85489
- _context18.next = 328;
85808
+ _context18.next = 357;
85490
85809
  break;
85491
85810
  }
85492
- _context18.next = 327;
85811
+ _context18.next = 356;
85493
85812
  return handle.stageRemoveRows(targets);
85494
- case 327:
85813
+ case 356:
85495
85814
  removed.push.apply(removed, _toConsumableArray(targets));
85496
- case 328:
85815
+ case 357:
85497
85816
  addedRows = [];
85498
85817
  /** Columns the AGENT provided per added row — lookup writes drag companion fields into `values`. */
85499
85818
  providedAddColumns = new Map();
85500
85819
  conditionedPosDefaults = 0;
85501
85820
  _loop3 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop3() {
85502
- var _addRows$_i4$values, _addRows$_i, _handle$getApplicatio5, _handle$getApplicatio6;
85503
- var rawValues, plainCols, lookupCols, bad, _i7, _Object$entries3, _Object$entries3$_i, _column2, rawValue, check, provided, _loop5, _i8, _lookupCols, hasField, requiredMissing, seed, newId, values, _i9, _plainCols, _plainCols$_i, _column3, text, ok, appData, rowFields, rowDepsOf, _loop6, _ret4;
85821
+ var _addRows$_i5$values, _addRows$_i, _handle$getApplicatio5, _handle$getApplicatio6;
85822
+ var rawValues, plainCols, lookupCols, bad, _i8, _Object$entries3, _Object$entries3$_i, _column2, rawValue, check, provided, _loop5, _i9, _lookupCols, hasField, requiredMissing, seed, newId, values, _i10, _plainCols, _plainCols$_i, _column3, text, ok, appData, rowFields, rowDepsOf, _loop6, _ret4;
85504
85823
  return _regeneratorRuntime.wrap(function _loop3$(_context12) {
85505
85824
  while (1) switch (_context12.prev = _context12.next) {
85506
85825
  case 0:
85507
- rawValues = (_addRows$_i4$values = (_addRows$_i = addRows[_i4]) === null || _addRows$_i === void 0 ? void 0 : _addRows$_i.values) !== null && _addRows$_i4$values !== void 0 ? _addRows$_i4$values : {};
85826
+ rawValues = (_addRows$_i5$values = (_addRows$_i = addRows[_i5]) === null || _addRows$_i === void 0 ? void 0 : _addRows$_i.values) !== null && _addRows$_i5$values !== void 0 ? _addRows$_i5$values : {};
85508
85827
  plainCols = [];
85509
85828
  lookupCols = [];
85510
85829
  bad = false; // Every plain column is checked before anything is staged; the table parses them once the row exists.
85511
- _i7 = 0, _Object$entries3 = Object.entries(rawValues);
85830
+ _i8 = 0, _Object$entries3 = Object.entries(rawValues);
85512
85831
  case 5:
85513
- if (!(_i7 < _Object$entries3.length)) {
85832
+ if (!(_i8 < _Object$entries3.length)) {
85514
85833
  _context12.next = 19;
85515
85834
  break;
85516
85835
  }
85517
- _Object$entries3$_i = _slicedToArray(_Object$entries3[_i7], 2), _column2 = _Object$entries3$_i[0], rawValue = _Object$entries3$_i[1];
85836
+ _Object$entries3$_i = _slicedToArray(_Object$entries3[_i8], 2), _column2 = _Object$entries3$_i[0], rawValue = _Object$entries3$_i[1];
85518
85837
  if (!isLookupColumn(_column2)) {
85519
85838
  _context12.next = 10;
85520
85839
  break;
@@ -85528,7 +85847,7 @@ function createNavigationToolset(ctx) {
85528
85847
  break;
85529
85848
  }
85530
85849
  failed.push({
85531
- rowId: "addRows[".concat(_i4, "]"),
85850
+ rowId: "addRows[".concat(_i5, "]"),
85532
85851
  column: _column2,
85533
85852
  error: check.error
85534
85853
  });
@@ -85537,7 +85856,7 @@ function createNavigationToolset(ctx) {
85537
85856
  case 15:
85538
85857
  if (check.text !== '') plainCols.push([_column2, check.text]);
85539
85858
  case 16:
85540
- _i7++;
85859
+ _i8++;
85541
85860
  _context12.next = 5;
85542
85861
  break;
85543
85862
  case 19:
@@ -85552,40 +85871,40 @@ function createNavigationToolset(ctx) {
85552
85871
  break;
85553
85872
  }
85554
85873
  failed.push({
85555
- rowId: "addRows[".concat(_i4, "]"),
85874
+ rowId: "addRows[".concat(_i5, "]"),
85556
85875
  error: 'No usable values — provide at least one column value.'
85557
85876
  });
85558
85877
  return _context12.abrupt("return", 0);
85559
85878
  case 24:
85560
85879
  // Fail fast with the COMPLETE list of missing required columns; defaulted ones are filled by the add itself.
85561
85880
  // A lookup also fills its companion fields (name field, mapped fields), so those count as provided.
85562
- provided = new Set(plainCols.map(function (_ref33) {
85563
- var _ref34 = _slicedToArray(_ref33, 1),
85564
- column = _ref34[0];
85881
+ provided = new Set(plainCols.map(function (_ref32) {
85882
+ var _ref33 = _slicedToArray(_ref32, 1),
85883
+ column = _ref33[0];
85565
85884
  return column;
85566
85885
  }));
85567
85886
  _loop5 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop5() {
85568
85887
  var _divaDefs$find$custom, _divaDefs$find3, _params$additionalMap;
85569
- var _lookupCols$_i, column, params, _iterator22, _step22, mapping;
85888
+ var _lookupCols$_i, column, params, _iterator23, _step23, mapping;
85570
85889
  return _regeneratorRuntime.wrap(function _loop5$(_context10) {
85571
85890
  while (1) switch (_context10.prev = _context10.next) {
85572
85891
  case 0:
85573
- _lookupCols$_i = _slicedToArray(_lookupCols[_i8], 1), column = _lookupCols$_i[0];
85892
+ _lookupCols$_i = _slicedToArray(_lookupCols[_i9], 1), column = _lookupCols$_i[0];
85574
85893
  provided.add(column);
85575
85894
  params = (_divaDefs$find$custom = (_divaDefs$find3 = _divaDefs.find(function (d) {
85576
85895
  return d.field === column;
85577
85896
  })) === null || _divaDefs$find3 === void 0 ? void 0 : _divaDefs$find3.customParams) !== null && _divaDefs$find$custom !== void 0 ? _divaDefs$find$custom : {};
85578
85897
  if (params.nameField) provided.add(params.nameField);
85579
- _iterator22 = _createForOfIteratorHelper$1((_params$additionalMap = params.additionalMappings) !== null && _params$additionalMap !== void 0 ? _params$additionalMap : []);
85898
+ _iterator23 = _createForOfIteratorHelper$1((_params$additionalMap = params.additionalMappings) !== null && _params$additionalMap !== void 0 ? _params$additionalMap : []);
85580
85899
  try {
85581
- for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) {
85582
- mapping = _step22.value;
85900
+ for (_iterator23.s(); !(_step23 = _iterator23.n()).done;) {
85901
+ mapping = _step23.value;
85583
85902
  if (mapping.targetField) provided.add(mapping.targetField);
85584
85903
  }
85585
85904
  } catch (err) {
85586
- _iterator22.e(err);
85905
+ _iterator23.e(err);
85587
85906
  } finally {
85588
- _iterator22.f();
85907
+ _iterator23.f();
85589
85908
  }
85590
85909
  case 6:
85591
85910
  case "end":
@@ -85593,15 +85912,15 @@ function createNavigationToolset(ctx) {
85593
85912
  }
85594
85913
  }, _loop5);
85595
85914
  });
85596
- _i8 = 0, _lookupCols = lookupCols;
85915
+ _i9 = 0, _lookupCols = lookupCols;
85597
85916
  case 27:
85598
- if (!(_i8 < _lookupCols.length)) {
85917
+ if (!(_i9 < _lookupCols.length)) {
85599
85918
  _context12.next = 32;
85600
85919
  break;
85601
85920
  }
85602
85921
  return _context12.delegateYield(_loop5(), "t0", 29);
85603
85922
  case 29:
85604
- _i8++;
85923
+ _i9++;
85605
85924
  _context12.next = 27;
85606
85925
  break;
85607
85926
  case 32:
@@ -85622,7 +85941,7 @@ function createNavigationToolset(ctx) {
85622
85941
  break;
85623
85942
  }
85624
85943
  failed.push({
85625
- rowId: "addRows[".concat(_i4, "]"),
85944
+ rowId: "addRows[".concat(_i5, "]"),
85626
85945
  error: "Missing required column(s): ".concat(requiredMissing.join(', '), ".")
85627
85946
  });
85628
85947
  return _context12.abrupt("return", 0);
@@ -85646,19 +85965,19 @@ function createNavigationToolset(ctx) {
85646
85965
  break;
85647
85966
  }
85648
85967
  failed.push({
85649
- rowId: "addRows[".concat(_i4, "]"),
85968
+ rowId: "addRows[".concat(_i5, "]"),
85650
85969
  error: 'This table does not support creating rows (no create endpoint).'
85651
85970
  });
85652
85971
  return _context12.abrupt("return", 0);
85653
85972
  case 45:
85654
85973
  values = _objectSpread$5({}, seed);
85655
- _i9 = 0, _plainCols = plainCols;
85974
+ _i10 = 0, _plainCols = plainCols;
85656
85975
  case 47:
85657
- if (!(_i9 < _plainCols.length)) {
85976
+ if (!(_i10 < _plainCols.length)) {
85658
85977
  _context12.next = 60;
85659
85978
  break;
85660
85979
  }
85661
- _plainCols$_i = _slicedToArray(_plainCols[_i9], 2), _column3 = _plainCols$_i[0], text = _plainCols$_i[1];
85980
+ _plainCols$_i = _slicedToArray(_plainCols[_i10], 2), _column3 = _plainCols$_i[0], text = _plainCols$_i[1];
85662
85981
  _context12.next = 51;
85663
85982
  return writeCell(newId, _column3, text);
85664
85983
  case 51:
@@ -85668,7 +85987,7 @@ function createNavigationToolset(ctx) {
85668
85987
  break;
85669
85988
  }
85670
85989
  failed.push({
85671
- rowId: "addRows[".concat(_i4, "]"),
85990
+ rowId: "addRows[".concat(_i5, "]"),
85672
85991
  column: _column3,
85673
85992
  error: ok
85674
85993
  });
@@ -85677,7 +85996,7 @@ function createNavigationToolset(ctx) {
85677
85996
  case 56:
85678
85997
  values[_column3] = cellValueOf(_api2, _api2.getRowNode(newId), _column3);
85679
85998
  case 57:
85680
- _i9++;
85999
+ _i10++;
85681
86000
  _context12.next = 47;
85682
86001
  break;
85683
86002
  case 60:
@@ -85700,14 +86019,14 @@ function createNavigationToolset(ctx) {
85700
86019
  };
85701
86020
  _loop6 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop6() {
85702
86021
  var _api2$getRowNode$data, _api2$getRowNode9;
85703
- var readyIdx, _lookupCols$splice$, column, rawValue, missingDeps, providers, res, write, _i10, _Object$entries4, _res$data, _Object$entries4$_i, key, _value2;
86022
+ var readyIdx, _lookupCols$splice$, column, rawValue, missingDeps, providers, res, write, _i11, _Object$entries4, _res$data, _Object$entries4$_i, key, _value2;
85704
86023
  return _regeneratorRuntime.wrap(function _loop6$(_context11) {
85705
86024
  while (1) switch (_context11.prev = _context11.next) {
85706
86025
  case 0:
85707
86026
  // Prefer a lookup whose row dependencies are already satisfied — its write may provide what the deferred one needs.
85708
- readyIdx = lookupCols.findIndex(function (_ref35) {
85709
- var _ref36 = _slicedToArray(_ref35, 1),
85710
- column = _ref36[0];
86027
+ readyIdx = lookupCols.findIndex(function (_ref34) {
86028
+ var _ref35 = _slicedToArray(_ref34, 1),
86029
+ column = _ref35[0];
85711
86030
  return rowDepsOf(column).every(function (dep) {
85712
86031
  return values[dep] !== undefined || rawValues[dep] !== undefined;
85713
86032
  });
@@ -85728,7 +86047,7 @@ function createNavigationToolset(ctx) {
85728
86047
  return provider !== null && provider !== void 0 && provider.field && provider.field !== column ? "'".concat(provider.field, "'") : "'".concat(dep, "'");
85729
86048
  });
85730
86049
  failed.push({
85731
- rowId: "addRows[".concat(_i4, "]"),
86050
+ rowId: "addRows[".concat(_i5, "]"),
85732
86051
  column: column,
85733
86052
  error: "Column '".concat(column, "' is a lookup whose option list depends on ").concat(providers.join(' + '), " \u2014 set that column in the SAME row (its value resolves the list).")
85734
86053
  });
@@ -85744,7 +86063,7 @@ function createNavigationToolset(ctx) {
85744
86063
  break;
85745
86064
  }
85746
86065
  failed.push({
85747
- rowId: "addRows[".concat(_i4, "]"),
86066
+ rowId: "addRows[".concat(_i5, "]"),
85748
86067
  column: column,
85749
86068
  error: res.error
85750
86069
  });
@@ -85753,8 +86072,8 @@ function createNavigationToolset(ctx) {
85753
86072
  case 15:
85754
86073
  // On a NEW row an undefined write-shape entry means "leave empty" — skip it so it does not clobber a provided key.
85755
86074
  write = {};
85756
- for (_i10 = 0, _Object$entries4 = Object.entries((_res$data = res.data) !== null && _res$data !== void 0 ? _res$data : {}); _i10 < _Object$entries4.length; _i10++) {
85757
- _Object$entries4$_i = _slicedToArray(_Object$entries4[_i10], 2), key = _Object$entries4$_i[0], _value2 = _Object$entries4$_i[1];
86075
+ for (_i11 = 0, _Object$entries4 = Object.entries((_res$data = res.data) !== null && _res$data !== void 0 ? _res$data : {}); _i11 < _Object$entries4.length; _i11++) {
86076
+ _Object$entries4$_i = _slicedToArray(_Object$entries4[_i11], 2), key = _Object$entries4$_i[0], _value2 = _Object$entries4$_i[1];
85758
86077
  if (_value2 !== undefined) write[key] = _value2;
85759
86078
  }
85760
86079
  _context11.t0 = Object.keys(write).length;
@@ -85774,7 +86093,7 @@ function createNavigationToolset(ctx) {
85774
86093
  break;
85775
86094
  }
85776
86095
  failed.push({
85777
- rowId: "addRows[".concat(_i4, "]"),
86096
+ rowId: "addRows[".concat(_i5, "]"),
85778
86097
  column: column,
85779
86098
  error: 'Staging failed (row disappeared?).'
85780
86099
  });
@@ -85825,25 +86144,25 @@ function createNavigationToolset(ctx) {
85825
86144
  }
85826
86145
  }, _loop3);
85827
86146
  });
85828
- _i4 = 0;
85829
- case 333:
85830
- if (!(_i4 < addRows.length)) {
85831
- _context18.next = 341;
86147
+ _i5 = 0;
86148
+ case 362:
86149
+ if (!(_i5 < addRows.length)) {
86150
+ _context18.next = 370;
85832
86151
  break;
85833
86152
  }
85834
- return _context18.delegateYield(_loop3(), "t10", 335);
85835
- case 335:
86153
+ return _context18.delegateYield(_loop3(), "t10", 364);
86154
+ case 364:
85836
86155
  _ret3 = _context18.t10;
85837
86156
  if (!(_ret3 === 0)) {
85838
- _context18.next = 338;
86157
+ _context18.next = 367;
85839
86158
  break;
85840
86159
  }
85841
- return _context18.abrupt("continue", 338);
85842
- case 338:
85843
- _i4++;
85844
- _context18.next = 333;
86160
+ return _context18.abrupt("continue", 367);
86161
+ case 367:
86162
+ _i5++;
86163
+ _context18.next = 362;
85845
86164
  break;
85846
- case 341:
86165
+ case 370:
85847
86166
  // Any add failed → return the table's FULL add schema so the next attempt has everything.
85848
86167
  addSchemaHint = function addSchemaHint() {
85849
86168
  if (!addRows.length) return '';
@@ -85860,7 +86179,7 @@ function createNavigationToolset(ctx) {
85860
86179
  return " ADD SCHEMA of '".concat(_entry2.label, "' \u2014 required: ").concat(req.join(', ') || 'none').concat(defaulted.length ? "; defaulted (OMIT): ".concat(defaulted.join(', ')) : '', ". Enum/lookup columns take only their listed values (listGrids/readColumnOptions).");
85861
86180
  };
85862
86181
  if (!(!staged.length && !addedRows.length && !removed.length)) {
85863
- _context18.next = 345;
86182
+ _context18.next = 374;
85864
86183
  break;
85865
86184
  }
85866
86185
  restoreUserFilter();
@@ -85871,63 +86190,63 @@ function createNavigationToolset(ctx) {
85871
86190
  failed: failed.length ? failed : undefined,
85872
86191
  note: unchanged.length ? 'NOTHING was staged: every proposed value equals the current cell value (the change may already have been applied earlier). Tell the user the data already matches — do NOT claim you changed anything.' : "Nothing could be staged \u2014 nothing to approve. Fix the failures (fresh readGridRows) and try again.".concat(failed.length ? addSchemaHint() : '')
85873
86192
  });
85874
- case 345:
86193
+ case 374:
85875
86194
  // The table would silently skip invalid staged rows on save — surface that as a failure instead of a fake success.
85876
86195
  validationErrors = []; // Rows the sequential lookup pass already sent carry the SERVER's verdict (a rejection leaves the same
85877
86196
  // error markers) — that is reported as a server error below, not as a validation failure of the rest.
85878
86197
  alreadySent = new Set([].concat(_toConsumableArray(mergedOutcome.committed), _toConsumableArray(mergedOutcome.failed.map(function (failure) {
85879
86198
  return failure.rowId;
85880
86199
  })), _toConsumableArray(mergedOutcome.skipped)));
85881
- _iterator15 = _createForOfIteratorHelper$1(new Set([].concat(_toConsumableArray(staged.map(function (s) {
86200
+ _iterator16 = _createForOfIteratorHelper$1(new Set([].concat(_toConsumableArray(staged.map(function (s) {
85882
86201
  return s.rowId;
85883
86202
  })), _toConsumableArray(addedRows.map(function (a) {
85884
86203
  return a.rowId;
85885
86204
  })))));
85886
- _context18.prev = 348;
85887
- _iterator15.s();
85888
- case 350:
85889
- if ((_step15 = _iterator15.n()).done) {
85890
- _context18.next = 358;
86205
+ _context18.prev = 377;
86206
+ _iterator16.s();
86207
+ case 379:
86208
+ if ((_step16 = _iterator16.n()).done) {
86209
+ _context18.next = 387;
85891
86210
  break;
85892
86211
  }
85893
- _rowId2 = _step15.value;
85894
- if (!alreadySent.has(_rowId2)) {
85895
- _context18.next = 354;
86212
+ _rowId3 = _step16.value;
86213
+ if (!alreadySent.has(_rowId3)) {
86214
+ _context18.next = 383;
85896
86215
  break;
85897
86216
  }
85898
- return _context18.abrupt("continue", 356);
85899
- case 354:
85900
- rowErrors = (_api2$getRowNode10 = _api2.getRowNode(_rowId2)) === null || _api2$getRowNode10 === void 0 || (_api2$getRowNode10 = _api2$getRowNode10.data) === null || _api2$getRowNode10 === void 0 || (_api2$getRowNode10 = _api2$getRowNode10.__diva_context) === null || _api2$getRowNode10 === void 0 ? void 0 : _api2$getRowNode10.errors;
86217
+ return _context18.abrupt("continue", 385);
86218
+ case 383:
86219
+ rowErrors = (_api2$getRowNode10 = _api2.getRowNode(_rowId3)) === null || _api2$getRowNode10 === void 0 || (_api2$getRowNode10 = _api2$getRowNode10.data) === null || _api2$getRowNode10 === void 0 || (_api2$getRowNode10 = _api2$getRowNode10.__diva_context) === null || _api2$getRowNode10 === void 0 ? void 0 : _api2$getRowNode10.errors;
85901
86220
  if (Array.isArray(rowErrors) && rowErrors.length) {
85902
86221
  validationErrors.push({
85903
- rowId: _rowId2,
86222
+ rowId: _rowId3,
85904
86223
  errors: rowErrors.map(function (e) {
85905
86224
  return [e.field, e.errorText].filter(Boolean).join(': ');
85906
86225
  })
85907
86226
  });
85908
86227
  }
85909
- case 356:
85910
- _context18.next = 350;
86228
+ case 385:
86229
+ _context18.next = 379;
85911
86230
  break;
85912
- case 358:
85913
- _context18.next = 363;
86231
+ case 387:
86232
+ _context18.next = 392;
85914
86233
  break;
85915
- case 360:
85916
- _context18.prev = 360;
85917
- _context18.t11 = _context18["catch"](348);
85918
- _iterator15.e(_context18.t11);
85919
- case 363:
85920
- _context18.prev = 363;
85921
- _iterator15.f();
85922
- return _context18.finish(363);
85923
- case 366:
86234
+ case 389:
86235
+ _context18.prev = 389;
86236
+ _context18.t11 = _context18["catch"](377);
86237
+ _iterator16.e(_context18.t11);
86238
+ case 392:
86239
+ _context18.prev = 392;
86240
+ _iterator16.f();
86241
+ return _context18.finish(392);
86242
+ case 395:
85924
86243
  if (!validationErrors.length) {
85925
- _context18.next = 371;
86244
+ _context18.next = 400;
85926
86245
  break;
85927
86246
  }
85928
- _context18.next = 369;
86247
+ _context18.next = 398;
85929
86248
  return handle.rollback();
85930
- case 369:
86249
+ case 398:
85931
86250
  restoreUserFilter();
85932
86251
  // Rows resolved by the sequential lookup pass above commit individually, BEFORE this check runs —
85933
86252
  // a validation failure in the rest of the batch cannot roll those back, so "everything was reverted"
@@ -85942,9 +86261,9 @@ function createNavigationToolset(ctx) {
85942
86261
  failed: failed.length ? failed : undefined,
85943
86262
  note: mergedOutcome.committed.length ? "".concat(mergedOutcome.committed.length, " row(s) addressed by keyColumn/keyValue were already COMMITTED individually before this validation failure (each such row is located, staged and saved on its own, to avoid losing it to a later filter change) \u2014 do NOT re-send those, see committedRowIds. The REST of the batch failed validation and was reverted: fix the listed problems and try ONE new stageTableEdits call for just those.").concat(addSchemaHint()) : "NOTHING was staged for approval: some rows fail the table's validation (everything was reverted). Fix the listed problems \u2014 e.g. fill the required columns \u2014 and try ONE new stageTableEdits call.".concat(addSchemaHint())
85944
86263
  }));
85945
- case 371:
86264
+ case 400:
85946
86265
  // Bring the first staged row into view; staged cells/rows are highlighted.
85947
- focusNode = _api2.getRowNode((_ref23 = (_ref24 = (_staged$0$rowId = (_staged$ = staged[0]) === null || _staged$ === void 0 ? void 0 : _staged$.rowId) !== null && _staged$0$rowId !== void 0 ? _staged$0$rowId : removed[0]) !== null && _ref24 !== void 0 ? _ref24 : (_addedRows$ = addedRows[0]) === null || _addedRows$ === void 0 ? void 0 : _addedRows$.rowId) !== null && _ref23 !== void 0 ? _ref23 : '');
86266
+ focusNode = _api2.getRowNode((_ref22 = (_ref23 = (_staged$0$rowId = (_staged$ = staged[0]) === null || _staged$ === void 0 ? void 0 : _staged$.rowId) !== null && _staged$0$rowId !== void 0 ? _staged$0$rowId : removed[0]) !== null && _ref23 !== void 0 ? _ref23 : (_addedRows$ = addedRows[0]) === null || _addedRows$ === void 0 ? void 0 : _addedRows$.rowId) !== null && _ref22 !== void 0 ? _ref22 : '');
85948
86267
  if ((focusNode === null || focusNode === void 0 ? void 0 : focusNode.rowIndex) != null) _api2.ensureIndexVisible(focusNode.rowIndex, 'middle');
85949
86268
  totalStaged = staged.length + addedRows.length + removed.length;
85950
86269
  /**
@@ -85974,27 +86293,27 @@ function createNavigationToolset(ctx) {
85974
86293
  if (!ctx.autoApprove && !preApproved) awaitingApproval();
85975
86294
  _context18.t12 = ctx.autoApprove || preApproved;
85976
86295
  if (_context18.t12) {
85977
- _context18.next = 381;
86296
+ _context18.next = 410;
85978
86297
  break;
85979
86298
  }
85980
- _context18.next = 380;
86299
+ _context18.next = 409;
85981
86300
  return _entry2.requestAgentApproval(totalStaged, undefined, signal);
85982
- case 380:
86301
+ case 409:
85983
86302
  _context18.t12 = _context18.sent;
85984
- case 381:
86303
+ case 410:
85985
86304
  approved = _context18.t12;
85986
86305
  if (approved) {
85987
- _context18.next = 391;
86306
+ _context18.next = 420;
85988
86307
  break;
85989
86308
  }
85990
- _context18.next = 385;
86309
+ _context18.next = 414;
85991
86310
  return handle.rollback();
85992
- case 385:
86311
+ case 414:
85993
86312
  survived = survivingOperations();
85994
86313
  survivedCount = survived.changes.length + survived.addedRowIds.length + survived.removedRowIds.length;
85995
86314
  restoreUserFilter();
85996
86315
  if (survivedCount) {
85997
- _context18.next = 390;
86316
+ _context18.next = 419;
85998
86317
  break;
85999
86318
  }
86000
86319
  return _context18.abrupt("return", {
@@ -86003,7 +86322,7 @@ function createNavigationToolset(ctx) {
86003
86322
  failed: failed.length ? failed : undefined,
86004
86323
  note: 'The user DISCARDED the staged changes — nothing was saved. Do NOT re-stage the same values; ask what to adjust instead.'
86005
86324
  });
86006
- case 390:
86325
+ case 419:
86007
86326
  return _context18.abrupt("return", {
86008
86327
  applied: true,
86009
86328
  appliedCount: survivedCount,
@@ -86020,7 +86339,7 @@ function createNavigationToolset(ctx) {
86020
86339
  failed: failed.length ? failed : undefined,
86021
86340
  note: 'The user DISCARDED the staged changes, but the table had ALREADY SAVED the listed operations before the decision arrived ' + '(it saves pending edits by itself when the user clicks outside the grid), so the rollback found nothing to revert. ' + 'Report EXACTLY these operations as live on the server and ask the user whether to undo them — do NOT re-send them, and do not claim the discard took effect.'
86022
86341
  });
86023
- case 391:
86342
+ case 420:
86024
86343
  // Trim the echoed row: drop `*DisplayTexts` mirrors, collapse localized objects to one language.
86025
86344
  trimEcho = function trimEcho(values) {
86026
86345
  var isLocalized = function isLocalized(v) {
@@ -86029,9 +86348,9 @@ function createNavigationToolset(ctx) {
86029
86348
  });
86030
86349
  };
86031
86350
  var out = {};
86032
- for (var _i5 = 0, _Object$entries2 = Object.entries(values); _i5 < _Object$entries2.length; _i5++) {
86351
+ for (var _i6 = 0, _Object$entries2 = Object.entries(values); _i6 < _Object$entries2.length; _i6++) {
86033
86352
  var _localized$DE;
86034
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i5], 2),
86353
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i6], 2),
86035
86354
  key = _Object$entries2$_i[0],
86036
86355
  _value = _Object$entries2$_i[1];
86037
86356
  if (/DisplayTexts?$/.test(key)) continue;
@@ -86040,9 +86359,9 @@ function createNavigationToolset(ctx) {
86040
86359
  }
86041
86360
  return out;
86042
86361
  }; // The commit REPORTS what the server confirmed; grid state cannot (a vanished rejected row gets no marker).
86043
- _context18.next = 394;
86362
+ _context18.next = 423;
86044
86363
  return handle.commitStagedChanges();
86045
- case 394:
86364
+ case 423:
86046
86365
  finalOutcome = _context18.sent;
86047
86366
  // Rows resolved by the sequential lookup pass above were already committed individually — merge
86048
86367
  // their outcomes in. When that pass never ran (the common case), this is exactly `finalOutcome`.
@@ -86066,10 +86385,10 @@ function createNavigationToolset(ctx) {
86066
86385
  })), _toConsumableArray(addedRows.filter(function (a) {
86067
86386
  return a.rowId === rowId;
86068
86387
  }).flatMap(function (a) {
86069
- return Object.entries(a.values).map(function (_ref25) {
86070
- var _ref26 = _slicedToArray(_ref25, 2),
86071
- column = _ref26[0],
86072
- value = _ref26[1];
86388
+ return Object.entries(a.values).map(function (_ref24) {
86389
+ var _ref25 = _slicedToArray(_ref24, 2),
86390
+ column = _ref25[0],
86391
+ value = _ref25[1];
86073
86392
  return {
86074
86393
  column: column,
86075
86394
  length: String(value !== null && value !== void 0 ? value : '').length
@@ -86113,52 +86432,52 @@ function createNavigationToolset(ctx) {
86113
86432
  errors: [].concat(_toConsumableArray(said), _toConsumableArray(lengthNote ? [lengthNote] : []), _toConsumableArray(remedy ? [remedy] : []))
86114
86433
  });
86115
86434
  };
86116
- _iterator16 = _createForOfIteratorHelper$1((_outcome$failed = outcome === null || outcome === void 0 ? void 0 : outcome.failed) !== null && _outcome$failed !== void 0 ? _outcome$failed : []);
86435
+ _iterator17 = _createForOfIteratorHelper$1((_outcome$failed = outcome === null || outcome === void 0 ? void 0 : outcome.failed) !== null && _outcome$failed !== void 0 ? _outcome$failed : []);
86117
86436
  try {
86118
- for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
86119
- failure = _step16.value;
86437
+ for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
86438
+ failure = _step17.value;
86120
86439
  addError(failure.rowId, failure.errors);
86121
86440
  }
86122
86441
  } catch (err) {
86123
- _iterator16.e(err);
86442
+ _iterator17.e(err);
86124
86443
  } finally {
86125
- _iterator16.f();
86444
+ _iterator17.f();
86126
86445
  }
86127
- _iterator17 = _createForOfIteratorHelper$1((_outcome$skipped = outcome === null || outcome === void 0 ? void 0 : outcome.skipped) !== null && _outcome$skipped !== void 0 ? _outcome$skipped : []);
86446
+ _iterator18 = _createForOfIteratorHelper$1((_outcome$skipped = outcome === null || outcome === void 0 ? void 0 : outcome.skipped) !== null && _outcome$skipped !== void 0 ? _outcome$skipped : []);
86128
86447
  try {
86129
- for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
86130
- _rowId3 = _step17.value;
86131
- addError(_rowId3, ['Row was NOT sent to the server — the commit skipped it (its grid row was gone, or it still carried validation errors). ' + 'VERIFY BEFORE RE-SENDING: this message has been measured WRONG (the row WAS on the server) — locateRow the row by its key first; a blind re-send creates a silent duplicate. ' + 'Typical on rows created AFTER this view last loaded (the lazy grid evicts them): locateRow the row (loads and pins it), then re-send ONLY its cells as an own batch — one row per call.']);
86448
+ for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
86449
+ _rowId4 = _step18.value;
86450
+ addError(_rowId4, ['Row was NOT sent to the server — the commit skipped it (its grid row was gone, or it still carried validation errors). ' + 'VERIFY BEFORE RE-SENDING: this message has been measured WRONG (the row WAS on the server) — locateRow the row by its key first; a blind re-send creates a silent duplicate. ' + 'Typical on rows created AFTER this view last loaded (the lazy grid evicts them): locateRow the row (loads and pins it), then re-send ONLY its cells as an own batch — one row per call.']);
86132
86451
  }
86133
86452
  // Secondary signal for rows the outcome did not mention: server-rejected rows stay pending with error markers.
86134
86453
  } catch (err) {
86135
- _iterator17.e(err);
86454
+ _iterator18.e(err);
86136
86455
  } finally {
86137
- _iterator17.f();
86456
+ _iterator18.f();
86138
86457
  }
86139
- _iterator18 = _createForOfIteratorHelper$1(new Set([].concat(_toConsumableArray(staged.map(function (s) {
86458
+ _iterator19 = _createForOfIteratorHelper$1(new Set([].concat(_toConsumableArray(staged.map(function (s) {
86140
86459
  return s.rowId;
86141
86460
  })), _toConsumableArray(addedRows.map(function (a) {
86142
86461
  return a.rowId;
86143
86462
  })), removed)));
86144
86463
  try {
86145
- for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
86146
- _rowId4 = _step18.value;
86147
- _rowErrors = (_api2$getRowNode11 = _api2.getRowNode(_rowId4)) === null || _api2$getRowNode11 === void 0 || (_api2$getRowNode11 = _api2$getRowNode11.data) === null || _api2$getRowNode11 === void 0 || (_api2$getRowNode11 = _api2$getRowNode11.__diva_context) === null || _api2$getRowNode11 === void 0 ? void 0 : _api2$getRowNode11.errors;
86464
+ for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
86465
+ _rowId5 = _step19.value;
86466
+ _rowErrors = (_api2$getRowNode11 = _api2.getRowNode(_rowId5)) === null || _api2$getRowNode11 === void 0 || (_api2$getRowNode11 = _api2$getRowNode11.data) === null || _api2$getRowNode11 === void 0 || (_api2$getRowNode11 = _api2$getRowNode11.__diva_context) === null || _api2$getRowNode11 === void 0 ? void 0 : _api2$getRowNode11.errors;
86148
86467
  if (Array.isArray(_rowErrors) && _rowErrors.length) {
86149
- addError(_rowId4, _rowErrors.map(function (e) {
86468
+ addError(_rowId5, _rowErrors.map(function (e) {
86150
86469
  return [e.field, e.errorText].filter(Boolean).join(': ');
86151
86470
  }));
86152
86471
  }
86153
86472
  }
86154
86473
  // A committed row loses its isNew marker. NOT keyed on _id: bulk endpoints may not echo the record.
86155
86474
  } catch (err) {
86156
- _iterator18.e(err);
86475
+ _iterator19.e(err);
86157
86476
  } finally {
86158
- _iterator18.f();
86477
+ _iterator19.f();
86159
86478
  }
86160
- for (_i6 = 0, _addedRows = addedRows; _i6 < _addedRows.length; _i6++) {
86161
- a = _addedRows[_i6];
86479
+ for (_i7 = 0, _addedRows = addedRows; _i7 < _addedRows.length; _i7++) {
86480
+ a = _addedRows[_i7];
86162
86481
  if ((_api2$getRowNode5 = _api2.getRowNode(a.rowId)) !== null && _api2$getRowNode5 !== void 0 && (_api2$getRowNode5 = _api2$getRowNode5.data) !== null && _api2$getRowNode5 !== void 0 && (_api2$getRowNode5 = _api2$getRowNode5.__diva_context) !== null && _api2$getRowNode5 !== void 0 && _api2$getRowNode5.isNew) {
86163
86482
  addError(a.rowId, ['Row was NOT saved — the commit skipped it (it stayed pending).']);
86164
86483
  }
@@ -86169,12 +86488,12 @@ function createNavigationToolset(ctx) {
86169
86488
  survivedAfterCommit = outcomeIsEmpty ? survivingOperations() : undefined;
86170
86489
  autoCommitted = !!survivedAfterCommit && survivedAfterCommit.changes.length + survivedAfterCommit.addedRowIds.length + survivedAfterCommit.removedRowIds.length > 0;
86171
86490
  if (!(outcomeIsEmpty && !autoCommitted && !serverErrors.length)) {
86172
- _context18.next = 418;
86491
+ _context18.next = 447;
86173
86492
  break;
86174
86493
  }
86175
- _context18.next = 416;
86494
+ _context18.next = 445;
86176
86495
  return handle.rollback();
86177
- case 416:
86496
+ case 445:
86178
86497
  restoreUserFilter();
86179
86498
  return _context18.abrupt("return", {
86180
86499
  applied: false,
@@ -86182,13 +86501,13 @@ function createNavigationToolset(ctx) {
86182
86501
  failed: failed.length ? failed : undefined,
86183
86502
  note: 'NOTHING was saved: the commit reported no row as saved or rejected, and the grid holds none of the staged values any more ' + '(the table dropped the pending edits before they were sent). Do NOT report this as done — re-read the rows (readGridRows) and stage the batch again.'
86184
86503
  });
86185
- case 418:
86504
+ case 447:
86186
86505
  autoCommittedOps = autoCommitted ? survivedAfterCommit : undefined;
86187
86506
  committedIds = new Set(autoCommittedOps ? [].concat(_toConsumableArray(autoCommittedOps.changes.map(function (change) {
86188
86507
  return change.rowId;
86189
86508
  })), _toConsumableArray(autoCommittedOps.addedRowIds), _toConsumableArray(autoCommittedOps.removedRowIds)) : (_outcome$committed = outcome === null || outcome === void 0 ? void 0 : outcome.committed) !== null && _outcome$committed !== void 0 ? _outcome$committed : []);
86190
86509
  if (!serverErrors.length) {
86191
- _context18.next = 492;
86510
+ _context18.next = 529;
86192
86511
  break;
86193
86512
  }
86194
86513
  failedIds = new Set(serverErrors.map(function (s) {
@@ -86201,15 +86520,16 @@ function createNavigationToolset(ctx) {
86201
86520
  return _objectSpread$5(_objectSpread$5({}, s), {}, {
86202
86521
  _id: (_api2$getRowNode6 = _api2.getRowNode(s.rowId)) === null || _api2$getRowNode6 === void 0 || (_api2$getRowNode6 = _api2$getRowNode6.data) === null || _api2$getRowNode6 === void 0 ? void 0 : _api2$getRowNode6._id
86203
86522
  });
86204
- });
86523
+ }); // The commit's own createdIds beat the grid here: after the rollback below the added nodes are gone, and a
86524
+ // row verified as `unknown` is one the receipt tells the agent to re-send - which is how duplicates happen.
86205
86525
  addTargets = addedRows.filter(function (a) {
86206
86526
  return !failedIds.has(a.rowId);
86207
86527
  }).map(function (a) {
86208
- var _api2$getRowNode7;
86528
+ var _outcome$createdIds$a, _outcome$createdIds, _api2$getRowNode7;
86209
86529
  return {
86210
86530
  rowId: a.rowId,
86211
86531
  values: trimEcho(a.values),
86212
- _id: (_api2$getRowNode7 = _api2.getRowNode(a.rowId)) === null || _api2$getRowNode7 === void 0 || (_api2$getRowNode7 = _api2$getRowNode7.data) === null || _api2$getRowNode7 === void 0 ? void 0 : _api2$getRowNode7._id
86532
+ _id: (_outcome$createdIds$a = outcome === null || outcome === void 0 || (_outcome$createdIds = outcome.createdIds) === null || _outcome$createdIds === void 0 ? void 0 : _outcome$createdIds[a.rowId]) !== null && _outcome$createdIds$a !== void 0 ? _outcome$createdIds$a : (_api2$getRowNode7 = _api2.getRowNode(a.rowId)) === null || _api2$getRowNode7 === void 0 || (_api2$getRowNode7 = _api2$getRowNode7.data) === null || _api2$getRowNode7 === void 0 ? void 0 : _api2$getRowNode7._id
86213
86533
  };
86214
86534
  }); // A committed removal already deleted its node — its _id comes from the staging-time capture.
86215
86535
  removalTargets = removed.filter(function (rowId) {
@@ -86220,20 +86540,28 @@ function createNavigationToolset(ctx) {
86220
86540
  _id: removedRecordIds.get(rowId)
86221
86541
  };
86222
86542
  }); // Clear the rejected leftovers (they would block the next staging).
86223
- _context18.next = 427;
86543
+ _context18.next = 456;
86224
86544
  return handle.rollback();
86225
- case 427:
86545
+ case 456:
86226
86546
  restoreUserFilter();
86227
86547
  // Partial failure: neither the commit report nor the rollback is reliable — read the server back per operation.
86228
- hasIdColumn = !!_api2.getColumnDef('_id');
86229
- verifyBudget = 25;
86548
+ hasIdColumn = !!_api2.getColumnDef('_id'); // A COUNT budget bounded nothing: one probe can spend three 8s row-waits, so 25 of them ran for ten
86549
+ // minutes while the tab's whole call queue waited behind it. The budget is wall-clock now, and
86550
+ // `verifyDeadlineHit` says so, because an `unknown` that means "we ran out of time" is a different
86551
+ // instruction to the agent than one that means "the server did not answer".
86552
+ verifyDeadline = Date.now() + 20000;
86553
+ verifyDeadlineHit = false; // The filter is this grid's, not ours: captured once, put back once, whatever happens in between. Restoring
86554
+ // it per probe meant a single throw left an `_id` filter on the table that matched nothing - every later
86555
+ // read then waited out its timeout and reported an empty table.
86556
+ filterBeforeVerify = _api2.getFilterModel();
86557
+ verifyFilterApplied = false;
86230
86558
  probeServerRow = /*#__PURE__*/function () {
86231
- var _ref27 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_id, onFound) {
86232
- var previousFilter, located, result;
86559
+ var _ref26 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_id, onFound) {
86560
+ var _id2, _located$node$data, located, exact;
86233
86561
  return _regeneratorRuntime.wrap(function _callee7$(_context8) {
86234
86562
  while (1) switch (_context8.prev = _context8.next) {
86235
86563
  case 0:
86236
- if (!(!_id || !hasIdColumn || verifyBudget <= 0)) {
86564
+ if (!(!_id || !hasIdColumn)) {
86237
86565
  _context8.next = 2;
86238
86566
  break;
86239
86567
  }
@@ -86241,47 +86569,64 @@ function createNavigationToolset(ctx) {
86241
86569
  state: 'unknown'
86242
86570
  });
86243
86571
  case 2:
86244
- verifyBudget -= 1;
86245
- _context8.prev = 3;
86246
- previousFilter = _api2.getFilterModel();
86247
- _context8.next = 7;
86572
+ if (!(signal !== null && signal !== void 0 && signal.aborted || Date.now() > verifyDeadline)) {
86573
+ _context8.next = 5;
86574
+ break;
86575
+ }
86576
+ verifyDeadlineHit = true;
86577
+ return _context8.abrupt("return", {
86578
+ state: 'unknown'
86579
+ });
86580
+ case 5:
86581
+ _context8.prev = 5;
86582
+ _context8.next = 8;
86248
86583
  return locateRowCore(_api2, '_id', String(_id), false);
86249
- case 7:
86584
+ case 8:
86250
86585
  located = _context8.sent;
86251
- result = located.node ? {
86586
+ verifyFilterApplied = verifyFilterApplied || located.filterApplied;
86587
+ // locateRowCore falls back to a CONTAINS match; for a verification that is not good enough - a row
86588
+ // whose id merely contains the one asked for would be reported as the row itself.
86589
+ exact = located.node && String((_id2 = (_located$node$data = located.node.data) === null || _located$node$data === void 0 ? void 0 : _located$node$data._id) !== null && _id2 !== void 0 ? _id2 : '') === String(_id);
86590
+ return _context8.abrupt("return", exact ? {
86252
86591
  state: 'found',
86253
86592
  value: onFound(located.node)
86254
86593
  } : {
86255
86594
  state: 'missing'
86256
- };
86257
- if (located.filterApplied) _api2.setFilterModel(Object.keys(previousFilter !== null && previousFilter !== void 0 ? previousFilter : {}).length ? previousFilter : null);
86258
- return _context8.abrupt("return", result);
86259
- case 13:
86260
- _context8.prev = 13;
86261
- _context8.t0 = _context8["catch"](3);
86595
+ });
86596
+ case 14:
86597
+ _context8.prev = 14;
86598
+ _context8.t0 = _context8["catch"](5);
86262
86599
  return _context8.abrupt("return", {
86263
86600
  state: 'unknown'
86264
86601
  });
86265
- case 16:
86602
+ case 17:
86266
86603
  case "end":
86267
86604
  return _context8.stop();
86268
86605
  }
86269
- }, _callee7, null, [[3, 13]]);
86606
+ }, _callee7, null, [[5, 14]]);
86270
86607
  }));
86271
86608
  return function probeServerRow(_x24, _x25) {
86272
- return _ref27.apply(this, arguments);
86609
+ return _ref26.apply(this, arguments);
86273
86610
  };
86274
86611
  }();
86612
+ restoreVerifyFilter = function restoreVerifyFilter() {
86613
+ if (!verifyFilterApplied) return;
86614
+ verifyFilterApplied = false;
86615
+ _api2.setFilterModel(Object.keys(filterBeforeVerify !== null && filterBeforeVerify !== void 0 ? filterBeforeVerify : {}).length ? filterBeforeVerify : null);
86616
+ };
86275
86617
  verifiedChanges = [];
86276
- _iterator19 = _createForOfIteratorHelper$1(editTargets);
86277
- _context18.prev = 433;
86618
+ verifiedAdds = [];
86619
+ verifiedRemovals = [];
86620
+ _context18.prev = 467;
86621
+ _iterator20 = _createForOfIteratorHelper$1(editTargets);
86622
+ _context18.prev = 469;
86278
86623
  _loop4 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop4() {
86279
86624
  var _expectedValueOf, _target$from;
86280
86625
  var target, probe, serverValue, serverState;
86281
86626
  return _regeneratorRuntime.wrap(function _loop4$(_context9) {
86282
86627
  while (1) switch (_context9.prev = _context9.next) {
86283
86628
  case 0:
86284
- target = _step19.value;
86629
+ target = _step20.value;
86285
86630
  _context9.next = 3;
86286
86631
  return probeServerRow(target._id, function (node) {
86287
86632
  return fmt(cellValueOf(_api2, node, target.column));
@@ -86318,49 +86663,48 @@ function createNavigationToolset(ctx) {
86318
86663
  }
86319
86664
  }, _loop4);
86320
86665
  });
86321
- _iterator19.s();
86322
- case 436:
86323
- if ((_step19 = _iterator19.n()).done) {
86324
- _context18.next = 442;
86666
+ _iterator20.s();
86667
+ case 472:
86668
+ if ((_step20 = _iterator20.n()).done) {
86669
+ _context18.next = 478;
86325
86670
  break;
86326
86671
  }
86327
- return _context18.delegateYield(_loop4(), "t13", 438);
86328
- case 438:
86672
+ return _context18.delegateYield(_loop4(), "t13", 474);
86673
+ case 474:
86329
86674
  if (!_context18.t13) {
86330
- _context18.next = 440;
86675
+ _context18.next = 476;
86331
86676
  break;
86332
86677
  }
86333
- return _context18.abrupt("continue", 440);
86334
- case 440:
86335
- _context18.next = 436;
86678
+ return _context18.abrupt("continue", 476);
86679
+ case 476:
86680
+ _context18.next = 472;
86336
86681
  break;
86337
- case 442:
86338
- _context18.next = 447;
86682
+ case 478:
86683
+ _context18.next = 483;
86339
86684
  break;
86340
- case 444:
86341
- _context18.prev = 444;
86342
- _context18.t14 = _context18["catch"](433);
86343
- _iterator19.e(_context18.t14);
86344
- case 447:
86345
- _context18.prev = 447;
86346
- _iterator19.f();
86347
- return _context18.finish(447);
86348
- case 450:
86349
- verifiedAdds = [];
86350
- _iterator20 = _createForOfIteratorHelper$1(addTargets);
86351
- _context18.prev = 452;
86352
- _iterator20.s();
86353
- case 454:
86354
- if ((_step20 = _iterator20.n()).done) {
86355
- _context18.next = 462;
86685
+ case 480:
86686
+ _context18.prev = 480;
86687
+ _context18.t14 = _context18["catch"](469);
86688
+ _iterator20.e(_context18.t14);
86689
+ case 483:
86690
+ _context18.prev = 483;
86691
+ _iterator20.f();
86692
+ return _context18.finish(483);
86693
+ case 486:
86694
+ _iterator21 = _createForOfIteratorHelper$1(addTargets);
86695
+ _context18.prev = 487;
86696
+ _iterator21.s();
86697
+ case 489:
86698
+ if ((_step21 = _iterator21.n()).done) {
86699
+ _context18.next = 497;
86356
86700
  break;
86357
86701
  }
86358
- target = _step20.value;
86359
- _context18.next = 458;
86702
+ target = _step21.value;
86703
+ _context18.next = 493;
86360
86704
  return probeServerRow(target._id, function () {
86361
86705
  return true;
86362
86706
  });
86363
- case 458:
86707
+ case 493:
86364
86708
  probe = _context18.sent;
86365
86709
  verifiedAdds.push(_objectSpread$5(_objectSpread$5({
86366
86710
  rowId: target.rowId,
@@ -86370,77 +86714,85 @@ function createNavigationToolset(ctx) {
86370
86714
  } : {}), {}, {
86371
86715
  serverState: probe.state === 'found' ? 'applied' : probe.state === 'missing' ? 'reverted' : 'unknown'
86372
86716
  }));
86373
- case 460:
86374
- _context18.next = 454;
86717
+ case 495:
86718
+ _context18.next = 489;
86375
86719
  break;
86376
- case 462:
86377
- _context18.next = 467;
86720
+ case 497:
86721
+ _context18.next = 502;
86378
86722
  break;
86379
- case 464:
86380
- _context18.prev = 464;
86381
- _context18.t15 = _context18["catch"](452);
86382
- _iterator20.e(_context18.t15);
86383
- case 467:
86384
- _context18.prev = 467;
86385
- _iterator20.f();
86386
- return _context18.finish(467);
86387
- case 470:
86388
- verifiedRemovals = [];
86389
- _iterator21 = _createForOfIteratorHelper$1(removalTargets);
86390
- _context18.prev = 472;
86391
- _iterator21.s();
86392
- case 474:
86393
- if ((_step21 = _iterator21.n()).done) {
86394
- _context18.next = 482;
86723
+ case 499:
86724
+ _context18.prev = 499;
86725
+ _context18.t15 = _context18["catch"](487);
86726
+ _iterator21.e(_context18.t15);
86727
+ case 502:
86728
+ _context18.prev = 502;
86729
+ _iterator21.f();
86730
+ return _context18.finish(502);
86731
+ case 505:
86732
+ _iterator22 = _createForOfIteratorHelper$1(removalTargets);
86733
+ _context18.prev = 506;
86734
+ _iterator22.s();
86735
+ case 508:
86736
+ if ((_step22 = _iterator22.n()).done) {
86737
+ _context18.next = 516;
86395
86738
  break;
86396
86739
  }
86397
- _target = _step21.value;
86398
- _context18.next = 478;
86740
+ _target = _step22.value;
86741
+ _context18.next = 512;
86399
86742
  return probeServerRow(_target._id, function () {
86400
86743
  return true;
86401
86744
  });
86402
- case 478:
86745
+ case 512:
86403
86746
  _probe = _context18.sent;
86404
86747
  verifiedRemovals.push({
86405
86748
  rowId: _target.rowId,
86406
86749
  serverState: _probe.state === 'missing' ? 'applied' : _probe.state === 'found' ? 'reverted' : 'unknown'
86407
86750
  });
86408
- case 480:
86409
- _context18.next = 474;
86751
+ case 514:
86752
+ _context18.next = 508;
86410
86753
  break;
86411
- case 482:
86412
- _context18.next = 487;
86754
+ case 516:
86755
+ _context18.next = 521;
86413
86756
  break;
86414
- case 484:
86415
- _context18.prev = 484;
86416
- _context18.t16 = _context18["catch"](472);
86417
- _iterator21.e(_context18.t16);
86418
- case 487:
86419
- _context18.prev = 487;
86420
- _iterator21.f();
86421
- return _context18.finish(487);
86422
- case 490:
86757
+ case 518:
86758
+ _context18.prev = 518;
86759
+ _context18.t16 = _context18["catch"](506);
86760
+ _iterator22.e(_context18.t16);
86761
+ case 521:
86762
+ _context18.prev = 521;
86763
+ _iterator22.f();
86764
+ return _context18.finish(521);
86765
+ case 524:
86766
+ _context18.prev = 524;
86767
+ // The table belongs to the user again before we answer, whatever the probes did.
86768
+ restoreVerifyFilter();
86769
+ return _context18.finish(524);
86770
+ case 527:
86423
86771
  appliedCount = [].concat(verifiedChanges, verifiedAdds, verifiedRemovals).filter(function (v) {
86424
86772
  return v.serverState === 'applied';
86425
86773
  }).length;
86426
- return _context18.abrupt("return", _objectSpread$5(_objectSpread$5({
86774
+ return _context18.abrupt("return", _objectSpread$5(_objectSpread$5(_objectSpread$5(_objectSpread$5({
86427
86775
  applied: false,
86428
86776
  appliedCount: appliedCount
86429
- }, serieScope ? {
86777
+ }, verifyDeadlineHit ? {
86778
+ verifyDeadlineHit: true
86779
+ } : {}), serieScope ? {
86430
86780
  targetSerie: {
86431
86781
  serieNo: serieScope.serieNo,
86432
86782
  name: serieScope.name,
86433
86783
  serieId: serieScope.serieId || undefined
86434
86784
  }
86785
+ } : {}), boundParentRow ? {
86786
+ boundParentRow: boundParentRow
86435
86787
  } : {}), {}, {
86436
86788
  serverErrors: serverErrors,
86437
86789
  changes: verifiedChanges.length ? verifiedChanges : undefined,
86438
86790
  addedRows: verifiedAdds.length ? verifiedAdds : undefined,
86439
86791
  removals: verifiedRemovals.length ? verifiedRemovals : undefined,
86440
86792
  failed: failed.length ? failed : undefined,
86441
- note: 'The SERVER REJECTED the listed rows. Every other operation was READ BACK from the server — its `serverState` is the truth: ' + 'applied = the effect IS on the server (do NOT re-send it), reverted = re-send it after fixing the rejection cause, ' + 'unknown = verify with readGridRows/locateRow before re-sending. Never re-send an applied or unknown operation blindly — that is how silent duplicates happen.'
86793
+ note: 'The SERVER REJECTED the listed rows. Every other operation was READ BACK from the server — its `serverState` is the truth: ' + 'applied = the effect IS on the server (do NOT re-send it), reverted = re-send it after fixing the rejection cause, ' + 'unknown = verify with readGridRows/locateRow before re-sending. Never re-send an applied or unknown operation blindly — that is how silent duplicates happen.' + (verifyDeadlineHit ? ' The read-back ran out of time, so some `unknown`s mean UNCHECKED rather than unanswered — check those yourself before deciding.' : '') + parentBindingNote
86442
86794
  }));
86443
- case 492:
86795
+ case 529:
86444
86796
  // Return the real _id so references are not built from grid rowIds; catalogs/packages list rows are new EDITORS.
86445
86797
  livePath = (_root$navigationState3 = root.navigationState.path) !== null && _root$navigationState3 !== void 0 ? _root$navigationState3 : '';
86446
86798
  editorPathFor = function editorPathFor(id) {
@@ -86448,9 +86800,11 @@ function createNavigationToolset(ctx) {
86448
86800
  }; // Above a handful of rows the receipt carries ids only — the values are what the agent just sent.
86449
86801
  echoValues = addedRows.length <= 10;
86450
86802
  withServerIds = addedRows.map(function (a) {
86451
- var _api2$getRowNode8;
86803
+ var _api2$getRowNode8, _outcome$createdIds$a2, _outcome$createdIds2;
86452
86804
  var rowData = (_api2$getRowNode8 = _api2.getRowNode(a.rowId)) === null || _api2$getRowNode8 === void 0 ? void 0 : _api2$getRowNode8.data;
86453
- var _id = rowData === null || rowData === void 0 ? void 0 : rowData._id;
86805
+ // The id the server handed out in the commit answer comes first; the grid node only knows it once the
86806
+ // post-commit transaction has reached it.
86807
+ var _id = (_outcome$createdIds$a2 = outcome === null || outcome === void 0 || (_outcome$createdIds2 = outcome.createdIds) === null || _outcome$createdIds2 === void 0 ? void 0 : _outcome$createdIds2[a.rowId]) !== null && _outcome$createdIds$a2 !== void 0 ? _outcome$createdIds$a2 : rowData === null || rowData === void 0 ? void 0 : rowData._id;
86454
86808
  var editorPath = editorPathFor(_id);
86455
86809
  // `persisted` comes from the commit's report — a missing _id is NOT evidence either way.
86456
86810
  var persisted = outcome ? committedIds.has(a.rowId) : undefined;
@@ -86469,7 +86823,10 @@ function createNavigationToolset(ctx) {
86469
86823
  }), editorPath ? {
86470
86824
  editorPath: editorPath
86471
86825
  } : {});
86472
- }); // The saved RECORDS' own serie, as the cross-check on the view's scope: they must agree.
86826
+ }); // A confirmed add whose echo carries no _id IS saved — measured on optioncombinations, where the retry duplicated the row.
86827
+ addedRowsWithoutId = withServerIds.filter(function (a) {
86828
+ return a.persisted === true && !a._id;
86829
+ }).length; // The saved RECORDS' own serie, as the cross-check on the view's scope: they must agree.
86473
86830
  landedInSeries = _toConsumableArray(new Set(withServerIds.map(function (a) {
86474
86831
  return a.serieId;
86475
86832
  }).filter(Boolean).map(String)));
@@ -86502,31 +86859,28 @@ function createNavigationToolset(ctx) {
86502
86859
  column: s.column
86503
86860
  };
86504
86861
  })), _toConsumableArray(addedRows.flatMap(function (a) {
86505
- return Object.entries(a.values).filter(function (_ref28) {
86862
+ return Object.entries(a.values).filter(function (_ref27) {
86506
86863
  var _providedAddColumns$g, _providedAddColumns$g2;
86507
- var _ref29 = _slicedToArray(_ref28, 2),
86508
- column = _ref29[0],
86509
- value = _ref29[1];
86864
+ var _ref28 = _slicedToArray(_ref27, 2),
86865
+ column = _ref28[0],
86866
+ value = _ref28[1];
86510
86867
  return !isEmptyCell(value) && ((_providedAddColumns$g = (_providedAddColumns$g2 = providedAddColumns.get(a.rowId)) === null || _providedAddColumns$g2 === void 0 ? void 0 : _providedAddColumns$g2.has(column)) !== null && _providedAddColumns$g !== void 0 ? _providedAddColumns$g : true);
86511
- }).map(function (_ref30) {
86512
- var _ref31 = _slicedToArray(_ref30, 1),
86513
- column = _ref31[0];
86868
+ }).map(function (_ref29) {
86869
+ var _ref30 = _slicedToArray(_ref29, 1),
86870
+ column = _ref30[0];
86514
86871
  return {
86515
86872
  rowId: a.rowId,
86516
86873
  column: column
86517
86874
  };
86518
86875
  });
86519
- }))).filter(function (_ref32) {
86520
- var rowId = _ref32.rowId,
86521
- column = _ref32.column;
86876
+ }))).filter(function (_ref31) {
86877
+ var rowId = _ref31.rowId,
86878
+ column = _ref31.column;
86522
86879
  var node = _api2.getRowNode(rowId);
86523
86880
  return node ? isEmptyCell(cellValueOf(_api2, node, column)) : false;
86524
- }); // Subtables register AFTER their parent, so anything past the first entry is a child grid.
86525
- isSubtable = root.gridRegistry.entries.findIndex(function (e) {
86526
- return e.label === _entry2.label;
86527
- }) > 0;
86881
+ });
86528
86882
  restoreUserFilter();
86529
- return _context18.abrupt("return", _objectSpread$5(_objectSpread$5(_objectSpread$5(_objectSpread$5(_objectSpread$5({
86883
+ return _context18.abrupt("return", _objectSpread$5(_objectSpread$5(_objectSpread$5(_objectSpread$5(_objectSpread$5(_objectSpread$5(_objectSpread$5({
86530
86884
  applied: true,
86531
86885
  appliedCount: confirmedCount
86532
86886
  }, silentlyDropped.length ? {
@@ -86542,36 +86896,41 @@ function createNavigationToolset(ctx) {
86542
86896
  name: serieScope.name,
86543
86897
  serieId: serieScope.serieId || undefined
86544
86898
  }
86899
+ } : {}), boundParentRow ? {
86900
+ boundParentRow: boundParentRow
86545
86901
  } : {}), {}, {
86546
86902
  unchangedCount: unchanged.length || undefined,
86547
86903
  changes: staged.length ? staged : undefined,
86548
- addedRows: withServerIds.length ? withServerIds : undefined,
86904
+ addedRows: withServerIds.length ? withServerIds : undefined
86905
+ }, addedRowsWithoutId ? {
86906
+ addedRowsWithoutId: addedRowsWithoutId
86907
+ } : {}), {}, {
86549
86908
  removedRowIds: removed.length ? removed : undefined,
86550
86909
  failed: failed.length ? failed : undefined,
86551
- note: "Changes saved through the table's normal edit path." + (autoCommitted ? ' The table had ALREADY saved this batch when the approval was answered (it saves pending edits by itself when the user clicks outside the grid), so what is confirmed below was read off the saved rows, not from the commit report.' : '') + (conditionedPosDefaults ? " ".concat(conditionedPosDefaults, " conditioned position(s) got posCountValue 0 automatically (the form default 1 would load them ALWAYS) \u2014 pass posCountValue explicitly to override.") : '') + (failed.length ? " PARTIAL SUCCESS: ".concat(failed.length, " entr").concat(failed.length === 1 ? 'y' : 'ies', " FAILED (see 'failed') \u2014 report them to the user, never claim everything was saved.") : '') + (addedRows.length ? ' New rows: rowId addresses the row in THIS grid session only — for record references and editor paths use the returned _id.' + (echoValues ? '' : ' Values are not echoed at this batch size — they are what you sent; readGridRows to verify.') : '') + (withServerIds.some(function (a) {
86910
+ note: "Changes saved through the table's normal edit path." + (addedRowsWithoutId ? " ".concat(addedRowsWithoutId, " added row(s) were CONFIRMED by the commit but came back WITHOUT an _id: the row IS on the server \u2014 do NOT re-send it, that creates a duplicate. Read it back for its _id (readGridRows/locateRow on this table; getDecision for a combination row) before building on it.") : '') + (reroutedRecordIds ? " ".concat(reroutedRecordIds, " rowId(s) were record _ids of rows not loaded on screen \u2014 resolved through the _id column (server-side lookup), which is how such rows are addressed here.") : '') + (autoCommitted ? ' The table had ALREADY saved this batch when the approval was answered (it saves pending edits by itself when the user clicks outside the grid), so what is confirmed below was read off the saved rows, not from the commit report.' : '') + (conditionedPosDefaults ? " ".concat(conditionedPosDefaults, " conditioned position(s) got posCountValue 0 automatically (the form default 1 would load them ALWAYS) \u2014 pass posCountValue explicitly to override.") : '') + (failed.length ? " PARTIAL SUCCESS: ".concat(failed.length, " entr").concat(failed.length === 1 ? 'y' : 'ies', " FAILED (see 'failed') \u2014 report them to the user, never claim everything was saved.") : '') + (addedRows.length ? ' New rows: rowId addresses the row in THIS grid session only — for record references and editor paths use the returned _id.' + (echoValues ? '' : ' Values are not echoed at this batch size — they are what you sent; readGridRows to verify.') : '') + (withServerIds.some(function (a) {
86552
86911
  return a.editorPath;
86553
86912
  }) ? ' A created catalog/pack is a new EDITOR: the list view only holds its shell — when the task continues with its content (series, articles, features, overlays, …), navigateTo its editorPath and work INSIDE (all sub-views appear in listViews there).' : '') + (
86554
86913
  // A freshly created decision reports persisted:true and then does NOTHING — it only runs where referenced.
86555
86914
  _entry2.label === 'decisions' && withServerIds.length ? ' A NEW DECISION RUNS NOWHERE YET: it only executes once its decisionNo is listed in series.decisionRefs (or items.decisionRefs for article-specific rules) — wire it now, and note the planner picks the new ref up only after a FULL page reload (reloadPage), not reloadPlanner.' : '') + (ctx.autoApprove ? ' AUTO-APPROVE is on — committed WITHOUT the approval bar; mention that ONCE per reply, not per call.' : '') + (
86556
86915
  // A subtable commit does NOT refresh the parent row — verifying via the parent invites duplicates.
86557
- isSubtable ? ' SUBTABLE WRITE: the PARENT row still shows its pre-change aggregate (e.g. featureclasses.featureRefs) and its lastUpdatedDate does NOT move — that is a missing refresh, not a failed write. Verify in THIS subtable (readGridRows), never via the parent row; the parent catches up only after the view is re-entered.' : '') + (
86916
+ isSubtable ? ' SUBTABLE WRITE: the PARENT row still shows its pre-change aggregate (e.g. featureclasses.featureRefs) and its lastUpdatedDate does NOT move — that is a missing refresh, not a failed write. Verify in THIS subtable (readGridRows), never via the parent row; the parent catches up only after the view is re-entered.' : '') + parentBindingNote + (
86558
86917
  // The serie by NUMBER AND NAME, not by 24-hex id — the thing to check is whether this is serie 0.
86559
86918
  serieScope && (addedRows.length || staged.length || removed.length) ? " SERIE-SCOPED TABLE: these rows belong to ".concat(serieLabelOf(serieScope), " \u2014 the serie the VIEW's selector held, which AUTO-SELECTS THE FIRST serie when nobody chose one").concat(addedRows.length ? ', so a new row can land in the components serie without anyone deciding that' : '', ". CONFIRM it is the serie you meant before continuing.").concat(foreignSeries.length ? " MISMATCH: the saved record(s) report serieId ".concat(foreignSeries.join(', '), ", which is NOT this view's scope \u2014 read the rows back before doing anything else.") : '') : '') + (removed.length ? ' REMOVALS: inbound references are NOT cleaned up. Deleting an entity leaves dead pointers in decisions (featureRefs + condition columns), price feature groups + their finishes conditions, option-group membership, partlistpos.itemRefTypeNo, items.featureClassRefNo and items.partListRef, plus formula keys inside action strings — measured on all of these. Two of them make the planner THROW on init (a missing feature class, a missing formula). Only option keys inside decision condition/action cells are cleaned, and a deleted PRICE FEATURE GROUP is the one clean case (its matrix column goes with it). So after any delete, read the referrers yourself; nothing warns you. ' + 'lintCatalog finds most of them AFTER a reloadPlanner — but NOT a dead items.featureClassRefNo, because that article throws during init and never enters the snapshot it lints. For that one check the EDITOR: on the items view, readGridRows({grid:"items", columns:["typeNo","featureClassRefNo"]}) and compare against readColumnOptions({grid:"items", column:"featureClassRefNo"}), which lists the classes that still exist. Same approach for partlistpos.itemRefTypeNo against the items list.' : '') + ' Loaded planner instances still hold PRE-change data — reloadPlanner before verifying these changes in the planner.' + (stagingNotes.length ? " HOUSE-STYLE NOTES: ".concat(stagingNotes.join(' ')) : '')
86560
86919
  }));
86561
- case 506:
86920
+ case 543:
86562
86921
  // Thrown (not returned) so the refusal does NOT end the turn — the model tells the user to decide on the staged edits first.
86563
86922
  dirtyGrids = root.gridRegistry.entries.filter(function (entry) {
86564
- var _entry$getHandle5;
86565
- return (_entry$getHandle5 = entry.getHandle()) === null || _entry$getHandle5 === void 0 ? void 0 : _entry$getHandle5.hasPendingChanges();
86923
+ var _entry$getHandle4;
86924
+ return (_entry$getHandle4 = entry.getHandle()) === null || _entry$getHandle4 === void 0 ? void 0 : _entry$getHandle4.hasPendingChanges();
86566
86925
  }).map(function (entry) {
86567
86926
  return entry.label;
86568
86927
  });
86569
86928
  if (!dirtyGrids.length) {
86570
- _context18.next = 509;
86929
+ _context18.next = 546;
86571
86930
  break;
86572
86931
  }
86573
86932
  throw new Error("Page reload refused: table(s) ".concat(dirtyGrids.join(', '), " still carry staged, unapproved edits that a reload would silently drop. Ask the user to \xDCbernehmen or Verwerfen them first, then call reloadPage again."));
86574
- case 509:
86933
+ case 546:
86575
86934
  // Deferred so the tool result reaches the chat and the turn is persisted (the stored endedByTool record is what
86576
86935
  // triggers the automatic 'Continue.' after the reload) before the document unloads.
86577
86936
  setTimeout(function () {
@@ -86579,73 +86938,77 @@ function createNavigationToolset(ctx) {
86579
86938
  }, 2000);
86580
86939
  return _context18.abrupt("return", {
86581
86940
  ok: true,
86941
+ // Tells the bridge client not to wait for a settled context — this document is gone in 2 s.
86942
+ pageReload: true,
86582
86943
  note: "Full page reload triggered — this turn ends here. The chat reopens on this conversation and an automatic 'Continue.' follows once the view is ready (if the agent panel is not open after the reload, it fires when the user opens it). Every planner instance is rebuilt from a FRESH article payload, so decisionRefs and media changes are now in effect — verify with listDecisions / getMediaInfo, do not assume."
86583
86944
  });
86584
- case 511:
86945
+ case 548:
86585
86946
  _livePath = (_root$navigationState4 = root.navigationState.path) !== null && _root$navigationState4 !== void 0 ? _root$navigationState4 : '';
86586
86947
  packageBase = (_livePath$match = _livePath.match(/catalogs\/idmeditor\/packages\/([^/]+)/)) === null || _livePath$match === void 0 ? void 0 : _livePath$match[1];
86587
86948
  catalogBase = (_livePath$match2 = _livePath.match(/catalogs\/idmeditor\/catalogs\/([^/]+)/)) === null || _livePath$match2 === void 0 ? void 0 : _livePath$match2[1];
86588
- baseId = (_ref37 = (_ref38 = packageBase !== null && packageBase !== void 0 ? packageBase : catalogBase) !== null && _ref38 !== void 0 ? _ref38 : ctx.packageId) !== null && _ref37 !== void 0 ? _ref37 : ctx.catalogId;
86949
+ baseId = (_ref36 = (_ref37 = packageBase !== null && packageBase !== void 0 ? packageBase : catalogBase) !== null && _ref37 !== void 0 ? _ref37 : ctx.packageId) !== null && _ref36 !== void 0 ? _ref36 : ctx.catalogId;
86589
86950
  if (baseId) {
86590
- _context18.next = 517;
86951
+ _context18.next = 554;
86591
86952
  break;
86592
86953
  }
86593
86954
  return _context18.abrupt("return", {
86594
86955
  error: 'No catalog/package context — nothing to reload.'
86595
86956
  });
86596
- case 517:
86957
+ case 554:
86597
86958
  // Package views load the ENRICHER pack, catalog views the raw IDM catalog.
86598
86959
  isPack = baseId === packageBase || !packageBase && !catalogBase && baseId === ctx.packageId;
86599
86960
  _root$webplannerInsta = root.webplannerInstanceStore.invalidateByBase(baseId), destroyed = _root$webplannerInsta.destroyed, reloadTriggered = _root$webplannerInsta.reloadTriggered, knownKeys = _root$webplannerInsta.knownKeys;
86600
86961
  source = isPack ? "PACKAGE ".concat(baseId, " (enricher pack: pricelist factors and manual prices APPLY)") : "CATALOG ".concat(baseId, " (raw IDM catalog: enricher pricelists do NOT apply \u2014 to verify pack prices, navigateTo the package view first, then reloadPlanner there)"); // A base matching no instance key invalidates nothing — report that instead of claiming the discard happened.
86601
86962
  if (!(!destroyed && !reloadTriggered)) {
86602
- _context18.next = 524;
86963
+ _context18.next = 561;
86603
86964
  break;
86604
86965
  }
86605
86966
  if (knownKeys.length) {
86606
- _context18.next = 523;
86967
+ _context18.next = 560;
86607
86968
  break;
86608
86969
  }
86609
86970
  return _context18.abrupt("return", {
86610
86971
  ok: true,
86611
86972
  destroyed: destroyed,
86612
86973
  reloadTriggered: reloadTriggered,
86974
+ environmentUnchanged: true,
86613
86975
  note: "NOTHING TO RELOAD \u2014 no planner instance is loaded for ".concat(baseId, ", so there was no stale snapshot to discard. The next planner use loads CURRENT data from ").concat(source, ".")
86614
86976
  });
86615
- case 523:
86977
+ case 560:
86616
86978
  return _context18.abrupt("return", {
86617
86979
  ok: false,
86618
86980
  destroyed: destroyed,
86619
86981
  reloadTriggered: reloadTriggered,
86982
+ environmentUnchanged: true,
86620
86983
  knownKeys: knownKeys,
86621
86984
  error: "Nothing was invalidated: no loaded planner belongs to '".concat(baseId, "'. Loaded instance keys are [").concat(knownKeys.join(', '), "] ") + "(key = catalogId|serieNo|itemTypeNo|language). A key whose first segment is EMPTY or differs from '".concat(baseId, "' means the ") + "configurator was mounted without the catalog binding \u2014 reload the page to re-bind, then reloadPlanner again. Do NOT treat " + "planner reads as current until this succeeds."
86622
86985
  });
86623
- case 524:
86986
+ case 561:
86624
86987
  return _context18.abrupt("return", {
86625
86988
  ok: true,
86626
86989
  destroyed: destroyed,
86627
86990
  reloadTriggered: reloadTriggered,
86628
86991
  note: "Planner instances were discarded \u2014 the next planner use loads CURRENT data from ".concat(source) + (reloadTriggered ? ' (the open configurator reloads itself, and its stale instance is destroyed rather than re-adopted)' : '') + ". The turn ends here; an automatic 'Continue.' follows."
86629
86992
  });
86630
- case 525:
86993
+ case 562:
86631
86994
  _resolveGrid4 = resolveGrid(args.grid), _entry3 = _resolveGrid4.entry, _error3 = _resolveGrid4.error;
86632
86995
  if (!(_error3 || !_entry3)) {
86633
- _context18.next = 528;
86996
+ _context18.next = 565;
86634
86997
  break;
86635
86998
  }
86636
86999
  return _context18.abrupt("return", {
86637
87000
  error: _error3
86638
87001
  });
86639
- case 528:
87002
+ case 565:
86640
87003
  _handle = _entry3.getHandle();
86641
87004
  if (_handle) {
86642
- _context18.next = 531;
87005
+ _context18.next = 568;
86643
87006
  break;
86644
87007
  }
86645
87008
  return _context18.abrupt("return", {
86646
87009
  error: "Table '".concat(_entry3.label, "' is not ready.")
86647
87010
  });
86648
- case 531:
87011
+ case 568:
86649
87012
  actionName = String((_action = input === null || input === void 0 ? void 0 : input.action) !== null && _action !== void 0 ? _action : '');
86650
87013
  actionInput = String((_input = input === null || input === void 0 ? void 0 : input.input) !== null && _input !== void 0 ? _input : '').trim();
86651
87014
  _addTargets = _handle.getDivaColumnDefs().filter(isHeaderAddColumn);
@@ -86656,15 +87019,15 @@ function createNavigationToolset(ctx) {
86656
87019
  return action.name;
86657
87020
  })));
86658
87021
  if (available.includes(actionName)) {
86659
- _context18.next = 538;
87022
+ _context18.next = 575;
86660
87023
  break;
86661
87024
  }
86662
87025
  return _context18.abrupt("return", {
86663
87026
  error: "Action '".concat(actionName, "' is not available on '").concat(_entry3.label, "' \u2014 this table has: ").concat(available.join(', ') || 'no actions', " (listGrids shows each table's actions).")
86664
87027
  });
86665
- case 538:
87028
+ case 575:
86666
87029
  approve = /*#__PURE__*/function () {
86667
- var _ref39 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(label) {
87030
+ var _ref38 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(label) {
86668
87031
  return _regeneratorRuntime.wrap(function _callee8$(_context13) {
86669
87032
  while (1) switch (_context13.prev = _context13.next) {
86670
87033
  case 0:
@@ -86687,7 +87050,7 @@ function createNavigationToolset(ctx) {
86687
87050
  }, _callee8);
86688
87051
  }));
86689
87052
  return function approve(_x26) {
86690
- return _ref39.apply(this, arguments);
87053
+ return _ref38.apply(this, arguments);
86691
87054
  };
86692
87055
  }();
86693
87056
  declined = {
@@ -86696,7 +87059,7 @@ function createNavigationToolset(ctx) {
86696
87059
  }; // Same transparency rule as stageTableEdits: a silently executed action must be reported as such.
86697
87060
  autoNote = ctx.autoApprove ? ' AUTO-APPROVE is on — executed WITHOUT the approval bar; mention that ONCE per reply, not per call.' : '';
86698
87061
  authorizedFetch = /*#__PURE__*/function () {
86699
- var _ref40 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(url, method, body) {
87062
+ var _ref39 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(url, method, body) {
86700
87063
  var response, detail;
86701
87064
  return _regeneratorRuntime.wrap(function _callee9$(_context14) {
86702
87065
  while (1) switch (_context14.prev = _context14.next) {
@@ -86731,11 +87094,11 @@ function createNavigationToolset(ctx) {
86731
87094
  }, _callee9);
86732
87095
  }));
86733
87096
  return function authorizedFetch(_x27, _x28, _x29) {
86734
- return _ref40.apply(this, arguments);
87097
+ return _ref39.apply(this, arguments);
86735
87098
  };
86736
87099
  }(); // The reload is asynchronous — purge, then wait bounded until rows are back.
86737
87100
  refreshAndSettle = /*#__PURE__*/function () {
86738
- var _ref41 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
87101
+ var _ref40 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
86739
87102
  var api, deadline;
86740
87103
  return _regeneratorRuntime.wrap(function _callee10$(_context15) {
86741
87104
  while (1) switch (_context15.prev = _context15.next) {
@@ -86762,7 +87125,7 @@ function createNavigationToolset(ctx) {
86762
87125
  }, _callee10);
86763
87126
  }));
86764
87127
  return function refreshAndSettle() {
86765
- return _ref41.apply(this, arguments);
87128
+ return _ref40.apply(this, arguments);
86766
87129
  };
86767
87130
  }();
86768
87131
  unsettledNote = ' WARNING: the table has NOT repopulated yet (server still recomputing) — before reading it, reopen the view: locateRow the parent row again, openToolbarTool the subtable.'; // Declared by the VIEW and executed by it — this toolset only carries the input and the approval.
@@ -86770,347 +87133,347 @@ function createNavigationToolset(ctx) {
86770
87133
  return action.name === actionName;
86771
87134
  });
86772
87135
  if (!viewAction) {
86773
- _context18.next = 566;
87136
+ _context18.next = 603;
86774
87137
  break;
86775
87138
  }
86776
87139
  mutating = viewAction.mutating !== false;
86777
87140
  _context18.t17 = mutating;
86778
87141
  if (!_context18.t17) {
86779
- _context18.next = 552;
87142
+ _context18.next = 589;
86780
87143
  break;
86781
87144
  }
86782
- _context18.next = 551;
87145
+ _context18.next = 588;
86783
87146
  return approve("".concat(actionName, ": ").concat(actionInput || '(no input)'));
86784
- case 551:
87147
+ case 588:
86785
87148
  _context18.t17 = !_context18.sent;
86786
- case 552:
87149
+ case 589:
86787
87150
  if (!_context18.t17) {
86788
- _context18.next = 554;
87151
+ _context18.next = 591;
86789
87152
  break;
86790
87153
  }
86791
87154
  return _context18.abrupt("return", declined);
86792
- case 554:
86793
- _context18.prev = 554;
87155
+ case 591:
87156
+ _context18.prev = 591;
86794
87157
  _context18.t18 = "";
86795
- _context18.next = 558;
87158
+ _context18.next = 595;
86796
87159
  return viewAction.run(actionInput);
86797
- case 558:
87160
+ case 595:
86798
87161
  _context18.t19 = _context18.sent;
86799
87162
  _context18.t20 = _context18.t18.concat.call(_context18.t18, _context18.t19).concat(mutating ? autoNote : '');
86800
87163
  return _context18.abrupt("return", {
86801
87164
  applied: true,
86802
87165
  note: _context18.t20
86803
87166
  });
86804
- case 563:
86805
- _context18.prev = 563;
86806
- _context18.t21 = _context18["catch"](554);
87167
+ case 600:
87168
+ _context18.prev = 600;
87169
+ _context18.t21 = _context18["catch"](591);
86807
87170
  return _context18.abrupt("return", {
86808
87171
  error: _context18.t21 instanceof Error ? _context18.t21.message : String(_context18.t21)
86809
87172
  });
86810
- case 566:
87173
+ case 603:
86811
87174
  if (!(actionName === 'cloneCatalog')) {
86812
- _context18.next = 585;
87175
+ _context18.next = 622;
86813
87176
  break;
86814
87177
  }
86815
87178
  if (isRecordId(actionInput)) {
86816
- _context18.next = 569;
87179
+ _context18.next = 606;
86817
87180
  break;
86818
87181
  }
86819
87182
  return _context18.abrupt("return", {
86820
87183
  error: "input must be the catalog's _id (24-hex) — read it from the _id column (readGridRows)."
86821
87184
  });
86822
- case 569:
86823
- _context18.next = 571;
87185
+ case 606:
87186
+ _context18.next = 608;
86824
87187
  return approve("cloneCatalog: ".concat(actionInput));
86825
- case 571:
87188
+ case 608:
86826
87189
  if (_context18.sent) {
86827
- _context18.next = 573;
87190
+ _context18.next = 610;
86828
87191
  break;
86829
87192
  }
86830
87193
  return _context18.abrupt("return", declined);
86831
- case 573:
86832
- _context18.prev = 573;
86833
- _context18.next = 576;
87194
+ case 610:
87195
+ _context18.prev = 610;
87196
+ _context18.next = 613;
86834
87197
  return authorizedFetch("".concat(root.configurationStore.apiConfig.idmService, "/catalogs/").concat(actionInput, "/clone"), 'POST', '{}');
86835
- case 576:
86836
- _context18.next = 581;
87198
+ case 613:
87199
+ _context18.next = 618;
86837
87200
  break;
86838
- case 578:
86839
- _context18.prev = 578;
86840
- _context18.t22 = _context18["catch"](573);
87201
+ case 615:
87202
+ _context18.prev = 615;
87203
+ _context18.t22 = _context18["catch"](610);
86841
87204
  return _context18.abrupt("return", {
86842
87205
  error: _context18.t22 instanceof Error ? _context18.t22.message : String(_context18.t22)
86843
87206
  });
86844
- case 581:
86845
- _context18.next = 583;
87207
+ case 618:
87208
+ _context18.next = 620;
86846
87209
  return refreshAndSettle();
86847
- case 583:
87210
+ case 620:
86848
87211
  cloneSettled = _context18.sent;
86849
87212
  return _context18.abrupt("return", {
86850
87213
  applied: true,
86851
87214
  note: "Catalog cloned server-side \u2014 the table refreshes; the copy appears as a new row (readGridRows to find it and REPORT its name + _id).".concat(autoNote).concat(cloneSettled ? '' : unsettledNote)
86852
87215
  });
86853
- case 585:
87216
+ case 622:
86854
87217
  if (!(actionName === 'importGlobalFeatures')) {
86855
- _context18.next = 605;
87218
+ _context18.next = 642;
86856
87219
  break;
86857
87220
  }
86858
87221
  catalogId = String((_catalogId = ((_handle$getApplicatio7 = (_handle$getApplicatio8 = _handle.getApplicationData) === null || _handle$getApplicatio8 === void 0 ? void 0 : _handle$getApplicatio8.call(_handle)) !== null && _handle$getApplicatio7 !== void 0 ? _handle$getApplicatio7 : {}).catalogId) !== null && _catalogId !== void 0 ? _catalogId : '');
86859
87222
  if (catalogId) {
86860
- _context18.next = 589;
87223
+ _context18.next = 626;
86861
87224
  break;
86862
87225
  }
86863
87226
  return _context18.abrupt("return", {
86864
87227
  error: 'No catalog context on this table.'
86865
87228
  });
86866
- case 589:
86867
- _context18.next = 591;
87229
+ case 626:
87230
+ _context18.next = 628;
86868
87231
  return approve('importGlobalFeatures');
86869
- case 591:
87232
+ case 628:
86870
87233
  if (_context18.sent) {
86871
- _context18.next = 593;
87234
+ _context18.next = 630;
86872
87235
  break;
86873
87236
  }
86874
87237
  return _context18.abrupt("return", declined);
86875
- case 593:
86876
- _context18.prev = 593;
86877
- _context18.next = 596;
87238
+ case 630:
87239
+ _context18.prev = 630;
87240
+ _context18.next = 633;
86878
87241
  return authorizedFetch("".concat(root.configurationStore.apiConfig.idmService, "/catalogs/").concat(catalogId, "/features/global"), 'POST');
86879
- case 596:
86880
- _context18.next = 601;
87242
+ case 633:
87243
+ _context18.next = 638;
86881
87244
  break;
86882
- case 598:
86883
- _context18.prev = 598;
86884
- _context18.t23 = _context18["catch"](593);
87245
+ case 635:
87246
+ _context18.prev = 635;
87247
+ _context18.t23 = _context18["catch"](630);
86885
87248
  return _context18.abrupt("return", {
86886
87249
  error: _context18.t23 instanceof Error ? _context18.t23.message : String(_context18.t23)
86887
87250
  });
86888
- case 601:
86889
- _context18.next = 603;
87251
+ case 638:
87252
+ _context18.next = 640;
86890
87253
  return refreshAndSettle();
86891
- case 603:
87254
+ case 640:
86892
87255
  importSettled = _context18.sent;
86893
87256
  return _context18.abrupt("return", {
86894
87257
  applied: true,
86895
87258
  note: "Global features imported \u2014 the table refreshes with the added feature rows.".concat(autoNote).concat(importSettled ? '' : unsettledNote)
86896
87259
  });
86897
- case 605:
87260
+ case 642:
86898
87261
  if (!(actionName === 'setPriceFactor' || actionName === 'setPriceFactorPriority')) {
86899
- _context18.next = 666;
87262
+ _context18.next = 703;
86900
87263
  break;
86901
87264
  }
86902
87265
  app = (_handle$getApplicatio9 = (_handle$getApplicatio10 = _handle.getApplicationData) === null || _handle$getApplicatio10 === void 0 ? void 0 : _handle$getApplicatio10.call(_handle)) !== null && _handle$getApplicatio9 !== void 0 ? _handle$getApplicatio9 : {};
86903
87266
  serieNo = Number(app.serieNo);
86904
- _context18.prev = 608;
87267
+ _context18.prev = 645;
86905
87268
  params = JSON.parse(actionInput || '{}');
86906
- _context18.next = 615;
87269
+ _context18.next = 652;
86907
87270
  break;
86908
- case 612:
86909
- _context18.prev = 612;
86910
- _context18.t24 = _context18["catch"](608);
87271
+ case 649:
87272
+ _context18.prev = 649;
87273
+ _context18.t24 = _context18["catch"](645);
86911
87274
  return _context18.abrupt("return", {
86912
87275
  error: "input must be a JSON object — listGrids shows this action's exact shape."
86913
87276
  });
86914
- case 615:
87277
+ case 652:
86915
87278
  scope = String((_params$scope = params.scope) !== null && _params$scope !== void 0 ? _params$scope : '');
86916
87279
  if (scope in PRICE_FACTOR_FIELDS) {
86917
- _context18.next = 618;
87280
+ _context18.next = 655;
86918
87281
  break;
86919
87282
  }
86920
87283
  return _context18.abrupt("return", {
86921
87284
  error: "scope must be one of: ".concat(Object.keys(PRICE_FACTOR_FIELDS).join(', '), ".")
86922
87285
  });
86923
- case 618:
87286
+ case 655:
86924
87287
  key = params.key === undefined ? undefined : String(params.key); // The factor maps live on the PRICELIST record — the write goes through the parent pricelists grid row.
86925
87288
  parent = resolveGrid('pricelists');
86926
87289
  if (!(parent.error || !parent.entry || !parent.api)) {
86927
- _context18.next = 622;
87290
+ _context18.next = 659;
86928
87291
  break;
86929
87292
  }
86930
87293
  return _context18.abrupt("return", {
86931
87294
  error: "The parent 'pricelists' table must be on screen for factor actions."
86932
87295
  });
86933
- case 622:
87296
+ case 659:
86934
87297
  parentHandle = parent.entry.getHandle();
86935
87298
  if (parentHandle) {
86936
- _context18.next = 625;
87299
+ _context18.next = 662;
86937
87300
  break;
86938
87301
  }
86939
87302
  return _context18.abrupt("return", {
86940
87303
  error: "Table 'pricelists' is not ready."
86941
87304
  });
86942
- case 625:
87305
+ case 662:
86943
87306
  parent.api.forEachNode(function (node) {
86944
87307
  var _node$data4;
86945
87308
  if (((_node$data4 = node.data) === null || _node$data4 === void 0 ? void 0 : _node$data4._id) === app.pricelistId) pricelistNode = node;
86946
87309
  });
86947
87310
  if ((_pricelistNode = pricelistNode) !== null && _pricelistNode !== void 0 && _pricelistNode.id) {
86948
- _context18.next = 628;
87311
+ _context18.next = 665;
86949
87312
  break;
86950
87313
  }
86951
87314
  return _context18.abrupt("return", {
86952
87315
  error: "Pricelist ".concat(app.pricelistId, " is not loaded in the 'pricelists' table.")
86953
87316
  });
86954
- case 628:
86955
- _context18.prev = 628;
87317
+ case 665:
87318
+ _context18.prev = 665;
86956
87319
  if (!(actionName === 'setPriceFactor')) {
86957
- _context18.next = 637;
87320
+ _context18.next = 674;
86958
87321
  break;
86959
87322
  }
86960
87323
  factors = params.factors;
86961
87324
  if (!(!Array.isArray(factors) || factors.some(function (f) {
86962
87325
  return typeof f !== 'number' || !Number.isFinite(f) || f <= 0;
86963
87326
  }))) {
86964
- _context18.next = 633;
87327
+ _context18.next = 670;
86965
87328
  break;
86966
87329
  }
86967
87330
  return _context18.abrupt("return", {
86968
87331
  error: 'factors must be an array of positive numbers (>1 = factor, <1 = discount fraction, e.g. 0.95 = 5% off); [] clears the entry.'
86969
87332
  });
86970
- case 633:
87333
+ case 670:
86971
87334
  patch = applyPriceFactor(pricelistNode.data, serieNo, scope, key, factors);
86972
87335
  label = "setPriceFactor ".concat(scope).concat(key ? " ".concat(key) : '', " \u2192 [").concat(factors.join('; '), "] (Serie ").concat(serieNo, ")");
86973
- _context18.next = 643;
87336
+ _context18.next = 680;
86974
87337
  break;
86975
- case 637:
87338
+ case 674:
86976
87339
  if (!(typeof params.priority !== 'boolean')) {
86977
- _context18.next = 639;
87340
+ _context18.next = 676;
86978
87341
  break;
86979
87342
  }
86980
87343
  return _context18.abrupt("return", {
86981
87344
  error: 'priority must be true or false.'
86982
87345
  });
86983
- case 639:
87346
+ case 676:
86984
87347
  if (key) {
86985
- _context18.next = 641;
87348
+ _context18.next = 678;
86986
87349
  break;
86987
87350
  }
86988
87351
  return _context18.abrupt("return", {
86989
87352
  error: 'key is required (the pfg id / price group).'
86990
87353
  });
86991
- case 641:
87354
+ case 678:
86992
87355
  patch = applyPriceFactorPriority(pricelistNode.data, serieNo, scope, key, params.priority);
86993
87356
  label = "setPriceFactorPriority ".concat(scope, " ").concat(key, " \u2192 ").concat(params.priority, " (Serie ").concat(serieNo, ")");
86994
- case 643:
86995
- _context18.next = 648;
87357
+ case 680:
87358
+ _context18.next = 685;
86996
87359
  break;
86997
- case 645:
86998
- _context18.prev = 645;
86999
- _context18.t25 = _context18["catch"](628);
87360
+ case 682:
87361
+ _context18.prev = 682;
87362
+ _context18.t25 = _context18["catch"](665);
87000
87363
  return _context18.abrupt("return", {
87001
87364
  error: _context18.t25 instanceof Error ? _context18.t25.message : String(_context18.t25)
87002
87365
  });
87003
- case 648:
87004
- _context18.next = 650;
87366
+ case 685:
87367
+ _context18.next = 687;
87005
87368
  return approve(label);
87006
- case 650:
87369
+ case 687:
87007
87370
  if (_context18.sent) {
87008
- _context18.next = 652;
87371
+ _context18.next = 689;
87009
87372
  break;
87010
87373
  }
87011
87374
  return _context18.abrupt("return", declined);
87012
- case 652:
87375
+ case 689:
87013
87376
  pricelistRowId = pricelistNode.id;
87014
- _context18.next = 655;
87377
+ _context18.next = 692;
87015
87378
  return parentHandle.setNodeDataValue(pricelistRowId, patch, {
87016
87379
  suppressAutoCommit: true
87017
87380
  });
87018
- case 655:
87381
+ case 692:
87019
87382
  if (_context18.sent) {
87020
- _context18.next = 657;
87383
+ _context18.next = 694;
87021
87384
  break;
87022
87385
  }
87023
87386
  return _context18.abrupt("return", {
87024
87387
  error: 'The pricelist row rejected the update.'
87025
87388
  });
87026
- case 657:
87027
- _context18.next = 659;
87389
+ case 694:
87390
+ _context18.next = 696;
87028
87391
  return parentHandle.commitStagedChanges();
87029
- case 659:
87392
+ case 696:
87030
87393
  factorOutcome = _context18.sent;
87031
87394
  rejected = factorOutcome === null || factorOutcome === void 0 ? void 0 : factorOutcome.failed.find(function (failure) {
87032
87395
  return failure.rowId === pricelistRowId;
87033
87396
  });
87034
87397
  if (!rejected) {
87035
- _context18.next = 663;
87398
+ _context18.next = 700;
87036
87399
  break;
87037
87400
  }
87038
87401
  return _context18.abrupt("return", {
87039
87402
  error: "The server rejected the factor update: ".concat(rejected.errors.join(' ') || 'no reason given', ". Nothing was changed.")
87040
87403
  });
87041
- case 663:
87404
+ case 700:
87042
87405
  if (!(factorOutcome && !factorOutcome.committed.includes(pricelistRowId))) {
87043
- _context18.next = 665;
87406
+ _context18.next = 702;
87044
87407
  break;
87045
87408
  }
87046
87409
  return _context18.abrupt("return", {
87047
87410
  error: 'The factor update was NOT saved — the commit did not confirm the pricelist row. Re-read the pricelist (readGridRows) before retrying.'
87048
87411
  });
87049
- case 665:
87412
+ case 702:
87050
87413
  return _context18.abrupt("return", {
87051
87414
  applied: true,
87052
87415
  note: "Saved on the pricelist record and confirmed by the server (same path as the factor modal) \u2014 the prices table reflects it immediately.".concat(autoNote)
87053
87416
  });
87054
- case 666:
87417
+ case 703:
87055
87418
  if (!(actionName === 'deleteAllManualPrices')) {
87056
- _context18.next = 684;
87419
+ _context18.next = 721;
87057
87420
  break;
87058
87421
  }
87059
87422
  _app = (_handle$getApplicatio11 = (_handle$getApplicatio12 = _handle.getApplicationData) === null || _handle$getApplicatio12 === void 0 ? void 0 : _handle$getApplicatio12.call(_handle)) !== null && _handle$getApplicatio11 !== void 0 ? _handle$getApplicatio11 : {};
87060
- _context18.next = 670;
87423
+ _context18.next = 707;
87061
87424
  return approve("deleteAllManualPrices (Pricelist ".concat(_app.pricelistId, ", Serie ").concat(_app.serieNo, ")"));
87062
- case 670:
87425
+ case 707:
87063
87426
  if (_context18.sent) {
87064
- _context18.next = 672;
87427
+ _context18.next = 709;
87065
87428
  break;
87066
87429
  }
87067
87430
  return _context18.abrupt("return", declined);
87068
- case 672:
87069
- _context18.prev = 672;
87070
- _context18.next = 675;
87431
+ case 709:
87432
+ _context18.prev = 709;
87433
+ _context18.next = 712;
87071
87434
  return authorizedFetch("".concat(root.configurationStore.apiConfig.enricherService, "/packages/").concat(_app.packageId, "/pricelists/").concat(_app.pricelistId, "/serie/").concat(_app.serieNo, "/prices/manual"), 'DELETE');
87072
- case 675:
87073
- _context18.next = 680;
87435
+ case 712:
87436
+ _context18.next = 717;
87074
87437
  break;
87075
- case 677:
87076
- _context18.prev = 677;
87077
- _context18.t26 = _context18["catch"](672);
87438
+ case 714:
87439
+ _context18.prev = 714;
87440
+ _context18.t26 = _context18["catch"](709);
87078
87441
  return _context18.abrupt("return", {
87079
87442
  error: _context18.t26 instanceof Error ? _context18.t26.message : String(_context18.t26)
87080
87443
  });
87081
- case 680:
87082
- _context18.next = 682;
87444
+ case 717:
87445
+ _context18.next = 719;
87083
87446
  return refreshAndSettle();
87084
- case 682:
87447
+ case 719:
87085
87448
  pricesSettled = _context18.sent;
87086
87449
  return _context18.abrupt("return", {
87087
87450
  applied: true,
87088
87451
  note: "All manual price overrides of this pricelist+serie were deleted (irreversible) \u2014 the table refreshed; origPrices and factors now determine every cell.".concat(autoNote).concat(pricesSettled ? '' : unsettledNote)
87089
87452
  });
87090
- case 684:
87453
+ case 721:
87091
87454
  // addColumn: one approval, sequential adds — parallel adds race the view rebuild.
87092
87455
  _target4 = _addTargets[0];
87093
87456
  if (actionInput) {
87094
- _context18.next = 687;
87457
+ _context18.next = 724;
87095
87458
  break;
87096
87459
  }
87097
87460
  return _context18.abrupt("return", {
87098
87461
  error: "Provide input: the key(s) to add, comma-separated \u2014 readColumnOptions('".concat(_target4.field, "') lists the addable entries.")
87099
87462
  });
87100
- case 687:
87463
+ case 724:
87101
87464
  keys = actionInput.split(',').map(function (k) {
87102
87465
  return k.trim();
87103
87466
  }).filter(Boolean); // Resolve ALL keys BEFORE asking approval: the bar shows the real labels, invalid keys fail fast.
87104
87467
  resolved = [];
87105
- _context18.prev = 689;
87106
- _iterator23 = _createForOfIteratorHelper$1(keys);
87107
- _context18.prev = 691;
87468
+ _context18.prev = 726;
87469
+ _iterator24 = _createForOfIteratorHelper$1(keys);
87470
+ _context18.prev = 728;
87108
87471
  _loop7 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop7() {
87109
87472
  var key, options, option;
87110
87473
  return _regeneratorRuntime.wrap(function _loop7$(_context16) {
87111
87474
  while (1) switch (_context16.prev = _context16.next) {
87112
87475
  case 0:
87113
- key = _step23.value;
87476
+ key = _step24.value;
87114
87477
  _context16.next = 3;
87115
87478
  return _handle.fetchLookupOptions(_target4.field, [key], {}, 0, 50);
87116
87479
  case 3:
@@ -87138,64 +87501,64 @@ function createNavigationToolset(ctx) {
87138
87501
  }
87139
87502
  }, _loop7);
87140
87503
  });
87141
- _iterator23.s();
87142
- case 694:
87143
- if ((_step23 = _iterator23.n()).done) {
87144
- _context18.next = 701;
87504
+ _iterator24.s();
87505
+ case 731:
87506
+ if ((_step24 = _iterator24.n()).done) {
87507
+ _context18.next = 738;
87145
87508
  break;
87146
87509
  }
87147
- return _context18.delegateYield(_loop7(), "t27", 696);
87148
- case 696:
87510
+ return _context18.delegateYield(_loop7(), "t27", 733);
87511
+ case 733:
87149
87512
  _ret5 = _context18.t27;
87150
87513
  if (!_ret5) {
87151
- _context18.next = 699;
87514
+ _context18.next = 736;
87152
87515
  break;
87153
87516
  }
87154
87517
  return _context18.abrupt("return", _ret5.v);
87155
- case 699:
87156
- _context18.next = 694;
87518
+ case 736:
87519
+ _context18.next = 731;
87157
87520
  break;
87158
- case 701:
87159
- _context18.next = 706;
87521
+ case 738:
87522
+ _context18.next = 743;
87160
87523
  break;
87161
- case 703:
87162
- _context18.prev = 703;
87163
- _context18.t28 = _context18["catch"](691);
87164
- _iterator23.e(_context18.t28);
87165
- case 706:
87166
- _context18.prev = 706;
87167
- _iterator23.f();
87168
- return _context18.finish(706);
87169
- case 709:
87170
- _context18.next = 714;
87524
+ case 740:
87525
+ _context18.prev = 740;
87526
+ _context18.t28 = _context18["catch"](728);
87527
+ _iterator24.e(_context18.t28);
87528
+ case 743:
87529
+ _context18.prev = 743;
87530
+ _iterator24.f();
87531
+ return _context18.finish(743);
87532
+ case 746:
87533
+ _context18.next = 751;
87171
87534
  break;
87172
- case 711:
87173
- _context18.prev = 711;
87174
- _context18.t29 = _context18["catch"](689);
87535
+ case 748:
87536
+ _context18.prev = 748;
87537
+ _context18.t29 = _context18["catch"](726);
87175
87538
  return _context18.abrupt("return", {
87176
87539
  error: _context18.t29 instanceof Error ? _context18.t29.message : String(_context18.t29)
87177
87540
  });
87178
- case 714:
87179
- _context18.next = 716;
87541
+ case 751:
87542
+ _context18.next = 753;
87180
87543
  return approve("addColumn: ".concat(resolved.map(function (r) {
87181
87544
  return r.label;
87182
87545
  }).join(', ')));
87183
- case 716:
87546
+ case 753:
87184
87547
  if (_context18.sent) {
87185
- _context18.next = 718;
87548
+ _context18.next = 755;
87186
87549
  break;
87187
87550
  }
87188
87551
  return _context18.abrupt("return", declined);
87189
- case 718:
87552
+ case 755:
87190
87553
  added = [];
87191
87554
  newColumns = [];
87192
- _context18.prev = 720;
87555
+ _context18.prev = 757;
87193
87556
  _loop8 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop8() {
87194
87557
  var key, beforeFields, attempt, newColumn;
87195
87558
  return _regeneratorRuntime.wrap(function _loop8$(_context17) {
87196
87559
  while (1) switch (_context17.prev = _context17.next) {
87197
87560
  case 0:
87198
- key = _resolved[_i11].key;
87561
+ key = _resolved[_i12].key;
87199
87562
  beforeFields = new Set(_handle.getDivaColumnDefs().map(function (d) {
87200
87563
  return d.field;
87201
87564
  }).filter(Boolean));
@@ -87235,18 +87598,18 @@ function createNavigationToolset(ctx) {
87235
87598
  }
87236
87599
  }, _loop8);
87237
87600
  });
87238
- _i11 = 0, _resolved = resolved;
87239
- case 723:
87240
- if (!(_i11 < _resolved.length)) {
87241
- _context18.next = 728;
87601
+ _i12 = 0, _resolved = resolved;
87602
+ case 760:
87603
+ if (!(_i12 < _resolved.length)) {
87604
+ _context18.next = 765;
87242
87605
  break;
87243
87606
  }
87244
- return _context18.delegateYield(_loop8(), "t30", 725);
87245
- case 725:
87246
- _i11++;
87247
- _context18.next = 723;
87607
+ return _context18.delegateYield(_loop8(), "t30", 762);
87608
+ case 762:
87609
+ _i12++;
87610
+ _context18.next = 760;
87248
87611
  break;
87249
- case 728:
87612
+ case 765:
87250
87613
  // On a decision's option-combinations subtable the add also writes the decision's featureRefs.
87251
87614
  decisionSubtableNote = /optioncombination/i.test(_entry3.label) ? " NOTE: on a decision's option-combinations subtable this ALSO wrote the feature(s) into the decision's featureRefs — existing rows carry NO condition for it, which in a type-0/1 re-opens that feature entirely. Re-read the decision row; fill the rows or revert featureRefs if you only wanted to look." : '';
87252
87615
  partialNote = newColumns.length < resolved.length ? " ".concat(resolved.length - newColumns.length, " added column(s) did not surface a field id within the poll \u2014 listGrids shows the final columns.") : '';
@@ -87262,31 +87625,31 @@ function createNavigationToolset(ctx) {
87262
87625
  return "'".concat(c, "'");
87263
87626
  }).join(', '), ".") : 'Column(s) added — the table re-renders; listGrids shows the new columns and their field ids.') + partialNote + decisionSubtableNote + autoNote
87264
87627
  }));
87265
- case 733:
87266
- _context18.prev = 733;
87267
- _context18.t31 = _context18["catch"](720);
87628
+ case 770:
87629
+ _context18.prev = 770;
87630
+ _context18.t31 = _context18["catch"](757);
87268
87631
  return _context18.abrupt("return", {
87269
87632
  error: "".concat(_context18.t31 instanceof Error ? _context18.t31.message : String(_context18.t31)).concat(newColumns.length ? " \u2014 ".concat(newColumns.length, " column(s) were already added before the failure: ").concat(newColumns.join(', ')) : '')
87270
87633
  });
87271
- case 736:
87634
+ case 773:
87272
87635
  _resolveGrid5 = resolveGrid(args.grid), _entry4 = _resolveGrid5.entry, _api3 = _resolveGrid5.api, _error4 = _resolveGrid5.error;
87273
87636
  if (!(_error4 || !_api3 || !_entry4)) {
87274
- _context18.next = 739;
87637
+ _context18.next = 776;
87275
87638
  break;
87276
87639
  }
87277
87640
  return _context18.abrupt("return", {
87278
87641
  error: _error4
87279
87642
  });
87280
- case 739:
87643
+ case 776:
87281
87644
  _handle2 = _entry4.getHandle();
87282
87645
  if (_handle2) {
87283
- _context18.next = 742;
87646
+ _context18.next = 779;
87284
87647
  break;
87285
87648
  }
87286
87649
  return _context18.abrupt("return", {
87287
87650
  error: "Table '".concat(_entry4.label, "' is not ready.")
87288
87651
  });
87289
- case 742:
87652
+ case 779:
87290
87653
  _column4 = String((_column5 = input === null || input === void 0 ? void 0 : input.column) !== null && _column5 !== void 0 ? _column5 : '');
87291
87654
  search = String((_search = input === null || input === void 0 ? void 0 : input.search) !== null && _search !== void 0 ? _search : '');
87292
87655
  _limit = Math.min(Number(input === null || input === void 0 ? void 0 : input.limit) > 0 ? Number(input.limit) : 50, 200); // A table ACTION can carry its own value list — the picker its dialog shows, answered here so the agent
@@ -87295,11 +87658,11 @@ function createNavigationToolset(ctx) {
87295
87658
  return action.name === _column4;
87296
87659
  });
87297
87660
  if (!optionAction) {
87298
- _context18.next = 761;
87661
+ _context18.next = 798;
87299
87662
  break;
87300
87663
  }
87301
87664
  if (optionAction.options) {
87302
- _context18.next = 749;
87665
+ _context18.next = 786;
87303
87666
  break;
87304
87667
  }
87305
87668
  return _context18.abrupt("return", {
@@ -87308,11 +87671,11 @@ function createNavigationToolset(ctx) {
87308
87671
  hasMore: false,
87309
87672
  note: "'".concat(_column4, "' is a table ACTION with no value list \u2014 its input is described in listGrids: ").concat(optionAction.description)
87310
87673
  });
87311
- case 749:
87312
- _context18.prev = 749;
87313
- _context18.next = 752;
87674
+ case 786:
87675
+ _context18.prev = 786;
87676
+ _context18.next = 789;
87314
87677
  return optionAction.options(search, _limit);
87315
- case 752:
87678
+ case 789:
87316
87679
  _yield$optionAction$o = _context18.sent;
87317
87680
  options = _yield$optionAction$o.options;
87318
87681
  note = _yield$optionAction$o.note;
@@ -87322,20 +87685,20 @@ function createNavigationToolset(ctx) {
87322
87685
  hasMore: options.length >= _limit,
87323
87686
  note: "Values for runTableAction('".concat(_column4, "', <input>) \u2014 pass the VALUE(s), not the label.").concat(note ? " ".concat(note) : '')
87324
87687
  });
87325
- case 758:
87326
- _context18.prev = 758;
87327
- _context18.t32 = _context18["catch"](749);
87688
+ case 795:
87689
+ _context18.prev = 795;
87690
+ _context18.t32 = _context18["catch"](786);
87328
87691
  return _context18.abrupt("return", {
87329
87692
  error: _context18.t32 instanceof Error ? _context18.t32.message : String(_context18.t32)
87330
87693
  });
87331
- case 761:
87694
+ case 798:
87332
87695
  // Enum columns are answered here too: 'which values does this column take' is ONE question.
87333
87696
  enumDef = _handle2.getDivaColumnDefs().find(function (d) {
87334
87697
  return d.field === _column4;
87335
87698
  });
87336
87699
  enumData = enumDef === null || enumDef === void 0 || (_enumDef$customParams = enumDef.customParams) === null || _enumDef$customParams === void 0 ? void 0 : _enumDef$customParams.enumData;
87337
87700
  if (!(Array.isArray(enumData) && enumData.length)) {
87338
- _context18.next = 765;
87701
+ _context18.next = 802;
87339
87702
  break;
87340
87703
  }
87341
87704
  return _context18.abrupt("return", {
@@ -87350,14 +87713,14 @@ function createNavigationToolset(ctx) {
87350
87713
  hasMore: false,
87351
87714
  note: "Enum column \u2014 this is the COMPLETE allowed set (also in listGrids). Stage the VALUE, not the label".concat(enumDef !== null && enumDef !== void 0 && (_enumDef$customParams2 = enumDef.customParams) !== null && _enumDef$customParams2 !== void 0 && _enumDef$customParams2.multiple ? ', comma-separated for multiple' : '', ".")
87352
87715
  });
87353
- case 765:
87716
+ case 802:
87354
87717
  if (enumDef) {
87355
- _context18.next = 771;
87718
+ _context18.next = 808;
87356
87719
  break;
87357
87720
  }
87358
87721
  computedDef = divaDefOf(_handle2.getDivaColumnDefs(), _column4);
87359
87722
  if (!isComputedColumn(computedDef)) {
87360
- _context18.next = 769;
87723
+ _context18.next = 806;
87361
87724
  break;
87362
87725
  }
87363
87726
  return _context18.abrupt("return", {
@@ -87366,16 +87729,16 @@ function createNavigationToolset(ctx) {
87366
87729
  hasMore: false,
87367
87730
  note: "'".concat(_column4, "' is a computed matrix cell \u2014 it has no option list; stage its value directly with stageTableEdits.")
87368
87731
  });
87369
- case 769:
87732
+ case 806:
87370
87733
  fields = _handle2.getDivaColumnDefs().map(function (d) {
87371
87734
  return d.field;
87372
87735
  }).filter(Boolean);
87373
87736
  return _context18.abrupt("return", {
87374
87737
  error: "Column '".concat(_column4, "' not found. Fields of '").concat(_entry4.label, "': ").concat(fields.join(', '), ".")
87375
87738
  });
87376
- case 771:
87739
+ case 808:
87377
87740
  if (!(enumDef.cellDataType === 'asset')) {
87378
- _context18.next = 773;
87741
+ _context18.next = 810;
87379
87742
  break;
87380
87743
  }
87381
87744
  return _context18.abrupt("return", {
@@ -87384,9 +87747,9 @@ function createNavigationToolset(ctx) {
87384
87747
  hasMore: false,
87385
87748
  note: "'".concat(_column4, "' is an ASSET cell \u2014 no option list; write it via uploadAsset + setAssetCell.")
87386
87749
  });
87387
- case 773:
87750
+ case 810:
87388
87751
  if (!(enumDef.cellDataType !== 'lookup' && !isHeaderAddColumn(enumDef))) {
87389
- _context18.next = 775;
87752
+ _context18.next = 812;
87390
87753
  break;
87391
87754
  }
87392
87755
  return _context18.abrupt("return", {
@@ -87395,14 +87758,14 @@ function createNavigationToolset(ctx) {
87395
87758
  hasMore: false,
87396
87759
  note: "'".concat(_column4, "' is a free-form ").concat((_enumDef$cellDataType = enumDef.cellDataType) !== null && _enumDef$cellDataType !== void 0 ? _enumDef$cellDataType : 'text', " column \u2014 it has no option list; stage a ").concat(enumDef.cellDataType === 'number' ? 'number' : 'value', " directly with stageTableEdits.")
87397
87760
  });
87398
- case 775:
87761
+ case 812:
87399
87762
  // Row-dependent url/filter templates resolve against a loaded row.
87400
87763
  firstRow = _api3.getDisplayedRowAtIndex(0);
87401
87764
  rowData = isRealRow(firstRow) ? (_data = firstRow.data) !== null && _data !== void 0 ? _data : {} : {};
87402
- _context18.prev = 777;
87403
- _context18.next = 780;
87765
+ _context18.prev = 814;
87766
+ _context18.next = 817;
87404
87767
  return _handle2.fetchLookupOptions(_column4, search, rowData, 0, _limit);
87405
- case 780:
87768
+ case 817:
87406
87769
  _options = _context18.sent;
87407
87770
  return _context18.abrupt("return", {
87408
87771
  column: _column4,
@@ -87418,9 +87781,9 @@ function createNavigationToolset(ctx) {
87418
87781
  hasMore: _options.length >= _limit,
87419
87782
  note: isHeaderAddColumn(enumDef) ? "These entries are ADDABLE via runTableAction 'addColumn' (each becomes a table column) — they are not cell values to stage." : 'Stage this column with the VALUE(s) — comma-separated when the column is multi-select (see columnMeta.multiSelect).'
87420
87783
  });
87421
- case 784:
87422
- _context18.prev = 784;
87423
- _context18.t33 = _context18["catch"](777);
87784
+ case 821:
87785
+ _context18.prev = 821;
87786
+ _context18.t33 = _context18["catch"](814);
87424
87787
  // On an empty table a row-dependent lookup request goes out broken — teach the recovery instead of the opaque error.
87425
87788
  defs = _handle2.getDivaColumnDefs();
87426
87789
  url = String((_defs$find$customPara = (_defs$find = defs.find(function (d) {
@@ -87440,27 +87803,27 @@ function createNavigationToolset(ctx) {
87440
87803
  return _context18.abrupt("return", {
87441
87804
  error: (_context18.t33 instanceof Error ? _context18.t33.message : String(_context18.t33)) + hint
87442
87805
  });
87443
- case 793:
87806
+ case 830:
87444
87807
  _resolveGrid6 = resolveGrid(args.grid), _api4 = _resolveGrid6.api, _error5 = _resolveGrid6.error;
87445
87808
  if (!(_error5 || !_api4)) {
87446
- _context18.next = 796;
87809
+ _context18.next = 833;
87447
87810
  break;
87448
87811
  }
87449
87812
  return _context18.abrupt("return", {
87450
87813
  error: _error5
87451
87814
  });
87452
- case 796:
87815
+ case 833:
87453
87816
  _api4.setFilterModel(null);
87454
87817
  return _context18.abrupt("return", {
87455
87818
  ok: true
87456
87819
  });
87457
- case 798:
87820
+ case 835:
87458
87821
  throw new Error("Unknown navigation tool: ".concat(name));
87459
- case 799:
87822
+ case 836:
87460
87823
  case "end":
87461
87824
  return _context18.stop();
87462
87825
  }
87463
- }, _callee11, null, [[38, 72, 75, 78], [46, 52], [86, 92], [242, 254, 257, 260], [266, 284, 287, 290], [291, 315, 318, 321], [348, 360, 363, 366], [433, 444, 447, 450], [452, 464, 467, 470], [472, 484, 487, 490], [554, 563], [573, 578], [593, 598], [608, 612], [628, 645], [672, 677], [689, 711], [691, 703, 706, 709], [720, 733], [749, 758], [777, 784]]);
87826
+ }, _callee11, null, [[38, 72, 75, 78], [46, 52], [86, 92], [271, 283, 286, 289], [295, 313, 316, 319], [320, 344, 347, 350], [377, 389, 392, 395], [467,, 524, 527], [469, 480, 483, 486], [487, 499, 502, 505], [506, 518, 521, 524], [591, 600], [610, 615], [630, 635], [645, 649], [665, 682], [709, 714], [726, 748], [728, 740, 743, 746], [757, 770], [786, 795], [814, 821]]);
87464
87827
  }));
87465
87828
  function dispatch(_x7, _x8, _x9, _x10) {
87466
87829
  return _dispatch.apply(this, arguments);
@@ -87470,19 +87833,32 @@ function createNavigationToolset(ctx) {
87470
87833
  };
87471
87834
  }
87472
87835
 
87836
+ /** A registered grid by reference: gridId beats label, because labels derive from the read endpoint and can collide. */
87837
+ function findGridEntry(root, gridRef) {
87838
+ var wanted = gridRef.toLowerCase();
87839
+ var entries = root.gridRegistry.entries;
87840
+ var byGridId = entries.find(function (candidate) {
87841
+ var _candidate$gridId;
87842
+ return ((_candidate$gridId = candidate.gridId) === null || _candidate$gridId === void 0 ? void 0 : _candidate$gridId.toLowerCase()) === wanted;
87843
+ });
87844
+ return byGridId !== null && byGridId !== void 0 ? byGridId : entries.find(function (candidate) {
87845
+ return candidate.label.toLowerCase() === wanted;
87846
+ });
87847
+ }
87848
+
87473
87849
  /** Waits for a registered on-screen grid (by label, or the first one) to be mounted and ready. */
87474
87850
  function waitForGrid(_x30, _x31, _x32) {
87475
87851
  return _waitForGrid.apply(this, arguments);
87476
87852
  }
87477
87853
  /**
87478
- * How a registered grid is told apart from its neighbours: by gridId, which is unique per grid, and only by label
87479
- * when a grid has none — the same order waitForGrid resolves in. Labels are derived from the read endpoint and can
87480
- * collide between two mounted grids, so a label-only snapshot would miss a subtable that opens under a label that
87481
- * is already on screen.
87854
+ * Waits until a subtable reports the parent row the parentRow prelude located. Compared in the subtable's DECLARED
87855
+ * column, read off the located row, since parentRow may address the parent by another column. The entry is resolved
87856
+ * anew on every poll: a keyed remount registers a new entry while the old one keeps its last value. Returns the
87857
+ * refusal on timeout; a grid without a declaration passes at once.
87482
87858
  */
87483
87859
  function _waitForGrid() {
87484
87860
  _waitForGrid = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee14(root, gridLabel, timeoutMs) {
87485
- var deadline, _root$gridRegistry$en, _entry$getHandle6, entry, api;
87861
+ var deadline, _entry$getHandle5, entry, api;
87486
87862
  return _regeneratorRuntime.wrap(function _callee14$(_context21) {
87487
87863
  while (1) switch (_context21.prev = _context21.next) {
87488
87864
  case 0:
@@ -87492,13 +87868,8 @@ function _waitForGrid() {
87492
87868
  _context21.next = 10;
87493
87869
  break;
87494
87870
  }
87495
- entry = gridLabel ? (_root$gridRegistry$en = root.gridRegistry.entries.find(function (candidate) {
87496
- var _candidate$gridId2;
87497
- return ((_candidate$gridId2 = candidate.gridId) === null || _candidate$gridId2 === void 0 ? void 0 : _candidate$gridId2.toLowerCase()) === gridLabel.toLowerCase();
87498
- })) !== null && _root$gridRegistry$en !== void 0 ? _root$gridRegistry$en : root.gridRegistry.entries.find(function (candidate) {
87499
- return candidate.label.toLowerCase() === gridLabel.toLowerCase();
87500
- }) : root.gridRegistry.entries[0];
87501
- api = entry === null || entry === void 0 || (_entry$getHandle6 = entry.getHandle()) === null || _entry$getHandle6 === void 0 ? void 0 : _entry$getHandle6.getGridApi();
87871
+ entry = gridLabel ? findGridEntry(root, gridLabel) : root.gridRegistry.entries[0];
87872
+ api = entry === null || entry === void 0 || (_entry$getHandle5 = entry.getHandle()) === null || _entry$getHandle5 === void 0 ? void 0 : _entry$getHandle5.getGridApi();
87502
87873
  if (!api) {
87503
87874
  _context21.next = 6;
87504
87875
  break;
@@ -87520,6 +87891,66 @@ function _waitForGrid() {
87520
87891
  }));
87521
87892
  return _waitForGrid.apply(this, arguments);
87522
87893
  }
87894
+ function waitForDeclaredParent(_x33, _x34, _x35, _x36, _x37) {
87895
+ return _waitForDeclaredParent.apply(this, arguments);
87896
+ }
87897
+ /**
87898
+ * How a registered grid is told apart from its neighbours: by gridId, which is unique per grid, and only by label
87899
+ * when a grid has none — the same order waitForGrid resolves in. Labels are derived from the read endpoint and can
87900
+ * collide between two mounted grids, so a label-only snapshot would miss a subtable that opens under a label that
87901
+ * is already on screen.
87902
+ */
87903
+ function _waitForDeclaredParent() {
87904
+ _waitForDeclaredParent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15(root, gridRef, parentApi, parentNode, timeoutMs) {
87905
+ var deadline, label, mismatch, _entry$getBoundParent, entry, declared, _cellValueOf4, _declared$value, expected;
87906
+ return _regeneratorRuntime.wrap(function _callee15$(_context22) {
87907
+ while (1) switch (_context22.prev = _context22.next) {
87908
+ case 0:
87909
+ deadline = Date.now() + timeoutMs;
87910
+ label = gridRef;
87911
+ mismatch = 'no bound parent row';
87912
+ case 3:
87913
+ if (!(Date.now() < deadline)) {
87914
+ _context22.next = 18;
87915
+ break;
87916
+ }
87917
+ entry = findGridEntry(root, gridRef);
87918
+ if (!(entry && !entry.getBoundParent)) {
87919
+ _context22.next = 7;
87920
+ break;
87921
+ }
87922
+ return _context22.abrupt("return", undefined);
87923
+ case 7:
87924
+ declared = entry === null || entry === void 0 || (_entry$getBoundParent = entry.getBoundParent) === null || _entry$getBoundParent === void 0 ? void 0 : _entry$getBoundParent.call(entry);
87925
+ if (!(entry && declared)) {
87926
+ _context22.next = 14;
87927
+ break;
87928
+ }
87929
+ expected = String((_cellValueOf4 = cellValueOf(parentApi, parentNode, declared.column)) !== null && _cellValueOf4 !== void 0 ? _cellValueOf4 : '');
87930
+ if (!(expected && declared.value === expected)) {
87931
+ _context22.next = 12;
87932
+ break;
87933
+ }
87934
+ return _context22.abrupt("return", undefined);
87935
+ case 12:
87936
+ label = entry.label;
87937
+ mismatch = "".concat(declared.column, " = '").concat((_declared$value = declared.value) !== null && _declared$value !== void 0 ? _declared$value : '', "', not the located row's '").concat(expected, "'");
87938
+ case 14:
87939
+ _context22.next = 16;
87940
+ return sleep(250);
87941
+ case 16:
87942
+ _context22.next = 3;
87943
+ break;
87944
+ case 18:
87945
+ return _context22.abrupt("return", "parentRow: the '".concat(label, "' subtable still shows ").concat(mismatch, ", after waiting ").concat(timeoutMs, " ms \u2014 it did not switch to the selected parent in time. Nothing was read or staged."));
87946
+ case 19:
87947
+ case "end":
87948
+ return _context22.stop();
87949
+ }
87950
+ }, _callee15);
87951
+ }));
87952
+ return _waitForDeclaredParent.apply(this, arguments);
87953
+ }
87523
87954
  function gridIdentity(entry) {
87524
87955
  var _entry$gridId;
87525
87956
  return (_entry$gridId = entry.gridId) !== null && _entry$gridId !== void 0 ? _entry$gridId : entry.label;
@@ -87530,7 +87961,7 @@ function gridIdentity(entry) {
87530
87961
  * other helpers resolve FIRST — its gridId, or the label only when it has none. Returning the label would hand a
87531
87962
  * colliding name straight back to waitForGrid/resolveGrid, which then pick the parent grid of the same label.
87532
87963
  */
87533
- function waitForNewGrid(_x33, _x34, _x35) {
87964
+ function waitForNewGrid(_x38, _x39, _x40) {
87534
87965
  return _waitForNewGrid.apply(this, arguments);
87535
87966
  }
87536
87967
  /**
@@ -87538,50 +87969,50 @@ function waitForNewGrid(_x33, _x34, _x35) {
87538
87969
  * waits for the table, then locates + selects the row (subtable deep-links carry tool/subGrid/subColumn/subValue).
87539
87970
  */
87540
87971
  function _waitForNewGrid() {
87541
- _waitForNewGrid = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15(root, before, timeoutMs) {
87972
+ _waitForNewGrid = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee16(root, before, timeoutMs) {
87542
87973
  var deadline, fresh;
87543
- return _regeneratorRuntime.wrap(function _callee15$(_context22) {
87544
- while (1) switch (_context22.prev = _context22.next) {
87974
+ return _regeneratorRuntime.wrap(function _callee16$(_context23) {
87975
+ while (1) switch (_context23.prev = _context23.next) {
87545
87976
  case 0:
87546
87977
  deadline = Date.now() + timeoutMs;
87547
87978
  case 1:
87548
87979
  if (!(Date.now() < deadline)) {
87549
- _context22.next = 9;
87980
+ _context23.next = 9;
87550
87981
  break;
87551
87982
  }
87552
87983
  fresh = root.gridRegistry.entries.find(function (entry) {
87553
87984
  return !before.has(gridIdentity(entry));
87554
87985
  });
87555
87986
  if (!fresh) {
87556
- _context22.next = 5;
87987
+ _context23.next = 5;
87557
87988
  break;
87558
87989
  }
87559
- return _context22.abrupt("return", gridIdentity(fresh));
87990
+ return _context23.abrupt("return", gridIdentity(fresh));
87560
87991
  case 5:
87561
- _context22.next = 7;
87992
+ _context23.next = 7;
87562
87993
  return sleep(250);
87563
87994
  case 7:
87564
- _context22.next = 1;
87995
+ _context23.next = 1;
87565
87996
  break;
87566
87997
  case 9:
87567
- return _context22.abrupt("return", undefined);
87998
+ return _context23.abrupt("return", undefined);
87568
87999
  case 10:
87569
88000
  case "end":
87570
- return _context22.stop();
88001
+ return _context23.stop();
87571
88002
  }
87572
- }, _callee15);
88003
+ }, _callee16);
87573
88004
  }));
87574
88005
  return _waitForNewGrid.apply(this, arguments);
87575
88006
  }
87576
- function showEntityFromLink(_x36, _x37) {
88007
+ function showEntityFromLink(_x41, _x42) {
87577
88008
  return _showEntityFromLink.apply(this, arguments);
87578
88009
  }
87579
88010
  function _showEntityFromLink() {
87580
- _showEntityFromLink = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee16(root, href) {
88011
+ _showEntityFromLink = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee17(root, href) {
87581
88012
  var _params$get, _params$get2, _params$get3, _params$get4, _params$get5, _params$get6, _params$get7, _params$get8;
87582
- var params, targetPath, grid, column, value, targetMissing, api, _yield$locateRowCore$, parentNode, toolId, toolDeadline, opened, _i12, _arr2, bar, tool, subGrid, subColumn, subValue, subApi;
87583
- return _regeneratorRuntime.wrap(function _callee16$(_context23) {
87584
- while (1) switch (_context23.prev = _context23.next) {
88013
+ var params, targetPath, grid, column, value, targetMissing, api, _yield$locateRowCore$, parentNode, toolId, toolDeadline, opened, _i13, _arr3, bar, tool, subGrid, subColumn, subValue, subApi;
88014
+ return _regeneratorRuntime.wrap(function _callee17$(_context24) {
88015
+ while (1) switch (_context24.prev = _context24.next) {
87585
88016
  case 0:
87586
88017
  params = new URL(href).searchParams;
87587
88018
  targetPath = ((_params$get = params.get('path')) !== null && _params$get !== void 0 ? _params$get : '').replace(/^\//, '');
@@ -87589,7 +88020,7 @@ function _showEntityFromLink() {
87589
88020
  column = (_params$get3 = params.get('column')) !== null && _params$get3 !== void 0 ? _params$get3 : '';
87590
88021
  value = (_params$get4 = params.get('value')) !== null && _params$get4 !== void 0 ? _params$get4 : ''; // Model-derived path — same whitelist as navigateTo.
87591
88022
  if (!(targetPath && !isKnownPath(root, targetPath))) {
87592
- _context23.next = 7;
88023
+ _context24.next = 7;
87593
88024
  break;
87594
88025
  }
87595
88026
  throw new Error("entity link targets unknown path '".concat(targetPath, "'"));
@@ -87599,16 +88030,16 @@ function _showEntityFromLink() {
87599
88030
  root.navigate('/' + targetPath);
87600
88031
  }
87601
88032
  if (!(!column || !value)) {
87602
- _context23.next = 10;
88033
+ _context24.next = 10;
87603
88034
  break;
87604
88035
  }
87605
- return _context23.abrupt("return");
88036
+ return _context24.abrupt("return");
87606
88037
  case 10:
87607
88038
  if (!(value === column)) {
87608
- _context23.next = 12;
88039
+ _context24.next = 12;
87609
88040
  break;
87610
88041
  }
87611
- return _context23.abrupt("return");
88042
+ return _context24.abrupt("return");
87612
88043
  case 12:
87613
88044
  // Locate failures past this point happen AFTER a successful navigation — mark them so the
87614
88045
  // caller can report "view opened, row not found" instead of a dead link.
@@ -87617,25 +88048,25 @@ function _showEntityFromLink() {
87617
88048
  entityLinkTargetMissing: true
87618
88049
  });
87619
88050
  };
87620
- _context23.next = 15;
88051
+ _context24.next = 15;
87621
88052
  return waitForGrid(root, grid, 10000);
87622
88053
  case 15:
87623
- api = _context23.sent;
88054
+ api = _context24.sent;
87624
88055
  if (api) {
87625
- _context23.next = 18;
88056
+ _context24.next = 18;
87626
88057
  break;
87627
88058
  }
87628
88059
  throw targetMissing("entity link: table '".concat(grid !== null && grid !== void 0 ? grid : '', "' not found on '").concat(targetPath, "'"));
87629
88060
  case 18:
87630
- _context23.next = 20;
88061
+ _context24.next = 20;
87631
88062
  return locateRowCore(api, column, value)["catch"](function (e) {
87632
88063
  throw targetMissing(e instanceof Error ? e.message : String(e));
87633
88064
  });
87634
88065
  case 20:
87635
- _yield$locateRowCore$ = _context23.sent;
88066
+ _yield$locateRowCore$ = _context24.sent;
87636
88067
  parentNode = _yield$locateRowCore$.node;
87637
88068
  if (parentNode) {
87638
- _context23.next = 24;
88069
+ _context24.next = 24;
87639
88070
  break;
87640
88071
  }
87641
88072
  throw targetMissing("entity link: no row with ".concat(column, "='").concat(value, "' in '").concat(grid !== null && grid !== void 0 ? grid : '', "'"));
@@ -87643,75 +88074,75 @@ function _showEntityFromLink() {
87643
88074
  // Subtable chain: the parent selection reveals a conditional toolbar tool — open it, then locate inside it.
87644
88075
  toolId = (_params$get5 = params.get('tool')) !== null && _params$get5 !== void 0 ? _params$get5 : params.get('subGrid');
87645
88076
  if (toolId) {
87646
- _context23.next = 27;
88077
+ _context24.next = 27;
87647
88078
  break;
87648
88079
  }
87649
- return _context23.abrupt("return");
88080
+ return _context24.abrupt("return");
87650
88081
  case 27:
87651
88082
  toolDeadline = Date.now() + 5000;
87652
88083
  opened = false;
87653
88084
  case 29:
87654
88085
  if (!(Date.now() < toolDeadline && !opened)) {
87655
- _context23.next = 47;
88086
+ _context24.next = 47;
87656
88087
  break;
87657
88088
  }
87658
- _i12 = 0, _arr2 = [root.contentStore.rightToolBar, root.contentStore.bottomToolBar];
88089
+ _i13 = 0, _arr3 = [root.contentStore.rightToolBar, root.contentStore.bottomToolBar];
87659
88090
  case 31:
87660
- if (!(_i12 < _arr2.length)) {
87661
- _context23.next = 42;
88091
+ if (!(_i13 < _arr3.length)) {
88092
+ _context24.next = 42;
87662
88093
  break;
87663
88094
  }
87664
- bar = _arr2[_i12];
88095
+ bar = _arr3[_i13];
87665
88096
  tool = bar.tools.find(function (candidate) {
87666
88097
  return candidate.id.toLowerCase() === toolId.toLowerCase();
87667
88098
  });
87668
88099
  if (!tool) {
87669
- _context23.next = 39;
88100
+ _context24.next = 39;
87670
88101
  break;
87671
88102
  }
87672
88103
  bar.selectTool(tool.id);
87673
88104
  bar.hidden = false;
87674
88105
  opened = true;
87675
- return _context23.abrupt("break", 42);
88106
+ return _context24.abrupt("break", 42);
87676
88107
  case 39:
87677
- _i12++;
87678
- _context23.next = 31;
88108
+ _i13++;
88109
+ _context24.next = 31;
87679
88110
  break;
87680
88111
  case 42:
87681
88112
  if (opened) {
87682
- _context23.next = 45;
88113
+ _context24.next = 45;
87683
88114
  break;
87684
88115
  }
87685
- _context23.next = 45;
88116
+ _context24.next = 45;
87686
88117
  return sleep(250);
87687
88118
  case 45:
87688
- _context23.next = 29;
88119
+ _context24.next = 29;
87689
88120
  break;
87690
88121
  case 47:
87691
88122
  subGrid = (_params$get6 = params.get('subGrid')) !== null && _params$get6 !== void 0 ? _params$get6 : undefined;
87692
88123
  subColumn = (_params$get7 = params.get('subColumn')) !== null && _params$get7 !== void 0 ? _params$get7 : '';
87693
88124
  subValue = (_params$get8 = params.get('subValue')) !== null && _params$get8 !== void 0 ? _params$get8 : '';
87694
88125
  if (!(!opened || !subColumn || !subValue)) {
87695
- _context23.next = 52;
88126
+ _context24.next = 52;
87696
88127
  break;
87697
88128
  }
87698
- return _context23.abrupt("return");
88129
+ return _context24.abrupt("return");
87699
88130
  case 52:
87700
- _context23.next = 54;
88131
+ _context24.next = 54;
87701
88132
  return waitForGrid(root, subGrid, 10000);
87702
88133
  case 54:
87703
- subApi = _context23.sent;
88134
+ subApi = _context24.sent;
87704
88135
  if (!subApi) {
87705
- _context23.next = 58;
88136
+ _context24.next = 58;
87706
88137
  break;
87707
88138
  }
87708
- _context23.next = 58;
88139
+ _context24.next = 58;
87709
88140
  return locateRowCore(subApi, subColumn, subValue);
87710
88141
  case 58:
87711
88142
  case "end":
87712
- return _context23.stop();
88143
+ return _context24.stop();
87713
88144
  }
87714
- }, _callee16);
88145
+ }, _callee17);
87715
88146
  }));
87716
88147
  return _showEntityFromLink.apply(this, arguments);
87717
88148
  }