@lucca-front/ng 21.3.0 → 21.3.1-rc.2

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.
Files changed (29) hide show
  1. package/fesm2022/lucca-front-ng-box.mjs +41 -4
  2. package/fesm2022/lucca-front-ng-box.mjs.map +1 -1
  3. package/fesm2022/lucca-front-ng-color.mjs +2 -2
  4. package/fesm2022/lucca-front-ng-color.mjs.map +1 -1
  5. package/fesm2022/lucca-front-ng-core-select-department.mjs +18 -11
  6. package/fesm2022/lucca-front-ng-core-select-department.mjs.map +1 -1
  7. package/fesm2022/lucca-front-ng-data-table.mjs +2 -2
  8. package/fesm2022/lucca-front-ng-data-table.mjs.map +1 -1
  9. package/fesm2022/lucca-front-ng-form-header.mjs +2 -2
  10. package/fesm2022/lucca-front-ng-form-header.mjs.map +1 -1
  11. package/fesm2022/lucca-front-ng-forms-rich-text-input.mjs +15 -5
  12. package/fesm2022/lucca-front-ng-forms-rich-text-input.mjs.map +1 -1
  13. package/fesm2022/lucca-front-ng-forms.mjs +2 -2
  14. package/fesm2022/lucca-front-ng-forms.mjs.map +1 -1
  15. package/fesm2022/lucca-front-ng-skeleton.mjs +2 -2
  16. package/fesm2022/lucca-front-ng-skeleton.mjs.map +1 -1
  17. package/fesm2022/lucca-front-ng-software-icon.mjs +1 -0
  18. package/fesm2022/lucca-front-ng-software-icon.mjs.map +1 -1
  19. package/fesm2022/lucca-front-ng-time.mjs +6 -4
  20. package/fesm2022/lucca-front-ng-time.mjs.map +1 -1
  21. package/package.json +4 -4
  22. package/schematics/lib/deprecated-mapper.js +1 -1
  23. package/schematics/lu-grid/migration.js +31 -58
  24. package/schematics/lu-grid/migration.utils.js +60 -0
  25. package/types/lucca-front-ng-box.d.ts +6 -1
  26. package/types/lucca-front-ng-core-select-department.d.ts +10 -9
  27. package/types/lucca-front-ng-form-header.d.ts +1 -1
  28. package/types/lucca-front-ng-software-icon.d.ts +2 -2
  29. package/types/lucca-front-ng-time.d.ts +1 -0
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { InjectionToken, inject, input, booleanAttribute, viewChild, ElementRef, contentChildren, signal, computed, effect, forwardRef, ChangeDetectionStrategy, ViewEncapsulation, Component, DestroyRef, ViewContainerRef, TemplateRef, viewChildren } from '@angular/core';
3
3
  import { ButtonComponent } from '@lucca-front/ng/button';
4
- import { intlInputOptions } from '@lucca-front/ng/core';
4
+ import { isNil, intlInputOptions } from '@lucca-front/ng/core';
5
5
  import { IconComponent } from '@lucca-front/ng/icon';
6
6
  import { LuTooltipTriggerDirective } from '@lucca-front/ng/tooltip';
7
7
  import { CommonModule } from '@angular/common';
@@ -58,6 +58,7 @@ class RichTextInputComponent {
58
58
  #focusedPlugin;
59
59
  #editor;
60
60
  #isRootElementInitialized;
61
+ #pendingValue;
61
62
  constructor() {
62
63
  this.#richTextFormatter = inject(RICH_TEXT_FORMATTER);
63
64
  this.#formField = inject(FormFieldComponent, { optional: true });
@@ -80,6 +81,7 @@ class RichTextInputComponent {
80
81
  this.#isTouched = signal(false, ...(ngDevMode ? [{ debugName: "#isTouched" }] : /* istanbul ignore next */ []));
81
82
  this.#focusedPlugin = 0;
82
83
  this.#isRootElementInitialized = false;
84
+ this.#pendingValue = null;
83
85
  effect(() => {
84
86
  if (this.#formField?.presentation() && this.contentPresentation()) {
85
87
  this.#editor?.setRootElement(this.contentPresentation()?.nativeElement ?? null);
@@ -109,19 +111,27 @@ class RichTextInputComponent {
109
111
  if (this.#allPlugins().length > 0) {
110
112
  this.#allPlugins()[this.#focusedPlugin].tabindex?.set(0);
111
113
  }
114
+ if (this.#pendingValue) {
115
+ this.writeValue(this.#pendingValue);
116
+ }
112
117
  }
113
118
  ngOnDestroy() {
114
119
  this.#cleanup?.();
115
120
  }
116
121
  writeValue(value) {
122
+ const editorRef = this.#editor;
123
+ if (isNil(editorRef)) {
124
+ this.#pendingValue = value;
125
+ return;
126
+ }
117
127
  const updateTags = [SKIP_DOM_SELECTION_TAG, INITIAL_UPDATE_TAG];
118
128
  if (value) {
119
- this.#editor?.update(() => {
120
- this.#richTextFormatter.parse(this.#editor, value);
129
+ editorRef.update(() => {
130
+ this.#richTextFormatter.parse(editorRef, value);
121
131
  }, { tag: updateTags });
122
132
  }
123
- else if (!this.#editor?.getEditorState().isEmpty()) {
124
- this.#editor?.update(() => {
133
+ else if (!editorRef.getEditorState().isEmpty()) {
134
+ editorRef.update(() => {
125
135
  const root = $getRoot();
126
136
  root.clear();
127
137
  }, { tag: updateTags });