@sheetxl/sdk 0.8.0-beta.6 → 0.8.0-beta.9

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 (115) hide show
  1. package/browser/cjs/BAtZ8a7H7zsRvWqe.cjs +90 -0
  2. package/browser/cjs/CQPMWBxBUmkORmxV.cjs +1 -0
  3. package/browser/cjs/{CMrcyRRWS0gjwpr2.cjs → CvQ1tIq7wZ7HIGPq.cjs} +1 -1
  4. package/browser/cjs/CwvGOe42j8KpAF0v.cjs +1 -0
  5. package/browser/cjs/{KMBs7XyoINajcR-L.cjs → DCOqoH-T4Ux_1dQj.cjs} +1 -1
  6. package/browser/cjs/index.cjs +2 -2
  7. package/browser/esm/{7_M82_Otn5kHQ0qd.mjs → BdHD3v-u8irI1XhZ.mjs} +2 -2
  8. package/browser/esm/{DRsp6JAObqXYGvhz.mjs → C8btlUQcQwNyzHY3.mjs} +2 -2
  9. package/browser/esm/{CfoNUsKHL7SzfO8c.mjs → CF3VfWX7bJu8kO_Z.mjs} +2 -2
  10. package/browser/esm/{DBjWjEUK9qrHG5VD.mjs → D3ll0ybMQOP4uPyW.mjs} +1 -1
  11. package/browser/esm/{CEk-nufZXNFx5jDl.mjs → DXmFrSnh3xSBfoD7.mjs} +9233 -8740
  12. package/browser/esm/{iLZfKwfSx5bQgCOp.mjs → DzgIc4oyekwA-fkl.mjs} +96 -96
  13. package/browser/esm/{J1egfq2ajlXPw3Ki.mjs → Iw280tlGmTHKDqzd.mjs} +2 -2
  14. package/browser/esm/index.mjs +920 -593
  15. package/node/esm/{BMtLBfP7JzIsG9_G.mjs → B_FOXd5PSfVcg0ED.mjs} +1 -1
  16. package/node/esm/{CynxiHhVY9UGe_h6.mjs → BzgnLKSVfN-mrMSW.mjs} +1 -1
  17. package/node/esm/{DYRjFZ75QYgmgEWF.mjs → D4PsEIRHxAahp5kn.mjs} +1 -1
  18. package/node/esm/{DpyQm1VnGyCmRRKJ.mjs → dinqlP3jU8gDOjso.mjs} +1 -1
  19. package/node/esm/index.mjs +10520 -9698
  20. package/package.json +7 -6
  21. package/resources/locales/de/model.msg.json +19 -0
  22. package/resources/locales/en/model.msg.json +25 -0
  23. package/types/scripting-api.json +7337 -6890
  24. package/types/scripting-enums.json +101 -21
  25. package/types/scripting.d.ts +1961 -466
  26. package/types/src/calculation/Calculation.d.ts +37 -45
  27. package/types/src/calculation/grid/CalcGrid.d.ts +12 -4
  28. package/types/src/calculation/grid/CalcGridBackend.d.ts +0 -6
  29. package/types/src/calculation/grid/CalcGridProxy.d.ts +1 -6
  30. package/types/src/calculation/grid/ICalcGrid.d.ts +12 -4
  31. package/types/src/calculation/grid/_CalcRequest.d.ts +4 -9
  32. package/types/src/cell/ICell.d.ts +3 -3
  33. package/types/src/cell/ICellHeader.d.ts +24 -2
  34. package/types/src/cellRange/ICellRange.d.ts +67 -3
  35. package/types/src/cellRange/ICellRanges.d.ts +12 -12
  36. package/types/src/chart/Chart.d.ts +2 -13
  37. package/types/src/condition/AnchoredConditional.d.ts +2 -0
  38. package/types/src/condition/BuiltInOperators/ColorOperator.d.ts +4 -0
  39. package/types/src/condition/BuiltInOperators/IconOperator.d.ts +4 -0
  40. package/types/src/condition/ICondition.d.ts +36 -28
  41. package/types/src/condition/_ConditionUtils.d.ts +32 -8
  42. package/types/src/fill/IFill.d.ts +46 -11
  43. package/types/src/fill/IStroke.d.ts +34 -42
  44. package/types/src/filter/IFilter.d.ts +51 -6
  45. package/types/src/hyperlink/IHyperlink.d.ts +8 -0
  46. package/types/src/index.d.ts +1 -0
  47. package/types/src/movable/AbstractMovableContent.d.ts +6 -0
  48. package/types/src/movable/FormControl.d.ts +206 -0
  49. package/types/src/movable/IFormControl.d.ts +424 -0
  50. package/types/src/movable/IMovable.d.ts +37 -8
  51. package/types/src/movable/IMovableCollection.d.ts +19 -1
  52. package/types/src/movable/Movable.d.ts +20 -0
  53. package/types/src/movable/MovableContentRegistry.d.ts +64 -0
  54. package/types/src/movable/_BuiltInContents.d.ts +2 -0
  55. package/types/src/movable/_DrawnBounds.d.ts +33 -0
  56. package/types/src/movable/_RotatedFrame.d.ts +20 -0
  57. package/types/src/movable/index.d.ts +6 -4
  58. package/types/src/numFmt/BuiltInFormats.d.ts +5 -0
  59. package/types/src/numFmt/_NumFmtUtils.d.ts +0 -1
  60. package/types/src/numFmt/vendor/numfmt/_sheetxl.d.ts +6 -0
  61. package/types/src/outline/IOutline.d.ts +186 -0
  62. package/types/src/outline/Outline.d.ts +157 -0
  63. package/types/src/outline/index.d.ts +2 -0
  64. package/types/src/shape/GeometryPreset.d.ts +197 -0
  65. package/types/src/shape/IGeometry.d.ts +398 -0
  66. package/types/src/shape/IShape.d.ts +177 -204
  67. package/types/src/shape/Shape.d.ts +39 -13
  68. package/types/src/shape/ShapeStyleUtils.d.ts +48 -0
  69. package/types/src/shape/_Geometry.d.ts +14 -0
  70. package/types/src/shape/_GeometryLoader.d.ts +21 -0
  71. package/types/src/shape/_builtIn/_BuiltInChunks.d.ts +10 -0
  72. package/types/src/shape/_builtIn/_BuiltInDef.d.ts +9 -0
  73. package/types/src/shape/_builtIn/arrows.d.ts +6 -0
  74. package/types/src/shape/_builtIn/basic.d.ts +6 -0
  75. package/types/src/shape/_builtIn/callouts.d.ts +6 -0
  76. package/types/src/shape/_builtIn/flowchart.d.ts +6 -0
  77. package/types/src/shape/_builtIn/lines.d.ts +6 -0
  78. package/types/src/shape/_builtIn/math.d.ts +6 -0
  79. package/types/src/shape/_builtIn/other.d.ts +6 -0
  80. package/types/src/shape/_builtIn/rectangles.d.ts +6 -0
  81. package/types/src/shape/_builtIn/starsBanners.d.ts +6 -0
  82. package/types/src/shape/geometry/_strokeEnds.d.ts +7 -0
  83. package/types/src/shape/geometry/format.d.ts +3 -0
  84. package/types/src/shape/geometry/geometry.d.ts +84 -0
  85. package/types/src/shape/geometry/guides.d.ts +54 -0
  86. package/types/src/shape/geometry/handles.d.ts +14 -0
  87. package/types/src/shape/geometry/index.d.ts +7 -0
  88. package/types/src/shape/geometry/lineEnds.d.ts +53 -0
  89. package/types/src/shape/geometry/paths.d.ts +35 -0
  90. package/types/src/shape/geometry/segments.d.ts +114 -0
  91. package/types/src/shape/index.d.ts +2 -0
  92. package/types/src/sheet/ISheet.d.ts +10 -45
  93. package/types/src/sheet/Sheet.d.ts +19 -5
  94. package/types/src/sheet/SheetRange.d.ts +16 -1
  95. package/types/src/sheet/_SheetUtils.d.ts +10 -2
  96. package/types/src/sheetHeader/ISheetHeader.d.ts +4 -0
  97. package/types/src/sheetHeader/SheetCellHeader.d.ts +4 -0
  98. package/types/src/sheetHeader/SheetHeader.d.ts +10 -0
  99. package/types/src/sheetHeader/_HeaderUtils.d.ts +3 -1
  100. package/types/src/sheetView/ISheetView.d.ts +17 -0
  101. package/types/src/sheetView/SheetView.d.ts +4 -0
  102. package/types/src/table/AnchoredTable.d.ts +7 -2
  103. package/types/src/text/IText.d.ts +182 -0
  104. package/types/src/text/ITextFrame.d.ts +85 -0
  105. package/types/src/text/TextRotation.d.ts +3 -3
  106. package/types/src/text/TextStacked.d.ts +2 -2
  107. package/types/src/theme/ITheme.d.ts +24 -0
  108. package/types/src/workbook/Workbook.d.ts +16 -5
  109. package/browser/cjs/-wfVn4ubg563jjqj.cjs +0 -93
  110. package/browser/cjs/B2GVAGA-CBeu_7U4.cjs +0 -1
  111. package/browser/cjs/DFKGFVvoELb8_p_B.cjs +0 -1
  112. package/types/src/movable/Control.d.ts +0 -55
  113. package/types/src/movable/IControl.d.ts +0 -86
  114. package/types/src/movable/IGroup.d.ts +0 -30
  115. package/types/src/shape/_ShapeXml.d.ts +0 -28
@@ -39,10 +39,11 @@ export interface IMovable extends IAnchored, ITransaction.ITransactional, IHisto
39
39
  * | `'chart'` | {@link IChart} |
40
40
  * | `'shape'` | {@link IShape} — text boxes, callouts, connectors and groups |
41
41
  * | `'slicer'` | {@link ISlicer} |
42
- * | `'control'` | {@link IControl} — a form control |
42
+ * | `'checkBox'`, `'button'`, `'scrollBar'`, … | {@link IFormControl} — a form control, one type per kind ({@link IFormControl.Type}) |
43
43
  *
44
- * Anything else is content that is positioned and saved but not modeled; it answers
45
- * {@link IMovable.IContent} and nothing more.
44
+ * A host adds kinds of its own through {@link MovableContentRegistry}. Anything else is content
45
+ * that is positioned and saved but not modeled; it answers {@link IMovable.IContent} and nothing
46
+ * more.
46
47
  *
47
48
  * The content owns what identifies it: its name, its description and its id. The movable owns
48
49
  * where it is drawn. To remove both, delete the content.
@@ -77,11 +78,12 @@ export interface IMovable extends IAnchored, ITransaction.ITransactional, IHisto
77
78
  */
78
79
  isSelected: () => boolean;
79
80
  /**
80
- * Set the absolution position of a movable in pixels.
81
+ * Set the position and size of the movable's unrotated frame, in pixels.
81
82
  * @param bounds The new bounds.
82
83
  *
83
84
  * @remarks
84
- * If only some of the points are provided then only those will be moved.
85
+ * If only some of the points are provided then only those will be moved. The frame is what
86
+ * {@link getBounds} returns; the cells the movable is anchored to follow from it and the rotation.
85
87
  */
86
88
  setBounds(bounds: Partial<Bounds>, options?: ITransaction.OperationOptions): IMovable;
87
89
  /**
@@ -94,7 +96,13 @@ export interface IMovable extends IAnchored, ITransaction.ITransactional, IHisto
94
96
  */
95
97
  scrollIntoView: (options?: globalThis.ScrollIntoViewOptions | boolean) => Promise<boolean>;
96
98
  /**
97
- * Returns the absolute bounds of the movable object in pixels or `null` if not yet laid out.
99
+ * Returns the movable's unrotated frame in pixels, or `null` if not yet laid out.
100
+ *
101
+ * @remarks
102
+ * The frame is the box the movable is drawn in before it is turned by {@link getRotation}, about
103
+ * its center. A rotated movable is anchored to the cells of the box it occupies as rotated,
104
+ * which Excel takes to be the frame with its width and height swapped when the rotation is within
105
+ * 45° of 90° or 270°, and the frame itself otherwise.
98
106
  */
99
107
  getBounds(): Bounds | null;
100
108
  /**
@@ -107,12 +115,16 @@ export interface IMovable extends IAnchored, ITransaction.ITransactional, IHisto
107
115
  */
108
116
  isHidden(): boolean;
109
117
  /**
110
- * Set the rotation in degrees.
118
+ * Set the rotation in degrees, clockwise about the frame's center.
119
+ *
120
+ * @remarks
121
+ * The frame keeps its position and size; the cells the movable is anchored to are those of the
122
+ * box it then occupies (see {@link getBounds}).
111
123
  */
112
124
  setRotation(rotation: number): IMovable;
113
125
  /**
114
126
  * @see
115
- * {@link setHidden}
127
+ * {@link setRotation}
116
128
  */
117
129
  getRotation(): number;
118
130
  /**
@@ -177,6 +189,23 @@ export interface IMovable extends IAnchored, ITransaction.ITransactional, IHisto
177
189
  * {@link IMovable}
178
190
  */
179
191
  export declare namespace IMovable {
192
+ /**
193
+ * A content's formulas as the calculation engine holds them: references that follow the cells
194
+ * they name through inserts, deletes, moves and sheet renames.
195
+ *
196
+ * @remarks
197
+ * Handed out by the sheet when content is created
198
+ * ({@link MovableContentRegistry.CreateOptions.holdFormulas}); a chart holds its series this way.
199
+ */
200
+ interface HeldFormulas {
201
+ /**
202
+ * The formula at `index` as it reads now, or `null` while it reads as it was handed over:
203
+ * the engine does not hold it, or nothing has moved what it names.
204
+ */
205
+ getText(index: number): string | null;
206
+ /** Takes the formulas out of the engine, as part of the current operation. */
207
+ release(): void;
208
+ }
180
209
  /**
181
210
  * What a movable draws: a chart, a picture, a shape, a slicer, a control.
182
211
  *
@@ -86,6 +86,18 @@ export declare namespace IMovableCollection {
86
86
  * @defaultValue false
87
87
  */
88
88
  fullyContained?: boolean;
89
+ /**
90
+ * Match {@link address} against what each movable paints rather than the cells it is anchored
91
+ * to: its rotation, a drawing that reaches outside its frame (a callout's tail) and its line.
92
+ * Use it to find the movables visible in a range.
93
+ *
94
+ * @remarks
95
+ * A shape's drawing is known once its geometry has been evaluated, which the search starts;
96
+ * until then it is matched by its frame, and the collection notifies a change when the answer
97
+ * is ready. Ignored with {@link fullyContained}.
98
+ * @defaultValue false
99
+ */
100
+ drawn?: boolean;
89
101
  }
90
102
  /**
91
103
  * Options for adding a movable to the collection.
@@ -112,9 +124,15 @@ export declare namespace IMovableCollection {
112
124
  */
113
125
  fromResourceId?: (resourceId: number) => IResource;
114
126
  /**
115
- * The boundary for the movable object in pixels.
127
+ * The movable's unrotated frame in pixels (see {@link IMovable.getBounds}).
116
128
  */
117
129
  bounds?: Partial<Bounds>;
130
+ /**
131
+ * The rotation in degrees, clockwise about the frame's center.
132
+ *
133
+ * @defaultValue 0
134
+ */
135
+ rotation?: number;
118
136
  /**
119
137
  * Placement hint used only when {@link bounds} is omitted. `'viewport'` centers the (default-sized)
120
138
  * movable in the visible viewport via {@link ISheet.IListeners.onRequestViewport}, falling back to the
@@ -66,10 +66,30 @@ export declare class Movable<J extends IMovable.JSON = IMovable.JSON, STATE exte
66
66
  getZIndex(): number;
67
67
  /** {@inheritDoc IMovable.setBounds} */
68
68
  setBounds(bounds: Partial<Bounds>, options?: ITransaction.OperationOptions): this;
69
+ /**
70
+ * Places the movable so that the box it occupies on the sheet as rotated is `anchorBounds`.
71
+ */
72
+ private _setAnchorBounds;
69
73
  private _updateMovableLocation;
70
74
  private _calcAbsoluteBounds;
71
75
  /** {@inheritDoc IMovable.getBounds} */
72
76
  getBounds(): Bounds | null;
77
+ /**
78
+ * The box the movable's anchor states and the box it paints, in pixels: its content's drawing,
79
+ * which can reach past the frame, turned with the frame. `null` before it is laid out.
80
+ *
81
+ * @param onReady Called when the content has a newer answer than the one returned.
82
+ * @internal
83
+ */
84
+ _getDrawnBounds(onReady: () => void): {
85
+ anchor: Bounds;
86
+ drawn: Bounds;
87
+ } | null;
88
+ /**
89
+ * The box the movable occupies on the sheet as rotated, which its anchor states; the frame is
90
+ * this box with its sides swapped within 45° of a quarter turn.
91
+ */
92
+ private _getAnchorBounds;
73
93
  /** {@inheritDoc IMovable.setAnchorType} */
74
94
  setAnchorType(type: IAnchored.Type): this;
75
95
  protected _processContainerShift(options: Anchored.ShiftOptions): IRange.Coords | null | void;
@@ -0,0 +1,64 @@
1
+ import { IResource, IResourceCollection } from '../resource';
2
+ import { ICellRange } from '../cellRange';
3
+ import { IMovable } from './IMovable';
4
+ import { AbstractMovableContent } from './AbstractMovableContent';
5
+ /**
6
+ * The kinds of content a movable can place, by type, and how each is created.
7
+ *
8
+ * @remarks
9
+ * A sheet creates a movable's content from its JSON by looking the content's `type` up here. The
10
+ * built-in kinds (picture, chart, shape, slicer, the form controls) are registered when the SDK
11
+ * loads; a host registers its own the same way, and from then on a workbook that carries that
12
+ * type creates the host's content, saves it through its `toJSON`, and offers it to the UI under
13
+ * the same type (`registerMovableRenderer` in `@sheetxl/react`).
14
+ *
15
+ * A type nobody has registered still loads and saves: it becomes an unmodeled content that
16
+ * carries its JSON as it was.
17
+ */
18
+ export declare namespace MovableContentRegistry {
19
+ /**
20
+ * What a movable's content is given when created.
21
+ */
22
+ interface CreateOptions extends AbstractMovableContent.ConstructorOptions<any> {
23
+ /** The content's type, as registered. */
24
+ type: string;
25
+ /** The content's JSON, as saved. */
26
+ json?: any;
27
+ /** Returns an IResource from the resourceId or null if not found. */
28
+ fromResourceId?: (resourceId: number) => IResource;
29
+ /** Useful for load/save/copying. */
30
+ beginPersistResource: () => IResourceCollection.IPersistScope<IResource.JSON>;
31
+ /** Allow for the default lock aspect ratio to be overwritten. */
32
+ defaultLockAspectRatio?: boolean;
33
+ /** Resolves an address against the workbook the content lives in. */
34
+ getRange: (address: string) => ICellRange | null;
35
+ /** Hands formulas to the calculation engine so they follow structural edits. */
36
+ holdFormulas: (getExpressions: () => readonly string[]) => IMovable.HeldFormulas;
37
+ }
38
+ /**
39
+ * What a movable needs of its content: {@link IMovable.IContent}, and that it can be saved.
40
+ */
41
+ interface Content extends IMovable.IContent {
42
+ toJSON(toResourceId?: (resource: IResource) => number | null): any;
43
+ }
44
+ /**
45
+ * Creates the content of one kind.
46
+ */
47
+ type Factory = (options: CreateOptions) => Content;
48
+ /**
49
+ * Registers how a kind of content is created, replacing any earlier registration.
50
+ *
51
+ * @param type The content type (`IMovable.IContent.getType()`).
52
+ * @returns A function that removes the registration.
53
+ */
54
+ function register(type: string, factory: Factory): () => void;
55
+ /**
56
+ * The factory for a kind of content, or `undefined` if none is registered.
57
+ */
58
+ function get(type: string): Factory | undefined;
59
+ /**
60
+ * The registered types.
61
+ */
62
+ function getTypes(): string[];
63
+ }
64
+ //# sourceMappingURL=MovableContentRegistry.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=_BuiltInContents.d.ts.map
@@ -0,0 +1,33 @@
1
+ import { Bounds } from '@sheetxl/utils';
2
+ /** Edges of a box in a movable's frame, in pixels; they may lie outside the frame. */
3
+ export interface FrameRect {
4
+ l: number;
5
+ t: number;
6
+ r: number;
7
+ b: number;
8
+ }
9
+ /**
10
+ * Content that can paint outside its frame (a shape: a callout's tail, its line).
11
+ *
12
+ * @remarks
13
+ * Answers synchronously from what it last evaluated, or `null` before it has; `onReady` is called
14
+ * when a newer answer is ready.
15
+ */
16
+ export interface DrawnContent {
17
+ _getDrawnRect(width: number, height: number, onReady: () => void): FrameRect | null;
18
+ }
19
+ export declare const isDrawnContent: (content: unknown) => content is DrawnContent;
20
+ /**
21
+ * The box a movable paints on the sheet: `rect` (its frame when absent), placed in the unrotated
22
+ * `frame`, turned by `rotation` degrees clockwise about the frame's center.
23
+ */
24
+ export declare const drawnBounds: (frame: Bounds, rect: FrameRect | null, rotation: number) => Bounds;
25
+ /**
26
+ * How far `drawn` reaches past `anchor` on its farthest side, in pixels; `0` when it stays inside.
27
+ */
28
+ export declare const overhang: (anchor: Bounds, drawn: Bounds) => number;
29
+ /** Whether two boxes overlap or touch. */
30
+ export declare const isBoundsIntersect: (a: Bounds, b: Bounds) => boolean;
31
+ export declare const getDrawnVersion: () => number;
32
+ export declare const bumpDrawnVersion: () => void;
33
+ //# sourceMappingURL=_DrawnBounds.d.ts.map
@@ -0,0 +1,20 @@
1
+ import { Bounds } from '@sheetxl/utils';
2
+ /**
3
+ * Whether a rotation is within 45° of a quarter turn (90° or 270°), in either direction.
4
+ *
5
+ * @remarks
6
+ * Excel's anchor of a rotated drawing is the box of the drawing as rotated, and Excel does not
7
+ * compute a true rotated bounding box: within 45° of a quarter turn the anchor is the unrotated
8
+ * frame with its width and height swapped, otherwise it is the frame itself. The same rule
9
+ * places a member rotated by a quarter turn in a group that is scaled unevenly.
10
+ */
11
+ export declare const isQuarterTurn: (rotation: number) => boolean;
12
+ /**
13
+ * Between a drawing's unrotated frame and its anchor, the box it occupies as rotated: within 45°
14
+ * of a quarter turn the sides are swapped about the same center, otherwise the box is unchanged.
15
+ *
16
+ * @remarks
17
+ * Its own inverse, so it maps a frame to its anchor and an anchor to its frame.
18
+ */
19
+ export declare const swapForRotation: (bounds: Bounds, rotation: number) => Bounds;
20
+ //# sourceMappingURL=_RotatedFrame.d.ts.map
@@ -1,8 +1,10 @@
1
- /**
2
- * @hidden
3
- */
4
- export * from './IControl';
5
1
  export * from './IMovable';
6
2
  export * from './IMovableCollection';
7
3
  export * from './IMovableSelection';
4
+ export * from './MovableContentRegistry';
5
+ export * from './AbstractMovableContent';
6
+ /**
7
+ * @hidden
8
+ */
9
+ export * from './IFormControl';
8
10
  //# sourceMappingURL=index.d.ts.map
@@ -49,6 +49,11 @@ export declare function getBuiltInFormatCode(id: number): string | undefined;
49
49
  * always returns the canonical code.
50
50
  */
51
51
  export declare function resolveNumberFormat(ref: NumberFormatRef): string;
52
+ /**
53
+ * The preset names a format may be given by (`Short Date`, `Fixed`), and the code or built-in
54
+ * id each stands for. A name is not a code: its letters are not tokens.
55
+ */
56
+ export declare const XMLFormatMap: Readonly<Record<string, string | number>>;
52
57
  /**
53
58
  * Find the built-in id Excel saves a format code as, or `undefined` if Excel
54
59
  * saves it as a custom format.
@@ -43,7 +43,6 @@ export declare function toLocaleDateCore(format: NumberFormatRef, value: number,
43
43
  fmt: string;
44
44
  date: Date;
45
45
  } | null;
46
- export declare const XMLFormatMap: Readonly<Record<string, string | number>>;
47
46
  /**
48
47
  * Returns a legacy color as an rgb value
49
48
  */
@@ -13,3 +13,9 @@ export declare function roundDisplay(value: number, places: number): number;
13
13
 
14
14
  /** §3a — `String(value)` with the exponential form expanded to plain decimal notation. */
15
15
  export declare function toDecimalString(value: number): string;
16
+
17
+ /**
18
+ * Which calendar (`date`) and clock (`time`) parts a format code evaluates, read off the
19
+ * parser. Neither for a code whose only date tokens are elapsed ones, and for an illegal code.
20
+ */
21
+ export declare function dateTimeParts(pattern: string): { readonly date: boolean, readonly time: boolean };
@@ -0,0 +1,186 @@
1
+ import { IRange } from '@sheetxl/primitives';
2
+ import { IListener } from '../listener';
3
+ import { ITransaction } from '../transaction';
4
+ /**
5
+ * The row and column groups on a sheet, and how they are laid out.
6
+ *
7
+ * @remarks
8
+ * There is no group object to create or delete. Every row and column carries an outline level,
9
+ * `0` to `7` ({@link ICellHeader.getOutlineLevel}), and a group at level *n* is a run of
10
+ * consecutive rows (or columns) whose level is *n* or more. Its summary row is the one just past
11
+ * the run, on the side {@link getSummaryDirection} names. Collapsing a group hides its detail rows.
12
+ *
13
+ * Groups are made and removed with {@link ICellRange.group} and {@link ICellRange.ungroup}, or
14
+ * from the sheet's formulas with {@link autoOutline}, and collapsed and expanded with
15
+ * {@link ICellRange.hideGroupDetails} and {@link ICellRange.showGroupDetails}. Whether the symbols are drawn
16
+ * is the view's: {@link ISheetView.setShowOutlineSymbols}.
17
+ *
18
+ * The counterpart of Excel's `Worksheet.Outline`.
19
+ */
20
+ export interface IOutline extends IListener.ISource<IOutline, IOutline.Events> {
21
+ /**
22
+ * Where a group's summary sits: `down` or `up` for rows, `right` or `left` for columns.
23
+ *
24
+ * @defaultValue `down` for rows, `right` for columns.
25
+ */
26
+ getSummaryDirection(axis: IRange.Axis): IRange.Direction;
27
+ /**
28
+ * Sets where a group's summary sits.
29
+ *
30
+ * @throws `Error` If the direction does not belong to the axis (`left` for rows).
31
+ */
32
+ setSummaryDirection(axis: IRange.Axis, direction: IRange.Direction, options?: ITransaction.OperationOptions): this;
33
+ /**
34
+ * Whether the automatic outline styles are applied to summary rows and columns.
35
+ *
36
+ * @defaultValue false
37
+ */
38
+ isAutomaticStyles(): boolean;
39
+ /**
40
+ * Sets whether the automatic outline styles are applied.
41
+ */
42
+ setAutomaticStyles(automatic: boolean, options?: ITransaction.OperationOptions): this;
43
+ /**
44
+ * The deepest outline level in use on the axis; `0` when nothing is grouped.
45
+ */
46
+ getLevelCount(axis: IRange.Axis): number;
47
+ /**
48
+ * The groups on an axis, outermost level first and in order within a level.
49
+ *
50
+ * @param axis The axis.
51
+ * @param options Limits the groups returned.
52
+ */
53
+ getGroups(axis: IRange.Axis, options?: IOutline.GetGroupsOptions): readonly IOutline.Group[];
54
+ /**
55
+ * Expands the groups up to a level and collapses everything deeper, as the level buttons do.
56
+ *
57
+ * @param axis The axis.
58
+ * @param levels How many levels stay visible, from `1` (only the outermost summaries); more levels
59
+ * than exist shows every row or column.
60
+ *
61
+ * @remarks
62
+ * The counterpart of Excel's `Outline.ShowLevels` and Office Scripts' `showOutlineLevels`, one
63
+ * axis at a time.
64
+ */
65
+ setVisibleLevels(axis: IRange.Axis, levels: number, options?: ITransaction.OperationOptions): this;
66
+ /**
67
+ * Removes every outline level from the sheet. Hidden rows and columns stay hidden.
68
+ *
69
+ * @param axes Which levels to remove. Default `IRange.AxisSelection.Both`.
70
+ * @returns The current `IOutline`.
71
+ * @throws `Error` If the sheet is protected.
72
+ *
73
+ * @remarks
74
+ * The whole-sheet form of {@link ICellRange.clearGroups}, which is what Excel's Clear Outline
75
+ * does with one cell selected.
76
+ */
77
+ clear(axes?: IRange.AxisSelection, options?: ITransaction.OperationOptions): this;
78
+ /**
79
+ * Outlines the sheet from its formulas: a cell whose formula totals the cells on one side of it
80
+ * in its own column makes its row a summary row and those rows a group, and the same for
81
+ * columns.
82
+ *
83
+ * @returns The current `IOutline`.
84
+ * @throws `Error` If no summary rows or columns are found, or the sheet is protected.
85
+ *
86
+ * @remarks
87
+ * The counterpart of Excel's `Range.AutoOutline`, which outlines the whole sheet whatever the
88
+ * range. Any outline the sheet already has is removed first, and the summary direction of each
89
+ * axis is set to where its first summary sits: below and right, or above and left.
90
+ */
91
+ autoOutline(options?: ITransaction.OperationOptions): this;
92
+ /**
93
+ * The settings that differ from their defaults, or `null` when none do.
94
+ *
95
+ * @remarks
96
+ * The levels themselves are saved with the rows and columns, not here.
97
+ */
98
+ toJSON(): IOutline.JSON | null;
99
+ /**
100
+ * For runtime type checking.
101
+ */
102
+ readonly isIOutline: true;
103
+ }
104
+ /**
105
+ * {@inheritDoc IOutline}
106
+ * @see
107
+ * ### **Interface**
108
+ *
109
+ * {@link IOutline}
110
+ */
111
+ export declare namespace IOutline {
112
+ /**
113
+ * A group of rows or columns.
114
+ */
115
+ interface Group {
116
+ /**
117
+ * The level, from `1`; level 1 is the outermost.
118
+ */
119
+ level: number;
120
+ /**
121
+ * The first detail row or column.
122
+ */
123
+ start: number;
124
+ /**
125
+ * The last detail row or column, inclusive.
126
+ */
127
+ end: number;
128
+ /**
129
+ * The summary row or column, or `null` when the group runs to the edge of the sheet on the
130
+ * summary side.
131
+ */
132
+ summary: number | null;
133
+ /**
134
+ * Whether the details are collapsed: every one of them is hidden, whoever hid them.
135
+ *
136
+ * @remarks
137
+ * Read from the hidden details, as Excel reads it. A group whose summary is itself hidden,
138
+ * inside a collapsed outer group, reads collapsed only when it was collapsed before the outer
139
+ * one; expanding the outer group leaves such a group collapsed and opens the rest.
140
+ */
141
+ collapsed: boolean;
142
+ }
143
+ /**
144
+ * Options for {@link IOutline.getGroups}.
145
+ */
146
+ interface GetGroupsOptions {
147
+ /**
148
+ * Only this level. Omitted returns every level.
149
+ */
150
+ level?: number;
151
+ /**
152
+ * Only groups that meet the span from here (a viewport). Includes the summary.
153
+ */
154
+ from?: number;
155
+ /**
156
+ * Only groups that meet the span to here, inclusive.
157
+ */
158
+ to?: number;
159
+ }
160
+ /**
161
+ * The outline settings that differ from their defaults.
162
+ */
163
+ interface JSON {
164
+ /**
165
+ * Present, as `up`, when a group's summary row sits above its details.
166
+ */
167
+ summaryRow?: 'up';
168
+ /**
169
+ * Present, as `left`, when a group's summary column sits left of its details.
170
+ */
171
+ summaryColumn?: 'left';
172
+ /**
173
+ * Present, as `true`, when the automatic outline styles are applied.
174
+ */
175
+ automaticStyles?: true;
176
+ }
177
+ interface Events {
178
+ /**
179
+ * Called when the outline changes: its settings, a level, or which details are shown.
180
+ */
181
+ onOutlineChange?(source: IOutline): void;
182
+ }
183
+ interface IListeners extends IListener.Callbacks<IOutline, IOutline.Events> {
184
+ }
185
+ }
186
+ //# sourceMappingURL=IOutline.d.ts.map
@@ -0,0 +1,157 @@
1
+ import { IRange } from '@sheetxl/primitives';
2
+ import { RunCoords } from '@sheetxl/utils';
3
+ import { ITypes } from '../type';
4
+ import { ITransaction } from '../transaction';
5
+ import { IListener } from '../listener';
6
+ import { ISheet } from '../sheet/ISheet';
7
+ import { IOutline } from './IOutline';
8
+ import { ListenerEmitter } from '../listener/ListenerEmitter';
9
+ import { SheetHeader } from '../sheetHeader/SheetHeader';
10
+ import type * as _HeaderUtils from '../sheetHeader/_HeaderUtils';
11
+ type HeaderRun = ITypes.RunCoordValue<_HeaderUtils.CellHeaderState>;
12
+ /**
13
+ * The groups on one axis, derived from that axis's header runs.
14
+ */
15
+ interface AxisGroups {
16
+ runs: readonly HeaderRun[];
17
+ direction: IRange.Direction;
18
+ entireMax: number;
19
+ /** Per level, `byLevel[level - 1]`, ordered and non-overlapping within a level. */
20
+ byLevel: IOutline.Group[][];
21
+ }
22
+ interface State {
23
+ summaryRow: IRange.Direction;
24
+ summaryColumn: IRange.Direction;
25
+ automaticStyles: boolean;
26
+ }
27
+ /** A summary line and the detail lines it totals, found by {@link Outline.autoOutline}. */
28
+ interface SummarySpan {
29
+ summary: number;
30
+ start: number;
31
+ end: number;
32
+ }
33
+ /**
34
+ * The outline of a sheet.
35
+ *
36
+ * @remarks
37
+ * Holds only the settings. The levels and collapsed flags live on the header runs, and the groups
38
+ * are derived from those runs (runs × levels, never a row walk), cached against the run array,
39
+ * which the headers replace rather than mutate.
40
+ *
41
+ * Whether a group is collapsed is derived too, as Excel derives it: its details are all hidden,
42
+ * and either its summary is showing or the summary carries the collapsed flag. The flag is what
43
+ * tells an inner group that was collapsed from one that was merely hidden with its outer group,
44
+ * so it is recorded on every collapsed inner summary before an outer group hides it.
45
+ */
46
+ export declare class Outline implements IOutline {
47
+ protected _options: Outline.ConstructorOptions;
48
+ protected _transactions: ITransaction.IStore;
49
+ protected _id: string;
50
+ protected _emitter: ListenerEmitter<IOutline, IOutline.IListeners>;
51
+ protected _removeListeners: IListener.Remove[];
52
+ protected _closed: boolean;
53
+ protected _rowGroups: AxisGroups | null;
54
+ protected _columnGroups: AxisGroups | null;
55
+ constructor(options: Outline.ConstructorOptions);
56
+ protected _getState(): Readonly<State>;
57
+ protected _updateState(update: Partial<State>, options?: ITransaction.OperationOptions): void;
58
+ protected _header(axis: IRange.Axis): SheetHeader;
59
+ protected _sheet(): ISheet;
60
+ /**
61
+ * The structure of an outline and its settings need an unprotected sheet, whatever the
62
+ * protection allows; only showing and hiding details goes by Format Rows / Format Columns.
63
+ */
64
+ protected _assertUnlocked(): void;
65
+ /** {@inheritDoc IOutline.getSummaryDirection} */
66
+ getSummaryDirection(axis: IRange.Axis): IRange.Direction;
67
+ /** {@inheritDoc IOutline.setSummaryDirection} */
68
+ setSummaryDirection(axis: IRange.Axis, direction: IRange.Direction, options?: ITransaction.OperationOptions): this;
69
+ /** {@inheritDoc IOutline.isAutomaticStyles} */
70
+ isAutomaticStyles(): boolean;
71
+ /** {@inheritDoc IOutline.setAutomaticStyles} */
72
+ setAutomaticStyles(automatic: boolean, options?: ITransaction.OperationOptions): this;
73
+ /** {@inheritDoc IOutline.getLevelCount} */
74
+ getLevelCount(axis: IRange.Axis): number;
75
+ /** {@inheritDoc IOutline.getGroups} */
76
+ getGroups(axis: IRange.Axis, options?: IOutline.GetGroupsOptions): readonly IOutline.Group[];
77
+ /** {@inheritDoc IOutline.setVisibleLevels} */
78
+ setVisibleLevels(axis: IRange.Axis, levels: number, options?: ITransaction.OperationOptions): this;
79
+ protected _setVisibleLevels(axis: IRange.Axis, levels: number): void;
80
+ /**
81
+ * Adds `delta` to the outline level of every header in `coords`.
82
+ *
83
+ * @internal
84
+ */
85
+ _changeLevels(axis: IRange.Axis, coords: RunCoords, delta: 1 | -1, options?: ITransaction.OperationOptions): void;
86
+ /**
87
+ * Throws if any header in `coords` is already at the deepest outline level.
88
+ *
89
+ * @internal
90
+ */
91
+ _assertNotDeepest(axis: IRange.Axis, coords: RunCoords): void;
92
+ /** {@inheritDoc IOutline.clear} */
93
+ clear(axes?: IRange.AxisSelection, options?: ITransaction.OperationOptions): this;
94
+ protected _clearAxis(axis: IRange.Axis): void;
95
+ /**
96
+ * Removes the outline levels and collapsed flags from the headers in `coords`.
97
+ *
98
+ * @internal
99
+ */
100
+ _clear(axis: IRange.Axis, coords: RunCoords, options?: ITransaction.OperationOptions): void;
101
+ /**
102
+ * Collapses or expands the groups a span selects: those whose summary falls in it, or, when there
103
+ * are none, the deepest groups whose details meet it.
104
+ *
105
+ * @internal
106
+ */
107
+ _setGroupDetails(axis: IRange.Axis, coords: RunCoords, show: boolean, options?: ITransaction.OperationOptions): void;
108
+ protected _selectGroups(axis: IRange.Axis, coords: RunCoords): IOutline.Group[];
109
+ /**
110
+ * The groups nested in `group`, deeper levels only, excluding those that share its summary (one
111
+ * flag cannot tell the two apart).
112
+ */
113
+ protected _innerGroups(axis: IRange.Axis, group: IOutline.Group): IOutline.Group[];
114
+ protected _hideGroupDetails(axis: IRange.Axis, group: IOutline.Group): void;
115
+ protected _showGroupDetails(axis: IRange.Axis, group: IOutline.Group): void;
116
+ /** {@inheritDoc IOutline.autoOutline} */
117
+ autoOutline(options?: ITransaction.OperationOptions): this;
118
+ /**
119
+ * The summary lines of one axis within `scope`, and the direction their details lie in.
120
+ */
121
+ protected _findSummaries(scope: IRange.Coords, axis: IRange.Axis): {
122
+ direction: IRange.Direction;
123
+ spans: SummarySpan[];
124
+ };
125
+ protected _groups(axis: IRange.Axis): AxisGroups;
126
+ /** {@inheritDoc IListener.ISource.addListeners} */
127
+ addListeners(listeners: IOutline.IListeners, options?: IListener.Options): IListener.Remove;
128
+ /** {@inheritDoc IOutline.toJSON} */
129
+ toJSON(): IOutline.JSON | null;
130
+ /**
131
+ * Stops listening and drops the state. Terminal and not undoable.
132
+ *
133
+ * @internal
134
+ */
135
+ close(): void;
136
+ get [Symbol.toStringTag](): string;
137
+ toString(): string;
138
+ /** {@inheritDoc IOutline.isIOutline} */
139
+ get isIOutline(): true;
140
+ }
141
+ /**
142
+ * {@inheritDoc Outline}
143
+ * @see
144
+ * ### **Interface**
145
+ *
146
+ * {@link Outline}
147
+ */
148
+ export declare namespace Outline {
149
+ interface ConstructorOptions {
150
+ rowHeaders: SheetHeader;
151
+ columnHeaders: SheetHeader;
152
+ transactions?: ITransaction.IStore;
153
+ json?: IOutline.JSON | null;
154
+ }
155
+ }
156
+ export {};
157
+ //# sourceMappingURL=Outline.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from './IOutline';
2
+ //# sourceMappingURL=index.d.ts.map