@trebco/treb 29.1.2 → 29.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trebco/treb",
3
- "version": "29.1.2",
3
+ "version": "29.1.4",
4
4
  "license": "LGPL-3.0-or-later",
5
5
  "homepage": "https://treb.app",
6
6
  "repository": {
@@ -46,6 +46,13 @@ export enum TextPartFlag {
46
46
  italic = 7,
47
47
  */
48
48
 
49
+ /**
50
+ * this is an indent component. we want to keep track of this
51
+ * so we don't add it more than once if we're indenting dynamically.
52
+ * maybe this is not the way to indent.
53
+ */
54
+ indent = 8,
55
+
49
56
  }
50
57
 
51
58
  export interface TextPart {
@@ -735,11 +735,17 @@ export class TileRenderer {
735
735
  let override_formatting: string | undefined;
736
736
  let formatted = cell.editing ? '' : cell.formatted; // <-- empty on editing, to remove overflows
737
737
 
738
+ // remove existing indent, if any
739
+
740
+ if (Array.isArray(formatted)) {
741
+ formatted = formatted.filter(test => test.flag !== TextPartFlag.indent);
742
+ }
743
+
738
744
  // precalculate indent as string so we can use layout
739
745
 
740
746
  let indent = '';
741
747
  let align: HorizontalAlign|undefined;
742
-
748
+
743
749
  if (style.indent) {
744
750
 
745
751
  for (let i = 0; i < style.indent; i++) {
@@ -751,9 +757,14 @@ export class TileRenderer {
751
757
  // default might be left or right based on type
752
758
 
753
759
  if (!align) {
754
- align = (cell.type === ValueType.number || cell.calculated_type === ValueType.number) ? 'right' : 'left';
760
+ align = (
761
+ cell.type === ValueType.number ||
762
+ cell.calculated_type === ValueType.number ||
763
+ cell.type === ValueType.complex ||
764
+ cell.calculated_type === ValueType.complex
765
+ ) ? 'right' : 'left';
755
766
  }
756
-
767
+
757
768
  }
758
769
 
759
770
  if (Array.isArray(formatted)) {
@@ -767,12 +778,11 @@ export class TileRenderer {
767
778
  // this is a single line, with number formatting
768
779
 
769
780
  if (indent) {
770
-
771
781
  if (align === 'right') {
772
- formatted.push({ text: indent });
782
+ formatted.push({ text: indent, flag: TextPartFlag.indent });
773
783
  }
774
- else if (align === 'left') {
775
- formatted.unshift({ text: indent });
784
+ else if (align === 'left' || typeof align === 'undefined') {
785
+ formatted.unshift({ text: indent, flag: TextPartFlag.indent });
776
786
  }
777
787
  }
778
788
 
@@ -2081,7 +2081,7 @@ export class Grid extends GridBase {
2081
2081
 
2082
2082
  if (!area) {
2083
2083
  if (this.primary_selection.empty) { return; }
2084
- area = this.primary_selection.area;
2084
+ area = this.active_sheet.RealArea(this.primary_selection.area);
2085
2085
  }
2086
2086
 
2087
2087
  this.ExecCommand({