@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.
@@ -4216,6 +4216,12 @@
4216
4216
  this.setCode(safeCode);
4217
4217
  }
4218
4218
  };
4219
+ CoreFacade.prototype.setPayload = function (payload) {
4220
+ var safeCode = this.getSafeCode(payload);
4221
+ // Força a atualização sem verificar _lastCodeEmitted,
4222
+ // mas preserva o cursor verificando no nível do editor
4223
+ this.setCodeWithCursorPreservation(safeCode);
4224
+ };
4219
4225
  CoreFacade.prototype.getOnCoreFinishLoadObservable = function () {
4220
4226
  return this.$onCoreFinishLoad.asObservable();
4221
4227
  };
@@ -4309,6 +4315,13 @@
4309
4315
  enumerable: true,
4310
4316
  configurable: true
4311
4317
  });
4318
+ Object.defineProperty(CodeEditorComponent.prototype, "payload", {
4319
+ set: function (payload) {
4320
+ this.coreFacade.setPayload(payload);
4321
+ },
4322
+ enumerable: true,
4323
+ configurable: true
4324
+ });
4312
4325
  CodeEditorComponent.prototype.writeValue = function (value) {
4313
4326
  this.code = value;
4314
4327
  };
@@ -4365,6 +4378,9 @@
4365
4378
  __decorate([
4366
4379
  core.Input()
4367
4380
  ], CodeEditorComponent.prototype, "code", null);
4381
+ __decorate([
4382
+ core.Input()
4383
+ ], CodeEditorComponent.prototype, "payload", null);
4368
4384
  __decorate([
4369
4385
  core.Output()
4370
4386
  ], CodeEditorComponent.prototype, "codeChange", void 0);
@@ -5693,6 +5709,29 @@
5693
5709
  this._codeReceivedBeforeViewCreation = code;
5694
5710
  }
5695
5711
  };
5712
+ CodeMirror6Core.prototype.setCodeWithCursorPreservation = function (code) {
5713
+ if (CodeMirror6Core._editorView) {
5714
+ var currentCode = CodeMirror6Core._editorView.state.doc.toString();
5715
+ // Só atualiza se o conteúdo for realmente diferente
5716
+ if (currentCode !== code) {
5717
+ var currentSelection = CodeMirror6Core._editorView.state.selection.main;
5718
+ CodeMirror6Core.updateEditorView({
5719
+ changes: {
5720
+ from: 0,
5721
+ to: CodeMirror6Core._editorView.state.doc.length,
5722
+ insert: code
5723
+ },
5724
+ selection: {
5725
+ anchor: Math.min(currentSelection.anchor, code.length),
5726
+ head: Math.min(currentSelection.head, code.length)
5727
+ }
5728
+ });
5729
+ }
5730
+ }
5731
+ else {
5732
+ this._codeReceivedBeforeViewCreation = code;
5733
+ }
5734
+ };
5696
5735
  CodeMirror6Core.$onCompletionItemsUpdate = new rxjs.Subject();
5697
5736
  CodeMirror6Core._ngUnsubscribe = new rxjs.Subject();
5698
5737
  CodeMirror6Core._editorView = null;