@seniorsistemas/angular-components 17.29.2 → 17.29.3

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.
@@ -4070,6 +4070,12 @@ var CoreFacade = /** @class */ (function () {
4070
4070
  this.setCode(safeCode);
4071
4071
  }
4072
4072
  };
4073
+ CoreFacade.prototype.setPayload = function (payload) {
4074
+ var safeCode = this.getSafeCode(payload);
4075
+ // Força a atualização sem verificar _lastCodeEmitted,
4076
+ // mas preserva o cursor verificando no nível do editor
4077
+ this.setCodeWithCursorPreservation(safeCode);
4078
+ };
4073
4079
  CoreFacade.prototype.getOnCoreFinishLoadObservable = function () {
4074
4080
  return this.$onCoreFinishLoad.asObservable();
4075
4081
  };
@@ -4163,6 +4169,13 @@ var CodeEditorComponent = /** @class */ (function () {
4163
4169
  enumerable: true,
4164
4170
  configurable: true
4165
4171
  });
4172
+ Object.defineProperty(CodeEditorComponent.prototype, "payload", {
4173
+ set: function (payload) {
4174
+ this.coreFacade.setPayload(payload);
4175
+ },
4176
+ enumerable: true,
4177
+ configurable: true
4178
+ });
4166
4179
  CodeEditorComponent.prototype.writeValue = function (value) {
4167
4180
  this.code = value;
4168
4181
  };
@@ -4219,6 +4232,9 @@ var CodeEditorComponent = /** @class */ (function () {
4219
4232
  __decorate([
4220
4233
  Input()
4221
4234
  ], CodeEditorComponent.prototype, "code", null);
4235
+ __decorate([
4236
+ Input()
4237
+ ], CodeEditorComponent.prototype, "payload", null);
4222
4238
  __decorate([
4223
4239
  Output()
4224
4240
  ], CodeEditorComponent.prototype, "codeChange", void 0);
@@ -5547,6 +5563,29 @@ var CodeMirror6Core = /** @class */ (function (_super) {
5547
5563
  this._codeReceivedBeforeViewCreation = code;
5548
5564
  }
5549
5565
  };
5566
+ CodeMirror6Core.prototype.setCodeWithCursorPreservation = function (code) {
5567
+ if (CodeMirror6Core._editorView) {
5568
+ var currentCode = CodeMirror6Core._editorView.state.doc.toString();
5569
+ // Só atualiza se o conteúdo for realmente diferente
5570
+ if (currentCode !== code) {
5571
+ var currentSelection = CodeMirror6Core._editorView.state.selection.main;
5572
+ CodeMirror6Core.updateEditorView({
5573
+ changes: {
5574
+ from: 0,
5575
+ to: CodeMirror6Core._editorView.state.doc.length,
5576
+ insert: code
5577
+ },
5578
+ selection: {
5579
+ anchor: Math.min(currentSelection.anchor, code.length),
5580
+ head: Math.min(currentSelection.head, code.length)
5581
+ }
5582
+ });
5583
+ }
5584
+ }
5585
+ else {
5586
+ this._codeReceivedBeforeViewCreation = code;
5587
+ }
5588
+ };
5550
5589
  CodeMirror6Core.$onCompletionItemsUpdate = new Subject();
5551
5590
  CodeMirror6Core._ngUnsubscribe = new Subject();
5552
5591
  CodeMirror6Core._editorView = null;