@crystaldesign/diva-backoffice 26.12.0-beta.20 → 26.12.0-beta.22

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.
@@ -51480,7 +51480,7 @@ var NAVIGATION_TOOL_DEFS = [{
51480
51480
  argAliases: GRID_ARG_ALIASES
51481
51481
  }, {
51482
51482
  name: 'stageTableEdits',
51483
- 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. One call stages at most 500 rows — not a server limit (a bulk table sends every staged row in ONE request) but a browser one, since every staged row is a live grid row; a payload cannot be sliced, so a bigger file is uploaded in parts of at most 500 rows and each part written in its own call (a dryRun is exempt: it can check a whole file at once, before you split it). WHICH ROUTE FOR NEW ROWS — decide before you type a single row: (1) a handful of rows you compose yourself → addRows. (2) more rows you still compose yourself → addRowsTsv (a HEADER line of column field ids, then one tab-separated line per row): the same information without repeating every key. (3) MCP only — rows that already exist OUTSIDE this conversation — a file, a script's or query's output, an export, anything you would be COPYING rather than writing — never retype them, whatever their count: your harness posts the file once to /diva-agent/bridge/payloads and you pass source:{payloadId} plus `mapping` for foreign column names; the call then costs the same for ten rows as for five hundred and you never read the rows into your context. In the in-app chat there is no upload, so such rows go as addRowsTsv. Rule of thumb: if writing the rows out would cost more tokens than the rest of the task, they go by reference. Run such a call once with dryRun:true — every row is checked before anything is staged, and the answer is counts plus the distinct problems",
51483
+ 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. One call stages at most 500 rows — not a server limit (a bulk table sends every staged row in ONE request) but a browser one, since every staged row is a live grid row; a payload cannot be sliced, so a bigger file is uploaded in parts of at most 500 rows and each part written in its own call (a dryRun is exempt: it can check a whole file at once, before you split it). WHICH ROUTE FOR NEW ROWS — decide by the COUNT before you type a single row, and count the rows the TASK names, not the ones you have typed so far: (1) a handful → addRows. (2) up to about fifty → addRowsTsv (a HEADER line of column field ids, then one tab-separated line per row): the same information without repeating every key. (3) MCP only — from about fifty rows on, and at any count for rows that already exist as a file, a script's or query's output or an export: your harness writes them to a file and posts it once to the payload route (your MCP endpoint URL with /mcp replaced by /bridge/payloads, same Bearer token — the `source` parameter says how), and you pass source:{payloadId} plus `mapping` for foreign column names; the call then costs the same for ten rows as for five hundred and you never read the rows into your context. Composing the rows rather than copying them changes nothing about which route they take — a list you can print from your shell is a file. In the in-app chat there is no upload, so such rows go as addRowsTsv. Rule of thumb: if writing the rows out would cost more tokens than the rest of the task, they go by reference. Run such a call once with dryRun:true — every row is checked before anything is staged, and the answer is counts plus the distinct problems",
51484
51484
  input_schema: {
51485
51485
  type: 'object',
51486
51486
  properties: {
@@ -51513,7 +51513,7 @@ var NAVIGATION_TOOL_DEFS = [{
51513
51513
  },
51514
51514
  source: {
51515
51515
  type: 'object',
51516
- description: "PREPARED ROWS BY REFERENCE (MCP only): the rows of a payload your own harness uploaded, instead of listing them here. POST them once to /diva-agent/bridge/payloads with the same bridge token your MCP connection is configured with (curl -H 'Authorization: Bearer …' -H 'Content-Type: application/json' --data-binary @rows.json, so the file's contents never enter the conversation; if your shell cannot read that token, ask the user to expose it as an environment variable), then name the returned id: {payloadId:'pl_…'}. The call is then the same size for 10 rows as for 500. An upload takes at most 5 MB, one write stages at most 500 rows, and a payload cannot be sliced — so upload a bigger file in parts of at most 500 rows and name each part in its own call; you may hold ten payloads at a time (DELETE the ones you are done with). Combine with `mapping`, and run it once with dryRun:true to have every row checked.",
51516
+ description: "ROWS BY REFERENCE (MCP only): the rows of a payload your own harness uploaded, instead of listing them here — the route for every batch from about fifty rows on, and for rows that already exist as a file, an export or a script's or query's output, at any count. POST them once, as a JSON array of row objects, to your MCP endpoint URL with its trailing /mcp replaced by /bridge/payloads (https://…/diva-agent/mcp → https://…/diva-agent/bridge/payloads) with the same bridge token your MCP connection is configured with (PAYLOAD_URL=\"${DIVA_BRIDGE_URL%/mcp}/bridge/payloads\"; curl -X POST \"$PAYLOAD_URL\" -H \"Authorization: Bearer $DIVA_BRIDGE_TOKEN\" -H 'Content-Type: application/json' --data-binary @rows.json, so neither the rows nor the token enter the conversation; those two environment variables are the only source for the URL and the token — never search config files, keychains or credential stores for them, and when they are unset ask the user in one line rather than typing the rows into the call), then name the returned id: {payloadId:'pl_…'}. The upload answer lists the payload's columns and three sample rows — check the shape there instead of reading the file. The call is then the same size for 10 rows as for 500. An upload takes at most 5 MB, one write stages at most 500 rows, and a payload cannot be sliced — so upload a bigger file in parts of at most 500 rows and name each part in its own call; you may hold ten payloads at a time (DELETE the ones you are done with). Combine with `mapping`, and run it once with dryRun:true to have every row checked.",
51517
51517
  properties: {
51518
51518
  payloadId: {
51519
51519
  type: 'string',
@@ -51531,7 +51531,7 @@ var NAVIGATION_TOOL_DEFS = [{
51531
51531
  },
51532
51532
  addRowsTsv: {
51533
51533
  type: 'string',
51534
- description: "The same rows as `addRows`, in spreadsheet shape: a HEADER line of column FIELD ids, then one tab-separated line per row (e.g. 'typeNo\\tsequenceNo\\nART_001\\t10\\nART_002\\t20'). Carries the same information without repeating the keys, which is what lets a long list of rows fit in one call. An empty cell leaves that column UNSET (its default applies), values may not contain tabs or newlines. Combines with addRows."
51534
+ description: "The same rows as `addRows`, in spreadsheet shape: a HEADER line of column FIELD ids, then one tab-separated line per row (e.g. 'typeNo\\tsequenceNo\\nART_001\\t10\\nART_002\\t20'). Carries the same information without repeating the keys, which keeps a MODERATE batch — up to about fifty rows — inside one call; from there on the rows go through `source` instead of into the call. An empty cell leaves that column UNSET (its default applies), values may not contain tabs or newlines. Combines with addRows."
51535
51535
  },
51536
51536
  dryRun: {
51537
51537
  type: 'boolean',
@@ -51914,6 +51914,20 @@ function columnAgentMeta(divaDef) {
51914
51914
  if (divaDef !== null && divaDef !== void 0 && divaDef.required) meta.required = true;
51915
51915
  if ((divaDef === null || divaDef === void 0 ? void 0 : divaDef.defaultValue) !== undefined) meta.defaulted = true;
51916
51916
  if ((divaDef === null || divaDef === void 0 ? void 0 : divaDef.editable) === false) meta.readOnly = true;
51917
+ // A FUNCTION is a CONDITIONAL editable, and the condition that matters to an agent is the new row: asked with a row
51918
+ // that has no _id, series.catalogGroupCode answers no, because it is routed by the saved record. Unmarked, the column
51919
+ // looks writable, its allowedValues invite a value, and addRows then loses every cell to a generic parser message.
51920
+ else if (typeof (divaDef === null || divaDef === void 0 ? void 0 : divaDef.editable) === 'function') {
51921
+ try {
51922
+ if (!divaDef.editable({
51923
+ data: {},
51924
+ node: undefined,
51925
+ colDef: divaDef
51926
+ })) meta.editableOnlyOnSavedRows = true;
51927
+ } catch (_unused) {
51928
+ // A predicate needing more of a row than this says nothing about the new-row case — claim nothing.
51929
+ }
51930
+ }
51917
51931
  var enumData = divaDef === null || divaDef === void 0 || (_divaDef$customParams = divaDef.customParams) === null || _divaDef$customParams === void 0 ? void 0 : _divaDef$customParams.enumData;
51918
51932
  if (Array.isArray(enumData) && enumData.length) {
51919
51933
  var _divaDef$customParams2;
@@ -51925,7 +51939,8 @@ function columnAgentMeta(divaDef) {
51925
51939
  });
51926
51940
  if (divaDef !== null && divaDef !== void 0 && (_divaDef$customParams2 = divaDef.customParams) !== null && _divaDef$customParams2 !== void 0 && _divaDef$customParams2.multiple) meta.multiSelect = true;
51927
51941
  }
51928
- if (type === 'dateString' && divaDef !== null && divaDef !== void 0 && (_divaDef$customParams3 = divaDef.customParams) !== null && _divaDef$customParams3 !== void 0 && _divaDef$customParams3.dateFormat) meta.dateFormat = divaDef.customParams.dateFormat;
51942
+ // How the cell RENDERS a date; writes take ISO regardless, so the key must not read as an input format.
51943
+ if (type === 'dateString' && divaDef !== null && divaDef !== void 0 && (_divaDef$customParams3 = divaDef.customParams) !== null && _divaDef$customParams3 !== void 0 && _divaDef$customParams3.dateFormat) meta.displayFormat = divaDef.customParams.dateFormat;
51929
51944
  // Surface the validation regex and the length cap it encodes up front (server rejections quote it only after a failed write).
51930
51945
  if (typeof (divaDef === null || divaDef === void 0 ? void 0 : divaDef.regex) === 'string' && divaDef.regex) {
51931
51946
  meta.pattern = divaDef.regex;
@@ -51953,7 +51968,9 @@ function columnAgentMeta(divaDef) {
51953
51968
  if (!meta.allowedValues && Array.isArray(editorValues) && editorValues.length) meta.selectableValues = editorValues;
51954
51969
  if (isComputedColumn(divaDef)) {
51955
51970
  meta.computed = true;
51956
- meta.note = 'computed matrix cell — it has no record field of its own; stage it like any other cell and the table translates the value into the fields behind it';
51971
+ // "like any other cell" is true only where the cell is actually editable: on a column marked
51972
+ // editableOnlyOnSavedRows it sent addRows straight into a refusal of every row.
51973
+ meta.note = meta.editableOnlyOnSavedRows ? 'computed matrix cell — it has no record field of its own. Set it with `edits` AFTER the row exists; addRows refuses it.' : 'computed matrix cell — it has no record field of its own; stage it like any other cell and the table translates the value into the fields behind it';
51957
51974
  }
51958
51975
  return meta;
51959
51976
  }
@@ -52455,7 +52472,7 @@ function createNavigationToolset(ctx) {
52455
52472
  var path = root.navigationState.path;
52456
52473
  if (!entries.length) {
52457
52474
  return {
52458
- error: "No table is currently on screen (current view: ".concat(path, ") \u2014 navigateTo the view that hosts the table first.")
52475
+ error: "No table is on screen (current view: ".concat(path, "). A view can render its table only once the data it gates on has arrived, and that state SURVIVES navigation: ") + "leaving and coming back does not repair it, nor does repeating navigateTo. Try reloadPage on this workspace \u2014 it refetches what the view is waiting for. " + "Only when the path itself is wrong does another navigateTo help; listViews has the valid ones."
52459
52476
  };
52460
52477
  }
52461
52478
  var entry = gridLabel ? findGridEntry(root, gridLabel) : entries[0];
@@ -52866,7 +52883,7 @@ function createNavigationToolset(ctx) {
52866
52883
  },
52867
52884
  dispatch: function () {
52868
52885
  var _dispatch = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11(name, input, signal, onProgress) {
52869
- 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, only, entries, compactWanted, fullWanted, _args$value, _resolveGrid, entry, api, error, multiValues, filterBeforeBulk, rows, missing, unverified, notUnique, deadline, notReached, anyLookupFilter, _iterator5, _step5, _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, context, _i3, node, values, truncatedColumns, _iterator6, _step6, column, raw, columnMeta, lastNode, gridContext, hasCreatorRow, creatorRowLoaded, totalRowCount, dirty, filterModel, filteredBy, _ref25, _ref26, _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, addRowsTsv, lines, header, duplicate, faults, removeRowIds, removeRows, editedRows, removedRows, intendedRowCount, _prelude, _resolveGrid3, _entry2, _api2, _error2, handle, explicitParentRow, mountedAfterFirst, isSubtable, parentBinding, boundParentRow, parentBindingNote, idColumnPresent, isUnloadedRecordId, reroutedRecordIds, _iterator7, _step7, _edit2, _i4, _arr2, rowId, serieScope, fmt, _divaDefs, checkCellInput, parserRefusal, parseRefusalOf, computedRefusalOf, writeCell, isLookupColumn, lookupWrite, staged, storedWrite, expectedValueOf, stagingNotes, failed, unchanged, removed, removedRecordIds, filterBeforeStaging, keyFilterApplied, restoreUserFilter, keyCache, resolveByKey, resolveTarget, applyEditToNode, columnDefFor, requiredFields, failures, failedRows, problems, needsServerLookup, lookupKeyOf, lookupKeys, _iterator9, _step9, _edit3, _keyColumn2, _keyValue2, _iterator10, _step10, _removal, _keyColumn3, _keyValue3, _iterator11, _step11, edit, keyColumn, keyValue, _iterator12, _step12, removal, _keyColumn, _keyValue, mergedOutcome, mergeCommitOutcome, preApproved, intendedCount, _approved, _iterator13, _step13, _loop3, _ret3, filterWasChanged, _iterator15, _step15, _removal2, _target2, _target2$error, id, _iterator16, _step16, _edit4$column, _edit4, _column, _target3, _target3$error, _node2, _rowId2, targets, _iterator17, _step17, _api2$getRowNode2, _rowId, addedRows, providedAddColumns, conditionedPosDefaults, lookupWriteCache, _loop4, _ret4, _i6, addSchemaHint, validationErrors, alreadySent, _iterator18, _step18, _api2$getRowNode12, _rowId3, rowErrors, focusNode, totalStaged, survivingOperations, approved, survived, survivedCount, trimEcho, finalOutcome, outcome, serverErrors, reported, isSessionRowId, sentValuesOf, lengthLimitNote, addError, _iterator19, _step19, failure, _iterator20, _step20, _rowId4, _iterator21, _step21, _api2$getRowNode13, _rowId5, _rowErrors, _i8, _addedRows, _api2$getRowNode5, a, outcomeIsEmpty, survivedAfterCommit, autoCommitted, autoCommittedOps, committedIds, failedIds, editTargets, addTargets, removalTargets, hasIdColumn, verifyDeadline, verifyDeadlineHit, filterBeforeVerify, verifyFilterApplied, probeServerRow, restoreVerifyFilter, verifiedChanges, verifiedAdds, verifiedRemovals, _iterator22, _step22, _loop5, _iterator23, _step23, target, probe, _iterator24, _step24, _target, _probe, appliedCount, livePath, editorPathFor, echoValues, withServerIds, addedRowsWithoutId, landedInSeries, foreignSeries, committedOps, confirmedCount, notCommittedRowIds, isEmptyCell, silentlyDropped, dirtyGrids, _root$navigationState4, _livePath$match, _livePath$match2, _ref43, _ref44, _livePath, packageBase, catalogBase, baseId, isPack, _root$webplannerInsta, destroyed, reloadTriggered, knownKeys, source, _action, _input, _entry3$getActions, _entry3$getActions2, _resolveGrid4, _entry3, _error3, _handle, actionName, actionInput, _addTargets, removeTargets, 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, removeTargetIn, _target4, _header, live, saved, gone, attempt, rowsNote, _target5, keys, resolved, _iterator27, _step27, _loop8, _ret6, added, newColumns, _loop9, _i14, _resolved, decisionSubtableNote, partialNote, _column7, _search, _entry4$getActions, _entry4$getActions2, _enumDef$customParams, _data, _plainWords$sort$, _resolveGrid5, _entry4, _api3, _error4, _handle2, _column6, search, _limit, wantsExact, needle, equals, optionAction, _yield$optionAction$o, options, note, enumDef, enumData, _enumDef$customParams2, computedDef, fields, _enumDef$cellDataType, firstRow, rowData, patternChars, plainWords, remoteSearch, matchLocally, fetchLimit, fetched, text, _options, fetchCapped, _defs$find$customPara, _defs$find, _handle2$getApplicati, _handle2$getApplicati2, defs, url, _rowFields, appScope, deps, hint, _resolveGrid6, _api4, _error5, _resolveGrid7, _entry5, _error6, _handle3, _label, _autoNote;
52886
+ 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, only, entries, compactWanted, fullWanted, _args$value, _resolveGrid, entry, api, error, multiValues, filterBeforeBulk, rows, missing, unverified, notUnique, deadline, notReached, anyLookupFilter, _iterator5, _step5, _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, context, _i3, node, values, truncatedColumns, _iterator6, _step6, column, raw, columnMeta, lastNode, gridContext, hasCreatorRow, creatorRowLoaded, totalRowCount, dirty, filterModel, filteredBy, _ref25, _ref26, _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, addRowsTsv, lines, header, duplicate, faults, removeRowIds, removeRows, editedRows, removedRows, intendedRowCount, _prelude, _resolveGrid3, _entry2, _api2, _error2, handle, explicitParentRow, mountedAfterFirst, isSubtable, parentBinding, boundParentRow, parentBindingNote, idColumnPresent, isUnloadedRecordId, reroutedRecordIds, _iterator7, _step7, _edit2, _i4, _arr2, rowId, serieScope, fmt, _divaDefs, checkCellInput, parserRefusal, parseRefusalOf, newRowEditability, newRowEditRefusal, typedValueOf, computedRefusalOf, writeCell, isLookupColumn, lookupWrite, staged, storedWrite, expectedValueOf, stagingNotes, failed, unchanged, removed, removedRecordIds, filterBeforeStaging, keyFilterApplied, restoreUserFilter, keyCache, resolveByKey, resolveTarget, applyEditToNode, columnDefFor, requiredFields, failures, editabilityUnverified, failedRows, problems, needsServerLookup, lookupKeyOf, lookupKeys, _iterator9, _step9, _edit3, _keyColumn2, _keyValue2, _iterator10, _step10, _removal, _keyColumn3, _keyValue3, _iterator11, _step11, edit, keyColumn, keyValue, _iterator12, _step12, removal, _keyColumn, _keyValue, mergedOutcome, mergeCommitOutcome, preApproved, intendedCount, _approved, _iterator13, _step13, _loop3, _ret3, filterWasChanged, _iterator15, _step15, _removal2, _target2, _target2$error, id, _iterator16, _step16, _edit4$column, _edit4, _column2, _target3, _target3$error, _node2, _rowId2, targets, _iterator17, _step17, _api2$getRowNode2, _rowId, addedRows, providedAddColumns, conditionedPosDefaults, lookupWriteCache, _loop4, _ret4, _i7, addSchemaHint, validationErrors, alreadySent, _iterator18, _step18, _api2$getRowNode12, _rowId3, rowErrors, focusNode, totalStaged, survivingOperations, approved, survived, survivedCount, trimEcho, finalOutcome, outcome, serverErrors, reported, isSessionRowId, sentValuesOf, lengthLimitNote, addError, _iterator19, _step19, failure, _iterator20, _step20, _rowId4, _iterator21, _step21, _api2$getRowNode13, _rowId5, _rowErrors, _i9, _addedRows, _api2$getRowNode5, a, outcomeIsEmpty, survivedAfterCommit, autoCommitted, autoCommittedOps, committedIds, failedIds, editTargets, addTargets, removalTargets, hasIdColumn, verifyDeadline, verifyDeadlineHit, filterBeforeVerify, verifyFilterApplied, probeServerRow, restoreVerifyFilter, verifiedChanges, verifiedAdds, verifiedRemovals, _iterator22, _step22, _loop5, _iterator23, _step23, target, probe, _iterator24, _step24, _target, _probe, appliedCount, livePath, editorPathFor, echoValues, withServerIds, addedRowsWithoutId, landedInSeries, foreignSeries, committedOps, confirmedCount, notCommittedRowIds, isEmptyCell, silentlyDropped, dirtyGrids, _root$navigationState4, _livePath$match, _livePath$match2, _ref43, _ref44, _livePath, packageBase, catalogBase, baseId, isPack, _root$webplannerInsta, destroyed, reloadTriggered, knownKeys, source, _action, _input, _entry3$getActions, _entry3$getActions2, _resolveGrid4, _entry3, _error3, _handle, actionName, actionInput, _addTargets, removeTargets, viewActions, available, approve, declined, autoNote, authorizedFetch, refreshAndSettle, unsettledNote, viewAction, mutating, cloneSettled, _catalogId, _handle$getApplicatio7, _handle$getApplicatio8, catalogId, importSettled, _handle$getApplicatio9, _handle$getApplicatio10, _params2$scope, _pricelistNode, app, serieNo, _params2, scope, key, parent, parentHandle, pricelistNode, patch, label, factors, pricelistRowId, factorOutcome, rejected, _handle$getApplicatio11, _handle$getApplicatio12, _app, pricesSettled, removeTargetIn, _target4, _header, live, saved, gone, attempt, rowsNote, _target5, keys, resolved, _iterator27, _step27, _loop8, _ret6, added, newColumns, _loop9, _i15, _resolved, decisionSubtableNote, partialNote, _column8, _search, _entry4$getActions, _entry4$getActions2, _enumDef$customParams, _data, _plainWords$sort$, _resolveGrid5, _entry4, _api3, _error4, _handle2, _column7, search, _limit, wantsExact, needle, equals, optionAction, _yield$optionAction$o, options, note, enumDef, enumData, _enumDef$customParams2, computedDef, savedRowsOnly, fields, _enumDef$cellDataType, firstRow, rowData, patternChars, plainWords, remoteSearch, matchLocally, fetchLimit, fetched, text, _options, fetchCapped, _defs$find$customPara, _defs$find, _handle2$getApplicati, _handle2$getApplicati2, defs, url, _rowFields, appScope, deps, hint, _resolveGrid6, _api4, _error5, _resolveGrid7, _entry5, _error6, _handle3, _label, _autoNote;
52870
52887
  return _regeneratorRuntime.wrap(function _callee11$(_context18) {
52871
52888
  while (1) switch (_context18.prev = _context18.next) {
52872
52889
  case 0:
@@ -52882,7 +52899,7 @@ function createNavigationToolset(ctx) {
52882
52899
  if (!args[canonical] && from) args[canonical] = from;
52883
52900
  }
52884
52901
  _context18.t0 = name;
52885
- _context18.next = _context18.t0 === 'listViews' ? 6 : _context18.t0 === 'navigateTo' ? 8 : _context18.t0 === 'listGrids' ? 24 : _context18.t0 === 'locateRow' ? 31 : _context18.t0 === 'openToolbarTool' ? 121 : _context18.t0 === 'readGridRows' ? 127 : _context18.t0 === 'stageTableEdits' ? 177 : _context18.t0 === 'reloadPage' ? 588 : _context18.t0 === 'reloadPlanner' ? 593 : _context18.t0 === 'runTableAction' ? 607 : _context18.t0 === 'readColumnOptions' ? 858 : _context18.t0 === 'clearGridFilter' ? 926 : _context18.t0 === 'discardStagedChanges' ? 931 : 952;
52902
+ _context18.next = _context18.t0 === 'listViews' ? 6 : _context18.t0 === 'navigateTo' ? 8 : _context18.t0 === 'listGrids' ? 24 : _context18.t0 === 'locateRow' ? 31 : _context18.t0 === 'openToolbarTool' ? 121 : _context18.t0 === 'readGridRows' ? 127 : _context18.t0 === 'stageTableEdits' ? 177 : _context18.t0 === 'reloadPage' ? 592 : _context18.t0 === 'reloadPlanner' ? 597 : _context18.t0 === 'runTableAction' ? 611 : _context18.t0 === 'readColumnOptions' ? 862 : _context18.t0 === 'clearGridFilter' ? 931 : _context18.t0 === 'discardStagedChanges' ? 936 : 957;
52886
52903
  break;
52887
52904
  case 6:
52888
52905
  _allViews2 = allViews(root, ctx), views = _allViews2.views, editorSubviews = _allViews2.editorSubviews;
@@ -53761,7 +53778,7 @@ function createNavigationToolset(ctx) {
53761
53778
  error: "Column '".concat(column, "' is not editable on this row (row-dependent rule).")
53762
53779
  };
53763
53780
  }
53764
- } catch (_unused) {
53781
+ } catch (_unused2) {
53765
53782
  /* editable fn needs grid params we don't have — do not block */
53766
53783
  }
53767
53784
  }
@@ -53947,18 +53964,63 @@ function createNavigationToolset(ctx) {
53947
53964
  return e instanceof Error ? e.message : String(e);
53948
53965
  }
53949
53966
  };
53967
+ /**
53968
+ * Whether a NEW row's cell is editable, judged the way the write path judges it: by the DIVA definition's
53969
+ * rule (AG Grid's colDef may not carry it), against the row AS PROPOSED. Judged against an empty row instead,
53970
+ * a value-dependent rule (a set number editable once a quantity is filled in) refused what the write would
53971
+ * have accepted; judged against the proposed row, `!!data._id` still refuses series.catalogGroupCode — the
53972
+ * column a dry run had waved through before the write lost a hundred rows to it. A rule that needs more
53973
+ * than the row (grid context) throws, and that is reported as UNVERIFIED rather than passed off as a pass.
53974
+ */
53975
+ newRowEditability = function newRowEditability(column, candidate) {
53976
+ var _divaDefOf;
53977
+ var editableFn = (_divaDefOf = divaDefOf(_divaDefs, column)) === null || _divaDefOf === void 0 ? void 0 : _divaDefOf.editable;
53978
+ if (typeof editableFn !== 'function') return 'editable';
53979
+ var colDef = _api2.getColumnDef(column);
53980
+ try {
53981
+ return editableFn({
53982
+ data: candidate,
53983
+ colDef: colDef
53984
+ }) ? 'editable' : 'refused';
53985
+ } catch (_unused3) {
53986
+ return 'unverified';
53987
+ }
53988
+ };
53989
+ newRowEditRefusal = function newRowEditRefusal(column) {
53990
+ return "Column '".concat(column, "' is not editable on the row as proposed \u2014 its own rule refuses it for these values. ") + "Typically the row has to exist first (create it, then set the column with 'edits'), or another column of the row has to be filled in.";
53991
+ };
53992
+ /** The value the grid would store for the cell — its own parser, so a row rule sees a number as a number, not as text. */
53993
+ typedValueOf = function typedValueOf(column, text) {
53994
+ var colDef = _api2.getColumnDef(column);
53995
+ if (typeof (colDef === null || colDef === void 0 ? void 0 : colDef.valueParser) !== 'function') return text;
53996
+ try {
53997
+ var _api2$getColumn2;
53998
+ var parsed = colDef.valueParser({
53999
+ api: _api2,
54000
+ column: (_api2$getColumn2 = _api2.getColumn) === null || _api2$getColumn2 === void 0 ? void 0 : _api2$getColumn2.call(_api2, column),
54001
+ colDef: colDef,
54002
+ data: {},
54003
+ node: undefined,
54004
+ oldValue: undefined,
54005
+ newValue: text
54006
+ });
54007
+ return parsed === undefined || parsed === null ? text : parsed;
54008
+ } catch (_unused4) {
54009
+ return text;
54010
+ }
54011
+ };
53950
54012
  /**
53951
54013
  * A computed column stores through its cellEditToRowUpdate, which the write path runs after the parser; a value
53952
54014
  * the hook refuses (undefined) never reaches the row, so a dry run has to ask the hook too - the matrix refuses 0.
53953
54015
  */
53954
54016
  computedRefusalOf = function computedRefusalOf(column, text) {
53955
- var _api2$getColumn2;
54017
+ var _api2$getColumn3;
53956
54018
  var divaDef = divaDefOf(_divaDefs, column);
53957
54019
  if (!isComputedColumn(divaDef)) return undefined;
53958
54020
  var colDef = _api2.getColumnDef(column);
53959
54021
  var parsed = typeof (colDef === null || colDef === void 0 ? void 0 : colDef.valueParser) === 'function' ? colDef.valueParser({
53960
54022
  api: _api2,
53961
- column: (_api2$getColumn2 = _api2.getColumn) === null || _api2$getColumn2 === void 0 ? void 0 : _api2$getColumn2.call(_api2, column),
54023
+ column: (_api2$getColumn3 = _api2.getColumn) === null || _api2$getColumn3 === void 0 ? void 0 : _api2$getColumn3.call(_api2, column),
53962
54024
  colDef: colDef,
53963
54025
  data: {},
53964
54026
  node: undefined,
@@ -54014,8 +54076,8 @@ function createNavigationToolset(ctx) {
54014
54076
  };
54015
54077
  }();
54016
54078
  isLookupColumn = function isLookupColumn(column) {
54017
- var _divaDefOf;
54018
- return ((_divaDefOf = divaDefOf(_divaDefs, column)) === null || _divaDefOf === void 0 ? void 0 : _divaDefOf.cellDataType) === 'lookup';
54079
+ var _divaDefOf2;
54080
+ return ((_divaDefOf2 = divaDefOf(_divaDefs, column)) === null || _divaDefOf2 === void 0 ? void 0 : _divaDefOf2.cellDataType) === 'lookup';
54019
54081
  };
54020
54082
  lookupWrite = /*#__PURE__*/function () {
54021
54083
  var _ref21 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(column, raw, rowData) {
@@ -54034,7 +54096,7 @@ function createNavigationToolset(ctx) {
54034
54096
  if (Array.isArray(parsed)) normalizedRaw = parsed.map(function (v) {
54035
54097
  return String(v).trim();
54036
54098
  }).join(',');
54037
- } catch (_unused2) {
54099
+ } catch (_unused5) {
54038
54100
  normalizedRaw = normalizedRaw.slice(1, -1);
54039
54101
  }
54040
54102
  }
@@ -54437,7 +54499,7 @@ function createNavigationToolset(ctx) {
54437
54499
  // for rows that came from a payload: the agent never read them, so this is its only way to check them — and
54438
54500
  // the answer stays small, counts plus the failing rows, however many rows there are.
54439
54501
  if (!(input !== null && input !== void 0 && input.dryRun && addRows.length)) {
54440
- _context18.next = 290;
54502
+ _context18.next = 294;
54441
54503
  break;
54442
54504
  }
54443
54505
  requiredFields = _divaDefs.filter(function (definition) {
@@ -54446,12 +54508,17 @@ function createNavigationToolset(ctx) {
54446
54508
  return definition.field;
54447
54509
  });
54448
54510
  failures = [];
54511
+ editabilityUnverified = new Set();
54449
54512
  addRows.forEach(function (row, index) {
54450
54513
  var _row$values;
54451
54514
  var rawValues = (_row$values = row === null || row === void 0 ? void 0 : row.values) !== null && _row$values !== void 0 ? _row$values : {};
54452
54515
  var provided = new Set();
54453
54516
  var failuresBefore = failures.length;
54454
54517
  var usable = false;
54518
+ // Pass 1 parses every cell into the row the write path would judge — a row rule may read a sibling cell,
54519
+ // so no rule is asked before the whole row is known.
54520
+ var candidate = {};
54521
+ var judged = [];
54455
54522
  var _loop2 = function _loop2() {
54456
54523
  var _parseRefusalOf;
54457
54524
  var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i5], 2),
@@ -54461,12 +54528,15 @@ function createNavigationToolset(ctx) {
54461
54528
  var _customParams, _divaDefs$find3, _params$additionalMap;
54462
54529
  usable = true;
54463
54530
  provided.add(column);
54531
+ // The key as typed: what a sibling's rule reads is that the cell is filled, and resolving it would
54532
+ // cost a server round-trip per row. The lookup's own rule stays unverified, as its value does.
54533
+ candidate[column] = rawValue;
54464
54534
  // A lookup also fills its companion fields; resolving it would cost a server round-trip per row.
54465
- var params = (_customParams = (_divaDefs$find3 = _divaDefs.find(function (definition) {
54535
+ var _params = (_customParams = (_divaDefs$find3 = _divaDefs.find(function (definition) {
54466
54536
  return definition.field === column;
54467
54537
  })) === null || _divaDefs$find3 === void 0 ? void 0 : _divaDefs$find3.customParams) !== null && _customParams !== void 0 ? _customParams : {};
54468
- if (params.nameField) provided.add(params.nameField);
54469
- var _iterator8 = _createForOfIteratorHelper$r((_params$additionalMap = params.additionalMappings) !== null && _params$additionalMap !== void 0 ? _params$additionalMap : []),
54538
+ if (_params.nameField) provided.add(_params.nameField);
54539
+ var _iterator8 = _createForOfIteratorHelper$r((_params$additionalMap = _params.additionalMappings) !== null && _params$additionalMap !== void 0 ? _params$additionalMap : []),
54470
54540
  _step8;
54471
54541
  try {
54472
54542
  for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
@@ -54501,6 +54571,8 @@ function createNavigationToolset(ctx) {
54501
54571
  });
54502
54572
  return 0; // continue
54503
54573
  }
54574
+ candidate[column] = typedValueOf(column, check.text);
54575
+ judged.push(column);
54504
54576
  provided.add(column);
54505
54577
  usable = true;
54506
54578
  },
@@ -54509,6 +54581,22 @@ function createNavigationToolset(ctx) {
54509
54581
  _ret2 = _loop2();
54510
54582
  if (_ret2 === 0) continue;
54511
54583
  }
54584
+ // Pass 2 asks each row rule about the proposed row. A refused column counts as not provided, exactly as
54585
+ // a cell the write path refuses never reaches the row.
54586
+ for (var _i6 = 0, _judged = judged; _i6 < _judged.length; _i6++) {
54587
+ var _column = _judged[_i6];
54588
+ var verdict = newRowEditability(_column, candidate);
54589
+ if (verdict === 'refused') {
54590
+ failures.push({
54591
+ row: index + 1,
54592
+ column: _column,
54593
+ error: newRowEditRefusal(_column)
54594
+ });
54595
+ provided["delete"](_column);
54596
+ } else if (verdict === 'unverified') {
54597
+ editabilityUnverified.add(_column);
54598
+ }
54599
+ }
54512
54600
  // The staging path refuses such a row before it looks at the required columns — same order, same words.
54513
54601
  if (!usable && failures.length === failuresBefore) {
54514
54602
  failures.push({
@@ -54537,17 +54625,22 @@ function createNavigationToolset(ctx) {
54537
54625
  problems = groupByFault(failures, function (failure) {
54538
54626
  return failure.row;
54539
54627
  });
54540
- return _context18.abrupt("return", {
54628
+ return _context18.abrupt("return", _objectSpread$X(_objectSpread$X({
54541
54629
  applied: false,
54542
54630
  dryRun: true,
54543
54631
  rowCount: addRows.length,
54544
54632
  okRowCount: addRows.length - failedRows.size,
54545
54633
  failedRowCount: failedRows.size,
54546
54634
  problems: problems.length ? problems.slice(0, PROBLEM_GROUP_LIMIT) : undefined,
54547
- problemsTruncated: problems.length > PROBLEM_GROUP_LIMIT ? problems.length - PROBLEM_GROUP_LIMIT : undefined,
54548
- note: "NOTHING was staged. ".concat(addRows.length - failedRows.size, " of ").concat(addRows.length, " row(s) pass the table's column rules. ") + 'Checked: the columns exist and are writable, every value parses the way its column stores it (numbers, dates, booleans, enum and codec values), every row has a usable value, every required column is present. ' + 'NOT checked: lookup values and server-side rules — those cost a request per row and are reported by the real call. ' + "Row numbers count the addRows list (a payload's rows follow the rows listed in the call), then the addRowsTsv lines. " + 'Re-send without dryRun to stage and commit.' + (addRows.length > WRITE_ROW_LIMIT ? " NOTE: ".concat(addRows.length, " rows exceed the ").concat(WRITE_ROW_LIMIT, "-row limit of ONE write \u2014 split them across calls.") : '')
54549
- });
54550
- case 290:
54635
+ problemsTruncated: problems.length > PROBLEM_GROUP_LIMIT ? problems.length - PROBLEM_GROUP_LIMIT : undefined
54636
+ }, editabilityUnverified.size ? {
54637
+ editabilityUnverified: _toConsumableArray(editabilityUnverified)
54638
+ } : {}), {}, {
54639
+ note: "NOTHING was staged. ".concat(addRows.length - failedRows.size, " of ").concat(addRows.length, " row(s) pass the table's column rules. ") + 'Checked: the columns exist and are writable, every value parses the way its column stores it (numbers, dates, booleans, enum and codec values), every row has a usable value, every required column is present, and every row rule that could be asked accepts the row as proposed. ' + 'NOT checked: lookup values and server-side rules — those cost a request per row and are reported by the real call' + (editabilityUnverified.size ? "; and the editability of ".concat(_toConsumableArray(editabilityUnverified).map(function (column) {
54640
+ return "'".concat(column, "'");
54641
+ }).join(', '), " (editabilityUnverified) \u2014 its rule needs grid context a dry run does not have, so the real call may still refuse it. ") : '. ') + "Row numbers count the addRows list (a payload's rows follow the rows listed in the call), then the addRowsTsv lines. " + 'Re-send without dryRun to stage and commit.' + (addRows.length > WRITE_ROW_LIMIT ? " NOTE: ".concat(addRows.length, " rows exceed the ").concat(WRITE_ROW_LIMIT, "-row limit of ONE write \u2014 split them across calls.") : '')
54642
+ }));
54643
+ case 294:
54551
54644
  /** Mirrors locateRowCore's own loaded-rows check (read-only) — never mutates the filter itself. */
54552
54645
  needsServerLookup = function needsServerLookup(keyColumn, keyValue) {
54553
54646
  var colDef = columnDefFor(keyColumn);
@@ -54651,24 +54744,24 @@ function createNavigationToolset(ctx) {
54651
54744
  };
54652
54745
  preApproved = false;
54653
54746
  if (!(lookupKeys.size > 0)) {
54654
- _context18.next = 338;
54747
+ _context18.next = 342;
54655
54748
  break;
54656
54749
  }
54657
54750
  intendedCount = edits.length + addRows.length + removeRowIds.length + removeRows.length;
54658
54751
  if (!ctx.autoApprove) awaitingApproval();
54659
54752
  _context18.t5 = ctx.autoApprove;
54660
54753
  if (_context18.t5) {
54661
- _context18.next = 309;
54754
+ _context18.next = 313;
54662
54755
  break;
54663
54756
  }
54664
- _context18.next = 308;
54757
+ _context18.next = 312;
54665
54758
  return _entry2.requestAgentApproval(intendedCount, "".concat(intendedCount, " change(s) \u2014 ").concat(lookupKeys.size, " row(s) must be located first"), signal);
54666
- case 308:
54759
+ case 312:
54667
54760
  _context18.t5 = _context18.sent;
54668
- case 309:
54761
+ case 313:
54669
54762
  _approved = _context18.t5;
54670
54763
  if (_approved) {
54671
- _context18.next = 313;
54764
+ _context18.next = 317;
54672
54765
  break;
54673
54766
  }
54674
54767
  restoreUserFilter();
@@ -54677,10 +54770,10 @@ function createNavigationToolset(ctx) {
54677
54770
  stagedCount: 0,
54678
54771
  note: 'The user DECLINED the change — nothing was staged or saved. Do not retry; ask what to do instead.'
54679
54772
  });
54680
- case 313:
54773
+ case 317:
54681
54774
  preApproved = true;
54682
54775
  _iterator13 = _createForOfIteratorHelper$r(lookupKeys.values());
54683
- _context18.prev = 315;
54776
+ _context18.prev = 319;
54684
54777
  _loop3 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop3() {
54685
54778
  var _step13$value, keyColumn, keyValue, target, _target$error, node, rowId, rowEdits, rowRemovals, _node$data3, _iterator14, _step14, _edit$column, _edit;
54686
54779
  return _regeneratorRuntime.wrap(function _loop3$(_context7) {
@@ -54775,155 +54868,155 @@ function createNavigationToolset(ctx) {
54775
54868
  }, _loop3, null, [[22, 32, 35, 38]]);
54776
54869
  });
54777
54870
  _iterator13.s();
54778
- case 318:
54871
+ case 322:
54779
54872
  if ((_step13 = _iterator13.n()).done) {
54780
- _context18.next = 325;
54873
+ _context18.next = 329;
54781
54874
  break;
54782
54875
  }
54783
- return _context18.delegateYield(_loop3(), "t6", 320);
54784
- case 320:
54876
+ return _context18.delegateYield(_loop3(), "t6", 324);
54877
+ case 324:
54785
54878
  _ret3 = _context18.t6;
54786
54879
  if (!(_ret3 === 0)) {
54787
- _context18.next = 323;
54880
+ _context18.next = 327;
54788
54881
  break;
54789
54882
  }
54790
- return _context18.abrupt("continue", 323);
54791
- case 323:
54792
- _context18.next = 318;
54883
+ return _context18.abrupt("continue", 327);
54884
+ case 327:
54885
+ _context18.next = 322;
54793
54886
  break;
54794
- case 325:
54795
- _context18.next = 330;
54887
+ case 329:
54888
+ _context18.next = 334;
54796
54889
  break;
54797
- case 327:
54798
- _context18.prev = 327;
54799
- _context18.t7 = _context18["catch"](315);
54890
+ case 331:
54891
+ _context18.prev = 331;
54892
+ _context18.t7 = _context18["catch"](319);
54800
54893
  _iterator13.e(_context18.t7);
54801
- case 330:
54802
- _context18.prev = 330;
54894
+ case 334:
54895
+ _context18.prev = 334;
54803
54896
  _iterator13.f();
54804
- return _context18.finish(330);
54805
- case 333:
54897
+ return _context18.finish(334);
54898
+ case 337:
54806
54899
  // Bring the loaded window back to what the caller had before more edits (possibly rowId-addressed,
54807
54900
  // always assumed already-loaded) rely on it — restoreUserFilter only mutates when a lookup above
54808
54901
  // actually changed something, and the grid needs a moment to settle after a filter change.
54809
54902
  filterWasChanged = keyFilterApplied;
54810
54903
  restoreUserFilter();
54811
54904
  if (!filterWasChanged) {
54812
- _context18.next = 338;
54905
+ _context18.next = 342;
54813
54906
  break;
54814
54907
  }
54815
- _context18.next = 338;
54908
+ _context18.next = 342;
54816
54909
  return waitForRows(_api2);
54817
- case 338:
54910
+ case 342:
54818
54911
  // Key-addressed removals resolve to rowIds before the edit loop (conflicts are checked against the final id list).
54819
54912
  // Rows already resolved+staged+committed by the sequential lookup pass above are skipped here.
54820
54913
  _iterator15 = _createForOfIteratorHelper$r(removeRows);
54821
- _context18.prev = 339;
54914
+ _context18.prev = 343;
54822
54915
  _iterator15.s();
54823
- case 341:
54916
+ case 345:
54824
54917
  if ((_step15 = _iterator15.n()).done) {
54825
- _context18.next = 355;
54918
+ _context18.next = 359;
54826
54919
  break;
54827
54920
  }
54828
54921
  _removal2 = _step15.value;
54829
54922
  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))))) {
54830
- _context18.next = 345;
54923
+ _context18.next = 349;
54831
54924
  break;
54832
54925
  }
54833
- return _context18.abrupt("continue", 353);
54834
- case 345:
54835
- _context18.next = 347;
54926
+ return _context18.abrupt("continue", 357);
54927
+ case 349:
54928
+ _context18.next = 351;
54836
54929
  return resolveTarget(_removal2);
54837
- case 347:
54930
+ case 351:
54838
54931
  _target2 = _context18.sent;
54839
54932
  if (!(_target2.error || !_target2.node)) {
54840
- _context18.next = 351;
54933
+ _context18.next = 355;
54841
54934
  break;
54842
54935
  }
54843
54936
  failed.push({
54844
54937
  rowId: _target2.label,
54845
54938
  error: (_target2$error = _target2.error) !== null && _target2$error !== void 0 ? _target2$error : 'Row not found.'
54846
54939
  });
54847
- return _context18.abrupt("continue", 353);
54848
- case 351:
54940
+ return _context18.abrupt("continue", 357);
54941
+ case 355:
54849
54942
  id = String(_target2.node.id);
54850
54943
  if (!removeRowIds.includes(id)) removeRowIds.push(id);
54851
- case 353:
54852
- _context18.next = 341;
54944
+ case 357:
54945
+ _context18.next = 345;
54853
54946
  break;
54854
- case 355:
54855
- _context18.next = 360;
54947
+ case 359:
54948
+ _context18.next = 364;
54856
54949
  break;
54857
- case 357:
54858
- _context18.prev = 357;
54859
- _context18.t8 = _context18["catch"](339);
54950
+ case 361:
54951
+ _context18.prev = 361;
54952
+ _context18.t8 = _context18["catch"](343);
54860
54953
  _iterator15.e(_context18.t8);
54861
- case 360:
54862
- _context18.prev = 360;
54954
+ case 364:
54955
+ _context18.prev = 364;
54863
54956
  _iterator15.f();
54864
- return _context18.finish(360);
54865
- case 363:
54957
+ return _context18.finish(364);
54958
+ case 367:
54866
54959
  _iterator16 = _createForOfIteratorHelper$r(edits);
54867
- _context18.prev = 364;
54960
+ _context18.prev = 368;
54868
54961
  _iterator16.s();
54869
- case 366:
54962
+ case 370:
54870
54963
  if ((_step16 = _iterator16.n()).done) {
54871
- _context18.next = 386;
54964
+ _context18.next = 390;
54872
54965
  break;
54873
54966
  }
54874
54967
  _edit4 = _step16.value;
54875
54968
  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))))) {
54876
- _context18.next = 370;
54969
+ _context18.next = 374;
54877
54970
  break;
54878
54971
  }
54879
- return _context18.abrupt("continue", 384);
54880
- case 370:
54881
- _column = String((_edit4$column = _edit4 === null || _edit4 === void 0 ? void 0 : _edit4.column) !== null && _edit4$column !== void 0 ? _edit4$column : '');
54882
- _context18.next = 373;
54972
+ return _context18.abrupt("continue", 388);
54973
+ case 374:
54974
+ _column2 = String((_edit4$column = _edit4 === null || _edit4 === void 0 ? void 0 : _edit4.column) !== null && _edit4$column !== void 0 ? _edit4$column : '');
54975
+ _context18.next = 377;
54883
54976
  return resolveTarget(_edit4);
54884
- case 373:
54977
+ case 377:
54885
54978
  _target3 = _context18.sent;
54886
54979
  if (!(_target3.error || !_target3.node)) {
54887
- _context18.next = 377;
54980
+ _context18.next = 381;
54888
54981
  break;
54889
54982
  }
54890
54983
  failed.push({
54891
54984
  rowId: _target3.label,
54892
- column: _column,
54985
+ column: _column2,
54893
54986
  error: (_target3$error = _target3.error) !== null && _target3$error !== void 0 ? _target3$error : 'Row not found.'
54894
54987
  });
54895
- return _context18.abrupt("continue", 384);
54896
- case 377:
54988
+ return _context18.abrupt("continue", 388);
54989
+ case 381:
54897
54990
  _node2 = _target3.node;
54898
54991
  _rowId2 = String(_node2.id);
54899
54992
  if (!removeRowIds.includes(_rowId2)) {
54900
- _context18.next = 382;
54993
+ _context18.next = 386;
54901
54994
  break;
54902
54995
  }
54903
54996
  failed.push({
54904
54997
  rowId: _rowId2,
54905
- column: _column,
54998
+ column: _column2,
54906
54999
  error: 'This row is also being removed — edit OR remove a row, not both.'
54907
55000
  });
54908
- return _context18.abrupt("continue", 384);
54909
- case 382:
54910
- _context18.next = 384;
54911
- return applyEditToNode(_node2, _rowId2, _column, _edit4 === null || _edit4 === void 0 ? void 0 : _edit4.newValue);
54912
- case 384:
54913
- _context18.next = 366;
54914
- break;
55001
+ return _context18.abrupt("continue", 388);
54915
55002
  case 386:
54916
- _context18.next = 391;
54917
- break;
55003
+ _context18.next = 388;
55004
+ return applyEditToNode(_node2, _rowId2, _column2, _edit4 === null || _edit4 === void 0 ? void 0 : _edit4.newValue);
54918
55005
  case 388:
54919
- _context18.prev = 388;
54920
- _context18.t9 = _context18["catch"](364);
55006
+ _context18.next = 370;
55007
+ break;
55008
+ case 390:
55009
+ _context18.next = 395;
55010
+ break;
55011
+ case 392:
55012
+ _context18.prev = 392;
55013
+ _context18.t9 = _context18["catch"](368);
54921
55014
  _iterator16.e(_context18.t9);
54922
- case 391:
54923
- _context18.prev = 391;
55015
+ case 395:
55016
+ _context18.prev = 395;
54924
55017
  _iterator16.f();
54925
- return _context18.finish(391);
54926
- case 394:
55018
+ return _context18.finish(395);
55019
+ case 398:
54927
55020
  targets = removeRowIds.filter(function (rowId) {
54928
55021
  if (isRealRow(_api2.getRowNode(rowId))) return true;
54929
55022
  failed.push({
@@ -54944,47 +55037,47 @@ function createNavigationToolset(ctx) {
54944
55037
  _iterator17.f();
54945
55038
  }
54946
55039
  if (!targets.length) {
54947
- _context18.next = 401;
55040
+ _context18.next = 405;
54948
55041
  break;
54949
55042
  }
54950
- _context18.next = 400;
55043
+ _context18.next = 404;
54951
55044
  return handle.stageRemoveRows(targets);
54952
- case 400:
55045
+ case 404:
54953
55046
  removed.push.apply(removed, _toConsumableArray(targets));
54954
- case 401:
55047
+ case 405:
54955
55048
  addedRows = [];
54956
55049
  /** Columns the AGENT provided per added row — lookup writes drag companion fields into `values`. */
54957
55050
  providedAddColumns = new Map();
54958
55051
  conditionedPosDefaults = 0;
54959
55052
  lookupWriteCache = new Map();
54960
55053
  _loop4 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop4() {
54961
- var _addRows$_i6$values, _addRows$_i, _handle$getApplicatio5, _handle$getApplicatio6;
54962
- var rawValues, plainCols, lookupCols, bad, _i9, _Object$entries4, _Object$entries4$_i, _column2, rawValue, check, provided, _loop6, _i10, _lookupCols, hasField, requiredMissing, seed, newId, values, _i11, _plainCols, _plainCols$_i, _column3, text, ok, appData, rowFields, rowDepsOf, lookupColumns, _loop7, _ret5, _api2$getRowNode$data, _api2$getRowNode9, finished, _iterator26, _step26, _divaDefOf2, _step26$value, _column4, _text, isPosCountRow, _ok2, _api2$getRowNode$data2, _api2$getRowNode10, _finished, _i12, _arr3, _divaDefOf3, _column5, editableFn, locked;
55054
+ var _addRows$_i7$values, _addRows$_i, _handle$getApplicatio5, _handle$getApplicatio6;
55055
+ var rawValues, plainCols, lookupCols, bad, _i10, _Object$entries4, _Object$entries4$_i, _column3, rawValue, check, provided, _loop6, _i11, _lookupCols, hasField, requiredMissing, seed, newId, values, _i12, _plainCols, _plainCols$_i, _column4, text, ok, appData, rowFields, rowDepsOf, lookupColumns, _loop7, _ret5, _api2$getRowNode$data, _api2$getRowNode9, finished, _iterator26, _step26, _divaDefOf3, _step26$value, _column5, _text, isPosCountRow, _ok2, _api2$getRowNode$data2, _api2$getRowNode10, _finished, _i13, _arr3, _divaDefOf4, _column6, editableFn, locked;
54963
55056
  return _regeneratorRuntime.wrap(function _loop4$(_context12) {
54964
55057
  while (1) switch (_context12.prev = _context12.next) {
54965
55058
  case 0:
54966
- rawValues = (_addRows$_i6$values = (_addRows$_i = addRows[_i6]) === null || _addRows$_i === void 0 ? void 0 : _addRows$_i.values) !== null && _addRows$_i6$values !== void 0 ? _addRows$_i6$values : {};
55059
+ rawValues = (_addRows$_i7$values = (_addRows$_i = addRows[_i7]) === null || _addRows$_i === void 0 ? void 0 : _addRows$_i.values) !== null && _addRows$_i7$values !== void 0 ? _addRows$_i7$values : {};
54967
55060
  plainCols = [];
54968
55061
  lookupCols = [];
54969
55062
  bad = false; // Every plain column is checked before anything is staged; the table parses them once the row exists.
54970
- _i9 = 0, _Object$entries4 = Object.entries(rawValues);
55063
+ _i10 = 0, _Object$entries4 = Object.entries(rawValues);
54971
55064
  case 5:
54972
- if (!(_i9 < _Object$entries4.length)) {
55065
+ if (!(_i10 < _Object$entries4.length)) {
54973
55066
  _context12.next = 19;
54974
55067
  break;
54975
55068
  }
54976
- _Object$entries4$_i = _slicedToArray(_Object$entries4[_i9], 2), _column2 = _Object$entries4$_i[0], rawValue = _Object$entries4$_i[1];
54977
- if (!isLookupColumn(_column2)) {
55069
+ _Object$entries4$_i = _slicedToArray(_Object$entries4[_i10], 2), _column3 = _Object$entries4$_i[0], rawValue = _Object$entries4$_i[1];
55070
+ if (!isLookupColumn(_column3)) {
54978
55071
  _context12.next = 10;
54979
55072
  break;
54980
55073
  }
54981
- lookupCols.push([_column2, rawValue]);
55074
+ lookupCols.push([_column3, rawValue]);
54982
55075
  return _context12.abrupt("continue", 16);
54983
55076
  case 10:
54984
55077
  // The row's own values decide a row-dependent PARSER (the count column of the flat combination table):
54985
55078
  // the decision arrives in the same call, so the cell is not the action grammar just because the row
54986
55079
  // does not exist yet. Row rules stay out until the row is finished.
54987
- check = checkCellInput(_column2, String(rawValue !== null && rawValue !== void 0 ? rawValue : ''), rawValues, {
55080
+ check = checkCellInput(_column3, String(rawValue !== null && rawValue !== void 0 ? rawValue : ''), rawValues, {
54988
55081
  skipRowRules: true
54989
55082
  });
54990
55083
  if (check.ok) {
@@ -54992,16 +55085,16 @@ function createNavigationToolset(ctx) {
54992
55085
  break;
54993
55086
  }
54994
55087
  failed.push({
54995
- rowId: "addRows[".concat(_i6, "]"),
54996
- column: _column2,
55088
+ rowId: "addRows[".concat(_i7, "]"),
55089
+ column: _column3,
54997
55090
  error: check.error
54998
55091
  });
54999
55092
  bad = true;
55000
55093
  return _context12.abrupt("break", 19);
55001
55094
  case 15:
55002
- if (check.text !== '') plainCols.push([_column2, check.text]);
55095
+ if (check.text !== '') plainCols.push([_column3, check.text]);
55003
55096
  case 16:
55004
- _i9++;
55097
+ _i10++;
55005
55098
  _context12.next = 5;
55006
55099
  break;
55007
55100
  case 19:
@@ -55016,7 +55109,7 @@ function createNavigationToolset(ctx) {
55016
55109
  break;
55017
55110
  }
55018
55111
  failed.push({
55019
- rowId: "addRows[".concat(_i6, "]"),
55112
+ rowId: "addRows[".concat(_i7, "]"),
55020
55113
  error: 'No usable values — provide at least one column value.'
55021
55114
  });
55022
55115
  return _context12.abrupt("return", 0);
@@ -55034,7 +55127,7 @@ function createNavigationToolset(ctx) {
55034
55127
  return _regeneratorRuntime.wrap(function _loop6$(_context10) {
55035
55128
  while (1) switch (_context10.prev = _context10.next) {
55036
55129
  case 0:
55037
- _lookupCols$_i = _slicedToArray(_lookupCols[_i10], 1), column = _lookupCols$_i[0];
55130
+ _lookupCols$_i = _slicedToArray(_lookupCols[_i11], 1), column = _lookupCols$_i[0];
55038
55131
  provided.add(column);
55039
55132
  params = (_divaDefs$find$custom = (_divaDefs$find4 = _divaDefs.find(function (d) {
55040
55133
  return d.field === column;
@@ -55057,15 +55150,15 @@ function createNavigationToolset(ctx) {
55057
55150
  }
55058
55151
  }, _loop6);
55059
55152
  });
55060
- _i10 = 0, _lookupCols = lookupCols;
55153
+ _i11 = 0, _lookupCols = lookupCols;
55061
55154
  case 27:
55062
- if (!(_i10 < _lookupCols.length)) {
55155
+ if (!(_i11 < _lookupCols.length)) {
55063
55156
  _context12.next = 32;
55064
55157
  break;
55065
55158
  }
55066
55159
  return _context12.delegateYield(_loop6(), "t0", 29);
55067
55160
  case 29:
55068
- _i10++;
55161
+ _i11++;
55069
55162
  _context12.next = 27;
55070
55163
  break;
55071
55164
  case 32:
@@ -55086,7 +55179,7 @@ function createNavigationToolset(ctx) {
55086
55179
  break;
55087
55180
  }
55088
55181
  failed.push({
55089
- rowId: "addRows[".concat(_i6, "]"),
55182
+ rowId: "addRows[".concat(_i7, "]"),
55090
55183
  error: "Missing required column(s): ".concat(requiredMissing.join(', '), ".")
55091
55184
  });
55092
55185
  return _context12.abrupt("return", 0);
@@ -55110,21 +55203,21 @@ function createNavigationToolset(ctx) {
55110
55203
  break;
55111
55204
  }
55112
55205
  failed.push({
55113
- rowId: "addRows[".concat(_i6, "]"),
55206
+ rowId: "addRows[".concat(_i7, "]"),
55114
55207
  error: 'This table does not support creating rows (no create endpoint).'
55115
55208
  });
55116
55209
  return _context12.abrupt("return", 0);
55117
55210
  case 45:
55118
55211
  values = _objectSpread$X({}, seed);
55119
- _i11 = 0, _plainCols = plainCols;
55212
+ _i12 = 0, _plainCols = plainCols;
55120
55213
  case 47:
55121
- if (!(_i11 < _plainCols.length)) {
55214
+ if (!(_i12 < _plainCols.length)) {
55122
55215
  _context12.next = 60;
55123
55216
  break;
55124
55217
  }
55125
- _plainCols$_i = _slicedToArray(_plainCols[_i11], 2), _column3 = _plainCols$_i[0], text = _plainCols$_i[1];
55218
+ _plainCols$_i = _slicedToArray(_plainCols[_i12], 2), _column4 = _plainCols$_i[0], text = _plainCols$_i[1];
55126
55219
  _context12.next = 51;
55127
- return writeCell(newId, _column3, text);
55220
+ return writeCell(newId, _column4, text);
55128
55221
  case 51:
55129
55222
  ok = _context12.sent;
55130
55223
  if (!(ok !== true)) {
@@ -55132,16 +55225,16 @@ function createNavigationToolset(ctx) {
55132
55225
  break;
55133
55226
  }
55134
55227
  failed.push({
55135
- rowId: "addRows[".concat(_i6, "]"),
55136
- column: _column3,
55228
+ rowId: "addRows[".concat(_i7, "]"),
55229
+ column: _column4,
55137
55230
  error: ok
55138
55231
  });
55139
55232
  bad = true;
55140
55233
  return _context12.abrupt("break", 60);
55141
55234
  case 56:
55142
- values[_column3] = cellValueOf(_api2, _api2.getRowNode(newId), _column3);
55235
+ values[_column4] = cellValueOf(_api2, _api2.getRowNode(newId), _column4);
55143
55236
  case 57:
55144
- _i11++;
55237
+ _i12++;
55145
55238
  _context12.next = 47;
55146
55239
  break;
55147
55240
  case 60:
@@ -55169,7 +55262,7 @@ function createNavigationToolset(ctx) {
55169
55262
  });
55170
55263
  _loop7 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop7() {
55171
55264
  var _api2$getRowNode$data3, _api2$getRowNode11, _lookupWriteCache$get;
55172
- var readyIdx, _lookupCols$splice$, column, rawValue, missingDeps, providers, lookupRowData, lookupCacheKey, res, write, _i13, _Object$entries5, _res$data, _Object$entries5$_i, key, _value2;
55265
+ var readyIdx, _lookupCols$splice$, column, rawValue, missingDeps, providers, lookupRowData, lookupCacheKey, res, write, _i14, _Object$entries5, _res$data, _Object$entries5$_i, key, _value2;
55173
55266
  return _regeneratorRuntime.wrap(function _loop7$(_context11) {
55174
55267
  while (1) switch (_context11.prev = _context11.next) {
55175
55268
  case 0:
@@ -55197,7 +55290,7 @@ function createNavigationToolset(ctx) {
55197
55290
  return provider !== null && provider !== void 0 && provider.field && provider.field !== column ? "'".concat(provider.field, "'") : "'".concat(dep, "'");
55198
55291
  });
55199
55292
  failed.push({
55200
- rowId: "addRows[".concat(_i6, "]"),
55293
+ rowId: "addRows[".concat(_i7, "]"),
55201
55294
  column: column,
55202
55295
  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).")
55203
55296
  });
@@ -55232,7 +55325,7 @@ function createNavigationToolset(ctx) {
55232
55325
  break;
55233
55326
  }
55234
55327
  failed.push({
55235
- rowId: "addRows[".concat(_i6, "]"),
55328
+ rowId: "addRows[".concat(_i7, "]"),
55236
55329
  column: column,
55237
55330
  error: res.error
55238
55331
  });
@@ -55241,8 +55334,8 @@ function createNavigationToolset(ctx) {
55241
55334
  case 23:
55242
55335
  // On a NEW row an undefined write-shape entry means "leave empty" — skip it so it does not clobber a provided key.
55243
55336
  write = {};
55244
- for (_i13 = 0, _Object$entries5 = Object.entries((_res$data = res.data) !== null && _res$data !== void 0 ? _res$data : {}); _i13 < _Object$entries5.length; _i13++) {
55245
- _Object$entries5$_i = _slicedToArray(_Object$entries5[_i13], 2), key = _Object$entries5$_i[0], _value2 = _Object$entries5$_i[1];
55337
+ for (_i14 = 0, _Object$entries5 = Object.entries((_res$data = res.data) !== null && _res$data !== void 0 ? _res$data : {}); _i14 < _Object$entries5.length; _i14++) {
55338
+ _Object$entries5$_i = _slicedToArray(_Object$entries5[_i14], 2), key = _Object$entries5$_i[0], _value2 = _Object$entries5$_i[1];
55246
55339
  if (_value2 !== undefined) write[key] = _value2;
55247
55340
  }
55248
55341
  _context11.t1 = Object.keys(write).length;
@@ -55262,7 +55355,7 @@ function createNavigationToolset(ctx) {
55262
55355
  break;
55263
55356
  }
55264
55357
  failed.push({
55265
- rowId: "addRows[".concat(_i6, "]"),
55358
+ rowId: "addRows[".concat(_i7, "]"),
55266
55359
  column: column,
55267
55360
  error: 'Staging failed (row disappeared?).'
55268
55361
  });
@@ -55308,8 +55401,8 @@ function createNavigationToolset(ctx) {
55308
55401
  _context12.next = 92;
55309
55402
  break;
55310
55403
  }
55311
- _step26$value = _slicedToArray(_step26.value, 2), _column4 = _step26$value[0], _text = _step26$value[1];
55312
- isPosCountRow = (_divaDefOf2 = divaDefOf(_divaDefs, _column4)) === null || _divaDefOf2 === void 0 || (_divaDefOf2 = _divaDefOf2.customParams) === null || _divaDefOf2 === void 0 ? void 0 : _divaDefOf2.isPosCount;
55404
+ _step26$value = _slicedToArray(_step26.value, 2), _column5 = _step26$value[0], _text = _step26$value[1];
55405
+ isPosCountRow = (_divaDefOf3 = divaDefOf(_divaDefs, _column5)) === null || _divaDefOf3 === void 0 || (_divaDefOf3 = _divaDefOf3.customParams) === null || _divaDefOf3 === void 0 ? void 0 : _divaDefOf3.isPosCount;
55313
55406
  if (!(typeof isPosCountRow !== 'function' || !isPosCountRow(finished))) {
55314
55407
  _context12.next = 82;
55315
55408
  break;
@@ -55317,7 +55410,7 @@ function createNavigationToolset(ctx) {
55317
55410
  return _context12.abrupt("continue", 90);
55318
55411
  case 82:
55319
55412
  _context12.next = 84;
55320
- return writeCell(newId, _column4, _text);
55413
+ return writeCell(newId, _column5, _text);
55321
55414
  case 84:
55322
55415
  _ok2 = _context12.sent;
55323
55416
  if (!(_ok2 !== true)) {
@@ -55325,14 +55418,14 @@ function createNavigationToolset(ctx) {
55325
55418
  break;
55326
55419
  }
55327
55420
  failed.push({
55328
- rowId: "addRows[".concat(_i6, "]"),
55329
- column: _column4,
55421
+ rowId: "addRows[".concat(_i7, "]"),
55422
+ column: _column5,
55330
55423
  error: _ok2
55331
55424
  });
55332
55425
  bad = true;
55333
55426
  return _context12.abrupt("break", 92);
55334
55427
  case 89:
55335
- values[_column4] = cellValueOf(_api2, _api2.getRowNode(newId), _column4);
55428
+ values[_column5] = cellValueOf(_api2, _api2.getRowNode(newId), _column5);
55336
55429
  case 90:
55337
55430
  _context12.next = 77;
55338
55431
  break;
@@ -55354,18 +55447,18 @@ function createNavigationToolset(ctx) {
55354
55447
  }
55355
55448
  _finished = (_api2$getRowNode$data2 = (_api2$getRowNode10 = _api2.getRowNode(newId)) === null || _api2$getRowNode10 === void 0 ? void 0 : _api2$getRowNode10.data) !== null && _api2$getRowNode$data2 !== void 0 ? _api2$getRowNode$data2 : values; // Lookup columns too: `lookupWrite` never evaluates the rule, so a lookup a creatable table locks on the
55356
55449
  // finished row (a parent key chosen by another column) would otherwise reach the server unchecked.
55357
- _i12 = 0, _arr3 = [].concat(_toConsumableArray(plainCols.map(function (_ref39) {
55450
+ _i13 = 0, _arr3 = [].concat(_toConsumableArray(plainCols.map(function (_ref39) {
55358
55451
  var _ref40 = _slicedToArray(_ref39, 1),
55359
55452
  field = _ref40[0];
55360
55453
  return field;
55361
55454
  })), _toConsumableArray(lookupColumns));
55362
55455
  case 103:
55363
- if (!(_i12 < _arr3.length)) {
55456
+ if (!(_i13 < _arr3.length)) {
55364
55457
  _context12.next = 118;
55365
55458
  break;
55366
55459
  }
55367
- _column5 = _arr3[_i12];
55368
- editableFn = (_divaDefOf3 = divaDefOf(_divaDefs, _column5)) === null || _divaDefOf3 === void 0 ? void 0 : _divaDefOf3.editable;
55460
+ _column6 = _arr3[_i13];
55461
+ editableFn = (_divaDefOf4 = divaDefOf(_divaDefs, _column6)) === null || _divaDefOf4 === void 0 ? void 0 : _divaDefOf4.editable;
55369
55462
  if (!(typeof editableFn !== 'function')) {
55370
55463
  _context12.next = 108;
55371
55464
  break;
@@ -55377,7 +55470,7 @@ function createNavigationToolset(ctx) {
55377
55470
  locked = editableFn({
55378
55471
  data: _finished
55379
55472
  }) === false;
55380
- } catch (_unused4) {
55473
+ } catch (_unused7) {
55381
55474
  /* editable fn needs grid params we don't have — do not block */
55382
55475
  }
55383
55476
  if (locked) {
@@ -55387,14 +55480,14 @@ function createNavigationToolset(ctx) {
55387
55480
  return _context12.abrupt("continue", 115);
55388
55481
  case 112:
55389
55482
  failed.push({
55390
- rowId: "addRows[".concat(_i6, "]"),
55391
- column: _column5,
55392
- error: "Column '".concat(_column5, "' is not editable on this row (row-dependent rule) \u2014 the row's other values rule it out; check the table's description.")
55483
+ rowId: "addRows[".concat(_i7, "]"),
55484
+ column: _column6,
55485
+ error: "Column '".concat(_column6, "' is not editable on this row (row-dependent rule) \u2014 the row's other values rule it out; check the table's description.")
55393
55486
  });
55394
55487
  bad = true;
55395
55488
  return _context12.abrupt("break", 118);
55396
55489
  case 115:
55397
- _i12++;
55490
+ _i13++;
55398
55491
  _context12.next = 103;
55399
55492
  break;
55400
55493
  case 118:
@@ -55418,25 +55511,25 @@ function createNavigationToolset(ctx) {
55418
55511
  }
55419
55512
  }, _loop4, null, [[75, 94, 97, 100]]);
55420
55513
  });
55421
- _i6 = 0;
55422
- case 407:
55423
- if (!(_i6 < addRows.length)) {
55424
- _context18.next = 415;
55514
+ _i7 = 0;
55515
+ case 411:
55516
+ if (!(_i7 < addRows.length)) {
55517
+ _context18.next = 419;
55425
55518
  break;
55426
55519
  }
55427
- return _context18.delegateYield(_loop4(), "t10", 409);
55428
- case 409:
55520
+ return _context18.delegateYield(_loop4(), "t10", 413);
55521
+ case 413:
55429
55522
  _ret4 = _context18.t10;
55430
55523
  if (!(_ret4 === 0)) {
55431
- _context18.next = 412;
55524
+ _context18.next = 416;
55432
55525
  break;
55433
55526
  }
55434
- return _context18.abrupt("continue", 412);
55435
- case 412:
55436
- _i6++;
55437
- _context18.next = 407;
55527
+ return _context18.abrupt("continue", 416);
55528
+ case 416:
55529
+ _i7++;
55530
+ _context18.next = 411;
55438
55531
  break;
55439
- case 415:
55532
+ case 419:
55440
55533
  // Any add failed → return the table's FULL add schema so the next attempt has everything.
55441
55534
  addSchemaHint = function addSchemaHint() {
55442
55535
  if (!addRows.length) return '';
@@ -55453,7 +55546,7 @@ function createNavigationToolset(ctx) {
55453
55546
  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).");
55454
55547
  };
55455
55548
  if (!(!staged.length && !addedRows.length && !removed.length)) {
55456
- _context18.next = 419;
55549
+ _context18.next = 423;
55457
55550
  break;
55458
55551
  }
55459
55552
  restoreUserFilter();
@@ -55464,7 +55557,7 @@ function createNavigationToolset(ctx) {
55464
55557
  failed: failed.length ? summarizeFailures(failed) : undefined,
55465
55558
  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() : '')
55466
55559
  });
55467
- case 419:
55560
+ case 423:
55468
55561
  // The table would silently skip invalid staged rows on save — surface that as a failure instead of a fake success.
55469
55562
  validationErrors = []; // Rows the sequential lookup pass already sent carry the SERVER's verdict (a rejection leaves the same
55470
55563
  // error markers) — that is reported as a server error below, not as a validation failure of the rest.
@@ -55476,20 +55569,20 @@ function createNavigationToolset(ctx) {
55476
55569
  })), _toConsumableArray(addedRows.map(function (a) {
55477
55570
  return a.rowId;
55478
55571
  })))));
55479
- _context18.prev = 422;
55572
+ _context18.prev = 426;
55480
55573
  _iterator18.s();
55481
- case 424:
55574
+ case 428:
55482
55575
  if ((_step18 = _iterator18.n()).done) {
55483
- _context18.next = 432;
55576
+ _context18.next = 436;
55484
55577
  break;
55485
55578
  }
55486
55579
  _rowId3 = _step18.value;
55487
55580
  if (!alreadySent.has(_rowId3)) {
55488
- _context18.next = 428;
55581
+ _context18.next = 432;
55489
55582
  break;
55490
55583
  }
55491
- return _context18.abrupt("continue", 430);
55492
- case 428:
55584
+ return _context18.abrupt("continue", 434);
55585
+ case 432:
55493
55586
  rowErrors = (_api2$getRowNode12 = _api2.getRowNode(_rowId3)) === null || _api2$getRowNode12 === void 0 || (_api2$getRowNode12 = _api2$getRowNode12.data) === null || _api2$getRowNode12 === void 0 || (_api2$getRowNode12 = _api2$getRowNode12.__diva_context) === null || _api2$getRowNode12 === void 0 ? void 0 : _api2$getRowNode12.errors;
55494
55587
  if (Array.isArray(rowErrors) && rowErrors.length) {
55495
55588
  validationErrors.push({
@@ -55499,28 +55592,28 @@ function createNavigationToolset(ctx) {
55499
55592
  })
55500
55593
  });
55501
55594
  }
55502
- case 430:
55503
- _context18.next = 424;
55595
+ case 434:
55596
+ _context18.next = 428;
55504
55597
  break;
55505
- case 432:
55506
- _context18.next = 437;
55598
+ case 436:
55599
+ _context18.next = 441;
55507
55600
  break;
55508
- case 434:
55509
- _context18.prev = 434;
55510
- _context18.t11 = _context18["catch"](422);
55601
+ case 438:
55602
+ _context18.prev = 438;
55603
+ _context18.t11 = _context18["catch"](426);
55511
55604
  _iterator18.e(_context18.t11);
55512
- case 437:
55513
- _context18.prev = 437;
55605
+ case 441:
55606
+ _context18.prev = 441;
55514
55607
  _iterator18.f();
55515
- return _context18.finish(437);
55516
- case 440:
55608
+ return _context18.finish(441);
55609
+ case 444:
55517
55610
  if (!validationErrors.length) {
55518
- _context18.next = 445;
55611
+ _context18.next = 449;
55519
55612
  break;
55520
55613
  }
55521
- _context18.next = 443;
55614
+ _context18.next = 447;
55522
55615
  return handle.rollback();
55523
- case 443:
55616
+ case 447:
55524
55617
  restoreUserFilter();
55525
55618
  // Rows resolved by the sequential lookup pass above commit individually, BEFORE this check runs —
55526
55619
  // a validation failure in the rest of the batch cannot roll those back, so "everything was reverted"
@@ -55535,7 +55628,7 @@ function createNavigationToolset(ctx) {
55535
55628
  failed: failed.length ? summarizeFailures(failed) : undefined,
55536
55629
  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())
55537
55630
  }));
55538
- case 445:
55631
+ case 449:
55539
55632
  // Bring the first staged row into view; staged cells/rows are highlighted.
55540
55633
  focusNode = _api2.getRowNode((_ref25 = (_ref26 = (_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 && _ref26 !== void 0 ? _ref26 : (_addedRows$ = addedRows[0]) === null || _addedRows$ === void 0 ? void 0 : _addedRows$.rowId) !== null && _ref25 !== void 0 ? _ref25 : '');
55541
55634
  if ((focusNode === null || focusNode === void 0 ? void 0 : focusNode.rowIndex) != null) _api2.ensureIndexVisible(focusNode.rowIndex, 'middle');
@@ -55567,27 +55660,27 @@ function createNavigationToolset(ctx) {
55567
55660
  if (!ctx.autoApprove && !preApproved) awaitingApproval();
55568
55661
  _context18.t12 = ctx.autoApprove || preApproved;
55569
55662
  if (_context18.t12) {
55570
- _context18.next = 455;
55663
+ _context18.next = 459;
55571
55664
  break;
55572
55665
  }
55573
- _context18.next = 454;
55666
+ _context18.next = 458;
55574
55667
  return _entry2.requestAgentApproval(totalStaged, undefined, signal);
55575
- case 454:
55668
+ case 458:
55576
55669
  _context18.t12 = _context18.sent;
55577
- case 455:
55670
+ case 459:
55578
55671
  approved = _context18.t12;
55579
55672
  if (approved) {
55580
- _context18.next = 465;
55673
+ _context18.next = 469;
55581
55674
  break;
55582
55675
  }
55583
- _context18.next = 459;
55676
+ _context18.next = 463;
55584
55677
  return handle.rollback();
55585
- case 459:
55678
+ case 463:
55586
55679
  survived = survivingOperations();
55587
55680
  survivedCount = survived.changes.length + survived.addedRowIds.length + survived.removedRowIds.length;
55588
55681
  restoreUserFilter();
55589
55682
  if (survivedCount) {
55590
- _context18.next = 464;
55683
+ _context18.next = 468;
55591
55684
  break;
55592
55685
  }
55593
55686
  return _context18.abrupt("return", {
@@ -55596,7 +55689,7 @@ function createNavigationToolset(ctx) {
55596
55689
  failed: failed.length ? summarizeFailures(failed) : undefined,
55597
55690
  note: 'The user DISCARDED the staged changes — nothing was saved. Do NOT re-stage the same values; ask what to adjust instead.'
55598
55691
  });
55599
- case 464:
55692
+ case 468:
55600
55693
  return _context18.abrupt("return", {
55601
55694
  applied: true,
55602
55695
  appliedCount: survivedCount,
@@ -55613,7 +55706,7 @@ function createNavigationToolset(ctx) {
55613
55706
  failed: failed.length ? summarizeFailures(failed) : undefined,
55614
55707
  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.'
55615
55708
  });
55616
- case 465:
55709
+ case 469:
55617
55710
  // Trim the echoed row: drop `*DisplayTexts` mirrors, collapse localized objects to one language.
55618
55711
  trimEcho = function trimEcho(values) {
55619
55712
  var isLocalized = function isLocalized(v) {
@@ -55622,9 +55715,9 @@ function createNavigationToolset(ctx) {
55622
55715
  });
55623
55716
  };
55624
55717
  var out = {};
55625
- for (var _i7 = 0, _Object$entries3 = Object.entries(values); _i7 < _Object$entries3.length; _i7++) {
55718
+ for (var _i8 = 0, _Object$entries3 = Object.entries(values); _i8 < _Object$entries3.length; _i8++) {
55626
55719
  var _localized$DE;
55627
- var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i7], 2),
55720
+ var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i8], 2),
55628
55721
  key = _Object$entries3$_i[0],
55629
55722
  _value = _Object$entries3$_i[1];
55630
55723
  if (/DisplayTexts?$/.test(key)) continue;
@@ -55633,9 +55726,9 @@ function createNavigationToolset(ctx) {
55633
55726
  }
55634
55727
  return out;
55635
55728
  }; // The commit REPORTS what the server confirmed; grid state cannot (a vanished rejected row gets no marker).
55636
- _context18.next = 468;
55729
+ _context18.next = 472;
55637
55730
  return handle.commitStagedChanges();
55638
- case 468:
55731
+ case 472:
55639
55732
  finalOutcome = _context18.sent;
55640
55733
  // Rows resolved by the sequential lookup pass above were already committed individually — merge
55641
55734
  // their outcomes in. When that pass never ran (the common case), this is exactly `finalOutcome`.
@@ -55750,8 +55843,8 @@ function createNavigationToolset(ctx) {
55750
55843
  } finally {
55751
55844
  _iterator21.f();
55752
55845
  }
55753
- for (_i8 = 0, _addedRows = addedRows; _i8 < _addedRows.length; _i8++) {
55754
- a = _addedRows[_i8];
55846
+ for (_i9 = 0, _addedRows = addedRows; _i9 < _addedRows.length; _i9++) {
55847
+ a = _addedRows[_i9];
55755
55848
  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) {
55756
55849
  addError(a.rowId, ['Row was NOT saved — the commit skipped it (it stayed pending).']);
55757
55850
  }
@@ -55762,12 +55855,12 @@ function createNavigationToolset(ctx) {
55762
55855
  survivedAfterCommit = outcomeIsEmpty ? survivingOperations() : undefined;
55763
55856
  autoCommitted = !!survivedAfterCommit && survivedAfterCommit.changes.length + survivedAfterCommit.addedRowIds.length + survivedAfterCommit.removedRowIds.length > 0;
55764
55857
  if (!(outcomeIsEmpty && !autoCommitted && !serverErrors.length)) {
55765
- _context18.next = 492;
55858
+ _context18.next = 496;
55766
55859
  break;
55767
55860
  }
55768
- _context18.next = 490;
55861
+ _context18.next = 494;
55769
55862
  return handle.rollback();
55770
- case 490:
55863
+ case 494:
55771
55864
  restoreUserFilter();
55772
55865
  return _context18.abrupt("return", {
55773
55866
  applied: false,
@@ -55775,13 +55868,13 @@ function createNavigationToolset(ctx) {
55775
55868
  failed: failed.length ? summarizeFailures(failed) : undefined,
55776
55869
  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.'
55777
55870
  });
55778
- case 492:
55871
+ case 496:
55779
55872
  autoCommittedOps = autoCommitted ? survivedAfterCommit : undefined;
55780
55873
  committedIds = new Set(autoCommittedOps ? [].concat(_toConsumableArray(autoCommittedOps.changes.map(function (change) {
55781
55874
  return change.rowId;
55782
55875
  })), _toConsumableArray(autoCommittedOps.addedRowIds), _toConsumableArray(autoCommittedOps.removedRowIds)) : (_outcome$committed = outcome === null || outcome === void 0 ? void 0 : outcome.committed) !== null && _outcome$committed !== void 0 ? _outcome$committed : []);
55783
55876
  if (!serverErrors.length) {
55784
- _context18.next = 574;
55877
+ _context18.next = 578;
55785
55878
  break;
55786
55879
  }
55787
55880
  failedIds = new Set(serverErrors.map(function (s) {
@@ -55814,9 +55907,9 @@ function createNavigationToolset(ctx) {
55814
55907
  _id: removedRecordIds.get(rowId)
55815
55908
  };
55816
55909
  }); // Clear the rejected leftovers (they would block the next staging).
55817
- _context18.next = 501;
55910
+ _context18.next = 505;
55818
55911
  return handle.rollback();
55819
- case 501:
55912
+ case 505:
55820
55913
  restoreUserFilter();
55821
55914
  // Partial failure: neither the commit report nor the rollback is reliable — read the server back per operation.
55822
55915
  hasIdColumn = !!_api2.getColumnDef('_id'); // A COUNT budget bounded nothing: one probe can spend three 8s row-waits, so 25 of them ran for ten
@@ -55903,9 +55996,9 @@ function createNavigationToolset(ctx) {
55903
55996
  verifiedChanges = [];
55904
55997
  verifiedAdds = [];
55905
55998
  verifiedRemovals = [];
55906
- _context18.prev = 512;
55999
+ _context18.prev = 516;
55907
56000
  _iterator22 = _createForOfIteratorHelper$r(editTargets);
55908
- _context18.prev = 514;
56001
+ _context18.prev = 518;
55909
56002
  _loop5 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop5() {
55910
56003
  var _expectedValueOf, _target$from;
55911
56004
  var target, probe, serverValue, serverState;
@@ -55950,47 +56043,47 @@ function createNavigationToolset(ctx) {
55950
56043
  }, _loop5);
55951
56044
  });
55952
56045
  _iterator22.s();
55953
- case 517:
56046
+ case 521:
55954
56047
  if ((_step22 = _iterator22.n()).done) {
55955
- _context18.next = 523;
56048
+ _context18.next = 527;
55956
56049
  break;
55957
56050
  }
55958
- return _context18.delegateYield(_loop5(), "t13", 519);
55959
- case 519:
56051
+ return _context18.delegateYield(_loop5(), "t13", 523);
56052
+ case 523:
55960
56053
  if (!_context18.t13) {
55961
- _context18.next = 521;
56054
+ _context18.next = 525;
55962
56055
  break;
55963
56056
  }
55964
- return _context18.abrupt("continue", 521);
55965
- case 521:
55966
- _context18.next = 517;
56057
+ return _context18.abrupt("continue", 525);
56058
+ case 525:
56059
+ _context18.next = 521;
55967
56060
  break;
55968
- case 523:
55969
- _context18.next = 528;
56061
+ case 527:
56062
+ _context18.next = 532;
55970
56063
  break;
55971
- case 525:
55972
- _context18.prev = 525;
55973
- _context18.t14 = _context18["catch"](514);
56064
+ case 529:
56065
+ _context18.prev = 529;
56066
+ _context18.t14 = _context18["catch"](518);
55974
56067
  _iterator22.e(_context18.t14);
55975
- case 528:
55976
- _context18.prev = 528;
56068
+ case 532:
56069
+ _context18.prev = 532;
55977
56070
  _iterator22.f();
55978
- return _context18.finish(528);
55979
- case 531:
56071
+ return _context18.finish(532);
56072
+ case 535:
55980
56073
  _iterator23 = _createForOfIteratorHelper$r(addTargets);
55981
- _context18.prev = 532;
56074
+ _context18.prev = 536;
55982
56075
  _iterator23.s();
55983
- case 534:
56076
+ case 538:
55984
56077
  if ((_step23 = _iterator23.n()).done) {
55985
- _context18.next = 542;
56078
+ _context18.next = 546;
55986
56079
  break;
55987
56080
  }
55988
56081
  target = _step23.value;
55989
- _context18.next = 538;
56082
+ _context18.next = 542;
55990
56083
  return probeServerRow(target._id, function () {
55991
56084
  return true;
55992
56085
  });
55993
- case 538:
56086
+ case 542:
55994
56087
  probe = _context18.sent;
55995
56088
  verifiedAdds.push(_objectSpread$X(_objectSpread$X({
55996
56089
  rowId: target.rowId,
@@ -56000,60 +56093,60 @@ function createNavigationToolset(ctx) {
56000
56093
  } : {}), {}, {
56001
56094
  serverState: probe.state === 'found' ? 'applied' : probe.state === 'missing' ? 'reverted' : 'unknown'
56002
56095
  }));
56003
- case 540:
56004
- _context18.next = 534;
56096
+ case 544:
56097
+ _context18.next = 538;
56005
56098
  break;
56006
- case 542:
56007
- _context18.next = 547;
56099
+ case 546:
56100
+ _context18.next = 551;
56008
56101
  break;
56009
- case 544:
56010
- _context18.prev = 544;
56011
- _context18.t15 = _context18["catch"](532);
56102
+ case 548:
56103
+ _context18.prev = 548;
56104
+ _context18.t15 = _context18["catch"](536);
56012
56105
  _iterator23.e(_context18.t15);
56013
- case 547:
56014
- _context18.prev = 547;
56106
+ case 551:
56107
+ _context18.prev = 551;
56015
56108
  _iterator23.f();
56016
- return _context18.finish(547);
56017
- case 550:
56109
+ return _context18.finish(551);
56110
+ case 554:
56018
56111
  _iterator24 = _createForOfIteratorHelper$r(removalTargets);
56019
- _context18.prev = 551;
56112
+ _context18.prev = 555;
56020
56113
  _iterator24.s();
56021
- case 553:
56114
+ case 557:
56022
56115
  if ((_step24 = _iterator24.n()).done) {
56023
- _context18.next = 561;
56116
+ _context18.next = 565;
56024
56117
  break;
56025
56118
  }
56026
56119
  _target = _step24.value;
56027
- _context18.next = 557;
56120
+ _context18.next = 561;
56028
56121
  return probeServerRow(_target._id, function () {
56029
56122
  return true;
56030
56123
  });
56031
- case 557:
56124
+ case 561:
56032
56125
  _probe = _context18.sent;
56033
56126
  verifiedRemovals.push({
56034
56127
  rowId: _target.rowId,
56035
56128
  serverState: _probe.state === 'missing' ? 'applied' : _probe.state === 'found' ? 'reverted' : 'unknown'
56036
56129
  });
56037
- case 559:
56038
- _context18.next = 553;
56130
+ case 563:
56131
+ _context18.next = 557;
56039
56132
  break;
56040
- case 561:
56041
- _context18.next = 566;
56133
+ case 565:
56134
+ _context18.next = 570;
56042
56135
  break;
56043
- case 563:
56044
- _context18.prev = 563;
56045
- _context18.t16 = _context18["catch"](551);
56136
+ case 567:
56137
+ _context18.prev = 567;
56138
+ _context18.t16 = _context18["catch"](555);
56046
56139
  _iterator24.e(_context18.t16);
56047
- case 566:
56048
- _context18.prev = 566;
56140
+ case 570:
56141
+ _context18.prev = 570;
56049
56142
  _iterator24.f();
56050
- return _context18.finish(566);
56051
- case 569:
56052
- _context18.prev = 569;
56143
+ return _context18.finish(570);
56144
+ case 573:
56145
+ _context18.prev = 573;
56053
56146
  // The table belongs to the user again before we answer, whatever the probes did.
56054
56147
  restoreVerifyFilter();
56055
- return _context18.finish(569);
56056
- case 572:
56148
+ return _context18.finish(573);
56149
+ case 576:
56057
56150
  appliedCount = [].concat(verifiedChanges, verifiedAdds, verifiedRemovals).filter(function (v) {
56058
56151
  return v.serverState === 'applied';
56059
56152
  }).length;
@@ -56078,7 +56171,7 @@ function createNavigationToolset(ctx) {
56078
56171
  failed: failed.length ? summarizeFailures(failed) : undefined,
56079
56172
  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
56080
56173
  }));
56081
- case 574:
56174
+ case 578:
56082
56175
  // Return the real _id so references are not built from grid rowIds; catalogs/packages list rows are new EDITORS.
56083
56176
  livePath = (_root$navigationState3 = root.navigationState.path) !== null && _root$navigationState3 !== void 0 ? _root$navigationState3 : '';
56084
56177
  editorPathFor = function editorPathFor(id) {
@@ -56203,7 +56296,7 @@ function createNavigationToolset(ctx) {
56203
56296
  // The serie by NUMBER AND NAME, not by 24-hex id — the thing to check is whether this is serie 0.
56204
56297
  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(' ')) : '')
56205
56298
  }));
56206
- case 588:
56299
+ case 592:
56207
56300
  // Thrown (not returned) so the refusal does NOT end the turn — the model tells the user to decide on the staged edits first.
56208
56301
  dirtyGrids = root.gridRegistry.entries.filter(function (entry) {
56209
56302
  var _entry$getHandle4;
@@ -56212,11 +56305,11 @@ function createNavigationToolset(ctx) {
56212
56305
  return entry.label;
56213
56306
  });
56214
56307
  if (!dirtyGrids.length) {
56215
- _context18.next = 591;
56308
+ _context18.next = 595;
56216
56309
  break;
56217
56310
  }
56218
56311
  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."));
56219
- case 591:
56312
+ case 595:
56220
56313
  // Deferred so the tool result reaches the chat and the turn is persisted (the stored endedByTool record is what
56221
56314
  // triggers the automatic 'Continue.' after the reload) before the document unloads.
56222
56315
  setTimeout(function () {
@@ -56228,29 +56321,29 @@ function createNavigationToolset(ctx) {
56228
56321
  pageReload: true,
56229
56322
  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."
56230
56323
  });
56231
- case 593:
56324
+ case 597:
56232
56325
  _livePath = (_root$navigationState4 = root.navigationState.path) !== null && _root$navigationState4 !== void 0 ? _root$navigationState4 : '';
56233
56326
  packageBase = (_livePath$match = _livePath.match(/catalogs\/idmeditor\/packages\/([^/]+)/)) === null || _livePath$match === void 0 ? void 0 : _livePath$match[1];
56234
56327
  catalogBase = (_livePath$match2 = _livePath.match(/catalogs\/idmeditor\/catalogs\/([^/]+)/)) === null || _livePath$match2 === void 0 ? void 0 : _livePath$match2[1];
56235
56328
  baseId = (_ref43 = (_ref44 = packageBase !== null && packageBase !== void 0 ? packageBase : catalogBase) !== null && _ref44 !== void 0 ? _ref44 : ctx.packageId) !== null && _ref43 !== void 0 ? _ref43 : ctx.catalogId;
56236
56329
  if (baseId) {
56237
- _context18.next = 599;
56330
+ _context18.next = 603;
56238
56331
  break;
56239
56332
  }
56240
56333
  return _context18.abrupt("return", {
56241
56334
  error: 'No catalog/package context — nothing to reload.'
56242
56335
  });
56243
- case 599:
56336
+ case 603:
56244
56337
  // Package views load the ENRICHER pack, catalog views the raw IDM catalog.
56245
56338
  isPack = baseId === packageBase || !packageBase && !catalogBase && baseId === ctx.packageId;
56246
56339
  _root$webplannerInsta = root.webplannerInstanceStore.invalidateByBase(baseId), destroyed = _root$webplannerInsta.destroyed, reloadTriggered = _root$webplannerInsta.reloadTriggered, knownKeys = _root$webplannerInsta.knownKeys;
56247
56340
  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.
56248
56341
  if (!(!destroyed && !reloadTriggered)) {
56249
- _context18.next = 606;
56342
+ _context18.next = 610;
56250
56343
  break;
56251
56344
  }
56252
56345
  if (knownKeys.length) {
56253
- _context18.next = 605;
56346
+ _context18.next = 609;
56254
56347
  break;
56255
56348
  }
56256
56349
  return _context18.abrupt("return", {
@@ -56260,7 +56353,7 @@ function createNavigationToolset(ctx) {
56260
56353
  environmentUnchanged: true,
56261
56354
  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, ".")
56262
56355
  });
56263
- case 605:
56356
+ case 609:
56264
56357
  return _context18.abrupt("return", {
56265
56358
  ok: false,
56266
56359
  destroyed: destroyed,
@@ -56269,32 +56362,32 @@ function createNavigationToolset(ctx) {
56269
56362
  knownKeys: knownKeys,
56270
56363
  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."
56271
56364
  });
56272
- case 606:
56365
+ case 610:
56273
56366
  return _context18.abrupt("return", {
56274
56367
  ok: true,
56275
56368
  destroyed: destroyed,
56276
56369
  reloadTriggered: reloadTriggered,
56277
56370
  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."
56278
56371
  });
56279
- case 607:
56372
+ case 611:
56280
56373
  _resolveGrid4 = resolveGrid(args.grid), _entry3 = _resolveGrid4.entry, _error3 = _resolveGrid4.error;
56281
56374
  if (!(_error3 || !_entry3)) {
56282
- _context18.next = 610;
56375
+ _context18.next = 614;
56283
56376
  break;
56284
56377
  }
56285
56378
  return _context18.abrupt("return", {
56286
56379
  error: _error3
56287
56380
  });
56288
- case 610:
56381
+ case 614:
56289
56382
  _handle = _entry3.getHandle();
56290
56383
  if (_handle) {
56291
- _context18.next = 613;
56384
+ _context18.next = 617;
56292
56385
  break;
56293
56386
  }
56294
56387
  return _context18.abrupt("return", {
56295
56388
  error: "Table '".concat(_entry3.label, "' is not ready.")
56296
56389
  });
56297
- case 613:
56390
+ case 617:
56298
56391
  actionName = String((_action = input === null || input === void 0 ? void 0 : input.action) !== null && _action !== void 0 ? _action : '');
56299
56392
  actionInput = String((_input = input === null || input === void 0 ? void 0 : input.input) !== null && _input !== void 0 ? _input : '').trim();
56300
56393
  _addTargets = _handle.getDivaColumnDefs().filter(isHeaderAddColumn);
@@ -56306,13 +56399,13 @@ function createNavigationToolset(ctx) {
56306
56399
  return action.name;
56307
56400
  })));
56308
56401
  if (available.includes(actionName)) {
56309
- _context18.next = 621;
56402
+ _context18.next = 625;
56310
56403
  break;
56311
56404
  }
56312
56405
  return _context18.abrupt("return", {
56313
56406
  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).")
56314
56407
  });
56315
- case 621:
56408
+ case 625:
56316
56409
  approve = /*#__PURE__*/function () {
56317
56410
  var _ref45 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(label) {
56318
56411
  return _regeneratorRuntime.wrap(function _callee8$(_context13) {
@@ -56420,336 +56513,336 @@ function createNavigationToolset(ctx) {
56420
56513
  return action.name === actionName;
56421
56514
  });
56422
56515
  if (!viewAction) {
56423
- _context18.next = 649;
56516
+ _context18.next = 653;
56424
56517
  break;
56425
56518
  }
56426
56519
  mutating = viewAction.mutating !== false;
56427
56520
  _context18.t17 = mutating;
56428
56521
  if (!_context18.t17) {
56429
- _context18.next = 635;
56522
+ _context18.next = 639;
56430
56523
  break;
56431
56524
  }
56432
- _context18.next = 634;
56525
+ _context18.next = 638;
56433
56526
  return approve("".concat(actionName, ": ").concat(actionInput || '(no input)'));
56434
- case 634:
56527
+ case 638:
56435
56528
  _context18.t17 = !_context18.sent;
56436
- case 635:
56529
+ case 639:
56437
56530
  if (!_context18.t17) {
56438
- _context18.next = 637;
56531
+ _context18.next = 641;
56439
56532
  break;
56440
56533
  }
56441
56534
  return _context18.abrupt("return", declined);
56442
- case 637:
56443
- _context18.prev = 637;
56535
+ case 641:
56536
+ _context18.prev = 641;
56444
56537
  _context18.t18 = "";
56445
- _context18.next = 641;
56538
+ _context18.next = 645;
56446
56539
  return viewAction.run(actionInput);
56447
- case 641:
56540
+ case 645:
56448
56541
  _context18.t19 = _context18.sent;
56449
56542
  _context18.t20 = _context18.t18.concat.call(_context18.t18, _context18.t19).concat(mutating ? autoNote : '');
56450
56543
  return _context18.abrupt("return", {
56451
56544
  applied: true,
56452
56545
  note: _context18.t20
56453
56546
  });
56454
- case 646:
56455
- _context18.prev = 646;
56456
- _context18.t21 = _context18["catch"](637);
56547
+ case 650:
56548
+ _context18.prev = 650;
56549
+ _context18.t21 = _context18["catch"](641);
56457
56550
  return _context18.abrupt("return", {
56458
56551
  error: _context18.t21 instanceof Error ? _context18.t21.message : String(_context18.t21)
56459
56552
  });
56460
- case 649:
56553
+ case 653:
56461
56554
  if (!(actionName === 'cloneCatalog')) {
56462
- _context18.next = 668;
56555
+ _context18.next = 672;
56463
56556
  break;
56464
56557
  }
56465
56558
  if (isRecordId(actionInput)) {
56466
- _context18.next = 652;
56559
+ _context18.next = 656;
56467
56560
  break;
56468
56561
  }
56469
56562
  return _context18.abrupt("return", {
56470
56563
  error: "input must be the catalog's _id (24-hex) — read it from the _id column (readGridRows)."
56471
56564
  });
56472
- case 652:
56473
- _context18.next = 654;
56565
+ case 656:
56566
+ _context18.next = 658;
56474
56567
  return approve("cloneCatalog: ".concat(actionInput));
56475
- case 654:
56568
+ case 658:
56476
56569
  if (_context18.sent) {
56477
- _context18.next = 656;
56570
+ _context18.next = 660;
56478
56571
  break;
56479
56572
  }
56480
56573
  return _context18.abrupt("return", declined);
56481
- case 656:
56482
- _context18.prev = 656;
56483
- _context18.next = 659;
56574
+ case 660:
56575
+ _context18.prev = 660;
56576
+ _context18.next = 663;
56484
56577
  return authorizedFetch("".concat(root.configurationStore.apiConfig.idmService, "/catalogs/").concat(actionInput, "/clone"), 'POST', '{}');
56485
- case 659:
56486
- _context18.next = 664;
56578
+ case 663:
56579
+ _context18.next = 668;
56487
56580
  break;
56488
- case 661:
56489
- _context18.prev = 661;
56490
- _context18.t22 = _context18["catch"](656);
56581
+ case 665:
56582
+ _context18.prev = 665;
56583
+ _context18.t22 = _context18["catch"](660);
56491
56584
  return _context18.abrupt("return", {
56492
56585
  error: _context18.t22 instanceof Error ? _context18.t22.message : String(_context18.t22)
56493
56586
  });
56494
- case 664:
56495
- _context18.next = 666;
56587
+ case 668:
56588
+ _context18.next = 670;
56496
56589
  return refreshAndSettle();
56497
- case 666:
56590
+ case 670:
56498
56591
  cloneSettled = _context18.sent;
56499
56592
  return _context18.abrupt("return", {
56500
56593
  applied: true,
56501
56594
  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)
56502
56595
  });
56503
- case 668:
56596
+ case 672:
56504
56597
  if (!(actionName === 'importGlobalFeatures')) {
56505
- _context18.next = 688;
56598
+ _context18.next = 692;
56506
56599
  break;
56507
56600
  }
56508
56601
  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 : '');
56509
56602
  if (catalogId) {
56510
- _context18.next = 672;
56603
+ _context18.next = 676;
56511
56604
  break;
56512
56605
  }
56513
56606
  return _context18.abrupt("return", {
56514
56607
  error: 'No catalog context on this table.'
56515
56608
  });
56516
- case 672:
56517
- _context18.next = 674;
56609
+ case 676:
56610
+ _context18.next = 678;
56518
56611
  return approve('importGlobalFeatures');
56519
- case 674:
56612
+ case 678:
56520
56613
  if (_context18.sent) {
56521
- _context18.next = 676;
56614
+ _context18.next = 680;
56522
56615
  break;
56523
56616
  }
56524
56617
  return _context18.abrupt("return", declined);
56525
- case 676:
56526
- _context18.prev = 676;
56527
- _context18.next = 679;
56618
+ case 680:
56619
+ _context18.prev = 680;
56620
+ _context18.next = 683;
56528
56621
  return authorizedFetch("".concat(root.configurationStore.apiConfig.idmService, "/catalogs/").concat(catalogId, "/features/global"), 'POST');
56529
- case 679:
56530
- _context18.next = 684;
56622
+ case 683:
56623
+ _context18.next = 688;
56531
56624
  break;
56532
- case 681:
56533
- _context18.prev = 681;
56534
- _context18.t23 = _context18["catch"](676);
56625
+ case 685:
56626
+ _context18.prev = 685;
56627
+ _context18.t23 = _context18["catch"](680);
56535
56628
  return _context18.abrupt("return", {
56536
56629
  error: _context18.t23 instanceof Error ? _context18.t23.message : String(_context18.t23)
56537
56630
  });
56538
- case 684:
56539
- _context18.next = 686;
56631
+ case 688:
56632
+ _context18.next = 690;
56540
56633
  return refreshAndSettle();
56541
- case 686:
56634
+ case 690:
56542
56635
  importSettled = _context18.sent;
56543
56636
  return _context18.abrupt("return", {
56544
56637
  applied: true,
56545
56638
  note: "Global features imported \u2014 the table refreshes with the added feature rows.".concat(autoNote).concat(importSettled ? '' : unsettledNote)
56546
56639
  });
56547
- case 688:
56640
+ case 692:
56548
56641
  if (!(actionName === 'setPriceFactor' || actionName === 'setPriceFactorPriority')) {
56549
- _context18.next = 749;
56642
+ _context18.next = 753;
56550
56643
  break;
56551
56644
  }
56552
56645
  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 : {};
56553
56646
  serieNo = Number(app.serieNo);
56554
- _context18.prev = 691;
56555
- params = JSON.parse(actionInput || '{}');
56556
- _context18.next = 698;
56557
- break;
56558
- case 695:
56559
56647
  _context18.prev = 695;
56560
- _context18.t24 = _context18["catch"](691);
56648
+ _params2 = JSON.parse(actionInput || '{}');
56649
+ _context18.next = 702;
56650
+ break;
56651
+ case 699:
56652
+ _context18.prev = 699;
56653
+ _context18.t24 = _context18["catch"](695);
56561
56654
  return _context18.abrupt("return", {
56562
56655
  error: "input must be a JSON object — listGrids shows this action's exact shape."
56563
56656
  });
56564
- case 698:
56565
- scope = String((_params$scope = params.scope) !== null && _params$scope !== void 0 ? _params$scope : '');
56657
+ case 702:
56658
+ scope = String((_params2$scope = _params2.scope) !== null && _params2$scope !== void 0 ? _params2$scope : '');
56566
56659
  if (scope in PRICE_FACTOR_FIELDS) {
56567
- _context18.next = 701;
56660
+ _context18.next = 705;
56568
56661
  break;
56569
56662
  }
56570
56663
  return _context18.abrupt("return", {
56571
56664
  error: "scope must be one of: ".concat(Object.keys(PRICE_FACTOR_FIELDS).join(', '), ".")
56572
56665
  });
56573
- case 701:
56574
- 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.
56666
+ case 705:
56667
+ key = _params2.key === undefined ? undefined : String(_params2.key); // The factor maps live on the PRICELIST record — the write goes through the parent pricelists grid row.
56575
56668
  parent = resolveGrid('pricelists');
56576
56669
  if (!(parent.error || !parent.entry || !parent.api)) {
56577
- _context18.next = 705;
56670
+ _context18.next = 709;
56578
56671
  break;
56579
56672
  }
56580
56673
  return _context18.abrupt("return", {
56581
56674
  error: "The parent 'pricelists' table must be on screen for factor actions."
56582
56675
  });
56583
- case 705:
56676
+ case 709:
56584
56677
  parentHandle = parent.entry.getHandle();
56585
56678
  if (parentHandle) {
56586
- _context18.next = 708;
56679
+ _context18.next = 712;
56587
56680
  break;
56588
56681
  }
56589
56682
  return _context18.abrupt("return", {
56590
56683
  error: "Table 'pricelists' is not ready."
56591
56684
  });
56592
- case 708:
56685
+ case 712:
56593
56686
  parent.api.forEachNode(function (node) {
56594
56687
  var _node$data4;
56595
56688
  if (((_node$data4 = node.data) === null || _node$data4 === void 0 ? void 0 : _node$data4._id) === app.pricelistId) pricelistNode = node;
56596
56689
  });
56597
56690
  if ((_pricelistNode = pricelistNode) !== null && _pricelistNode !== void 0 && _pricelistNode.id) {
56598
- _context18.next = 711;
56691
+ _context18.next = 715;
56599
56692
  break;
56600
56693
  }
56601
56694
  return _context18.abrupt("return", {
56602
56695
  error: "Pricelist ".concat(app.pricelistId, " is not loaded in the 'pricelists' table.")
56603
56696
  });
56604
- case 711:
56605
- _context18.prev = 711;
56697
+ case 715:
56698
+ _context18.prev = 715;
56606
56699
  if (!(actionName === 'setPriceFactor')) {
56607
- _context18.next = 720;
56700
+ _context18.next = 724;
56608
56701
  break;
56609
56702
  }
56610
- factors = params.factors;
56703
+ factors = _params2.factors;
56611
56704
  if (!(!Array.isArray(factors) || factors.some(function (f) {
56612
56705
  return typeof f !== 'number' || !Number.isFinite(f) || f <= 0;
56613
56706
  }))) {
56614
- _context18.next = 716;
56707
+ _context18.next = 720;
56615
56708
  break;
56616
56709
  }
56617
56710
  return _context18.abrupt("return", {
56618
56711
  error: 'factors must be an array of positive numbers (>1 = factor, <1 = discount fraction, e.g. 0.95 = 5% off); [] clears the entry.'
56619
56712
  });
56620
- case 716:
56713
+ case 720:
56621
56714
  patch = applyPriceFactor(pricelistNode.data, serieNo, scope, key, factors);
56622
56715
  label = "setPriceFactor ".concat(scope).concat(key ? " ".concat(key) : '', " \u2192 [").concat(factors.join('; '), "] (Serie ").concat(serieNo, ")");
56623
- _context18.next = 726;
56716
+ _context18.next = 730;
56624
56717
  break;
56625
- case 720:
56626
- if (!(typeof params.priority !== 'boolean')) {
56627
- _context18.next = 722;
56718
+ case 724:
56719
+ if (!(typeof _params2.priority !== 'boolean')) {
56720
+ _context18.next = 726;
56628
56721
  break;
56629
56722
  }
56630
56723
  return _context18.abrupt("return", {
56631
56724
  error: 'priority must be true or false.'
56632
56725
  });
56633
- case 722:
56726
+ case 726:
56634
56727
  if (key) {
56635
- _context18.next = 724;
56728
+ _context18.next = 728;
56636
56729
  break;
56637
56730
  }
56638
56731
  return _context18.abrupt("return", {
56639
56732
  error: 'key is required (the pfg id / price group).'
56640
56733
  });
56641
- case 724:
56642
- patch = applyPriceFactorPriority(pricelistNode.data, serieNo, scope, key, params.priority);
56643
- label = "setPriceFactorPriority ".concat(scope, " ").concat(key, " \u2192 ").concat(params.priority, " (Serie ").concat(serieNo, ")");
56644
- case 726:
56645
- _context18.next = 731;
56646
- break;
56647
56734
  case 728:
56648
- _context18.prev = 728;
56649
- _context18.t25 = _context18["catch"](711);
56735
+ patch = applyPriceFactorPriority(pricelistNode.data, serieNo, scope, key, _params2.priority);
56736
+ label = "setPriceFactorPriority ".concat(scope, " ").concat(key, " \u2192 ").concat(_params2.priority, " (Serie ").concat(serieNo, ")");
56737
+ case 730:
56738
+ _context18.next = 735;
56739
+ break;
56740
+ case 732:
56741
+ _context18.prev = 732;
56742
+ _context18.t25 = _context18["catch"](715);
56650
56743
  return _context18.abrupt("return", {
56651
56744
  error: _context18.t25 instanceof Error ? _context18.t25.message : String(_context18.t25)
56652
56745
  });
56653
- case 731:
56654
- _context18.next = 733;
56746
+ case 735:
56747
+ _context18.next = 737;
56655
56748
  return approve(label);
56656
- case 733:
56749
+ case 737:
56657
56750
  if (_context18.sent) {
56658
- _context18.next = 735;
56751
+ _context18.next = 739;
56659
56752
  break;
56660
56753
  }
56661
56754
  return _context18.abrupt("return", declined);
56662
- case 735:
56755
+ case 739:
56663
56756
  pricelistRowId = pricelistNode.id;
56664
- _context18.next = 738;
56757
+ _context18.next = 742;
56665
56758
  return parentHandle.setNodeDataValue(pricelistRowId, patch, {
56666
56759
  suppressAutoCommit: true
56667
56760
  });
56668
- case 738:
56761
+ case 742:
56669
56762
  if (_context18.sent) {
56670
- _context18.next = 740;
56763
+ _context18.next = 744;
56671
56764
  break;
56672
56765
  }
56673
56766
  return _context18.abrupt("return", {
56674
56767
  error: 'The pricelist row rejected the update.'
56675
56768
  });
56676
- case 740:
56677
- _context18.next = 742;
56769
+ case 744:
56770
+ _context18.next = 746;
56678
56771
  return parentHandle.commitStagedChanges();
56679
- case 742:
56772
+ case 746:
56680
56773
  factorOutcome = _context18.sent;
56681
56774
  rejected = factorOutcome === null || factorOutcome === void 0 ? void 0 : factorOutcome.failed.find(function (failure) {
56682
56775
  return failure.rowId === pricelistRowId;
56683
56776
  });
56684
56777
  if (!rejected) {
56685
- _context18.next = 746;
56778
+ _context18.next = 750;
56686
56779
  break;
56687
56780
  }
56688
56781
  return _context18.abrupt("return", {
56689
56782
  error: "The server rejected the factor update: ".concat(rejected.errors.join(' ') || 'no reason given', ". Nothing was changed.")
56690
56783
  });
56691
- case 746:
56784
+ case 750:
56692
56785
  if (!(factorOutcome && !factorOutcome.committed.includes(pricelistRowId))) {
56693
- _context18.next = 748;
56786
+ _context18.next = 752;
56694
56787
  break;
56695
56788
  }
56696
56789
  return _context18.abrupt("return", {
56697
56790
  error: 'The factor update was NOT saved — the commit did not confirm the pricelist row. Re-read the pricelist (readGridRows) before retrying.'
56698
56791
  });
56699
- case 748:
56792
+ case 752:
56700
56793
  return _context18.abrupt("return", {
56701
56794
  applied: true,
56702
56795
  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)
56703
56796
  });
56704
- case 749:
56797
+ case 753:
56705
56798
  if (!(actionName === 'deleteAllManualPrices')) {
56706
- _context18.next = 767;
56799
+ _context18.next = 771;
56707
56800
  break;
56708
56801
  }
56709
56802
  _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 : {};
56710
- _context18.next = 753;
56803
+ _context18.next = 757;
56711
56804
  return approve("deleteAllManualPrices (Pricelist ".concat(_app.pricelistId, ", Serie ").concat(_app.serieNo, ")"));
56712
- case 753:
56805
+ case 757:
56713
56806
  if (_context18.sent) {
56714
- _context18.next = 755;
56807
+ _context18.next = 759;
56715
56808
  break;
56716
56809
  }
56717
56810
  return _context18.abrupt("return", declined);
56718
- case 755:
56719
- _context18.prev = 755;
56720
- _context18.next = 758;
56811
+ case 759:
56812
+ _context18.prev = 759;
56813
+ _context18.next = 762;
56721
56814
  return authorizedFetch("".concat(root.configurationStore.apiConfig.enricherService, "/packages/").concat(_app.packageId, "/pricelists/").concat(_app.pricelistId, "/serie/").concat(_app.serieNo, "/prices/manual"), 'DELETE');
56722
- case 758:
56723
- _context18.next = 763;
56815
+ case 762:
56816
+ _context18.next = 767;
56724
56817
  break;
56725
- case 760:
56726
- _context18.prev = 760;
56727
- _context18.t26 = _context18["catch"](755);
56818
+ case 764:
56819
+ _context18.prev = 764;
56820
+ _context18.t26 = _context18["catch"](759);
56728
56821
  return _context18.abrupt("return", {
56729
56822
  error: _context18.t26 instanceof Error ? _context18.t26.message : String(_context18.t26)
56730
56823
  });
56731
- case 763:
56732
- _context18.next = 765;
56824
+ case 767:
56825
+ _context18.next = 769;
56733
56826
  return refreshAndSettle();
56734
- case 765:
56827
+ case 769:
56735
56828
  pricesSettled = _context18.sent;
56736
56829
  return _context18.abrupt("return", {
56737
56830
  applied: true,
56738
56831
  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)
56739
56832
  });
56740
- case 767:
56833
+ case 771:
56741
56834
  if (!(actionName === 'removeColumn')) {
56742
- _context18.next = 806;
56835
+ _context18.next = 810;
56743
56836
  break;
56744
56837
  }
56745
56838
  if (actionInput) {
56746
- _context18.next = 770;
56839
+ _context18.next = 774;
56747
56840
  break;
56748
56841
  }
56749
56842
  return _context18.abrupt("return", {
56750
56843
  error: "Provide input: the column to remove — its field id ('optionsSetRefs.2305') or the bare key ('2305'); listGrids shows the columns."
56751
56844
  });
56752
- case 770:
56845
+ case 774:
56753
56846
  removeTargetIn = function removeTargetIn(defs) {
56754
56847
  return defs.find(function (def) {
56755
56848
  return def.field === actionInput || def.colId === actionInput || String(def.field).endsWith(".".concat(actionInput));
@@ -56757,7 +56850,7 @@ function createNavigationToolset(ctx) {
56757
56850
  };
56758
56851
  _target4 = removeTargetIn(removeTargets);
56759
56852
  if (_target4) {
56760
- _context18.next = 774;
56853
+ _context18.next = 778;
56761
56854
  break;
56762
56855
  }
56763
56856
  return _context18.abrupt("return", {
@@ -56765,75 +56858,75 @@ function createNavigationToolset(ctx) {
56765
56858
  return "'".concat(def.field, "'");
56766
56859
  }).join(', ') || 'none', ".")
56767
56860
  });
56768
- case 774:
56861
+ case 778:
56769
56862
  _header = typeof _target4.headerName === 'string' ? root.t(_target4.headerName) : String(_target4.field);
56770
- _context18.next = 777;
56863
+ _context18.next = 781;
56771
56864
  return approve("removeColumn: ".concat(_header));
56772
- case 777:
56865
+ case 781:
56773
56866
  if (_context18.sent) {
56774
- _context18.next = 779;
56867
+ _context18.next = 783;
56775
56868
  break;
56776
56869
  }
56777
56870
  return _context18.abrupt("return", declined);
56778
- case 779:
56871
+ case 783:
56779
56872
  // The defs are rebuilt on every render, each onRemove closing over the feature list of ITS render — the
56780
56873
  // pre-wait closure would drop a feature the user added while the bar was open. Re-resolve after the wait.
56781
56874
  live = removeTargetIn(_handle.getDivaColumnDefs().filter(isRemovableColumn));
56782
56875
  if (live) {
56783
- _context18.next = 782;
56876
+ _context18.next = 786;
56784
56877
  break;
56785
56878
  }
56786
56879
  return _context18.abrupt("return", {
56787
56880
  applied: false,
56788
56881
  note: "'".concat(_target4.field, "' left the table while the approval was pending \u2014 nothing was removed. listGrids shows the current columns.")
56789
56882
  });
56790
- case 782:
56791
- _context18.prev = 782;
56792
- _context18.next = 785;
56883
+ case 786:
56884
+ _context18.prev = 786;
56885
+ _context18.next = 789;
56793
56886
  return live.headerComponentParams.onRemove();
56794
- case 785:
56887
+ case 789:
56795
56888
  saved = _context18.sent;
56796
- _context18.next = 791;
56889
+ _context18.next = 795;
56797
56890
  break;
56798
- case 788:
56799
- _context18.prev = 788;
56800
- _context18.t27 = _context18["catch"](782);
56891
+ case 792:
56892
+ _context18.prev = 792;
56893
+ _context18.t27 = _context18["catch"](786);
56801
56894
  return _context18.abrupt("return", {
56802
56895
  error: _context18.t27 instanceof Error ? _context18.t27.message : String(_context18.t27)
56803
56896
  });
56804
- case 791:
56897
+ case 795:
56805
56898
  if (!(saved === false)) {
56806
- _context18.next = 793;
56899
+ _context18.next = 797;
56807
56900
  break;
56808
56901
  }
56809
56902
  return _context18.abrupt("return", {
56810
56903
  applied: false,
56811
56904
  note: "The parent row did not take the new feature list \u2014 '".concat(_target4.field, "' was NOT removed. locateRow the parent row again so the view reloads, then retry.")
56812
56905
  });
56813
- case 793:
56906
+ case 797:
56814
56907
  // Poll until the column left the view — the parent entity's write and the rebuild are asynchronous.
56815
56908
  gone = false;
56816
56909
  attempt = 0;
56817
- case 795:
56910
+ case 799:
56818
56911
  if (!(attempt < 20 && !gone)) {
56819
- _context18.next = 802;
56912
+ _context18.next = 806;
56820
56913
  break;
56821
56914
  }
56822
- _context18.next = 798;
56915
+ _context18.next = 802;
56823
56916
  return sleep(100);
56824
- case 798:
56917
+ case 802:
56825
56918
  gone = !_handle.getDivaColumnDefs().some(function (def) {
56826
56919
  return def.field === _target4.field;
56827
56920
  });
56828
- case 799:
56921
+ case 803:
56829
56922
  attempt++;
56830
- _context18.next = 795;
56923
+ _context18.next = 799;
56831
56924
  break;
56832
- case 802:
56925
+ case 806:
56833
56926
  // The view declares what becomes of the rows' cells of a removed feature column.
56834
56927
  rowsNote = _target4.headerComponentParams.removeKeepsCells ? ' The rows KEEP their cells for that feature (hidden now, still exported) — re-add the column to see or clear them.' : " The server also strips that feature's cells from every row of this table.";
56835
56928
  if (gone) {
56836
- _context18.next = 805;
56929
+ _context18.next = 809;
56837
56930
  break;
56838
56931
  }
56839
56932
  return _context18.abrupt("return", {
@@ -56845,7 +56938,7 @@ function createNavigationToolset(ctx) {
56845
56938
  viewNotRebuilt: true,
56846
56939
  note: "The parent row took the new feature list, but '".concat(_target4.field, "' is still in the view after the wait \u2014 the rebuild is pending. Re-read the columns (listGrids) before touching this table again; do NOT retry the removal.") + rowsNote + autoNote
56847
56940
  });
56848
- case 805:
56941
+ case 809:
56849
56942
  return _context18.abrupt("return", {
56850
56943
  applied: true,
56851
56944
  removed: {
@@ -56854,24 +56947,24 @@ function createNavigationToolset(ctx) {
56854
56947
  },
56855
56948
  note: 'Column removed.' + rowsNote + autoNote
56856
56949
  });
56857
- case 806:
56950
+ case 810:
56858
56951
  // addColumn: one approval, sequential adds — parallel adds race the view rebuild.
56859
56952
  _target5 = _addTargets[0];
56860
56953
  if (actionInput) {
56861
- _context18.next = 809;
56954
+ _context18.next = 813;
56862
56955
  break;
56863
56956
  }
56864
56957
  return _context18.abrupt("return", {
56865
56958
  error: "Provide input: the key(s) to add, comma-separated \u2014 readColumnOptions('".concat(_target5.field, "') lists the addable entries.")
56866
56959
  });
56867
- case 809:
56960
+ case 813:
56868
56961
  keys = actionInput.split(',').map(function (k) {
56869
56962
  return k.trim();
56870
56963
  }).filter(Boolean); // Resolve ALL keys BEFORE asking approval: the bar shows the real labels, invalid keys fail fast.
56871
56964
  resolved = [];
56872
- _context18.prev = 811;
56965
+ _context18.prev = 815;
56873
56966
  _iterator27 = _createForOfIteratorHelper$r(keys);
56874
- _context18.prev = 813;
56967
+ _context18.prev = 817;
56875
56968
  _loop8 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop8() {
56876
56969
  var key, options, option;
56877
56970
  return _regeneratorRuntime.wrap(function _loop8$(_context16) {
@@ -56906,63 +56999,63 @@ function createNavigationToolset(ctx) {
56906
56999
  }, _loop8);
56907
57000
  });
56908
57001
  _iterator27.s();
56909
- case 816:
57002
+ case 820:
56910
57003
  if ((_step27 = _iterator27.n()).done) {
56911
- _context18.next = 823;
57004
+ _context18.next = 827;
56912
57005
  break;
56913
57006
  }
56914
- return _context18.delegateYield(_loop8(), "t28", 818);
56915
- case 818:
57007
+ return _context18.delegateYield(_loop8(), "t28", 822);
57008
+ case 822:
56916
57009
  _ret6 = _context18.t28;
56917
57010
  if (!_ret6) {
56918
- _context18.next = 821;
57011
+ _context18.next = 825;
56919
57012
  break;
56920
57013
  }
56921
57014
  return _context18.abrupt("return", _ret6.v);
56922
- case 821:
56923
- _context18.next = 816;
57015
+ case 825:
57016
+ _context18.next = 820;
56924
57017
  break;
56925
- case 823:
56926
- _context18.next = 828;
57018
+ case 827:
57019
+ _context18.next = 832;
56927
57020
  break;
56928
- case 825:
56929
- _context18.prev = 825;
56930
- _context18.t29 = _context18["catch"](813);
57021
+ case 829:
57022
+ _context18.prev = 829;
57023
+ _context18.t29 = _context18["catch"](817);
56931
57024
  _iterator27.e(_context18.t29);
56932
- case 828:
56933
- _context18.prev = 828;
57025
+ case 832:
57026
+ _context18.prev = 832;
56934
57027
  _iterator27.f();
56935
- return _context18.finish(828);
56936
- case 831:
56937
- _context18.next = 836;
57028
+ return _context18.finish(832);
57029
+ case 835:
57030
+ _context18.next = 840;
56938
57031
  break;
56939
- case 833:
56940
- _context18.prev = 833;
56941
- _context18.t30 = _context18["catch"](811);
57032
+ case 837:
57033
+ _context18.prev = 837;
57034
+ _context18.t30 = _context18["catch"](815);
56942
57035
  return _context18.abrupt("return", {
56943
57036
  error: _context18.t30 instanceof Error ? _context18.t30.message : String(_context18.t30)
56944
57037
  });
56945
- case 836:
56946
- _context18.next = 838;
57038
+ case 840:
57039
+ _context18.next = 842;
56947
57040
  return approve("addColumn: ".concat(resolved.map(function (r) {
56948
57041
  return r.label;
56949
57042
  }).join(', ')));
56950
- case 838:
57043
+ case 842:
56951
57044
  if (_context18.sent) {
56952
- _context18.next = 840;
57045
+ _context18.next = 844;
56953
57046
  break;
56954
57047
  }
56955
57048
  return _context18.abrupt("return", declined);
56956
- case 840:
57049
+ case 844:
56957
57050
  added = [];
56958
57051
  newColumns = [];
56959
- _context18.prev = 842;
57052
+ _context18.prev = 846;
56960
57053
  _loop9 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop9() {
56961
57054
  var key, beforeFields, _attempt, newColumn;
56962
57055
  return _regeneratorRuntime.wrap(function _loop9$(_context17) {
56963
57056
  while (1) switch (_context17.prev = _context17.next) {
56964
57057
  case 0:
56965
- key = _resolved[_i14].key;
57058
+ key = _resolved[_i15].key;
56966
57059
  beforeFields = new Set(_handle.getDivaColumnDefs().map(function (d) {
56967
57060
  return d.field;
56968
57061
  }).filter(Boolean));
@@ -57002,18 +57095,18 @@ function createNavigationToolset(ctx) {
57002
57095
  }
57003
57096
  }, _loop9);
57004
57097
  });
57005
- _i14 = 0, _resolved = resolved;
57006
- case 845:
57007
- if (!(_i14 < _resolved.length)) {
57008
- _context18.next = 850;
57098
+ _i15 = 0, _resolved = resolved;
57099
+ case 849:
57100
+ if (!(_i15 < _resolved.length)) {
57101
+ _context18.next = 854;
57009
57102
  break;
57010
57103
  }
57011
- return _context18.delegateYield(_loop9(), "t31", 847);
57012
- case 847:
57013
- _i14++;
57014
- _context18.next = 845;
57104
+ return _context18.delegateYield(_loop9(), "t31", 851);
57105
+ case 851:
57106
+ _i15++;
57107
+ _context18.next = 849;
57015
57108
  break;
57016
- case 850:
57109
+ case 854:
57017
57110
  // On a decision's option-combinations subtable the add also writes the decision's featureRefs.
57018
57111
  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." : '';
57019
57112
  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.") : '';
@@ -57029,32 +57122,32 @@ function createNavigationToolset(ctx) {
57029
57122
  return "'".concat(c, "'");
57030
57123
  }).join(', '), ".") : 'Column(s) added — the table re-renders; listGrids shows the new columns and their field ids.') + partialNote + decisionSubtableNote + autoNote
57031
57124
  }));
57032
- case 855:
57033
- _context18.prev = 855;
57034
- _context18.t32 = _context18["catch"](842);
57125
+ case 859:
57126
+ _context18.prev = 859;
57127
+ _context18.t32 = _context18["catch"](846);
57035
57128
  return _context18.abrupt("return", {
57036
57129
  error: "".concat(_context18.t32 instanceof Error ? _context18.t32.message : String(_context18.t32)).concat(newColumns.length ? " \u2014 ".concat(newColumns.length, " column(s) were already added before the failure: ").concat(newColumns.join(', ')) : '')
57037
57130
  });
57038
- case 858:
57131
+ case 862:
57039
57132
  _resolveGrid5 = resolveGrid(args.grid), _entry4 = _resolveGrid5.entry, _api3 = _resolveGrid5.api, _error4 = _resolveGrid5.error;
57040
57133
  if (!(_error4 || !_api3 || !_entry4)) {
57041
- _context18.next = 861;
57134
+ _context18.next = 865;
57042
57135
  break;
57043
57136
  }
57044
57137
  return _context18.abrupt("return", {
57045
57138
  error: _error4
57046
57139
  });
57047
- case 861:
57140
+ case 865:
57048
57141
  _handle2 = _entry4.getHandle();
57049
57142
  if (_handle2) {
57050
- _context18.next = 864;
57143
+ _context18.next = 868;
57051
57144
  break;
57052
57145
  }
57053
57146
  return _context18.abrupt("return", {
57054
57147
  error: "Table '".concat(_entry4.label, "' is not ready.")
57055
57148
  });
57056
- case 864:
57057
- _column6 = String((_column7 = input === null || input === void 0 ? void 0 : input.column) !== null && _column7 !== void 0 ? _column7 : '');
57149
+ case 868:
57150
+ _column7 = String((_column8 = input === null || input === void 0 ? void 0 : input.column) !== null && _column8 !== void 0 ? _column8 : '');
57058
57151
  search = String((_search = input === null || input === void 0 ? void 0 : input.search) !== null && _search !== void 0 ? _search : '');
57059
57152
  _limit = Math.min(Number(input === null || input === void 0 ? void 0 : input.limit) > 0 ? Number(input.limit) : 50, 200); // `exact` is one contract for every source below: action values and enum values as well as lookups.
57060
57153
  wantsExact = (input === null || input === void 0 ? void 0 : input.exact) === true;
@@ -57065,57 +57158,57 @@ function createNavigationToolset(ctx) {
57065
57158
  }; // A table ACTION can carry its own value list — the picker its dialog shows, answered here so the agent
57066
57159
  // never has to drive a modal to find out what the action accepts.
57067
57160
  optionAction = ((_entry4$getActions = (_entry4$getActions2 = _entry4.getActions) === null || _entry4$getActions2 === void 0 ? void 0 : _entry4$getActions2.call(_entry4)) !== null && _entry4$getActions !== void 0 ? _entry4$getActions : []).find(function (action) {
57068
- return action.name === _column6;
57161
+ return action.name === _column7;
57069
57162
  });
57070
57163
  if (!optionAction) {
57071
- _context18.next = 886;
57164
+ _context18.next = 890;
57072
57165
  break;
57073
57166
  }
57074
57167
  if (optionAction.options) {
57075
- _context18.next = 874;
57168
+ _context18.next = 878;
57076
57169
  break;
57077
57170
  }
57078
57171
  return _context18.abrupt("return", {
57079
- column: _column6,
57172
+ column: _column7,
57080
57173
  options: [],
57081
57174
  hasMore: false,
57082
- note: "'".concat(_column6, "' is a table ACTION with no value list \u2014 its input is described in listGrids: ").concat(optionAction.description)
57175
+ note: "'".concat(_column7, "' is a table ACTION with no value list \u2014 its input is described in listGrids: ").concat(optionAction.description)
57083
57176
  });
57084
- case 874:
57085
- _context18.prev = 874;
57086
- _context18.next = 877;
57177
+ case 878:
57178
+ _context18.prev = 878;
57179
+ _context18.next = 881;
57087
57180
  return optionAction.options(search, _limit);
57088
- case 877:
57181
+ case 881:
57089
57182
  _yield$optionAction$o = _context18.sent;
57090
57183
  options = _yield$optionAction$o.options;
57091
57184
  note = _yield$optionAction$o.note;
57092
57185
  return _context18.abrupt("return", _objectSpread$X(_objectSpread$X({
57093
- column: _column6,
57186
+ column: _column7,
57094
57187
  options: wantsExact ? options.filter(equals) : options,
57095
57188
  hasMore: options.length >= _limit
57096
57189
  }, wantsExact ? {
57097
57190
  exact: true
57098
57191
  } : {}), {}, {
57099
- note: "Values for runTableAction('".concat(_column6, "', <input>) \u2014 pass the VALUE(s), not the label.").concat(note ? " ".concat(note) : '').concat(wantsExact ? ' exact:true — only options whose value or label equals the search.' : '')
57192
+ note: "Values for runTableAction('".concat(_column7, "', <input>) \u2014 pass the VALUE(s), not the label.").concat(note ? " ".concat(note) : '').concat(wantsExact ? ' exact:true — only options whose value or label equals the search.' : '')
57100
57193
  }));
57101
- case 883:
57102
- _context18.prev = 883;
57103
- _context18.t33 = _context18["catch"](874);
57194
+ case 887:
57195
+ _context18.prev = 887;
57196
+ _context18.t33 = _context18["catch"](878);
57104
57197
  return _context18.abrupt("return", {
57105
57198
  error: _context18.t33 instanceof Error ? _context18.t33.message : String(_context18.t33)
57106
57199
  });
57107
- case 886:
57200
+ case 890:
57108
57201
  // Enum columns are answered here too: 'which values does this column take' is ONE question.
57109
57202
  enumDef = _handle2.getDivaColumnDefs().find(function (d) {
57110
- return d.field === _column6;
57203
+ return d.field === _column7;
57111
57204
  });
57112
57205
  enumData = enumDef === null || enumDef === void 0 || (_enumDef$customParams = enumDef.customParams) === null || _enumDef$customParams === void 0 ? void 0 : _enumDef$customParams.enumData;
57113
57206
  if (!(Array.isArray(enumData) && enumData.length)) {
57114
- _context18.next = 890;
57207
+ _context18.next = 894;
57115
57208
  break;
57116
57209
  }
57117
57210
  return _context18.abrupt("return", _objectSpread$X(_objectSpread$X({
57118
- column: _column6,
57211
+ column: _column7,
57119
57212
  options: enumData.map(function (e) {
57120
57213
  var _e$name;
57121
57214
  return {
@@ -57131,52 +57224,54 @@ function createNavigationToolset(ctx) {
57131
57224
  } : {}), {}, {
57132
57225
  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' : '', ".").concat(wantsExact ? ' exact:true — only options whose value or label equals the search.' : '')
57133
57226
  }));
57134
- case 890:
57227
+ case 894:
57135
57228
  if (enumDef) {
57136
- _context18.next = 896;
57229
+ _context18.next = 901;
57137
57230
  break;
57138
57231
  }
57139
- computedDef = divaDefOf(_handle2.getDivaColumnDefs(), _column6);
57232
+ computedDef = divaDefOf(_handle2.getDivaColumnDefs(), _column7);
57140
57233
  if (!isComputedColumn(computedDef)) {
57141
- _context18.next = 894;
57234
+ _context18.next = 899;
57142
57235
  break;
57143
57236
  }
57237
+ // Same source as listGrids, so the two cannot disagree about whether a new row may carry this column.
57238
+ savedRowsOnly = columnAgentMeta(computedDef).editableOnlyOnSavedRows === true;
57144
57239
  return _context18.abrupt("return", {
57145
- column: _column6,
57240
+ column: _column7,
57146
57241
  options: [],
57147
57242
  hasMore: false,
57148
- note: "'".concat(_column6, "' is a computed matrix cell \u2014 it has no option list; stage its value directly with stageTableEdits.")
57243
+ note: savedRowsOnly ? "'".concat(_column7, "' is a computed matrix cell \u2014 it has no option list, and addRows cannot set it. Create the row, then set it with stageTableEdits 'edits'.") : "'".concat(_column7, "' is a computed matrix cell \u2014 it has no option list; stage its value directly with stageTableEdits.")
57149
57244
  });
57150
- case 894:
57245
+ case 899:
57151
57246
  fields = _handle2.getDivaColumnDefs().map(function (d) {
57152
57247
  return d.field;
57153
57248
  }).filter(Boolean);
57154
57249
  return _context18.abrupt("return", {
57155
- error: "Column '".concat(_column6, "' not found. Fields of '").concat(_entry4.label, "': ").concat(fields.join(', '), ".")
57250
+ error: "Column '".concat(_column7, "' not found. Fields of '").concat(_entry4.label, "': ").concat(fields.join(', '), ".")
57156
57251
  });
57157
- case 896:
57252
+ case 901:
57158
57253
  if (!(enumDef.cellDataType === 'asset')) {
57159
- _context18.next = 898;
57254
+ _context18.next = 903;
57160
57255
  break;
57161
57256
  }
57162
57257
  return _context18.abrupt("return", {
57163
- column: _column6,
57258
+ column: _column7,
57164
57259
  options: [],
57165
57260
  hasMore: false,
57166
- note: "'".concat(_column6, "' is an ASSET cell \u2014 no option list; write it via uploadAsset + setAssetCell.")
57261
+ note: "'".concat(_column7, "' is an ASSET cell \u2014 no option list; write it via uploadAsset + setAssetCell.")
57167
57262
  });
57168
- case 898:
57263
+ case 903:
57169
57264
  if (!(enumDef.cellDataType !== 'lookup' && !isHeaderAddColumn(enumDef))) {
57170
- _context18.next = 900;
57265
+ _context18.next = 905;
57171
57266
  break;
57172
57267
  }
57173
57268
  return _context18.abrupt("return", {
57174
- column: _column6,
57269
+ column: _column7,
57175
57270
  options: [],
57176
57271
  hasMore: false,
57177
- note: "'".concat(_column6, "' 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.")
57272
+ note: "'".concat(_column7, "' 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.")
57178
57273
  });
57179
- case 900:
57274
+ case 905:
57180
57275
  // Row-dependent url/filter templates resolve against a loaded row.
57181
57276
  firstRow = _api3.getDisplayedRowAtIndex(0);
57182
57277
  rowData = isRealRow(firstRow) ? (_data = firstRow.data) !== null && _data !== void 0 ? _data : {} : {}; // The server's contains-filter reads the search as a pattern: a bracket or a pipe in it returns nothing at all
@@ -57189,10 +57284,10 @@ function createNavigationToolset(ctx) {
57189
57284
  })[0]) !== null && _plainWords$sort$ !== void 0 ? _plainWords$sort$ : '' : search;
57190
57285
  matchLocally = remoteSearch !== search || wantsExact; // The local match only sees ONE capped fetch — a plain word with more hits than that can still hide the value.
57191
57286
  fetchLimit = matchLocally ? Math.max(_limit, 200) : _limit;
57192
- _context18.prev = 907;
57193
- _context18.next = 910;
57194
- return _handle2.fetchLookupOptions(_column6, remoteSearch, rowData, 0, fetchLimit);
57195
- case 910:
57287
+ _context18.prev = 912;
57288
+ _context18.next = 915;
57289
+ return _handle2.fetchLookupOptions(_column7, remoteSearch, rowData, 0, fetchLimit);
57290
+ case 915:
57196
57291
  fetched = _context18.sent;
57197
57292
  text = function text(o) {
57198
57293
  var _o$label2;
@@ -57203,7 +57298,7 @@ function createNavigationToolset(ctx) {
57203
57298
  }) : fetched).slice(0, _limit);
57204
57299
  fetchCapped = matchLocally && fetched.length >= fetchLimit;
57205
57300
  return _context18.abrupt("return", _objectSpread$X(_objectSpread$X({
57206
- column: _column6,
57301
+ column: _column7,
57207
57302
  // Entries without a display name render as ' (value)' — fall back to the value.
57208
57303
  options: _options.map(function (o) {
57209
57304
  var _o$label3;
@@ -57220,13 +57315,13 @@ function createNavigationToolset(ctx) {
57220
57315
  } : {}), {}, {
57221
57316
  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).') + (remoteSearch !== search ? " The search contains characters the server filter reads as a pattern \u2014 the server was asked for '".concat(remoteSearch, "' and the full text '").concat(search, "' was matched here.") : '') + (wantsExact ? ' exact:true — only options whose value or label equals the search.' : '') + (fetchCapped ? " The ".concat(wantsExact ? 'exact' : 'full-text', " check ran on the first ").concat(fetchLimit, " rows").concat(remoteSearch ? " matching '".concat(remoteSearch, "'") : '', " only \u2014 narrow the search if the value is not among them.") : '')
57222
57317
  }));
57223
- case 917:
57224
- _context18.prev = 917;
57225
- _context18.t34 = _context18["catch"](907);
57318
+ case 922:
57319
+ _context18.prev = 922;
57320
+ _context18.t34 = _context18["catch"](912);
57226
57321
  // On an empty table a row-dependent lookup request goes out broken — teach the recovery instead of the opaque error.
57227
57322
  defs = _handle2.getDivaColumnDefs();
57228
57323
  url = String((_defs$find$customPara = (_defs$find = defs.find(function (d) {
57229
- return d.field === _column6;
57324
+ return d.field === _column7;
57230
57325
  })) === null || _defs$find === void 0 || (_defs$find = _defs$find.customParams) === null || _defs$find === void 0 || (_defs$find = _defs$find.apiInterface) === null || _defs$find === void 0 ? void 0 : _defs$find.read) !== null && _defs$find$customPara !== void 0 ? _defs$find$customPara : '');
57231
57326
  _rowFields = new Set(defs.flatMap(function (d) {
57232
57327
  var _d$additionalFields3;
@@ -57242,92 +57337,92 @@ function createNavigationToolset(ctx) {
57242
57337
  return _context18.abrupt("return", {
57243
57338
  error: (_context18.t34 instanceof Error ? _context18.t34.message : String(_context18.t34)) + hint
57244
57339
  });
57245
- case 926:
57340
+ case 931:
57246
57341
  _resolveGrid6 = resolveGrid(args.grid), _api4 = _resolveGrid6.api, _error5 = _resolveGrid6.error;
57247
57342
  if (!(_error5 || !_api4)) {
57248
- _context18.next = 929;
57343
+ _context18.next = 934;
57249
57344
  break;
57250
57345
  }
57251
57346
  return _context18.abrupt("return", {
57252
57347
  error: _error5
57253
57348
  });
57254
- case 929:
57349
+ case 934:
57255
57350
  _api4.setFilterModel(null);
57256
57351
  return _context18.abrupt("return", {
57257
57352
  ok: true
57258
57353
  });
57259
- case 931:
57354
+ case 936:
57260
57355
  _resolveGrid7 = resolveGrid(args.grid), _entry5 = _resolveGrid7.entry, _error6 = _resolveGrid7.error;
57261
57356
  if (!(_error6 || !_entry5)) {
57262
- _context18.next = 934;
57357
+ _context18.next = 939;
57263
57358
  break;
57264
57359
  }
57265
57360
  return _context18.abrupt("return", {
57266
57361
  error: _error6
57267
57362
  });
57268
- case 934:
57363
+ case 939:
57269
57364
  _handle3 = _entry5.getHandle();
57270
57365
  if (_handle3) {
57271
- _context18.next = 937;
57366
+ _context18.next = 942;
57272
57367
  break;
57273
57368
  }
57274
57369
  return _context18.abrupt("return", {
57275
57370
  error: "Table '".concat(_entry5.label, "' is not ready.")
57276
57371
  });
57277
- case 937:
57372
+ case 942:
57278
57373
  if (_handle3.hasPendingChanges()) {
57279
- _context18.next = 939;
57374
+ _context18.next = 944;
57280
57375
  break;
57281
57376
  }
57282
57377
  return _context18.abrupt("return", {
57283
57378
  discarded: false,
57284
57379
  note: "Nothing is staged on '".concat(_entry5.label, "' \u2014 no staging blocks writes to it.")
57285
57380
  });
57286
- case 939:
57381
+ case 944:
57287
57382
  if (ctx.autoApprove) {
57288
- _context18.next = 946;
57383
+ _context18.next = 951;
57289
57384
  break;
57290
57385
  }
57291
57386
  awaitingApproval();
57292
57387
  // The bar's own buttons read Apply/Discard — the label says what Apply does, or Discard reads as the action.
57293
57388
  _label = "discardStagedChanges: every staged change on '".concat(_entry5.label, "' is dropped, the table returns to its last committed state");
57294
- _context18.next = 944;
57389
+ _context18.next = 949;
57295
57390
  return _entry5.requestAgentApproval(1, _label, signal);
57296
- case 944:
57391
+ case 949:
57297
57392
  if (_context18.sent) {
57298
- _context18.next = 946;
57393
+ _context18.next = 951;
57299
57394
  break;
57300
57395
  }
57301
57396
  return _context18.abrupt("return", {
57302
57397
  discarded: false,
57303
57398
  note: 'The user KEPT the staged changes — nothing was discarded. Ask what to do with them instead.'
57304
57399
  });
57305
- case 946:
57400
+ case 951:
57306
57401
  if (_handle3.hasPendingChanges()) {
57307
- _context18.next = 948;
57402
+ _context18.next = 953;
57308
57403
  break;
57309
57404
  }
57310
57405
  return _context18.abrupt("return", {
57311
57406
  discarded: false,
57312
57407
  note: "The table SAVED the staged changes on '".concat(_entry5.label, "' before the decision arrived (it saves pending edits by itself when the user clicks outside the grid) \u2014 nothing was discarded, those changes are live on the server. Read the rows back (readGridRows) and ask the user whether to undo them.")
57313
57408
  });
57314
- case 948:
57315
- _context18.next = 950;
57409
+ case 953:
57410
+ _context18.next = 955;
57316
57411
  return _handle3.rollback();
57317
- case 950:
57412
+ case 955:
57318
57413
  // Same transparency rule as runTableAction: a discard executed without the bar must be reported as such.
57319
57414
  _autoNote = ctx.autoApprove ? ' AUTO-APPROVE is on — executed WITHOUT the approval bar, so the user could not keep their own pending edits; mention that ONCE per reply, not per call.' : '';
57320
57415
  return _context18.abrupt("return", {
57321
57416
  discarded: true,
57322
57417
  note: "The staged changes on '".concat(_entry5.label, "' were discarded \u2014 the table is back at its last committed state, nothing was sent to the server, and writes to it are possible again.").concat(_autoNote)
57323
57418
  });
57324
- case 952:
57419
+ case 957:
57325
57420
  throw new Error("Unknown navigation tool: ".concat(name));
57326
- case 953:
57421
+ case 958:
57327
57422
  case "end":
57328
57423
  return _context18.stop();
57329
57424
  }
57330
- }, _callee11, null, [[45, 79, 82, 85], [53, 59], [93, 99], [315, 327, 330, 333], [339, 357, 360, 363], [364, 388, 391, 394], [422, 434, 437, 440], [512,, 569, 572], [514, 525, 528, 531], [532, 544, 547, 550], [551, 563, 566, 569], [637, 646], [656, 661], [676, 681], [691, 695], [711, 728], [755, 760], [782, 788], [811, 833], [813, 825, 828, 831], [842, 855], [874, 883], [907, 917]]);
57425
+ }, _callee11, null, [[45, 79, 82, 85], [53, 59], [93, 99], [319, 331, 334, 337], [343, 361, 364, 367], [368, 392, 395, 398], [426, 438, 441, 444], [516,, 573, 576], [518, 529, 532, 535], [536, 548, 551, 554], [555, 567, 570, 573], [641, 650], [660, 665], [680, 685], [695, 699], [715, 732], [759, 764], [786, 792], [815, 837], [817, 829, 832, 835], [846, 859], [878, 887], [912, 922]]);
57331
57426
  }));
57332
57427
  function dispatch(_x8, _x9, _x10, _x11) {
57333
57428
  return _dispatch.apply(this, arguments);
@@ -57514,7 +57609,7 @@ function showEntityFromLink(_x42, _x43) {
57514
57609
  function _showEntityFromLink() {
57515
57610
  _showEntityFromLink = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee18(root, href) {
57516
57611
  var _params$get, _params$get2, _params$get3, _params$get4, _params$get5, _params$get6, _params$get7, _params$get8;
57517
- var params, targetPath, grid, column, value, targetMissing, api, _yield$locateRowCore$, parentNode, toolId, toolDeadline, opened, _i15, _arr4, bar, tool, subGrid, subColumn, subValue, subApi;
57612
+ var params, targetPath, grid, column, value, targetMissing, api, _yield$locateRowCore$, parentNode, toolId, toolDeadline, opened, _i16, _arr4, bar, tool, subGrid, subColumn, subValue, subApi;
57518
57613
  return _regeneratorRuntime.wrap(function _callee18$(_context25) {
57519
57614
  while (1) switch (_context25.prev = _context25.next) {
57520
57615
  case 0:
@@ -57590,13 +57685,13 @@ function _showEntityFromLink() {
57590
57685
  _context25.next = 47;
57591
57686
  break;
57592
57687
  }
57593
- _i15 = 0, _arr4 = [root.contentStore.rightToolBar, root.contentStore.bottomToolBar];
57688
+ _i16 = 0, _arr4 = [root.contentStore.rightToolBar, root.contentStore.bottomToolBar];
57594
57689
  case 31:
57595
- if (!(_i15 < _arr4.length)) {
57690
+ if (!(_i16 < _arr4.length)) {
57596
57691
  _context25.next = 42;
57597
57692
  break;
57598
57693
  }
57599
- bar = _arr4[_i15];
57694
+ bar = _arr4[_i16];
57600
57695
  tool = bar.tools.find(function (candidate) {
57601
57696
  return candidate.id.toLowerCase() === toolId.toLowerCase();
57602
57697
  });
@@ -57609,7 +57704,7 @@ function _showEntityFromLink() {
57609
57704
  opened = true;
57610
57705
  return _context25.abrupt("break", 42);
57611
57706
  case 39:
57612
- _i15++;
57707
+ _i16++;
57613
57708
  _context25.next = 31;
57614
57709
  break;
57615
57710
  case 42: