acttrader-charts 1.3.0-beta.8 → 1.3.0-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -25952,6 +25952,25 @@ var _ChartEngine = class _ChartEngine {
25952
25952
  if (this.draftOrderLabel) this.setLevelQty(this.draftOrderLabel, qty);
25953
25953
  return this;
25954
25954
  }
25955
+ /**
25956
+ * Update the quantity (lots) shown on an EXISTING level's pill — the
25957
+ * host-panel counterpart of the chart's own qty-pill editing, mirroring
25958
+ * `updateLevelBracket` / `updateLevelMainPrice` for the quantity field.
25959
+ *
25960
+ * Exists because a modify panel that edits lots had no way to reflect the
25961
+ * change on the chart: `setLevelQty` was private and only reachable for
25962
+ * drafts, so the pill kept the server's old size until the broker echoed
25963
+ * the modify (reported: panel showed 0.13 while the chart pill stayed
25964
+ * 0.07). Goes through the same staging as chart-side qty edits, so the
25965
+ * value survives `setLevels` refreshes and is included in `tradeLevelEdit`
25966
+ * / reverted by `cancelCurrentEdit` exactly like a pill edit.
25967
+ */
25968
+ updateLevelQty(label, qty) {
25969
+ if (!label || label === this.draftOrderLabel) return this;
25970
+ if (!Number.isFinite(qty) || qty <= 0) return this;
25971
+ this.setLevelQty(label, qty);
25972
+ return this;
25973
+ }
25955
25974
  setLevelQty(label, qty) {
25956
25975
  const idx = this.levels.findIndex((l) => l.label === label);
25957
25976
  if (idx === -1) return;
@@ -27650,7 +27669,19 @@ var _ChartEngine = class _ChartEngine {
27650
27669
  this._cancelEditAndDeselect(label);
27651
27670
  return;
27652
27671
  }
27653
- const toRevert = label ? this.pendingLevelDrags.has(label) ? [[label, this.pendingLevelDrags.get(label) ?? []]] : [] : [...this.pendingLevelDrags.entries()];
27672
+ const toRevert = label ? this.pendingLevelDrags.has(label) || this.pendingQtyChanges.has(label) ? (
27673
+ /* A qty-only edit stages into pendingQtyChanges with NO drag
27674
+ entry (the panel's updateLevelQty path, and a flyout edit
27675
+ without touching prices). Building the revert list from
27676
+ drags alone skipped the loop entirely, so cancel left the
27677
+ staged qty on the pill forever — and the setLevels refresh
27678
+ preservation then kept re-applying it. */
27679
+ [[label, this.pendingLevelDrags.get(label) ?? []]]
27680
+ ) : [] : [
27681
+ ...this.pendingLevelDrags.entries(),
27682
+ // qty-only labels missing from the drags map (see above)
27683
+ ...[...this.pendingQtyChanges.keys()].filter((k) => !this.pendingLevelDrags.has(k)).map((k) => [k, []])
27684
+ ];
27654
27685
  for (const [lbl] of toRevert) {
27655
27686
  this.undoIsNewBracketMutations(lbl);
27656
27687
  this.pendingLevelDrags.delete(lbl);