@searsuite/sear-plugin-selection 0.0.0-stage → 0.0.1
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/LICENSE +29 -0
- package/README.md +8 -2
- package/dist/AnalyzeSheetRangeMove.d.ts +5 -0
- package/dist/AnalyzeSheetRangeMove.d.ts.map +1 -0
- package/dist/AnalyzeSheetRangeMove.js +7 -0
- package/dist/AnalyzeSheetRangeMove.js.map +1 -0
- package/dist/GetActiveCell.d.ts +3 -0
- package/dist/GetActiveCell.d.ts.map +1 -0
- package/dist/GetActiveCell.js +7 -0
- package/dist/GetActiveCell.js.map +1 -0
- package/dist/SheetAxisDrag.d.ts +15 -0
- package/dist/SheetAxisDrag.d.ts.map +1 -0
- package/dist/SheetAxisDrag.js +42 -0
- package/dist/SheetAxisDrag.js.map +1 -0
- package/dist/SheetDragAxis.d.ts +7 -0
- package/dist/SheetDragAxis.d.ts.map +1 -0
- package/dist/SheetDragAxis.js +6 -0
- package/dist/SheetDragAxis.js.map +1 -0
- package/dist/SheetFillRangeCommand.d.ts +18 -0
- package/dist/SheetFillRangeCommand.d.ts.map +1 -0
- package/dist/SheetFillRangeCommand.js +114 -0
- package/dist/SheetFillRangeCommand.js.map +1 -0
- package/dist/SheetFillSeries.d.ts +7 -0
- package/dist/SheetFillSeries.d.ts.map +1 -0
- package/dist/SheetFillSeries.js +46 -0
- package/dist/SheetFillSeries.js.map +1 -0
- package/dist/SheetHighlightPipelineNames.d.ts +5 -0
- package/dist/SheetHighlightPipelineNames.d.ts.map +1 -0
- package/dist/SheetHighlightPipelineNames.js +9 -0
- package/dist/SheetHighlightPipelineNames.js.map +1 -0
- package/dist/SheetHighlightRegistry.d.ts +67 -0
- package/dist/SheetHighlightRegistry.d.ts.map +1 -0
- package/dist/SheetHighlightRegistry.js +114 -0
- package/dist/SheetHighlightRegistry.js.map +1 -0
- package/dist/SheetRangeDrag.d.ts +54 -0
- package/dist/SheetRangeDrag.d.ts.map +1 -0
- package/dist/SheetRangeDrag.js +631 -0
- package/dist/SheetRangeDrag.js.map +1 -0
- package/dist/SheetRangeDragCommand.d.ts +19 -0
- package/dist/SheetRangeDragCommand.d.ts.map +1 -0
- package/dist/SheetRangeDragCommand.js +15 -0
- package/dist/SheetRangeDragCommand.js.map +1 -0
- package/dist/SheetRangeMoveCommands.d.ts +12 -0
- package/dist/SheetRangeMoveCommands.d.ts.map +1 -0
- package/dist/SheetRangeMoveCommands.js +8 -0
- package/dist/SheetRangeMoveCommands.js.map +1 -0
- package/dist/SheetRangeMoveError.d.ts +12 -0
- package/dist/SheetRangeMoveError.d.ts.map +1 -0
- package/dist/SheetRangeMoveError.js +18 -0
- package/dist/SheetRangeMoveError.js.map +1 -0
- package/dist/SheetSelectionCommands.d.ts +52 -0
- package/dist/SheetSelectionCommands.d.ts.map +1 -0
- package/dist/SheetSelectionCommands.js +29 -0
- package/dist/SheetSelectionCommands.js.map +1 -0
- package/dist/SheetSelectionInteractionReducer.d.ts +13 -0
- package/dist/SheetSelectionInteractionReducer.d.ts.map +1 -0
- package/dist/SheetSelectionInteractionReducer.js +21 -0
- package/dist/SheetSelectionInteractionReducer.js.map +1 -0
- package/dist/SheetSelectionPipelineNames.d.ts +21 -0
- package/dist/SheetSelectionPipelineNames.d.ts.map +1 -0
- package/dist/SheetSelectionPipelineNames.js +28 -0
- package/dist/SheetSelectionPipelineNames.js.map +1 -0
- package/dist/SheetSelectionPointerCommand.d.ts +29 -0
- package/dist/SheetSelectionPointerCommand.d.ts.map +1 -0
- package/dist/SheetSelectionPointerCommand.js +15 -0
- package/dist/SheetSelectionPointerCommand.js.map +1 -0
- package/dist/SheetSelectionRenderSemantics.d.ts +6 -0
- package/dist/SheetSelectionRenderSemantics.d.ts.map +1 -0
- package/dist/SheetSelectionRenderSemantics.js +9 -0
- package/dist/SheetSelectionRenderSemantics.js.map +1 -0
- package/dist/createRangeMovePreview.d.ts +5 -0
- package/dist/createRangeMovePreview.d.ts.map +1 -0
- package/dist/createRangeMovePreview.js +21 -0
- package/dist/createRangeMovePreview.js.map +1 -0
- package/dist/index.d.ts +51 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +88 -0
- package/dist/index.js.map +1 -0
- package/dist/resolveAxisInsertionBoundary.d.ts +4 -0
- package/dist/resolveAxisInsertionBoundary.d.ts.map +1 -0
- package/dist/resolveAxisInsertionBoundary.js +16 -0
- package/dist/resolveAxisInsertionBoundary.js.map +1 -0
- package/dist/resolveSheetRangeMove.d.ts +5 -0
- package/dist/resolveSheetRangeMove.d.ts.map +1 -0
- package/dist/resolveSheetRangeMove.js +24 -0
- package/dist/resolveSheetRangeMove.js.map +1 -0
- package/dist/sheetHighlight/SheetHighlightPlugin.d.ts +30 -0
- package/dist/sheetHighlight/SheetHighlightPlugin.d.ts.map +1 -0
- package/dist/sheetHighlight/SheetHighlightPlugin.js +113 -0
- package/dist/sheetHighlight/SheetHighlightPlugin.js.map +1 -0
- package/dist/sheetSelection/SheetSelectionPlugin.d.ts +150 -0
- package/dist/sheetSelection/SheetSelectionPlugin.d.ts.map +1 -0
- package/dist/sheetSelection/SheetSelectionPlugin.js +1652 -0
- package/dist/sheetSelection/SheetSelectionPlugin.js.map +1 -0
- package/package.json +65 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 LIZHAOTING (Eric)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
## Liability
|
|
24
|
+
|
|
25
|
+
To the maximum extent permitted by applicable law, in no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software.
|
|
26
|
+
|
|
27
|
+
## Warranty
|
|
28
|
+
|
|
29
|
+
This software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software.
|
package/README.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @searsuite/sear-plugin-selection
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Manages Sheet selection, navigation, observations, highlights, and commands.
|
|
4
|
+
|
|
5
|
+
[API reference](https://searsuite.com/docs/ref/#sear-plugin-selection)
|
|
6
|
+
|
|
7
|
+
## Repository
|
|
8
|
+
|
|
9
|
+
Repository: [searsuite/packages/sear-plugin-selection](https://github.com/SearSuite/searsuite/tree/main/packages/sear-plugin-selection).
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type SheetRangeMoveAnalysis } from '@searsuite/sear-assembly-plugin';
|
|
2
|
+
import { type MoveSheetRangeInput } from './SheetRangeMoveCommands';
|
|
3
|
+
/** Reads the latest legal destination and owner constraints for a range move. */
|
|
4
|
+
export declare const AnalyzeSheetRangeMove: import("@searsuite/sear-assembly-commands").SheetQueryDefinition<MoveSheetRangeInput, SheetRangeMoveAnalysis>;
|
|
5
|
+
//# sourceMappingURL=AnalyzeSheetRangeMove.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnalyzeSheetRangeMove.d.ts","sourceRoot":"","sources":["../src/AnalyzeSheetRangeMove.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,iFAAiF;AACjF,eAAO,MAAM,qBAAqB,+GAEjC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AnalyzeSheetRangeMove = void 0;
|
|
4
|
+
const sear_assembly_commands_1 = require("@searsuite/sear-assembly-commands");
|
|
5
|
+
/** Reads the latest legal destination and owner constraints for a range move. */
|
|
6
|
+
exports.AnalyzeSheetRangeMove = (0, sear_assembly_commands_1.defineSheetQuery)('sheet.moveRange.analyze');
|
|
7
|
+
//# sourceMappingURL=AnalyzeSheetRangeMove.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnalyzeSheetRangeMove.js","sourceRoot":"","sources":["../src/AnalyzeSheetRangeMove.ts"],"names":[],"mappings":";;;AAAA,8EAAqE;AAIrE,iFAAiF;AACpE,QAAA,qBAAqB,GAAG,IAAA,yCAAgB,EACnD,yBAAyB,CAC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetActiveCell.d.ts","sourceRoot":"","sources":["../src/GetActiveCell.ts"],"names":[],"mappings":"AAGA,mFAAmF;AACnF,eAAO,MAAM,aAAa,0GAA+E,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetActiveCell = void 0;
|
|
4
|
+
const sear_assembly_commands_1 = require("@searsuite/sear-assembly-commands");
|
|
5
|
+
/** Reads the cell where the current selection began, including reversed ranges. */
|
|
6
|
+
exports.GetActiveCell = (0, sear_assembly_commands_1.defineSheetQuery)('sheet.selection.activeCell');
|
|
7
|
+
//# sourceMappingURL=GetActiveCell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetActiveCell.js","sourceRoot":"","sources":["../src/GetActiveCell.ts"],"names":[],"mappings":";;;AAAA,8EAAqE;AAGrE,mFAAmF;AACtE,QAAA,aAAa,GAAG,IAAA,yCAAgB,EAA+B,4BAA4B,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type SheetCommandBus } from '@searsuite/sear-assembly-commands';
|
|
2
|
+
import { type SheetMoveRange } from '@searsuite/sear-assembly-plugin';
|
|
3
|
+
import { type SheetRangeHighlight } from './SheetHighlightRegistry';
|
|
4
|
+
import { SheetDragAxis } from './SheetDragAxis';
|
|
5
|
+
/** Original block and insertion edge of one complete-axis gesture. */
|
|
6
|
+
export interface SheetAxisDragDestination {
|
|
7
|
+
readonly source: SheetMoveRange;
|
|
8
|
+
readonly axis: SheetDragAxis;
|
|
9
|
+
readonly before: number;
|
|
10
|
+
}
|
|
11
|
+
/** Anchors the insertion guide to an edge on the destination axis. */
|
|
12
|
+
export declare function createAxisDragHighlight({ axis, before }: SheetAxisDragDestination, rows: number, columns: number): SheetRangeHighlight;
|
|
13
|
+
/** Commits document reordering before updating the local selection to the moved block. */
|
|
14
|
+
export declare function commitAxisDrag(commands: SheetCommandBus, { source, axis, before }: SheetAxisDragDestination): void;
|
|
15
|
+
//# sourceMappingURL=SheetAxisDrag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SheetAxisDrag.d.ts","sourceRoot":"","sources":["../src/SheetAxisDrag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,KAAK,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAC9G,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAsB,KAAK,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,sEAAsE;AACtE,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,sEAAsE;AACtE,wBAAgB,uBAAuB,CACrC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,wBAAwB,EAC1C,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,mBAAmB,CAkBrB;AAED,0FAA0F;AAC1F,wBAAgB,cAAc,CAAC,QAAQ,EAAE,eAAe,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,wBAAwB,GAAG,IAAI,CAWlH"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAxisDragHighlight = createAxisDragHighlight;
|
|
4
|
+
exports.commitAxisDrag = commitAxisDrag;
|
|
5
|
+
const sear_assembly_commands_1 = require("@searsuite/sear-assembly-commands");
|
|
6
|
+
const SheetHighlightRegistry_1 = require("./SheetHighlightRegistry");
|
|
7
|
+
const SheetDragAxis_1 = require("./SheetDragAxis");
|
|
8
|
+
const SheetSelectionCommands_1 = require("./SheetSelectionCommands");
|
|
9
|
+
/** Anchors the insertion guide to an edge on the destination axis. */
|
|
10
|
+
function createAxisDragHighlight({ axis, before }, rows, columns) {
|
|
11
|
+
const size = axis === SheetDragAxis_1.SheetDragAxis.Row ? rows : columns;
|
|
12
|
+
const position = Math.min(size - 1, before);
|
|
13
|
+
return {
|
|
14
|
+
start: axis === SheetDragAxis_1.SheetDragAxis.Row ? [position, 0] : [0, position],
|
|
15
|
+
end: axis === SheetDragAxis_1.SheetDragAxis.Row ? [position, columns - 1] : [rows - 1, position],
|
|
16
|
+
type: 'sheet-axis-move-guide',
|
|
17
|
+
depth: 4,
|
|
18
|
+
skipHit: true,
|
|
19
|
+
edge: axis === SheetDragAxis_1.SheetDragAxis.Row
|
|
20
|
+
? before === size
|
|
21
|
+
? SheetHighlightRegistry_1.SheetHighlightEdge.Bottom
|
|
22
|
+
: SheetHighlightRegistry_1.SheetHighlightEdge.Top
|
|
23
|
+
: before === size
|
|
24
|
+
? SheetHighlightRegistry_1.SheetHighlightEdge.Right
|
|
25
|
+
: SheetHighlightRegistry_1.SheetHighlightEdge.Left,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/** Commits document reordering before updating the local selection to the moved block. */
|
|
29
|
+
function commitAxisDrag(commands, { source, axis, before }) {
|
|
30
|
+
const index = source.start[axis];
|
|
31
|
+
const count = source.end[axis] - index + 1;
|
|
32
|
+
if (before >= index && before <= index + count)
|
|
33
|
+
return;
|
|
34
|
+
commands.run(axis === SheetDragAxis_1.SheetDragAxis.Row ? sear_assembly_commands_1.MoveRowsCommand : sear_assembly_commands_1.MoveColumnsCommand, { index, count, before });
|
|
35
|
+
const destination = before > index ? before - count : before;
|
|
36
|
+
const anchor = [...source.start];
|
|
37
|
+
const focus = [...source.end];
|
|
38
|
+
anchor[axis] = destination;
|
|
39
|
+
focus[axis] = destination + count - 1;
|
|
40
|
+
commands.run(SheetSelectionCommands_1.SelectRangeCommand, { anchor, focus });
|
|
41
|
+
}
|
|
42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CAAC;AACJ,CAAC;AAED,0FAA0F;AAC1F,SAAgB,cAAc,CAAC,QAAyB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAA4B;IAC1G,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;IAC3C,IAAI,MAAM,IAAI,KAAK,IAAI,MAAM,IAAI,KAAK,GAAG,KAAK;QAAE,OAAO;IACvD,QAAQ,CAAC,GAAG,CAAC,IAAI,KAAK,6BAAa,CAAC,GAAG,CAAC,CAAC,CAAC,wCAAe,CAAC,CAAC,CAAC,2CAAkB,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;IAC1G,MAAM,WAAW,GAAG,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;IAC7D,MAAM,MAAM,GAAqB,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACnD,MAAM,KAAK,GAAqB,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAChD,MAAM,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,GAAG,WAAW,GAAG,KAAK,GAAG,CAAC,CAAC;IACtC,QAAQ,CAAC,GAAG,CAAC,2CAAkB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Canonical axes for complete row/column selection gestures. */
|
|
2
|
+
export declare const SheetDragAxis: {
|
|
3
|
+
readonly Row: 0;
|
|
4
|
+
readonly Column: 1;
|
|
5
|
+
};
|
|
6
|
+
export type SheetDragAxis = (typeof SheetDragAxis)[keyof typeof SheetDragAxis];
|
|
7
|
+
//# sourceMappingURL=SheetDragAxis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SheetDragAxis.d.ts","sourceRoot":"","sources":["../src/SheetDragAxis.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,eAAO,MAAM,aAAa;;;CAAiC,CAAC;AAC5D,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SheetDragAxis = void 0;
|
|
4
|
+
/** Canonical axes for complete row/column selection gestures. */
|
|
5
|
+
exports.SheetDragAxis = { Row: 0, Column: 1 };
|
|
6
|
+
//# sourceMappingURL=SheetDragAxis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SheetDragAxis.js","sourceRoot":"","sources":["../src/SheetDragAxis.ts"],"names":[],"mappings":";;;AAAA,iEAAiE;AACpD,QAAA,aAAa,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAW,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type SheetCommandBus, type SheetQueryRegistry } from '@searsuite/sear-assembly-commands';
|
|
2
|
+
import { type SheetClipboardTransferRegistry, type SheetFormatTransferRegistry } from '@searsuite/sear-assembly-plugin';
|
|
3
|
+
import { type SheetRowVisibility } from '@searsuite/sear-render-engine';
|
|
4
|
+
import { type CellClipboardCodecRegistry, type SheetCellInputValidationRegistry } from '@searsuite/sear-domain-cell-types';
|
|
5
|
+
import { type CellMergeMatrix } from '@searsuite/sear-plugin-cell-merge';
|
|
6
|
+
export interface SheetFillRangeInput {
|
|
7
|
+
readonly source: {
|
|
8
|
+
readonly start: readonly [number, number];
|
|
9
|
+
readonly end: readonly [number, number];
|
|
10
|
+
};
|
|
11
|
+
readonly target: readonly [number, number];
|
|
12
|
+
/** Exact copy keeps the source cell's formula text unchanged. */
|
|
13
|
+
readonly mode?: 'fill' | 'exact';
|
|
14
|
+
}
|
|
15
|
+
/** Fills cells from a selected source rectangle through the pointer destination. */
|
|
16
|
+
export declare const FillSheetRangeCommand: import("@searsuite/sear-assembly-commands").SheetCommandDefinition<SheetFillRangeInput, import("@searsuite/sear-assembly-commands").SheetCommandResult>;
|
|
17
|
+
export declare function registerSheetFillRangeCommand(commands: SheetCommandBus, queries: SheetQueryRegistry, validation: SheetCellInputValidationRegistry, codecs: CellClipboardCodecRegistry, readMerges?: () => CellMergeMatrix | null, readRowVisibility?: () => SheetRowVisibility | null, formats?: SheetFormatTransferRegistry, ownerData?: SheetClipboardTransferRegistry): void;
|
|
18
|
+
//# sourceMappingURL=SheetFillRangeCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SheetFillRangeCommand.d.ts","sourceRoot":"","sources":["../src/SheetFillRangeCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwE,KAAK,eAAe,EAAE,KAAK,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAExK,OAAO,EAAE,KAAK,8BAA8B,EAAE,KAAK,2BAA2B,EAAwF,MAAM,iCAAiC,CAAC;AAC9M,OAAO,EAAmE,KAAK,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAGzI,OAAO,EAAE,KAAK,0BAA0B,EAAE,KAAK,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AAC3H,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAGzE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC;IACxG,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,iEAAiE;IACjE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAClC;AAED,oFAAoF;AACpF,eAAO,MAAM,qBAAqB,yJAAuE,CAAC;AAE1G,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,eAAe,EAAE,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,gCAAgC,EACpG,MAAM,EAAE,0BAA0B,EAClC,UAAU,CAAC,EAAE,MAAM,eAAe,GAAG,IAAI,EACzC,iBAAiB,CAAC,EAAE,MAAM,kBAAkB,GAAG,IAAI,EACnD,OAAO,CAAC,EAAE,2BAA2B,EACrC,SAAS,CAAC,EAAE,8BAA8B,GACzC,IAAI,CAkGN"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FillSheetRangeCommand = void 0;
|
|
4
|
+
exports.registerSheetFillRangeCommand = registerSheetFillRangeCommand;
|
|
5
|
+
const sear_assembly_commands_1 = require("@searsuite/sear-assembly-commands");
|
|
6
|
+
const sear_assembly_core_1 = require("@searsuite/sear-assembly-core");
|
|
7
|
+
const sear_render_engine_1 = require("@searsuite/sear-render-engine");
|
|
8
|
+
const sear_domain_ot_1 = require("@searsuite/sear-domain-ot");
|
|
9
|
+
const sear_foundation_error_1 = require("@searsuite/sear-foundation-error");
|
|
10
|
+
const SheetFillSeries_1 = require("./SheetFillSeries");
|
|
11
|
+
/** Fills cells from a selected source rectangle through the pointer destination. */
|
|
12
|
+
exports.FillSheetRangeCommand = (0, sear_assembly_commands_1.defineSheetCommand)('sheet.selection.fillRange');
|
|
13
|
+
function registerSheetFillRangeCommand(commands, queries, validation, codecs, readMerges, readRowVisibility, formats, ownerData) {
|
|
14
|
+
commands.register(exports.FillSheetRangeCommand, (input) => {
|
|
15
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
16
|
+
const cells = queries.run(sear_render_engine_1.ReadSheetCellDataQuery, void 0);
|
|
17
|
+
const { source, target } = input;
|
|
18
|
+
const startRow = Math.min(source.start[0], target[0]);
|
|
19
|
+
const endRow = Math.max(source.end[0], target[0]);
|
|
20
|
+
const startCol = Math.min(source.start[1], target[1]);
|
|
21
|
+
const endCol = Math.max(source.end[1], target[1]);
|
|
22
|
+
if (startRow < 0 || startCol < 0 || endRow >= cells.shape[0] || endCol >= cells.shape[1])
|
|
23
|
+
throw new sear_foundation_error_1.SearError('Fill range is outside the Sheet bounds.');
|
|
24
|
+
const intersectsMerge = (_a = readMerges === null || readMerges === void 0 ? void 0 : readMerges()) === null || _a === void 0 ? void 0 : _a.getRanges().some((range) => {
|
|
25
|
+
const first = range.getPoint(0);
|
|
26
|
+
const last = range.getPoint(1);
|
|
27
|
+
return first[0] <= endRow && last[0] >= startRow && first[1] <= endCol && last[1] >= startCol;
|
|
28
|
+
});
|
|
29
|
+
if (intersectsMerge)
|
|
30
|
+
throw new sear_foundation_error_1.SearError('Cannot fill a range containing merged cells.');
|
|
31
|
+
const sourceHeight = source.end[0] - source.start[0] + 1;
|
|
32
|
+
const sourceWidth = source.end[1] - source.start[1] + 1;
|
|
33
|
+
const modulo = (value, size) => ((value % size) + size) % size;
|
|
34
|
+
const singleStep = input.mode === 'exact' || sourceHeight !== 1 || sourceWidth !== 1
|
|
35
|
+
? null : (_b = formats === null || formats === void 0 ? void 0 : formats.singleCellFillStep(source.start[0], source.start[1])) !== null && _b !== void 0 ? _b : null;
|
|
36
|
+
const seriesAxis = input.mode === 'exact' ? null
|
|
37
|
+
: sourceWidth === 1 && sourceHeight >= 2 && target[1] === source.end[1] ? 'row'
|
|
38
|
+
: sourceHeight === 1 && sourceWidth >= 2 && target[0] === source.end[0] ? 'column'
|
|
39
|
+
: singleStep != null && target[1] === source.start[1] && target[0] !== source.start[0] ? 'row'
|
|
40
|
+
: singleStep != null && target[0] === source.start[0] && target[1] !== source.start[1] ? 'column'
|
|
41
|
+
: null;
|
|
42
|
+
const seriesSource = seriesAxis === 'row'
|
|
43
|
+
? Array.from({ length: sourceHeight }, (_, index) => cells.getItem(source.start[0] + index, source.start[1]))
|
|
44
|
+
: seriesAxis === 'column'
|
|
45
|
+
? Array.from({ length: sourceWidth }, (_, index) => cells.getItem(source.start[0], source.start[1] + index))
|
|
46
|
+
: [];
|
|
47
|
+
const series = (0, SheetFillSeries_1.inferSheetFillSeries)(seriesSource, singleStep !== null && singleStep !== void 0 ? singleStep : undefined);
|
|
48
|
+
const rowVisibility = readRowVisibility === null || readRowVisibility === void 0 ? void 0 : readRowVisibility();
|
|
49
|
+
const operations = [];
|
|
50
|
+
const sourceFormats = new Map();
|
|
51
|
+
const sourceOwnerData = new Map();
|
|
52
|
+
const formatOperations = new Map();
|
|
53
|
+
const ownerDataRequests = [];
|
|
54
|
+
for (let row = startRow; row <= endRow; row += 1) {
|
|
55
|
+
if ((rowVisibility === null || rowVisibility === void 0 ? void 0 : rowVisibility.active) && rowVisibility.isRowFiltered(row))
|
|
56
|
+
continue;
|
|
57
|
+
for (let col = startCol; col <= endCol; col += 1) {
|
|
58
|
+
if (row >= source.start[0] && row <= source.end[0] && col >= source.start[1] && col <= source.end[1])
|
|
59
|
+
continue;
|
|
60
|
+
const sourceRow = source.start[0] + modulo(row - source.start[0], sourceHeight);
|
|
61
|
+
const sourceCol = source.start[1] + modulo(col - source.start[1], sourceWidth);
|
|
62
|
+
const sourceValue = cells.getItem(sourceRow, sourceCol);
|
|
63
|
+
const value = series && seriesAxis
|
|
64
|
+
? Object.assign(Object.assign({}, (0, sear_domain_ot_1.OTClone)(sourceValue)), { value: series.valueAt(seriesAxis === 'row'
|
|
65
|
+
? row - source.start[0] : col - source.start[1]) }) : sourceValue;
|
|
66
|
+
const cloned = value ? (0, sear_domain_ot_1.OTClone)(value) : null;
|
|
67
|
+
const copied = cloned && !series && input.mode !== 'exact'
|
|
68
|
+
? (_e = (_d = (_c = codecs.get(cloned.type)) === null || _c === void 0 ? void 0 : _c.rebase) === null || _d === void 0 ? void 0 : _d.call(_c, cloned, {
|
|
69
|
+
rowDelta: row - sourceRow, columnDelta: col - sourceCol,
|
|
70
|
+
})) !== null && _e !== void 0 ? _e : cloned
|
|
71
|
+
: cloned;
|
|
72
|
+
const result = validation.validate(row, col, (copied === null || copied === void 0 ? void 0 : copied.value) == null ? '' : String(copied.value));
|
|
73
|
+
if (result.reject)
|
|
74
|
+
throw new sear_foundation_error_1.SearError((_f = result.message) !== null && _f !== void 0 ? _f : 'Fill value was rejected by cell validation.', { destination: [row, col], ruleId: result.ruleId });
|
|
75
|
+
operations.push((0, sear_domain_ot_1.createUpdateCellOTOperation)([row, col], copied, cells.getItem(row, col), formats ? sear_domain_ot_1.MatrixCellUpdateIntent.Relocation : undefined));
|
|
76
|
+
const sourceKey = `${sourceRow}:${sourceCol}`;
|
|
77
|
+
const destination = { start: [row, col], end: [row, col] };
|
|
78
|
+
if (formats) {
|
|
79
|
+
let captured = sourceFormats.get(sourceKey);
|
|
80
|
+
if (!captured) {
|
|
81
|
+
captured = formats.capture({ start: [sourceRow, sourceCol], end: [sourceRow, sourceCol] });
|
|
82
|
+
sourceFormats.set(sourceKey, captured);
|
|
83
|
+
}
|
|
84
|
+
for (const plan of captured.plan(destination)) {
|
|
85
|
+
const planned = (_g = formatOperations.get(plan.target)) !== null && _g !== void 0 ? _g : [];
|
|
86
|
+
planned.push(...plan.operations);
|
|
87
|
+
formatOperations.set(plan.target, planned);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (ownerData) {
|
|
91
|
+
let captured = sourceOwnerData.get(sourceKey);
|
|
92
|
+
if (!captured) {
|
|
93
|
+
captured = ownerData.capturePortable({ start: [sourceRow, sourceCol], end: [sourceRow, sourceCol] });
|
|
94
|
+
sourceOwnerData.set(sourceKey, captured);
|
|
95
|
+
}
|
|
96
|
+
ownerDataRequests.push({ captured, destination });
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const pipeline = new sear_assembly_core_1.Pipeline(exports.FillSheetRangeCommand.id);
|
|
101
|
+
if (operations.length)
|
|
102
|
+
pipeline.addTransaction('fillRange.values', (0, sear_assembly_commands_1.createSheetTransaction)(sear_render_engine_1.SheetDataPlugin.pluginKey, operations));
|
|
103
|
+
for (const [owner, planned] of formatOperations) {
|
|
104
|
+
if (planned.length)
|
|
105
|
+
pipeline.addTransaction('fillRange.formats', (0, sear_assembly_commands_1.createSheetTransaction)(owner, planned));
|
|
106
|
+
}
|
|
107
|
+
for (const plan of (_h = ownerData === null || ownerData === void 0 ? void 0 : ownerData.planPortable(ownerDataRequests)) !== null && _h !== void 0 ? _h : []) {
|
|
108
|
+
if (plan.operations.length)
|
|
109
|
+
pipeline.addTransaction('fillRange.ownerData', (0, sear_assembly_commands_1.createSheetTransaction)(plan.target, [...plan.operations]));
|
|
110
|
+
}
|
|
111
|
+
return new sear_assembly_commands_1.PipelineExecutionCommand(exports.FillSheetRangeCommand.id, pipeline);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=SheetFillRangeCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SheetFillRangeCommand.js","sourceRoot":"","sources":["../src/SheetFillRangeCommand.ts"],"names":[],"mappings":";;;AAoBA,sEAyGC;AA7HD,8EAAwK;AACxK,sEAAyD;AAEzD,sEAAyI;AACzI,8DAAyH;AACzH,4EAA6D;AAG7D,uDAAyD;AASzD,oFAAoF;AACvE,QAAA,qBAAqB,GAAG,IAAA,2CAAkB,EAAsB,2BAA2B,CAAC,CAAC;AAE1G,SAAgB,6BAA6B,CAC3C,QAAyB,EAAE,OAA2B,EAAE,UAA4C,EACpG,MAAkC,EAClC,UAAyC,EACzC,iBAAmD,EACnD,OAAqC,EACrC,SAA0C;IAE1C,QAAQ,CAAC,QAAQ,CAAC,6BAAqB,EAAE,CAAC,KAAK,EAAE,EAA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ACL,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type CellMatrixElement } from '@searsuite/sear-domain-cell-types';
|
|
2
|
+
export interface SheetFillSeries {
|
|
3
|
+
valueAt(index: number): number | string;
|
|
4
|
+
}
|
|
5
|
+
/** Infers a constant-step series from one row or column of persisted cells. */
|
|
6
|
+
export declare function inferSheetFillSeries(source: readonly (CellMatrixElement | null)[], singleStep?: number): SheetFillSeries | null;
|
|
7
|
+
//# sourceMappingURL=SheetFillSeries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SheetFillSeries.d.ts","sourceRoot":"","sources":["../src/SheetFillSeries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAErF,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;CACzC;AAED,+EAA+E;AAC/E,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,CAAC,iBAAiB,GAAG,IAAI,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAkC/H"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.inferSheetFillSeries = inferSheetFillSeries;
|
|
4
|
+
const sear_domain_cell_types_1 = require("@searsuite/sear-domain-cell-types");
|
|
5
|
+
/** Infers a constant-step series from one row or column of persisted cells. */
|
|
6
|
+
function inferSheetFillSeries(source, singleStep) {
|
|
7
|
+
var _a;
|
|
8
|
+
if (source.length === 1 && Number.isFinite(singleStep) &&
|
|
9
|
+
((_a = source[0]) === null || _a === void 0 ? void 0 : _a.type) === sear_domain_cell_types_1.CellType.Number && typeof source[0].value === 'number') {
|
|
10
|
+
const first = source[0].value;
|
|
11
|
+
return { valueAt: (index) => first + index * singleStep };
|
|
12
|
+
}
|
|
13
|
+
if (source.length < 2)
|
|
14
|
+
return null;
|
|
15
|
+
if (source.every((cell) => (cell === null || cell === void 0 ? void 0 : cell.type) === sear_domain_cell_types_1.CellType.Number && typeof cell.value === 'number' && Number.isFinite(cell.value))) {
|
|
16
|
+
const first = source[0].value;
|
|
17
|
+
const step = source[1].value - first;
|
|
18
|
+
if (source.every((cell, index) => cell.value === first + index * step)) {
|
|
19
|
+
return { valueAt: (index) => first + index * step };
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
if (!source.every((cell) => (cell === null || cell === void 0 ? void 0 : cell.type) === sear_domain_cell_types_1.CellType.String && typeof cell.value === 'string'))
|
|
24
|
+
return null;
|
|
25
|
+
const parts = source.map((cell) => /^(.*?)(\d+)$/.exec(cell.value));
|
|
26
|
+
if (parts.some((part) => !part || !part[1]))
|
|
27
|
+
return null;
|
|
28
|
+
const prefix = parts[0][1];
|
|
29
|
+
const width = parts[0][2].length;
|
|
30
|
+
if (!parts.every((part) => part[1] === prefix && part[2].length === width))
|
|
31
|
+
return null;
|
|
32
|
+
const first = Number(parts[0][2]);
|
|
33
|
+
const step = Number(parts[1][2]) - first;
|
|
34
|
+
if (!Number.isSafeInteger(first) || !Number.isSafeInteger(step) ||
|
|
35
|
+
!parts.every((part, index) => Number(part[2]) === first + index * step))
|
|
36
|
+
return null;
|
|
37
|
+
return {
|
|
38
|
+
valueAt(index) {
|
|
39
|
+
const value = first + index * step;
|
|
40
|
+
return Number.isSafeInteger(value) && value >= 0
|
|
41
|
+
? `${prefix}${String(value).padStart(width, '0')}`
|
|
42
|
+
: `${prefix}${value}`;
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=SheetFillSeries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SheetFillSeries.js","sourceRoot":"","sources":["../src/SheetFillSeries.ts"],"names":[],"mappings":";;AA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CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,IAAK,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1F,OAAO;QACL,OAAO,CAAC,KAAK;YACX,MAAM,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC;YACnC,OAAO,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC;gBAC9C,CAAC,CAAC,GAAG,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE;gBAClD,CAAC,CAAC,GAAG,MAAM,GAAG,KAAK,EAAE,CAAC;QAC1B,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SheetHighlightPipelineNames.d.ts","sourceRoot":"","sources":["../src/SheetHighlightPipelineNames.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,oBAAY,8BAA8B;IACxC,OAAO,4BAA4B;CACpC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SheetHighlightPipelineStepName = void 0;
|
|
4
|
+
/** Observable pipeline steps owned by the generic range-highlight host. */
|
|
5
|
+
var SheetHighlightPipelineStepName;
|
|
6
|
+
(function (SheetHighlightPipelineStepName) {
|
|
7
|
+
SheetHighlightPipelineStepName["Refresh"] = "sheet-highlight.refresh";
|
|
8
|
+
})(SheetHighlightPipelineStepName || (exports.SheetHighlightPipelineStepName = SheetHighlightPipelineStepName = {}));
|
|
9
|
+
//# sourceMappingURL=SheetHighlightPipelineNames.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SheetHighlightPipelineNames.js","sourceRoot":"","sources":["../src/SheetHighlightPipelineNames.ts"],"names":[],"mappings":";;;AAAA,2EAA2E;AAC3E,IAAY,8BAEX;AAFD,WAAY,8BAA8B;IACxC,qEAAmC,CAAA;AACrC,CAAC,EAFW,8BAA8B,8CAA9B,8BAA8B,QAEzC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { SearCoreSheet } from '@searsuite/sear-assembly-core';
|
|
2
|
+
import { Platform } from '@searsuite/sear-foundation-platform';
|
|
3
|
+
import { type Point } from '@searsuite/sear-foundation-rect';
|
|
4
|
+
/** Viewport-spanning overlay guide anchored to a cell-range edge. */
|
|
5
|
+
export declare const SheetHighlightEdge: {
|
|
6
|
+
readonly Top: "top";
|
|
7
|
+
readonly Bottom: "bottom";
|
|
8
|
+
readonly Left: "left";
|
|
9
|
+
readonly Right: "right";
|
|
10
|
+
};
|
|
11
|
+
export type SheetHighlightEdge = (typeof SheetHighlightEdge)[keyof typeof SheetHighlightEdge];
|
|
12
|
+
/** A visual-only cell range supplied by an independently registered provider. */
|
|
13
|
+
export interface SheetRangeHighlight {
|
|
14
|
+
start: Point;
|
|
15
|
+
end: Point;
|
|
16
|
+
type?: string;
|
|
17
|
+
depth?: number;
|
|
18
|
+
/** Insets the visual box from the resolved cell-range boundary. */
|
|
19
|
+
inset?: number;
|
|
20
|
+
strokeWidth?: number;
|
|
21
|
+
stroke?: string;
|
|
22
|
+
fill?: string;
|
|
23
|
+
skipHit?: boolean;
|
|
24
|
+
/** Paints a transient range above the grid in the final overlay pass. */
|
|
25
|
+
overlay?: boolean;
|
|
26
|
+
edge?: SheetHighlightEdge;
|
|
27
|
+
}
|
|
28
|
+
/** Read-only sheet state made available to every range-highlight provider. */
|
|
29
|
+
export interface SheetHighlightContext {
|
|
30
|
+
searCore: SearCoreSheet;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Extension point for range decorations such as formula precedents, search
|
|
34
|
+
* results, validation errors, collaboration selections, and audit trails.
|
|
35
|
+
*/
|
|
36
|
+
export interface SheetHighlightProvider {
|
|
37
|
+
key: string;
|
|
38
|
+
getHighlights(context: SheetHighlightContext): SheetRangeHighlight[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Registry for independently replaceable sheet-range highlighters.
|
|
42
|
+
*
|
|
43
|
+
* The registry owns provider activation and change notification; the paired
|
|
44
|
+
* SheetHighlightPlugin owns scene-node creation and teardown.
|
|
45
|
+
*/
|
|
46
|
+
export declare class SheetHighlightRegistry {
|
|
47
|
+
#private;
|
|
48
|
+
private readonly platform?;
|
|
49
|
+
/** DI token for resolving SheetHighlightRegistry. */
|
|
50
|
+
static readonly symbol: unique symbol;
|
|
51
|
+
constructor(platform?: Platform | undefined);
|
|
52
|
+
/** Registers the value. */
|
|
53
|
+
register(provider: SheetHighlightProvider): () => void;
|
|
54
|
+
/** Updates the enabled. */
|
|
55
|
+
setEnabled(providerKey: string, enabled: boolean): void;
|
|
56
|
+
/**
|
|
57
|
+
* Requests a new provider evaluation when state read by a provider (for
|
|
58
|
+
* example selection, search terms, or remote cursors) changes externally.
|
|
59
|
+
*/
|
|
60
|
+
invalidate(): void;
|
|
61
|
+
/** Returns the highlights. */
|
|
62
|
+
getHighlights(context: SheetHighlightContext): SheetRangeHighlight[];
|
|
63
|
+
/** Subscribes to state changes and returns an idempotent disposer. */
|
|
64
|
+
subscribe(listener: () => void): () => void;
|
|
65
|
+
private notify;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=SheetHighlightRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SheetHighlightRegistry.d.ts","sourceRoot":"","sources":["../src/SheetHighlightRegistry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAA8B,MAAM,+BAA+B,CAAC;AAG1F,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAC/D,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAG7D,qEAAqE;A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BAAqB,GAAG,mBAAmB,EAAE;IAS3E,sEAAsE;IAC/D,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;IAQlD,OAAO,CAAC,MAAM;CAWf"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
9
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
10
|
+
};
|
|
11
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
14
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
|
+
};
|
|
16
|
+
var _SheetHighlightRegistry_providers, _SheetHighlightRegistry_enabled, _SheetHighlightRegistry_listeners;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.SheetHighlightRegistry = exports.SheetHighlightEdge = void 0;
|
|
19
|
+
const sear_foundation_error_1 = require("@searsuite/sear-foundation-error");
|
|
20
|
+
const sear_assembly_core_1 = require("@searsuite/sear-assembly-core");
|
|
21
|
+
const sear_assembly_plugin_1 = require("@searsuite/sear-assembly-plugin");
|
|
22
|
+
const sear_foundation_di_1 = require("@searsuite/sear-foundation-di");
|
|
23
|
+
const sear_foundation_platform_1 = require("@searsuite/sear-foundation-platform");
|
|
24
|
+
/** Viewport-spanning overlay guide anchored to a cell-range edge. */
|
|
25
|
+
exports.SheetHighlightEdge = { Top: 'top', Bottom: 'bottom', Left: 'left', Right: 'right' };
|
|
26
|
+
/**
|
|
27
|
+
* Registry for independently replaceable sheet-range highlighters.
|
|
28
|
+
*
|
|
29
|
+
* The registry owns provider activation and change notification; the paired
|
|
30
|
+
* SheetHighlightPlugin owns scene-node creation and teardown.
|
|
31
|
+
*/
|
|
32
|
+
let SheetHighlightRegistry = class SheetHighlightRegistry {
|
|
33
|
+
constructor(platform) {
|
|
34
|
+
this.platform = platform;
|
|
35
|
+
_SheetHighlightRegistry_providers.set(this, new Map());
|
|
36
|
+
_SheetHighlightRegistry_enabled.set(this, new Map());
|
|
37
|
+
_SheetHighlightRegistry_listeners.set(this, new Set());
|
|
38
|
+
}
|
|
39
|
+
/** Registers the value. */
|
|
40
|
+
register(provider) {
|
|
41
|
+
(0, sear_assembly_plugin_1.assertSheetContributionWrite)(this);
|
|
42
|
+
const entry = Object.freeze({ key: provider.key, getHighlights: provider.getHighlights.bind(provider) });
|
|
43
|
+
if (__classPrivateFieldGet(this, _SheetHighlightRegistry_providers, "f").has(entry.key)) {
|
|
44
|
+
throw new sear_foundation_error_1.SearError(`A sheet highlight provider named "${entry.key}" is already registered.`);
|
|
45
|
+
}
|
|
46
|
+
__classPrivateFieldGet(this, _SheetHighlightRegistry_providers, "f").set(entry.key, entry);
|
|
47
|
+
__classPrivateFieldGet(this, _SheetHighlightRegistry_enabled, "f").set(entry.key, true);
|
|
48
|
+
this.notify();
|
|
49
|
+
const registry = this;
|
|
50
|
+
return function unregisterSheetHighlightProvider() {
|
|
51
|
+
(0, sear_assembly_plugin_1.assertSheetContributionWrite)(registry);
|
|
52
|
+
if (__classPrivateFieldGet(registry, _SheetHighlightRegistry_providers, "f").get(entry.key) !== entry)
|
|
53
|
+
return;
|
|
54
|
+
__classPrivateFieldGet(registry, _SheetHighlightRegistry_providers, "f").delete(entry.key);
|
|
55
|
+
__classPrivateFieldGet(registry, _SheetHighlightRegistry_enabled, "f").delete(entry.key);
|
|
56
|
+
registry.notify();
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/** Updates the enabled. */
|
|
60
|
+
setEnabled(providerKey, enabled) {
|
|
61
|
+
(0, sear_assembly_plugin_1.assertSheetContributionWrite)(this);
|
|
62
|
+
if (!__classPrivateFieldGet(this, _SheetHighlightRegistry_providers, "f").has(providerKey) || __classPrivateFieldGet(this, _SheetHighlightRegistry_enabled, "f").get(providerKey) === enabled)
|
|
63
|
+
return;
|
|
64
|
+
__classPrivateFieldGet(this, _SheetHighlightRegistry_enabled, "f").set(providerKey, enabled);
|
|
65
|
+
this.notify();
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Requests a new provider evaluation when state read by a provider (for
|
|
69
|
+
* example selection, search terms, or remote cursors) changes externally.
|
|
70
|
+
*/
|
|
71
|
+
invalidate() {
|
|
72
|
+
this.notify();
|
|
73
|
+
}
|
|
74
|
+
/** Returns the highlights. */
|
|
75
|
+
getHighlights(context) {
|
|
76
|
+
const highlights = [];
|
|
77
|
+
__classPrivateFieldGet(this, _SheetHighlightRegistry_providers, "f").forEach((provider, key) => {
|
|
78
|
+
if (__classPrivateFieldGet(this, _SheetHighlightRegistry_enabled, "f").get(key) !== true)
|
|
79
|
+
return;
|
|
80
|
+
highlights.push(...provider.getHighlights(context));
|
|
81
|
+
});
|
|
82
|
+
return highlights;
|
|
83
|
+
}
|
|
84
|
+
/** Subscribes to state changes and returns an idempotent disposer. */
|
|
85
|
+
subscribe(listener) {
|
|
86
|
+
__classPrivateFieldGet(this, _SheetHighlightRegistry_listeners, "f").add(listener);
|
|
87
|
+
const registry = this;
|
|
88
|
+
return function unsubscribeSheetHighlightRegistry() {
|
|
89
|
+
__classPrivateFieldGet(registry, _SheetHighlightRegistry_listeners, "f").delete(listener);
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
notify() {
|
|
93
|
+
(0, sear_assembly_core_1.runOutsideCommandExecution)(() => __classPrivateFieldGet(this, _SheetHighlightRegistry_listeners, "f").forEach((listener) => {
|
|
94
|
+
var _a;
|
|
95
|
+
try {
|
|
96
|
+
listener();
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
(_a = this.platform) === null || _a === void 0 ? void 0 : _a.warn('Sheet highlight listener failed.', error);
|
|
100
|
+
}
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
exports.SheetHighlightRegistry = SheetHighlightRegistry;
|
|
105
|
+
_SheetHighlightRegistry_providers = new WeakMap();
|
|
106
|
+
_SheetHighlightRegistry_enabled = new WeakMap();
|
|
107
|
+
_SheetHighlightRegistry_listeners = new WeakMap();
|
|
108
|
+
/** DI token for resolving SheetHighlightRegistry. */
|
|
109
|
+
SheetHighlightRegistry.symbol = Symbol.for('SheetHighlightRegistry');
|
|
110
|
+
exports.SheetHighlightRegistry = SheetHighlightRegistry = __decorate([
|
|
111
|
+
(0, sear_foundation_di_1.Injectable)(),
|
|
112
|
+
__param(0, (0, sear_foundation_di_1.Inject)(sear_foundation_platform_1.Platform.symbol))
|
|
113
|
+
], SheetHighlightRegistry);
|
|
114
|
+
//# sourceMappingURL=SheetHighlightRegistry.js.map
|