@acorex/components 22.4.13 → 22.4.15

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.
@@ -4,7 +4,7 @@ import { AXDecoratorIconComponent, AXDecoratorGenericComponent } from '@acorex/c
4
4
  import { AXTranslatorPipe, AXTranslationService } from '@acorex/core/translation';
5
5
  import { AsyncPipe, isPlatformBrowser } from '@angular/common';
6
6
  import * as i0 from '@angular/core';
7
- import { inject, signal, computed, Injectable, input, ViewEncapsulation, ChangeDetectionStrategy, Component, ElementRef, PLATFORM_ID, afterNextRender, effect, DestroyRef, contentChild, forwardRef, model, viewChild, NgModule } from '@angular/core';
7
+ import { inject, signal, computed, Injectable, input, ViewEncapsulation, ChangeDetectionStrategy, Component, ElementRef, PLATFORM_ID, afterNextRender, effect, DestroyRef, contentChild, numberAttribute, forwardRef, model, viewChild, NgModule } from '@angular/core';
8
8
  import { AXTextEditor, AX_TEXT_EDITOR_ZOOM_MAX, AX_TEXT_EDITOR_ZOOM_MIN, AX_TEXT_EDITOR_DEFAULT_TEXT_COLORS, AX_TEXT_EDITOR_DEFAULT_BACKGROUND_COLORS, AX_TEXT_EDITOR_ZOOM_PRESETS, AX_TEXT_EDITOR_FONT_SIZES } from '@acorex/cdk/text-editor';
9
9
  import { isEqual } from 'lodash-es';
10
10
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@@ -443,8 +443,14 @@ class AXTextEditorComponent extends classes((MXInputBaseValueComponent), MXLookC
443
443
  ...(ngDevMode ? [{ debugName: "placeHolder" }] : /* istanbul ignore next */ []));
444
444
  this.outputFormat = input('json', /* @ts-ignore */
445
445
  ...(ngDevMode ? [{ debugName: "outputFormat" }] : /* istanbul ignore next */ []));
446
- this.initialLine = input(6, /* @ts-ignore */
447
- ...(ngDevMode ? [{ debugName: "initialLine" }] : /* istanbul ignore next */ []));
446
+ /**
447
+ * Minimum height of the editable surface, measured in text lines.
448
+ *
449
+ * @defaultValue 6
450
+ */
451
+ this.initialLine = input(6, { ...(ngDevMode ? { debugName: "initialLine" } : /* istanbul ignore next */ {}), transform: numberAttribute });
452
+ this.initialLineCss = computed(() => String(Math.max(1, this.initialLine() || 6)), /* @ts-ignore */
453
+ ...(ngDevMode ? [{ debugName: "initialLineCss" }] : /* istanbul ignore next */ []));
448
454
  this.zoomFactor = computed(() => this.editorService.zoomFactor(), /* @ts-ignore */
449
455
  ...(ngDevMode ? [{ debugName: "zoomFactor" }] : /* istanbul ignore next */ []));
450
456
  this.projectedContent = computed(() => this.projected() != null, /* @ts-ignore */
@@ -475,6 +481,19 @@ class AXTextEditorComponent extends classes((MXInputBaseValueComponent), MXLookC
475
481
  blur() {
476
482
  this.editorService.blur();
477
483
  }
484
+ /**
485
+ * Replaces the editor content. Optionally focuses the editor afterward.
486
+ *
487
+ * @param value - HTML, JSON, or null to clear.
488
+ * @param focus - When true, moves the caret into the editor after the content is applied.
489
+ * @returns void
490
+ */
491
+ setContent(value, focus = false) {
492
+ this.value = value ?? '';
493
+ if (!focus)
494
+ return;
495
+ setTimeout(() => this.focus());
496
+ }
478
497
  /** @ignore */
479
498
  notifyEditorFocus(event) {
480
499
  this.emitOnFocusEvent(event);
@@ -500,7 +519,7 @@ class AXTextEditorComponent extends classes((MXInputBaseValueComponent), MXLookC
500
519
  this.editorService.setContent(value == null ? '' : value, false);
501
520
  }
502
521
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: AXTextEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
503
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.6", type: AXTextEditorComponent, isStandalone: true, selector: "ax-text-editor", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: false, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: false, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: false, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: false, isRequired: false, transformFunction: null }, look: { classPropertyName: "look", publicName: "look", isSignal: false, isRequired: false, transformFunction: null }, placeHolder: { classPropertyName: "placeHolder", publicName: "placeHolder", isSignal: true, isRequired: false, transformFunction: null }, outputFormat: { classPropertyName: "outputFormat", publicName: "outputFormat", isSignal: true, isRequired: false, transformFunction: null }, initialLine: { classPropertyName: "initialLine", publicName: "initialLine", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onBlur: "onBlur", onFocus: "onFocus", valueChange: "valueChange", stateChange: "stateChange", onValueChanged: "onValueChanged", readonlyChange: "readonlyChange", disabledChange: "disabledChange" }, host: { attributes: { "ngSkipHydration": "true" }, properties: { "style.--ax-comp-text-editor-initial-line": "initialLine()", "style.--ax-comp-text-editor-zoom": "zoomFactor()", "class.ax-state-disabled": "disabled", "class.ax-state-readonly": "readonly && !disabled" }, classAttribute: "ax-text-editor" }, providers: [
522
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.6", type: AXTextEditorComponent, isStandalone: true, selector: "ax-text-editor", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: false, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: false, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: false, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: false, isRequired: false, transformFunction: null }, look: { classPropertyName: "look", publicName: "look", isSignal: false, isRequired: false, transformFunction: null }, placeHolder: { classPropertyName: "placeHolder", publicName: "placeHolder", isSignal: true, isRequired: false, transformFunction: null }, outputFormat: { classPropertyName: "outputFormat", publicName: "outputFormat", isSignal: true, isRequired: false, transformFunction: null }, initialLine: { classPropertyName: "initialLine", publicName: "initialLine", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onBlur: "onBlur", onFocus: "onFocus", valueChange: "valueChange", stateChange: "stateChange", onValueChanged: "onValueChanged", readonlyChange: "readonlyChange", disabledChange: "disabledChange" }, host: { attributes: { "ngSkipHydration": "true" }, properties: { "style.--ax-comp-text-editor-initial-line": "initialLineCss()", "style.--ax-comp-text-editor-zoom": "zoomFactor()", "class.ax-state-disabled": "disabled", "class.ax-state-readonly": "readonly && !disabled" }, classAttribute: "ax-text-editor" }, providers: [
504
523
  AXTextEditor,
505
524
  AXTextEditorService,
506
525
  { provide: AXComponent, useExisting: AXTextEditorComponent },
@@ -524,7 +543,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImpor
524
543
  'readonlyChange',
525
544
  'disabledChange',
526
545
  ], host: {
527
- '[style.--ax-comp-text-editor-initial-line]': 'initialLine()',
546
+ '[style.--ax-comp-text-editor-initial-line]': 'initialLineCss()',
528
547
  '[style.--ax-comp-text-editor-zoom]': 'zoomFactor()',
529
548
  '[class.ax-state-disabled]': 'disabled',
530
549
  '[class.ax-state-readonly]': 'readonly && !disabled',